@pancakeswap/multicall 2.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -0
- package/dist/abis/IMulticall.d.ts +36 -0
- package/dist/abis/IMulticall.d.ts.map +1 -0
- package/dist/constants/blockConflictTolerance.d.ts +6 -0
- package/dist/constants/blockConflictTolerance.d.ts.map +1 -0
- package/dist/constants/contracts.d.ts +6 -0
- package/dist/constants/contracts.d.ts.map +1 -0
- package/dist/constants/gasLimit.d.ts +10 -0
- package/dist/constants/gasLimit.d.ts.map +1 -0
- package/dist/constants/index.d.ts +4 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/getBlockConflictTolerance.d.ts +3 -0
- package/dist/getBlockConflictTolerance.d.ts.map +1 -0
- package/dist/getGasLimit.d.ts +15 -0
- package/dist/getGasLimit.d.ts.map +1 -0
- package/dist/getMulticallContract.d.ts +10 -0
- package/dist/getMulticallContract.d.ts.map +1 -0
- package/dist/index.d.ts +8 -54
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +244 -262
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +231 -261
- package/dist/index.mjs.map +1 -0
- package/dist/multicall.d.ts +19 -0
- package/dist/multicall.d.ts.map +1 -0
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +16 -12
- package/CHANGELOG.md +0 -25
- package/Multicall.json +0 -236
- package/index.ts +0 -138
- package/tsconfig.json +0 -11
- package/tsup.config.ts +0 -11
package/package.json
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pancakeswap/multicall",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
5
|
+
"files": [
|
|
6
|
+
"dist"
|
|
7
|
+
],
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"module": "dist/index.mjs",
|
|
8
11
|
"dependencies": {
|
|
9
|
-
"
|
|
10
|
-
"@
|
|
11
|
-
"@ethersproject/providers": "^5.0.0"
|
|
12
|
+
"viem": "^1.2.9",
|
|
13
|
+
"@pancakeswap/sdk": "5.4.1"
|
|
12
14
|
},
|
|
13
15
|
"devDependencies": {
|
|
14
16
|
"tsup": "^6.7.0",
|
|
15
|
-
"typescript": "^
|
|
16
|
-
"
|
|
17
|
-
"@pancakeswap/tsconfig": "0.0.0"
|
|
17
|
+
"typescript": "^5.1.3",
|
|
18
|
+
"vitest": "^0.27.2",
|
|
19
|
+
"@pancakeswap/tsconfig": "0.0.0",
|
|
20
|
+
"@pancakeswap/utils": "5.0.2"
|
|
18
21
|
},
|
|
19
22
|
"exports": {
|
|
20
23
|
"./package.json": "./package.json",
|
|
@@ -22,12 +25,13 @@
|
|
|
22
25
|
"types": "./dist/index.d.ts",
|
|
23
26
|
"import": "./dist/index.mjs",
|
|
24
27
|
"require": "./dist/index.js"
|
|
25
|
-
}
|
|
26
|
-
"./Multicall.json": "./Multicall.json"
|
|
28
|
+
}
|
|
27
29
|
},
|
|
28
30
|
"scripts": {
|
|
29
31
|
"build": "tsup",
|
|
30
32
|
"dev": "tsup --watch",
|
|
33
|
+
"test": "vitest --run",
|
|
34
|
+
"coverage": "vitest run --coverage",
|
|
31
35
|
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
|
|
32
36
|
}
|
|
33
37
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# @pancakeswap/multicall
|
|
2
|
-
|
|
3
|
-
## 2.0.0
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- Updated dependencies [b5dbd2921]
|
|
8
|
-
- @pancakeswap/sdk@4.0.0
|
|
9
|
-
|
|
10
|
-
## 1.0.0
|
|
11
|
-
|
|
12
|
-
### Minor Changes
|
|
13
|
-
|
|
14
|
-
- 65fbb250a: Bump version
|
|
15
|
-
|
|
16
|
-
### Patch Changes
|
|
17
|
-
|
|
18
|
-
- Updated dependencies [65fbb250a]
|
|
19
|
-
- @pancakeswap/sdk@3.2.0
|
|
20
|
-
|
|
21
|
-
## 0.0.2
|
|
22
|
-
|
|
23
|
-
### Patch Changes
|
|
24
|
-
|
|
25
|
-
- 1e4a4b27c: Base multicall feature
|
package/Multicall.json
DELETED
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"inputs": [
|
|
4
|
-
{
|
|
5
|
-
"components": [
|
|
6
|
-
{ "internalType": "address", "name": "target", "type": "address" },
|
|
7
|
-
{ "internalType": "bytes", "name": "callData", "type": "bytes" }
|
|
8
|
-
],
|
|
9
|
-
"internalType": "struct Multicall3.Call[]",
|
|
10
|
-
"name": "calls",
|
|
11
|
-
"type": "tuple[]"
|
|
12
|
-
}
|
|
13
|
-
],
|
|
14
|
-
"name": "aggregate",
|
|
15
|
-
"outputs": [
|
|
16
|
-
{ "internalType": "uint256", "name": "blockNumber", "type": "uint256" },
|
|
17
|
-
{ "internalType": "bytes[]", "name": "returnData", "type": "bytes[]" }
|
|
18
|
-
],
|
|
19
|
-
"stateMutability": "payable",
|
|
20
|
-
"type": "function"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"inputs": [
|
|
24
|
-
{
|
|
25
|
-
"components": [
|
|
26
|
-
{ "internalType": "address", "name": "target", "type": "address" },
|
|
27
|
-
{ "internalType": "bool", "name": "allowFailure", "type": "bool" },
|
|
28
|
-
{ "internalType": "bytes", "name": "callData", "type": "bytes" }
|
|
29
|
-
],
|
|
30
|
-
"internalType": "struct Multicall3.Call3[]",
|
|
31
|
-
"name": "calls",
|
|
32
|
-
"type": "tuple[]"
|
|
33
|
-
}
|
|
34
|
-
],
|
|
35
|
-
"name": "aggregate3",
|
|
36
|
-
"outputs": [
|
|
37
|
-
{
|
|
38
|
-
"components": [
|
|
39
|
-
{ "internalType": "bool", "name": "success", "type": "bool" },
|
|
40
|
-
{ "internalType": "bytes", "name": "returnData", "type": "bytes" }
|
|
41
|
-
],
|
|
42
|
-
"internalType": "struct Multicall3.Result[]",
|
|
43
|
-
"name": "returnData",
|
|
44
|
-
"type": "tuple[]"
|
|
45
|
-
}
|
|
46
|
-
],
|
|
47
|
-
"stateMutability": "payable",
|
|
48
|
-
"type": "function"
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"inputs": [
|
|
52
|
-
{
|
|
53
|
-
"components": [
|
|
54
|
-
{ "internalType": "address", "name": "target", "type": "address" },
|
|
55
|
-
{ "internalType": "bool", "name": "allowFailure", "type": "bool" },
|
|
56
|
-
{ "internalType": "uint256", "name": "value", "type": "uint256" },
|
|
57
|
-
{ "internalType": "bytes", "name": "callData", "type": "bytes" }
|
|
58
|
-
],
|
|
59
|
-
"internalType": "struct Multicall3.Call3Value[]",
|
|
60
|
-
"name": "calls",
|
|
61
|
-
"type": "tuple[]"
|
|
62
|
-
}
|
|
63
|
-
],
|
|
64
|
-
"name": "aggregate3Value",
|
|
65
|
-
"outputs": [
|
|
66
|
-
{
|
|
67
|
-
"components": [
|
|
68
|
-
{ "internalType": "bool", "name": "success", "type": "bool" },
|
|
69
|
-
{ "internalType": "bytes", "name": "returnData", "type": "bytes" }
|
|
70
|
-
],
|
|
71
|
-
"internalType": "struct Multicall3.Result[]",
|
|
72
|
-
"name": "returnData",
|
|
73
|
-
"type": "tuple[]"
|
|
74
|
-
}
|
|
75
|
-
],
|
|
76
|
-
"stateMutability": "payable",
|
|
77
|
-
"type": "function"
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
"inputs": [
|
|
81
|
-
{
|
|
82
|
-
"components": [
|
|
83
|
-
{ "internalType": "address", "name": "target", "type": "address" },
|
|
84
|
-
{ "internalType": "bytes", "name": "callData", "type": "bytes" }
|
|
85
|
-
],
|
|
86
|
-
"internalType": "struct Multicall3.Call[]",
|
|
87
|
-
"name": "calls",
|
|
88
|
-
"type": "tuple[]"
|
|
89
|
-
}
|
|
90
|
-
],
|
|
91
|
-
"name": "blockAndAggregate",
|
|
92
|
-
"outputs": [
|
|
93
|
-
{ "internalType": "uint256", "name": "blockNumber", "type": "uint256" },
|
|
94
|
-
{ "internalType": "bytes32", "name": "blockHash", "type": "bytes32" },
|
|
95
|
-
{
|
|
96
|
-
"components": [
|
|
97
|
-
{ "internalType": "bool", "name": "success", "type": "bool" },
|
|
98
|
-
{ "internalType": "bytes", "name": "returnData", "type": "bytes" }
|
|
99
|
-
],
|
|
100
|
-
"internalType": "struct Multicall3.Result[]",
|
|
101
|
-
"name": "returnData",
|
|
102
|
-
"type": "tuple[]"
|
|
103
|
-
}
|
|
104
|
-
],
|
|
105
|
-
"stateMutability": "payable",
|
|
106
|
-
"type": "function"
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
"inputs": [],
|
|
110
|
-
"name": "getBasefee",
|
|
111
|
-
"outputs": [{ "internalType": "uint256", "name": "basefee", "type": "uint256" }],
|
|
112
|
-
"stateMutability": "view",
|
|
113
|
-
"type": "function"
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
"inputs": [{ "internalType": "uint256", "name": "blockNumber", "type": "uint256" }],
|
|
117
|
-
"name": "getBlockHash",
|
|
118
|
-
"outputs": [{ "internalType": "bytes32", "name": "blockHash", "type": "bytes32" }],
|
|
119
|
-
"stateMutability": "view",
|
|
120
|
-
"type": "function"
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
"inputs": [],
|
|
124
|
-
"name": "getBlockNumber",
|
|
125
|
-
"outputs": [{ "internalType": "uint256", "name": "blockNumber", "type": "uint256" }],
|
|
126
|
-
"stateMutability": "view",
|
|
127
|
-
"type": "function"
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
"inputs": [],
|
|
131
|
-
"name": "getChainId",
|
|
132
|
-
"outputs": [{ "internalType": "uint256", "name": "chainid", "type": "uint256" }],
|
|
133
|
-
"stateMutability": "view",
|
|
134
|
-
"type": "function"
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
"inputs": [],
|
|
138
|
-
"name": "getCurrentBlockCoinbase",
|
|
139
|
-
"outputs": [{ "internalType": "address", "name": "coinbase", "type": "address" }],
|
|
140
|
-
"stateMutability": "view",
|
|
141
|
-
"type": "function"
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
"inputs": [],
|
|
145
|
-
"name": "getCurrentBlockDifficulty",
|
|
146
|
-
"outputs": [{ "internalType": "uint256", "name": "difficulty", "type": "uint256" }],
|
|
147
|
-
"stateMutability": "view",
|
|
148
|
-
"type": "function"
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
"inputs": [],
|
|
152
|
-
"name": "getCurrentBlockGasLimit",
|
|
153
|
-
"outputs": [{ "internalType": "uint256", "name": "gaslimit", "type": "uint256" }],
|
|
154
|
-
"stateMutability": "view",
|
|
155
|
-
"type": "function"
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
"inputs": [],
|
|
159
|
-
"name": "getCurrentBlockTimestamp",
|
|
160
|
-
"outputs": [{ "internalType": "uint256", "name": "timestamp", "type": "uint256" }],
|
|
161
|
-
"stateMutability": "view",
|
|
162
|
-
"type": "function"
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
"inputs": [{ "internalType": "address", "name": "addr", "type": "address" }],
|
|
166
|
-
"name": "getEthBalance",
|
|
167
|
-
"outputs": [{ "internalType": "uint256", "name": "balance", "type": "uint256" }],
|
|
168
|
-
"stateMutability": "view",
|
|
169
|
-
"type": "function"
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
"inputs": [],
|
|
173
|
-
"name": "getLastBlockHash",
|
|
174
|
-
"outputs": [{ "internalType": "bytes32", "name": "blockHash", "type": "bytes32" }],
|
|
175
|
-
"stateMutability": "view",
|
|
176
|
-
"type": "function"
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
"inputs": [
|
|
180
|
-
{ "internalType": "bool", "name": "requireSuccess", "type": "bool" },
|
|
181
|
-
{
|
|
182
|
-
"components": [
|
|
183
|
-
{ "internalType": "address", "name": "target", "type": "address" },
|
|
184
|
-
{ "internalType": "bytes", "name": "callData", "type": "bytes" }
|
|
185
|
-
],
|
|
186
|
-
"internalType": "struct Multicall3.Call[]",
|
|
187
|
-
"name": "calls",
|
|
188
|
-
"type": "tuple[]"
|
|
189
|
-
}
|
|
190
|
-
],
|
|
191
|
-
"name": "tryAggregate",
|
|
192
|
-
"outputs": [
|
|
193
|
-
{
|
|
194
|
-
"components": [
|
|
195
|
-
{ "internalType": "bool", "name": "success", "type": "bool" },
|
|
196
|
-
{ "internalType": "bytes", "name": "returnData", "type": "bytes" }
|
|
197
|
-
],
|
|
198
|
-
"internalType": "struct Multicall3.Result[]",
|
|
199
|
-
"name": "returnData",
|
|
200
|
-
"type": "tuple[]"
|
|
201
|
-
}
|
|
202
|
-
],
|
|
203
|
-
"stateMutability": "payable",
|
|
204
|
-
"type": "function"
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
"inputs": [
|
|
208
|
-
{ "internalType": "bool", "name": "requireSuccess", "type": "bool" },
|
|
209
|
-
{
|
|
210
|
-
"components": [
|
|
211
|
-
{ "internalType": "address", "name": "target", "type": "address" },
|
|
212
|
-
{ "internalType": "bytes", "name": "callData", "type": "bytes" }
|
|
213
|
-
],
|
|
214
|
-
"internalType": "struct Multicall3.Call[]",
|
|
215
|
-
"name": "calls",
|
|
216
|
-
"type": "tuple[]"
|
|
217
|
-
}
|
|
218
|
-
],
|
|
219
|
-
"name": "tryBlockAndAggregate",
|
|
220
|
-
"outputs": [
|
|
221
|
-
{ "internalType": "uint256", "name": "blockNumber", "type": "uint256" },
|
|
222
|
-
{ "internalType": "bytes32", "name": "blockHash", "type": "bytes32" },
|
|
223
|
-
{
|
|
224
|
-
"components": [
|
|
225
|
-
{ "internalType": "bool", "name": "success", "type": "bool" },
|
|
226
|
-
{ "internalType": "bytes", "name": "returnData", "type": "bytes" }
|
|
227
|
-
],
|
|
228
|
-
"internalType": "struct Multicall3.Result[]",
|
|
229
|
-
"name": "returnData",
|
|
230
|
-
"type": "tuple[]"
|
|
231
|
-
}
|
|
232
|
-
],
|
|
233
|
-
"stateMutability": "payable",
|
|
234
|
-
"type": "function"
|
|
235
|
-
}
|
|
236
|
-
]
|
package/index.ts
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { Interface, Fragment } from '@ethersproject/abi'
|
|
2
|
-
import { CallOverrides, Contract } from '@ethersproject/contracts'
|
|
3
|
-
import { Provider } from '@ethersproject/providers'
|
|
4
|
-
import { ChainId } from '@pancakeswap/sdk'
|
|
5
|
-
|
|
6
|
-
import multicallAbi from './Multicall.json'
|
|
7
|
-
|
|
8
|
-
export const multicallAddresses = {
|
|
9
|
-
1: '0xcA11bde05977b3631167028862bE2a173976CA11',
|
|
10
|
-
4: '0xcA11bde05977b3631167028862bE2a173976CA11',
|
|
11
|
-
5: '0xcA11bde05977b3631167028862bE2a173976CA11',
|
|
12
|
-
56: '0xcA11bde05977b3631167028862bE2a173976CA11',
|
|
13
|
-
97: '0xcA11bde05977b3631167028862bE2a173976CA11',
|
|
14
|
-
} as const
|
|
15
|
-
|
|
16
|
-
export const getMulticallContract = (chainId: ChainId, provider: Provider) => {
|
|
17
|
-
if (multicallAddresses[chainId as keyof typeof multicallAddresses]) {
|
|
18
|
-
return new Contract(multicallAddresses[chainId as keyof typeof multicallAddresses], multicallAbi, provider)
|
|
19
|
-
}
|
|
20
|
-
return null
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface Call {
|
|
24
|
-
address: string // Address of the contract
|
|
25
|
-
name: string // Function name on the contract (example: balanceOf)
|
|
26
|
-
params?: any[] // Function params
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface MulticallOptions extends CallOverrides {
|
|
30
|
-
requireSuccess?: boolean
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Multicall V2 uses the new "tryAggregate" function. It is different in 2 ways
|
|
35
|
-
*
|
|
36
|
-
* 1. If "requireSuccess" is false multicall will not bail out if one of the calls fails
|
|
37
|
-
* 2. The return includes a boolean whether the call was successful e.g. [wasSuccessful, callResult]
|
|
38
|
-
*/
|
|
39
|
-
interface MulticallV2Params {
|
|
40
|
-
abi: any[] | any
|
|
41
|
-
calls: Call[]
|
|
42
|
-
chainId?: ChainId
|
|
43
|
-
options?: MulticallOptions
|
|
44
|
-
provider?: Provider
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface CallV3 extends Call {
|
|
48
|
-
abi: any[] | any
|
|
49
|
-
allowFailure?: boolean
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
interface MulticallV3Params {
|
|
53
|
-
calls: CallV3[]
|
|
54
|
-
chainId?: ChainId
|
|
55
|
-
allowFailure?: boolean
|
|
56
|
-
overrides?: CallOverrides
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export type MultiCallV2 = <T = any>(params: MulticallV2Params) => Promise<T>
|
|
60
|
-
export type MultiCall = <T = any>(abi: any[], calls: Call[], chainId?: ChainId) => Promise<T>
|
|
61
|
-
|
|
62
|
-
export function createMulticall<TProvider extends Provider>(
|
|
63
|
-
provider: ({ chainId }: { chainId?: number | undefined }) => TProvider,
|
|
64
|
-
) {
|
|
65
|
-
const multicall: MultiCall = async (abi: any[], calls: Call[], chainId = ChainId.BSC) => {
|
|
66
|
-
const multi = getMulticallContract(chainId, provider({ chainId }))
|
|
67
|
-
if (!multi) throw new Error(`Multicall Provider missing for ${chainId}`)
|
|
68
|
-
const itf = new Interface(abi)
|
|
69
|
-
|
|
70
|
-
const calldata = calls.map((call) => ({
|
|
71
|
-
target: call.address.toLowerCase(),
|
|
72
|
-
callData: itf.encodeFunctionData(call.name, call.params),
|
|
73
|
-
}))
|
|
74
|
-
const { returnData } = await multi.callStatic.aggregate(calldata)
|
|
75
|
-
|
|
76
|
-
const res = returnData.map((call: any, i: number) => itf.decodeFunctionResult(calls[i].name, call))
|
|
77
|
-
|
|
78
|
-
return res as any
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const multicallv2: MultiCallV2 = async ({ abi, calls, chainId = ChainId.BSC, options, provider: _provider }) => {
|
|
82
|
-
const { requireSuccess = true, ...overrides } = options || {}
|
|
83
|
-
const multi = getMulticallContract(chainId, _provider || provider({ chainId }))
|
|
84
|
-
if (!multi) throw new Error(`Multicall Provider missing for ${chainId}`)
|
|
85
|
-
const itf = new Interface(abi)
|
|
86
|
-
|
|
87
|
-
const calldata = calls.map((call) => ({
|
|
88
|
-
target: call.address.toLowerCase(),
|
|
89
|
-
callData: itf.encodeFunctionData(call.name, call.params),
|
|
90
|
-
}))
|
|
91
|
-
|
|
92
|
-
const returnData = await multi.callStatic.tryAggregate(requireSuccess, calldata, overrides)
|
|
93
|
-
const res = returnData.map((call: any, i: number) => {
|
|
94
|
-
const [result, data] = call
|
|
95
|
-
return result && data !== '0x' ? itf.decodeFunctionResult(calls[i].name, data) : null
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
return res as any
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const multicallv3 = async ({ calls, chainId = ChainId.BSC, allowFailure, overrides }: MulticallV3Params) => {
|
|
102
|
-
const multi = getMulticallContract(chainId, provider({ chainId }))
|
|
103
|
-
if (!multi) throw new Error(`Multicall Provider missing for ${chainId}`)
|
|
104
|
-
const interfaceCache = new WeakMap()
|
|
105
|
-
const _calls = calls.map(({ abi, address, name, params, allowFailure: _allowFailure }) => {
|
|
106
|
-
let itf = interfaceCache.get(abi)
|
|
107
|
-
if (!itf) {
|
|
108
|
-
itf = new Interface(abi)
|
|
109
|
-
interfaceCache.set(abi, itf)
|
|
110
|
-
}
|
|
111
|
-
if (!itf.fragments.some((fragment: Fragment) => fragment.name === name))
|
|
112
|
-
console.error(`${name} missing on ${address}`)
|
|
113
|
-
const callData = itf.encodeFunctionData(name, params ?? [])
|
|
114
|
-
return {
|
|
115
|
-
target: address.toLowerCase(),
|
|
116
|
-
allowFailure: allowFailure || _allowFailure,
|
|
117
|
-
callData,
|
|
118
|
-
}
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
const result = await multi.callStatic.aggregate3(_calls, ...(overrides ? [overrides] : []))
|
|
122
|
-
|
|
123
|
-
return result.map((call: any, i: number) => {
|
|
124
|
-
const { returnData, success } = call
|
|
125
|
-
if (!success || returnData === '0x') return null
|
|
126
|
-
const { abi, name } = calls[i]
|
|
127
|
-
const itf = interfaceCache.get(abi)
|
|
128
|
-
const decoded = itf?.decodeFunctionResult(name, returnData)
|
|
129
|
-
return decoded
|
|
130
|
-
})
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
return {
|
|
134
|
-
multicall,
|
|
135
|
-
multicallv2,
|
|
136
|
-
multicallv3,
|
|
137
|
-
}
|
|
138
|
-
}
|
package/tsconfig.json
DELETED