@sentio/sdk 2.0.0-rc.14 → 2.0.0-rc.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/aptos/api.d.ts +5 -0
- package/lib/aptos/api.js +21 -0
- package/lib/aptos/api.js.map +1 -0
- package/lib/aptos/aptos-plugin.d.ts +14 -0
- package/lib/aptos/aptos-plugin.js +146 -0
- package/lib/aptos/aptos-plugin.js.map +1 -0
- package/lib/aptos/aptos-processor.d.ts +72 -0
- package/lib/aptos/aptos-processor.js +201 -0
- package/lib/aptos/aptos-processor.js.map +1 -0
- package/lib/aptos/builtin/0x1.d.ts +2140 -0
- package/lib/aptos/builtin/0x1.js +2727 -0
- package/lib/aptos/builtin/0x1.js.map +1 -0
- package/lib/aptos/builtin/0x3.d.ts +573 -0
- package/lib/aptos/builtin/0x3.js +496 -0
- package/lib/aptos/builtin/0x3.js.map +1 -0
- package/lib/aptos/builtin/index.d.ts +2 -0
- package/lib/aptos/builtin/index.js +6 -0
- package/lib/aptos/builtin/index.js.map +1 -0
- package/lib/aptos/codegen/codegen.d.ts +23 -0
- package/lib/aptos/codegen/codegen.js +388 -0
- package/lib/aptos/codegen/codegen.js.map +1 -0
- package/lib/aptos/codegen/index.d.ts +1 -0
- package/lib/aptos/codegen/index.js +2 -0
- package/lib/aptos/codegen/index.js.map +1 -0
- package/lib/aptos/codegen/typegen.d.ts +18 -0
- package/lib/aptos/codegen/typegen.js +145 -0
- package/lib/aptos/codegen/typegen.js.map +1 -0
- package/lib/aptos/codegen/typegen.test.d.ts +1 -0
- package/lib/aptos/codegen/typegen.test.js.map +1 -0
- package/lib/aptos/context.d.ts +21 -0
- package/lib/aptos/context.js +59 -0
- package/lib/aptos/context.js.map +1 -0
- package/lib/aptos/index.d.ts +9 -0
- package/lib/aptos/index.js +8 -0
- package/lib/aptos/index.js.map +1 -0
- package/lib/aptos/models.d.ts +37 -0
- package/lib/aptos/models.js +2 -0
- package/lib/aptos/models.js.map +1 -0
- package/lib/aptos/move-coder.d.ts +22 -0
- package/lib/aptos/move-coder.js +164 -0
- package/lib/aptos/move-coder.js.map +1 -0
- package/lib/aptos/move-types.d.ts +10 -0
- package/lib/aptos/move-types.js +2 -0
- package/lib/aptos/move-types.js.map +1 -0
- package/lib/aptos/network.d.ts +11 -0
- package/lib/aptos/network.js +27 -0
- package/lib/aptos/network.js.map +1 -0
- package/lib/aptos/run-codegen.d.ts +1 -0
- package/lib/aptos/run-codegen.js +12 -0
- package/lib/aptos/run-codegen.js.map +1 -0
- package/lib/aptos/tests/aptos.test.d.ts +1 -0
- package/lib/aptos/tests/aptos.test.js.map +1 -0
- package/lib/aptos/tests/souffl3.d.ts +1 -0
- package/lib/aptos/tests/souffl3.js +44 -0
- package/lib/aptos/tests/souffl3.js.map +1 -0
- package/lib/aptos/tests/types/index.d.ts +3 -0
- package/lib/aptos/tests/types/index.js +7 -0
- package/lib/aptos/tests/types/index.js.map +1 -0
- package/lib/aptos/tests/types/reserved.d.ts +445 -0
- package/lib/aptos/tests/types/reserved.js +301 -0
- package/lib/aptos/tests/types/reserved.js.map +1 -0
- package/lib/aptos/tests/types/soffl3.d.ts +1065 -0
- package/lib/aptos/tests/types/soffl3.js +548 -0
- package/lib/aptos/tests/types/soffl3.js.map +1 -0
- package/lib/aptos/tests/types/souffle.d.ts +440 -0
- package/lib/aptos/tests/types/souffle.js +295 -0
- package/lib/aptos/tests/types/souffle.js.map +1 -0
- package/lib/aptos/types.d.ts +9 -0
- package/lib/aptos/types.js +130 -0
- package/lib/aptos/types.js.map +1 -0
- package/lib/aptos/types.test.d.ts +1 -0
- package/lib/aptos/types.test.js.map +1 -0
- package/lib/aptos/utils.d.ts +7 -0
- package/lib/aptos/utils.js +20 -0
- package/lib/aptos/utils.js.map +1 -0
- package/lib/{utils/chain.d.ts → chain.d.ts} +0 -0
- package/lib/{utils/chain.js → chain.js} +0 -0
- package/lib/chain.js.map +1 -0
- package/lib/core/context.js +1 -1
- package/lib/core/context.js.map +1 -1
- package/lib/core/sui-plugin.js +1 -1
- package/lib/core/sui-plugin.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/solana/builtin/index.d.ts +1 -0
- package/lib/solana/builtin/index.js +2 -0
- package/lib/solana/builtin/index.js.map +1 -0
- package/lib/solana/builtin/spl-token-processor.d.ts +39 -0
- package/lib/solana/builtin/spl-token-processor.js +254 -0
- package/lib/solana/builtin/spl-token-processor.js.map +1 -0
- package/lib/solana/builtin/types.d.ts +427 -0
- package/lib/solana/builtin/types.js +200 -0
- package/lib/solana/builtin/types.js.map +1 -0
- package/lib/solana/codegen/codegen.d.ts +1 -0
- package/lib/solana/codegen/codegen.js +122 -0
- package/lib/solana/codegen/codegen.js.map +1 -0
- package/lib/solana/codegen/index.d.ts +1 -0
- package/lib/solana/codegen/index.js +2 -0
- package/lib/solana/codegen/index.js.map +1 -0
- package/lib/solana/index.d.ts +4 -0
- package/lib/solana/index.js +5 -0
- package/lib/solana/index.js.map +1 -0
- package/lib/solana/run-codegen.d.ts +2 -0
- package/lib/solana/run-codegen.js +12 -0
- package/lib/solana/run-codegen.js.map +1 -0
- package/lib/solana/solana-context.d.ts +9 -0
- package/lib/solana/solana-context.js +28 -0
- package/lib/solana/solana-context.js.map +1 -0
- package/lib/solana/solana-options.d.ts +10 -0
- package/lib/solana/solana-options.js +10 -0
- package/lib/solana/solana-options.js.map +1 -0
- package/lib/solana/solana-plugin.d.ts +9 -0
- package/lib/solana/solana-plugin.js +87 -0
- package/lib/solana/solana-plugin.js.map +1 -0
- package/lib/solana/solana-processor.d.ts +43 -0
- package/lib/solana/solana-processor.js +72 -0
- package/lib/solana/solana-processor.js.map +1 -0
- package/lib/solana/tests/solana.test.d.ts +1 -0
- package/lib/solana/tests/solana.test.js.map +1 -0
- package/lib/solana/tests/types/basic_1.d.ts +26 -0
- package/lib/solana/tests/types/basic_1.js +63 -0
- package/lib/solana/tests/types/basic_1.js.map +1 -0
- package/lib/solana/tests/types/basic_1_processor.d.ts +21 -0
- package/lib/solana/tests/types/basic_1_processor.js +35 -0
- package/lib/solana/tests/types/basic_1_processor.js.map +1 -0
- package/lib/solana/tests/types/token_bridge.d.ts +29 -0
- package/lib/solana/tests/types/token_bridge.js +938 -0
- package/lib/solana/tests/types/token_bridge.js.map +1 -0
- package/lib/solana/tests/types/token_bridge_processor.d.ts +212 -0
- package/lib/solana/tests/types/token_bridge_processor.js +134 -0
- package/lib/solana/tests/types/token_bridge_processor.js.map +1 -0
- package/lib/solana/tests/wormhole-token-bridge.d.ts +15 -0
- package/lib/solana/tests/wormhole-token-bridge.js +79 -0
- package/lib/solana/tests/wormhole-token-bridge.js.map +1 -0
- package/lib/testing/test-processor-server.js +1 -1
- package/lib/testing/test-processor-server.js.map +1 -1
- package/lib/testing/test-provider.js +1 -1
- package/lib/testing/test-provider.js.map +1 -1
- package/lib/utils/index.d.ts +0 -1
- package/lib/utils/index.js +0 -1
- package/lib/utils/index.js.map +1 -1
- package/package.json +33 -11
- package/src/aptos/abis/0x1.json +9205 -0
- package/src/aptos/abis/0x3.json +1515 -0
- package/src/aptos/api.ts +23 -0
- package/src/aptos/aptos-plugin.ts +183 -0
- package/src/aptos/aptos-processor.ts +331 -0
- package/src/aptos/builtin/0x1.ts +4911 -0
- package/src/aptos/builtin/0x3.ts +1092 -0
- package/src/aptos/builtin/index.ts +5 -0
- package/src/aptos/codegen/codegen.ts +470 -0
- package/src/aptos/codegen/index.ts +1 -0
- package/src/aptos/codegen/tsconfig.json +8 -0
- package/src/aptos/codegen/typegen.ts +165 -0
- package/src/aptos/context.ts +72 -0
- package/src/aptos/index.ts +10 -0
- package/src/aptos/models.ts +47 -0
- package/src/aptos/move-coder.ts +201 -0
- package/src/aptos/move-types.ts +11 -0
- package/src/aptos/network.ts +29 -0
- package/src/aptos/run-codegen.ts +13 -0
- package/src/aptos/tests/abis/reserved.json +402 -0
- package/src/aptos/tests/abis/soffl3.json +1411 -0
- package/src/aptos/tests/abis/souffle.json +389 -0
- package/src/aptos/tests/souffl3.ts +57 -0
- package/src/aptos/tests/types/index.ts +6 -0
- package/src/aptos/tests/types/reserved.ts +881 -0
- package/src/aptos/tests/types/soffl3.ts +1820 -0
- package/src/aptos/tests/types/souffle.ts +880 -0
- package/src/aptos/types.ts +149 -0
- package/src/aptos/utils.ts +26 -0
- package/src/{utils/chain.ts → chain.ts} +0 -0
- package/src/core/context.ts +1 -1
- package/src/core/sui-plugin.ts +1 -1
- package/src/index.ts +1 -1
- package/src/solana/builtin/index.ts +1 -0
- package/src/solana/builtin/spl-token-processor.ts +298 -0
- package/src/solana/builtin/types.ts +279 -0
- package/src/solana/codegen/codegen.ts +140 -0
- package/src/solana/codegen/index.ts +1 -0
- package/src/solana/codegen/tsconfig.json +8 -0
- package/src/solana/index.ts +4 -0
- package/src/solana/run-codegen.ts +13 -0
- package/src/solana/solana-context.ts +30 -0
- package/src/solana/solana-options.ts +11 -0
- package/src/solana/solana-plugin.ts +103 -0
- package/src/solana/solana-processor.ts +102 -0
- package/src/solana/tests/abis/basic_1.json +62 -0
- package/src/solana/tests/abis/token_bridge.json +937 -0
- package/src/solana/tests/types/basic_1.ts +62 -0
- package/src/solana/tests/types/basic_1_processor.ts +42 -0
- package/src/solana/tests/types/token_bridge.ts +937 -0
- package/src/solana/tests/types/token_bridge_processor.ts +150 -0
- package/src/solana/tests/wormhole-token-bridge.ts +96 -0
- package/src/testing/test-processor-server.ts +1 -1
- package/src/testing/test-provider.ts +1 -1
- package/src/utils/index.ts +0 -1
- package/lib/utils/chain.js.map +0 -1
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { SPLITTER, VECTOR_STR } from './utils.js'
|
|
2
|
+
|
|
3
|
+
export class TypeDescriptor {
|
|
4
|
+
// type: string
|
|
5
|
+
|
|
6
|
+
// qualified name without type parameters
|
|
7
|
+
qname: string
|
|
8
|
+
// account?: string
|
|
9
|
+
// module?: string
|
|
10
|
+
|
|
11
|
+
typeArgs: TypeDescriptor[]
|
|
12
|
+
|
|
13
|
+
constructor(symbol: string, typeParams?: TypeDescriptor[]) {
|
|
14
|
+
this.qname = symbol
|
|
15
|
+
this.typeArgs = typeParams || []
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
getSignature(): string {
|
|
19
|
+
if (this.typeArgs.length > 0) {
|
|
20
|
+
return this.qname + '<' + this.typeArgs.map((t) => t.getSignature()).join(', ') + '>'
|
|
21
|
+
}
|
|
22
|
+
return this.qname
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Replace T0, T1 with more concrete type
|
|
26
|
+
applyTypeArgs(ctx: Map<string, TypeDescriptor>): TypeDescriptor {
|
|
27
|
+
const replace = ctx.get(this.qname)
|
|
28
|
+
if (replace) {
|
|
29
|
+
return replace
|
|
30
|
+
}
|
|
31
|
+
if (ctx.size === 0 || this.typeArgs.length === 0) {
|
|
32
|
+
return this
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const typeArgs: TypeDescriptor[] = []
|
|
36
|
+
for (const arg of this.typeArgs) {
|
|
37
|
+
const replace = ctx.get(arg.qname)
|
|
38
|
+
if (replace) {
|
|
39
|
+
typeArgs.push(replace)
|
|
40
|
+
} else {
|
|
41
|
+
typeArgs.push(arg.applyTypeArgs(ctx))
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return new TypeDescriptor(this.qname, typeArgs)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// all depended types including itself, not include system type
|
|
48
|
+
dependedTypes(): string[] {
|
|
49
|
+
if (this.qname.startsWith('&')) {
|
|
50
|
+
return []
|
|
51
|
+
}
|
|
52
|
+
switch (this.qname) {
|
|
53
|
+
case 'signer':
|
|
54
|
+
case 'address':
|
|
55
|
+
case '0x1::string::String':
|
|
56
|
+
case 'bool':
|
|
57
|
+
case 'u8':
|
|
58
|
+
case 'u16':
|
|
59
|
+
case 'u32':
|
|
60
|
+
case 'u64':
|
|
61
|
+
case 'u128':
|
|
62
|
+
return []
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Type parameters are not depended
|
|
66
|
+
if (this.qname.indexOf(SPLITTER) == -1) {
|
|
67
|
+
if (this.qname.startsWith('T')) {
|
|
68
|
+
return []
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const types = new Set<string>()
|
|
73
|
+
for (const param of this.typeArgs) {
|
|
74
|
+
param.dependedTypes().forEach((t) => types.add(t))
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (this.qname !== VECTOR_STR) {
|
|
78
|
+
types.add(this.qname)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return Array.from(types)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function parseMoveType(type: string): TypeDescriptor {
|
|
86
|
+
// type = type.replace('&', '')
|
|
87
|
+
|
|
88
|
+
type = type.replaceAll('&mut ', '&')
|
|
89
|
+
type = type.replaceAll('mut ', '')
|
|
90
|
+
|
|
91
|
+
// TODO replace ' ' is not exactly safe, need to double check this
|
|
92
|
+
type = type.replaceAll(' ', '')
|
|
93
|
+
|
|
94
|
+
const stack: TypeDescriptor[] = [new TypeDescriptor('')]
|
|
95
|
+
let buffer = []
|
|
96
|
+
|
|
97
|
+
// xxx:asdf<g1<a,<c,d>>, b, g2<a,b>, e>
|
|
98
|
+
for (let i = 0; i < type.length; i++) {
|
|
99
|
+
const ch = type[i]
|
|
100
|
+
if (ch === '<') {
|
|
101
|
+
// const symbol = type.slice(symbolStart, i)
|
|
102
|
+
// symbolStart =
|
|
103
|
+
const symbol = buffer.join('')
|
|
104
|
+
buffer = []
|
|
105
|
+
stack[stack.length - 1].qname = symbol
|
|
106
|
+
stack.push(new TypeDescriptor(''))
|
|
107
|
+
continue
|
|
108
|
+
}
|
|
109
|
+
if (ch === '>') {
|
|
110
|
+
const typeParam = stack.pop()
|
|
111
|
+
if (!typeParam) {
|
|
112
|
+
throw Error('Uxpectecd stack size')
|
|
113
|
+
}
|
|
114
|
+
if (buffer.length > 0) {
|
|
115
|
+
typeParam.qname = buffer.join('')
|
|
116
|
+
buffer = []
|
|
117
|
+
}
|
|
118
|
+
stack[stack.length - 1].typeArgs.push(typeParam)
|
|
119
|
+
continue
|
|
120
|
+
}
|
|
121
|
+
if (ch === ',') {
|
|
122
|
+
const typeParam = stack.pop()
|
|
123
|
+
if (!typeParam) {
|
|
124
|
+
throw Error('Uxpectecd stack size')
|
|
125
|
+
}
|
|
126
|
+
if (buffer.length > 0) {
|
|
127
|
+
typeParam.qname = buffer.join('')
|
|
128
|
+
buffer = []
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
stack[stack.length - 1].typeArgs.push(typeParam)
|
|
132
|
+
// continue parse next param
|
|
133
|
+
stack.push(new TypeDescriptor(''))
|
|
134
|
+
continue
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
buffer.push(ch)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (buffer.length > 0) {
|
|
141
|
+
stack[stack.length - 1].qname = buffer.join('')
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const res = stack.pop()
|
|
145
|
+
if (!res || stack.length > 0) {
|
|
146
|
+
throw Error('Uxpectecd stack size')
|
|
147
|
+
}
|
|
148
|
+
return res
|
|
149
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { MoveFunction, MoveModule } from './move-types.js'
|
|
2
|
+
|
|
3
|
+
export const SPLITTER = '::'
|
|
4
|
+
|
|
5
|
+
export const VECTOR_STR = 'vector'
|
|
6
|
+
|
|
7
|
+
export function isFrameworkAccount(account: string) {
|
|
8
|
+
return account === '0x1' || account === '0x2' || account === '0x3'
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function moduleQname(module: MoveModule): string {
|
|
12
|
+
return module.address.toLowerCase() + SPLITTER + module.name
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function moduleQnameForType(type: string): [string, string] {
|
|
16
|
+
const parts = type.split(SPLITTER).slice(0, 2)
|
|
17
|
+
return [parts[0], parts[1]]
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function getMeaningfulFunctionParams(func: MoveFunction): string[] {
|
|
21
|
+
let params = func.params
|
|
22
|
+
if (func.params[0] === '&signer') {
|
|
23
|
+
params = params.slice(1)
|
|
24
|
+
}
|
|
25
|
+
return params
|
|
26
|
+
}
|
|
File without changes
|
package/src/core/context.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { LogParams } from 'ethers/providers'
|
|
|
4
4
|
import { RecordMetaData } from '@sentio/protos'
|
|
5
5
|
import { Trace } from '../eth/trace.js'
|
|
6
6
|
import { Labels, normalizeLabels } from './metadata.js'
|
|
7
|
-
import { CHAIN_IDS } from '../
|
|
7
|
+
import { CHAIN_IDS } from '../chain.js'
|
|
8
8
|
import { BaseContext } from './base-context.js'
|
|
9
9
|
|
|
10
10
|
export abstract class EthContext extends BaseContext {
|
package/src/core/sui-plugin.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ContractConfig, DataBinding, HandlerType, ProcessConfigResponse, Proces
|
|
|
3
3
|
|
|
4
4
|
import { ServerError, Status } from 'nice-grpc'
|
|
5
5
|
|
|
6
|
-
import { CHAIN_IDS } from '../
|
|
6
|
+
import { CHAIN_IDS } from '../chain.js'
|
|
7
7
|
import { SuiProcessorState } from './sui-processor.js'
|
|
8
8
|
|
|
9
9
|
export class SuiPlugin extends Plugin {
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './spl-token-processor.js'
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import { SolanaBaseProcessor, SolanaContext, SolanaBindOptions } from '@sentio/sdk/solana'
|
|
2
|
+
import { Instruction } from '@project-serum/anchor'
|
|
3
|
+
import { AmountToUiAmount, Approve, ApproveChecked, Burn, BurnChecked, CloseAccount, CreateNativeMint, DefaultAccountStateExtension, FreezeAccount, GetAccountDataSize, InitializeAccount, InitializeAccount2, InitializeAccount3, InitializeImmutableOwner, InitializeMint, InitializeMintCloseAuthority, InitializeMultisig, MemoTransferExtension, MintTo, MintToChecked, Reallocate, Revoke, SyncNative, ThawAccount, Transfer, TransferChecked, TransferFeeExtension, UiAmountToAmount } from './types.js';
|
|
4
|
+
|
|
5
|
+
export class SPLTokenProcessor extends SolanaBaseProcessor {
|
|
6
|
+
static bind(options: SolanaBindOptions): SPLTokenProcessor {
|
|
7
|
+
if (options && !options.name) {
|
|
8
|
+
options.name = 'SPL Token Program'
|
|
9
|
+
}
|
|
10
|
+
return new SPLTokenProcessor(options)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
fromParsedInstruction: (instruction: { type: string, info: any }) => Instruction | null = (instruction: { type: string, info: any }) => {
|
|
14
|
+
const instructionType = instruction.type
|
|
15
|
+
if (!instructionType) {
|
|
16
|
+
return null
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
name: instruction.type,
|
|
20
|
+
data: {
|
|
21
|
+
...instruction.info,
|
|
22
|
+
},
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public onInitializeMint(
|
|
27
|
+
handler: (data: InitializeMint, ctx: SolanaContext) => void
|
|
28
|
+
): SPLTokenProcessor {
|
|
29
|
+
this.onInstruction('initializeMint', (ins: Instruction, ctx) => {
|
|
30
|
+
if (ins) {
|
|
31
|
+
handler(ins.data as InitializeMint, ctx)
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
return this
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public onInitializeAccount(
|
|
38
|
+
hanlder: (data: InitializeAccount, ctx: SolanaContext) => void
|
|
39
|
+
): SPLTokenProcessor {
|
|
40
|
+
this.onInstruction('initializeAccount', (ins: Instruction, ctx) => {
|
|
41
|
+
if (ins) {
|
|
42
|
+
hanlder(ins.data as InitializeAccount, ctx)
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
return this
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public onInitializeAccount2(
|
|
49
|
+
hanlder: (data: InitializeAccount2, ctx: SolanaContext) => void
|
|
50
|
+
): SPLTokenProcessor {
|
|
51
|
+
this.onInstruction('initializeAccount2', (ins: Instruction, ctx) => {
|
|
52
|
+
if (ins) {
|
|
53
|
+
hanlder(ins.data as InitializeAccount2, ctx)
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
return this
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public onInitializeAccount3(
|
|
60
|
+
hanlder: (data: InitializeAccount3, ctx: SolanaContext) => void
|
|
61
|
+
): SPLTokenProcessor {
|
|
62
|
+
this.onInstruction('initializeAccount3', (ins: Instruction, ctx) => {
|
|
63
|
+
if (ins) {
|
|
64
|
+
hanlder(ins.data as InitializeAccount3, ctx)
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
return this
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
public onInitializeMultisig(
|
|
71
|
+
handler: (data: InitializeMultisig, ctx: SolanaContext) => void
|
|
72
|
+
): SPLTokenProcessor {
|
|
73
|
+
this.onInstruction('initializeMultisig', (ins: Instruction, ctx) => {
|
|
74
|
+
if (ins) {
|
|
75
|
+
handler(ins.data as InitializeMultisig, ctx)
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
return this
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
public onTransfer(handler: (data: Transfer, ctx: SolanaContext) => void): SPLTokenProcessor {
|
|
82
|
+
this.onInstruction('transfer', (ins: Instruction, ctx) => {
|
|
83
|
+
if (ins) {
|
|
84
|
+
handler(ins.data as Transfer, ctx)
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
return this
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
public onApprovend(handler: (data: Approve, ctx: SolanaContext) => void): SPLTokenProcessor {
|
|
91
|
+
this.onInstruction('approve', (ins: Instruction, ctx) => {
|
|
92
|
+
if (ins) {
|
|
93
|
+
handler(ins.data as Approve, ctx)
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
return this
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
public onRevoke(handler: (data: Revoke, ctx: SolanaContext) => void): SPLTokenProcessor {
|
|
100
|
+
this.onInstruction('revoke', (ins: Instruction, ctx) => {
|
|
101
|
+
if (ins) {
|
|
102
|
+
handler(ins.data as Revoke, ctx)
|
|
103
|
+
}
|
|
104
|
+
})
|
|
105
|
+
return this
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
public onSetAuthority(handler: (data: any, ctx: SolanaContext) => void): SPLTokenProcessor {
|
|
109
|
+
this.onInstruction('setAuthority', (ins: Instruction, ctx) => {
|
|
110
|
+
if (ins) {
|
|
111
|
+
handler(ins.data as any, ctx)
|
|
112
|
+
}
|
|
113
|
+
})
|
|
114
|
+
return this
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
public onMintTo(handler: (data: MintTo, ctx: SolanaContext) => void): SPLTokenProcessor {
|
|
118
|
+
this.onInstruction('mintTo', (ins: Instruction, ctx) => {
|
|
119
|
+
if (ins) {
|
|
120
|
+
handler(ins.data as MintTo, ctx)
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
return this
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
public onBurn(handler: (data: Burn, ctx: SolanaContext) => void): SPLTokenProcessor {
|
|
127
|
+
this.onInstruction('burn', (ins: Instruction, ctx) => {
|
|
128
|
+
if (ins) {
|
|
129
|
+
handler(ins.data as Burn, ctx)
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
return this
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
public onCloseAccount(handler: (data: CloseAccount, ctx: SolanaContext) => void): SPLTokenProcessor {
|
|
136
|
+
this.onInstruction('closeAccount', (ins: Instruction, ctx) => {
|
|
137
|
+
if (ins) {
|
|
138
|
+
handler(ins.data as CloseAccount, ctx)
|
|
139
|
+
}
|
|
140
|
+
})
|
|
141
|
+
return this
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
public onFreezeAccount(handler: (data: FreezeAccount, ctx: SolanaContext) => void): SPLTokenProcessor {
|
|
145
|
+
this.onInstruction('freezeAccount', (ins: Instruction, ctx) => {
|
|
146
|
+
if (ins) {
|
|
147
|
+
handler(ins.data as FreezeAccount, ctx)
|
|
148
|
+
}
|
|
149
|
+
})
|
|
150
|
+
return this
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
public onThawAccount(handler: (data: ThawAccount, ctx: SolanaContext) => void): SPLTokenProcessor {
|
|
154
|
+
this.onInstruction('thawAccount', (ins: Instruction, ctx) => {
|
|
155
|
+
if (ins) {
|
|
156
|
+
handler(ins.data as ThawAccount, ctx)
|
|
157
|
+
}
|
|
158
|
+
})
|
|
159
|
+
return this
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
public onTransferChecked(handler: (data: TransferChecked, ctx: SolanaContext) => void): SPLTokenProcessor {
|
|
163
|
+
this.onInstruction('transferChecked', (ins: Instruction, ctx) => {
|
|
164
|
+
if (ins) {
|
|
165
|
+
handler(ins.data as TransferChecked, ctx)
|
|
166
|
+
}
|
|
167
|
+
})
|
|
168
|
+
return this
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
public onApproveChecked(handler: (data: ApproveChecked, ctx: SolanaContext) => void): SPLTokenProcessor {
|
|
172
|
+
this.onInstruction('approveChecked', (ins: Instruction, ctx) => {
|
|
173
|
+
if (ins) {
|
|
174
|
+
handler(ins.data as ApproveChecked, ctx)
|
|
175
|
+
}
|
|
176
|
+
})
|
|
177
|
+
return this
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
public onMintToChecked(handler: (data: MintToChecked, ctx: SolanaContext) => void): SPLTokenProcessor {
|
|
181
|
+
this.onInstruction('mintToChecked', (ins: Instruction, ctx) => {
|
|
182
|
+
if (ins) {
|
|
183
|
+
handler(ins.data as MintToChecked, ctx)
|
|
184
|
+
}
|
|
185
|
+
})
|
|
186
|
+
return this
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
public onBurnChecked(handler: (data: BurnChecked, ctx: SolanaContext) => void): SPLTokenProcessor {
|
|
190
|
+
this.onInstruction('burnChecked', (ins: Instruction, ctx) => {
|
|
191
|
+
if (ins) {
|
|
192
|
+
handler(ins.data as BurnChecked, ctx)
|
|
193
|
+
}
|
|
194
|
+
})
|
|
195
|
+
return this
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
public onSyncNative(handler: (data: SyncNative, ctx: SolanaContext) => void): SPLTokenProcessor {
|
|
199
|
+
this.onInstruction('syncNative', (ins: Instruction, ctx) => {
|
|
200
|
+
if (ins) {
|
|
201
|
+
handler(ins.data as SyncNative, ctx)
|
|
202
|
+
}
|
|
203
|
+
})
|
|
204
|
+
return this
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
public onGetAccountDataSize(handler: (data: GetAccountDataSize, ctx: SolanaContext) => void): SPLTokenProcessor {
|
|
208
|
+
this.onInstruction('getAccountDataSize', (ins: Instruction, ctx) => {
|
|
209
|
+
if (ins) {
|
|
210
|
+
handler(ins.data as GetAccountDataSize, ctx)
|
|
211
|
+
}
|
|
212
|
+
})
|
|
213
|
+
return this
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
public onInitializeImmutableOwner(handler: (data: InitializeImmutableOwner, ctx: SolanaContext) => void): SPLTokenProcessor {
|
|
217
|
+
this.onInstruction('initializeImmutableOwner', (ins: Instruction, ctx) => {
|
|
218
|
+
if (ins) {
|
|
219
|
+
handler(ins.data as InitializeImmutableOwner, ctx)
|
|
220
|
+
}
|
|
221
|
+
})
|
|
222
|
+
return this
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
public onAmountToUiAmount(handler: (data: AmountToUiAmount, ctx: SolanaContext) => void): SPLTokenProcessor {
|
|
226
|
+
this.onInstruction('amountToUiAmount', (ins: Instruction, ctx) => {
|
|
227
|
+
if (ins) {
|
|
228
|
+
handler(ins.data as AmountToUiAmount, ctx)
|
|
229
|
+
}
|
|
230
|
+
})
|
|
231
|
+
return this
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
public onUiAmountToAmount(handler: (data: UiAmountToAmount, ctx: SolanaContext) => void): SPLTokenProcessor {
|
|
235
|
+
this.onInstruction('uiAmountToAmount', (ins: Instruction, ctx) => {
|
|
236
|
+
if (ins) {
|
|
237
|
+
handler(ins.data as UiAmountToAmount, ctx)
|
|
238
|
+
}
|
|
239
|
+
})
|
|
240
|
+
return this
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
public onInitializeMintCloseAuthority(handler: (data: InitializeMintCloseAuthority, ctx: SolanaContext) => void): SPLTokenProcessor {
|
|
244
|
+
this.onInstruction('initializeMintCloseAuthority', (ins: Instruction, ctx) => {
|
|
245
|
+
if (ins) {
|
|
246
|
+
handler(ins.data as InitializeMintCloseAuthority, ctx)
|
|
247
|
+
}
|
|
248
|
+
})
|
|
249
|
+
return this
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
public onTransferFeeExtension(handler: (data: TransferFeeExtension, ctx: SolanaContext) => void): SPLTokenProcessor {
|
|
253
|
+
this.onInstruction('transferFeeExtension', (ins: Instruction, ctx) => {
|
|
254
|
+
if (ins) {
|
|
255
|
+
handler(ins.data as TransferFeeExtension, ctx)
|
|
256
|
+
}
|
|
257
|
+
})
|
|
258
|
+
return this
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
public onDefaultAccountStateExtension(handler: (data: DefaultAccountStateExtension, ctx: SolanaContext) => void): SPLTokenProcessor {
|
|
262
|
+
this.onInstruction('defaultAccountStateExtension', (ins: Instruction, ctx) => {
|
|
263
|
+
if (ins) {
|
|
264
|
+
handler(ins.data as DefaultAccountStateExtension, ctx)
|
|
265
|
+
}
|
|
266
|
+
})
|
|
267
|
+
return this
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
public onReallocate(handler: (data: Reallocate, ctx: SolanaContext) => void): SPLTokenProcessor {
|
|
271
|
+
this.onInstruction('reallocate', (ins: Instruction, ctx) => {
|
|
272
|
+
if (ins) {
|
|
273
|
+
handler(ins.data as Reallocate, ctx)
|
|
274
|
+
}
|
|
275
|
+
})
|
|
276
|
+
return this
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
public onMemoTransferExtension(handler: (data: MemoTransferExtension, ctx: SolanaContext) => void): SPLTokenProcessor {
|
|
280
|
+
this.onInstruction('memoTransferExtension', (ins: Instruction, ctx) => {
|
|
281
|
+
if (ins) {
|
|
282
|
+
handler(ins.data as MemoTransferExtension, ctx)
|
|
283
|
+
}
|
|
284
|
+
})
|
|
285
|
+
return this
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
public onCreateNativeMint(handler: (data: CreateNativeMint, ctx: SolanaContext) => void): SPLTokenProcessor {
|
|
289
|
+
this.onInstruction('createNativeMint', (ins: Instruction, ctx) => {
|
|
290
|
+
if (ins) {
|
|
291
|
+
handler(ins.data as CreateNativeMint, ctx)
|
|
292
|
+
}
|
|
293
|
+
})
|
|
294
|
+
return this
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// Todo(pcxu): auto gen this file
|
|
298
|
+
}
|