@sentio/sdk 1.13.1 → 1.13.2
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/cli/commands/run-create.js +2 -0
- package/lib/cli/commands/run-create.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/commands/run-create.ts +3 -0
- package/template/package.json +2 -3
- package/template/src/processor.test.ts +1 -1
- package/template/src/processor.ts +20 -16
- package/template/node_modules/@sentio/sdk/lib/base-processor-template.d.ts +0 -27
- package/template/node_modules/@sentio/sdk/lib/base-processor-template.js +0 -80
- package/template/node_modules/@sentio/sdk/lib/base-processor-template.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/base-processor.d.ts +0 -30
- package/template/node_modules/@sentio/sdk/lib/base-processor.js +0 -148
- package/template/node_modules/@sentio/sdk/lib/base-processor.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/bind-options.d.ts +0 -21
- package/template/node_modules/@sentio/sdk/lib/bind-options.js +0 -42
- package/template/node_modules/@sentio/sdk/lib/bind-options.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/binds.d.ts +0 -10
- package/template/node_modules/@sentio/sdk/lib/binds.js +0 -59
- package/template/node_modules/@sentio/sdk/lib/binds.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/erc20/index.d.ts +0 -2
- package/template/node_modules/@sentio/sdk/lib/builtin/erc20/index.js +0 -22
- package/template/node_modules/@sentio/sdk/lib/builtin/erc20/index.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/erc20/test-utils.d.ts +0 -5
- package/template/node_modules/@sentio/sdk/lib/builtin/erc20/test-utils.js +0 -46
- package/template/node_modules/@sentio/sdk/lib/builtin/erc20/test-utils.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/index.d.ts +0 -2
- package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/index.js +0 -22
- package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/index.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/test-utils.d.ts +0 -4
- package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/test-utils.js +0 -35
- package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/test-utils.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20.d.ts +0 -307
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20.js +0 -3
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20Bytes.d.ts +0 -166
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20Bytes.js +0 -3
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20Bytes.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/WETH9.d.ts +0 -221
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/WETH9.js +0 -3
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/WETH9.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/common.d.ts +0 -22
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/common.js +0 -3
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/common.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20_processor.d.ts +0 -184
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20_processor.js +0 -453
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20_processor.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20bytes_processor.d.ts +0 -110
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20bytes_processor.js +0 -325
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20bytes_processor.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20Bytes__factory.d.ts +0 -48
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20Bytes__factory.js +0 -254
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20Bytes__factory.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20__factory.d.ts +0 -42
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20__factory.js +0 -404
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20__factory.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/WETH9__factory.d.ts +0 -45
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/WETH9__factory.js +0 -297
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/WETH9__factory.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/index.d.ts +0 -3
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/index.js +0 -13
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/index.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/index.d.ts +0 -7
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/index.js +0 -34
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/index.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/weth9_processor.d.ts +0 -126
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/weth9_processor.js +0 -361
- package/template/node_modules/@sentio/sdk/lib/builtin/internal/weth9_processor.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/weth9/index.d.ts +0 -2
- package/template/node_modules/@sentio/sdk/lib/builtin/weth9/index.js +0 -22
- package/template/node_modules/@sentio/sdk/lib/builtin/weth9/index.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/builtin/weth9/test-utils.d.ts +0 -6
- package/template/node_modules/@sentio/sdk/lib/builtin/weth9/test-utils.js +0 -57
- package/template/node_modules/@sentio/sdk/lib/builtin/weth9/test-utils.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/chain-config.d.ts +0 -6
- package/template/node_modules/@sentio/sdk/lib/chain-config.js +0 -3
- package/template/node_modules/@sentio/sdk/lib/chain-config.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/cli/build.d.ts +0 -4
- package/template/node_modules/@sentio/sdk/lib/cli/build.js +0 -178
- package/template/node_modules/@sentio/sdk/lib/cli/build.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/cli/cli.d.ts +0 -2
- package/template/node_modules/@sentio/sdk/lib/cli/cli.js +0 -163
- package/template/node_modules/@sentio/sdk/lib/cli/cli.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/cli/commands/run-create.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/cli/commands/run-create.js +0 -43
- package/template/node_modules/@sentio/sdk/lib/cli/commands/run-create.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/cli/commands/run-login.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/cli/commands/run-login.js +0 -77
- package/template/node_modules/@sentio/sdk/lib/cli/commands/run-login.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/cli/config.d.ts +0 -16
- package/template/node_modules/@sentio/sdk/lib/cli/config.js +0 -36
- package/template/node_modules/@sentio/sdk/lib/cli/config.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/cli/key.d.ts +0 -2
- package/template/node_modules/@sentio/sdk/lib/cli/key.js +0 -44
- package/template/node_modules/@sentio/sdk/lib/cli/key.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/cli/solana-code-gen.d.ts +0 -2
- package/template/node_modules/@sentio/sdk/lib/cli/solana-code-gen.js +0 -19
- package/template/node_modules/@sentio/sdk/lib/cli/solana-code-gen.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/cli/upload.d.ts +0 -2
- package/template/node_modules/@sentio/sdk/lib/cli/upload.js +0 -85
- package/template/node_modules/@sentio/sdk/lib/cli/upload.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/cli/webpack.config.js +0 -42
- package/template/node_modules/@sentio/sdk/lib/context.d.ts +0 -49
- package/template/node_modules/@sentio/sdk/lib/context.js +0 -93
- package/template/node_modules/@sentio/sdk/lib/context.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/contract-namer.d.ts +0 -6
- package/template/node_modules/@sentio/sdk/lib/contract-namer.js +0 -20
- package/template/node_modules/@sentio/sdk/lib/contract-namer.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/error.d.ts +0 -7
- package/template/node_modules/@sentio/sdk/lib/error.js +0 -43
- package/template/node_modules/@sentio/sdk/lib/error.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/gen/builtin.d.ts +0 -6
- package/template/node_modules/@sentio/sdk/lib/gen/builtin.js +0 -3
- package/template/node_modules/@sentio/sdk/lib/gen/builtin.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/gen/google/protobuf/empty.d.ts +0 -16
- package/template/node_modules/@sentio/sdk/lib/gen/google/protobuf/empty.js +0 -47
- package/template/node_modules/@sentio/sdk/lib/gen/google/protobuf/empty.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/gen/processor/protos/processor.d.ts +0 -666
- package/template/node_modules/@sentio/sdk/lib/gen/processor/protos/processor.js +0 -2837
- package/template/node_modules/@sentio/sdk/lib/gen/processor/protos/processor.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/generic-processor.d.ts +0 -10
- package/template/node_modules/@sentio/sdk/lib/generic-processor.js +0 -32
- package/template/node_modules/@sentio/sdk/lib/generic-processor.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/index.d.ts +0 -18
- package/template/node_modules/@sentio/sdk/lib/index.js +0 -63
- package/template/node_modules/@sentio/sdk/lib/index.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/loader.d.ts +0 -5
- package/template/node_modules/@sentio/sdk/lib/loader.js +0 -30
- package/template/node_modules/@sentio/sdk/lib/loader.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/meter.d.ts +0 -26
- package/template/node_modules/@sentio/sdk/lib/meter.js +0 -131
- package/template/node_modules/@sentio/sdk/lib/meter.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/meter.test.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/meter.test.js +0 -16
- package/template/node_modules/@sentio/sdk/lib/meter.test.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/numberish.d.ts +0 -6
- package/template/node_modules/@sentio/sdk/lib/numberish.js +0 -96
- package/template/node_modules/@sentio/sdk/lib/numberish.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/numberish.test.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/numberish.test.js +0 -70
- package/template/node_modules/@sentio/sdk/lib/numberish.test.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/processor-runner.d.ts +0 -2
- package/template/node_modules/@sentio/sdk/lib/processor-runner.js +0 -40
- package/template/node_modules/@sentio/sdk/lib/processor-runner.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/processor-state.d.ts +0 -16
- package/template/node_modules/@sentio/sdk/lib/processor-state.js +0 -20
- package/template/node_modules/@sentio/sdk/lib/processor-state.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/promise-or-void.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/promise-or-void.js +0 -3
- package/template/node_modules/@sentio/sdk/lib/promise-or-void.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/provider.d.ts +0 -6
- package/template/node_modules/@sentio/sdk/lib/provider.js +0 -66
- package/template/node_modules/@sentio/sdk/lib/provider.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/release.config.js +0 -31
- package/template/node_modules/@sentio/sdk/lib/service.d.ts +0 -25
- package/template/node_modules/@sentio/sdk/lib/service.js +0 -406
- package/template/node_modules/@sentio/sdk/lib/service.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/solana/builtin/index.d.ts +0 -2
- package/template/node_modules/@sentio/sdk/lib/solana/builtin/index.js +0 -19
- package/template/node_modules/@sentio/sdk/lib/solana/builtin/index.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/solana/builtin/spl-token-processor.d.ts +0 -26
- package/template/node_modules/@sentio/sdk/lib/solana/builtin/spl-token-processor.js +0 -138
- package/template/node_modules/@sentio/sdk/lib/solana/builtin/spl-token-processor.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/solana/builtin/types.d.ts +0 -330
- package/template/node_modules/@sentio/sdk/lib/solana/builtin/types.js +0 -203
- package/template/node_modules/@sentio/sdk/lib/solana/builtin/types.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/solana/builtin/wormhole-processor.d.ts +0 -18
- package/template/node_modules/@sentio/sdk/lib/solana/builtin/wormhole-processor.js +0 -192
- package/template/node_modules/@sentio/sdk/lib/solana/builtin/wormhole-processor.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/solana-processor.d.ts +0 -34
- package/template/node_modules/@sentio/sdk/lib/solana-processor.js +0 -95
- package/template/node_modules/@sentio/sdk/lib/solana-processor.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/codegen.d.ts +0 -4
- package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/codegen.js +0 -292
- package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/codegen.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/functions.d.ts +0 -3
- package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/functions.js +0 -61
- package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/functions.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/index.d.ts +0 -6
- package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/index.js +0 -51
- package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/index.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/codegen.test.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/codegen.test.js +0 -49
- package/template/node_modules/@sentio/sdk/lib/test/codegen.test.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/erc20-template.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/erc20-template.js +0 -23
- package/template/node_modules/@sentio/sdk/lib/test/erc20-template.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/erc20-template.test.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/erc20-template.test.js +0 -37
- package/template/node_modules/@sentio/sdk/lib/test/erc20-template.test.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/erc20.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/erc20.js +0 -44
- package/template/node_modules/@sentio/sdk/lib/test/erc20.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/erc20.test.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/erc20.test.js +0 -96
- package/template/node_modules/@sentio/sdk/lib/test/erc20.test.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/generic-processor.test.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/generic-processor.test.js +0 -59
- package/template/node_modules/@sentio/sdk/lib/test/generic-processor.test.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/index.d.ts +0 -2
- package/template/node_modules/@sentio/sdk/lib/test/index.js +0 -8
- package/template/node_modules/@sentio/sdk/lib/test/index.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/metric-utils.d.ts +0 -6
- package/template/node_modules/@sentio/sdk/lib/test/metric-utils.js +0 -50
- package/template/node_modules/@sentio/sdk/lib/test/metric-utils.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/mirrorworld.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/mirrorworld.js +0 -42
- package/template/node_modules/@sentio/sdk/lib/test/mirrorworld.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/solana.test.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/solana.test.js +0 -90
- package/template/node_modules/@sentio/sdk/lib/test/solana.test.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/test-processor-server.d.ts +0 -34
- package/template/node_modules/@sentio/sdk/lib/test/test-processor-server.js +0 -205
- package/template/node_modules/@sentio/sdk/lib/test/test-processor-server.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/test-provider.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/test-provider.js +0 -25
- package/template/node_modules/@sentio/sdk/lib/test/test-provider.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet.d.ts +0 -45
- package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet.js +0 -1396
- package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet_processor.d.ts +0 -107
- package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet_processor.js +0 -105
- package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet_processor.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/wormhole-token-bridge.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/test/wormhole-token-bridge.js +0 -22
- package/template/node_modules/@sentio/sdk/lib/test/wormhole-token-bridge.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/trace.d.ts +0 -35
- package/template/node_modules/@sentio/sdk/lib/trace.js +0 -43
- package/template/node_modules/@sentio/sdk/lib/trace.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/utils/chainmap.d.ts +0 -2
- package/template/node_modules/@sentio/sdk/lib/utils/chainmap.js +0 -98
- package/template/node_modules/@sentio/sdk/lib/utils/chainmap.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/utils/convert.d.ts +0 -5
- package/template/node_modules/@sentio/sdk/lib/utils/convert.js +0 -27
- package/template/node_modules/@sentio/sdk/lib/utils/convert.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/utils/erc20.d.ts +0 -14
- package/template/node_modules/@sentio/sdk/lib/utils/erc20.js +0 -62
- package/template/node_modules/@sentio/sdk/lib/utils/erc20.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/utils/erc20.test.d.ts +0 -1
- package/template/node_modules/@sentio/sdk/lib/utils/erc20.test.js +0 -23
- package/template/node_modules/@sentio/sdk/lib/utils/erc20.test.js.map +0 -1
- package/template/node_modules/@sentio/sdk/lib/utils/index.d.ts +0 -3
- package/template/node_modules/@sentio/sdk/lib/utils/index.js +0 -14
- package/template/node_modules/@sentio/sdk/lib/utils/index.js.map +0 -1
- package/template/node_modules/@sentio/sdk/package.json +0 -78
- package/template/node_modules/@sentio/sdk/src/abis/ERC20.json +0 -174
- package/template/node_modules/@sentio/sdk/src/abis/ERC20Bytes.json +0 -236
- package/template/node_modules/@sentio/sdk/src/abis/WETH9.json +0 -153
- package/template/node_modules/@sentio/sdk/src/base-processor-template.ts +0 -105
- package/template/node_modules/@sentio/sdk/src/base-processor.ts +0 -172
- package/template/node_modules/@sentio/sdk/src/bind-options.ts +0 -41
- package/template/node_modules/@sentio/sdk/src/binds.ts +0 -73
- package/template/node_modules/@sentio/sdk/src/builtin/erc20/index.ts +0 -6
- package/template/node_modules/@sentio/sdk/src/builtin/erc20/test-utils.ts +0 -71
- package/template/node_modules/@sentio/sdk/src/builtin/erc20bytes/index.ts +0 -6
- package/template/node_modules/@sentio/sdk/src/builtin/erc20bytes/test-utils.ts +0 -53
- package/template/node_modules/@sentio/sdk/src/builtin/internal/ERC20.ts +0 -679
- package/template/node_modules/@sentio/sdk/src/builtin/internal/ERC20Bytes.ts +0 -384
- package/template/node_modules/@sentio/sdk/src/builtin/internal/WETH9.ts +0 -480
- package/template/node_modules/@sentio/sdk/src/builtin/internal/common.ts +0 -46
- package/template/node_modules/@sentio/sdk/src/builtin/internal/erc20_processor.ts +0 -762
- package/template/node_modules/@sentio/sdk/src/builtin/internal/erc20bytes_processor.ts +0 -531
- package/template/node_modules/@sentio/sdk/src/builtin/internal/factories/ERC20Bytes__factory.ts +0 -257
- package/template/node_modules/@sentio/sdk/src/builtin/internal/factories/ERC20__factory.ts +0 -404
- package/template/node_modules/@sentio/sdk/src/builtin/internal/factories/WETH9__factory.ts +0 -297
- package/template/node_modules/@sentio/sdk/src/builtin/internal/factories/index.ts +0 -6
- package/template/node_modules/@sentio/sdk/src/builtin/internal/index.ts +0 -10
- package/template/node_modules/@sentio/sdk/src/builtin/internal/weth9_processor.ts +0 -589
- package/template/node_modules/@sentio/sdk/src/builtin/weth9/index.ts +0 -6
- package/template/node_modules/@sentio/sdk/src/builtin/weth9/test-utils.ts +0 -89
- package/template/node_modules/@sentio/sdk/src/chain-config.ts +0 -6
- package/template/node_modules/@sentio/sdk/src/cli/build.ts +0 -196
- package/template/node_modules/@sentio/sdk/src/cli/cli.ts +0 -160
- package/template/node_modules/@sentio/sdk/src/cli/commands/run-create.ts +0 -36
- package/template/node_modules/@sentio/sdk/src/cli/commands/run-login.ts +0 -70
- package/template/node_modules/@sentio/sdk/src/cli/config.ts +0 -45
- package/template/node_modules/@sentio/sdk/src/cli/key.ts +0 -43
- package/template/node_modules/@sentio/sdk/src/cli/solana-code-gen.ts +0 -16
- package/template/node_modules/@sentio/sdk/src/cli/upload.ts +0 -88
- package/template/node_modules/@sentio/sdk/src/cli/webpack.config.js +0 -42
- package/template/node_modules/@sentio/sdk/src/context.ts +0 -103
- package/template/node_modules/@sentio/sdk/src/contract-namer.ts +0 -17
- package/template/node_modules/@sentio/sdk/src/error.ts +0 -45
- package/template/node_modules/@sentio/sdk/src/gen/builtin.ts +0 -22
- package/template/node_modules/@sentio/sdk/src/gen/google/protobuf/empty.ts +0 -70
- package/template/node_modules/@sentio/sdk/src/gen/processor/protos/processor.ts +0 -3626
- package/template/node_modules/@sentio/sdk/src/generic-processor.ts +0 -35
- package/template/node_modules/@sentio/sdk/src/index.ts +0 -21
- package/template/node_modules/@sentio/sdk/src/loader.ts +0 -24
- package/template/node_modules/@sentio/sdk/src/meter.test.ts +0 -16
- package/template/node_modules/@sentio/sdk/src/meter.ts +0 -140
- package/template/node_modules/@sentio/sdk/src/numberish.test.ts +0 -82
- package/template/node_modules/@sentio/sdk/src/numberish.ts +0 -100
- package/template/node_modules/@sentio/sdk/src/processor-runner.ts +0 -46
- package/template/node_modules/@sentio/sdk/src/processor-state.ts +0 -24
- package/template/node_modules/@sentio/sdk/src/promise-or-void.ts +0 -1
- package/template/node_modules/@sentio/sdk/src/provider.ts +0 -74
- package/template/node_modules/@sentio/sdk/src/service.ts +0 -491
- package/template/node_modules/@sentio/sdk/src/solana/builtin/index.ts +0 -2
- package/template/node_modules/@sentio/sdk/src/solana/builtin/spl-token-processor.ts +0 -164
- package/template/node_modules/@sentio/sdk/src/solana/builtin/types.ts +0 -268
- package/template/node_modules/@sentio/sdk/src/solana/builtin/wormhole-processor.ts +0 -178
- package/template/node_modules/@sentio/sdk/src/solana-processor.ts +0 -106
- package/template/node_modules/@sentio/sdk/src/target-ethers-sentio/codegen.ts +0 -315
- package/template/node_modules/@sentio/sdk/src/target-ethers-sentio/functions.ts +0 -68
- package/template/node_modules/@sentio/sdk/src/target-ethers-sentio/index.ts +0 -50
- package/template/node_modules/@sentio/sdk/src/target-ethers-sentio/tsconfig.json +0 -9
- package/template/node_modules/@sentio/sdk/src/test/abis/evm/CommitmentPool.json +0 -1034
- package/template/node_modules/@sentio/sdk/src/test/abis/evm/anyswapRouter.json +0 -490
- package/template/node_modules/@sentio/sdk/src/test/abis/solana/mirrorworld.json +0 -1392
- package/template/node_modules/@sentio/sdk/src/test/codegen.test.ts +0 -29
- package/template/node_modules/@sentio/sdk/src/test/erc20-template.test.ts +0 -37
- package/template/node_modules/@sentio/sdk/src/test/erc20-template.ts +0 -25
- package/template/node_modules/@sentio/sdk/src/test/erc20.test.ts +0 -117
- package/template/node_modules/@sentio/sdk/src/test/erc20.ts +0 -50
- package/template/node_modules/@sentio/sdk/src/test/generic-processor.test.ts +0 -70
- package/template/node_modules/@sentio/sdk/src/test/index.ts +0 -2
- package/template/node_modules/@sentio/sdk/src/test/metric-utils.ts +0 -49
- package/template/node_modules/@sentio/sdk/src/test/mirrorworld.ts +0 -40
- package/template/node_modules/@sentio/sdk/src/test/sentio.yaml +0 -4
- package/template/node_modules/@sentio/sdk/src/test/solana.test.ts +0 -93
- package/template/node_modules/@sentio/sdk/src/test/test-processor-server.ts +0 -258
- package/template/node_modules/@sentio/sdk/src/test/test-provider.ts +0 -25
- package/template/node_modules/@sentio/sdk/src/test/types/game_wallet.ts +0 -1392
- package/template/node_modules/@sentio/sdk/src/test/types/game_wallet_processor.ts +0 -113
- package/template/node_modules/@sentio/sdk/src/test/wormhole-token-bridge.ts +0 -21
- package/template/node_modules/@sentio/sdk/src/trace.ts +0 -86
- package/template/node_modules/@sentio/sdk/src/types/global.d.ts +0 -17
- package/template/node_modules/@sentio/sdk/src/utils/chainmap.ts +0 -95
- package/template/node_modules/@sentio/sdk/src/utils/convert.ts +0 -26
- package/template/node_modules/@sentio/sdk/src/utils/erc20.test.ts +0 -26
- package/template/node_modules/@sentio/sdk/src/utils/erc20.ts +0 -66
- package/template/node_modules/@sentio/sdk/src/utils/index.ts +0 -3
- package/template/node_modules/base-x/LICENSE.md +0 -22
- package/template/node_modules/base-x/README.md +0 -73
- package/template/node_modules/base-x/package.json +0 -46
- package/template/node_modules/base-x/src/index.d.ts +0 -9
- package/template/node_modules/base-x/src/index.js +0 -121
- package/template/node_modules/bs58/CHANGELOG.md +0 -65
- package/template/node_modules/bs58/LICENSE +0 -21
- package/template/node_modules/bs58/README.md +0 -91
- package/template/node_modules/bs58/index.d.ts +0 -5
- package/template/node_modules/bs58/index.js +0 -4
- package/template/node_modules/bs58/package.json +0 -39
- package/template/src/types/internal/X2y2.ts +0 -684
- package/template/src/types/internal/common.ts +0 -46
- package/template/src/types/internal/factories/X2y2__factory.ts +0 -436
- package/template/src/types/internal/factories/index.ts +0 -4
- package/template/src/types/internal/index.ts +0 -6
- package/template/src/types/internal/x2y2_processor.ts +0 -1004
- package/template/src/types/x2y2/index.ts +0 -6
- package/template/src/types/x2y2/test-utils.ts +0 -89
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-redeclare */
|
|
3
|
-
// copy from https://github.com/solana-labs/solana/blob/master/explorer/src/components/instruction/token/types.ts
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.TransferChecked = exports.Transfer = exports.TokenAmountUi = exports.PublicKeyFromString = void 0;
|
|
6
|
-
const superstruct_1 = require("superstruct");
|
|
7
|
-
// Replace with string
|
|
8
|
-
exports.PublicKeyFromString = (0, superstruct_1.coerce)((0, superstruct_1.instance)(String), (0, superstruct_1.string)(), (value) => (value));
|
|
9
|
-
exports.TokenAmountUi = (0, superstruct_1.type)({
|
|
10
|
-
amount: (0, superstruct_1.string)(),
|
|
11
|
-
decimals: (0, superstruct_1.number)(),
|
|
12
|
-
uiAmountString: (0, superstruct_1.string)(),
|
|
13
|
-
});
|
|
14
|
-
const InitializeMint = (0, superstruct_1.type)({
|
|
15
|
-
mint: exports.PublicKeyFromString,
|
|
16
|
-
decimals: (0, superstruct_1.number)(),
|
|
17
|
-
mintAuthority: exports.PublicKeyFromString,
|
|
18
|
-
rentSysvar: exports.PublicKeyFromString,
|
|
19
|
-
freezeAuthority: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
20
|
-
});
|
|
21
|
-
const InitializeAccount = (0, superstruct_1.type)({
|
|
22
|
-
account: exports.PublicKeyFromString,
|
|
23
|
-
mint: exports.PublicKeyFromString,
|
|
24
|
-
owner: exports.PublicKeyFromString,
|
|
25
|
-
rentSysvar: exports.PublicKeyFromString,
|
|
26
|
-
});
|
|
27
|
-
const InitializeAccount2 = (0, superstruct_1.type)({
|
|
28
|
-
account: exports.PublicKeyFromString,
|
|
29
|
-
mint: exports.PublicKeyFromString,
|
|
30
|
-
rentSysvar: exports.PublicKeyFromString,
|
|
31
|
-
owner: exports.PublicKeyFromString,
|
|
32
|
-
});
|
|
33
|
-
const InitializeAccount3 = (0, superstruct_1.type)({
|
|
34
|
-
account: exports.PublicKeyFromString,
|
|
35
|
-
mint: exports.PublicKeyFromString,
|
|
36
|
-
owner: exports.PublicKeyFromString,
|
|
37
|
-
});
|
|
38
|
-
const InitializeMultisig = (0, superstruct_1.type)({
|
|
39
|
-
multisig: exports.PublicKeyFromString,
|
|
40
|
-
rentSysvar: exports.PublicKeyFromString,
|
|
41
|
-
signers: (0, superstruct_1.array)(exports.PublicKeyFromString),
|
|
42
|
-
m: (0, superstruct_1.number)(),
|
|
43
|
-
});
|
|
44
|
-
exports.Transfer = (0, superstruct_1.type)({
|
|
45
|
-
source: exports.PublicKeyFromString,
|
|
46
|
-
destination: exports.PublicKeyFromString,
|
|
47
|
-
amount: (0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.number)()]),
|
|
48
|
-
authority: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
49
|
-
multisigAuthority: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
50
|
-
signers: (0, superstruct_1.optional)((0, superstruct_1.array)(exports.PublicKeyFromString)),
|
|
51
|
-
});
|
|
52
|
-
const Approve = (0, superstruct_1.type)({
|
|
53
|
-
source: exports.PublicKeyFromString,
|
|
54
|
-
delegate: exports.PublicKeyFromString,
|
|
55
|
-
amount: (0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.number)()]),
|
|
56
|
-
owner: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
57
|
-
multisigOwner: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
58
|
-
signers: (0, superstruct_1.optional)((0, superstruct_1.array)(exports.PublicKeyFromString)),
|
|
59
|
-
});
|
|
60
|
-
const Revoke = (0, superstruct_1.type)({
|
|
61
|
-
source: exports.PublicKeyFromString,
|
|
62
|
-
owner: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
63
|
-
multisigOwner: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
64
|
-
signers: (0, superstruct_1.optional)((0, superstruct_1.array)(exports.PublicKeyFromString)),
|
|
65
|
-
});
|
|
66
|
-
const AuthorityType = (0, superstruct_1.enums)([
|
|
67
|
-
"mintTokens",
|
|
68
|
-
"freezeAccount",
|
|
69
|
-
"accountOwner",
|
|
70
|
-
"closeAccount",
|
|
71
|
-
]);
|
|
72
|
-
const SetAuthority = (0, superstruct_1.type)({
|
|
73
|
-
mint: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
74
|
-
account: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
75
|
-
authorityType: AuthorityType,
|
|
76
|
-
newAuthority: (0, superstruct_1.nullable)(exports.PublicKeyFromString),
|
|
77
|
-
authority: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
78
|
-
multisigAuthority: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
79
|
-
signers: (0, superstruct_1.optional)((0, superstruct_1.array)(exports.PublicKeyFromString)),
|
|
80
|
-
});
|
|
81
|
-
const MintTo = (0, superstruct_1.type)({
|
|
82
|
-
mint: exports.PublicKeyFromString,
|
|
83
|
-
account: exports.PublicKeyFromString,
|
|
84
|
-
amount: (0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.number)()]),
|
|
85
|
-
mintAuthority: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
86
|
-
multisigMintAuthority: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
87
|
-
signers: (0, superstruct_1.optional)((0, superstruct_1.array)(exports.PublicKeyFromString)),
|
|
88
|
-
});
|
|
89
|
-
const Burn = (0, superstruct_1.type)({
|
|
90
|
-
account: exports.PublicKeyFromString,
|
|
91
|
-
mint: exports.PublicKeyFromString,
|
|
92
|
-
amount: (0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.number)()]),
|
|
93
|
-
authority: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
94
|
-
multisigAuthority: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
95
|
-
signers: (0, superstruct_1.optional)((0, superstruct_1.array)(exports.PublicKeyFromString)),
|
|
96
|
-
});
|
|
97
|
-
const CloseAccount = (0, superstruct_1.type)({
|
|
98
|
-
account: exports.PublicKeyFromString,
|
|
99
|
-
destination: exports.PublicKeyFromString,
|
|
100
|
-
owner: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
101
|
-
multisigOwner: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
102
|
-
signers: (0, superstruct_1.optional)((0, superstruct_1.array)(exports.PublicKeyFromString)),
|
|
103
|
-
});
|
|
104
|
-
const FreezeAccount = (0, superstruct_1.type)({
|
|
105
|
-
account: exports.PublicKeyFromString,
|
|
106
|
-
mint: exports.PublicKeyFromString,
|
|
107
|
-
freezeAuthority: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
108
|
-
multisigFreezeAuthority: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
109
|
-
signers: (0, superstruct_1.optional)((0, superstruct_1.array)(exports.PublicKeyFromString)),
|
|
110
|
-
});
|
|
111
|
-
const ThawAccount = (0, superstruct_1.type)({
|
|
112
|
-
account: exports.PublicKeyFromString,
|
|
113
|
-
mint: exports.PublicKeyFromString,
|
|
114
|
-
freezeAuthority: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
115
|
-
multisigFreezeAuthority: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
116
|
-
signers: (0, superstruct_1.optional)((0, superstruct_1.array)(exports.PublicKeyFromString)),
|
|
117
|
-
});
|
|
118
|
-
exports.TransferChecked = (0, superstruct_1.type)({
|
|
119
|
-
source: exports.PublicKeyFromString,
|
|
120
|
-
mint: exports.PublicKeyFromString,
|
|
121
|
-
destination: exports.PublicKeyFromString,
|
|
122
|
-
authority: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
123
|
-
multisigAuthority: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
124
|
-
signers: (0, superstruct_1.optional)((0, superstruct_1.array)(exports.PublicKeyFromString)),
|
|
125
|
-
tokenAmount: exports.TokenAmountUi,
|
|
126
|
-
});
|
|
127
|
-
const ApproveChecked = (0, superstruct_1.type)({
|
|
128
|
-
source: exports.PublicKeyFromString,
|
|
129
|
-
mint: exports.PublicKeyFromString,
|
|
130
|
-
delegate: exports.PublicKeyFromString,
|
|
131
|
-
owner: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
132
|
-
multisigOwner: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
133
|
-
signers: (0, superstruct_1.optional)((0, superstruct_1.array)(exports.PublicKeyFromString)),
|
|
134
|
-
tokenAmount: exports.TokenAmountUi,
|
|
135
|
-
});
|
|
136
|
-
const MintToChecked = (0, superstruct_1.type)({
|
|
137
|
-
account: exports.PublicKeyFromString,
|
|
138
|
-
mint: exports.PublicKeyFromString,
|
|
139
|
-
mintAuthority: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
140
|
-
multisigMintAuthority: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
141
|
-
signers: (0, superstruct_1.optional)((0, superstruct_1.array)(exports.PublicKeyFromString)),
|
|
142
|
-
tokenAmount: exports.TokenAmountUi,
|
|
143
|
-
});
|
|
144
|
-
const BurnChecked = (0, superstruct_1.type)({
|
|
145
|
-
account: exports.PublicKeyFromString,
|
|
146
|
-
mint: exports.PublicKeyFromString,
|
|
147
|
-
authority: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
148
|
-
multisigAuthority: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
149
|
-
signers: (0, superstruct_1.optional)((0, superstruct_1.array)(exports.PublicKeyFromString)),
|
|
150
|
-
tokenAmount: exports.TokenAmountUi,
|
|
151
|
-
});
|
|
152
|
-
const SyncNative = (0, superstruct_1.type)({
|
|
153
|
-
account: exports.PublicKeyFromString,
|
|
154
|
-
});
|
|
155
|
-
const GetAccountDataSize = (0, superstruct_1.type)({
|
|
156
|
-
mint: exports.PublicKeyFromString,
|
|
157
|
-
extensionTypes: (0, superstruct_1.optional)((0, superstruct_1.array)((0, superstruct_1.string)())),
|
|
158
|
-
});
|
|
159
|
-
const InitializeImmutableOwner = (0, superstruct_1.type)({
|
|
160
|
-
account: exports.PublicKeyFromString,
|
|
161
|
-
});
|
|
162
|
-
const AmountToUiAmount = (0, superstruct_1.type)({
|
|
163
|
-
mint: exports.PublicKeyFromString,
|
|
164
|
-
amount: (0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.number)()]),
|
|
165
|
-
});
|
|
166
|
-
const UiAmountToAmount = (0, superstruct_1.type)({
|
|
167
|
-
mint: exports.PublicKeyFromString,
|
|
168
|
-
uiAmount: (0, superstruct_1.string)(),
|
|
169
|
-
});
|
|
170
|
-
const InitializeMintCloseAuthority = (0, superstruct_1.type)({
|
|
171
|
-
mint: exports.PublicKeyFromString,
|
|
172
|
-
newAuthority: exports.PublicKeyFromString,
|
|
173
|
-
});
|
|
174
|
-
const TransferFeeExtension = (0, superstruct_1.type)({
|
|
175
|
-
mint: exports.PublicKeyFromString,
|
|
176
|
-
transferFeeConfigAuthority: exports.PublicKeyFromString,
|
|
177
|
-
withdrawWitheldAuthority: exports.PublicKeyFromString,
|
|
178
|
-
transferFeeBasisPoints: (0, superstruct_1.number)(),
|
|
179
|
-
maximumFee: (0, superstruct_1.number)(),
|
|
180
|
-
});
|
|
181
|
-
const DefaultAccountStateExtension = (0, superstruct_1.type)({
|
|
182
|
-
mint: exports.PublicKeyFromString,
|
|
183
|
-
accountState: (0, superstruct_1.string)(),
|
|
184
|
-
freezeAuthority: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
185
|
-
});
|
|
186
|
-
const Reallocate = (0, superstruct_1.type)({
|
|
187
|
-
account: exports.PublicKeyFromString,
|
|
188
|
-
payer: exports.PublicKeyFromString,
|
|
189
|
-
systemProgram: exports.PublicKeyFromString,
|
|
190
|
-
extensionTypes: (0, superstruct_1.array)((0, superstruct_1.string)()),
|
|
191
|
-
});
|
|
192
|
-
const MemoTransferExtension = (0, superstruct_1.type)({
|
|
193
|
-
account: exports.PublicKeyFromString,
|
|
194
|
-
owner: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
195
|
-
multisigOwner: (0, superstruct_1.optional)(exports.PublicKeyFromString),
|
|
196
|
-
signers: (0, superstruct_1.optional)((0, superstruct_1.array)(exports.PublicKeyFromString)),
|
|
197
|
-
});
|
|
198
|
-
const CreateNativeMint = (0, superstruct_1.type)({
|
|
199
|
-
payer: exports.PublicKeyFromString,
|
|
200
|
-
nativeMint: exports.PublicKeyFromString,
|
|
201
|
-
systemProgram: exports.PublicKeyFromString,
|
|
202
|
-
});
|
|
203
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/solana/builtin/types.ts"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,iHAAiH;;;AAEjH,6CAYqB;AAErB,sBAAsB;AACT,QAAA,mBAAmB,GAAG,IAAA,oBAAM,EACvC,IAAA,sBAAQ,EAAC,MAAM,CAAC,EAChB,IAAA,oBAAM,GAAE,EACR,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CACnB,CAAC;AAWW,QAAA,aAAa,GAAG,IAAA,kBAAI,EAAC;IAChC,MAAM,EAAE,IAAA,oBAAM,GAAE;IAChB,QAAQ,EAAE,IAAA,oBAAM,GAAE;IAClB,cAAc,EAAE,IAAA,oBAAM,GAAE;CACzB,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,IAAA,kBAAI,EAAC;IAC1B,IAAI,EAAE,2BAAmB;IACzB,QAAQ,EAAE,IAAA,oBAAM,GAAE;IAClB,aAAa,EAAE,2BAAmB;IAClC,UAAU,EAAE,2BAAmB;IAC/B,eAAe,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master/explorer/src/components/instruction/token/types.ts\n\nimport {\n enums,\n type,\n Infer,\n number,\n string,\n optional,\n array,\n nullable,\n union,\n coerce,\n instance,\n} from \"superstruct\";\n\n// Replace with string\nexport const PublicKeyFromString = coerce(\n instance(String),\n string(),\n (value) => (value)\n);\n\nexport type TokenAmountUi = Infer<typeof TokenAmountUi>;\nexport type MintTo = Infer<typeof MintTo>;\nexport type Burn = Infer<typeof Burn>;\nexport type InitializeMint = Infer<typeof InitializeMint>;\nexport type InitializeAccount = Infer<typeof InitializeAccount>;\nexport type InitializeAccount2 = Infer<typeof InitializeAccount2>;\nexport type InitializeAccount3 = Infer<typeof InitializeAccount3>;\nexport type InitializeMultisig = Infer<typeof InitializeMultisig>;\n\nexport const TokenAmountUi = type({\n amount: string(),\n decimals: number(),\n uiAmountString: string(),\n});\n\nconst InitializeMint = type({\n mint: PublicKeyFromString,\n decimals: number(),\n mintAuthority: PublicKeyFromString,\n rentSysvar: PublicKeyFromString,\n freezeAuthority: optional(PublicKeyFromString),\n});\n\nconst InitializeAccount = type({\n account: PublicKeyFromString,\n mint: PublicKeyFromString,\n owner: PublicKeyFromString,\n rentSysvar: PublicKeyFromString,\n});\n\nconst InitializeAccount2 = type({\n account: PublicKeyFromString,\n mint: PublicKeyFromString,\n rentSysvar: PublicKeyFromString,\n owner: PublicKeyFromString,\n});\n\nconst InitializeAccount3 = type({\n account: PublicKeyFromString,\n mint: PublicKeyFromString,\n owner: PublicKeyFromString,\n});\n\nconst InitializeMultisig = type({\n multisig: PublicKeyFromString,\n rentSysvar: PublicKeyFromString,\n signers: array(PublicKeyFromString),\n m: number(),\n});\n\nexport type Transfer = Infer<typeof Transfer>;\nexport const Transfer = type({\n source: PublicKeyFromString,\n destination: PublicKeyFromString,\n amount: union([string(), number()]),\n authority: optional(PublicKeyFromString),\n multisigAuthority: optional(PublicKeyFromString),\n signers: optional(array(PublicKeyFromString)),\n});\n\nexport type Approve = Infer<typeof Approve>;\nconst Approve = type({\n source: PublicKeyFromString,\n delegate: PublicKeyFromString,\n amount: union([string(), number()]),\n owner: optional(PublicKeyFromString),\n multisigOwner: optional(PublicKeyFromString),\n signers: optional(array(PublicKeyFromString)),\n});\n\nexport type Revoke = Infer<typeof Revoke>;\nconst Revoke = type({\n source: PublicKeyFromString,\n owner: optional(PublicKeyFromString),\n multisigOwner: optional(PublicKeyFromString),\n signers: optional(array(PublicKeyFromString)),\n});\n\nconst AuthorityType = enums([\n \"mintTokens\",\n \"freezeAccount\",\n \"accountOwner\",\n \"closeAccount\",\n]);\n\nexport type SetAuthority = Infer<typeof SetAuthority>;\nconst SetAuthority = type({\n mint: optional(PublicKeyFromString),\n account: optional(PublicKeyFromString),\n authorityType: AuthorityType,\n newAuthority: nullable(PublicKeyFromString),\n authority: optional(PublicKeyFromString),\n multisigAuthority: optional(PublicKeyFromString),\n signers: optional(array(PublicKeyFromString)),\n});\n\nconst MintTo = type({\n mint: PublicKeyFromString,\n account: PublicKeyFromString,\n amount: union([string(), number()]),\n mintAuthority: optional(PublicKeyFromString),\n multisigMintAuthority: optional(PublicKeyFromString),\n signers: optional(array(PublicKeyFromString)),\n});\n\nconst Burn = type({\n account: PublicKeyFromString,\n mint: PublicKeyFromString,\n amount: union([string(), number()]),\n authority: optional(PublicKeyFromString),\n multisigAuthority: optional(PublicKeyFromString),\n signers: optional(array(PublicKeyFromString)),\n});\n\nconst CloseAccount = type({\n account: PublicKeyFromString,\n destination: PublicKeyFromString,\n owner: optional(PublicKeyFromString),\n multisigOwner: optional(PublicKeyFromString),\n signers: optional(array(PublicKeyFromString)),\n});\nexport type CloseAccount = Infer<typeof CloseAccount>;\n\nexport type FreezeAccount = Infer<typeof FreezeAccount>;\nconst FreezeAccount = type({\n account: PublicKeyFromString,\n mint: PublicKeyFromString,\n freezeAuthority: optional(PublicKeyFromString),\n multisigFreezeAuthority: optional(PublicKeyFromString),\n signers: optional(array(PublicKeyFromString)),\n});\n\nexport type ThawAccount = Infer<typeof ThawAccount>;\nconst ThawAccount = type({\n account: PublicKeyFromString,\n mint: PublicKeyFromString,\n freezeAuthority: optional(PublicKeyFromString),\n multisigFreezeAuthority: optional(PublicKeyFromString),\n signers: optional(array(PublicKeyFromString)),\n});\n\nexport type TransferChecked = Infer<typeof TransferChecked>;\nexport const TransferChecked = type({\n source: PublicKeyFromString,\n mint: PublicKeyFromString,\n destination: PublicKeyFromString,\n authority: optional(PublicKeyFromString),\n multisigAuthority: optional(PublicKeyFromString),\n signers: optional(array(PublicKeyFromString)),\n tokenAmount: TokenAmountUi,\n});\n\nexport type ApproveChecked = Infer<typeof ApproveChecked>;\nconst ApproveChecked = type({\n source: PublicKeyFromString,\n mint: PublicKeyFromString,\n delegate: PublicKeyFromString,\n owner: optional(PublicKeyFromString),\n multisigOwner: optional(PublicKeyFromString),\n signers: optional(array(PublicKeyFromString)),\n tokenAmount: TokenAmountUi,\n});\n\nexport type MintToChecked = Infer<typeof MintToChecked>;\nconst MintToChecked = type({\n account: PublicKeyFromString,\n mint: PublicKeyFromString,\n mintAuthority: optional(PublicKeyFromString),\n multisigMintAuthority: optional(PublicKeyFromString),\n signers: optional(array(PublicKeyFromString)),\n tokenAmount: TokenAmountUi,\n});\n\nexport type BurnChecked = Infer<typeof BurnChecked>;\nconst BurnChecked = type({\n account: PublicKeyFromString,\n mint: PublicKeyFromString,\n authority: optional(PublicKeyFromString),\n multisigAuthority: optional(PublicKeyFromString),\n signers: optional(array(PublicKeyFromString)),\n tokenAmount: TokenAmountUi,\n});\n\nconst SyncNative = type({\n account: PublicKeyFromString,\n});\n\nconst GetAccountDataSize = type({\n mint: PublicKeyFromString,\n extensionTypes: optional(array(string())),\n});\n\nconst InitializeImmutableOwner = type({\n account: PublicKeyFromString,\n});\n\nconst AmountToUiAmount = type({\n mint: PublicKeyFromString,\n amount: union([string(), number()]),\n});\n\nconst UiAmountToAmount = type({\n mint: PublicKeyFromString,\n uiAmount: string(),\n});\n\nconst InitializeMintCloseAuthority = type({\n mint: PublicKeyFromString,\n newAuthority: PublicKeyFromString,\n});\n\nconst TransferFeeExtension = type({\n mint: PublicKeyFromString,\n transferFeeConfigAuthority: PublicKeyFromString,\n withdrawWitheldAuthority: PublicKeyFromString,\n transferFeeBasisPoints: number(),\n maximumFee: number(),\n});\n\nconst DefaultAccountStateExtension = type({\n mint: PublicKeyFromString,\n accountState: string(),\n freezeAuthority: optional(PublicKeyFromString),\n});\n\nconst Reallocate = type({\n account: PublicKeyFromString,\n payer: PublicKeyFromString,\n systemProgram: PublicKeyFromString,\n extensionTypes: array(string()),\n});\n\nconst MemoTransferExtension = type({\n account: PublicKeyFromString,\n owner: optional(PublicKeyFromString),\n multisigOwner: optional(PublicKeyFromString),\n signers: optional(array(PublicKeyFromString)),\n});\n\nconst CreateNativeMint = type({\n payer: PublicKeyFromString,\n nativeMint: PublicKeyFromString,\n systemProgram: PublicKeyFromString,\n});\n"]}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { SolanaBaseProcessor } from '../../solana-processor';
|
|
2
|
-
import { SolanaContext } from '../../context';
|
|
3
|
-
import { SolanaBindOptions } from '../../bind-options';
|
|
4
|
-
import { Instruction } from '@project-serum/anchor';
|
|
5
|
-
export declare class TokenBridgeProcessor extends SolanaBaseProcessor {
|
|
6
|
-
private readonly transferDataValues;
|
|
7
|
-
private readonly transferDataWithPayloadValues;
|
|
8
|
-
private readonly attestTokenValues;
|
|
9
|
-
private readonly initializeDataValues;
|
|
10
|
-
static bind(options: SolanaBindOptions): TokenBridgeProcessor;
|
|
11
|
-
decodeInstruction: (rawInstruction: string) => Instruction | null;
|
|
12
|
-
onInitialize(handler: (args: any, ctx: SolanaContext) => void): TokenBridgeProcessor;
|
|
13
|
-
onAttestToken(handler: (args: any, ctx: SolanaContext) => void): TokenBridgeProcessor;
|
|
14
|
-
onTransferWrapped(handler: (args: any, ctx: SolanaContext) => void): TokenBridgeProcessor;
|
|
15
|
-
onTransferNativeWithPayload(handler: (args: any, ctx: SolanaContext) => void): TokenBridgeProcessor;
|
|
16
|
-
onTransferWrappedWithPaylod(handler: (args: any, ctx: SolanaContext) => void): TokenBridgeProcessor;
|
|
17
|
-
onTransferNative(handler: (args: any, ctx: SolanaContext) => void): TokenBridgeProcessor;
|
|
18
|
-
}
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.TokenBridgeProcessor = void 0;
|
|
30
|
-
const solana_processor_1 = require("../../solana-processor");
|
|
31
|
-
const borsh = __importStar(require("@project-serum/borsh"));
|
|
32
|
-
const bs58_1 = __importDefault(require("bs58"));
|
|
33
|
-
// https://github.com/certusone/wormhole/blob/8818d4b8f0471095dd48fa6f5da9c315cbfc9b52/solana/modules/token_bridge/program/src/lib.rs#L100
|
|
34
|
-
var TokenBrigeInstruction;
|
|
35
|
-
(function (TokenBrigeInstruction) {
|
|
36
|
-
TokenBrigeInstruction[TokenBrigeInstruction["Initialize"] = 0] = "Initialize";
|
|
37
|
-
TokenBrigeInstruction[TokenBrigeInstruction["AttestToken"] = 1] = "AttestToken";
|
|
38
|
-
TokenBrigeInstruction[TokenBrigeInstruction["CompleteNative"] = 2] = "CompleteNative";
|
|
39
|
-
TokenBrigeInstruction[TokenBrigeInstruction["CompleteWrapped"] = 3] = "CompleteWrapped";
|
|
40
|
-
TokenBrigeInstruction[TokenBrigeInstruction["TransferWrapped"] = 4] = "TransferWrapped";
|
|
41
|
-
TokenBrigeInstruction[TokenBrigeInstruction["TransferNative"] = 5] = "TransferNative";
|
|
42
|
-
TokenBrigeInstruction[TokenBrigeInstruction["RegisterChain"] = 6] = "RegisterChain";
|
|
43
|
-
TokenBrigeInstruction[TokenBrigeInstruction["CreateWrapped"] = 7] = "CreateWrapped";
|
|
44
|
-
TokenBrigeInstruction[TokenBrigeInstruction["UpgradeContract"] = 8] = "UpgradeContract";
|
|
45
|
-
TokenBrigeInstruction[TokenBrigeInstruction["CompleteNativeWithPayload"] = 9] = "CompleteNativeWithPayload";
|
|
46
|
-
TokenBrigeInstruction[TokenBrigeInstruction["CompleteWrappedWithPayload"] = 10] = "CompleteWrappedWithPayload";
|
|
47
|
-
TokenBrigeInstruction[TokenBrigeInstruction["TransferWrappedWithPayload"] = 11] = "TransferWrappedWithPayload";
|
|
48
|
-
TokenBrigeInstruction[TokenBrigeInstruction["TransferNativeWithPayload"] = 12] = "TransferNativeWithPayload";
|
|
49
|
-
})(TokenBrigeInstruction || (TokenBrigeInstruction = {}));
|
|
50
|
-
class TokenBridgeProcessor extends solana_processor_1.SolanaBaseProcessor {
|
|
51
|
-
transferDataValues = [
|
|
52
|
-
borsh.u32('nonce'),
|
|
53
|
-
borsh.u64('amount'),
|
|
54
|
-
borsh.u64('fee'),
|
|
55
|
-
borsh.array(borsh.u8(undefined), 32, 'target_address'),
|
|
56
|
-
borsh.u16('target_chain')
|
|
57
|
-
];
|
|
58
|
-
// https://github.com/certusone/wormhole/blob/8818d4b8f0471095dd48fa6f5da9c315cbfc9b52/solana/modules/token_bridge/program/src/api/transfer_payload.rs#L170
|
|
59
|
-
transferDataWithPayloadValues = [
|
|
60
|
-
borsh.u32('nonce'),
|
|
61
|
-
borsh.u64('amount'),
|
|
62
|
-
borsh.array(borsh.u8(undefined), 32, 'target_address'),
|
|
63
|
-
borsh.u16('target_chain'),
|
|
64
|
-
borsh.vecU8('payload'),
|
|
65
|
-
borsh.option(borsh.publicKey(undefined), 'cpi_program_id')
|
|
66
|
-
];
|
|
67
|
-
attestTokenValues = [
|
|
68
|
-
borsh.u32('nonce')
|
|
69
|
-
];
|
|
70
|
-
initializeDataValues = [
|
|
71
|
-
borsh.publicKey('bridge')
|
|
72
|
-
];
|
|
73
|
-
static bind(options) {
|
|
74
|
-
return new TokenBridgeProcessor(options);
|
|
75
|
-
}
|
|
76
|
-
decodeInstruction = (ins) => {
|
|
77
|
-
const u8Arr = bs58_1.default.decode(ins);
|
|
78
|
-
if (u8Arr.length === 0) {
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
let data;
|
|
82
|
-
// wormhole pass intruction's enum value as its first instrcution data
|
|
83
|
-
switch (u8Arr[0]) {
|
|
84
|
-
case TokenBrigeInstruction.Initialize:
|
|
85
|
-
return {
|
|
86
|
-
data: '',
|
|
87
|
-
name: TokenBrigeInstruction[TokenBrigeInstruction.Initialize]
|
|
88
|
-
};
|
|
89
|
-
case TokenBrigeInstruction.TransferNative:
|
|
90
|
-
// struct is defined at: https://github.com/certusone/wormhole/blob/8818d4b8f0471095dd48fa6f5da9c315cbfc9b52/solana/modules/token_bridge/program/src/api/transfer.rs#L295
|
|
91
|
-
data = borsh.struct(this.transferDataValues, 'TransferNativeData').decode(Buffer.from(u8Arr.slice(1)));
|
|
92
|
-
return {
|
|
93
|
-
data,
|
|
94
|
-
name: TokenBrigeInstruction[TokenBrigeInstruction.TransferNative]
|
|
95
|
-
};
|
|
96
|
-
case TokenBrigeInstruction.TransferWrapped:
|
|
97
|
-
// stuct is defined at: https://github.com/certusone/wormhole/blob/8818d4b8f0471095dd48fa6f5da9c315cbfc9b52/solana/modules/token_bridge/program/src/api/transfer.rs#L295
|
|
98
|
-
data = borsh.struct(this.transferDataValues, 'TransferWrappedData').decode(Buffer.from(u8Arr.slice(1)));
|
|
99
|
-
return {
|
|
100
|
-
data,
|
|
101
|
-
name: TokenBrigeInstruction[TokenBrigeInstruction.TransferWrapped]
|
|
102
|
-
};
|
|
103
|
-
case TokenBrigeInstruction.TransferNativeWithPayload:
|
|
104
|
-
data = borsh.struct(this.transferDataWithPayloadValues, 'TransferNativeWithPayloadData').decode(Buffer.from(u8Arr.slice(1)));
|
|
105
|
-
return {
|
|
106
|
-
data,
|
|
107
|
-
name: TokenBrigeInstruction[TokenBrigeInstruction.TransferNativeWithPayload]
|
|
108
|
-
};
|
|
109
|
-
case TokenBrigeInstruction.TransferWrappedWithPayload:
|
|
110
|
-
data = borsh.struct(this.transferDataWithPayloadValues, 'TransferWrappedWithPayloadData').decode(Buffer.from(u8Arr.slice(1)));
|
|
111
|
-
return {
|
|
112
|
-
data,
|
|
113
|
-
name: TokenBrigeInstruction[TokenBrigeInstruction.TransferWrappedWithPayload]
|
|
114
|
-
};
|
|
115
|
-
case TokenBrigeInstruction.Initialize:
|
|
116
|
-
data = borsh.struct(this.initializeDataValues, 'InitializeData').decode(Buffer.from(u8Arr.slice(1)));
|
|
117
|
-
return {
|
|
118
|
-
data,
|
|
119
|
-
name: TokenBrigeInstruction[TokenBrigeInstruction.Initialize]
|
|
120
|
-
};
|
|
121
|
-
case TokenBrigeInstruction.AttestToken:
|
|
122
|
-
data = borsh.struct(this.attestTokenValues, 'AttestTokenData').decode(Buffer.from(u8Arr.slice(1)));
|
|
123
|
-
return {
|
|
124
|
-
data,
|
|
125
|
-
name: TokenBrigeInstruction[TokenBrigeInstruction.AttestToken]
|
|
126
|
-
};
|
|
127
|
-
case TokenBrigeInstruction.CompleteNative:
|
|
128
|
-
case TokenBrigeInstruction.CompleteNativeWithPayload:
|
|
129
|
-
case TokenBrigeInstruction.CompleteWrapped:
|
|
130
|
-
case TokenBrigeInstruction.CompleteWrappedWithPayload:
|
|
131
|
-
case TokenBrigeInstruction.CreateWrapped:
|
|
132
|
-
case TokenBrigeInstruction.UpgradeContract:
|
|
133
|
-
case TokenBrigeInstruction.RegisterChain:
|
|
134
|
-
return {
|
|
135
|
-
data: '',
|
|
136
|
-
name: TokenBrigeInstruction[u8Arr[0]]
|
|
137
|
-
};
|
|
138
|
-
default:
|
|
139
|
-
return null;
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
onInitialize(handler) {
|
|
143
|
-
this.onInstruction('Initialize', (ins, ctx) => {
|
|
144
|
-
if (ins) {
|
|
145
|
-
handler(ins.data, ctx);
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
return this;
|
|
149
|
-
}
|
|
150
|
-
onAttestToken(handler) {
|
|
151
|
-
this.onInstruction('AttestToken', (ins, ctx) => {
|
|
152
|
-
if (ins) {
|
|
153
|
-
handler(ins.data, ctx);
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
return this;
|
|
157
|
-
}
|
|
158
|
-
onTransferWrapped(handler) {
|
|
159
|
-
this.onInstruction('TransferWrapped', (ins, ctx) => {
|
|
160
|
-
if (ins) {
|
|
161
|
-
handler(ins.data, ctx);
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
return this;
|
|
165
|
-
}
|
|
166
|
-
onTransferNativeWithPayload(handler) {
|
|
167
|
-
this.onInstruction('TransferNativeWithPayload', (ins, ctx) => {
|
|
168
|
-
if (ins) {
|
|
169
|
-
handler(ins.data, ctx);
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
return this;
|
|
173
|
-
}
|
|
174
|
-
onTransferWrappedWithPaylod(handler) {
|
|
175
|
-
this.onInstruction('TransferWrappedWithPaylod', (ins, ctx) => {
|
|
176
|
-
if (ins) {
|
|
177
|
-
handler(ins.data, ctx);
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
return this;
|
|
181
|
-
}
|
|
182
|
-
onTransferNative(handler) {
|
|
183
|
-
this.onInstruction('TransferNative', (ins, ctx) => {
|
|
184
|
-
if (ins) {
|
|
185
|
-
handler(ins.data, ctx);
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
return this;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
exports.TokenBridgeProcessor = TokenBridgeProcessor;
|
|
192
|
-
//# sourceMappingURL=wormhole-processor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wormhole-processor.js","sourceRoot":"","sources":["../../../src/solana/builtin/wormhole-processor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA4D;AAI5D,4DAA6C;AAC7C,gDAAuB;AAEvB,0IAA0I;AAC1I,IAAK,qBAcJ;AAdD,WAAK,qBAAqB;IACxB,6EAAc,CAAA;IACd,+EAAW,CAAA;IACX,qFAAc,CAAA;IACd,uFAAe,CAAA;IACf,uFAAe,CAAA;IACf,qFAAc,CAAA;IACd,mFAAa,CAAA;IACb,mFAAa,CAAA;IACb,uFAAe,CAAA;IACf,2GAAyB,CAAA;IACzB,8GAA0B,CAAA;IAC1B,8GAA0B,CAAA;IAC1B,4GAAyB,CAAA;AAC3B,CAAC,EAdI,qBAAqB,KAArB,qBAAqB,QAczB;AAED,MAAa,oBAAqB,SAAQ,sCAAmB;IAE1C,kBAAkB,GAAG;QACpC,KAAK,CAAC,GAAG,CAAC,OA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IACb,CAAC;IAED,gBAAgB,CAAC,OAAgD;QAC/D,IAAI,CAAC,aAAa,CAAC,gBAAgB,EAAE,CAAC,GAAgB,EAAE,GAAG,EAAE,EAAE;YAC7D,IAAI,GAAG,EAAE;gBACP,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;aACvB;QACH,CAAC,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAxJD,oDAwJC","sourcesContent":["import { SolanaBaseProcessor } from '../../solana-processor'\nimport { SolanaContext } from '../../context'\nimport { SolanaBindOptions } from '../../bind-options'\nimport { Instruction } from '@project-serum/anchor'\nimport * as borsh from '@project-serum/borsh'\nimport bs58 from 'bs58'\n\n// https://github.com/certusone/wormhole/blob/8818d4b8f0471095dd48fa6f5da9c315cbfc9b52/solana/modules/token_bridge/program/src/lib.rs#L100\nenum TokenBrigeInstruction {\n Initialize = 0,\n AttestToken,\n CompleteNative, // no args\n CompleteWrapped, // no args\n TransferWrapped,\n TransferNative,\n RegisterChain, // no args\n CreateWrapped, // no args\n UpgradeContract, // no args\n CompleteNativeWithPayload, // no args\n CompleteWrappedWithPayload, // no args\n TransferWrappedWithPayload,\n TransferNativeWithPayload,\n}\n\nexport class TokenBridgeProcessor extends SolanaBaseProcessor {\n\n private readonly transferDataValues = [\n borsh.u32('nonce'),\n borsh.u64('amount'),\n borsh.u64('fee'),\n borsh.array(borsh.u8(undefined), 32, 'target_address'),\n borsh.u16('target_chain')\n ]\n // https://github.com/certusone/wormhole/blob/8818d4b8f0471095dd48fa6f5da9c315cbfc9b52/solana/modules/token_bridge/program/src/api/transfer_payload.rs#L170\n private readonly transferDataWithPayloadValues = [\n borsh.u32('nonce'),\n borsh.u64('amount'),\n borsh.array(borsh.u8(undefined), 32, 'target_address'),\n borsh.u16('target_chain'),\n borsh.vecU8('payload'),\n borsh.option(borsh.publicKey(undefined), 'cpi_program_id')\n ]\n private readonly attestTokenValues = [\n borsh.u32('nonce')\n ]\n private readonly initializeDataValues = [\n borsh.publicKey('bridge')\n ]\n\n static bind(options: SolanaBindOptions): TokenBridgeProcessor {\n return new TokenBridgeProcessor(options)\n }\n\n decodeInstruction: (rawInstruction: string) => Instruction | null = (ins) => {\n const u8Arr = bs58.decode(ins)\n if (u8Arr.length === 0) {\n return null\n }\n\n let data: any\n // wormhole pass intruction's enum value as its first instrcution data\n switch (u8Arr[0]) {\n case TokenBrigeInstruction.Initialize:\n return {\n data: '',\n name: TokenBrigeInstruction[TokenBrigeInstruction.Initialize]\n }\n case TokenBrigeInstruction.TransferNative:\n // struct is defined at: https://github.com/certusone/wormhole/blob/8818d4b8f0471095dd48fa6f5da9c315cbfc9b52/solana/modules/token_bridge/program/src/api/transfer.rs#L295\n data = borsh.struct(this.transferDataValues, 'TransferNativeData').decode(Buffer.from(u8Arr.slice(1)))\n return {\n data,\n name: TokenBrigeInstruction[TokenBrigeInstruction.TransferNative]\n }\n case TokenBrigeInstruction.TransferWrapped:\n // stuct is defined at: https://github.com/certusone/wormhole/blob/8818d4b8f0471095dd48fa6f5da9c315cbfc9b52/solana/modules/token_bridge/program/src/api/transfer.rs#L295\n data = borsh.struct(this.transferDataValues, 'TransferWrappedData').decode(Buffer.from(u8Arr.slice(1)))\n return {\n data,\n name: TokenBrigeInstruction[TokenBrigeInstruction.TransferWrapped]\n }\n case TokenBrigeInstruction.TransferNativeWithPayload:\n data = borsh.struct(this.transferDataWithPayloadValues, 'TransferNativeWithPayloadData').decode(Buffer.from(u8Arr.slice(1)))\n return {\n data,\n name: TokenBrigeInstruction[TokenBrigeInstruction.TransferNativeWithPayload]\n }\n case TokenBrigeInstruction.TransferWrappedWithPayload:\n data = borsh.struct(this.transferDataWithPayloadValues, 'TransferWrappedWithPayloadData').decode(Buffer.from(u8Arr.slice(1)))\n return {\n data,\n name: TokenBrigeInstruction[TokenBrigeInstruction.TransferWrappedWithPayload]\n }\n case TokenBrigeInstruction.Initialize:\n data = borsh.struct(this.initializeDataValues, 'InitializeData').decode(Buffer.from(u8Arr.slice(1)))\n return {\n data,\n name: TokenBrigeInstruction[TokenBrigeInstruction.Initialize]\n }\n case TokenBrigeInstruction.AttestToken:\n data = borsh.struct(this.attestTokenValues, 'AttestTokenData').decode(Buffer.from(u8Arr.slice(1)))\n return {\n data,\n name: TokenBrigeInstruction[TokenBrigeInstruction.AttestToken]\n }\n case TokenBrigeInstruction.CompleteNative:\n case TokenBrigeInstruction.CompleteNativeWithPayload:\n case TokenBrigeInstruction.CompleteWrapped:\n case TokenBrigeInstruction.CompleteWrappedWithPayload:\n case TokenBrigeInstruction.CreateWrapped:\n case TokenBrigeInstruction.UpgradeContract:\n case TokenBrigeInstruction.RegisterChain:\n return {\n data: '',\n name: TokenBrigeInstruction[u8Arr[0]]\n }\n\n default:\n return null\n }\n }\n\n onInitialize(handler: (args: any, ctx: SolanaContext) => void): TokenBridgeProcessor {\n this.onInstruction('Initialize', (ins: Instruction, ctx) => {\n if (ins) {\n handler(ins.data, ctx)\n }\n })\n return this\n }\n\n onAttestToken(handler: (args: any, ctx: SolanaContext) => void): TokenBridgeProcessor {\n this.onInstruction('AttestToken', (ins: Instruction, ctx) => {\n if (ins) {\n handler(ins.data, ctx)\n }\n })\n return this\n }\n\n\n onTransferWrapped(handler: (args: any, ctx: SolanaContext) => void): TokenBridgeProcessor {\n this.onInstruction('TransferWrapped', (ins: Instruction, ctx) => {\n if (ins) {\n handler(ins.data, ctx)\n }\n })\n return this\n }\n\n onTransferNativeWithPayload(handler: (args: any, ctx: SolanaContext) => void): TokenBridgeProcessor {\n this.onInstruction('TransferNativeWithPayload', (ins: Instruction, ctx) => {\n if (ins) {\n handler(ins.data, ctx)\n }\n })\n return this\n }\n\n onTransferWrappedWithPaylod(handler: (args: any, ctx: SolanaContext) => void): TokenBridgeProcessor {\n this.onInstruction('TransferWrappedWithPaylod', (ins: Instruction, ctx) => {\n if (ins) {\n handler(ins.data, ctx)\n }\n })\n return this\n }\n\n onTransferNative(handler: (args: any, ctx: SolanaContext) => void): TokenBridgeProcessor {\n this.onInstruction('TransferNative', (ins: Instruction, ctx) => {\n if (ins) {\n handler(ins.data, ctx)\n }\n })\n return this\n }\n}\n "]}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { ProcessResult } from './gen/processor/protos/processor';
|
|
2
|
-
import { SolanaContext } from './context';
|
|
3
|
-
import Long from 'long';
|
|
4
|
-
import { Instruction } from '@project-serum/anchor';
|
|
5
|
-
import { SolanaBindOptions } from './bind-options';
|
|
6
|
-
declare type IndexConfigure = {
|
|
7
|
-
startSlot: Long;
|
|
8
|
-
endSlot?: Long;
|
|
9
|
-
};
|
|
10
|
-
export declare class SolanaBaseProcessor {
|
|
11
|
-
instructionHanlderMap: Map<string, (instruction: Instruction, ctx: SolanaContext) => void>;
|
|
12
|
-
address: string;
|
|
13
|
-
endpoint: string;
|
|
14
|
-
contractName: string;
|
|
15
|
-
processInnerInstruction: boolean;
|
|
16
|
-
config: IndexConfigure;
|
|
17
|
-
decodeInstruction: (rawInstruction: string) => Instruction | null;
|
|
18
|
-
fromParsedInstruction: (instruction: {
|
|
19
|
-
type: string;
|
|
20
|
-
info: any;
|
|
21
|
-
}) => Instruction | null;
|
|
22
|
-
constructor(options: SolanaBindOptions);
|
|
23
|
-
bind(options: SolanaBindOptions): void;
|
|
24
|
-
innerInstruction(flag: boolean): this;
|
|
25
|
-
onInstruction(instructionName: string, handler: (instruction: Instruction, ctx: SolanaContext) => void): this;
|
|
26
|
-
handleInstruction(ins: string | {
|
|
27
|
-
type: string;
|
|
28
|
-
info: any;
|
|
29
|
-
}): ProcessResult | null;
|
|
30
|
-
isBind(): boolean;
|
|
31
|
-
startSlot(startSlot: Long | number): this;
|
|
32
|
-
endBlock(endBlock: Long | number): this;
|
|
33
|
-
}
|
|
34
|
-
export {};
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.SolanaBaseProcessor = void 0;
|
|
7
|
-
const context_1 = require("./context");
|
|
8
|
-
const long_1 = __importDefault(require("long"));
|
|
9
|
-
class SolanaBaseProcessor {
|
|
10
|
-
instructionHanlderMap = new Map();
|
|
11
|
-
address;
|
|
12
|
-
endpoint;
|
|
13
|
-
contractName;
|
|
14
|
-
processInnerInstruction;
|
|
15
|
-
config = { startSlot: new long_1.default(0) };
|
|
16
|
-
decodeInstruction;
|
|
17
|
-
fromParsedInstruction;
|
|
18
|
-
constructor(options) {
|
|
19
|
-
if (options) {
|
|
20
|
-
this.bind(options);
|
|
21
|
-
}
|
|
22
|
-
global.PROCESSOR_STATE.solanaProcessors.push(this);
|
|
23
|
-
}
|
|
24
|
-
bind(options) {
|
|
25
|
-
this.address = options.address;
|
|
26
|
-
this.contractName = options.name || '';
|
|
27
|
-
this.processInnerInstruction = options.processInnerInstruction || false;
|
|
28
|
-
if (options.startBlock) {
|
|
29
|
-
this.startSlot(options.startBlock);
|
|
30
|
-
}
|
|
31
|
-
if (options.endBlock) {
|
|
32
|
-
this.endBlock(options.endBlock);
|
|
33
|
-
}
|
|
34
|
-
this.endpoint = options.network || 'https://api.mainnet-beta.solana.com';
|
|
35
|
-
}
|
|
36
|
-
innerInstruction(flag) {
|
|
37
|
-
this.processInnerInstruction = flag;
|
|
38
|
-
return this;
|
|
39
|
-
}
|
|
40
|
-
onInstruction(instructionName, handler) {
|
|
41
|
-
if (!this.isBind()) {
|
|
42
|
-
throw new Error("Processor doesn't bind to an address");
|
|
43
|
-
}
|
|
44
|
-
this.instructionHanlderMap.set(instructionName, handler);
|
|
45
|
-
return this;
|
|
46
|
-
}
|
|
47
|
-
handleInstruction(ins) {
|
|
48
|
-
const ctx = new context_1.SolanaContext(this.address);
|
|
49
|
-
let parsedInstruction = null;
|
|
50
|
-
if (ins) {
|
|
51
|
-
if (ins.info) {
|
|
52
|
-
if (this.fromParsedInstruction == null) {
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
parsedInstruction = this.fromParsedInstruction(ins);
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
if (this.decodeInstruction == null) {
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
parsedInstruction = this.decodeInstruction(ins);
|
|
62
|
-
}
|
|
63
|
-
if (parsedInstruction) {
|
|
64
|
-
const handler = this.instructionHanlderMap.get(parsedInstruction.name);
|
|
65
|
-
if (handler) {
|
|
66
|
-
handler(parsedInstruction, ctx);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return {
|
|
71
|
-
gauges: ctx.gauges,
|
|
72
|
-
counters: ctx.counters,
|
|
73
|
-
logs: [],
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
isBind() {
|
|
77
|
-
return this.address !== null;
|
|
78
|
-
}
|
|
79
|
-
startSlot(startSlot) {
|
|
80
|
-
if (typeof startSlot === 'number') {
|
|
81
|
-
startSlot = long_1.default.fromNumber(startSlot);
|
|
82
|
-
}
|
|
83
|
-
this.config.startSlot = startSlot;
|
|
84
|
-
return this;
|
|
85
|
-
}
|
|
86
|
-
endBlock(endBlock) {
|
|
87
|
-
if (typeof endBlock === 'number') {
|
|
88
|
-
endBlock = long_1.default.fromNumber(endBlock);
|
|
89
|
-
}
|
|
90
|
-
this.config.endSlot = endBlock;
|
|
91
|
-
return this;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
exports.SolanaBaseProcessor = SolanaBaseProcessor;
|
|
95
|
-
//# sourceMappingURL=solana-processor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"solana-processor.js","sourceRoot":"","sources":["../src/solana-processor.ts"],"names":[],"mappings":";;;;;;AACA,uCAAyC;AACzC,gDAAuB;AASvB,MAAa,mBAAmB;IACvB,qBAAqB,GAAwE,IAAI,G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AI,OAAO,QAAQ,KAAK,QAAQ,EAAE;YAChC,QAAQ,GAAG,cAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;SACrC;QACD,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG,QAAQ,CAAA;QAC9B,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AA9FD,kDA8FC","sourcesContent":["import { ProcessResult } from './gen/processor/protos/processor'\nimport { SolanaContext } from './context'\nimport Long from 'long'\nimport { Instruction } from '@project-serum/anchor'\nimport { SolanaBindOptions } from './bind-options'\n\ntype IndexConfigure = {\n startSlot: Long\n endSlot?: Long\n}\n\nexport class SolanaBaseProcessor {\n public instructionHanlderMap: Map<string, (instruction: Instruction, ctx: SolanaContext) => void> = new Map()\n address: string\n endpoint: string\n contractName: string\n processInnerInstruction: boolean\n config: IndexConfigure = { startSlot: new Long(0) }\n decodeInstruction: (rawInstruction: string) => Instruction | null\n fromParsedInstruction: (instruction: { type: string; info: any }) => Instruction | null\n\n constructor(options: SolanaBindOptions) {\n if (options) {\n this.bind(options)\n }\n global.PROCESSOR_STATE.solanaProcessors.push(this)\n }\n\n bind(options: SolanaBindOptions) {\n this.address = options.address\n this.contractName = options.name || ''\n this.processInnerInstruction = options.processInnerInstruction || false\n if (options.startBlock) {\n this.startSlot(options.startBlock)\n }\n if (options.endBlock) {\n this.endBlock(options.endBlock)\n }\n this.endpoint = options.network || 'https://api.mainnet-beta.solana.com'\n }\n\n innerInstruction(flag: boolean) {\n this.processInnerInstruction = flag\n return this\n }\n\n public onInstruction(instructionName: string, handler: (instruction: Instruction, ctx: SolanaContext) => void) {\n if (!this.isBind()) {\n throw new Error(\"Processor doesn't bind to an address\")\n }\n\n this.instructionHanlderMap.set(instructionName, handler)\n\n return this\n }\n\n public handleInstruction(ins: string | { type: string; info: any }): ProcessResult | null {\n const ctx = new SolanaContext(this.address)\n let parsedInstruction: Instruction | null = null\n\n if (ins) {\n if ((ins as { type: string; info: any }).info) {\n if (this.fromParsedInstruction == null) {\n return null\n }\n parsedInstruction = this.fromParsedInstruction(ins as { type: string; info: any })\n } else {\n if (this.decodeInstruction == null) {\n return null\n }\n parsedInstruction = this.decodeInstruction(ins as string)\n }\n if (parsedInstruction) {\n const handler = this.instructionHanlderMap.get(parsedInstruction.name)\n if (handler) {\n handler(parsedInstruction, ctx)\n }\n }\n }\n return {\n gauges: ctx.gauges,\n counters: ctx.counters,\n logs: [],\n }\n }\n\n public isBind() {\n return this.address !== null\n }\n\n public startSlot(startSlot: Long | number) {\n if (typeof startSlot === 'number') {\n startSlot = Long.fromNumber(startSlot)\n }\n this.config.startSlot = startSlot\n return this\n }\n\n public endBlock(endBlock: Long | number) {\n if (typeof endBlock === 'number') {\n endBlock = Long.fromNumber(endBlock)\n }\n this.config.endSlot = endBlock\n return this\n }\n}\n"]}
|