ethereum-multicall
Advanced tools
Comparing version 2.13.0 to 2.14.0
@@ -301,4 +301,9 @@ "use strict"; | ||
var _a; | ||
var contract = new ethers_1.ethers.Contract(ethers_1.ethers.constants.AddressZero, abi); | ||
methodName = methodName.trim(); | ||
if (contract.interface.functions[methodName]) { | ||
return contract.interface.functions[methodName].outputs; | ||
} | ||
for (var i = 0; i < abi.length; i++) { | ||
if (((_a = abi[i].name) === null || _a === void 0 ? void 0 : _a.trim()) === methodName.trim()) { | ||
if (((_a = abi[i].name) === null || _a === void 0 ? void 0 : _a.trim()) === methodName) { | ||
return abi[i].outputs; | ||
@@ -305,0 +310,0 @@ } |
@@ -298,4 +298,9 @@ var __assign = (this && this.__assign) || function () { | ||
var _a; | ||
var contract = new ethers.Contract(ethers.constants.AddressZero, abi); | ||
methodName = methodName.trim(); | ||
if (contract.interface.functions[methodName]) { | ||
return contract.interface.functions[methodName].outputs; | ||
} | ||
for (var i = 0; i < abi.length; i++) { | ||
if (((_a = abi[i].name) === null || _a === void 0 ? void 0 : _a.trim()) === methodName.trim()) { | ||
if (((_a = abi[i].name) === null || _a === void 0 ? void 0 : _a.trim()) === methodName) { | ||
return abi[i].outputs; | ||
@@ -302,0 +307,0 @@ } |
{ | ||
"name": "ethereum-multicall", | ||
"version": "2.13.0", | ||
"version": "2.14.0", | ||
"description": "Multicall allows multiple smart contract constant function calls to be grouped into a single call and the results aggregated into a single result", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js", |
@@ -50,3 +50,60 @@ [![npm version](https://badge.fury.io/js/ethereum-multicall.svg)](https://badge.fury.io/js/ethereum-multicall) | ||
## Usage | ||
### Overloaded methods | ||
As the [official docs mentions here](https://docs.ethers.io/v3/api-contract.html#prototype): | ||
> Due to signature overloading, multiple functions can have the same name. The first function specifed in the ABI will be bound to its name. To access overloaded functions, use the full typed signature of the functions (e.g. contract["foobar(address,uint256)"]). | ||
So, when creating the contract call context, under the calls array property we should have that in mind and use the method signature rather than the method name. E.g. | ||
```js | ||
const contractCallContext: ContractCallContext = { | ||
reference: 'upV2Controller', | ||
contractAddress: '0x19891DdF6F393C02E484D7a942d4BF8C0dB1d001', | ||
abi: [ | ||
{ | ||
inputs: [], | ||
name: 'getVirtualPrice', | ||
outputs: [ | ||
{ | ||
internalType: 'uint256', | ||
name: '', | ||
type: 'uint256', | ||
}, | ||
], | ||
stateMutability: 'view', | ||
type: 'function', | ||
}, | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: 'uint256', | ||
name: 'sentValue', | ||
type: 'uint256', | ||
}, | ||
], | ||
name: 'getVirtualPrice', | ||
outputs: [ | ||
{ | ||
internalType: 'uint256', | ||
name: '', | ||
type: 'uint256', | ||
}, | ||
], | ||
stateMutability: 'view', | ||
type: 'function', | ||
}, | ||
], | ||
calls: [ | ||
{ | ||
reference: 'getVirtualPriceWithInput', | ||
methodName: 'getVirtualPrice(uint256)', | ||
methodParameters: ['0xFFFFFFFFFFFFF'], | ||
}, | ||
{ | ||
reference: 'getVirtualPriceWithoutInput', | ||
methodName: 'getVirtualPrice()', | ||
methodParameters: [], | ||
}, | ||
], | ||
}; | ||
``` | ||
### Import examples: | ||
@@ -53,0 +110,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
113387
1946
634