@sentio/sdk 1.20.2 → 1.21.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/lib/aptos/aptos-processor.d.ts +10 -10
- package/lib/aptos/aptos-processor.js +65 -13
- package/lib/aptos/aptos-processor.js.map +1 -1
- package/lib/aptos/bind-options.d.ts +0 -6
- package/lib/aptos/bind-options.js +1 -8
- package/lib/aptos/bind-options.js.map +1 -1
- package/lib/aptos/context.d.ts +5 -4
- package/lib/aptos/context.js +9 -6
- package/lib/aptos/context.js.map +1 -1
- package/lib/aptos/index.d.ts +3 -2
- package/lib/aptos/index.js +1 -2
- package/lib/aptos/index.js.map +1 -1
- package/lib/aptos/runtime.d.ts +2 -0
- package/lib/aptos/runtime.js +16 -0
- package/lib/aptos/runtime.js.map +1 -0
- package/lib/aptos/types.d.ts +28 -0
- package/lib/aptos/types.js +159 -0
- package/lib/aptos/types.js.map +1 -0
- package/lib/aptos/utils.d.ts +6 -0
- package/lib/aptos/utils.js +19 -0
- package/lib/aptos/utils.js.map +1 -0
- package/lib/aptos-codegen/codegen.d.ts +5 -2
- package/lib/aptos-codegen/codegen.js +194 -17
- package/lib/aptos-codegen/codegen.js.map +1 -1
- package/lib/aptos-codegen/typegen.d.ts +18 -0
- package/lib/aptos-codegen/typegen.js +196 -0
- package/lib/aptos-codegen/typegen.js.map +1 -0
- package/lib/binds.d.ts +2 -3
- package/lib/binds.js +6 -33
- package/lib/binds.js.map +1 -1
- package/lib/builtin/aptos/0x1.d.ts +1624 -0
- package/lib/builtin/aptos/0x1.js +2502 -0
- package/lib/builtin/aptos/0x1.js.map +1 -0
- package/lib/builtin/aptos/0x3.d.ts +414 -0
- package/lib/builtin/aptos/0x3.js +461 -0
- package/lib/builtin/aptos/0x3.js.map +1 -0
- package/lib/builtin/internal/eacaggregatorproxy_processor.d.ts +2 -2
- package/lib/builtin/internal/eacaggregatorproxy_processor.js +12 -11
- package/lib/builtin/internal/eacaggregatorproxy_processor.js.map +1 -1
- package/lib/builtin/internal/erc20_processor.d.ts +2 -2
- package/lib/builtin/internal/erc20_processor.js +12 -11
- package/lib/builtin/internal/erc20_processor.js.map +1 -1
- package/lib/builtin/internal/erc20bytes_processor.d.ts +2 -2
- package/lib/builtin/internal/erc20bytes_processor.js +12 -11
- package/lib/builtin/internal/erc20bytes_processor.js.map +1 -1
- package/lib/builtin/internal/weth9_processor.d.ts +2 -2
- package/lib/builtin/internal/weth9_processor.js +12 -11
- package/lib/builtin/internal/weth9_processor.js.map +1 -1
- package/lib/builtin/solana/types.d.ts +5 -5
- package/lib/builtin/solana/wormhole-processor.d.ts +6 -6
- package/lib/builtin/solana/wormhole-processor.js +15 -12
- package/lib/builtin/solana/wormhole-processor.js.map +1 -1
- package/lib/cli/build.js +17 -16
- package/lib/cli/build.js.map +1 -1
- package/lib/core/base-processor-template.d.ts +7 -7
- package/lib/core/base-processor-template.js.map +1 -1
- package/lib/core/base-processor.d.ts +5 -6
- package/lib/core/base-processor.js +6 -4
- package/lib/core/base-processor.js.map +1 -1
- package/lib/core/big-decimal.d.ts +1 -0
- package/lib/core/big-decimal.js +6 -0
- package/lib/core/big-decimal.js.map +1 -0
- package/lib/core/bind-options.d.ts +0 -2
- package/lib/core/bind-options.js +4 -4
- package/lib/core/bind-options.js.map +1 -1
- package/lib/core/context.d.ts +14 -11
- package/lib/core/context.js +28 -19
- package/lib/core/context.js.map +1 -1
- package/lib/core/generic-processor.js +5 -5
- package/lib/core/generic-processor.js.map +1 -1
- package/lib/core/index.d.ts +5 -5
- package/lib/core/index.js +6 -6
- package/lib/core/index.js.map +1 -1
- package/lib/core/logger.d.ts +2 -3
- package/lib/core/logger.js +6 -6
- package/lib/core/logger.js.map +1 -1
- package/lib/core/metadata.d.ts +7 -4
- package/lib/core/metadata.js +13 -10
- package/lib/core/metadata.js.map +1 -1
- package/lib/core/meter.d.ts +4 -7
- package/lib/core/meter.js +12 -13
- package/lib/core/meter.js.map +1 -1
- package/lib/core/solana-processor.d.ts +7 -4
- package/lib/core/solana-processor.js +14 -20
- package/lib/core/solana-processor.js.map +1 -1
- package/lib/core/sui-processor.d.ts +5 -4
- package/lib/core/sui-processor.js +10 -17
- package/lib/core/sui-processor.js.map +1 -1
- package/lib/error.d.ts +2 -2
- package/lib/error.js.map +1 -1
- package/lib/gen/processor/protos/processor.d.ts +23 -12
- package/lib/gen/processor/protos/processor.js +129 -57
- package/lib/gen/processor/protos/processor.js.map +1 -1
- package/lib/index.d.ts +1 -2
- package/lib/index.js +1 -4
- package/lib/index.js.map +1 -1
- package/lib/processor-state.d.ts +1 -1
- package/lib/processor-state.js.map +1 -1
- package/lib/service.js +13 -12
- package/lib/service.js.map +1 -1
- package/lib/target-ethers-sentio/codegen.js +14 -15
- package/lib/target-ethers-sentio/codegen.js.map +1 -1
- package/lib/test-abi-code-gen.js.map +1 -1
- package/lib/testing/metric-utils.js +2 -2
- package/lib/testing/metric-utils.js.map +1 -1
- package/lib/tests/aptos.test.js +95 -2
- package/lib/tests/aptos.test.js.map +1 -1
- package/lib/tests/erc20.js +1 -1
- package/lib/tests/erc20.js.map +1 -1
- package/lib/tests/erc20.test.js +3 -4
- package/lib/tests/erc20.test.js.map +1 -1
- package/lib/tests/solana.test.js +5 -1
- package/lib/tests/solana.test.js.map +1 -1
- package/lib/tests/souffl3.js +17 -4
- package/lib/tests/souffl3.js.map +1 -1
- package/lib/tests/sui.test.js +1 -4
- package/lib/tests/sui.test.js.map +1 -1
- package/lib/tests/types/aptos/souffle.d.ts +311 -22
- package/lib/tests/types/aptos/souffle.js +140 -4
- package/lib/tests/types/aptos/souffle.js.map +1 -1
- package/lib/tests/types/solana/basic_1_processor.d.ts +2 -2
- package/lib/tests/types/solana/basic_1_processor.js +4 -4
- package/lib/tests/types/solana/basic_1_processor.js.map +1 -1
- package/lib/tests/wormhole-token-bridge.js +2 -1
- package/lib/tests/wormhole-token-bridge.js.map +1 -1
- package/lib/utils/chain.d.ts +1 -0
- package/lib/utils/chain.js +15 -1
- package/lib/utils/chain.js.map +1 -1
- package/lib/utils/conversion.d.ts +1 -1
- package/lib/utils/conversion.js.map +1 -1
- package/package.json +3 -2
- package/src/abis/aptos/0x1.json +9205 -0
- package/src/abis/aptos/0x3.json +1515 -0
- package/src/aptos/aptos-processor.ts +79 -18
- package/src/aptos/bind-options.ts +0 -7
- package/src/aptos/context.ts +11 -8
- package/src/aptos/index.ts +3 -2
- package/src/aptos/runtime.ts +13 -0
- package/src/aptos/types.ts +203 -0
- package/src/aptos/utils.ts +18 -0
- package/src/aptos-codegen/codegen.ts +221 -18
- package/src/aptos-codegen/typegen.test.ts +29 -0
- package/src/aptos-codegen/typegen.ts +216 -0
- package/src/binds.ts +5 -39
- package/src/builtin/aptos/0x1.ts +3760 -0
- package/src/builtin/aptos/0x3.ts +798 -0
- package/src/builtin/internal/eacaggregatorproxy_processor.ts +14 -31
- package/src/builtin/internal/erc20_processor.ts +14 -25
- package/src/builtin/internal/erc20bytes_processor.ts +14 -25
- package/src/builtin/internal/weth9_processor.ts +14 -25
- package/src/builtin/solana/wormhole-processor.ts +21 -18
- package/src/cli/build.ts +19 -17
- package/src/core/base-processor-template.ts +7 -7
- package/src/core/base-processor.ts +30 -9
- package/src/core/big-decimal.ts +1 -0
- package/src/core/bind-options.ts +3 -2
- package/src/core/context.ts +40 -24
- package/src/core/generic-processor.ts +6 -7
- package/src/core/index.ts +5 -5
- package/src/core/logger.ts +7 -7
- package/src/core/metadata.ts +14 -12
- package/src/core/meter.ts +12 -14
- package/src/core/solana-processor.ts +24 -21
- package/src/core/sui-processor.ts +10 -21
- package/src/error.ts +2 -2
- package/src/gen/processor/protos/processor.ts +158 -68
- package/src/index.ts +1 -2
- package/src/processor-state.ts +1 -1
- package/src/service.ts +22 -15
- package/src/target-ethers-sentio/codegen.ts +14 -15
- package/src/test-abi-code-gen.ts +1 -0
- package/src/testing/metric-utils.ts +2 -2
- package/src/tests/aptos.test.ts +102 -3
- package/src/tests/erc20.test.ts +3 -4
- package/src/tests/erc20.ts +1 -1
- package/src/tests/solana.test.ts +5 -1
- package/src/tests/souffl3.ts +21 -6
- package/src/tests/sui.test.ts +1 -4
- package/src/tests/types/aptos/souffle.ts +422 -40
- package/src/tests/types/solana/basic_1_processor.ts +6 -6
- package/src/tests/wormhole-token-bridge.ts +2 -1
- package/src/types/global.d.ts +1 -1
- package/src/utils/chain.ts +14 -0
- package/src/utils/conversion.ts +1 -1
- package/lib/contract-namer.d.ts +0 -6
- package/lib/contract-namer.js +0 -20
- package/lib/contract-namer.js.map +0 -1
- package/src/aptos-codegen/codgen.test.ts +0 -11
- package/src/contract-namer.ts +0 -17
|
@@ -14,10 +14,9 @@ import {
|
|
|
14
14
|
BaseProcessor,
|
|
15
15
|
BaseProcessorTemplate,
|
|
16
16
|
BoundContractView,
|
|
17
|
-
|
|
17
|
+
ContractContext,
|
|
18
18
|
ContractView,
|
|
19
19
|
DummyProvider,
|
|
20
|
-
getContractName,
|
|
21
20
|
TypedCallTrace,
|
|
22
21
|
} from "@sentio/sdk";
|
|
23
22
|
import { PromiseOrValue } from "./common";
|
|
@@ -827,7 +826,7 @@ export class EACAggregatorProxyBoundContractView extends BoundContractView<
|
|
|
827
826
|
}
|
|
828
827
|
}
|
|
829
828
|
|
|
830
|
-
export type EACAggregatorProxyContext =
|
|
829
|
+
export type EACAggregatorProxyContext = ContractContext<
|
|
831
830
|
EACAggregatorProxy,
|
|
832
831
|
EACAggregatorProxyBoundContractView
|
|
833
832
|
>;
|
|
@@ -837,20 +836,13 @@ export class EACAggregatorProxyProcessorTemplate extends BaseProcessorTemplate<
|
|
|
837
836
|
EACAggregatorProxyBoundContractView
|
|
838
837
|
> {
|
|
839
838
|
bindInternal(options: BindOptions) {
|
|
840
|
-
|
|
841
|
-
"EACAggregatorProxy"
|
|
842
|
-
|
|
843
|
-
) as EACAggregatorProxyProcessor;
|
|
839
|
+
if (!options.name) {
|
|
840
|
+
options.name = "EACAggregatorProxy";
|
|
841
|
+
}
|
|
842
|
+
let processor = getProcessor(options) as EACAggregatorProxyProcessor;
|
|
844
843
|
if (!processor) {
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
"EACAggregatorProxy",
|
|
848
|
-
options.name,
|
|
849
|
-
options.address,
|
|
850
|
-
options.network
|
|
851
|
-
);
|
|
852
|
-
processor = new EACAggregatorProxyProcessor(finalOptions);
|
|
853
|
-
addProcessor("EACAggregatorProxy", options, processor);
|
|
844
|
+
processor = new EACAggregatorProxyProcessor(options);
|
|
845
|
+
addProcessor(options, processor);
|
|
854
846
|
}
|
|
855
847
|
return processor;
|
|
856
848
|
}
|
|
@@ -1375,22 +1367,13 @@ export class EACAggregatorProxyProcessor extends BaseProcessor<
|
|
|
1375
1367
|
}
|
|
1376
1368
|
|
|
1377
1369
|
public static bind(options: BindOptions): EACAggregatorProxyProcessor {
|
|
1378
|
-
|
|
1379
|
-
"EACAggregatorProxy"
|
|
1380
|
-
|
|
1381
|
-
) as EACAggregatorProxyProcessor;
|
|
1370
|
+
if (!options.name) {
|
|
1371
|
+
options.name = "EACAggregatorProxy";
|
|
1372
|
+
}
|
|
1373
|
+
let processor = getProcessor(options) as EACAggregatorProxyProcessor;
|
|
1382
1374
|
if (!processor) {
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
const finalOptions = Object.assign({}, options);
|
|
1386
|
-
finalOptions.name = getContractName(
|
|
1387
|
-
"EACAggregatorProxy",
|
|
1388
|
-
options.name,
|
|
1389
|
-
options.address,
|
|
1390
|
-
options.network
|
|
1391
|
-
);
|
|
1392
|
-
processor = new EACAggregatorProxyProcessor(finalOptions);
|
|
1393
|
-
addProcessor("EACAggregatorProxy", options, processor);
|
|
1375
|
+
processor = new EACAggregatorProxyProcessor(options);
|
|
1376
|
+
addProcessor(options, processor);
|
|
1394
1377
|
}
|
|
1395
1378
|
return processor;
|
|
1396
1379
|
}
|
|
@@ -14,10 +14,9 @@ import {
|
|
|
14
14
|
BaseProcessor,
|
|
15
15
|
BaseProcessorTemplate,
|
|
16
16
|
BoundContractView,
|
|
17
|
-
|
|
17
|
+
ContractContext,
|
|
18
18
|
ContractView,
|
|
19
19
|
DummyProvider,
|
|
20
|
-
getContractName,
|
|
21
20
|
TypedCallTrace,
|
|
22
21
|
} from "@sentio/sdk";
|
|
23
22
|
import { PromiseOrValue } from "./common";
|
|
@@ -423,24 +422,20 @@ export class ERC20BoundContractView extends BoundContractView<
|
|
|
423
422
|
}
|
|
424
423
|
}
|
|
425
424
|
|
|
426
|
-
export type ERC20Context =
|
|
425
|
+
export type ERC20Context = ContractContext<ERC20, ERC20BoundContractView>;
|
|
427
426
|
|
|
428
427
|
export class ERC20ProcessorTemplate extends BaseProcessorTemplate<
|
|
429
428
|
ERC20,
|
|
430
429
|
ERC20BoundContractView
|
|
431
430
|
> {
|
|
432
431
|
bindInternal(options: BindOptions) {
|
|
433
|
-
|
|
432
|
+
if (!options.name) {
|
|
433
|
+
options.name = "ERC20";
|
|
434
|
+
}
|
|
435
|
+
let processor = getProcessor(options) as ERC20Processor;
|
|
434
436
|
if (!processor) {
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
"ERC20",
|
|
438
|
-
options.name,
|
|
439
|
-
options.address,
|
|
440
|
-
options.network
|
|
441
|
-
);
|
|
442
|
-
processor = new ERC20Processor(finalOptions);
|
|
443
|
-
addProcessor("ERC20", options, processor);
|
|
437
|
+
processor = new ERC20Processor(options);
|
|
438
|
+
addProcessor(options, processor);
|
|
444
439
|
}
|
|
445
440
|
return processor;
|
|
446
441
|
}
|
|
@@ -738,19 +733,13 @@ export class ERC20Processor extends BaseProcessor<
|
|
|
738
733
|
}
|
|
739
734
|
|
|
740
735
|
public static bind(options: BindOptions): ERC20Processor {
|
|
741
|
-
|
|
736
|
+
if (!options.name) {
|
|
737
|
+
options.name = "ERC20";
|
|
738
|
+
}
|
|
739
|
+
let processor = getProcessor(options) as ERC20Processor;
|
|
742
740
|
if (!processor) {
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
const finalOptions = Object.assign({}, options);
|
|
746
|
-
finalOptions.name = getContractName(
|
|
747
|
-
"ERC20",
|
|
748
|
-
options.name,
|
|
749
|
-
options.address,
|
|
750
|
-
options.network
|
|
751
|
-
);
|
|
752
|
-
processor = new ERC20Processor(finalOptions);
|
|
753
|
-
addProcessor("ERC20", options, processor);
|
|
741
|
+
processor = new ERC20Processor(options);
|
|
742
|
+
addProcessor(options, processor);
|
|
754
743
|
}
|
|
755
744
|
return processor;
|
|
756
745
|
}
|
|
@@ -14,10 +14,9 @@ import {
|
|
|
14
14
|
BaseProcessor,
|
|
15
15
|
BaseProcessorTemplate,
|
|
16
16
|
BoundContractView,
|
|
17
|
-
|
|
17
|
+
ContractContext,
|
|
18
18
|
ContractView,
|
|
19
19
|
DummyProvider,
|
|
20
|
-
getContractName,
|
|
21
20
|
TypedCallTrace,
|
|
22
21
|
} from "@sentio/sdk";
|
|
23
22
|
import { PromiseOrValue } from "./common";
|
|
@@ -297,7 +296,7 @@ export class ERC20BytesBoundContractView extends BoundContractView<
|
|
|
297
296
|
}
|
|
298
297
|
}
|
|
299
298
|
|
|
300
|
-
export type ERC20BytesContext =
|
|
299
|
+
export type ERC20BytesContext = ContractContext<
|
|
301
300
|
ERC20Bytes,
|
|
302
301
|
ERC20BytesBoundContractView
|
|
303
302
|
>;
|
|
@@ -307,17 +306,13 @@ export class ERC20BytesProcessorTemplate extends BaseProcessorTemplate<
|
|
|
307
306
|
ERC20BytesBoundContractView
|
|
308
307
|
> {
|
|
309
308
|
bindInternal(options: BindOptions) {
|
|
310
|
-
|
|
309
|
+
if (!options.name) {
|
|
310
|
+
options.name = "ERC20Bytes";
|
|
311
|
+
}
|
|
312
|
+
let processor = getProcessor(options) as ERC20BytesProcessor;
|
|
311
313
|
if (!processor) {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
"ERC20Bytes",
|
|
315
|
-
options.name,
|
|
316
|
-
options.address,
|
|
317
|
-
options.network
|
|
318
|
-
);
|
|
319
|
-
processor = new ERC20BytesProcessor(finalOptions);
|
|
320
|
-
addProcessor("ERC20Bytes", options, processor);
|
|
314
|
+
processor = new ERC20BytesProcessor(options);
|
|
315
|
+
addProcessor(options, processor);
|
|
321
316
|
}
|
|
322
317
|
return processor;
|
|
323
318
|
}
|
|
@@ -502,19 +497,13 @@ export class ERC20BytesProcessor extends BaseProcessor<
|
|
|
502
497
|
}
|
|
503
498
|
|
|
504
499
|
public static bind(options: BindOptions): ERC20BytesProcessor {
|
|
505
|
-
|
|
500
|
+
if (!options.name) {
|
|
501
|
+
options.name = "ERC20Bytes";
|
|
502
|
+
}
|
|
503
|
+
let processor = getProcessor(options) as ERC20BytesProcessor;
|
|
506
504
|
if (!processor) {
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
const finalOptions = Object.assign({}, options);
|
|
510
|
-
finalOptions.name = getContractName(
|
|
511
|
-
"ERC20Bytes",
|
|
512
|
-
options.name,
|
|
513
|
-
options.address,
|
|
514
|
-
options.network
|
|
515
|
-
);
|
|
516
|
-
processor = new ERC20BytesProcessor(finalOptions);
|
|
517
|
-
addProcessor("ERC20Bytes", options, processor);
|
|
505
|
+
processor = new ERC20BytesProcessor(options);
|
|
506
|
+
addProcessor(options, processor);
|
|
518
507
|
}
|
|
519
508
|
return processor;
|
|
520
509
|
}
|
|
@@ -14,10 +14,9 @@ import {
|
|
|
14
14
|
BaseProcessor,
|
|
15
15
|
BaseProcessorTemplate,
|
|
16
16
|
BoundContractView,
|
|
17
|
-
|
|
17
|
+
ContractContext,
|
|
18
18
|
ContractView,
|
|
19
19
|
DummyProvider,
|
|
20
|
-
getContractName,
|
|
21
20
|
TypedCallTrace,
|
|
22
21
|
} from "@sentio/sdk";
|
|
23
22
|
import { PromiseOrValue } from "./common";
|
|
@@ -306,24 +305,20 @@ export class WETH9BoundContractView extends BoundContractView<
|
|
|
306
305
|
}
|
|
307
306
|
}
|
|
308
307
|
|
|
309
|
-
export type WETH9Context =
|
|
308
|
+
export type WETH9Context = ContractContext<WETH9, WETH9BoundContractView>;
|
|
310
309
|
|
|
311
310
|
export class WETH9ProcessorTemplate extends BaseProcessorTemplate<
|
|
312
311
|
WETH9,
|
|
313
312
|
WETH9BoundContractView
|
|
314
313
|
> {
|
|
315
314
|
bindInternal(options: BindOptions) {
|
|
316
|
-
|
|
315
|
+
if (!options.name) {
|
|
316
|
+
options.name = "WETH9";
|
|
317
|
+
}
|
|
318
|
+
let processor = getProcessor(options) as WETH9Processor;
|
|
317
319
|
if (!processor) {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
"WETH9",
|
|
321
|
-
options.name,
|
|
322
|
-
options.address,
|
|
323
|
-
options.network
|
|
324
|
-
);
|
|
325
|
-
processor = new WETH9Processor(finalOptions);
|
|
326
|
-
addProcessor("WETH9", options, processor);
|
|
320
|
+
processor = new WETH9Processor(options);
|
|
321
|
+
addProcessor(options, processor);
|
|
327
322
|
}
|
|
328
323
|
return processor;
|
|
329
324
|
}
|
|
@@ -567,19 +562,13 @@ export class WETH9Processor extends BaseProcessor<
|
|
|
567
562
|
}
|
|
568
563
|
|
|
569
564
|
public static bind(options: BindOptions): WETH9Processor {
|
|
570
|
-
|
|
565
|
+
if (!options.name) {
|
|
566
|
+
options.name = "WETH9";
|
|
567
|
+
}
|
|
568
|
+
let processor = getProcessor(options) as WETH9Processor;
|
|
571
569
|
if (!processor) {
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
const finalOptions = Object.assign({}, options);
|
|
575
|
-
finalOptions.name = getContractName(
|
|
576
|
-
"WETH9",
|
|
577
|
-
options.name,
|
|
578
|
-
options.address,
|
|
579
|
-
options.network
|
|
580
|
-
);
|
|
581
|
-
processor = new WETH9Processor(finalOptions);
|
|
582
|
-
addProcessor("WETH9", options, processor);
|
|
570
|
+
processor = new WETH9Processor(options);
|
|
571
|
+
addProcessor(options, processor);
|
|
583
572
|
}
|
|
584
573
|
return processor;
|
|
585
574
|
}
|
|
@@ -46,6 +46,9 @@ export class TokenBridgeProcessor extends SolanaBaseProcessor {
|
|
|
46
46
|
]
|
|
47
47
|
|
|
48
48
|
static bind(options: SolanaBindOptions): TokenBridgeProcessor {
|
|
49
|
+
if (options && !options.name) {
|
|
50
|
+
options.name = 'WormholeTokenBridge'
|
|
51
|
+
}
|
|
49
52
|
return new TokenBridgeProcessor(options)
|
|
50
53
|
}
|
|
51
54
|
|
|
@@ -118,56 +121,56 @@ export class TokenBridgeProcessor extends SolanaBaseProcessor {
|
|
|
118
121
|
}
|
|
119
122
|
}
|
|
120
123
|
|
|
121
|
-
onInitialize(handler: (args: any, ctx: SolanaContext) => void): TokenBridgeProcessor {
|
|
122
|
-
this.onInstruction('Initialize', (ins: Instruction, ctx) => {
|
|
124
|
+
onInitialize(handler: (args: any, accounts: string[], ctx: SolanaContext) => void): TokenBridgeProcessor {
|
|
125
|
+
this.onInstruction('Initialize', (ins: Instruction, ctx, accounts: string[]) => {
|
|
123
126
|
if (ins) {
|
|
124
|
-
handler(ins.data, ctx)
|
|
127
|
+
handler(ins.data, accounts, ctx)
|
|
125
128
|
}
|
|
126
129
|
})
|
|
127
130
|
return this
|
|
128
131
|
}
|
|
129
132
|
|
|
130
|
-
onAttestToken(handler: (args: any, ctx: SolanaContext) => void): TokenBridgeProcessor {
|
|
131
|
-
this.onInstruction('AttestToken', (ins: Instruction, ctx) => {
|
|
133
|
+
onAttestToken(handler: (args: any, accounts: string[], ctx: SolanaContext) => void): TokenBridgeProcessor {
|
|
134
|
+
this.onInstruction('AttestToken', (ins: Instruction, ctx, accounts: string[]) => {
|
|
132
135
|
if (ins) {
|
|
133
|
-
handler(ins.data, ctx)
|
|
136
|
+
handler(ins.data, accounts, ctx)
|
|
134
137
|
}
|
|
135
138
|
})
|
|
136
139
|
return this
|
|
137
140
|
}
|
|
138
141
|
|
|
139
142
|
|
|
140
|
-
onTransferWrapped(handler: (args: any, ctx: SolanaContext) => void): TokenBridgeProcessor {
|
|
141
|
-
this.onInstruction('TransferWrapped', (ins: Instruction, ctx) => {
|
|
143
|
+
onTransferWrapped(handler: (args: any, accounts: string[], ctx: SolanaContext) => void): TokenBridgeProcessor {
|
|
144
|
+
this.onInstruction('TransferWrapped', (ins: Instruction, ctx, accounts: string[]) => {
|
|
142
145
|
if (ins) {
|
|
143
|
-
handler(ins.data, ctx)
|
|
146
|
+
handler(ins.data, accounts, ctx)
|
|
144
147
|
}
|
|
145
148
|
})
|
|
146
149
|
return this
|
|
147
150
|
}
|
|
148
151
|
|
|
149
|
-
onTransferNativeWithPayload(handler: (args: any, ctx: SolanaContext) => void): TokenBridgeProcessor {
|
|
150
|
-
this.onInstruction('TransferNativeWithPayload', (ins: Instruction, ctx) => {
|
|
152
|
+
onTransferNativeWithPayload(handler: (args: any, accounts: string[], ctx: SolanaContext) => void): TokenBridgeProcessor {
|
|
153
|
+
this.onInstruction('TransferNativeWithPayload', (ins: Instruction, ctx, accounts: string[]) => {
|
|
151
154
|
if (ins) {
|
|
152
|
-
handler(ins.data, ctx)
|
|
155
|
+
handler(ins.data, accounts, ctx)
|
|
153
156
|
}
|
|
154
157
|
})
|
|
155
158
|
return this
|
|
156
159
|
}
|
|
157
160
|
|
|
158
|
-
onTransferWrappedWithPaylod(handler: (args: any, ctx: SolanaContext) => void): TokenBridgeProcessor {
|
|
159
|
-
this.onInstruction('TransferWrappedWithPaylod', (ins: Instruction, ctx) => {
|
|
161
|
+
onTransferWrappedWithPaylod(handler: (args: any, accounts: string[], ctx: SolanaContext) => void): TokenBridgeProcessor {
|
|
162
|
+
this.onInstruction('TransferWrappedWithPaylod', (ins: Instruction, ctx, accounts: string[]) => {
|
|
160
163
|
if (ins) {
|
|
161
|
-
handler(ins.data, ctx)
|
|
164
|
+
handler(ins.data, accounts, ctx)
|
|
162
165
|
}
|
|
163
166
|
})
|
|
164
167
|
return this
|
|
165
168
|
}
|
|
166
169
|
|
|
167
|
-
onTransferNative(handler: (args: any, ctx: SolanaContext) => void): TokenBridgeProcessor {
|
|
168
|
-
this.onInstruction('TransferNative', (ins: Instruction, ctx) => {
|
|
170
|
+
onTransferNative(handler: (args: any, accounts: string[], ctx: SolanaContext) => void): TokenBridgeProcessor {
|
|
171
|
+
this.onInstruction('TransferNative', (ins: Instruction, ctx, accounts: string[]) => {
|
|
169
172
|
if (ins) {
|
|
170
|
-
handler(ins.data, ctx)
|
|
173
|
+
handler(ins.data, accounts, ctx)
|
|
171
174
|
}
|
|
172
175
|
})
|
|
173
176
|
return this
|
package/src/cli/build.ts
CHANGED
|
@@ -2,7 +2,7 @@ import chalk from 'chalk'
|
|
|
2
2
|
import path from 'path'
|
|
3
3
|
import fs from 'fs'
|
|
4
4
|
import { exec } from 'child_process'
|
|
5
|
-
import {
|
|
5
|
+
import { generate } from '../aptos-codegen/codegen'
|
|
6
6
|
// import { EVM, SOLANA, Target } from './config'
|
|
7
7
|
|
|
8
8
|
export async function buildProcessor(onlyGen: boolean) {
|
|
@@ -41,21 +41,23 @@ export function codeGenAptosProcessor(abisDir: string, outDir = 'src/types/aptos
|
|
|
41
41
|
return
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
const files = fs.readdirSync(abisDir)
|
|
44
|
+
// const files = fs.readdirSync(abisDir)
|
|
45
45
|
|
|
46
46
|
console.log(chalk.green('Generated Types for Aptos'))
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
47
|
+
|
|
48
|
+
generate(abisDir, outDir)
|
|
49
|
+
// for (const file of files) {
|
|
50
|
+
// if (path.extname(file) === '.json') {
|
|
51
|
+
// if (!fs.existsSync(outDir)) {
|
|
52
|
+
// fs.mkdirSync(outDir, { recursive: true })
|
|
53
|
+
// }
|
|
54
|
+
// }
|
|
55
|
+
// const codegen = new AptosAccountCodegen({
|
|
56
|
+
// srcFile: path.join(abisDir, file),
|
|
57
|
+
// outputDir: outDir,
|
|
58
|
+
// })
|
|
59
|
+
// codegen.generate()
|
|
60
|
+
// }
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
export async function codeGenEthersProcessor(
|
|
@@ -149,10 +151,10 @@ function codeGenSolanaInstruction(idlName: string, ins: any): string {
|
|
|
149
151
|
return `
|
|
150
152
|
on${
|
|
151
153
|
instructionName.charAt(0).toUpperCase() + instructionName.slice(1)
|
|
152
|
-
}(handler: (args: ${argsTypeString}, ctx: SolanaContext) => void): ${idlName}Processor {
|
|
153
|
-
this.onInstruction('${instructionName}', (ins: Instruction, ctx) => {
|
|
154
|
+
}(handler: (args: ${argsTypeString}, accounts: string[], ctx: SolanaContext) => void): ${idlName}Processor {
|
|
155
|
+
this.onInstruction('${instructionName}', (ins: Instruction, ctx, accounts: string[]) => {
|
|
154
156
|
if (ins) {
|
|
155
|
-
handler(ins.data as ${argsTypeString}, ctx)
|
|
157
|
+
handler(ins.data as ${argsTypeString}, accounts, ctx)
|
|
156
158
|
}
|
|
157
159
|
})
|
|
158
160
|
return this
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BoundContractView,
|
|
1
|
+
import { BoundContractView, ContractContext, ContractView } from './context'
|
|
2
2
|
import { Block } from '@ethersproject/abstract-provider'
|
|
3
3
|
import { BaseContract, EventFilter } from 'ethers'
|
|
4
4
|
import { Event } from '@ethersproject/contracts'
|
|
@@ -16,13 +16,13 @@ export abstract class BaseProcessorTemplate<
|
|
|
16
16
|
> {
|
|
17
17
|
id: number
|
|
18
18
|
binds = new Set<string>()
|
|
19
|
-
blockHandlers: ((block: Block, ctx:
|
|
19
|
+
blockHandlers: ((block: Block, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid)[] = []
|
|
20
20
|
traceHandlers: {
|
|
21
21
|
signature: string
|
|
22
|
-
handler: (trace: Trace, ctx:
|
|
22
|
+
handler: (trace: Trace, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid
|
|
23
23
|
}[] = []
|
|
24
24
|
eventHandlers: {
|
|
25
|
-
handler: (event: Event, ctx:
|
|
25
|
+
handler: (event: Event, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid
|
|
26
26
|
filter: EventFilter | EventFilter[]
|
|
27
27
|
}[] = []
|
|
28
28
|
|
|
@@ -78,7 +78,7 @@ export abstract class BaseProcessorTemplate<
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
public onEvent(
|
|
81
|
-
handler: (event: Event, ctx:
|
|
81
|
+
handler: (event: Event, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid,
|
|
82
82
|
filter: EventFilter | EventFilter[]
|
|
83
83
|
) {
|
|
84
84
|
this.eventHandlers.push({
|
|
@@ -88,14 +88,14 @@ export abstract class BaseProcessorTemplate<
|
|
|
88
88
|
return this
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
public onBlock(handler: (block: Block, ctx:
|
|
91
|
+
public onBlock(handler: (block: Block, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid) {
|
|
92
92
|
this.blockHandlers.push(handler)
|
|
93
93
|
return this
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
public onTrace(
|
|
97
97
|
signature: string,
|
|
98
|
-
handler: (trace: Trace, ctx:
|
|
98
|
+
handler: (trace: Trace, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid
|
|
99
99
|
) {
|
|
100
100
|
this.traceHandlers.push({ signature, handler })
|
|
101
101
|
return this
|
|
@@ -4,7 +4,7 @@ import { Block, Log, getNetwork } from '@ethersproject/providers'
|
|
|
4
4
|
import { BaseContract, EventFilter } from '@ethersproject/contracts'
|
|
5
5
|
import Long from 'long'
|
|
6
6
|
|
|
7
|
-
import { BoundContractView,
|
|
7
|
+
import { BoundContractView, ContractContext, ContractView } from './context'
|
|
8
8
|
import { ProcessResult } from '../gen'
|
|
9
9
|
import { BindInternalOptions, BindOptions } from './bind-options'
|
|
10
10
|
import { PromiseOrVoid } from '../promise-or-void'
|
|
@@ -28,7 +28,6 @@ export abstract class BaseProcessor<
|
|
|
28
28
|
eventHandlers: EventsHandler[] = []
|
|
29
29
|
traceHandlers: TraceHandler[] = []
|
|
30
30
|
|
|
31
|
-
name: string
|
|
32
31
|
config: BindInternalOptions
|
|
33
32
|
|
|
34
33
|
constructor(config: BindOptions) {
|
|
@@ -61,7 +60,7 @@ export abstract class BaseProcessor<
|
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
public onEvent(
|
|
64
|
-
handler: (event: Event, ctx:
|
|
63
|
+
handler: (event: Event, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid,
|
|
65
64
|
filter: EventFilter | EventFilter[]
|
|
66
65
|
) {
|
|
67
66
|
const chainId = this.getChainId()
|
|
@@ -75,10 +74,17 @@ export abstract class BaseProcessor<
|
|
|
75
74
|
}
|
|
76
75
|
|
|
77
76
|
const contractView = this.CreateBoundContractView()
|
|
77
|
+
const contractName = this.config.name
|
|
78
78
|
this.eventHandlers.push({
|
|
79
79
|
filters: _filters,
|
|
80
80
|
handler: async function (log) {
|
|
81
|
-
const ctx = new
|
|
81
|
+
const ctx = new ContractContext<TContract, TBoundContractView>(
|
|
82
|
+
contractName,
|
|
83
|
+
contractView,
|
|
84
|
+
chainId,
|
|
85
|
+
undefined,
|
|
86
|
+
log
|
|
87
|
+
)
|
|
82
88
|
// let event: Event = <Event>deepCopy(log);
|
|
83
89
|
const event: Event = <Event>log
|
|
84
90
|
const parsed = contractView.rawContract.interface.parseLog(log)
|
|
@@ -108,12 +114,19 @@ export abstract class BaseProcessor<
|
|
|
108
114
|
return this
|
|
109
115
|
}
|
|
110
116
|
|
|
111
|
-
public onBlock(handler: (block: Block, ctx:
|
|
117
|
+
public onBlock(handler: (block: Block, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid) {
|
|
112
118
|
const chainId = this.getChainId()
|
|
113
119
|
const contractView = this.CreateBoundContractView()
|
|
120
|
+
const contractName = this.config.name
|
|
114
121
|
|
|
115
122
|
this.blockHandlers.push(async function (block: Block) {
|
|
116
|
-
const ctx = new
|
|
123
|
+
const ctx = new ContractContext<TContract, TBoundContractView>(
|
|
124
|
+
contractName,
|
|
125
|
+
contractView,
|
|
126
|
+
chainId,
|
|
127
|
+
block,
|
|
128
|
+
undefined
|
|
129
|
+
)
|
|
117
130
|
await handler(block, ctx)
|
|
118
131
|
return {
|
|
119
132
|
gauges: ctx.gauges,
|
|
@@ -124,7 +137,7 @@ export abstract class BaseProcessor<
|
|
|
124
137
|
return this
|
|
125
138
|
}
|
|
126
139
|
|
|
127
|
-
public onAllEvents(handler: (event: Log, ctx:
|
|
140
|
+
public onAllEvents(handler: (event: Log, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid) {
|
|
128
141
|
const _filters: EventFilter[] = []
|
|
129
142
|
const tmpContract = this.CreateBoundContractView()
|
|
130
143
|
|
|
@@ -138,10 +151,11 @@ export abstract class BaseProcessor<
|
|
|
138
151
|
|
|
139
152
|
protected onTrace(
|
|
140
153
|
signature: string,
|
|
141
|
-
handler: (trace: Trace, ctx:
|
|
154
|
+
handler: (trace: Trace, ctx: ContractContext<TContract, TBoundContractView>) => PromiseOrVoid
|
|
142
155
|
) {
|
|
143
156
|
const chainId = this.getChainId()
|
|
144
157
|
const contractView = this.CreateBoundContractView()
|
|
158
|
+
const contractName = this.config.name
|
|
145
159
|
|
|
146
160
|
this.traceHandlers.push({
|
|
147
161
|
signature,
|
|
@@ -158,7 +172,14 @@ export abstract class BaseProcessor<
|
|
|
158
172
|
const traceData = '0x' + trace.action.input.slice(10)
|
|
159
173
|
trace.args = contractInterface._abiCoder.decode(fragment.inputs, traceData)
|
|
160
174
|
|
|
161
|
-
const ctx = new
|
|
175
|
+
const ctx = new ContractContext<TContract, TBoundContractView>(
|
|
176
|
+
contractName,
|
|
177
|
+
contractView,
|
|
178
|
+
chainId,
|
|
179
|
+
undefined,
|
|
180
|
+
undefined,
|
|
181
|
+
trace
|
|
182
|
+
)
|
|
162
183
|
await handler(trace, ctx)
|
|
163
184
|
return {
|
|
164
185
|
gauges: ctx.gauges,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BigNumber as BigDecimal } from 'bignumber.js'
|
package/src/core/bind-options.ts
CHANGED
|
@@ -3,8 +3,11 @@ import Long from 'long'
|
|
|
3
3
|
import { getNetwork } from '@ethersproject/providers'
|
|
4
4
|
|
|
5
5
|
export class BindOptions {
|
|
6
|
+
// Contract address
|
|
6
7
|
address: string
|
|
8
|
+
// Optional, if not set, then use eth mainnet
|
|
7
9
|
network?: Networkish = 1
|
|
10
|
+
// Optional, override default contract name
|
|
8
11
|
name?: string
|
|
9
12
|
startBlock?: Long | number
|
|
10
13
|
endBlock?: Long | number
|
|
@@ -39,5 +42,3 @@ export class SolanaBindOptions extends BindOptions {
|
|
|
39
42
|
declare network?: string
|
|
40
43
|
processInnerInstruction?: boolean
|
|
41
44
|
}
|
|
42
|
-
|
|
43
|
-
export class SuiBindOptions extends BindOptions {}
|