@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,113 +0,0 @@
|
|
|
1
|
-
import { BorshInstructionCoder, Instruction, Idl, BN } from '@project-serum/anchor'
|
|
2
|
-
import { SolanaBaseProcessor, SolanaContext, SolanaBindOptions } from "@sentio/sdk"
|
|
3
|
-
import { game_wallet_idl } from "./game_wallet"
|
|
4
|
-
import bs58 from 'bs58'
|
|
5
|
-
import { PublicKey } from '@solana/web3.js'
|
|
6
|
-
|
|
7
|
-
export class GameWalletProcessor extends SolanaBaseProcessor {
|
|
8
|
-
static bind(options: SolanaBindOptions): GameWalletProcessor {
|
|
9
|
-
if (options && !options.name) {
|
|
10
|
-
options.name = 'GameWallet'
|
|
11
|
-
}
|
|
12
|
-
return new GameWalletProcessor(options)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
decodeInstruction: (rawInstruction: string) => Instruction | null = (rawInstruction) => {
|
|
16
|
-
const instructionCoder = new BorshInstructionCoder(game_wallet_idl as Idl)
|
|
17
|
-
const decodedIns = instructionCoder.decode(Buffer.from(bs58.decode(rawInstruction)))
|
|
18
|
-
return decodedIns
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
onInitializeTokenConfig(handler: (args: { tokenDecimal: number, isPaused: boolean, canDeposit: boolean, canWithdraw: boolean, canSpend: boolean, canDistribute: boolean, isWithdrawServiceFeeEnable: boolean, withdrawServiceFeePercentage: BN, isSpendServiceFeeEnable: boolean, spendServiceFeePercentage: BN, isDistributionServiceFeeEnable: boolean, distributionServiceFeePercentage: BN, isMinWithdrawEnable: boolean, isMaxWithdrawEnable: boolean, minWithdraw: BN, maxWithdraw: BN }, ctx: SolanaContext) => void): GameWalletProcessor {
|
|
23
|
-
this.onInstruction('initializeTokenConfig', (ins: Instruction, ctx) => {
|
|
24
|
-
if (ins) {
|
|
25
|
-
handler(ins.data as { tokenDecimal: number, isPaused: boolean, canDeposit: boolean, canWithdraw: boolean, canSpend: boolean, canDistribute: boolean, isWithdrawServiceFeeEnable: boolean, withdrawServiceFeePercentage: BN, isSpendServiceFeeEnable: boolean, spendServiceFeePercentage: BN, isDistributionServiceFeeEnable: boolean, distributionServiceFeePercentage: BN, isMinWithdrawEnable: boolean, isMaxWithdrawEnable: boolean, minWithdraw: BN, maxWithdraw: BN }, ctx)
|
|
26
|
-
}
|
|
27
|
-
})
|
|
28
|
-
return this
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
onDeposit(handler: (args: { tokenConfigBump: number, depositPoolBump: number, depositPoolTokenAccountBump: number, amount: BN }, ctx: SolanaContext) => void): GameWalletProcessor {
|
|
32
|
-
this.onInstruction('deposit', (ins: Instruction, ctx) => {
|
|
33
|
-
if (ins) {
|
|
34
|
-
handler(ins.data as { tokenConfigBump: number, depositPoolBump: number, depositPoolTokenAccountBump: number, amount: BN }, ctx)
|
|
35
|
-
}
|
|
36
|
-
})
|
|
37
|
-
return this
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
onWithdraw(handler: (args: { tokenConfigBump: number, depositPoolBump: number, depositPoolTokenAccountBump: number, userTokenConfigBump: number, amount: BN, nonce: BN }, ctx: SolanaContext) => void): GameWalletProcessor {
|
|
41
|
-
this.onInstruction('withdraw', (ins: Instruction, ctx) => {
|
|
42
|
-
if (ins) {
|
|
43
|
-
handler(ins.data as { tokenConfigBump: number, depositPoolBump: number, depositPoolTokenAccountBump: number, userTokenConfigBump: number, amount: BN, nonce: BN }, ctx)
|
|
44
|
-
}
|
|
45
|
-
})
|
|
46
|
-
return this
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
onSpend(handler: (args: { tokenConfigBump: number, depositPoolBump: number, depositPoolTokenAccountBump: number, userTokenConfigBump: number, amount: BN, nonce: BN }, ctx: SolanaContext) => void): GameWalletProcessor {
|
|
50
|
-
this.onInstruction('spend', (ins: Instruction, ctx) => {
|
|
51
|
-
if (ins) {
|
|
52
|
-
handler(ins.data as { tokenConfigBump: number, depositPoolBump: number, depositPoolTokenAccountBump: number, userTokenConfigBump: number, amount: BN, nonce: BN }, ctx)
|
|
53
|
-
}
|
|
54
|
-
})
|
|
55
|
-
return this
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
onSpendWithoutUser(handler: (args: { tokenConfigBump: number, depositPoolBump: number, depositPoolTokenAccountBump: number, userTokenConfigBump: number, amount: BN, nonce: BN }, ctx: SolanaContext) => void): GameWalletProcessor {
|
|
59
|
-
this.onInstruction('spendWithoutUser', (ins: Instruction, ctx) => {
|
|
60
|
-
if (ins) {
|
|
61
|
-
handler(ins.data as { tokenConfigBump: number, depositPoolBump: number, depositPoolTokenAccountBump: number, userTokenConfigBump: number, amount: BN, nonce: BN }, ctx)
|
|
62
|
-
}
|
|
63
|
-
})
|
|
64
|
-
return this
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
onAddDistributeSupply(handler: (args: { tokenConfigBump: number, distributionPoolBump: number, distributionPoolTokenAccountBump: number, amount: BN }, ctx: SolanaContext) => void): GameWalletProcessor {
|
|
68
|
-
this.onInstruction('addDistributeSupply', (ins: Instruction, ctx) => {
|
|
69
|
-
if (ins) {
|
|
70
|
-
handler(ins.data as { tokenConfigBump: number, distributionPoolBump: number, distributionPoolTokenAccountBump: number, amount: BN }, ctx)
|
|
71
|
-
}
|
|
72
|
-
})
|
|
73
|
-
return this
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
onDistribute(handler: (args: { tokenConfigBump: number, depositPoolBump: number, depositPoolTokenAccountBump: number, distributionPoolBump: number, distributionPoolTokenAccountBump: number, amount: BN, nonce: BN }, ctx: SolanaContext) => void): GameWalletProcessor {
|
|
77
|
-
this.onInstruction('distribute', (ins: Instruction, ctx) => {
|
|
78
|
-
if (ins) {
|
|
79
|
-
handler(ins.data as { tokenConfigBump: number, depositPoolBump: number, depositPoolTokenAccountBump: number, distributionPoolBump: number, distributionPoolTokenAccountBump: number, amount: BN, nonce: BN }, ctx)
|
|
80
|
-
}
|
|
81
|
-
})
|
|
82
|
-
return this
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
onDistributeWithoutUser(handler: (args: { tokenConfigBump: number, depositPoolBump: number, depositPoolTokenAccountBump: number, distributionPoolBump: number, distributionPoolTokenAccountBump: number, amount: BN, nonce: BN }, ctx: SolanaContext) => void): GameWalletProcessor {
|
|
86
|
-
this.onInstruction('distributeWithoutUser', (ins: Instruction, ctx) => {
|
|
87
|
-
if (ins) {
|
|
88
|
-
handler(ins.data as { tokenConfigBump: number, depositPoolBump: number, depositPoolTokenAccountBump: number, distributionPoolBump: number, distributionPoolTokenAccountBump: number, amount: BN, nonce: BN }, ctx)
|
|
89
|
-
}
|
|
90
|
-
})
|
|
91
|
-
return this
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
onUpdateTokenConfig(handler: (args: { tokenConfigBump: number, tokenDecimal: number, isPaused: boolean, canDeposit: boolean, canWithdraw: boolean, canSpend: boolean, canDistribute: boolean, isWithdrawServiceFeeEnable: boolean, withdrawServiceFeePercentage: BN, isSpendServiceFeeEnable: boolean, spendServiceFeePercentage: BN, isDistributionServiceFeeEnable: boolean, distributionServiceFeePercentage: BN, isMinWithdrawEnable: boolean, isMaxWithdrawEnable: boolean, minWithdraw: BN, maxWithdraw: BN }, ctx: SolanaContext) => void): GameWalletProcessor {
|
|
95
|
-
this.onInstruction('updateTokenConfig', (ins: Instruction, ctx) => {
|
|
96
|
-
if (ins) {
|
|
97
|
-
handler(ins.data as { tokenConfigBump: number, tokenDecimal: number, isPaused: boolean, canDeposit: boolean, canWithdraw: boolean, canSpend: boolean, canDistribute: boolean, isWithdrawServiceFeeEnable: boolean, withdrawServiceFeePercentage: BN, isSpendServiceFeeEnable: boolean, spendServiceFeePercentage: BN, isDistributionServiceFeeEnable: boolean, distributionServiceFeePercentage: BN, isMinWithdrawEnable: boolean, isMaxWithdrawEnable: boolean, minWithdraw: BN, maxWithdraw: BN }, ctx)
|
|
98
|
-
}
|
|
99
|
-
})
|
|
100
|
-
return this
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
onUpdateUserTokenConfig(handler: (args: { tokenConfigBump: number, userTokenConfigBump: number, isActive: boolean, canDeposit: boolean, canWithdraw: boolean, canSpend: boolean, canDistribute: boolean }, ctx: SolanaContext) => void): GameWalletProcessor {
|
|
104
|
-
this.onInstruction('updateUserTokenConfig', (ins: Instruction, ctx) => {
|
|
105
|
-
if (ins) {
|
|
106
|
-
handler(ins.data as { tokenConfigBump: number, userTokenConfigBump: number, isActive: boolean, canDeposit: boolean, canWithdraw: boolean, canSpend: boolean, canDistribute: boolean }, ctx)
|
|
107
|
-
}
|
|
108
|
-
})
|
|
109
|
-
return this
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { TokenBridgeProcessor } from '../solana/builtin/wormhole-processor'
|
|
2
|
-
import { SPLTokenProcessor } from '../solana/builtin'
|
|
3
|
-
|
|
4
|
-
TokenBridgeProcessor.bind({
|
|
5
|
-
address: 'wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb',
|
|
6
|
-
}).onTransferNative((args, ctx) => {
|
|
7
|
-
ctx.meter.Counter('total_transfer_amount').add(args.amount)
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
SPLTokenProcessor.bind({ address: 'wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb' })
|
|
11
|
-
.onMintTo((data, ctx) => {
|
|
12
|
-
if (data.mint === '7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs') {
|
|
13
|
-
ctx.meter.Counter('totalWeth_supply').add(data.amount as number)
|
|
14
|
-
}
|
|
15
|
-
})
|
|
16
|
-
.onBurn((data, ctx) => {
|
|
17
|
-
if (data.mint === '7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs') {
|
|
18
|
-
ctx.meter.Counter('totalWeth_supply').sub(data.amount as number)
|
|
19
|
-
}
|
|
20
|
-
})
|
|
21
|
-
.innerInstruction(true)
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
// https://github.com/openethereum/parity-ethereum/blob/55c90d4016505317034e3e98f699af07f5404b63/rpc/src/v1/types/trace.rs#L482
|
|
2
|
-
import { Result } from '@ethersproject/abi'
|
|
3
|
-
|
|
4
|
-
export interface TypedCallTrace<TArgsArray extends Array<any> = any, TArgsObject = any> extends Trace {
|
|
5
|
-
args: TArgsArray & TArgsObject
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface Trace {
|
|
9
|
-
args?: Result
|
|
10
|
-
|
|
11
|
-
action: TraceAction
|
|
12
|
-
blockHash: string
|
|
13
|
-
blockNumber: number
|
|
14
|
-
result: TraceResult
|
|
15
|
-
subtraces: number
|
|
16
|
-
traceAddress: number[]
|
|
17
|
-
transactionHash: string
|
|
18
|
-
transactionPosition: number
|
|
19
|
-
type: string
|
|
20
|
-
error?: string
|
|
21
|
-
}
|
|
22
|
-
// export type CallType = "call" | "callcode" | "delegatecall" | "staticcall"
|
|
23
|
-
|
|
24
|
-
export interface TraceAction {
|
|
25
|
-
from: string
|
|
26
|
-
to?: string
|
|
27
|
-
value: number
|
|
28
|
-
gas: number
|
|
29
|
-
input?: string
|
|
30
|
-
callType?: string
|
|
31
|
-
|
|
32
|
-
init?: string
|
|
33
|
-
address?: string
|
|
34
|
-
balance?: string
|
|
35
|
-
refundAddress?: string
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// TODO are more field missing for FailedCall, FailedCreate
|
|
39
|
-
export interface TraceResult {
|
|
40
|
-
gasUsed: number
|
|
41
|
-
output?: string
|
|
42
|
-
address?: string
|
|
43
|
-
code?: string
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// const TRACE: Trace = {
|
|
47
|
-
// action: {
|
|
48
|
-
// from: '0xd771111cbfa2bbdafbf9f0e58b49b3f827da31f5',
|
|
49
|
-
// callType: 'call',
|
|
50
|
-
// gas: 0x12154,
|
|
51
|
-
// input:
|
|
52
|
-
// '0xb1a417f4000000000000000000000000d771111cbfa2bbdafbf9f0e58b49b3f827da31f5000000000000000000000000d771111cbfa2bbdafbf9f0e58b49b3f827da31f500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000131888b5aaf000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000',
|
|
53
|
-
// to: '0x0baba1ad5be3a5c0a66e7ac838a129bf948f1ea4',
|
|
54
|
-
// value: 0x131888b5aaf0000,
|
|
55
|
-
// },
|
|
56
|
-
// blockHash: '0x5451711bc530a7c04128fedbe149eb359c10eccd44a83909d448c5244c7eea26',
|
|
57
|
-
// blockNumber: 15533908,
|
|
58
|
-
// result: { gasUsed: 0x114c1, output: '0x' },
|
|
59
|
-
// subtraces: 1,
|
|
60
|
-
// traceAddress: [],
|
|
61
|
-
// transactionHash: '0x66dce11d6217042ed709a38e507e7762c93b1bde4a0447ae7a243493bbdffc0e',
|
|
62
|
-
// transactionPosition: 73,
|
|
63
|
-
// type: 'call',
|
|
64
|
-
// }
|
|
65
|
-
|
|
66
|
-
// const trac2: Trace =
|
|
67
|
-
// {
|
|
68
|
-
// "action": {
|
|
69
|
-
// "from": "0x95ba4cf87d6723ad9c0db21737d862be80e93911",
|
|
70
|
-
// "gas": 0x630d0b,
|
|
71
|
-
// "init": "0x608060405234801561001057600080fd5b50604051602080610b2983398101806040528101908080519060200190929190505050808060405180807f6f72672e7a657070656c696e6f732e70726f78792e696d706c656d656e74617481526020017f696f6e000000000000000000000000000000000000000000000000000000000081525060230190506040518091039020600019167f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3600102600019161415156100c657fe5b6100de81610169640100000000026401000000009004565b5060405180807f6f72672e7a657070656c696e6f732e70726f78792e61646d696e000000000000815250601a0190506040518091039020600019167f10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b6001026000191614151561014a57fe5b6101623361024e640100000000026401000000009004565b5050610290565b60006101878261027d6401000000000261084b176401000000009004565b1515610221576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603b8152602001807f43616e6e6f742073657420612070726f787920696d706c656d656e746174696f81526020017f6e20746f2061206e6f6e2d636f6e74726163742061646472657373000000000081525060400191505060405180910390fd5b7f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c360010290508181555050565b60007f10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b60010290508181555050565b600080823b905060008111915050919050565b61088a8061029f6000396000f30060806040526004361061006d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633659cfe6146100775780634f1ef286146100ba5780635c60da1b146101085780638f2839701461015f578063f851a440146101a2575b6100756101f9565b005b34801561008357600080fd5b506100b8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610213565b005b610106600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001919091929391929390505050610268565b005b34801561011457600080fd5b5061011d610308565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561016b57600080fd5b506101a0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610360565b005b3480156101ae57600080fd5b506101b761051e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610201610576565b61021161020c610651565b610682565b565b61021b6106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561025c57610257816106d9565b610265565b6102646101f9565b5b50565b6102706106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102fa576102ac836106d9565b3073ffffffffffffffffffffffffffffffffffffffff163483836040518083838082843782019150509250505060006040518083038185875af19250505015156102f557600080fd5b610303565b6103026101f9565b5b505050565b60006103126106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103545761034d610651565b905061035d565b61035c6101f9565b5b90565b6103686106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561051257600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610466576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001807f43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f81526020017f787920746f20746865207a65726f20616464726573730000000000000000000081525060400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61048f6106a8565b82604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a161050d81610748565b61051b565b61051a6101f9565b5b50565b60006105286106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561056a576105636106a8565b9050610573565b6105726101f9565b5b90565b61057e6106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610647576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260328152602001807f43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e20667281526020017f6f6d207468652070726f78792061646d696e000000000000000000000000000081525060400191505060405180910390fd5b61064f610777565b565b6000807f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c36001029050805491505090565b3660008037600080366000845af43d6000803e80600081146106a3573d6000f35b3d6000fd5b6000807f10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b6001029050805491505090565b6106e281610779565b7fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b60007f10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b60010290508181555050565b565b60006107848261084b565b151561081e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603b8152602001807f43616e6e6f742073657420612070726f787920696d706c656d656e746174696f81526020017f6e20746f2061206e6f6e2d636f6e74726163742061646472657373000000000081525060400191505060405180910390fd5b7f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c360010290508181555050565b600080823b9050600081119150509190505600a165627a7a72305820a4a547cfc7202c5acaaae74d428e988bc62ad5024eb0165532d3a8f91db4ed2400290000000000000000000000000882477e7895bdc5cea7cb1552ed914ab157fe56",
|
|
72
|
-
// "value": 0x0
|
|
73
|
-
// },
|
|
74
|
-
// "blockHash": "0xb2f6986457f5a24ff088a0beb5567c8c1fe2da02687c78e743507ee7c982b977",
|
|
75
|
-
// "blockNumber": 6082465,
|
|
76
|
-
// "result": {
|
|
77
|
-
// "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
|
|
78
|
-
// "code": "0x60806040526004361061006d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633659cfe6146100775780634f1ef286146100ba5780635c60da1b146101085780638f2839701461015f578063f851a440146101a2575b6100756101f9565b005b34801561008357600080fd5b506100b8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610213565b005b610106600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001919091929391929390505050610268565b005b34801561011457600080fd5b5061011d610308565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561016b57600080fd5b506101a0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610360565b005b3480156101ae57600080fd5b506101b761051e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610201610576565b61021161020c610651565b610682565b565b61021b6106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561025c57610257816106d9565b610265565b6102646101f9565b5b50565b6102706106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102fa576102ac836106d9565b3073ffffffffffffffffffffffffffffffffffffffff163483836040518083838082843782019150509250505060006040518083038185875af19250505015156102f557600080fd5b610303565b6103026101f9565b5b505050565b60006103126106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103545761034d610651565b905061035d565b61035c6101f9565b5b90565b6103686106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561051257600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610466576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001807f43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f81526020017f787920746f20746865207a65726f20616464726573730000000000000000000081525060400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61048f6106a8565b82604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a161050d81610748565b61051b565b61051a6101f9565b5b50565b60006105286106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561056a576105636106a8565b9050610573565b6105726101f9565b5b90565b61057e6106a8565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610647576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260328152602001807f43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e20667281526020017f6f6d207468652070726f78792061646d696e000000000000000000000000000081525060400191505060405180910390fd5b61064f610777565b565b6000807f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c36001029050805491505090565b3660008037600080366000845af43d6000803e80600081146106a3573d6000f35b3d6000fd5b6000807f10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b6001029050805491505090565b6106e281610779565b7fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b60007f10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b60010290508181555050565b565b60006107848261084b565b151561081e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603b8152602001807f43616e6e6f742073657420612070726f787920696d706c656d656e746174696f81526020017f6e20746f2061206e6f6e2d636f6e74726163742061646472657373000000000081525060400191505060405180910390fd5b7f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c360010290508181555050565b600080823b9050600081119150509190505600a165627a7a72305820a4a547cfc7202c5acaaae74d428e988bc62ad5024eb0165532d3a8f91db4ed240029",
|
|
79
|
-
// "gasUsed": 0x74f42
|
|
80
|
-
// },
|
|
81
|
-
// "subtraces": 0,
|
|
82
|
-
// "traceAddress": [],
|
|
83
|
-
// "transactionHash": "0xe7e0fe390354509cd08c9a0168536938600ddc552b3f7cb96030ebef62e75895",
|
|
84
|
-
// "transactionPosition": 22,
|
|
85
|
-
// "type": "create"
|
|
86
|
-
// }
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { BaseContract } from 'ethers'
|
|
2
|
-
import { BaseProcessor, BaseProcessorTemplate, SolanaBaseProcessor, TemplateInstance, ProcessorState } from '..'
|
|
3
|
-
import { Provider } from '@ethersproject/providers'
|
|
4
|
-
import { ContractView } from 'context'
|
|
5
|
-
|
|
6
|
-
declare global {
|
|
7
|
-
// var Processors: BaseProcessor<BaseContract, ContractView<BaseContract>>[]
|
|
8
|
-
// var Templates: BaseProcessorTemplate<BaseContract, ContractView<BaseContract>>[]
|
|
9
|
-
// var TemplatesInstances: TemplateInstance[]
|
|
10
|
-
// var SentioProvider: Map<number, Provider>
|
|
11
|
-
// var SolanaProcessors: SolanaBaseProcessor[]
|
|
12
|
-
|
|
13
|
-
var PROCESSOR_STATE: ProcessorState
|
|
14
|
-
var sentio_sdk: any
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// processorState = new ProcessorState()
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
// copy from https://github.com/DefiLlama/chainlist/blob/main/constants/chainIds.js
|
|
2
|
-
// and https://besu.hyperledger.org/en/stable/Concepts/NetworkID-And-ChainID/
|
|
3
|
-
|
|
4
|
-
export const CHAIN_MAP: Record<string, string> = {
|
|
5
|
-
SOL_mainnet: 'solana',
|
|
6
|
-
SOL_devnet: 'solana-dev',
|
|
7
|
-
SOL_testnet: 'solana-test',
|
|
8
|
-
0: 'kardia',
|
|
9
|
-
1: 'ethereum',
|
|
10
|
-
2: 'expanse',
|
|
11
|
-
3: 'ropsten',
|
|
12
|
-
4: 'rinkeby',
|
|
13
|
-
5: 'goerli',
|
|
14
|
-
6: 'kotti',
|
|
15
|
-
8: 'ubiq',
|
|
16
|
-
10: 'optimism',
|
|
17
|
-
19: 'songbird',
|
|
18
|
-
20: 'elastos',
|
|
19
|
-
25: 'cronos',
|
|
20
|
-
30: 'rsk',
|
|
21
|
-
40: 'telos',
|
|
22
|
-
50: 'xdc',
|
|
23
|
-
52: 'csc',
|
|
24
|
-
55: 'zyx',
|
|
25
|
-
56: 'binance',
|
|
26
|
-
57: 'syscoin',
|
|
27
|
-
60: 'gochain',
|
|
28
|
-
61: 'ethclassic',
|
|
29
|
-
63: 'mordor',
|
|
30
|
-
66: 'okexchain',
|
|
31
|
-
70: 'hoo',
|
|
32
|
-
82: 'meter',
|
|
33
|
-
88: 'tomochain',
|
|
34
|
-
100: 'xdai',
|
|
35
|
-
106: 'velas',
|
|
36
|
-
108: 'thundercore',
|
|
37
|
-
122: 'fuse',
|
|
38
|
-
128: 'heco',
|
|
39
|
-
137: 'polygon',
|
|
40
|
-
200: 'xdaiarb',
|
|
41
|
-
212: 'astor',
|
|
42
|
-
246: 'energyweb',
|
|
43
|
-
250: 'fantom',
|
|
44
|
-
269: 'hpb',
|
|
45
|
-
288: 'boba',
|
|
46
|
-
321: 'kucoin',
|
|
47
|
-
336: 'shiden',
|
|
48
|
-
361: 'theta',
|
|
49
|
-
416: 'sx',
|
|
50
|
-
534: 'candle',
|
|
51
|
-
592: 'astar',
|
|
52
|
-
820: 'callisto',
|
|
53
|
-
888: 'wanchain',
|
|
54
|
-
1088: 'metis',
|
|
55
|
-
1246: 'omchain',
|
|
56
|
-
1284: 'moonbeam',
|
|
57
|
-
1285: 'moonriver',
|
|
58
|
-
2018: 'dev',
|
|
59
|
-
2020: 'ronin',
|
|
60
|
-
2222: 'kava',
|
|
61
|
-
2612: 'ezchain',
|
|
62
|
-
4181: 'phi',
|
|
63
|
-
4689: 'iotex',
|
|
64
|
-
5050: 'xlc',
|
|
65
|
-
5551: 'nahmii',
|
|
66
|
-
7777: 'nmactest',
|
|
67
|
-
8217: 'klaytn',
|
|
68
|
-
9001: 'evmos',
|
|
69
|
-
10000: 'smartbch',
|
|
70
|
-
103090: 'crystaleum',
|
|
71
|
-
32659: 'fusion',
|
|
72
|
-
42161: 'arbitrum',
|
|
73
|
-
42220: 'celo',
|
|
74
|
-
42262: 'oasis',
|
|
75
|
-
43114: 'avalanche',
|
|
76
|
-
71402: 'godwoken',
|
|
77
|
-
200625: 'akroma',
|
|
78
|
-
333999: 'polis',
|
|
79
|
-
11155111: 'sepolia',
|
|
80
|
-
1313161554: 'aurora',
|
|
81
|
-
1666600000: 'harmony',
|
|
82
|
-
11297108109: 'palm',
|
|
83
|
-
836542336838601: 'curio',
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export function getChainName(chainId: string | number): string {
|
|
87
|
-
if (typeof chainId === 'number') {
|
|
88
|
-
chainId = chainId.toString()
|
|
89
|
-
}
|
|
90
|
-
const name = CHAIN_MAP[chainId]
|
|
91
|
-
if (name) {
|
|
92
|
-
return name
|
|
93
|
-
}
|
|
94
|
-
return chainId
|
|
95
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { BigNumber } from 'ethers'
|
|
2
|
-
import { BigDecimal, MetricValue } from '@sentio/sdk'
|
|
3
|
-
import { Numberish } from '../numberish'
|
|
4
|
-
|
|
5
|
-
export function toBigDecimal(n: BigNumber) {
|
|
6
|
-
return new BigDecimal(n.toString())
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function metricValueToNumberish(v: MetricValue): Numberish {
|
|
10
|
-
if (v.doubleValue) {
|
|
11
|
-
return v.doubleValue
|
|
12
|
-
}
|
|
13
|
-
if (v.bigInteger) {
|
|
14
|
-
const bn = BigNumber.from(v.bigInteger.data)
|
|
15
|
-
if (v.bigInteger.negative) {
|
|
16
|
-
return BigNumber.from(0).sub(bn)
|
|
17
|
-
}
|
|
18
|
-
return bn
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (v.bigDecimal) {
|
|
22
|
-
return new BigDecimal(v.bigDecimal)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
throw Error("MetricValue doesn't contain any of possible value")
|
|
26
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ProcessorState } from '@sentio/sdk'
|
|
2
|
-
import { getERC20TokenInfo } from './erc20'
|
|
3
|
-
import { loadTestProvidersFromEnv } from '../test'
|
|
4
|
-
|
|
5
|
-
describe('erc20 tests', () => {
|
|
6
|
-
global.PROCESSOR_STATE = new ProcessorState()
|
|
7
|
-
const haveProviders = loadTestProvidersFromEnv('1')
|
|
8
|
-
|
|
9
|
-
const testIf = haveProviders ? test : test.skip
|
|
10
|
-
|
|
11
|
-
testIf('test bytes32', async () => {
|
|
12
|
-
const info = await getERC20TokenInfo('0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2')
|
|
13
|
-
|
|
14
|
-
expect(info.decimal).toEqual(18)
|
|
15
|
-
expect(info.symbol).toEqual('MKR')
|
|
16
|
-
expect(info.name).toEqual('Maker')
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
testIf('test normal', async () => {
|
|
20
|
-
const info = await getERC20TokenInfo('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48')
|
|
21
|
-
|
|
22
|
-
expect(info.decimal).toEqual(6)
|
|
23
|
-
expect(info.symbol).toEqual('USDC')
|
|
24
|
-
expect(info.name).toEqual('USD Coin')
|
|
25
|
-
})
|
|
26
|
-
})
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { BigNumber } from '@ethersproject/bignumber'
|
|
2
|
-
|
|
3
|
-
import { transformEtherError } from '../error'
|
|
4
|
-
import { getERC20Contract } from '../builtin/erc20'
|
|
5
|
-
import { getERC20BytesContract } from '../builtin/internal/erc20bytes_processor'
|
|
6
|
-
import { BigDecimal } from '@sentio/sdk'
|
|
7
|
-
import { toBigDecimal } from './convert'
|
|
8
|
-
import { utils } from 'ethers'
|
|
9
|
-
|
|
10
|
-
export class TokenInfo {
|
|
11
|
-
symbol: string
|
|
12
|
-
name: string
|
|
13
|
-
decimal: number
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const NATIVE_ETH = {
|
|
17
|
-
symbol: 'ETH',
|
|
18
|
-
decimal: 18,
|
|
19
|
-
name: 'Native ETH',
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const TOKEN_INFOS = new Map<string, TokenInfo>()
|
|
23
|
-
|
|
24
|
-
export async function getERC20TokenInfo(tokenAddress: string, chainId = 1): Promise<TokenInfo> {
|
|
25
|
-
const key = chainId + tokenAddress
|
|
26
|
-
const res = TOKEN_INFOS.get(key)
|
|
27
|
-
if (res) {
|
|
28
|
-
return res
|
|
29
|
-
}
|
|
30
|
-
const contract = getERC20Contract(tokenAddress, chainId)
|
|
31
|
-
const bytesContract = getERC20BytesContract(tokenAddress, chainId)
|
|
32
|
-
|
|
33
|
-
try {
|
|
34
|
-
// TODO maybe not do try catch, just do raw call the parse results
|
|
35
|
-
let name = ''
|
|
36
|
-
try {
|
|
37
|
-
name = await contract.name()
|
|
38
|
-
} catch (e) {
|
|
39
|
-
name = utils.parseBytes32String(await bytesContract.name())
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
let symbol = ''
|
|
43
|
-
try {
|
|
44
|
-
symbol = await contract.symbol()
|
|
45
|
-
} catch (e) {
|
|
46
|
-
symbol = utils.parseBytes32String(await bytesContract.symbol())
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const decimal = await contract.decimals()
|
|
50
|
-
const info: TokenInfo = { name, symbol, decimal }
|
|
51
|
-
TOKEN_INFOS.set(key, info)
|
|
52
|
-
return info
|
|
53
|
-
} catch (e) {
|
|
54
|
-
throw transformEtherError(e, undefined)
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export async function getER20NormalizedAmount(
|
|
59
|
-
tokenAddress: string,
|
|
60
|
-
amount: BigNumber,
|
|
61
|
-
chainId: number
|
|
62
|
-
): Promise<BigDecimal> {
|
|
63
|
-
const tokenInfo = await getERC20TokenInfo(tokenAddress, chainId)
|
|
64
|
-
const divider = new BigDecimal(10).pow(tokenInfo.decimal)
|
|
65
|
-
return toBigDecimal(amount).dividedBy(divider)
|
|
66
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2018 base-x contributors
|
|
4
|
-
Copyright (c) 2014-2018 The Bitcoin Core developers
|
|
5
|
-
|
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
in the Software without restriction, including without limitation the rights
|
|
9
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
furnished to do so, subject to the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
SOFTWARE.
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
# base-x
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.org/package/base-x)
|
|
4
|
-
[](https://travis-ci.org/cryptocoinjs/base-x)
|
|
5
|
-
|
|
6
|
-
[](https://github.com/feross/standard)
|
|
7
|
-
|
|
8
|
-
Fast base encoding / decoding of any given alphabet using bitcoin style leading
|
|
9
|
-
zero compression.
|
|
10
|
-
|
|
11
|
-
**WARNING:** This module is **NOT RFC3548** compliant, it cannot be used for base16 (hex), base32, or base64 encoding in a standards compliant manner.
|
|
12
|
-
|
|
13
|
-
## Example
|
|
14
|
-
|
|
15
|
-
Base58
|
|
16
|
-
|
|
17
|
-
``` javascript
|
|
18
|
-
var BASE58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
|
|
19
|
-
var bs58 = require('base-x')(BASE58)
|
|
20
|
-
|
|
21
|
-
var decoded = bs58.decode('5Kd3NBUAdUnhyzenEwVLy9pBKxSwXvE9FMPyR4UKZvpe6E3AgLr')
|
|
22
|
-
|
|
23
|
-
console.log(decoded)
|
|
24
|
-
// => Uint8Array(33) [
|
|
25
|
-
// 128, 237, 219, 220, 17, 104, 241, 218,
|
|
26
|
-
// 234, 219, 211, 228, 76, 30, 63, 143,
|
|
27
|
-
// 90, 40, 76, 32, 41, 247, 138, 210,
|
|
28
|
-
// 106, 249, 133, 131, 164, 153, 222, 91,
|
|
29
|
-
// 25
|
|
30
|
-
// ]
|
|
31
|
-
|
|
32
|
-
console.log(bs58.encode(decoded))
|
|
33
|
-
// => 5Kd3NBUAdUnhyzenEwVLy9pBKxSwXvE9FMPyR4UKZvpe6E3AgLr
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
### Alphabets
|
|
37
|
-
|
|
38
|
-
See below for a list of commonly recognized alphabets, and their respective base.
|
|
39
|
-
|
|
40
|
-
Base | Alphabet
|
|
41
|
-
------------- | -------------
|
|
42
|
-
2 | `01`
|
|
43
|
-
8 | `01234567`
|
|
44
|
-
11 | `0123456789a`
|
|
45
|
-
16 | `0123456789abcdef`
|
|
46
|
-
32 | `0123456789ABCDEFGHJKMNPQRSTVWXYZ`
|
|
47
|
-
32 | `ybndrfg8ejkmcpqxot1uwisza345h769` (z-base-32)
|
|
48
|
-
36 | `0123456789abcdefghijklmnopqrstuvwxyz`
|
|
49
|
-
58 | `123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`
|
|
50
|
-
62 | `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`
|
|
51
|
-
64 | `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`
|
|
52
|
-
67 | `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.!~`
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
## How it works
|
|
56
|
-
|
|
57
|
-
It encodes octet arrays by doing long divisions on all significant digits in the
|
|
58
|
-
array, creating a representation of that number in the new base. Then for every
|
|
59
|
-
leading zero in the input (not significant as a number) it will encode as a
|
|
60
|
-
single leader character. This is the first in the alphabet and will decode as 8
|
|
61
|
-
bits. The other characters depend upon the base. For example, a base58 alphabet
|
|
62
|
-
packs roughly 5.858 bits per character.
|
|
63
|
-
|
|
64
|
-
This means the encoded string 000f (using a base16, 0-f alphabet) will actually decode
|
|
65
|
-
to 4 bytes unlike a canonical hex encoding which uniformly packs 4 bits into each
|
|
66
|
-
character.
|
|
67
|
-
|
|
68
|
-
While unusual, this does mean that no padding is required and it works for bases
|
|
69
|
-
like 43.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
## LICENSE [MIT](LICENSE)
|
|
73
|
-
A direct derivation of the base58 implementation from [`bitcoin/bitcoin`](https://github.com/bitcoin/bitcoin/blob/f1e2f2a85962c1664e4e55471061af0eaa798d40/src/base58.cpp), generalized for variable length alphabets.
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "base-x",
|
|
3
|
-
"version": "4.0.0",
|
|
4
|
-
"description": "Fast base encoding / decoding of any given alphabet",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"base-x",
|
|
7
|
-
"base58",
|
|
8
|
-
"base62",
|
|
9
|
-
"base64",
|
|
10
|
-
"crypto",
|
|
11
|
-
"crytography",
|
|
12
|
-
"decode",
|
|
13
|
-
"decoding",
|
|
14
|
-
"encode",
|
|
15
|
-
"encoding"
|
|
16
|
-
],
|
|
17
|
-
"homepage": "https://github.com/cryptocoinjs/base-x",
|
|
18
|
-
"bugs": {
|
|
19
|
-
"url": "https://github.com/cryptocoinjs/base-x/issues"
|
|
20
|
-
},
|
|
21
|
-
"license": "MIT",
|
|
22
|
-
"author": "Daniel Cousens",
|
|
23
|
-
"files": [
|
|
24
|
-
"src"
|
|
25
|
-
],
|
|
26
|
-
"main": "src/index.js",
|
|
27
|
-
"types": "src/index.d.ts",
|
|
28
|
-
"repository": {
|
|
29
|
-
"type": "git",
|
|
30
|
-
"url": "https://github.com/cryptocoinjs/base-x.git"
|
|
31
|
-
},
|
|
32
|
-
"scripts": {
|
|
33
|
-
"build": "tsc -p ./tsconfig.json ; standard --fix",
|
|
34
|
-
"gitdiff": "npm run build && git diff --exit-code",
|
|
35
|
-
"prepublish": "npm run gitdiff",
|
|
36
|
-
"standard": "standard",
|
|
37
|
-
"test": "npm run unit && npm run standard",
|
|
38
|
-
"unit": "tape test/*.js"
|
|
39
|
-
},
|
|
40
|
-
"devDependencies": {
|
|
41
|
-
"@types/node": "12.0.10",
|
|
42
|
-
"standard": "^10.0.3",
|
|
43
|
-
"tape": "^4.5.1",
|
|
44
|
-
"typescript": "3.5.2"
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
declare function base(ALPHABET: string): base.BaseConverter;
|
|
2
|
-
export = base;
|
|
3
|
-
declare namespace base {
|
|
4
|
-
interface BaseConverter {
|
|
5
|
-
encode(buffer: Uint8Array | number[]): string;
|
|
6
|
-
decodeUnsafe(string: string): Uint8Array | undefined;
|
|
7
|
-
decode(string: string): Uint8Array;
|
|
8
|
-
}
|
|
9
|
-
}
|