Updated dist files.
This commit is contained in:
parent
eddf93b200
commit
c5b411811a
69
dist/ethers-contracts.js
vendored
69
dist/ethers-contracts.js
vendored
@ -605,11 +605,27 @@ function alignSize(size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function pack(coders, values) {
|
function pack(coders, values) {
|
||||||
|
if (Array.isArray(values)) {
|
||||||
|
if (coders.length !== values.length) {
|
||||||
|
throwError('types/values mismatch', { type: type, values: values });
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (values && typeof(values) === 'object') {
|
||||||
|
var arrayValues = [];
|
||||||
|
coders.forEach(function(coder) {
|
||||||
|
arrayValues.push(values[coder.localName]);
|
||||||
|
});
|
||||||
|
values = arrayValues;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
throwError('invalid value', { type: 'tuple', values: values });
|
||||||
|
}
|
||||||
|
|
||||||
var parts = [];
|
var parts = [];
|
||||||
|
|
||||||
coders.forEach(function(coder, index) {
|
coders.forEach(function(coder, index) {
|
||||||
parts.push({ dynamic: coder.dynamic, value: coder.encode(values[index]) });
|
parts.push({ dynamic: coder.dynamic, value: coder.encode(values[index]) });
|
||||||
})
|
});
|
||||||
|
|
||||||
var staticSize = 0, dynamicSize = 0;
|
var staticSize = 0, dynamicSize = 0;
|
||||||
parts.forEach(function(part, index) {
|
parts.forEach(function(part, index) {
|
||||||
@ -757,17 +773,6 @@ function coderTuple(coders, localName) {
|
|||||||
name: 'tuple',
|
name: 'tuple',
|
||||||
type: type,
|
type: type,
|
||||||
encode: function(value) {
|
encode: function(value) {
|
||||||
if (Array.isArray(value)) {
|
|
||||||
if (coders.length !== value.length) {
|
|
||||||
throwError('types/values mismatch', { type: type, values: values });
|
|
||||||
}
|
|
||||||
|
|
||||||
// @TODO: If receiving an object, and we have names, create the array
|
|
||||||
|
|
||||||
} else {
|
|
||||||
throwError('invalid value', { type: types, values: values });
|
|
||||||
}
|
|
||||||
|
|
||||||
return pack(coders, value);
|
return pack(coders, value);
|
||||||
},
|
},
|
||||||
decode: function(data, offset) {
|
decode: function(data, offset) {
|
||||||
@ -915,29 +920,27 @@ function Interface(abi) {
|
|||||||
switch (method.type) {
|
switch (method.type) {
|
||||||
case 'constructor':
|
case 'constructor':
|
||||||
var func = (function() {
|
var func = (function() {
|
||||||
// @TODO: Move to parseParams
|
var inputParams = parseParams(method.inputs);
|
||||||
var inputTypes = getKeys(method.inputs, 'type');
|
|
||||||
var func = function(bytecode) {
|
var func = function(bytecode) {
|
||||||
if (!utils.isHexString(bytecode)) {
|
if (!utils.isHexString(bytecode)) {
|
||||||
throwError('invalid bytecode', {input: bytecode});
|
throwError('invalid bytecode', { input: bytecode });
|
||||||
}
|
}
|
||||||
|
|
||||||
var params = Array.prototype.slice.call(arguments, 1);
|
var params = Array.prototype.slice.call(arguments, 1);
|
||||||
if (params.length < inputTypes.length) {
|
if (params.length < inputParams.types.length) {
|
||||||
throwError('missing parameter');
|
throwError('missing parameter');
|
||||||
} else if (params.length > inputTypes.length) {
|
} else if (params.length > inputParams.types.length) {
|
||||||
throwError('too many parameters');
|
throwError('too many parameters');
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = {
|
var result = {
|
||||||
bytecode: bytecode + Interface.encodeParams(inputTypes, params).substring(2),
|
bytecode: bytecode + Interface.encodeParams(inputParams.names, inputParams.types, params).substring(2),
|
||||||
}
|
}
|
||||||
|
|
||||||
return populateDescription(new DeployDescription(), result);
|
return populateDescription(new DeployDescription(), result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @TODO: Move to parseParams
|
defineFrozen(func, 'inputs', inputParams);
|
||||||
defineFrozen(func, 'inputs', getKeys(method.inputs, 'name'));
|
|
||||||
|
|
||||||
return func;
|
return func;
|
||||||
})();
|
})();
|
||||||
@ -951,7 +954,6 @@ function Interface(abi) {
|
|||||||
var inputParams = parseParams(method.inputs);
|
var inputParams = parseParams(method.inputs);
|
||||||
var outputParams = parseParams(method.outputs);
|
var outputParams = parseParams(method.outputs);
|
||||||
|
|
||||||
var inputTypes = inputParams.types;
|
|
||||||
if (method.constant) {
|
if (method.constant) {
|
||||||
var outputTypes = outputParams.types;
|
var outputTypes = outputParams.types;
|
||||||
var outputNames = outputParams.names;
|
var outputNames = outputParams.names;
|
||||||
@ -971,13 +973,13 @@ function Interface(abi) {
|
|||||||
|
|
||||||
var params = Array.prototype.slice.call(arguments, 0);
|
var params = Array.prototype.slice.call(arguments, 0);
|
||||||
|
|
||||||
if (params.length < inputTypes.length) {
|
if (params.length < inputParams.types.length) {
|
||||||
throwError('missing parameter');
|
throwError('missing parameter');
|
||||||
} else if (params.length > inputTypes.length) {
|
} else if (params.length > inputParams.types.length) {
|
||||||
throwError('too many parameters');
|
throwError('too many parameters');
|
||||||
}
|
}
|
||||||
|
|
||||||
result.data = sighash + Interface.encodeParams(inputTypes, params).substring(2);
|
result.data = sighash + Interface.encodeParams(inputParams.names, inputParams.types, params).substring(2);
|
||||||
if (method.constant) {
|
if (method.constant) {
|
||||||
result.parse = function(data) {
|
result.parse = function(data) {
|
||||||
return Interface.decodeParams(
|
return Interface.decodeParams(
|
||||||
@ -992,9 +994,8 @@ function Interface(abi) {
|
|||||||
return populateDescription(new TransactionDescription(), result);
|
return populateDescription(new TransactionDescription(), result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @TODO: Move the paraseParams
|
defineFrozen(func, 'inputs', inputParams);
|
||||||
defineFrozen(func, 'inputs', getKeys(method.inputs, 'name'));
|
defineFrozen(func, 'outputs', outputParams);
|
||||||
defineFrozen(func, 'outputs', getKeys(method.outputs, 'name'));
|
|
||||||
|
|
||||||
utils.defineProperty(func, 'signature', signature);
|
utils.defineProperty(func, 'signature', signature);
|
||||||
utils.defineProperty(func, 'sighash', sighash);
|
utils.defineProperty(func, 'sighash', sighash);
|
||||||
@ -1146,12 +1147,20 @@ function Interface(abi) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
utils.defineProperty(Interface, 'encodeParams', function(types, values) {
|
utils.defineProperty(Interface, 'encodeParams', function(names, types, values) {
|
||||||
|
|
||||||
|
// Names is optional, so shift over all the parameters if not provided
|
||||||
|
if (arguments.length < 3) {
|
||||||
|
values = types;
|
||||||
|
types = names;
|
||||||
|
names = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (types.length !== values.length) { throwError('types/values mismatch', {types: types, values: values}); }
|
if (types.length !== values.length) { throwError('types/values mismatch', {types: types, values: values}); }
|
||||||
|
|
||||||
var coders = [];
|
var coders = [];
|
||||||
types.forEach(function(type) {
|
types.forEach(function(type, index) {
|
||||||
coders.push(getParamCoder(type));
|
coders.push(getParamCoder(type, (names ? names[index]: undefined)));
|
||||||
});
|
});
|
||||||
|
|
||||||
return utils.hexlify(coderTuple(coders).encode(values));
|
return utils.hexlify(coderTuple(coders).encode(values));
|
||||||
|
6
dist/ethers-contracts.min.js
vendored
6
dist/ethers-contracts.min.js
vendored
File diff suppressed because one or more lines are too long
69
dist/ethers.js
vendored
69
dist/ethers.js
vendored
@ -7212,11 +7212,27 @@ function alignSize(size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function pack(coders, values) {
|
function pack(coders, values) {
|
||||||
|
if (Array.isArray(values)) {
|
||||||
|
if (coders.length !== values.length) {
|
||||||
|
throwError('types/values mismatch', { type: type, values: values });
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (values && typeof(values) === 'object') {
|
||||||
|
var arrayValues = [];
|
||||||
|
coders.forEach(function(coder) {
|
||||||
|
arrayValues.push(values[coder.localName]);
|
||||||
|
});
|
||||||
|
values = arrayValues;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
throwError('invalid value', { type: 'tuple', values: values });
|
||||||
|
}
|
||||||
|
|
||||||
var parts = [];
|
var parts = [];
|
||||||
|
|
||||||
coders.forEach(function(coder, index) {
|
coders.forEach(function(coder, index) {
|
||||||
parts.push({ dynamic: coder.dynamic, value: coder.encode(values[index]) });
|
parts.push({ dynamic: coder.dynamic, value: coder.encode(values[index]) });
|
||||||
})
|
});
|
||||||
|
|
||||||
var staticSize = 0, dynamicSize = 0;
|
var staticSize = 0, dynamicSize = 0;
|
||||||
parts.forEach(function(part, index) {
|
parts.forEach(function(part, index) {
|
||||||
@ -7364,17 +7380,6 @@ function coderTuple(coders, localName) {
|
|||||||
name: 'tuple',
|
name: 'tuple',
|
||||||
type: type,
|
type: type,
|
||||||
encode: function(value) {
|
encode: function(value) {
|
||||||
if (Array.isArray(value)) {
|
|
||||||
if (coders.length !== value.length) {
|
|
||||||
throwError('types/values mismatch', { type: type, values: values });
|
|
||||||
}
|
|
||||||
|
|
||||||
// @TODO: If receiving an object, and we have names, create the array
|
|
||||||
|
|
||||||
} else {
|
|
||||||
throwError('invalid value', { type: types, values: values });
|
|
||||||
}
|
|
||||||
|
|
||||||
return pack(coders, value);
|
return pack(coders, value);
|
||||||
},
|
},
|
||||||
decode: function(data, offset) {
|
decode: function(data, offset) {
|
||||||
@ -7522,29 +7527,27 @@ function Interface(abi) {
|
|||||||
switch (method.type) {
|
switch (method.type) {
|
||||||
case 'constructor':
|
case 'constructor':
|
||||||
var func = (function() {
|
var func = (function() {
|
||||||
// @TODO: Move to parseParams
|
var inputParams = parseParams(method.inputs);
|
||||||
var inputTypes = getKeys(method.inputs, 'type');
|
|
||||||
var func = function(bytecode) {
|
var func = function(bytecode) {
|
||||||
if (!utils.isHexString(bytecode)) {
|
if (!utils.isHexString(bytecode)) {
|
||||||
throwError('invalid bytecode', {input: bytecode});
|
throwError('invalid bytecode', { input: bytecode });
|
||||||
}
|
}
|
||||||
|
|
||||||
var params = Array.prototype.slice.call(arguments, 1);
|
var params = Array.prototype.slice.call(arguments, 1);
|
||||||
if (params.length < inputTypes.length) {
|
if (params.length < inputParams.types.length) {
|
||||||
throwError('missing parameter');
|
throwError('missing parameter');
|
||||||
} else if (params.length > inputTypes.length) {
|
} else if (params.length > inputParams.types.length) {
|
||||||
throwError('too many parameters');
|
throwError('too many parameters');
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = {
|
var result = {
|
||||||
bytecode: bytecode + Interface.encodeParams(inputTypes, params).substring(2),
|
bytecode: bytecode + Interface.encodeParams(inputParams.names, inputParams.types, params).substring(2),
|
||||||
}
|
}
|
||||||
|
|
||||||
return populateDescription(new DeployDescription(), result);
|
return populateDescription(new DeployDescription(), result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @TODO: Move to parseParams
|
defineFrozen(func, 'inputs', inputParams);
|
||||||
defineFrozen(func, 'inputs', getKeys(method.inputs, 'name'));
|
|
||||||
|
|
||||||
return func;
|
return func;
|
||||||
})();
|
})();
|
||||||
@ -7558,7 +7561,6 @@ function Interface(abi) {
|
|||||||
var inputParams = parseParams(method.inputs);
|
var inputParams = parseParams(method.inputs);
|
||||||
var outputParams = parseParams(method.outputs);
|
var outputParams = parseParams(method.outputs);
|
||||||
|
|
||||||
var inputTypes = inputParams.types;
|
|
||||||
if (method.constant) {
|
if (method.constant) {
|
||||||
var outputTypes = outputParams.types;
|
var outputTypes = outputParams.types;
|
||||||
var outputNames = outputParams.names;
|
var outputNames = outputParams.names;
|
||||||
@ -7578,13 +7580,13 @@ function Interface(abi) {
|
|||||||
|
|
||||||
var params = Array.prototype.slice.call(arguments, 0);
|
var params = Array.prototype.slice.call(arguments, 0);
|
||||||
|
|
||||||
if (params.length < inputTypes.length) {
|
if (params.length < inputParams.types.length) {
|
||||||
throwError('missing parameter');
|
throwError('missing parameter');
|
||||||
} else if (params.length > inputTypes.length) {
|
} else if (params.length > inputParams.types.length) {
|
||||||
throwError('too many parameters');
|
throwError('too many parameters');
|
||||||
}
|
}
|
||||||
|
|
||||||
result.data = sighash + Interface.encodeParams(inputTypes, params).substring(2);
|
result.data = sighash + Interface.encodeParams(inputParams.names, inputParams.types, params).substring(2);
|
||||||
if (method.constant) {
|
if (method.constant) {
|
||||||
result.parse = function(data) {
|
result.parse = function(data) {
|
||||||
return Interface.decodeParams(
|
return Interface.decodeParams(
|
||||||
@ -7599,9 +7601,8 @@ function Interface(abi) {
|
|||||||
return populateDescription(new TransactionDescription(), result);
|
return populateDescription(new TransactionDescription(), result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @TODO: Move the paraseParams
|
defineFrozen(func, 'inputs', inputParams);
|
||||||
defineFrozen(func, 'inputs', getKeys(method.inputs, 'name'));
|
defineFrozen(func, 'outputs', outputParams);
|
||||||
defineFrozen(func, 'outputs', getKeys(method.outputs, 'name'));
|
|
||||||
|
|
||||||
utils.defineProperty(func, 'signature', signature);
|
utils.defineProperty(func, 'signature', signature);
|
||||||
utils.defineProperty(func, 'sighash', sighash);
|
utils.defineProperty(func, 'sighash', sighash);
|
||||||
@ -7753,12 +7754,20 @@ function Interface(abi) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
utils.defineProperty(Interface, 'encodeParams', function(types, values) {
|
utils.defineProperty(Interface, 'encodeParams', function(names, types, values) {
|
||||||
|
|
||||||
|
// Names is optional, so shift over all the parameters if not provided
|
||||||
|
if (arguments.length < 3) {
|
||||||
|
values = types;
|
||||||
|
types = names;
|
||||||
|
names = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (types.length !== values.length) { throwError('types/values mismatch', {types: types, values: values}); }
|
if (types.length !== values.length) { throwError('types/values mismatch', {types: types, values: values}); }
|
||||||
|
|
||||||
var coders = [];
|
var coders = [];
|
||||||
types.forEach(function(type) {
|
types.forEach(function(type, index) {
|
||||||
coders.push(getParamCoder(type));
|
coders.push(getParamCoder(type, (names ? names[index]: undefined)));
|
||||||
});
|
});
|
||||||
|
|
||||||
return utils.hexlify(coderTuple(coders).encode(values));
|
return utils.hexlify(coderTuple(coders).encode(values));
|
||||||
|
6
dist/ethers.min.js
vendored
6
dist/ethers.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ethers",
|
"name": "ethers",
|
||||||
"version": "2.1.5",
|
"version": "2.2.0",
|
||||||
"description": "Ethereum wallet library.",
|
"description": "Ethereum wallet library.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -10,7 +10,7 @@
|
|||||||
"version": "grunt dist"
|
"version": "grunt dist"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ethers-contracts": "2.1.10",
|
"ethers-contracts": "2.2.0",
|
||||||
"ethers-providers": "2.1.16",
|
"ethers-providers": "2.1.16",
|
||||||
"ethers-utils": "2.1.9",
|
"ethers-utils": "2.1.9",
|
||||||
"ethers-wallet": "2.1.7"
|
"ethers-wallet": "2.1.7"
|
||||||
|
Loading…
Reference in New Issue
Block a user