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 formatBytes32String(text) {
// Get the bytes
var bytes = utf8_1.toUtf8Bytes(text);
// Check we have room for null-termination
if (bytes.length > 31) {
throw new Error("bytes32 string must be less than 32 bytes");
}
// Zero-pad (implicitly null-terminates)
return bytes_1.hexlify(bytes_1.concat([bytes, constants_1.HashZero]).slice(0, 32));
}
exports.formatBytes32String = formatBytes32String;
function handleNumber(value) {
if (value === "0x") {
return constants_1.Zero;
}
return bignumber_1.BigNumber.from(value);
}
var transactionFields = [
Formatter.prototype.callAddress = function (value) {
if (!bytes_1.isHexString(value, 32)) {
return null;
}
var address = address_1.getAddress(bytes_1.hexDataSlice(value, 12));
return (address === constants_1.AddressZero) ? null : address;
};
Formatter.prototype.contractAddress = function (value) {