@sentio/sdk 2.40.0-rc.4 → 2.40.0-rc.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/aptos/aptos-processor.d.ts +1 -1
- package/lib/aptos/aptos-processor.d.ts.map +1 -1
- package/lib/aptos/aptos-processor.js +1 -1
- package/lib/aptos/aptos-processor.js.map +1 -1
- package/lib/aptos/context.d.ts +2 -2
- package/lib/aptos/context.d.ts.map +1 -1
- package/lib/aptos/context.js +1 -1
- package/lib/aptos/ext/aptos-dex.d.ts +1 -1
- package/lib/aptos/ext/aptos-dex.d.ts.map +1 -1
- package/lib/aptos/ext/aptos-dex.js +1 -1
- package/lib/aptos/ext/aptos-dex.js.map +1 -1
- package/lib/aptos/ext/coin-event.d.ts +1 -1
- package/lib/aptos/ext/coin-event.d.ts.map +1 -1
- package/lib/aptos/ext/coin.js +2 -2
- package/lib/aptos/ext/coin.js.map +1 -1
- package/lib/aptos/move-coder.d.ts.map +1 -1
- package/lib/aptos/move-coder.js +6 -5
- package/lib/aptos/move-coder.js.map +1 -1
- package/lib/aptos/network.d.ts +2 -0
- package/lib/aptos/network.d.ts.map +1 -1
- package/lib/aptos/network.js +7 -1
- package/lib/aptos/network.js.map +1 -1
- package/lib/eth/account-processor.d.ts +21 -7
- package/lib/eth/account-processor.d.ts.map +1 -1
- package/lib/eth/account-processor.js +2 -2
- package/lib/eth/account-processor.js.map +1 -1
- package/lib/eth/base-processor-template.d.ts +24 -8
- package/lib/eth/base-processor-template.d.ts.map +1 -1
- package/lib/eth/base-processor-template.js.map +1 -1
- package/lib/eth/base-processor.d.ts +30 -10
- package/lib/eth/base-processor.d.ts.map +1 -1
- package/lib/eth/base-processor.js +6 -6
- package/lib/eth/base-processor.js.map +1 -1
- package/lib/eth/builtin/internal/eacaggregatorproxy-processor.d.ts +100 -31
- package/lib/eth/builtin/internal/eacaggregatorproxy-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js +1226 -46
- package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc1155-processor.d.ts +55 -16
- package/lib/eth/builtin/internal/erc1155-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc1155-processor.js +486 -16
- package/lib/eth/builtin/internal/erc1155-processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc20-processor.d.ts +79 -24
- package/lib/eth/builtin/internal/erc20-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc20-processor.js +985 -36
- package/lib/eth/builtin/internal/erc20-processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc20bytes-processor.d.ts +46 -13
- package/lib/eth/builtin/internal/erc20bytes-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc20bytes-processor.js +485 -18
- package/lib/eth/builtin/internal/erc20bytes-processor.js.map +1 -1
- package/lib/eth/builtin/internal/erc721-processor.d.ts +67 -20
- package/lib/eth/builtin/internal/erc721-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/erc721-processor.js +784 -28
- package/lib/eth/builtin/internal/erc721-processor.js.map +1 -1
- package/lib/eth/builtin/internal/weth9-processor.d.ts +64 -19
- package/lib/eth/builtin/internal/weth9-processor.d.ts.map +1 -1
- package/lib/eth/builtin/internal/weth9-processor.js +574 -22
- package/lib/eth/builtin/internal/weth9-processor.js.map +1 -1
- package/lib/eth/codegen/event-handler.js +1 -1
- package/lib/eth/codegen/file.d.ts.map +1 -1
- package/lib/eth/codegen/file.js +21 -3
- package/lib/eth/codegen/file.js.map +1 -1
- package/lib/eth/codegen/function-calls.d.ts +4 -0
- package/lib/eth/codegen/function-calls.d.ts.map +1 -1
- package/lib/eth/codegen/function-calls.js +80 -5
- package/lib/eth/codegen/function-calls.js.map +1 -1
- package/lib/eth/codegen/types.d.ts +1 -0
- package/lib/eth/codegen/types.d.ts.map +1 -1
- package/lib/eth/codegen/types.js +13 -0
- package/lib/eth/codegen/types.js.map +1 -1
- package/lib/eth/context.d.ts +4 -0
- package/lib/eth/context.d.ts.map +1 -1
- package/lib/eth/context.js +4 -0
- package/lib/eth/context.js.map +1 -1
- package/lib/eth/eth-plugin.d.ts +27 -9
- package/lib/eth/eth-plugin.d.ts.map +1 -1
- package/lib/eth/eth-plugin.js +20 -17
- package/lib/eth/eth-plugin.js.map +1 -1
- package/lib/eth/eth.d.ts.map +1 -1
- package/lib/eth/eth.js +1 -1
- package/lib/eth/eth.js.map +1 -1
- package/lib/eth/generic-processor.js +1 -1
- package/lib/eth/generic-processor.js.map +1 -1
- package/lib/eth/generic-processor.test.js.map +1 -1
- package/lib/eth/index.d.ts +2 -1
- package/lib/eth/index.d.ts.map +1 -1
- package/lib/eth/index.js +2 -1
- package/lib/eth/index.js.map +1 -1
- package/lib/solana/builtin/spl-token-processor.d.ts +1 -1
- package/lib/solana/builtin/spl-token-processor.d.ts.map +1 -1
- package/lib/solana/builtin/spl-token-processor.js +1 -1
- package/lib/solana/builtin/spl-token-processor.js.map +1 -1
- package/lib/solana/solana-context.d.ts +1 -1
- package/lib/solana/solana-context.js +2 -2
- package/lib/stark/codegen/codegen.d.ts +2 -0
- package/lib/stark/codegen/codegen.d.ts.map +1 -0
- package/lib/stark/codegen/codegen.js +109 -0
- package/lib/stark/codegen/codegen.js.map +1 -0
- package/lib/stark/codegen/index.d.ts +2 -0
- package/lib/stark/codegen/index.d.ts.map +1 -0
- package/lib/stark/codegen/index.js +2 -0
- package/lib/stark/codegen/index.js.map +1 -0
- package/lib/stark/codegen/run.d.ts +2 -0
- package/lib/stark/codegen/run.d.ts.map +1 -0
- package/lib/stark/codegen/run.js +11 -0
- package/lib/stark/codegen/run.js.map +1 -0
- package/lib/stark/codegen/utils.d.ts +2 -0
- package/lib/stark/codegen/utils.d.ts.map +1 -0
- package/lib/stark/codegen/utils.js +4 -0
- package/lib/stark/codegen/utils.js.map +1 -0
- package/lib/stark/context.d.ts +28 -0
- package/lib/stark/context.d.ts.map +1 -0
- package/lib/stark/context.js +59 -0
- package/lib/stark/context.js.map +1 -0
- package/lib/stark/contract.d.ts +12 -0
- package/lib/stark/contract.d.ts.map +1 -0
- package/lib/stark/contract.js +43 -0
- package/lib/stark/contract.js.map +1 -0
- package/lib/stark/event.d.ts +7 -0
- package/lib/stark/event.d.ts.map +1 -0
- package/lib/stark/event.js +11 -0
- package/lib/stark/event.js.map +1 -0
- package/lib/stark/index.d.ts +7 -0
- package/lib/stark/index.d.ts.map +1 -0
- package/lib/stark/index.js +7 -0
- package/lib/stark/index.js.map +1 -0
- package/lib/stark/starknet-plugin.d.ts +17 -0
- package/lib/stark/starknet-plugin.d.ts.map +1 -0
- package/lib/stark/starknet-plugin.js +78 -0
- package/lib/stark/starknet-plugin.js.map +1 -0
- package/lib/stark/starknet-processor.d.ts +32 -0
- package/lib/stark/starknet-processor.d.ts.map +1 -0
- package/lib/stark/starknet-processor.js +111 -0
- package/lib/stark/starknet-processor.js.map +1 -0
- package/lib/stark/types.d.ts +11 -0
- package/lib/stark/types.d.ts.map +1 -0
- package/lib/stark/types.js +2 -0
- package/lib/stark/types.js.map +1 -0
- package/lib/store/cache.d.ts +14 -0
- package/lib/store/cache.d.ts.map +1 -0
- package/lib/store/cache.js +35 -0
- package/lib/store/cache.js.map +1 -0
- package/lib/store/store.d.ts +2 -3
- package/lib/store/store.d.ts.map +1 -1
- package/lib/store/store.js +34 -9
- package/lib/store/store.js.map +1 -1
- package/lib/sui/context.d.ts +1 -1
- package/lib/sui/context.d.ts.map +1 -1
- package/lib/sui/sui-processor.d.ts +1 -1
- package/lib/sui/sui-processor.d.ts.map +1 -1
- package/lib/sui/sui-processor.js +1 -1
- package/lib/sui/sui-processor.js.map +1 -1
- package/lib/testing/aptos-facet.d.ts +1 -1
- package/lib/testing/aptos-facet.js +2 -2
- package/lib/testing/starknet-facet.d.ts +9 -0
- package/lib/testing/starknet-facet.d.ts.map +1 -0
- package/lib/testing/starknet-facet.js +52 -0
- package/lib/testing/starknet-facet.js.map +1 -0
- package/lib/testing/sui-facet.js +1 -1
- package/lib/testing/test-processor-server.d.ts +2 -0
- package/lib/testing/test-processor-server.d.ts.map +1 -1
- package/lib/testing/test-processor-server.js +3 -0
- package/lib/testing/test-processor-server.js.map +1 -1
- package/lib/tsup.config.ts +3 -15
- package/lib/utils/dex-price.d.ts +1 -0
- package/lib/utils/dex-price.d.ts.map +1 -1
- package/lib/utils/dex-price.js +13 -2
- package/lib/utils/dex-price.js.map +1 -1
- package/package.json +21 -10
- package/src/aptos/aptos-processor.ts +1 -1
- package/src/aptos/context.ts +2 -2
- package/src/aptos/ext/aptos-dex.ts +1 -1
- package/src/aptos/ext/coin-event.ts +1 -1
- package/src/aptos/ext/coin.ts +2 -2
- package/src/aptos/move-coder.ts +7 -5
- package/src/aptos/network.ts +7 -1
- package/src/bundle.config.ts +23 -0
- package/src/eth/account-processor.ts +28 -12
- package/src/eth/base-processor-template.ts +16 -8
- package/src/eth/base-processor.ts +25 -16
- package/src/eth/builtin/internal/eacaggregatorproxy-processor.ts +1554 -123
- package/src/eth/builtin/internal/erc1155-processor.ts +659 -42
- package/src/eth/builtin/internal/erc20-processor.ts +1266 -90
- package/src/eth/builtin/internal/erc20bytes-processor.ts +639 -49
- package/src/eth/builtin/internal/erc721-processor.ts +1035 -70
- package/src/eth/builtin/internal/weth9-processor.ts +758 -63
- package/src/eth/codegen/event-handler.ts +1 -1
- package/src/eth/codegen/file.ts +26 -3
- package/src/eth/codegen/function-calls.ts +96 -8
- package/src/eth/codegen/types.ts +22 -1
- package/src/eth/context.ts +7 -0
- package/src/eth/eth-plugin.ts +34 -26
- package/src/eth/eth.ts +1 -2
- package/src/eth/generic-processor.ts +1 -1
- package/src/eth/index.ts +5 -1
- package/src/solana/builtin/spl-token-processor.ts +1 -1
- package/src/solana/solana-context.ts +2 -2
- package/src/stark/codegen/codegen.ts +124 -0
- package/src/stark/codegen/index.ts +1 -0
- package/src/stark/codegen/run.ts +10 -0
- package/src/stark/codegen/utils.ts +3 -0
- package/src/stark/context.ts +78 -0
- package/src/stark/contract.ts +55 -0
- package/src/stark/event.ts +7 -0
- package/src/stark/index.ts +9 -0
- package/src/stark/starknet-plugin.ts +108 -0
- package/src/stark/starknet-processor.ts +140 -0
- package/src/stark/types.ts +11 -0
- package/src/store/cache.ts +46 -0
- package/src/store/store.ts +40 -22
- package/src/sui/context.ts +1 -1
- package/src/sui/sui-processor.ts +1 -1
- package/src/testing/aptos-facet.ts +2 -2
- package/src/testing/starknet-facet.ts +61 -0
- package/src/testing/sui-facet.ts +1 -1
- package/src/testing/test-processor-server.ts +3 -0
- package/src/tsup.config.ts +3 -15
- package/src/utils/dex-price.ts +15 -2
- package/lib/eth/provider.d.ts +0 -5
- package/lib/eth/provider.d.ts.map +0 -1
- package/lib/eth/provider.js +0 -134
- package/lib/eth/provider.js.map +0 -1
- package/lib/utils/chainlink-oracles-sepolia.csv +0 -19
- package/lib/utils/chainlink-oracles.csv +0 -217
- package/src/eth/provider.ts +0 -163
@@ -12,7 +12,7 @@ export function generateEventHandler(event: EventDeclaration, contractName: stri
|
|
12
12
|
handler: (event: ${eventNamePrefix}Event, ctx: ${contractName}Context) => void,
|
13
13
|
filter?: ${eventNamePrefix}EventFilter | ${eventNamePrefix}EventFilter[],
|
14
14
|
fetchConfig?: Partial<EthFetchConfig>,
|
15
|
-
preprocessHandler?: (event: ${eventNamePrefix}Event, ctx: ${contractName}Context) => Promise<PreprocessResult>
|
15
|
+
preprocessHandler?: (event: ${eventNamePrefix}Event, ctx: ${contractName}Context, preprocessStore: {[k: string]: any}) => Promise<PreprocessResult>
|
16
16
|
): this {
|
17
17
|
if (!filter) {
|
18
18
|
filter = templateContract.filters['${filterName}'](${event.inputs.map(() => 'null').join(',')})
|
package/src/eth/codegen/file.ts
CHANGED
@@ -9,7 +9,12 @@ import {
|
|
9
9
|
import { reservedKeywords } from '@sentio/ethers-v6/dist/codegen/reserved-keywords.js'
|
10
10
|
import { codegenCallTraceTypes, generateCallHandlers } from './functions-handler.js'
|
11
11
|
import { generateEventFilters, generateEventHandlers } from './event-handler.js'
|
12
|
-
import {
|
12
|
+
import {
|
13
|
+
generateBoundFunctionCallEncoders,
|
14
|
+
generateBoundViewFunctions,
|
15
|
+
generateFunctionCallEncoders,
|
16
|
+
generateViewFunctions
|
17
|
+
} from './function-calls.js'
|
13
18
|
|
14
19
|
export function codeGenIndex(contract: Contract): string {
|
15
20
|
return `
|
@@ -44,6 +49,13 @@ export function codeGenSentioFile(contract: Contract): string {
|
|
44
49
|
.flatMap((fs) => generateViewFunctions(false, fs))
|
45
50
|
.join(',\n')}
|
46
51
|
}
|
52
|
+
|
53
|
+
encodeCall = {
|
54
|
+
${Object.values(contract.functions)
|
55
|
+
.filter((f) => !reservedKeywords.has(f[0].name))
|
56
|
+
.flatMap((fs) => generateFunctionCallEncoders(fs))
|
57
|
+
.join(',\n')}
|
58
|
+
}
|
47
59
|
}
|
48
60
|
|
49
61
|
export class ${contract.name}BoundContractView extends BoundContractView<${contract.name},
|
@@ -61,6 +73,15 @@ export function codeGenSentioFile(contract: Contract): string {
|
|
61
73
|
.flatMap((fs) => generateBoundViewFunctions(false, fs))
|
62
74
|
.join(',\n')}
|
63
75
|
}
|
76
|
+
|
77
|
+
encodeCall = {
|
78
|
+
view: this.view,
|
79
|
+
context: this.context,
|
80
|
+
${Object.values(contract.functions)
|
81
|
+
.filter((f) => !reservedKeywords.has(f[0].name))
|
82
|
+
.flatMap((fs) => generateBoundFunctionCallEncoders(fs))
|
83
|
+
.join(',\n')}
|
84
|
+
}
|
64
85
|
}
|
65
86
|
|
66
87
|
export type ${contract.name}Context = ContractContext<${contract.name}, ${contract.name}BoundContractView>
|
@@ -173,7 +194,7 @@ export class ${contract.name}ProcessorTemplate extends BaseProcessorTemplate<${c
|
|
173
194
|
|
174
195
|
const imports = createImportsForUsedIdentifiers(
|
175
196
|
{
|
176
|
-
ethers: ['BigNumberish', 'Overrides', 'BytesLike'],
|
197
|
+
ethers: ['BigNumberish', 'Overrides', 'BytesLike', 'Interface'],
|
177
198
|
// 'ethers/providers': ['Networkish'],
|
178
199
|
'@sentio/sdk/eth': [
|
179
200
|
'addContractByABI',
|
@@ -195,10 +216,12 @@ export class ${contract.name}ProcessorTemplate extends BaseProcessorTemplate<${c
|
|
195
216
|
'TypedCallTrace',
|
196
217
|
'EthContext',
|
197
218
|
'EthFetchConfig',
|
198
|
-
'PreprocessResult'
|
219
|
+
'PreprocessResult',
|
220
|
+
'makeEthCallKey'
|
199
221
|
],
|
200
222
|
// '@sentio/sdk/eth': ['BaseContext'],
|
201
223
|
// '@sentio/protos': ['EthFetchConfig'],
|
224
|
+
'@sentio/protos': ['EthCallParam', 'EthCallContext', 'PreparedData'],
|
202
225
|
'./common.js': ['PromiseOrValue'],
|
203
226
|
'./index.js': [`${contract.name}__factory`],
|
204
227
|
[`./${contract.name}.js`]: [`${contract.name}`, ...eventsImports, ...uniqueStructImports]
|
@@ -1,7 +1,11 @@
|
|
1
1
|
// https://github.com/dethcrypto/TypeChain/blob/015abb28bd22826611051f27e0ec96a00f9a0b61/packages/target-ethers-v5/src/codegen/functions.ts#L54
|
2
|
-
import { FunctionDeclaration } from 'typechain'
|
2
|
+
import { FunctionDeclaration, getSignatureForFn } from 'typechain'
|
3
3
|
import { generateInputTypes, generateOutputTypes } from '@sentio/ethers-v6/dist/codegen/types.js'
|
4
|
-
import {
|
4
|
+
import {
|
5
|
+
getFullSignatureAsSymbolForFunction,
|
6
|
+
getFullSignatureForFunction,
|
7
|
+
getFullSignatureWithOutputForFn
|
8
|
+
} from './types.js'
|
5
9
|
|
6
10
|
function generateReturnTypes(fn: FunctionDeclaration) {
|
7
11
|
// sounds like returnResultObject should be true but we need to set false to make it work
|
@@ -34,11 +38,28 @@ export function generateViewFunction(view: boolean, fn: FunctionDeclaration, inc
|
|
34
38
|
`
|
35
39
|
async ${declName}(${generateInputTypes(fn.inputs, {
|
36
40
|
useStructs: true
|
37
|
-
})}overrides?: Overrides): ${generateReturnTypes(fn)} {
|
38
|
-
try {
|
39
|
-
|
40
|
-
|
41
|
-
|
41
|
+
})}overrides?: Overrides, preparedData?: PreparedData, ethCallContext?: EthCallContext): ${generateReturnTypes(fn)} {
|
42
|
+
try {
|
43
|
+
if (preparedData?.ethCallResults && ethCallContext) {
|
44
|
+
const iface = new Interface(["function ${getFullSignatureWithOutputForFn(fn)}"])
|
45
|
+
const calldata = iface.encodeFunctionData(
|
46
|
+
"${fn.name}",[${
|
47
|
+
fn.inputs.length > 0 ? fn.inputs.map((input, index) => input.name || `arg${index}`).join(',') + ',' : ''
|
48
|
+
}]
|
49
|
+
)
|
50
|
+
const key = makeEthCallKey({
|
51
|
+
context: ethCallContext,
|
52
|
+
calldata
|
53
|
+
})
|
54
|
+
const ret = preparedData.ethCallResults[key]
|
55
|
+
if (ret) {
|
56
|
+
const result = iface.decodeFunctionResult("${fn.name}", ret).toArray()
|
57
|
+
return result.length == 1? result[0]: result
|
58
|
+
}
|
59
|
+
}
|
60
|
+
return await ${func}${call}(${
|
61
|
+
fn.inputs.length > 0 ? fn.inputs.map((input, index) => input.name || `arg${index}`).join(',') + ',' : ''
|
62
|
+
} overrides || {})
|
42
63
|
} catch (e) {
|
43
64
|
const stack = new Error().stack
|
44
65
|
throw transformEtherError(e, undefined, stack)
|
@@ -67,12 +88,79 @@ export function generateBoundViewFunction(view: boolean, fn: FunctionDeclaration
|
|
67
88
|
async ${declName ?? fn.name}(${generateInputTypes(fn.inputs, {
|
68
89
|
useStructs: true
|
69
90
|
})}overrides?: Overrides): ${generateReturnTypes(fn)} {
|
91
|
+
const ethCallContext = {
|
92
|
+
chainId: this.context.chainId,
|
93
|
+
blockTag: "0x" + this.context.blockNumber.toString(16),
|
94
|
+
address: this.context.address,
|
95
|
+
}
|
70
96
|
return await this.${qualifier}.${declName}(${
|
71
97
|
fn.inputs.length > 0 ? fn.inputs.map((input, index) => input.name || `arg${index}`).join(',') + ',' : ''
|
72
98
|
} {
|
73
99
|
blockTag: this.context.blockNumber,
|
74
100
|
...overrides
|
75
|
-
})
|
101
|
+
}, this.context.preparedData, ethCallContext)
|
102
|
+
}
|
103
|
+
`
|
104
|
+
]
|
105
|
+
}
|
106
|
+
|
107
|
+
// TODO add tests for these
|
108
|
+
export function generateFunctionCallEncoders(functions: FunctionDeclaration[]): string[] {
|
109
|
+
const includeArgTypes = functions.length !== 1
|
110
|
+
return functions.flatMap((fn) => generateFunctionCallEncoder(fn, includeArgTypes))
|
111
|
+
}
|
112
|
+
|
113
|
+
export function generateFunctionCallEncoder(fn: FunctionDeclaration, includeArgTypes: boolean): string[] {
|
114
|
+
const declName = includeArgTypes ? getFullSignatureAsSymbolForFunction(fn) : fn.name
|
115
|
+
return [
|
116
|
+
`
|
117
|
+
${declName}(${generateInputTypes(fn.inputs, {
|
118
|
+
useStructs: true
|
119
|
+
})}ethCallContext: EthCallContext): EthCallParam {
|
120
|
+
try {
|
121
|
+
const iface = new Interface(["function ${getSignatureForFn(fn)}"])
|
122
|
+
const calldata = iface.encodeFunctionData(
|
123
|
+
"${fn.name}",[${
|
124
|
+
fn.inputs.length > 0 ? fn.inputs.map((input, index) => input.name || `arg${index}`).join(',') + ',' : ''
|
125
|
+
}]
|
126
|
+
)
|
127
|
+
return {
|
128
|
+
context: ethCallContext,
|
129
|
+
calldata
|
130
|
+
}
|
131
|
+
} catch (e) {
|
132
|
+
const stack = new Error().stack
|
133
|
+
throw transformEtherError(e, undefined, stack)
|
134
|
+
}
|
135
|
+
}
|
136
|
+
`
|
137
|
+
]
|
138
|
+
}
|
139
|
+
|
140
|
+
export function generateBoundFunctionCallEncoders(functions: FunctionDeclaration[]): string[] {
|
141
|
+
const includeArgTypes = functions.length !== 1
|
142
|
+
return functions.flatMap((fn) => generateBoundFunctionCallEncoder(fn, includeArgTypes))
|
143
|
+
}
|
144
|
+
|
145
|
+
export function generateBoundFunctionCallEncoder(fn: FunctionDeclaration, includeArgTypes: boolean): string[] {
|
146
|
+
const declName = includeArgTypes ? getFullSignatureAsSymbolForFunction(fn) : fn.name
|
147
|
+
|
148
|
+
// TODO need override address?
|
149
|
+
return [
|
150
|
+
`
|
151
|
+
${declName ?? fn.name}(${generateInputTypes(fn.inputs, {
|
152
|
+
useStructs: true
|
153
|
+
})}overrides?: Overrides): EthCallParam {
|
154
|
+
const chainId = overrides?.chainId?.toString() ?? this.context.chainId.toString()
|
155
|
+
const address = this.context.address
|
156
|
+
let blockTag = "0x" + this.context.blockNumber.toString(16)
|
157
|
+
if (overrides?.blockTag) {
|
158
|
+
blockTag = typeof(overrides.blockTag) == 'string'? overrides.blockTag: "0x" + overrides.blockTag.toString(16)
|
159
|
+
}
|
160
|
+
|
161
|
+
return this.view.encodeCall.${declName}(${
|
162
|
+
fn.inputs.length > 0 ? fn.inputs.map((input, index) => input.name || `arg${index}`).join(',') + ',' : ''
|
163
|
+
}{chainId, address, blockTag})
|
76
164
|
}
|
77
165
|
`
|
78
166
|
]
|
package/src/eth/codegen/types.ts
CHANGED
@@ -1,4 +1,11 @@
|
|
1
|
-
import {
|
1
|
+
import {
|
2
|
+
AbiOutputParameter,
|
3
|
+
AbiParameter,
|
4
|
+
EventDeclaration,
|
5
|
+
FunctionDeclaration,
|
6
|
+
getArgumentForSignature,
|
7
|
+
getSignatureForFn
|
8
|
+
} from 'typechain'
|
2
9
|
import { EvmType } from 'typechain/dist/parser/parseEvmType.js'
|
3
10
|
|
4
11
|
export function getFullSignatureAsSymbolForFunction(fn: FunctionDeclaration): string {
|
@@ -40,3 +47,17 @@ export function getFullSignatureForFunction(fn: FunctionDeclaration): string {
|
|
40
47
|
})
|
41
48
|
.join(',')})`
|
42
49
|
}
|
50
|
+
|
51
|
+
function getOutputArgumentForSignature(argument: AbiOutputParameter) {
|
52
|
+
if (argument.type.type == 'void') {
|
53
|
+
return ''
|
54
|
+
}
|
55
|
+
return getArgumentForSignature(argument as AbiParameter)
|
56
|
+
}
|
57
|
+
|
58
|
+
export function getFullSignatureWithOutputForFn(fn: FunctionDeclaration) {
|
59
|
+
return `${getSignatureForFn(fn)} ${fn.stateMutability} returns (${fn.outputs
|
60
|
+
.map((i) => getOutputArgumentForSignature(i))
|
61
|
+
.filter((s) => s != '')
|
62
|
+
.join(',')})`
|
63
|
+
}
|
package/src/eth/context.ts
CHANGED
@@ -188,6 +188,9 @@ export class ContractContext<
|
|
188
188
|
if (view.callStatic) {
|
189
189
|
view.callStatic.context = this
|
190
190
|
}
|
191
|
+
if (view.encodeCall) {
|
192
|
+
view.encodeCall.context = this
|
193
|
+
}
|
191
194
|
this.contractName = contractName
|
192
195
|
this.contract = view
|
193
196
|
}
|
@@ -226,6 +229,10 @@ export class BoundContractView<TContract extends BaseContract, TContractView ext
|
|
226
229
|
context: EthContext
|
227
230
|
view: TContractView
|
228
231
|
}
|
232
|
+
encodeCall: {
|
233
|
+
context: EthContext
|
234
|
+
view: TContractView
|
235
|
+
}
|
229
236
|
|
230
237
|
constructor(address: string, view: TContractView) {
|
231
238
|
this.address = address
|
package/src/eth/eth-plugin.ts
CHANGED
@@ -35,10 +35,13 @@ interface Handlers {
|
|
35
35
|
}
|
36
36
|
|
37
37
|
interface PreprocessHandlers {
|
38
|
-
eventHandlers: ((event: Data_EthLog) => Promise<PreprocessResult>)[]
|
39
|
-
traceHandlers: ((trace: Data_EthTrace) => Promise<PreprocessResult>)[]
|
40
|
-
blockHandlers: ((block: Data_EthBlock) => Promise<PreprocessResult>)[]
|
41
|
-
transactionHandlers: ((
|
38
|
+
eventHandlers: ((event: Data_EthLog, preprocessStore: { [k: string]: any }) => Promise<PreprocessResult>)[]
|
39
|
+
traceHandlers: ((trace: Data_EthTrace, preprocessStore: { [k: string]: any }) => Promise<PreprocessResult>)[]
|
40
|
+
blockHandlers: ((block: Data_EthBlock, preprocessStore: { [k: string]: any }) => Promise<PreprocessResult>)[]
|
41
|
+
transactionHandlers: ((
|
42
|
+
txn: Data_EthTransaction,
|
43
|
+
preprocessStore: { [k: string]: any }
|
44
|
+
) => Promise<PreprocessResult>)[]
|
42
45
|
}
|
43
46
|
|
44
47
|
export class EthPlugin extends Plugin {
|
@@ -278,16 +281,16 @@ export class EthPlugin extends Plugin {
|
|
278
281
|
}
|
279
282
|
}
|
280
283
|
|
281
|
-
preprocessBinding(request: DataBinding): Promise<PreprocessResult> {
|
284
|
+
preprocessBinding(request: DataBinding, preprocessStore: { [k: string]: any }): Promise<PreprocessResult> {
|
282
285
|
switch (request.handlerType) {
|
283
286
|
case HandlerType.ETH_LOG:
|
284
|
-
return this.preprocessLog(request)
|
287
|
+
return this.preprocessLog(request, preprocessStore)
|
285
288
|
case HandlerType.ETH_TRACE:
|
286
|
-
return this.preprocessTrace(request)
|
289
|
+
return this.preprocessTrace(request, preprocessStore)
|
287
290
|
case HandlerType.ETH_BLOCK:
|
288
|
-
return this.preprocessBlock(request)
|
291
|
+
return this.preprocessBlock(request, preprocessStore)
|
289
292
|
case HandlerType.ETH_TRANSACTION:
|
290
|
-
return this.preprocessTransaction(request)
|
293
|
+
return this.preprocessTransaction(request, preprocessStore)
|
291
294
|
default:
|
292
295
|
throw new ServerError(Status.INVALID_ARGUMENT, 'No handle type registered ' + request.handlerType)
|
293
296
|
}
|
@@ -326,7 +329,7 @@ export class EthPlugin extends Plugin {
|
|
326
329
|
return TemplateInstanceState.INSTANCE.getValues().length !== config.templateInstances.length
|
327
330
|
}
|
328
331
|
|
329
|
-
async preprocessLog(request: DataBinding): Promise<PreprocessResult> {
|
332
|
+
async preprocessLog(request: DataBinding, preprocessStore: { [k: string]: any }): Promise<PreprocessResult> {
|
330
333
|
if (!request.data?.ethLog?.log) {
|
331
334
|
throw new ServerError(Status.INVALID_ARGUMENT, "Log can't be null")
|
332
335
|
}
|
@@ -335,7 +338,7 @@ export class EthPlugin extends Plugin {
|
|
335
338
|
const promises: Promise<PreprocessResult>[] = []
|
336
339
|
for (const handlerId of request.handlerIds) {
|
337
340
|
const handler = this.preprocessHandlers.eventHandlers[handlerId]
|
338
|
-
const promise = handler(ethLog).catch((e) => {
|
341
|
+
const promise = handler(ethLog, preprocessStore).catch((e) => {
|
339
342
|
throw new ServerError(
|
340
343
|
Status.INTERNAL,
|
341
344
|
'error processing log: ' + JSON.stringify(ethLog.log) + '\n' + errorString(e)
|
@@ -346,7 +349,7 @@ export class EthPlugin extends Plugin {
|
|
346
349
|
return mergePreprocessResults(await Promise.all(promises))
|
347
350
|
}
|
348
351
|
|
349
|
-
async preprocessTrace(binding: DataBinding): Promise<PreprocessResult> {
|
352
|
+
async preprocessTrace(binding: DataBinding, preprocessStore: { [k: string]: any }): Promise<PreprocessResult> {
|
350
353
|
if (!binding.data?.ethTrace?.trace) {
|
351
354
|
throw new ServerError(Status.INVALID_ARGUMENT, "Trace can't be null")
|
352
355
|
}
|
@@ -355,7 +358,7 @@ export class EthPlugin extends Plugin {
|
|
355
358
|
const promises: Promise<PreprocessResult>[] = []
|
356
359
|
|
357
360
|
for (const handlerId of binding.handlerIds) {
|
358
|
-
const promise = this.preprocessHandlers.traceHandlers[handlerId](ethTrace).catch((e) => {
|
361
|
+
const promise = this.preprocessHandlers.traceHandlers[handlerId](ethTrace, preprocessStore).catch((e) => {
|
359
362
|
throw new ServerError(
|
360
363
|
Status.INTERNAL,
|
361
364
|
'error processing trace: ' + JSON.stringify(ethTrace.trace) + '\n' + errorString(e)
|
@@ -366,7 +369,7 @@ export class EthPlugin extends Plugin {
|
|
366
369
|
return mergePreprocessResults(await Promise.all(promises))
|
367
370
|
}
|
368
371
|
|
369
|
-
async preprocessBlock(binding: DataBinding): Promise<PreprocessResult> {
|
372
|
+
async preprocessBlock(binding: DataBinding, preprocessStore: { [k: string]: any }): Promise<PreprocessResult> {
|
370
373
|
if (!binding.data?.ethBlock?.block) {
|
371
374
|
throw new ServerError(Status.INVALID_ARGUMENT, "Block can't be empty")
|
372
375
|
}
|
@@ -374,7 +377,7 @@ export class EthPlugin extends Plugin {
|
|
374
377
|
|
375
378
|
const promises: Promise<PreprocessResult>[] = []
|
376
379
|
for (const handlerId of binding.handlerIds) {
|
377
|
-
const promise = this.preprocessHandlers.blockHandlers[handlerId](ethBlock).catch((e) => {
|
380
|
+
const promise = this.preprocessHandlers.blockHandlers[handlerId](ethBlock, preprocessStore).catch((e) => {
|
378
381
|
throw new ServerError(
|
379
382
|
Status.INTERNAL,
|
380
383
|
'error processing block: ' + ethBlock.block?.number + '\n' + errorString(e)
|
@@ -385,7 +388,7 @@ export class EthPlugin extends Plugin {
|
|
385
388
|
return mergePreprocessResults(await Promise.all(promises))
|
386
389
|
}
|
387
390
|
|
388
|
-
async preprocessTransaction(binding: DataBinding): Promise<PreprocessResult> {
|
391
|
+
async preprocessTransaction(binding: DataBinding, preprocessStore: { [k: string]: any }): Promise<PreprocessResult> {
|
389
392
|
if (!binding.data?.ethTransaction?.transaction) {
|
390
393
|
throw new ServerError(Status.INVALID_ARGUMENT, "transaction can't be null")
|
391
394
|
}
|
@@ -394,12 +397,14 @@ export class EthPlugin extends Plugin {
|
|
394
397
|
const promises: Promise<PreprocessResult>[] = []
|
395
398
|
|
396
399
|
for (const handlerId of binding.handlerIds) {
|
397
|
-
const promise = this.preprocessHandlers.transactionHandlers[handlerId](ethTransaction).catch(
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
400
|
+
const promise = this.preprocessHandlers.transactionHandlers[handlerId](ethTransaction, preprocessStore).catch(
|
401
|
+
(e) => {
|
402
|
+
throw new ServerError(
|
403
|
+
Status.INTERNAL,
|
404
|
+
'error processing transaction: ' + JSON.stringify(ethTransaction.transaction) + '\n' + errorString(e)
|
405
|
+
)
|
406
|
+
}
|
407
|
+
)
|
403
408
|
promises.push(promise)
|
404
409
|
}
|
405
410
|
return mergePreprocessResults(await Promise.all(promises))
|
@@ -414,7 +419,8 @@ export class EthPlugin extends Plugin {
|
|
414
419
|
const promises: Promise<ProcessResult>[] = []
|
415
420
|
for (const handlerId of request.handlerIds) {
|
416
421
|
const handler = this.handlers.eventHandlers[handlerId]
|
417
|
-
const promise = handler(ethLog).catch((e) => {
|
422
|
+
const promise = handler(ethLog, preparedData).catch((e) => {
|
423
|
+
console.error('error processing log: ', e)
|
418
424
|
throw new ServerError(
|
419
425
|
Status.INTERNAL,
|
420
426
|
'error processing log: ' + JSON.stringify(ethLog.log) + '\n' + errorString(e)
|
@@ -437,7 +443,8 @@ export class EthPlugin extends Plugin {
|
|
437
443
|
const promises: Promise<ProcessResult>[] = []
|
438
444
|
|
439
445
|
for (const handlerId of binding.handlerIds) {
|
440
|
-
const promise = this.handlers.traceHandlers[handlerId](ethTrace).catch((e) => {
|
446
|
+
const promise = this.handlers.traceHandlers[handlerId](ethTrace, preparedData).catch((e) => {
|
447
|
+
console.error('error processing trace: ', e)
|
441
448
|
throw new ServerError(
|
442
449
|
Status.INTERNAL,
|
443
450
|
'error processing trace: ' + JSON.stringify(ethTrace.trace) + '\n' + errorString(e)
|
@@ -459,7 +466,8 @@ export class EthPlugin extends Plugin {
|
|
459
466
|
|
460
467
|
const promises: Promise<ProcessResult>[] = []
|
461
468
|
for (const handlerId of binding.handlerIds) {
|
462
|
-
const promise = this.handlers.blockHandlers[handlerId](ethBlock).catch((e) => {
|
469
|
+
const promise = this.handlers.blockHandlers[handlerId](ethBlock, preparedData).catch((e) => {
|
470
|
+
console.error('error processing block: ', e)
|
463
471
|
throw new ServerError(
|
464
472
|
Status.INTERNAL,
|
465
473
|
'error processing block: ' + ethBlock.block?.number + '\n' + errorString(e)
|
@@ -482,7 +490,7 @@ export class EthPlugin extends Plugin {
|
|
482
490
|
const promises: Promise<ProcessResult>[] = []
|
483
491
|
|
484
492
|
for (const handlerId of binding.handlerIds) {
|
485
|
-
const promise = this.handlers.transactionHandlers[handlerId](ethTransaction).catch((e) => {
|
493
|
+
const promise = this.handlers.transactionHandlers[handlerId](ethTransaction, preparedData).catch((e) => {
|
486
494
|
throw new ServerError(
|
487
495
|
Status.INTERNAL,
|
488
496
|
'error processing transaction: ' + JSON.stringify(ethTransaction.transaction) + '\n' + errorString(e)
|
package/src/eth/eth.ts
CHANGED
@@ -57,8 +57,7 @@ export function transformEtherError(e: Error, ctx: ContractContext<any, any> | u
|
|
57
57
|
return e
|
58
58
|
}
|
59
59
|
|
60
|
-
const checkPage =
|
61
|
-
'Check here for possible cause and fix: https://docs.sentio.xyz/best-practices/handling-errors#ethers-error'
|
60
|
+
const checkPage = 'Check here for possible cause and fix: https://docs.sentio.xyz/docs/handling-errors#ethers-error'
|
62
61
|
|
63
62
|
let msg = ''
|
64
63
|
const err = e as CallExceptionError
|
@@ -2,7 +2,7 @@ import { BaseContract } from 'ethers'
|
|
2
2
|
import { BoundContractView, ContractView } from './context.js'
|
3
3
|
import { BindOptions } from './bind-options.js'
|
4
4
|
import { BaseProcessor } from './base-processor.js'
|
5
|
-
import { getProvider } from '
|
5
|
+
import { getProvider } from '@sentio/runtime'
|
6
6
|
import { addProcessor } from './binds.js'
|
7
7
|
|
8
8
|
export class GenericProcessor extends BaseProcessor<
|
package/src/eth/index.ts
CHANGED
@@ -2,7 +2,9 @@ export { BaseProcessor, GlobalProcessor, defaultPreprocessHandler } from './base
|
|
2
2
|
export { GenericProcessor } from './generic-processor.js'
|
3
3
|
export { BaseProcessorTemplate } from './base-processor-template.js'
|
4
4
|
export { AccountProcessor } from './account-processor.js'
|
5
|
-
|
5
|
+
|
6
|
+
export { getProvider, DummyProvider } from '@sentio/runtime'
|
7
|
+
|
6
8
|
export { EthContext } from './context.js'
|
7
9
|
export * from './eth.js'
|
8
10
|
export { BindOptions, AccountBindOptions } from './bind-options.js'
|
@@ -14,3 +16,5 @@ export { EthPlugin } from './eth-plugin.js'
|
|
14
16
|
export { EthFetchConfig, PreprocessResult } from '@sentio/protos'
|
15
17
|
|
16
18
|
export { EthChainId } from '@sentio/chain'
|
19
|
+
|
20
|
+
export { makeEthCallKey } from '@sentio/runtime'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { SolanaBaseProcessor, SolanaContext, SolanaBindOptions } from
|
1
|
+
import { SolanaBaseProcessor, SolanaContext, SolanaBindOptions } from "../index.js"
|
2
2
|
import { Instruction } from '@project-serum/anchor'
|
3
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
4
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { normalizeLabels, Labels, BaseContext, RecordMetaData } from '
|
1
|
+
import { normalizeLabels, Labels, BaseContext, RecordMetaData } from '../index.js'
|
2
2
|
import { SolanaChainId } from '@sentio/chain'
|
3
3
|
|
4
4
|
export class SolanaContext extends BaseContext {
|
@@ -35,7 +35,7 @@ export class SolanaContext extends BaseContext {
|
|
35
35
|
logIndex: 0,
|
36
36
|
chainId: this.getChainId(),
|
37
37
|
name: name,
|
38
|
-
labels: normalizeLabels(labels)
|
38
|
+
labels: normalizeLabels(labels)
|
39
39
|
}
|
40
40
|
}
|
41
41
|
}
|
@@ -0,0 +1,124 @@
|
|
1
|
+
import fs, { readFileSync, writeFileSync } from 'fs'
|
2
|
+
import chalk from 'chalk'
|
3
|
+
import path from 'path'
|
4
|
+
import mkdirp from 'mkdirp'
|
5
|
+
import { events } from 'starknet'
|
6
|
+
import { StarknetChainId } from '@sentio/chain'
|
7
|
+
import { Abi } from '@sentio/abi-wan-kanabi'
|
8
|
+
|
9
|
+
export async function codegen(abisDir: string, outDir: string) {
|
10
|
+
if (!fs.existsSync(abisDir)) {
|
11
|
+
return
|
12
|
+
}
|
13
|
+
|
14
|
+
const numFiles = await codegenInternal(abisDir, outDir)
|
15
|
+
console.log(chalk.green(`Generated ${numFiles} files for Starknet`))
|
16
|
+
}
|
17
|
+
|
18
|
+
async function codegenInternal(abisDir: string, outDir: string): Promise<number> {
|
19
|
+
const allFiles = fs.readdirSync(abisDir, { recursive: true }) as string[]
|
20
|
+
|
21
|
+
const abis: Record<string, any> = {}
|
22
|
+
let fileCount = 0
|
23
|
+
|
24
|
+
function guessNameFromAbi(abi: any, address: string) {
|
25
|
+
if (Array.isArray(abi)) {
|
26
|
+
const arr = abi as any[]
|
27
|
+
for (const a of arr) {
|
28
|
+
if (a.type == 'impl') {
|
29
|
+
return a.name.replace('Impl', '')
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
return 'Contract' + address.replace('0x', '').slice(0, 6)
|
34
|
+
}
|
35
|
+
|
36
|
+
for (const f of allFiles) {
|
37
|
+
if (f.toLowerCase().endsWith('.json')) {
|
38
|
+
let name = f.replace('.json', '')
|
39
|
+
const content = readFileSync(path.join(abisDir, f))
|
40
|
+
const abi = JSON.parse(content.toString())
|
41
|
+
let chain = StarknetChainId.STARKNET_MAINNET
|
42
|
+
if (name.startsWith('sepolia/')) {
|
43
|
+
chain = StarknetChainId.STARKNET_SEPOLIA
|
44
|
+
name = name.slice('sepolia/'.length)
|
45
|
+
}
|
46
|
+
const parts = name.split('-')
|
47
|
+
const address = parts.pop() as string
|
48
|
+
if (parts.length > 0) {
|
49
|
+
name = parts.join('')
|
50
|
+
} else {
|
51
|
+
name = guessNameFromAbi(abi, address)
|
52
|
+
}
|
53
|
+
abis[name] = {
|
54
|
+
name,
|
55
|
+
address,
|
56
|
+
chain,
|
57
|
+
abi
|
58
|
+
}
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
const tABIContents: string[] = []
|
63
|
+
|
64
|
+
for (const [name, abi] of Object.entries(abis)) {
|
65
|
+
tABIContents.push(`export const ABI_${name} = ${JSON.stringify(abi.abi, null, 2)} as const;`)
|
66
|
+
}
|
67
|
+
|
68
|
+
mkdirp.sync(outDir)
|
69
|
+
writeFileSync(path.join(outDir, 'tabi.ts'), tABIContents.join('\n'))
|
70
|
+
fileCount++
|
71
|
+
for (const { name, address, chain, abi: jsonAbi } of Object.values(abis)) {
|
72
|
+
const content: string[] = []
|
73
|
+
content.push(
|
74
|
+
`import { StarknetProcessorConfig, StarknetEvent, AbstractStarknetProcessor, StarknetContext } from '@sentio/sdk/starknet'`
|
75
|
+
)
|
76
|
+
content.push(`import { EventToPrimitiveType, TypedContractView, Abi } from "@sentio/abi-wan-kanabi"`)
|
77
|
+
content.push(`import { ABI_${name} } from "./tabi.js"\n`)
|
78
|
+
content.push(`export type ${name} = TypedContractView<typeof ABI_${name}>`)
|
79
|
+
const abi = jsonAbi as Abi
|
80
|
+
const abiEventsEnums = abi.filter((obj) => obj.type == 'event' && obj.kind === 'enum')
|
81
|
+
const eventMap: Record<string, string> = {}
|
82
|
+
for (const ev of Object.values(events.getAbiEvents(abi))) {
|
83
|
+
const fullName = ev.name as string
|
84
|
+
let eventName = fullName
|
85
|
+
for (const e of abiEventsEnums) {
|
86
|
+
for (const v of e.variants) {
|
87
|
+
if (v.type === fullName) {
|
88
|
+
eventName = v.name
|
89
|
+
break
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
94
|
+
eventMap[eventName] = fullName
|
95
|
+
content.push(`export type ${eventName} = EventToPrimitiveType<typeof ABI_${name}, "${fullName}">`)
|
96
|
+
}
|
97
|
+
|
98
|
+
content.push(`\nexport class ${name}Processor extends AbstractStarknetProcessor {
|
99
|
+
constructor(abi: Abi, config: Partial<StarknetProcessorConfig>) {
|
100
|
+
super(abi, {
|
101
|
+
name: "${name}",
|
102
|
+
address: "${address}",
|
103
|
+
chainId: "${chain}",
|
104
|
+
abi,
|
105
|
+
...config
|
106
|
+
})
|
107
|
+
}`)
|
108
|
+
content.push(`\tstatic bind(config: Partial<StarknetProcessorConfig>) {
|
109
|
+
return new ${name}Processor(ABI_${name}, config)
|
110
|
+
}`)
|
111
|
+
|
112
|
+
for (const [eventName, structName] of Object.entries(eventMap)) {
|
113
|
+
content.push(`\ton${eventName}(handler: (event: StarknetEvent<${eventName}>, ctx: StarknetContext<${name}>) => Promise<void>) {
|
114
|
+
return this.onEvent<${eventName}, ${name}>("${eventName}", "${structName}", handler)
|
115
|
+
}`)
|
116
|
+
}
|
117
|
+
|
118
|
+
content.push(`}`)
|
119
|
+
writeFileSync(path.join(outDir, `${name}-processor.ts`), content.join('\n'))
|
120
|
+
fileCount++
|
121
|
+
}
|
122
|
+
|
123
|
+
return fileCount
|
124
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './codegen.js'
|