Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return resolveAddresses(contract.signer || contract.provider, params, method.inputs).then(function (params) {
tx.data = contract.interface.encodeFunctionData(method, params);
if (method.constant || options.callStatic) {
// Call (constant functions) always cost 0 ether
if (options.estimate) {
return Promise.resolve(constants_1.Zero);
}
if (!contract.provider && !contract.signer) {
logger.throwError("call (constant functions) require a provider or signer", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: "call" });
}
// Check overrides make sense
["gasLimit", "gasPrice", "value"].forEach(function (key) {
if (tx[key] != null) {
throw new Error("call cannot override " + key);
}
});
if (options.transaction) {
return properties_1.resolveProperties(tx);
}
return (contract.signer || contract.provider).call(tx, blockTag).then(function (value) {
try {
var result = contract.interface.decodeFunctionResult(method, value);
function handleNumber(value) {
if (value === "0x") {
return constants_1.Zero;
}
return bignumber_1.BigNumber.from(value);
}
var transactionFields = [