@sentio/sdk 2.40.0-rc.5 → 2.40.0-rc.6
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/lib/aptos/builtin/0x1.js +10 -10
- package/lib/aptos/builtin/0x3.js +11 -11
- package/lib/aptos/builtin/index.js +11 -11
- package/lib/aptos/codegen/index.js +3 -3
- package/lib/aptos/ext/index.js +10 -10
- package/lib/aptos/index.js +10 -10
- package/lib/chunk-2QEQTKQY.js +1050 -0
- package/lib/{chunk-Z7QWETBQ.js → chunk-3LE323R2.js} +2 -2
- package/lib/{chunk-QHHXY7LO.js → chunk-5XM56ENY.js} +5 -5
- package/lib/{chunk-RX5G4RN2.js → chunk-7NFMED3E.js} +2 -2
- package/lib/{chunk-KA5CLZU6.js → chunk-7NWX3CH7.js} +90 -53
- package/lib/{chunk-F2IZC2B6.js → chunk-EMF4HXFG.js} +5 -5
- package/lib/{chunk-VP6Y633M.js → chunk-GOWJIAB2.js} +2 -2
- package/lib/chunk-K5OSTLHI.js +916 -0
- package/lib/{chunk-WLLDVQFE.js → chunk-KO4GSZCM.js} +3 -3
- package/lib/chunk-KTAUVRJN.js +1910 -0
- package/lib/{chunk-2QVJGMW4.js → chunk-KVB555XD.js} +2 -2
- package/lib/{chunk-TDPQO2SX.js → chunk-LICAL3XW.js} +2 -2
- package/lib/{chunk-NBZRHB5V.js → chunk-O6QXDRGG.js} +5 -5
- package/lib/{chunk-6DDG76PU.js → chunk-P6T5WFAZ.js} +4 -4
- package/lib/chunk-QKJ5SWA2.js +861 -0
- package/lib/{chunk-VJTNBZMU.js → chunk-QTWMU7GQ.js} +1 -1
- package/lib/{chunk-OAIP7J4S.js → chunk-RXO7SOTL.js} +2757 -1157
- package/lib/{chunk-S727P6WP.js → chunk-SYEQKTIU.js} +1 -1
- package/lib/{chunk-7OBRGY7G.js → chunk-YNJXNOVA.js} +2 -2
- package/lib/{chunk-N4OQDWM2.js → chunk-YOLIZKGZ.js} +1 -1
- package/lib/{chunk-USETTWR7.js → chunk-Z5PQR6UE.js} +100 -54
- package/lib/core/index.js +3 -3
- package/lib/{eacaggregatorproxy-aed46d4a.d.ts → eacaggregatorproxy-cb8e39be.d.ts} +76 -24
- package/lib/{erc1155-80a76eb5.d.ts → erc1155-fb097c50.d.ts} +31 -9
- package/lib/{erc20-39aae019.d.ts → erc20-95ba7721.d.ts} +61 -19
- package/lib/{erc721-0a429bd4.d.ts → erc721-13bf7a61.d.ts} +49 -15
- package/lib/eth/builtin/eacaggregatorproxy.d.ts +1 -1
- package/lib/eth/builtin/eacaggregatorproxy.js +5 -5
- package/lib/eth/builtin/erc1155.d.ts +1 -1
- package/lib/eth/builtin/erc1155.js +5 -5
- package/lib/eth/builtin/erc20.d.ts +1 -1
- package/lib/eth/builtin/erc20.js +4 -4
- package/lib/eth/builtin/erc721.d.ts +1 -1
- package/lib/eth/builtin/erc721.js +4 -4
- package/lib/eth/builtin/index.d.ts +39 -15
- package/lib/eth/builtin/index.js +8 -8
- package/lib/eth/builtin/weth9.d.ts +1 -1
- package/lib/eth/builtin/weth9.js +5 -5
- package/lib/eth/codegen/index.js +130 -39
- package/lib/eth/index.d.ts +1 -0
- package/lib/eth/index.js +7 -4
- package/lib/fuel/index.js +4 -4
- package/lib/index.js +5 -3
- package/lib/move/index.js +4 -4
- package/lib/solana/builtin/index.js +4 -4
- package/lib/solana/index.js +4 -4
- package/lib/store/index.js +3 -3
- package/lib/sui/builtin/0x1.js +12 -12
- package/lib/sui/builtin/0x2.js +13 -13
- package/lib/sui/builtin/0x3.js +14 -14
- package/lib/sui/builtin/index.js +14 -14
- package/lib/sui/codegen/index.js +2 -2
- package/lib/sui/ext/index.js +10 -10
- package/lib/sui/index.js +11 -11
- package/lib/testing/index.js +14 -14
- package/lib/utils/index.js +7 -7
- package/lib/{weth9-08664cb7.d.ts → weth9-2b52cb06.d.ts} +40 -12
- package/package.json +1 -1
- package/src/eth/builtin/internal/eacaggregatorproxy-processor.ts +1446 -115
- package/src/eth/builtin/internal/erc1155-processor.ts +611 -34
- package/src/eth/builtin/internal/erc20-processor.ts +1182 -84
- package/src/eth/builtin/internal/erc20bytes-processor.ts +595 -45
- package/src/eth/builtin/internal/erc721-processor.ts +967 -64
- package/src/eth/builtin/internal/weth9-processor.ts +698 -55
- package/src/eth/codegen/file.ts +26 -3
- package/src/eth/codegen/function-calls.ts +93 -8
- package/src/eth/codegen/types.ts +22 -1
- package/src/eth/eth-plugin.ts +4 -4
- package/src/eth/index.ts +2 -0
- package/lib/chunk-76HTCT5F.js +0 -469
- package/lib/chunk-ERTIHPSD.js +0 -528
- package/lib/chunk-LWKILLQ6.js +0 -820
- package/lib/chunk-S36AAZOU.js +0 -417
@@ -0,0 +1,916 @@
|
|
1
|
+
import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
|
2
|
+
import {
|
3
|
+
BaseProcessor,
|
4
|
+
BaseProcessorTemplate,
|
5
|
+
BoundContractView,
|
6
|
+
ContractView,
|
7
|
+
DummyProvider,
|
8
|
+
ERC1155__factory,
|
9
|
+
Interface,
|
10
|
+
addContractByABI,
|
11
|
+
addProcessor,
|
12
|
+
getContractByABI,
|
13
|
+
getProcessor,
|
14
|
+
getProvider,
|
15
|
+
import_chain,
|
16
|
+
transformEtherError
|
17
|
+
} from "./chunk-RXO7SOTL.js";
|
18
|
+
import {
|
19
|
+
makeEthCallKey
|
20
|
+
} from "./chunk-Z5PQR6UE.js";
|
21
|
+
import {
|
22
|
+
__export,
|
23
|
+
__publicField
|
24
|
+
} from "./chunk-AXRHIURD.js";
|
25
|
+
|
26
|
+
// src/eth/builtin/erc1155.ts
|
27
|
+
var erc1155_exports = {};
|
28
|
+
__export(erc1155_exports, {
|
29
|
+
ERC1155BoundContractView: () => ERC1155BoundContractView,
|
30
|
+
ERC1155ContractView: () => ERC1155ContractView,
|
31
|
+
ERC1155Processor: () => ERC1155Processor,
|
32
|
+
ERC1155ProcessorTemplate: () => ERC1155ProcessorTemplate,
|
33
|
+
ERC1155__factory: () => ERC1155__factory,
|
34
|
+
getERC1155Contract: () => getERC1155Contract,
|
35
|
+
getERC1155ContractOnContext: () => getERC1155ContractOnContext,
|
36
|
+
mockApprovalForAllLog: () => mockApprovalForAllLog,
|
37
|
+
mockTransferBatchLog: () => mockTransferBatchLog,
|
38
|
+
mockTransferSingleLog: () => mockTransferSingleLog,
|
39
|
+
mockURILog: () => mockURILog
|
40
|
+
});
|
41
|
+
|
42
|
+
// src/eth/builtin/internal/erc1155-processor.ts
|
43
|
+
var templateContract = ERC1155__factory.connect("0x0", DummyProvider);
|
44
|
+
var ERC1155ContractView = class extends ContractView {
|
45
|
+
constructor(contract) {
|
46
|
+
super(contract);
|
47
|
+
this.callStatic.contract = contract;
|
48
|
+
}
|
49
|
+
async balanceOf(account, id, overrides, preparedData, ethCallContext) {
|
50
|
+
try {
|
51
|
+
if (preparedData?.ethCallResults && ethCallContext) {
|
52
|
+
const iface = new Interface([
|
53
|
+
"function balanceOf(address,uint256) view returns (uint256)"
|
54
|
+
]);
|
55
|
+
const calldata = iface.encodeFunctionData("balanceOf", [account, id]);
|
56
|
+
const key = makeEthCallKey({
|
57
|
+
context: ethCallContext,
|
58
|
+
calldata
|
59
|
+
});
|
60
|
+
const ret = preparedData.ethCallResults[key];
|
61
|
+
if (ret) {
|
62
|
+
const result = iface.decodeFunctionResult("balanceOf", ret).toArray();
|
63
|
+
return result.length == 1 ? result[0] : result;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
return await this.contract.getFunction("balanceOf(address,uint256)")(
|
67
|
+
account,
|
68
|
+
id,
|
69
|
+
overrides || {}
|
70
|
+
);
|
71
|
+
} catch (e) {
|
72
|
+
const stack = new Error().stack;
|
73
|
+
throw transformEtherError(e, void 0, stack);
|
74
|
+
}
|
75
|
+
}
|
76
|
+
async balanceOfBatch(accounts, ids, overrides, preparedData, ethCallContext) {
|
77
|
+
try {
|
78
|
+
if (preparedData?.ethCallResults && ethCallContext) {
|
79
|
+
const iface = new Interface([
|
80
|
+
"function balanceOfBatch(address[],uint256[]) view returns (uint256[])"
|
81
|
+
]);
|
82
|
+
const calldata = iface.encodeFunctionData("balanceOfBatch", [
|
83
|
+
accounts,
|
84
|
+
ids
|
85
|
+
]);
|
86
|
+
const key = makeEthCallKey({
|
87
|
+
context: ethCallContext,
|
88
|
+
calldata
|
89
|
+
});
|
90
|
+
const ret = preparedData.ethCallResults[key];
|
91
|
+
if (ret) {
|
92
|
+
const result = iface.decodeFunctionResult("balanceOfBatch", ret).toArray();
|
93
|
+
return result.length == 1 ? result[0] : result;
|
94
|
+
}
|
95
|
+
}
|
96
|
+
return await this.contract.getFunction(
|
97
|
+
"balanceOfBatch(address[],uint256[])"
|
98
|
+
)(accounts, ids, overrides || {});
|
99
|
+
} catch (e) {
|
100
|
+
const stack = new Error().stack;
|
101
|
+
throw transformEtherError(e, void 0, stack);
|
102
|
+
}
|
103
|
+
}
|
104
|
+
async isApprovedForAll(account, operator, overrides, preparedData, ethCallContext) {
|
105
|
+
try {
|
106
|
+
if (preparedData?.ethCallResults && ethCallContext) {
|
107
|
+
const iface = new Interface([
|
108
|
+
"function isApprovedForAll(address,address) view returns (bool)"
|
109
|
+
]);
|
110
|
+
const calldata = iface.encodeFunctionData("isApprovedForAll", [
|
111
|
+
account,
|
112
|
+
operator
|
113
|
+
]);
|
114
|
+
const key = makeEthCallKey({
|
115
|
+
context: ethCallContext,
|
116
|
+
calldata
|
117
|
+
});
|
118
|
+
const ret = preparedData.ethCallResults[key];
|
119
|
+
if (ret) {
|
120
|
+
const result = iface.decodeFunctionResult("isApprovedForAll", ret).toArray();
|
121
|
+
return result.length == 1 ? result[0] : result;
|
122
|
+
}
|
123
|
+
}
|
124
|
+
return await this.contract.getFunction(
|
125
|
+
"isApprovedForAll(address,address)"
|
126
|
+
)(account, operator, overrides || {});
|
127
|
+
} catch (e) {
|
128
|
+
const stack = new Error().stack;
|
129
|
+
throw transformEtherError(e, void 0, stack);
|
130
|
+
}
|
131
|
+
}
|
132
|
+
async supportsInterface(interfaceId, overrides, preparedData, ethCallContext) {
|
133
|
+
try {
|
134
|
+
if (preparedData?.ethCallResults && ethCallContext) {
|
135
|
+
const iface = new Interface([
|
136
|
+
"function supportsInterface(bytes4) view returns (bool)"
|
137
|
+
]);
|
138
|
+
const calldata = iface.encodeFunctionData("supportsInterface", [
|
139
|
+
interfaceId
|
140
|
+
]);
|
141
|
+
const key = makeEthCallKey({
|
142
|
+
context: ethCallContext,
|
143
|
+
calldata
|
144
|
+
});
|
145
|
+
const ret = preparedData.ethCallResults[key];
|
146
|
+
if (ret) {
|
147
|
+
const result = iface.decodeFunctionResult("supportsInterface", ret).toArray();
|
148
|
+
return result.length == 1 ? result[0] : result;
|
149
|
+
}
|
150
|
+
}
|
151
|
+
return await this.contract.getFunction("supportsInterface(bytes4)")(
|
152
|
+
interfaceId,
|
153
|
+
overrides || {}
|
154
|
+
);
|
155
|
+
} catch (e) {
|
156
|
+
const stack = new Error().stack;
|
157
|
+
throw transformEtherError(e, void 0, stack);
|
158
|
+
}
|
159
|
+
}
|
160
|
+
async uri(id, overrides, preparedData, ethCallContext) {
|
161
|
+
try {
|
162
|
+
if (preparedData?.ethCallResults && ethCallContext) {
|
163
|
+
const iface = new Interface([
|
164
|
+
"function uri(uint256) view returns (string)"
|
165
|
+
]);
|
166
|
+
const calldata = iface.encodeFunctionData("uri", [id]);
|
167
|
+
const key = makeEthCallKey({
|
168
|
+
context: ethCallContext,
|
169
|
+
calldata
|
170
|
+
});
|
171
|
+
const ret = preparedData.ethCallResults[key];
|
172
|
+
if (ret) {
|
173
|
+
const result = iface.decodeFunctionResult("uri", ret).toArray();
|
174
|
+
return result.length == 1 ? result[0] : result;
|
175
|
+
}
|
176
|
+
}
|
177
|
+
return await this.contract.getFunction("uri(uint256)")(
|
178
|
+
id,
|
179
|
+
overrides || {}
|
180
|
+
);
|
181
|
+
} catch (e) {
|
182
|
+
const stack = new Error().stack;
|
183
|
+
throw transformEtherError(e, void 0, stack);
|
184
|
+
}
|
185
|
+
}
|
186
|
+
callStatic = {
|
187
|
+
contract: this.contract,
|
188
|
+
async safeBatchTransferFrom(from, to, ids, amounts, data, overrides, preparedData, ethCallContext) {
|
189
|
+
try {
|
190
|
+
if (preparedData?.ethCallResults && ethCallContext) {
|
191
|
+
const iface = new Interface([
|
192
|
+
"function safeBatchTransferFrom(address,address,uint256[],uint256[],bytes) nonpayable returns ()"
|
193
|
+
]);
|
194
|
+
const calldata = iface.encodeFunctionData("safeBatchTransferFrom", [
|
195
|
+
from,
|
196
|
+
to,
|
197
|
+
ids,
|
198
|
+
amounts,
|
199
|
+
data
|
200
|
+
]);
|
201
|
+
const key = makeEthCallKey({
|
202
|
+
context: ethCallContext,
|
203
|
+
calldata
|
204
|
+
});
|
205
|
+
const ret = preparedData.ethCallResults[key];
|
206
|
+
if (ret) {
|
207
|
+
const result = iface.decodeFunctionResult("safeBatchTransferFrom", ret).toArray();
|
208
|
+
return result.length == 1 ? result[0] : result;
|
209
|
+
}
|
210
|
+
}
|
211
|
+
return await this.contract.getFunction(
|
212
|
+
"safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)"
|
213
|
+
).staticCall(from, to, ids, amounts, data, overrides || {});
|
214
|
+
} catch (e) {
|
215
|
+
const stack = new Error().stack;
|
216
|
+
throw transformEtherError(e, void 0, stack);
|
217
|
+
}
|
218
|
+
},
|
219
|
+
async safeTransferFrom(from, to, id, amount, data, overrides, preparedData, ethCallContext) {
|
220
|
+
try {
|
221
|
+
if (preparedData?.ethCallResults && ethCallContext) {
|
222
|
+
const iface = new Interface([
|
223
|
+
"function safeTransferFrom(address,address,uint256,uint256,bytes) nonpayable returns ()"
|
224
|
+
]);
|
225
|
+
const calldata = iface.encodeFunctionData("safeTransferFrom", [
|
226
|
+
from,
|
227
|
+
to,
|
228
|
+
id,
|
229
|
+
amount,
|
230
|
+
data
|
231
|
+
]);
|
232
|
+
const key = makeEthCallKey({
|
233
|
+
context: ethCallContext,
|
234
|
+
calldata
|
235
|
+
});
|
236
|
+
const ret = preparedData.ethCallResults[key];
|
237
|
+
if (ret) {
|
238
|
+
const result = iface.decodeFunctionResult("safeTransferFrom", ret).toArray();
|
239
|
+
return result.length == 1 ? result[0] : result;
|
240
|
+
}
|
241
|
+
}
|
242
|
+
return await this.contract.getFunction(
|
243
|
+
"safeTransferFrom(address,address,uint256,uint256,bytes)"
|
244
|
+
).staticCall(from, to, id, amount, data, overrides || {});
|
245
|
+
} catch (e) {
|
246
|
+
const stack = new Error().stack;
|
247
|
+
throw transformEtherError(e, void 0, stack);
|
248
|
+
}
|
249
|
+
},
|
250
|
+
async setApprovalForAll(operator, approved, overrides, preparedData, ethCallContext) {
|
251
|
+
try {
|
252
|
+
if (preparedData?.ethCallResults && ethCallContext) {
|
253
|
+
const iface = new Interface([
|
254
|
+
"function setApprovalForAll(address,bool) nonpayable returns ()"
|
255
|
+
]);
|
256
|
+
const calldata = iface.encodeFunctionData("setApprovalForAll", [
|
257
|
+
operator,
|
258
|
+
approved
|
259
|
+
]);
|
260
|
+
const key = makeEthCallKey({
|
261
|
+
context: ethCallContext,
|
262
|
+
calldata
|
263
|
+
});
|
264
|
+
const ret = preparedData.ethCallResults[key];
|
265
|
+
if (ret) {
|
266
|
+
const result = iface.decodeFunctionResult("setApprovalForAll", ret).toArray();
|
267
|
+
return result.length == 1 ? result[0] : result;
|
268
|
+
}
|
269
|
+
}
|
270
|
+
return await this.contract.getFunction("setApprovalForAll(address,bool)").staticCall(operator, approved, overrides || {});
|
271
|
+
} catch (e) {
|
272
|
+
const stack = new Error().stack;
|
273
|
+
throw transformEtherError(e, void 0, stack);
|
274
|
+
}
|
275
|
+
}
|
276
|
+
};
|
277
|
+
encodeCall = {
|
278
|
+
balanceOf(account, id, ethCallContext) {
|
279
|
+
try {
|
280
|
+
const iface = new Interface(["function balanceOf(address,uint256)"]);
|
281
|
+
const calldata = iface.encodeFunctionData("balanceOf", [account, id]);
|
282
|
+
return {
|
283
|
+
context: ethCallContext,
|
284
|
+
calldata
|
285
|
+
};
|
286
|
+
} catch (e) {
|
287
|
+
const stack = new Error().stack;
|
288
|
+
throw transformEtherError(e, void 0, stack);
|
289
|
+
}
|
290
|
+
},
|
291
|
+
balanceOfBatch(accounts, ids, ethCallContext) {
|
292
|
+
try {
|
293
|
+
const iface = new Interface([
|
294
|
+
"function balanceOfBatch(address[],uint256[])"
|
295
|
+
]);
|
296
|
+
const calldata = iface.encodeFunctionData("balanceOfBatch", [
|
297
|
+
accounts,
|
298
|
+
ids
|
299
|
+
]);
|
300
|
+
return {
|
301
|
+
context: ethCallContext,
|
302
|
+
calldata
|
303
|
+
};
|
304
|
+
} catch (e) {
|
305
|
+
const stack = new Error().stack;
|
306
|
+
throw transformEtherError(e, void 0, stack);
|
307
|
+
}
|
308
|
+
},
|
309
|
+
isApprovedForAll(account, operator, ethCallContext) {
|
310
|
+
try {
|
311
|
+
const iface = new Interface([
|
312
|
+
"function isApprovedForAll(address,address)"
|
313
|
+
]);
|
314
|
+
const calldata = iface.encodeFunctionData("isApprovedForAll", [
|
315
|
+
account,
|
316
|
+
operator
|
317
|
+
]);
|
318
|
+
return {
|
319
|
+
context: ethCallContext,
|
320
|
+
calldata
|
321
|
+
};
|
322
|
+
} catch (e) {
|
323
|
+
const stack = new Error().stack;
|
324
|
+
throw transformEtherError(e, void 0, stack);
|
325
|
+
}
|
326
|
+
},
|
327
|
+
safeBatchTransferFrom(from, to, ids, amounts, data, ethCallContext) {
|
328
|
+
try {
|
329
|
+
const iface = new Interface([
|
330
|
+
"function safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)"
|
331
|
+
]);
|
332
|
+
const calldata = iface.encodeFunctionData("safeBatchTransferFrom", [
|
333
|
+
from,
|
334
|
+
to,
|
335
|
+
ids,
|
336
|
+
amounts,
|
337
|
+
data
|
338
|
+
]);
|
339
|
+
return {
|
340
|
+
context: ethCallContext,
|
341
|
+
calldata
|
342
|
+
};
|
343
|
+
} catch (e) {
|
344
|
+
const stack = new Error().stack;
|
345
|
+
throw transformEtherError(e, void 0, stack);
|
346
|
+
}
|
347
|
+
},
|
348
|
+
safeTransferFrom(from, to, id, amount, data, ethCallContext) {
|
349
|
+
try {
|
350
|
+
const iface = new Interface([
|
351
|
+
"function safeTransferFrom(address,address,uint256,uint256,bytes)"
|
352
|
+
]);
|
353
|
+
const calldata = iface.encodeFunctionData("safeTransferFrom", [
|
354
|
+
from,
|
355
|
+
to,
|
356
|
+
id,
|
357
|
+
amount,
|
358
|
+
data
|
359
|
+
]);
|
360
|
+
return {
|
361
|
+
context: ethCallContext,
|
362
|
+
calldata
|
363
|
+
};
|
364
|
+
} catch (e) {
|
365
|
+
const stack = new Error().stack;
|
366
|
+
throw transformEtherError(e, void 0, stack);
|
367
|
+
}
|
368
|
+
},
|
369
|
+
setApprovalForAll(operator, approved, ethCallContext) {
|
370
|
+
try {
|
371
|
+
const iface = new Interface([
|
372
|
+
"function setApprovalForAll(address,bool)"
|
373
|
+
]);
|
374
|
+
const calldata = iface.encodeFunctionData("setApprovalForAll", [
|
375
|
+
operator,
|
376
|
+
approved
|
377
|
+
]);
|
378
|
+
return {
|
379
|
+
context: ethCallContext,
|
380
|
+
calldata
|
381
|
+
};
|
382
|
+
} catch (e) {
|
383
|
+
const stack = new Error().stack;
|
384
|
+
throw transformEtherError(e, void 0, stack);
|
385
|
+
}
|
386
|
+
},
|
387
|
+
supportsInterface(interfaceId, ethCallContext) {
|
388
|
+
try {
|
389
|
+
const iface = new Interface(["function supportsInterface(bytes4)"]);
|
390
|
+
const calldata = iface.encodeFunctionData("supportsInterface", [
|
391
|
+
interfaceId
|
392
|
+
]);
|
393
|
+
return {
|
394
|
+
context: ethCallContext,
|
395
|
+
calldata
|
396
|
+
};
|
397
|
+
} catch (e) {
|
398
|
+
const stack = new Error().stack;
|
399
|
+
throw transformEtherError(e, void 0, stack);
|
400
|
+
}
|
401
|
+
},
|
402
|
+
uri(id, ethCallContext) {
|
403
|
+
try {
|
404
|
+
const iface = new Interface(["function uri(uint256)"]);
|
405
|
+
const calldata = iface.encodeFunctionData("uri", [id]);
|
406
|
+
return {
|
407
|
+
context: ethCallContext,
|
408
|
+
calldata
|
409
|
+
};
|
410
|
+
} catch (e) {
|
411
|
+
const stack = new Error().stack;
|
412
|
+
throw transformEtherError(e, void 0, stack);
|
413
|
+
}
|
414
|
+
}
|
415
|
+
};
|
416
|
+
};
|
417
|
+
var ERC1155BoundContractView = class extends BoundContractView {
|
418
|
+
async balanceOf(account, id, overrides) {
|
419
|
+
const ethCallContext = {
|
420
|
+
chainId: this.context.chainId,
|
421
|
+
blockTag: this.context.blockNumber.toString(16),
|
422
|
+
address: this.context.address
|
423
|
+
};
|
424
|
+
return await this.view.balanceOf(
|
425
|
+
account,
|
426
|
+
id,
|
427
|
+
{
|
428
|
+
blockTag: this.context.blockNumber,
|
429
|
+
...overrides
|
430
|
+
},
|
431
|
+
this.context.preparedData,
|
432
|
+
ethCallContext
|
433
|
+
);
|
434
|
+
}
|
435
|
+
async balanceOfBatch(accounts, ids, overrides) {
|
436
|
+
const ethCallContext = {
|
437
|
+
chainId: this.context.chainId,
|
438
|
+
blockTag: this.context.blockNumber.toString(16),
|
439
|
+
address: this.context.address
|
440
|
+
};
|
441
|
+
return await this.view.balanceOfBatch(
|
442
|
+
accounts,
|
443
|
+
ids,
|
444
|
+
{
|
445
|
+
blockTag: this.context.blockNumber,
|
446
|
+
...overrides
|
447
|
+
},
|
448
|
+
this.context.preparedData,
|
449
|
+
ethCallContext
|
450
|
+
);
|
451
|
+
}
|
452
|
+
async isApprovedForAll(account, operator, overrides) {
|
453
|
+
const ethCallContext = {
|
454
|
+
chainId: this.context.chainId,
|
455
|
+
blockTag: this.context.blockNumber.toString(16),
|
456
|
+
address: this.context.address
|
457
|
+
};
|
458
|
+
return await this.view.isApprovedForAll(
|
459
|
+
account,
|
460
|
+
operator,
|
461
|
+
{
|
462
|
+
blockTag: this.context.blockNumber,
|
463
|
+
...overrides
|
464
|
+
},
|
465
|
+
this.context.preparedData,
|
466
|
+
ethCallContext
|
467
|
+
);
|
468
|
+
}
|
469
|
+
async supportsInterface(interfaceId, overrides) {
|
470
|
+
const ethCallContext = {
|
471
|
+
chainId: this.context.chainId,
|
472
|
+
blockTag: this.context.blockNumber.toString(16),
|
473
|
+
address: this.context.address
|
474
|
+
};
|
475
|
+
return await this.view.supportsInterface(
|
476
|
+
interfaceId,
|
477
|
+
{
|
478
|
+
blockTag: this.context.blockNumber,
|
479
|
+
...overrides
|
480
|
+
},
|
481
|
+
this.context.preparedData,
|
482
|
+
ethCallContext
|
483
|
+
);
|
484
|
+
}
|
485
|
+
async uri(id, overrides) {
|
486
|
+
const ethCallContext = {
|
487
|
+
chainId: this.context.chainId,
|
488
|
+
blockTag: this.context.blockNumber.toString(16),
|
489
|
+
address: this.context.address
|
490
|
+
};
|
491
|
+
return await this.view.uri(
|
492
|
+
id,
|
493
|
+
{
|
494
|
+
blockTag: this.context.blockNumber,
|
495
|
+
...overrides
|
496
|
+
},
|
497
|
+
this.context.preparedData,
|
498
|
+
ethCallContext
|
499
|
+
);
|
500
|
+
}
|
501
|
+
callStatic = {
|
502
|
+
view: this.view,
|
503
|
+
context: this.context,
|
504
|
+
async safeBatchTransferFrom(from, to, ids, amounts, data, overrides) {
|
505
|
+
const ethCallContext = {
|
506
|
+
chainId: this.context.chainId,
|
507
|
+
blockTag: this.context.blockNumber.toString(16),
|
508
|
+
address: this.context.address
|
509
|
+
};
|
510
|
+
return await this.view.callStatic.safeBatchTransferFrom(
|
511
|
+
from,
|
512
|
+
to,
|
513
|
+
ids,
|
514
|
+
amounts,
|
515
|
+
data,
|
516
|
+
{
|
517
|
+
blockTag: this.context.blockNumber,
|
518
|
+
...overrides
|
519
|
+
},
|
520
|
+
this.context.preparedData,
|
521
|
+
ethCallContext
|
522
|
+
);
|
523
|
+
},
|
524
|
+
async safeTransferFrom(from, to, id, amount, data, overrides) {
|
525
|
+
const ethCallContext = {
|
526
|
+
chainId: this.context.chainId,
|
527
|
+
blockTag: this.context.blockNumber.toString(16),
|
528
|
+
address: this.context.address
|
529
|
+
};
|
530
|
+
return await this.view.callStatic.safeTransferFrom(
|
531
|
+
from,
|
532
|
+
to,
|
533
|
+
id,
|
534
|
+
amount,
|
535
|
+
data,
|
536
|
+
{
|
537
|
+
blockTag: this.context.blockNumber,
|
538
|
+
...overrides
|
539
|
+
},
|
540
|
+
this.context.preparedData,
|
541
|
+
ethCallContext
|
542
|
+
);
|
543
|
+
},
|
544
|
+
async setApprovalForAll(operator, approved, overrides) {
|
545
|
+
const ethCallContext = {
|
546
|
+
chainId: this.context.chainId,
|
547
|
+
blockTag: this.context.blockNumber.toString(16),
|
548
|
+
address: this.context.address
|
549
|
+
};
|
550
|
+
return await this.view.callStatic.setApprovalForAll(
|
551
|
+
operator,
|
552
|
+
approved,
|
553
|
+
{
|
554
|
+
blockTag: this.context.blockNumber,
|
555
|
+
...overrides
|
556
|
+
},
|
557
|
+
this.context.preparedData,
|
558
|
+
ethCallContext
|
559
|
+
);
|
560
|
+
}
|
561
|
+
};
|
562
|
+
encodeCall = {
|
563
|
+
view: this.view,
|
564
|
+
context: this.context,
|
565
|
+
balanceOf(account, id, overrides) {
|
566
|
+
const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
567
|
+
const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
|
568
|
+
const address = this.context.address;
|
569
|
+
return this.view.encodeCall.balanceOf(account, id, {
|
570
|
+
chainId,
|
571
|
+
address,
|
572
|
+
blockTag
|
573
|
+
});
|
574
|
+
},
|
575
|
+
balanceOfBatch(accounts, ids, overrides) {
|
576
|
+
const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
577
|
+
const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
|
578
|
+
const address = this.context.address;
|
579
|
+
return this.view.encodeCall.balanceOfBatch(accounts, ids, {
|
580
|
+
chainId,
|
581
|
+
address,
|
582
|
+
blockTag
|
583
|
+
});
|
584
|
+
},
|
585
|
+
isApprovedForAll(account, operator, overrides) {
|
586
|
+
const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
587
|
+
const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
|
588
|
+
const address = this.context.address;
|
589
|
+
return this.view.encodeCall.isApprovedForAll(account, operator, {
|
590
|
+
chainId,
|
591
|
+
address,
|
592
|
+
blockTag
|
593
|
+
});
|
594
|
+
},
|
595
|
+
safeBatchTransferFrom(from, to, ids, amounts, data, overrides) {
|
596
|
+
const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
597
|
+
const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
|
598
|
+
const address = this.context.address;
|
599
|
+
return this.view.encodeCall.safeBatchTransferFrom(
|
600
|
+
from,
|
601
|
+
to,
|
602
|
+
ids,
|
603
|
+
amounts,
|
604
|
+
data,
|
605
|
+
{ chainId, address, blockTag }
|
606
|
+
);
|
607
|
+
},
|
608
|
+
safeTransferFrom(from, to, id, amount, data, overrides) {
|
609
|
+
const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
610
|
+
const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
|
611
|
+
const address = this.context.address;
|
612
|
+
return this.view.encodeCall.safeTransferFrom(from, to, id, amount, data, {
|
613
|
+
chainId,
|
614
|
+
address,
|
615
|
+
blockTag
|
616
|
+
});
|
617
|
+
},
|
618
|
+
setApprovalForAll(operator, approved, overrides) {
|
619
|
+
const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
620
|
+
const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
|
621
|
+
const address = this.context.address;
|
622
|
+
return this.view.encodeCall.setApprovalForAll(operator, approved, {
|
623
|
+
chainId,
|
624
|
+
address,
|
625
|
+
blockTag
|
626
|
+
});
|
627
|
+
},
|
628
|
+
supportsInterface(interfaceId, overrides) {
|
629
|
+
const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
630
|
+
const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
|
631
|
+
const address = this.context.address;
|
632
|
+
return this.view.encodeCall.supportsInterface(interfaceId, {
|
633
|
+
chainId,
|
634
|
+
address,
|
635
|
+
blockTag
|
636
|
+
});
|
637
|
+
},
|
638
|
+
uri(id, overrides) {
|
639
|
+
const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString();
|
640
|
+
const blockTag = overrides?.blockTag?.toString() ?? this.context.blockNumber.toString(16);
|
641
|
+
const address = this.context.address;
|
642
|
+
return this.view.encodeCall.uri(id, { chainId, address, blockTag });
|
643
|
+
}
|
644
|
+
};
|
645
|
+
};
|
646
|
+
var _ERC1155Processor = class extends BaseProcessor {
|
647
|
+
onEventApprovalForAll(handler, filter, fetchConfig, preprocessHandler) {
|
648
|
+
if (!filter) {
|
649
|
+
filter = templateContract.filters["ApprovalForAll(address,address,bool)"](
|
650
|
+
null,
|
651
|
+
null,
|
652
|
+
null
|
653
|
+
);
|
654
|
+
}
|
655
|
+
return super.onEthEvent(handler, filter, fetchConfig, preprocessHandler);
|
656
|
+
}
|
657
|
+
onEventTransferBatch(handler, filter, fetchConfig, preprocessHandler) {
|
658
|
+
if (!filter) {
|
659
|
+
filter = templateContract.filters["TransferBatch(address,address,address,uint256[],uint256[])"](null, null, null, null, null);
|
660
|
+
}
|
661
|
+
return super.onEthEvent(handler, filter, fetchConfig, preprocessHandler);
|
662
|
+
}
|
663
|
+
onEventTransferSingle(handler, filter, fetchConfig, preprocessHandler) {
|
664
|
+
if (!filter) {
|
665
|
+
filter = templateContract.filters["TransferSingle(address,address,address,uint256,uint256)"](null, null, null, null, null);
|
666
|
+
}
|
667
|
+
return super.onEthEvent(handler, filter, fetchConfig, preprocessHandler);
|
668
|
+
}
|
669
|
+
onEventURI(handler, filter, fetchConfig, preprocessHandler) {
|
670
|
+
if (!filter) {
|
671
|
+
filter = templateContract.filters["URI(string,uint256)"](null, null);
|
672
|
+
}
|
673
|
+
return super.onEthEvent(handler, filter, fetchConfig, preprocessHandler);
|
674
|
+
}
|
675
|
+
onCallBalanceOf(handler, fetchConfig, preprocessHandler) {
|
676
|
+
return super.onEthTrace(
|
677
|
+
"0x00fdd58e",
|
678
|
+
handler,
|
679
|
+
fetchConfig,
|
680
|
+
preprocessHandler
|
681
|
+
);
|
682
|
+
}
|
683
|
+
onCallBalanceOfBatch(handler, fetchConfig, preprocessHandler) {
|
684
|
+
return super.onEthTrace(
|
685
|
+
"0x4e1273f4",
|
686
|
+
handler,
|
687
|
+
fetchConfig,
|
688
|
+
preprocessHandler
|
689
|
+
);
|
690
|
+
}
|
691
|
+
onCallIsApprovedForAll(handler, fetchConfig, preprocessHandler) {
|
692
|
+
return super.onEthTrace(
|
693
|
+
"0xe985e9c5",
|
694
|
+
handler,
|
695
|
+
fetchConfig,
|
696
|
+
preprocessHandler
|
697
|
+
);
|
698
|
+
}
|
699
|
+
onCallSafeBatchTransferFrom(handler, fetchConfig, preprocessHandler) {
|
700
|
+
return super.onEthTrace(
|
701
|
+
"0x2eb2c2d6",
|
702
|
+
handler,
|
703
|
+
fetchConfig,
|
704
|
+
preprocessHandler
|
705
|
+
);
|
706
|
+
}
|
707
|
+
onCallSafeTransferFrom(handler, fetchConfig, preprocessHandler) {
|
708
|
+
return super.onEthTrace(
|
709
|
+
"0xf242432a",
|
710
|
+
handler,
|
711
|
+
fetchConfig,
|
712
|
+
preprocessHandler
|
713
|
+
);
|
714
|
+
}
|
715
|
+
onCallSetApprovalForAll(handler, fetchConfig, preprocessHandler) {
|
716
|
+
return super.onEthTrace(
|
717
|
+
"0xa22cb465",
|
718
|
+
handler,
|
719
|
+
fetchConfig,
|
720
|
+
preprocessHandler
|
721
|
+
);
|
722
|
+
}
|
723
|
+
onCallSupportsInterface(handler, fetchConfig, preprocessHandler) {
|
724
|
+
return super.onEthTrace(
|
725
|
+
"0x01ffc9a7",
|
726
|
+
handler,
|
727
|
+
fetchConfig,
|
728
|
+
preprocessHandler
|
729
|
+
);
|
730
|
+
}
|
731
|
+
onCallUri(handler, fetchConfig, preprocessHandler) {
|
732
|
+
return super.onEthTrace(
|
733
|
+
"0x0e89341c",
|
734
|
+
handler,
|
735
|
+
fetchConfig,
|
736
|
+
preprocessHandler
|
737
|
+
);
|
738
|
+
}
|
739
|
+
CreateBoundContractView() {
|
740
|
+
const view = getERC1155Contract(this.config.network, this.config.address);
|
741
|
+
return new ERC1155BoundContractView(this.config.address, view);
|
742
|
+
}
|
743
|
+
static bind(options) {
|
744
|
+
if (!options.name) {
|
745
|
+
options.name = "ERC1155";
|
746
|
+
}
|
747
|
+
let processor = getProcessor(options);
|
748
|
+
if (!processor) {
|
749
|
+
processor = new _ERC1155Processor(options);
|
750
|
+
addProcessor(options, processor);
|
751
|
+
}
|
752
|
+
return processor;
|
753
|
+
}
|
754
|
+
};
|
755
|
+
var ERC1155Processor = _ERC1155Processor;
|
756
|
+
__publicField(ERC1155Processor, "filters", {
|
757
|
+
ApprovalForAll(account, operator, approved) {
|
758
|
+
return templateContract.filters["ApprovalForAll(address,address,bool)"](
|
759
|
+
account,
|
760
|
+
operator,
|
761
|
+
approved
|
762
|
+
);
|
763
|
+
},
|
764
|
+
TransferBatch(operator, from, to, ids, values) {
|
765
|
+
return templateContract.filters["TransferBatch(address,address,address,uint256[],uint256[])"](operator, from, to, ids, values);
|
766
|
+
},
|
767
|
+
TransferSingle(operator, from, to, id, value) {
|
768
|
+
return templateContract.filters["TransferSingle(address,address,address,uint256,uint256)"](operator, from, to, id, value);
|
769
|
+
},
|
770
|
+
URI(value, id) {
|
771
|
+
return templateContract.filters["URI(string,uint256)"](value, id);
|
772
|
+
}
|
773
|
+
});
|
774
|
+
var ERC1155ProcessorTemplate = class extends BaseProcessorTemplate {
|
775
|
+
bindInternal(options) {
|
776
|
+
if (!options.name) {
|
777
|
+
options.name = "ERC1155";
|
778
|
+
}
|
779
|
+
let processor = getProcessor(options);
|
780
|
+
if (!processor) {
|
781
|
+
processor = new ERC1155Processor(options);
|
782
|
+
addProcessor(options, processor);
|
783
|
+
}
|
784
|
+
return processor;
|
785
|
+
}
|
786
|
+
onEventApprovalForAll(handler, filter, fetchConfig, preprocessHandler) {
|
787
|
+
if (!filter) {
|
788
|
+
filter = templateContract.filters["ApprovalForAll(address,address,bool)"](
|
789
|
+
null,
|
790
|
+
null,
|
791
|
+
null
|
792
|
+
);
|
793
|
+
}
|
794
|
+
return super.onEthEvent(handler, filter, fetchConfig, preprocessHandler);
|
795
|
+
}
|
796
|
+
onEventTransferBatch(handler, filter, fetchConfig, preprocessHandler) {
|
797
|
+
if (!filter) {
|
798
|
+
filter = templateContract.filters["TransferBatch(address,address,address,uint256[],uint256[])"](null, null, null, null, null);
|
799
|
+
}
|
800
|
+
return super.onEthEvent(handler, filter, fetchConfig, preprocessHandler);
|
801
|
+
}
|
802
|
+
onEventTransferSingle(handler, filter, fetchConfig, preprocessHandler) {
|
803
|
+
if (!filter) {
|
804
|
+
filter = templateContract.filters["TransferSingle(address,address,address,uint256,uint256)"](null, null, null, null, null);
|
805
|
+
}
|
806
|
+
return super.onEthEvent(handler, filter, fetchConfig, preprocessHandler);
|
807
|
+
}
|
808
|
+
onEventURI(handler, filter, fetchConfig, preprocessHandler) {
|
809
|
+
if (!filter) {
|
810
|
+
filter = templateContract.filters["URI(string,uint256)"](null, null);
|
811
|
+
}
|
812
|
+
return super.onEthEvent(handler, filter, fetchConfig, preprocessHandler);
|
813
|
+
}
|
814
|
+
};
|
815
|
+
function getERC1155Contract(chainId, address) {
|
816
|
+
let contract = getContractByABI(
|
817
|
+
"ERC1155",
|
818
|
+
address,
|
819
|
+
chainId
|
820
|
+
);
|
821
|
+
if (!contract) {
|
822
|
+
const rawContract = ERC1155__factory.connect(address, getProvider(chainId));
|
823
|
+
contract = new ERC1155ContractView(rawContract);
|
824
|
+
addContractByABI("ERC1155", address, chainId, contract);
|
825
|
+
}
|
826
|
+
return contract;
|
827
|
+
}
|
828
|
+
function getERC1155ContractOnContext(context, address) {
|
829
|
+
const view = getERC1155Contract(context.getChainId(), address);
|
830
|
+
const boundView = new ERC1155BoundContractView(address, view);
|
831
|
+
boundView.context = context;
|
832
|
+
if (boundView.callStatic) {
|
833
|
+
boundView.callStatic.context = context;
|
834
|
+
}
|
835
|
+
return boundView;
|
836
|
+
}
|
837
|
+
|
838
|
+
// src/eth/builtin/internal/erc1155-test-utils.ts
|
839
|
+
var mockField = {
|
840
|
+
blockHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
841
|
+
blockNumber: 0,
|
842
|
+
logIndex: 0,
|
843
|
+
removed: false,
|
844
|
+
transactionHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
845
|
+
transactionIndex: 0
|
846
|
+
};
|
847
|
+
function mockApprovalForAllLog(contractAddress, event) {
|
848
|
+
const contract = getERC1155Contract(import_chain.EthChainId.ETHEREUM, contractAddress);
|
849
|
+
const encodedLog = contract.rawContract.interface.encodeEventLog(
|
850
|
+
"ApprovalForAll(address,address,bool)",
|
851
|
+
[event.account, event.operator, event.approved]
|
852
|
+
);
|
853
|
+
return {
|
854
|
+
...mockField,
|
855
|
+
index: 0,
|
856
|
+
address: contractAddress,
|
857
|
+
data: encodedLog.data,
|
858
|
+
topics: encodedLog.topics
|
859
|
+
};
|
860
|
+
}
|
861
|
+
function mockTransferBatchLog(contractAddress, event) {
|
862
|
+
const contract = getERC1155Contract(import_chain.EthChainId.ETHEREUM, contractAddress);
|
863
|
+
const encodedLog = contract.rawContract.interface.encodeEventLog(
|
864
|
+
"TransferBatch(address,address,address,uint256[],uint256[])",
|
865
|
+
[event.operator, event.from, event.to, event.ids, event.values]
|
866
|
+
);
|
867
|
+
return {
|
868
|
+
...mockField,
|
869
|
+
index: 0,
|
870
|
+
address: contractAddress,
|
871
|
+
data: encodedLog.data,
|
872
|
+
topics: encodedLog.topics
|
873
|
+
};
|
874
|
+
}
|
875
|
+
function mockTransferSingleLog(contractAddress, event) {
|
876
|
+
const contract = getERC1155Contract(import_chain.EthChainId.ETHEREUM, contractAddress);
|
877
|
+
const encodedLog = contract.rawContract.interface.encodeEventLog(
|
878
|
+
"TransferSingle(address,address,address,uint256,uint256)",
|
879
|
+
[event.operator, event.from, event.to, event.id, event.value]
|
880
|
+
);
|
881
|
+
return {
|
882
|
+
...mockField,
|
883
|
+
index: 0,
|
884
|
+
address: contractAddress,
|
885
|
+
data: encodedLog.data,
|
886
|
+
topics: encodedLog.topics
|
887
|
+
};
|
888
|
+
}
|
889
|
+
function mockURILog(contractAddress, event) {
|
890
|
+
const contract = getERC1155Contract(import_chain.EthChainId.ETHEREUM, contractAddress);
|
891
|
+
const encodedLog = contract.rawContract.interface.encodeEventLog(
|
892
|
+
"URI(string,uint256)",
|
893
|
+
[event.value, event.id]
|
894
|
+
);
|
895
|
+
return {
|
896
|
+
...mockField,
|
897
|
+
index: 0,
|
898
|
+
address: contractAddress,
|
899
|
+
data: encodedLog.data,
|
900
|
+
topics: encodedLog.topics
|
901
|
+
};
|
902
|
+
}
|
903
|
+
|
904
|
+
export {
|
905
|
+
ERC1155ContractView,
|
906
|
+
ERC1155BoundContractView,
|
907
|
+
ERC1155Processor,
|
908
|
+
ERC1155ProcessorTemplate,
|
909
|
+
getERC1155Contract,
|
910
|
+
getERC1155ContractOnContext,
|
911
|
+
mockApprovalForAllLog,
|
912
|
+
mockTransferBatchLog,
|
913
|
+
mockTransferSingleLog,
|
914
|
+
mockURILog,
|
915
|
+
erc1155_exports
|
916
|
+
};
|