@cryptorubic/web3 1.5.1-alpha.tron.2 → 1.5.1-alpha.tron.4
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/package.json
CHANGED
|
@@ -143,11 +143,11 @@ class TronAdapter extends abstract_adapter_1.AbstractAdapter {
|
|
|
143
143
|
// }
|
|
144
144
|
async multicallContractsMethods(contractAbi, contractsData) {
|
|
145
145
|
const calls = contractsData.map(({ contractAddress, methodsData }) => {
|
|
146
|
-
return methodsData.map(({ methodName, methodArguments }) =>
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
146
|
+
return methodsData.map(({ methodName, methodArguments }) => [
|
|
147
|
+
contractAddress,
|
|
148
|
+
true,
|
|
149
|
+
tron_web3_pure_1.TronWeb3Pure.encodeFunctionCall(contractAbi, methodName, methodArguments)
|
|
150
|
+
]);
|
|
151
151
|
});
|
|
152
152
|
console.log('[multicallContractsMethods] calls ==>', calls);
|
|
153
153
|
try {
|
|
@@ -50,6 +50,242 @@ exports.TRON_MULTICALL_ABI = [
|
|
|
50
50
|
type: 'tuple[]'
|
|
51
51
|
}
|
|
52
52
|
],
|
|
53
|
+
stateMutability: 'view',
|
|
54
|
+
type: 'function'
|
|
55
|
+
}
|
|
56
|
+
];
|
|
57
|
+
[
|
|
58
|
+
{
|
|
59
|
+
inputs: [
|
|
60
|
+
{
|
|
61
|
+
components: [
|
|
62
|
+
{ internalType: 'address', name: 'target', type: 'address' },
|
|
63
|
+
{ internalType: 'bytes', name: 'callData', type: 'bytes' }
|
|
64
|
+
],
|
|
65
|
+
internalType: 'struct Multicall3.Call[]',
|
|
66
|
+
name: 'calls',
|
|
67
|
+
type: 'tuple[]'
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
name: 'aggregate',
|
|
71
|
+
outputs: [
|
|
72
|
+
{ internalType: 'uint256', name: 'blockNumber', type: 'uint256' },
|
|
73
|
+
{ internalType: 'bytes[]', name: 'returnData', type: 'bytes[]' }
|
|
74
|
+
],
|
|
75
|
+
stateMutability: 'payable',
|
|
76
|
+
type: 'function'
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
inputs: [
|
|
80
|
+
{
|
|
81
|
+
components: [
|
|
82
|
+
{ internalType: 'address', name: 'target', type: 'address' },
|
|
83
|
+
{ internalType: 'bool', name: 'allowFailure', type: 'bool' },
|
|
84
|
+
{ internalType: 'bytes', name: 'callData', type: 'bytes' }
|
|
85
|
+
],
|
|
86
|
+
internalType: 'struct Multicall3.Call3[]',
|
|
87
|
+
name: 'calls',
|
|
88
|
+
type: 'tuple[]'
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
name: 'aggregate3',
|
|
92
|
+
outputs: [
|
|
93
|
+
{
|
|
94
|
+
components: [
|
|
95
|
+
{ internalType: 'bool', name: 'success', type: 'bool' },
|
|
96
|
+
{ internalType: 'bytes', name: 'returnData', type: 'bytes' }
|
|
97
|
+
],
|
|
98
|
+
internalType: 'struct Multicall3.Result[]',
|
|
99
|
+
name: 'returnData',
|
|
100
|
+
type: 'tuple[]'
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
stateMutability: 'payable',
|
|
104
|
+
type: 'function'
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
inputs: [
|
|
108
|
+
{
|
|
109
|
+
components: [
|
|
110
|
+
{ internalType: 'address', name: 'target', type: 'address' },
|
|
111
|
+
{ internalType: 'bool', name: 'allowFailure', type: 'bool' },
|
|
112
|
+
{ internalType: 'uint256', name: 'value', type: 'uint256' },
|
|
113
|
+
{ internalType: 'bytes', name: 'callData', type: 'bytes' }
|
|
114
|
+
],
|
|
115
|
+
internalType: 'struct Multicall3.Call3Value[]',
|
|
116
|
+
name: 'calls',
|
|
117
|
+
type: 'tuple[]'
|
|
118
|
+
}
|
|
119
|
+
],
|
|
120
|
+
name: 'aggregate3Value',
|
|
121
|
+
outputs: [
|
|
122
|
+
{
|
|
123
|
+
components: [
|
|
124
|
+
{ internalType: 'bool', name: 'success', type: 'bool' },
|
|
125
|
+
{ internalType: 'bytes', name: 'returnData', type: 'bytes' }
|
|
126
|
+
],
|
|
127
|
+
internalType: 'struct Multicall3.Result[]',
|
|
128
|
+
name: 'returnData',
|
|
129
|
+
type: 'tuple[]'
|
|
130
|
+
}
|
|
131
|
+
],
|
|
132
|
+
stateMutability: 'payable',
|
|
133
|
+
type: 'function'
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
inputs: [
|
|
137
|
+
{
|
|
138
|
+
components: [
|
|
139
|
+
{ internalType: 'address', name: 'target', type: 'address' },
|
|
140
|
+
{ internalType: 'bytes', name: 'callData', type: 'bytes' }
|
|
141
|
+
],
|
|
142
|
+
internalType: 'struct Multicall3.Call[]',
|
|
143
|
+
name: 'calls',
|
|
144
|
+
type: 'tuple[]'
|
|
145
|
+
}
|
|
146
|
+
],
|
|
147
|
+
name: 'blockAndAggregate',
|
|
148
|
+
outputs: [
|
|
149
|
+
{ internalType: 'uint256', name: 'blockNumber', type: 'uint256' },
|
|
150
|
+
{ internalType: 'bytes32', name: 'blockHash', type: 'bytes32' },
|
|
151
|
+
{
|
|
152
|
+
components: [
|
|
153
|
+
{ internalType: 'bool', name: 'success', type: 'bool' },
|
|
154
|
+
{ internalType: 'bytes', name: 'returnData', type: 'bytes' }
|
|
155
|
+
],
|
|
156
|
+
internalType: 'struct Multicall3.Result[]',
|
|
157
|
+
name: 'returnData',
|
|
158
|
+
type: 'tuple[]'
|
|
159
|
+
}
|
|
160
|
+
],
|
|
161
|
+
stateMutability: 'payable',
|
|
162
|
+
type: 'function'
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
inputs: [],
|
|
166
|
+
name: 'getBasefee',
|
|
167
|
+
outputs: [{ internalType: 'uint256', name: 'basefee', type: 'uint256' }],
|
|
168
|
+
stateMutability: 'view',
|
|
169
|
+
type: 'function'
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
inputs: [{ internalType: 'uint256', name: 'blockNumber', type: 'uint256' }],
|
|
173
|
+
name: 'getBlockHash',
|
|
174
|
+
outputs: [{ internalType: 'bytes32', name: 'blockHash', type: 'bytes32' }],
|
|
175
|
+
stateMutability: 'view',
|
|
176
|
+
type: 'function'
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
inputs: [],
|
|
180
|
+
name: 'getBlockNumber',
|
|
181
|
+
outputs: [{ internalType: 'uint256', name: 'blockNumber', type: 'uint256' }],
|
|
182
|
+
stateMutability: 'view',
|
|
183
|
+
type: 'function'
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
inputs: [],
|
|
187
|
+
name: 'getChainId',
|
|
188
|
+
outputs: [{ internalType: 'uint256', name: 'chainid', type: 'uint256' }],
|
|
189
|
+
stateMutability: 'view',
|
|
190
|
+
type: 'function'
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
inputs: [],
|
|
194
|
+
name: 'getCurrentBlockCoinbase',
|
|
195
|
+
outputs: [{ internalType: 'address', name: 'coinbase', type: 'address' }],
|
|
196
|
+
stateMutability: 'view',
|
|
197
|
+
type: 'function'
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
inputs: [],
|
|
201
|
+
name: 'getCurrentBlockDifficulty',
|
|
202
|
+
outputs: [{ internalType: 'uint256', name: 'difficulty', type: 'uint256' }],
|
|
203
|
+
stateMutability: 'view',
|
|
204
|
+
type: 'function'
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
inputs: [],
|
|
208
|
+
name: 'getCurrentBlockGasLimit',
|
|
209
|
+
outputs: [{ internalType: 'uint256', name: 'gaslimit', type: 'uint256' }],
|
|
210
|
+
stateMutability: 'view',
|
|
211
|
+
type: 'function'
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
inputs: [],
|
|
215
|
+
name: 'getCurrentBlockTimestamp',
|
|
216
|
+
outputs: [{ internalType: 'uint256', name: 'timestamp', type: 'uint256' }],
|
|
217
|
+
stateMutability: 'view',
|
|
218
|
+
type: 'function'
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
inputs: [{ internalType: 'address', name: 'addr', type: 'address' }],
|
|
222
|
+
name: 'getEthBalance',
|
|
223
|
+
outputs: [{ internalType: 'uint256', name: 'balance', type: 'uint256' }],
|
|
224
|
+
stateMutability: 'view',
|
|
225
|
+
type: 'function'
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
inputs: [],
|
|
229
|
+
name: 'getLastBlockHash',
|
|
230
|
+
outputs: [{ internalType: 'bytes32', name: 'blockHash', type: 'bytes32' }],
|
|
231
|
+
stateMutability: 'view',
|
|
232
|
+
type: 'function'
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
inputs: [
|
|
236
|
+
{ internalType: 'bool', name: 'requireSuccess', type: 'bool' },
|
|
237
|
+
{
|
|
238
|
+
components: [
|
|
239
|
+
{ internalType: 'address', name: 'target', type: 'address' },
|
|
240
|
+
{ internalType: 'bytes', name: 'callData', type: 'bytes' }
|
|
241
|
+
],
|
|
242
|
+
internalType: 'struct Multicall3.Call[]',
|
|
243
|
+
name: 'calls',
|
|
244
|
+
type: 'tuple[]'
|
|
245
|
+
}
|
|
246
|
+
],
|
|
247
|
+
name: 'tryAggregate',
|
|
248
|
+
outputs: [
|
|
249
|
+
{
|
|
250
|
+
components: [
|
|
251
|
+
{ internalType: 'bool', name: 'success', type: 'bool' },
|
|
252
|
+
{ internalType: 'bytes', name: 'returnData', type: 'bytes' }
|
|
253
|
+
],
|
|
254
|
+
internalType: 'struct Multicall3.Result[]',
|
|
255
|
+
name: 'returnData',
|
|
256
|
+
type: 'tuple[]'
|
|
257
|
+
}
|
|
258
|
+
],
|
|
259
|
+
stateMutability: 'payable',
|
|
260
|
+
type: 'function'
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
inputs: [
|
|
264
|
+
{ internalType: 'bool', name: 'requireSuccess', type: 'bool' },
|
|
265
|
+
{
|
|
266
|
+
components: [
|
|
267
|
+
{ internalType: 'address', name: 'target', type: 'address' },
|
|
268
|
+
{ internalType: 'bytes', name: 'callData', type: 'bytes' }
|
|
269
|
+
],
|
|
270
|
+
internalType: 'struct Multicall3.Call[]',
|
|
271
|
+
name: 'calls',
|
|
272
|
+
type: 'tuple[]'
|
|
273
|
+
}
|
|
274
|
+
],
|
|
275
|
+
name: 'tryBlockAndAggregate',
|
|
276
|
+
outputs: [
|
|
277
|
+
{ internalType: 'uint256', name: 'blockNumber', type: 'uint256' },
|
|
278
|
+
{ internalType: 'bytes32', name: 'blockHash', type: 'bytes32' },
|
|
279
|
+
{
|
|
280
|
+
components: [
|
|
281
|
+
{ internalType: 'bool', name: 'success', type: 'bool' },
|
|
282
|
+
{ internalType: 'bytes', name: 'returnData', type: 'bytes' }
|
|
283
|
+
],
|
|
284
|
+
internalType: 'struct Multicall3.Result[]',
|
|
285
|
+
name: 'returnData',
|
|
286
|
+
type: 'tuple[]'
|
|
287
|
+
}
|
|
288
|
+
],
|
|
53
289
|
stateMutability: 'payable',
|
|
54
290
|
type: 'function'
|
|
55
291
|
}
|
|
@@ -3,20 +3,12 @@
|
|
|
3
3
|
* Second argument is `data`, that is encoded contract method.
|
|
4
4
|
*/
|
|
5
5
|
export type TronCall = [string, string];
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* If false, the entire call will revert if the call fails.
|
|
13
|
-
*/
|
|
14
|
-
allowFailure: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Data to call on the target contract
|
|
17
|
-
*/
|
|
18
|
-
callData: string;
|
|
19
|
-
};
|
|
6
|
+
/**
|
|
7
|
+
* First argument is `target`, that is contract address to execute on
|
|
8
|
+
* Second argument is `allowFailure`. If false, the entire call will revert if the call fails.
|
|
9
|
+
* 3th argument is `callData`. Data to call on the target contract
|
|
10
|
+
*/
|
|
11
|
+
export type TronCall3Request = [string, boolean, string];
|
|
20
12
|
export type TronCall3Result = {
|
|
21
13
|
success: boolean;
|
|
22
14
|
returnData: string;
|