@sentio/sdk 1.16.3 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/aptos-processor.d.ts +21 -0
- package/lib/aptos-processor.js +65 -0
- package/lib/aptos-processor.js.map +1 -0
- package/lib/bind-options.d.ts +2 -0
- package/lib/bind-options.js +4 -1
- package/lib/bind-options.js.map +1 -1
- package/lib/builtin/eacaggregatorproxy/index.d.ts +2 -0
- package/lib/builtin/eacaggregatorproxy/index.js +22 -0
- package/lib/builtin/eacaggregatorproxy/index.js.map +1 -0
- package/lib/builtin/eacaggregatorproxy/test-utils.d.ts +6 -0
- package/lib/builtin/eacaggregatorproxy/test-utils.js +57 -0
- package/lib/builtin/eacaggregatorproxy/test-utils.js.map +1 -0
- package/lib/builtin/internal/EACAggregatorProxy.d.ts +460 -0
- package/lib/builtin/internal/EACAggregatorProxy.js +3 -0
- package/lib/builtin/internal/EACAggregatorProxy.js.map +1 -0
- package/lib/builtin/internal/eacaggregatorproxy_processor.d.ts +317 -0
- package/lib/builtin/internal/eacaggregatorproxy_processor.js +813 -0
- package/lib/builtin/internal/eacaggregatorproxy_processor.js.map +1 -0
- package/lib/builtin/internal/factories/EACAggregatorProxy__factory.d.ts +46 -0
- package/lib/builtin/internal/factories/EACAggregatorProxy__factory.js +527 -0
- package/lib/builtin/internal/factories/EACAggregatorProxy__factory.js.map +1 -0
- package/lib/builtin/internal/factories/index.d.ts +1 -0
- package/lib/builtin/internal/factories/index.js +3 -1
- package/lib/builtin/internal/factories/index.js.map +1 -1
- package/lib/builtin/internal/index.d.ts +2 -0
- package/lib/builtin/internal/index.js +3 -1
- package/lib/builtin/internal/index.js.map +1 -1
- package/lib/context.d.ts +5 -0
- package/lib/context.js +15 -3
- package/lib/context.js.map +1 -1
- package/lib/gen/processor/protos/processor.d.ts +2 -0
- package/lib/gen/processor/protos/processor.js +19 -0
- package/lib/gen/processor/protos/processor.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +4 -1
- package/lib/index.js.map +1 -1
- package/lib/meter.js +17 -0
- package/lib/meter.js.map +1 -1
- package/lib/numberish.js +7 -0
- package/lib/numberish.js.map +1 -1
- package/lib/processor-state.d.ts +2 -0
- package/lib/processor-state.js +1 -0
- package/lib/processor-state.js.map +1 -1
- package/lib/service.js +47 -0
- package/lib/service.js.map +1 -1
- package/lib/solana/builtin/spl-token-processor.d.ts +16 -1
- package/lib/solana/builtin/spl-token-processor.js +120 -0
- package/lib/solana/builtin/spl-token-processor.js.map +1 -1
- package/lib/solana/builtin/types.d.ts +97 -0
- package/lib/solana/builtin/types.js.map +1 -1
- package/lib/test/{mirrorworld.d.ts → aptos.test.d.ts} +0 -0
- package/lib/test/aptos.test.js +142 -0
- package/lib/test/aptos.test.js.map +1 -0
- package/lib/test/erc20-template.test.js +21 -2
- package/lib/test/erc20-template.test.js.map +1 -1
- package/lib/test/erc20.js +4 -5
- package/lib/test/erc20.js.map +1 -1
- package/lib/test/erc20.test.js +0 -13
- package/lib/test/erc20.test.js.map +1 -1
- package/lib/test/{tic-tac-toe.d.ts → error-capture.test.d.ts} +0 -0
- package/lib/test/error-capture.test.js +76 -0
- package/lib/test/error-capture.test.js.map +1 -0
- package/lib/test/solana.test.js +1 -17
- package/lib/test/solana.test.js.map +1 -1
- package/lib/test/souffl3.d.ts +1 -0
- package/lib/test/souffl3.js +24 -0
- package/lib/test/souffl3.js.map +1 -0
- package/lib/test/sui.test.js +28 -1
- package/lib/test/sui.test.js.map +1 -1
- package/lib/test/test-provider.d.ts +1 -1
- package/lib/test/test-provider.js +11 -5
- package/lib/test/test-provider.js.map +1 -1
- package/lib/test/types/{game_wallet.d.ts → basic_1.d.ts} +2 -21
- package/lib/test/types/basic_1.js +66 -0
- package/lib/test/types/basic_1.js.map +1 -0
- package/lib/test/types/basic_1_processor.d.ts +13 -0
- package/lib/test/types/basic_1_processor.js +41 -0
- package/lib/test/types/basic_1_processor.js.map +1 -0
- package/lib/utils/chainlink-oracles-goerli.csv +8 -0
- package/lib/utils/chainlink-oracles.csv +217 -0
- package/lib/utils/dex-price.d.ts +22 -0
- package/lib/utils/dex-price.js +114 -0
- package/lib/utils/dex-price.js.map +1 -0
- package/lib/utils/dex-price.test.d.ts +1 -0
- package/lib/utils/dex-price.test.js +22 -0
- package/lib/utils/dex-price.test.js.map +1 -0
- package/lib/utils/erc20.d.ts +1 -0
- package/lib/utils/erc20.js +7 -3
- package/lib/utils/erc20.js.map +1 -1
- package/lib/utils/index.d.ts +3 -1
- package/lib/utils/index.js +6 -1
- package/lib/utils/index.js.map +1 -1
- package/package.json +3 -3
- package/src/abis/EACAggregatorProxy.json +227 -0
- package/src/aptos-processor.ts +75 -0
- package/src/bind-options.ts +1 -0
- package/src/builtin/eacaggregatorproxy/index.ts +6 -0
- package/src/builtin/eacaggregatorproxy/test-utils.ts +89 -0
- package/src/builtin/internal/EACAggregatorProxy.ts +861 -0
- package/src/builtin/internal/eacaggregatorproxy_processor.ts +1417 -0
- package/src/builtin/internal/factories/EACAggregatorProxy__factory.ts +533 -0
- package/src/builtin/internal/factories/index.ts +1 -0
- package/src/builtin/internal/index.ts +2 -0
- package/src/context.ts +15 -2
- package/src/gen/processor/protos/processor.ts +20 -0
- package/src/index.ts +2 -1
- package/src/meter.ts +18 -2
- package/src/numberish.ts +7 -0
- package/src/processor-state.ts +3 -0
- package/src/service.ts +51 -0
- package/src/solana/builtin/spl-token-processor.ts +137 -1
- package/src/solana/builtin/types.ts +11 -0
- package/src/test/abis/solana/basic_1.json +62 -0
- package/src/test/aptos.test.ts +148 -0
- package/src/test/erc20-template.test.ts +26 -3
- package/src/test/erc20.test.ts +1 -15
- package/src/test/erc20.ts +4 -5
- package/src/test/error-capture.test.ts +82 -0
- package/src/test/solana.test.ts +1 -18
- package/src/test/souffl3.ts +24 -0
- package/src/test/sui.test.ts +31 -2
- package/src/test/test-provider.ts +11 -5
- package/src/test/types/basic_1.ts +62 -0
- package/src/test/types/basic_1_processor.ts +41 -0
- package/src/utils/chainlink-oracles-goerli.csv +8 -0
- package/src/utils/chainlink-oracles.csv +217 -0
- package/src/utils/dex-price.test.ts +24 -0
- package/src/utils/dex-price.ts +136 -0
- package/src/utils/erc20.ts +5 -1
- package/src/utils/index.ts +3 -1
- package/lib/test/erc20-template.d.ts +0 -1
- package/lib/test/erc20-template.js +0 -23
- package/lib/test/erc20-template.js.map +0 -1
- package/lib/test/mirrorworld.js +0 -42
- package/lib/test/mirrorworld.js.map +0 -1
- package/lib/test/tic-tac-toe.js +0 -31
- package/lib/test/tic-tac-toe.js.map +0 -1
- package/lib/test/types/game_wallet.js +0 -1396
- package/lib/test/types/game_wallet.js.map +0 -1
- package/lib/test/types/game_wallet_processor.d.ts +0 -107
- package/lib/test/types/game_wallet_processor.js +0 -105
- package/lib/test/types/game_wallet_processor.js.map +0 -1
- package/src/test/abis/solana/mirrorworld.json +0 -1392
- package/src/test/erc20-template.ts +0 -25
- package/src/test/mirrorworld.ts +0 -40
- package/src/test/sentio.yaml +0 -4
- package/src/test/tic-tac-toe.ts +0 -31
- package/src/test/types/game_wallet.ts +0 -1392
- package/src/test/types/game_wallet_processor.ts +0 -113
|
@@ -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
|
-
|