@sentio/sdk 2.0.0-rc.13 → 2.0.0-rc.15
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/api.d.ts +5 -0
- package/lib/aptos/api.js +21 -0
- package/lib/aptos/api.js.map +1 -0
- package/lib/aptos/aptos-plugin.d.ts +14 -0
- package/lib/aptos/aptos-plugin.js +146 -0
- package/lib/aptos/aptos-plugin.js.map +1 -0
- package/lib/aptos/aptos-processor.d.ts +72 -0
- package/lib/aptos/aptos-processor.js +201 -0
- package/lib/aptos/aptos-processor.js.map +1 -0
- package/lib/aptos/builtin/0x1.d.ts +2140 -0
- package/lib/aptos/builtin/0x1.js +2727 -0
- package/lib/aptos/builtin/0x1.js.map +1 -0
- package/lib/aptos/builtin/0x3.d.ts +573 -0
- package/lib/aptos/builtin/0x3.js +496 -0
- package/lib/aptos/builtin/0x3.js.map +1 -0
- package/lib/aptos/builtin/index.d.ts +2 -0
- package/lib/aptos/builtin/index.js +6 -0
- package/lib/aptos/builtin/index.js.map +1 -0
- package/lib/aptos/codegen/codegen.d.ts +23 -0
- package/lib/aptos/codegen/codegen.js +388 -0
- package/lib/aptos/codegen/codegen.js.map +1 -0
- package/lib/aptos/codegen/index.d.ts +1 -0
- package/lib/aptos/codegen/index.js +2 -0
- package/lib/aptos/codegen/index.js.map +1 -0
- package/lib/aptos/codegen/typegen.d.ts +18 -0
- package/lib/aptos/codegen/typegen.js +145 -0
- package/lib/aptos/codegen/typegen.js.map +1 -0
- package/lib/aptos/codegen/typegen.test.d.ts +1 -0
- package/lib/aptos/codegen/typegen.test.js.map +1 -0
- package/lib/aptos/context.d.ts +21 -0
- package/lib/aptos/context.js +59 -0
- package/lib/aptos/context.js.map +1 -0
- package/lib/aptos/index.d.ts +9 -0
- package/lib/aptos/index.js +8 -0
- package/lib/aptos/index.js.map +1 -0
- package/lib/aptos/models.d.ts +37 -0
- package/lib/aptos/models.js +2 -0
- package/lib/aptos/models.js.map +1 -0
- package/lib/aptos/move-coder.d.ts +22 -0
- package/lib/aptos/move-coder.js +164 -0
- package/lib/aptos/move-coder.js.map +1 -0
- package/lib/aptos/move-types.d.ts +10 -0
- package/lib/aptos/move-types.js +2 -0
- package/lib/aptos/move-types.js.map +1 -0
- package/lib/aptos/network.d.ts +11 -0
- package/lib/aptos/network.js +27 -0
- package/lib/aptos/network.js.map +1 -0
- package/lib/aptos/run-codegen.d.ts +1 -0
- package/lib/aptos/run-codegen.js +12 -0
- package/lib/aptos/run-codegen.js.map +1 -0
- package/lib/aptos/tests/aptos.test.d.ts +1 -0
- package/lib/aptos/tests/aptos.test.js.map +1 -0
- package/lib/aptos/tests/souffl3.d.ts +1 -0
- package/lib/aptos/tests/souffl3.js +44 -0
- package/lib/aptos/tests/souffl3.js.map +1 -0
- package/lib/aptos/tests/types/index.d.ts +3 -0
- package/lib/aptos/tests/types/index.js +7 -0
- package/lib/aptos/tests/types/index.js.map +1 -0
- package/lib/aptos/tests/types/reserved.d.ts +445 -0
- package/lib/aptos/tests/types/reserved.js +301 -0
- package/lib/aptos/tests/types/reserved.js.map +1 -0
- package/lib/aptos/tests/types/soffl3.d.ts +1065 -0
- package/lib/aptos/tests/types/soffl3.js +548 -0
- package/lib/aptos/tests/types/soffl3.js.map +1 -0
- package/lib/aptos/tests/types/souffle.d.ts +440 -0
- package/lib/aptos/tests/types/souffle.js +295 -0
- package/lib/aptos/tests/types/souffle.js.map +1 -0
- package/lib/aptos/types.d.ts +9 -0
- package/lib/aptos/types.js +130 -0
- package/lib/aptos/types.js.map +1 -0
- package/lib/aptos/types.test.d.ts +1 -0
- package/lib/aptos/types.test.js.map +1 -0
- package/lib/aptos/utils.d.ts +7 -0
- package/lib/aptos/utils.js +20 -0
- package/lib/aptos/utils.js.map +1 -0
- package/lib/builtin/internal/eacaggregatorproxy_processor.js +90 -180
- package/lib/builtin/internal/eacaggregatorproxy_processor.js.map +1 -1
- package/lib/builtin/internal/erc1155_processor.js +25 -50
- package/lib/builtin/internal/erc1155_processor.js.map +1 -1
- package/lib/builtin/internal/erc20_processor.js +40 -80
- package/lib/builtin/internal/erc20_processor.js.map +1 -1
- package/lib/builtin/internal/erc20bytes_processor.js +30 -60
- package/lib/builtin/internal/erc20bytes_processor.js.map +1 -1
- package/lib/builtin/internal/erc721_processor.js +45 -90
- package/lib/builtin/internal/erc721_processor.js.map +1 -1
- package/lib/builtin/internal/weth9_processor.js +30 -60
- package/lib/builtin/internal/weth9_processor.js.map +1 -1
- package/lib/{utils/chain.d.ts → chain.d.ts} +0 -0
- package/lib/{utils/chain.js → chain.js} +0 -0
- package/lib/chain.js.map +1 -0
- package/lib/core/context.js +1 -1
- package/lib/core/context.js.map +1 -1
- package/lib/core/sui-plugin.js +1 -1
- package/lib/core/sui-plugin.js.map +1 -1
- package/lib/error.d.ts +1 -1
- package/lib/error.js +10 -12
- package/lib/error.js.map +1 -1
- package/lib/eth/base-processor-template.d.ts +3 -3
- package/lib/eth/base-processor-template.js.map +1 -1
- package/lib/eth/base-processor.d.ts +3 -3
- package/lib/eth/base-processor.js.map +1 -1
- package/lib/eth/{eth-event.d.ts → eth.d.ts} +1 -1
- package/lib/eth/eth.js +2 -0
- package/lib/eth/eth.js.map +1 -0
- package/lib/eth/index.d.ts +1 -0
- package/lib/eth/index.js +1 -0
- package/lib/eth/index.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/solana/builtin/index.d.ts +1 -0
- package/lib/solana/builtin/index.js +2 -0
- package/lib/solana/builtin/index.js.map +1 -0
- package/lib/solana/builtin/spl-token-processor.d.ts +39 -0
- package/lib/solana/builtin/spl-token-processor.js +254 -0
- package/lib/solana/builtin/spl-token-processor.js.map +1 -0
- package/lib/solana/builtin/types.d.ts +427 -0
- package/lib/solana/builtin/types.js +200 -0
- package/lib/solana/builtin/types.js.map +1 -0
- package/lib/solana/codegen/codegen.d.ts +1 -0
- package/lib/solana/codegen/codegen.js +122 -0
- package/lib/solana/codegen/codegen.js.map +1 -0
- package/lib/solana/codegen/index.d.ts +1 -0
- package/lib/solana/codegen/index.js +2 -0
- package/lib/solana/codegen/index.js.map +1 -0
- package/lib/solana/index.d.ts +4 -0
- package/lib/solana/index.js +5 -0
- package/lib/solana/index.js.map +1 -0
- package/lib/solana/run-codegen.d.ts +2 -0
- package/lib/solana/run-codegen.js +12 -0
- package/lib/solana/run-codegen.js.map +1 -0
- package/lib/solana/solana-context.d.ts +9 -0
- package/lib/solana/solana-context.js +28 -0
- package/lib/solana/solana-context.js.map +1 -0
- package/lib/solana/solana-options.d.ts +10 -0
- package/lib/solana/solana-options.js +10 -0
- package/lib/solana/solana-options.js.map +1 -0
- package/lib/solana/solana-plugin.d.ts +9 -0
- package/lib/solana/solana-plugin.js +87 -0
- package/lib/solana/solana-plugin.js.map +1 -0
- package/lib/solana/solana-processor.d.ts +43 -0
- package/lib/solana/solana-processor.js +72 -0
- package/lib/solana/solana-processor.js.map +1 -0
- package/lib/solana/tests/solana.test.d.ts +1 -0
- package/lib/solana/tests/solana.test.js.map +1 -0
- package/lib/solana/tests/types/basic_1.d.ts +26 -0
- package/lib/solana/tests/types/basic_1.js +63 -0
- package/lib/solana/tests/types/basic_1.js.map +1 -0
- package/lib/solana/tests/types/basic_1_processor.d.ts +21 -0
- package/lib/solana/tests/types/basic_1_processor.js +35 -0
- package/lib/solana/tests/types/basic_1_processor.js.map +1 -0
- package/lib/solana/tests/types/token_bridge.d.ts +29 -0
- package/lib/solana/tests/types/token_bridge.js +938 -0
- package/lib/solana/tests/types/token_bridge.js.map +1 -0
- package/lib/solana/tests/types/token_bridge_processor.d.ts +212 -0
- package/lib/solana/tests/types/token_bridge_processor.js +134 -0
- package/lib/solana/tests/types/token_bridge_processor.js.map +1 -0
- package/lib/solana/tests/wormhole-token-bridge.d.ts +15 -0
- package/lib/solana/tests/wormhole-token-bridge.js +79 -0
- package/lib/solana/tests/wormhole-token-bridge.js.map +1 -0
- package/lib/target-ethers-sentio/view-function.cjs +4 -9
- package/lib/target-ethers-sentio/view-function.cjs.map +1 -1
- package/lib/testing/test-processor-server.js +1 -1
- package/lib/testing/test-processor-server.js.map +1 -1
- package/lib/testing/test-provider.js +1 -1
- package/lib/testing/test-provider.js.map +1 -1
- package/lib/utils/index.d.ts +0 -1
- package/lib/utils/index.js +0 -1
- package/lib/utils/index.js.map +1 -1
- package/package.json +34 -11
- package/src/aptos/abis/0x1.json +9205 -0
- package/src/aptos/abis/0x3.json +1515 -0
- package/src/aptos/api.ts +23 -0
- package/src/aptos/aptos-plugin.ts +183 -0
- package/src/aptos/aptos-processor.ts +331 -0
- package/src/aptos/builtin/0x1.ts +4911 -0
- package/src/aptos/builtin/0x3.ts +1092 -0
- package/src/aptos/builtin/index.ts +5 -0
- package/src/aptos/codegen/codegen.ts +470 -0
- package/src/aptos/codegen/index.ts +1 -0
- package/src/aptos/codegen/tsconfig.json +8 -0
- package/src/aptos/codegen/typegen.ts +165 -0
- package/src/aptos/context.ts +72 -0
- package/src/aptos/index.ts +10 -0
- package/src/aptos/models.ts +47 -0
- package/src/aptos/move-coder.ts +201 -0
- package/src/aptos/move-types.ts +11 -0
- package/src/aptos/network.ts +29 -0
- package/src/aptos/run-codegen.ts +13 -0
- package/src/aptos/tests/abis/reserved.json +402 -0
- package/src/aptos/tests/abis/soffl3.json +1411 -0
- package/src/aptos/tests/abis/souffle.json +389 -0
- package/src/aptos/tests/souffl3.ts +57 -0
- package/src/aptos/tests/types/index.ts +6 -0
- package/src/aptos/tests/types/reserved.ts +881 -0
- package/src/aptos/tests/types/soffl3.ts +1820 -0
- package/src/aptos/tests/types/souffle.ts +880 -0
- package/src/aptos/types.ts +149 -0
- package/src/aptos/utils.ts +26 -0
- package/src/builtin/internal/eacaggregatorproxy_processor.ts +90 -162
- package/src/builtin/internal/erc1155_processor.ts +25 -49
- package/src/builtin/internal/erc20_processor.ts +40 -72
- package/src/builtin/internal/erc20bytes_processor.ts +30 -54
- package/src/builtin/internal/erc721_processor.ts +45 -81
- package/src/builtin/internal/weth9_processor.ts +30 -54
- package/src/{utils/chain.ts → chain.ts} +0 -0
- package/src/core/context.ts +1 -1
- package/src/core/sui-plugin.ts +1 -1
- package/src/error.ts +12 -14
- package/src/eth/base-processor-template.ts +3 -3
- package/src/eth/base-processor.ts +4 -4
- package/src/eth/{eth-event.ts → eth.ts} +1 -1
- package/src/eth/index.ts +2 -0
- package/src/index.ts +2 -2
- package/src/solana/builtin/index.ts +1 -0
- package/src/solana/builtin/spl-token-processor.ts +298 -0
- package/src/solana/builtin/types.ts +279 -0
- package/src/solana/codegen/codegen.ts +140 -0
- package/src/solana/codegen/index.ts +1 -0
- package/src/solana/codegen/tsconfig.json +8 -0
- package/src/solana/index.ts +4 -0
- package/src/solana/run-codegen.ts +13 -0
- package/src/solana/solana-context.ts +30 -0
- package/src/solana/solana-options.ts +11 -0
- package/src/solana/solana-plugin.ts +103 -0
- package/src/solana/solana-processor.ts +102 -0
- package/src/solana/tests/abis/basic_1.json +62 -0
- package/src/solana/tests/abis/token_bridge.json +937 -0
- package/src/solana/tests/types/basic_1.ts +62 -0
- package/src/solana/tests/types/basic_1_processor.ts +42 -0
- package/src/solana/tests/types/token_bridge.ts +937 -0
- package/src/solana/tests/types/token_bridge_processor.ts +150 -0
- package/src/solana/tests/wormhole-token-bridge.ts +96 -0
- package/src/target-ethers-sentio/view-function.cts +4 -11
- package/src/testing/test-processor-server.ts +1 -1
- package/src/testing/test-provider.ts +1 -1
- package/src/utils/index.ts +0 -1
- package/lib/eth/eth-event.js +0 -2
- package/lib/eth/eth-event.js.map +0 -1
- package/lib/utils/chain.js.map +0 -1
|
@@ -266,107 +266,75 @@ export class ERC20BoundContractView extends BoundContractView<
|
|
|
266
266
|
spender: string,
|
|
267
267
|
overrides?: Overrides
|
|
268
268
|
): Promise<bigint> {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
return await this.view.allowance(owner, spender, overrides || {});
|
|
276
|
-
} catch (e) {
|
|
277
|
-
throw transformEtherError(e, this.context);
|
|
269
|
+
if (!overrides && this.context) {
|
|
270
|
+
overrides = {
|
|
271
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
272
|
+
};
|
|
278
273
|
}
|
|
274
|
+
return await this.view.allowance(owner, spender, overrides || {});
|
|
279
275
|
}
|
|
280
276
|
|
|
281
277
|
async balanceOf(account: string, overrides?: Overrides): Promise<bigint> {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
return await this.view.balanceOf(account, overrides || {});
|
|
289
|
-
} catch (e) {
|
|
290
|
-
throw transformEtherError(e, this.context);
|
|
278
|
+
if (!overrides && this.context) {
|
|
279
|
+
overrides = {
|
|
280
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
281
|
+
};
|
|
291
282
|
}
|
|
283
|
+
return await this.view.balanceOf(account, overrides || {});
|
|
292
284
|
}
|
|
293
285
|
|
|
294
286
|
async decimals(overrides?: Overrides): Promise<bigint> {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
return await this.view.decimals(overrides || {});
|
|
302
|
-
} catch (e) {
|
|
303
|
-
throw transformEtherError(e, this.context);
|
|
287
|
+
if (!overrides && this.context) {
|
|
288
|
+
overrides = {
|
|
289
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
290
|
+
};
|
|
304
291
|
}
|
|
292
|
+
return await this.view.decimals(overrides || {});
|
|
305
293
|
}
|
|
306
294
|
|
|
307
295
|
async locker(overrides?: Overrides): Promise<string> {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
return await this.view.locker(overrides || {});
|
|
315
|
-
} catch (e) {
|
|
316
|
-
throw transformEtherError(e, this.context);
|
|
296
|
+
if (!overrides && this.context) {
|
|
297
|
+
overrides = {
|
|
298
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
299
|
+
};
|
|
317
300
|
}
|
|
301
|
+
return await this.view.locker(overrides || {});
|
|
318
302
|
}
|
|
319
303
|
|
|
320
304
|
async name(overrides?: Overrides): Promise<string> {
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
return await this.view.name(overrides || {});
|
|
328
|
-
} catch (e) {
|
|
329
|
-
throw transformEtherError(e, this.context);
|
|
305
|
+
if (!overrides && this.context) {
|
|
306
|
+
overrides = {
|
|
307
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
308
|
+
};
|
|
330
309
|
}
|
|
310
|
+
return await this.view.name(overrides || {});
|
|
331
311
|
}
|
|
332
312
|
|
|
333
313
|
async owner(overrides?: Overrides): Promise<string> {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
return await this.view.owner(overrides || {});
|
|
341
|
-
} catch (e) {
|
|
342
|
-
throw transformEtherError(e, this.context);
|
|
314
|
+
if (!overrides && this.context) {
|
|
315
|
+
overrides = {
|
|
316
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
317
|
+
};
|
|
343
318
|
}
|
|
319
|
+
return await this.view.owner(overrides || {});
|
|
344
320
|
}
|
|
345
321
|
|
|
346
322
|
async symbol(overrides?: Overrides): Promise<string> {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
};
|
|
352
|
-
}
|
|
353
|
-
return await this.view.symbol(overrides || {});
|
|
354
|
-
} catch (e) {
|
|
355
|
-
throw transformEtherError(e, this.context);
|
|
323
|
+
if (!overrides && this.context) {
|
|
324
|
+
overrides = {
|
|
325
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
326
|
+
};
|
|
356
327
|
}
|
|
328
|
+
return await this.view.symbol(overrides || {});
|
|
357
329
|
}
|
|
358
330
|
|
|
359
331
|
async totalSupply(overrides?: Overrides): Promise<bigint> {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
return await this.view.totalSupply(overrides || {});
|
|
367
|
-
} catch (e) {
|
|
368
|
-
throw transformEtherError(e, this.context);
|
|
332
|
+
if (!overrides && this.context) {
|
|
333
|
+
overrides = {
|
|
334
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
335
|
+
};
|
|
369
336
|
}
|
|
337
|
+
return await this.view.totalSupply(overrides || {});
|
|
370
338
|
}
|
|
371
339
|
}
|
|
372
340
|
|
|
@@ -172,68 +172,48 @@ export class ERC20BytesBoundContractView extends BoundContractView<
|
|
|
172
172
|
ERC20BytesContractView
|
|
173
173
|
> {
|
|
174
174
|
async name(overrides?: Overrides): Promise<string> {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
return await this.view.name(overrides || {});
|
|
182
|
-
} catch (e) {
|
|
183
|
-
throw transformEtherError(e, this.context);
|
|
175
|
+
if (!overrides && this.context) {
|
|
176
|
+
overrides = {
|
|
177
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
178
|
+
};
|
|
184
179
|
}
|
|
180
|
+
return await this.view.name(overrides || {});
|
|
185
181
|
}
|
|
186
182
|
|
|
187
183
|
async totalSupply(overrides?: Overrides): Promise<bigint> {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
return await this.view.totalSupply(overrides || {});
|
|
195
|
-
} catch (e) {
|
|
196
|
-
throw transformEtherError(e, this.context);
|
|
184
|
+
if (!overrides && this.context) {
|
|
185
|
+
overrides = {
|
|
186
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
187
|
+
};
|
|
197
188
|
}
|
|
189
|
+
return await this.view.totalSupply(overrides || {});
|
|
198
190
|
}
|
|
199
191
|
|
|
200
192
|
async decimals(overrides?: Overrides): Promise<bigint> {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
return await this.view.decimals(overrides || {});
|
|
208
|
-
} catch (e) {
|
|
209
|
-
throw transformEtherError(e, this.context);
|
|
193
|
+
if (!overrides && this.context) {
|
|
194
|
+
overrides = {
|
|
195
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
196
|
+
};
|
|
210
197
|
}
|
|
198
|
+
return await this.view.decimals(overrides || {});
|
|
211
199
|
}
|
|
212
200
|
|
|
213
201
|
async balanceOf(who: string, overrides?: Overrides): Promise<bigint> {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
return await this.view.balanceOf(who, overrides || {});
|
|
221
|
-
} catch (e) {
|
|
222
|
-
throw transformEtherError(e, this.context);
|
|
202
|
+
if (!overrides && this.context) {
|
|
203
|
+
overrides = {
|
|
204
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
205
|
+
};
|
|
223
206
|
}
|
|
207
|
+
return await this.view.balanceOf(who, overrides || {});
|
|
224
208
|
}
|
|
225
209
|
|
|
226
210
|
async symbol(overrides?: Overrides): Promise<string> {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
return await this.view.symbol(overrides || {});
|
|
234
|
-
} catch (e) {
|
|
235
|
-
throw transformEtherError(e, this.context);
|
|
211
|
+
if (!overrides && this.context) {
|
|
212
|
+
overrides = {
|
|
213
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
214
|
+
};
|
|
236
215
|
}
|
|
216
|
+
return await this.view.symbol(overrides || {});
|
|
237
217
|
}
|
|
238
218
|
|
|
239
219
|
async allowance(
|
|
@@ -241,16 +221,12 @@ export class ERC20BytesBoundContractView extends BoundContractView<
|
|
|
241
221
|
spender: string,
|
|
242
222
|
overrides?: Overrides
|
|
243
223
|
): Promise<bigint> {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
return await this.view.allowance(owner, spender, overrides || {});
|
|
251
|
-
} catch (e) {
|
|
252
|
-
throw transformEtherError(e, this.context);
|
|
224
|
+
if (!overrides && this.context) {
|
|
225
|
+
overrides = {
|
|
226
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
227
|
+
};
|
|
253
228
|
}
|
|
229
|
+
return await this.view.allowance(owner, spender, overrides || {});
|
|
254
230
|
}
|
|
255
231
|
}
|
|
256
232
|
|
|
@@ -273,45 +273,33 @@ export class ERC721BoundContractView extends BoundContractView<
|
|
|
273
273
|
ERC721ContractView
|
|
274
274
|
> {
|
|
275
275
|
async totalSupply(overrides?: Overrides): Promise<bigint> {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
return await this.view.totalSupply(overrides || {});
|
|
283
|
-
} catch (e) {
|
|
284
|
-
throw transformEtherError(e, this.context);
|
|
276
|
+
if (!overrides && this.context) {
|
|
277
|
+
overrides = {
|
|
278
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
279
|
+
};
|
|
285
280
|
}
|
|
281
|
+
return await this.view.totalSupply(overrides || {});
|
|
286
282
|
}
|
|
287
283
|
|
|
288
284
|
async balanceOf(owner: string, overrides?: Overrides): Promise<bigint> {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
return await this.view.balanceOf(owner, overrides || {});
|
|
296
|
-
} catch (e) {
|
|
297
|
-
throw transformEtherError(e, this.context);
|
|
285
|
+
if (!overrides && this.context) {
|
|
286
|
+
overrides = {
|
|
287
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
288
|
+
};
|
|
298
289
|
}
|
|
290
|
+
return await this.view.balanceOf(owner, overrides || {});
|
|
299
291
|
}
|
|
300
292
|
|
|
301
293
|
async getApproved(
|
|
302
294
|
tokenId: BigNumberish,
|
|
303
295
|
overrides?: Overrides
|
|
304
296
|
): Promise<string> {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
return await this.view.getApproved(tokenId, overrides || {});
|
|
312
|
-
} catch (e) {
|
|
313
|
-
throw transformEtherError(e, this.context);
|
|
297
|
+
if (!overrides && this.context) {
|
|
298
|
+
overrides = {
|
|
299
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
300
|
+
};
|
|
314
301
|
}
|
|
302
|
+
return await this.view.getApproved(tokenId, overrides || {});
|
|
315
303
|
}
|
|
316
304
|
|
|
317
305
|
async isApprovedForAll(
|
|
@@ -319,87 +307,63 @@ export class ERC721BoundContractView extends BoundContractView<
|
|
|
319
307
|
operator: string,
|
|
320
308
|
overrides?: Overrides
|
|
321
309
|
): Promise<boolean> {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
};
|
|
327
|
-
}
|
|
328
|
-
return await this.view.isApprovedForAll(owner, operator, overrides || {});
|
|
329
|
-
} catch (e) {
|
|
330
|
-
throw transformEtherError(e, this.context);
|
|
310
|
+
if (!overrides && this.context) {
|
|
311
|
+
overrides = {
|
|
312
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
313
|
+
};
|
|
331
314
|
}
|
|
315
|
+
return await this.view.isApprovedForAll(owner, operator, overrides || {});
|
|
332
316
|
}
|
|
333
317
|
|
|
334
318
|
async name(overrides?: Overrides): Promise<string> {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
|
-
return await this.view.name(overrides || {});
|
|
342
|
-
} catch (e) {
|
|
343
|
-
throw transformEtherError(e, this.context);
|
|
319
|
+
if (!overrides && this.context) {
|
|
320
|
+
overrides = {
|
|
321
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
322
|
+
};
|
|
344
323
|
}
|
|
324
|
+
return await this.view.name(overrides || {});
|
|
345
325
|
}
|
|
346
326
|
|
|
347
327
|
async ownerOf(tokenId: BigNumberish, overrides?: Overrides): Promise<string> {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
};
|
|
353
|
-
}
|
|
354
|
-
return await this.view.ownerOf(tokenId, overrides || {});
|
|
355
|
-
} catch (e) {
|
|
356
|
-
throw transformEtherError(e, this.context);
|
|
328
|
+
if (!overrides && this.context) {
|
|
329
|
+
overrides = {
|
|
330
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
331
|
+
};
|
|
357
332
|
}
|
|
333
|
+
return await this.view.ownerOf(tokenId, overrides || {});
|
|
358
334
|
}
|
|
359
335
|
|
|
360
336
|
async supportsInterface(
|
|
361
337
|
interfaceId: BytesLike,
|
|
362
338
|
overrides?: Overrides
|
|
363
339
|
): Promise<boolean> {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
return await this.view.supportsInterface(interfaceId, overrides || {});
|
|
371
|
-
} catch (e) {
|
|
372
|
-
throw transformEtherError(e, this.context);
|
|
340
|
+
if (!overrides && this.context) {
|
|
341
|
+
overrides = {
|
|
342
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
343
|
+
};
|
|
373
344
|
}
|
|
345
|
+
return await this.view.supportsInterface(interfaceId, overrides || {});
|
|
374
346
|
}
|
|
375
347
|
|
|
376
348
|
async symbol(overrides?: Overrides): Promise<string> {
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
};
|
|
382
|
-
}
|
|
383
|
-
return await this.view.symbol(overrides || {});
|
|
384
|
-
} catch (e) {
|
|
385
|
-
throw transformEtherError(e, this.context);
|
|
349
|
+
if (!overrides && this.context) {
|
|
350
|
+
overrides = {
|
|
351
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
352
|
+
};
|
|
386
353
|
}
|
|
354
|
+
return await this.view.symbol(overrides || {});
|
|
387
355
|
}
|
|
388
356
|
|
|
389
357
|
async tokenURI(
|
|
390
358
|
tokenId: BigNumberish,
|
|
391
359
|
overrides?: Overrides
|
|
392
360
|
): Promise<string> {
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
};
|
|
398
|
-
}
|
|
399
|
-
return await this.view.tokenURI(tokenId, overrides || {});
|
|
400
|
-
} catch (e) {
|
|
401
|
-
throw transformEtherError(e, this.context);
|
|
361
|
+
if (!overrides && this.context) {
|
|
362
|
+
overrides = {
|
|
363
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
364
|
+
};
|
|
402
365
|
}
|
|
366
|
+
return await this.view.tokenURI(tokenId, overrides || {});
|
|
403
367
|
}
|
|
404
368
|
}
|
|
405
369
|
|
|
@@ -182,68 +182,48 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
|
182
182
|
WETH9ContractView
|
|
183
183
|
> {
|
|
184
184
|
async name(overrides?: Overrides): Promise<string> {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
return await this.view.name(overrides || {});
|
|
192
|
-
} catch (e) {
|
|
193
|
-
throw transformEtherError(e, this.context);
|
|
185
|
+
if (!overrides && this.context) {
|
|
186
|
+
overrides = {
|
|
187
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
188
|
+
};
|
|
194
189
|
}
|
|
190
|
+
return await this.view.name(overrides || {});
|
|
195
191
|
}
|
|
196
192
|
|
|
197
193
|
async totalSupply(overrides?: Overrides): Promise<bigint> {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
return await this.view.totalSupply(overrides || {});
|
|
205
|
-
} catch (e) {
|
|
206
|
-
throw transformEtherError(e, this.context);
|
|
194
|
+
if (!overrides && this.context) {
|
|
195
|
+
overrides = {
|
|
196
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
197
|
+
};
|
|
207
198
|
}
|
|
199
|
+
return await this.view.totalSupply(overrides || {});
|
|
208
200
|
}
|
|
209
201
|
|
|
210
202
|
async decimals(overrides?: Overrides): Promise<bigint> {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
return await this.view.decimals(overrides || {});
|
|
218
|
-
} catch (e) {
|
|
219
|
-
throw transformEtherError(e, this.context);
|
|
203
|
+
if (!overrides && this.context) {
|
|
204
|
+
overrides = {
|
|
205
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
206
|
+
};
|
|
220
207
|
}
|
|
208
|
+
return await this.view.decimals(overrides || {});
|
|
221
209
|
}
|
|
222
210
|
|
|
223
211
|
async balanceOf(arg0: string, overrides?: Overrides): Promise<bigint> {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
return await this.view.balanceOf(arg0, overrides || {});
|
|
231
|
-
} catch (e) {
|
|
232
|
-
throw transformEtherError(e, this.context);
|
|
212
|
+
if (!overrides && this.context) {
|
|
213
|
+
overrides = {
|
|
214
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
215
|
+
};
|
|
233
216
|
}
|
|
217
|
+
return await this.view.balanceOf(arg0, overrides || {});
|
|
234
218
|
}
|
|
235
219
|
|
|
236
220
|
async symbol(overrides?: Overrides): Promise<string> {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
return await this.view.symbol(overrides || {});
|
|
244
|
-
} catch (e) {
|
|
245
|
-
throw transformEtherError(e, this.context);
|
|
221
|
+
if (!overrides && this.context) {
|
|
222
|
+
overrides = {
|
|
223
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
224
|
+
};
|
|
246
225
|
}
|
|
226
|
+
return await this.view.symbol(overrides || {});
|
|
247
227
|
}
|
|
248
228
|
|
|
249
229
|
async allowance(
|
|
@@ -251,16 +231,12 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
|
251
231
|
arg1: string,
|
|
252
232
|
overrides?: Overrides
|
|
253
233
|
): Promise<bigint> {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
return await this.view.allowance(arg0, arg1, overrides || {});
|
|
261
|
-
} catch (e) {
|
|
262
|
-
throw transformEtherError(e, this.context);
|
|
234
|
+
if (!overrides && this.context) {
|
|
235
|
+
overrides = {
|
|
236
|
+
blockTag: toBlockTag(this.context.blockNumber),
|
|
237
|
+
};
|
|
263
238
|
}
|
|
239
|
+
return await this.view.allowance(arg0, arg1, overrides || {});
|
|
264
240
|
}
|
|
265
241
|
}
|
|
266
242
|
|
|
File without changes
|
package/src/core/context.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { LogParams } from 'ethers/providers'
|
|
|
4
4
|
import { RecordMetaData } from '@sentio/protos'
|
|
5
5
|
import { Trace } from '../eth/trace.js'
|
|
6
6
|
import { Labels, normalizeLabels } from './metadata.js'
|
|
7
|
-
import { CHAIN_IDS } from '../
|
|
7
|
+
import { CHAIN_IDS } from '../chain.js'
|
|
8
8
|
import { BaseContext } from './base-context.js'
|
|
9
9
|
|
|
10
10
|
export abstract class EthContext extends BaseContext {
|
package/src/core/sui-plugin.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ContractConfig, DataBinding, HandlerType, ProcessConfigResponse, Proces
|
|
|
3
3
|
|
|
4
4
|
import { ServerError, Status } from 'nice-grpc'
|
|
5
5
|
|
|
6
|
-
import { CHAIN_IDS } from '../
|
|
6
|
+
import { CHAIN_IDS } from '../chain.js'
|
|
7
7
|
import { SuiProcessorState } from './sui-processor.js'
|
|
8
8
|
|
|
9
9
|
export class SuiPlugin extends Plugin {
|
package/src/error.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// Transform error in more readable format
|
|
2
2
|
import { ContractContext } from './core/context.js'
|
|
3
|
+
import { CallExceptionError } from 'ethers'
|
|
3
4
|
// import { errors } from 'ethers/providers'
|
|
4
5
|
|
|
5
|
-
export class
|
|
6
|
+
export class SimpleEthersError extends Error {
|
|
6
7
|
e: Error
|
|
7
8
|
|
|
8
9
|
constructor(message: string, e: Error) {
|
|
@@ -16,11 +17,14 @@ export class EthersError extends Error {
|
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
export function transformEtherError(e: Error, ctx: ContractContext<any, any> | undefined): Error {
|
|
20
|
+
if (e instanceof SimpleEthersError) {
|
|
21
|
+
return e
|
|
22
|
+
}
|
|
23
|
+
|
|
19
24
|
let msg = ''
|
|
20
|
-
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
if (e.data === '0x') {
|
|
25
|
+
const err = e as CallExceptionError
|
|
26
|
+
if (err.code === 'CALL_EXCEPTION') {
|
|
27
|
+
if (err.data === '0x') {
|
|
24
28
|
if (ctx) {
|
|
25
29
|
msg =
|
|
26
30
|
"jsonrpc eth_call return '0x' (likely contract not existed) at chain " +
|
|
@@ -28,18 +32,12 @@ export function transformEtherError(e: Error, ctx: ContractContext<any, any> | u
|
|
|
28
32
|
': ' +
|
|
29
33
|
JSON.stringify(e)
|
|
30
34
|
} else {
|
|
31
|
-
msg = "jsonrpc eth_call return '0x' (likely contract not existed): " + JSON.stringify(
|
|
35
|
+
msg = "jsonrpc eth_call return '0x' (likely contract not existed): " + JSON.stringify(err)
|
|
32
36
|
}
|
|
37
|
+
return new SimpleEthersError(msg, err)
|
|
33
38
|
}
|
|
34
|
-
return new EthersError(msg, e)
|
|
35
39
|
}
|
|
36
40
|
|
|
37
|
-
|
|
38
|
-
return e
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// TODO gracefully handle more errors
|
|
42
|
-
|
|
43
|
-
msg = 'ethers call error\n' + e.message + '\n' + e.stack?.toString()
|
|
41
|
+
msg = 'ethers call error\n' + JSON.stringify(e) + '\n' + e.stack?.toString()
|
|
44
42
|
return new Error(msg)
|
|
45
43
|
}
|
|
@@ -8,7 +8,7 @@ import { Trace } from './trace.js'
|
|
|
8
8
|
import { ListStateStorage } from '@sentio/runtime'
|
|
9
9
|
import { EventFilter, LogParams, Network } from 'ethers/providers'
|
|
10
10
|
import { DeferredTopicFilter } from 'ethers/contract'
|
|
11
|
-
import {
|
|
11
|
+
import { Eth } from './eth.js'
|
|
12
12
|
|
|
13
13
|
export class ProcessorTemplateProcessorState extends ListStateStorage<
|
|
14
14
|
BaseProcessorTemplate<BaseContract, BoundContractView<BaseContract, any>>
|
|
@@ -37,7 +37,7 @@ export abstract class BaseProcessorTemplate<
|
|
|
37
37
|
fetchConfig?: EthFetchConfig
|
|
38
38
|
}[] = []
|
|
39
39
|
eventHandlers: {
|
|
40
|
-
handler: (event:
|
|
40
|
+
handler: (event: Eth, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid
|
|
41
41
|
filter: DeferredTopicFilter | DeferredTopicFilter[]
|
|
42
42
|
fetchConfig?: EthFetchConfig
|
|
43
43
|
}[] = []
|
|
@@ -88,7 +88,7 @@ export abstract class BaseProcessorTemplate<
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
public onEvent(
|
|
91
|
-
handler: (event:
|
|
91
|
+
handler: (event: Eth, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid,
|
|
92
92
|
filter: DeferredTopicFilter | DeferredTopicFilter[],
|
|
93
93
|
fetchConfig?: EthFetchConfig
|
|
94
94
|
) {
|