@sentio/sdk 2.16.1 → 2.16.2-rc.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.
Files changed (48) hide show
  1. package/lib/aptos/aptos-processor.d.ts +3 -2
  2. package/lib/aptos/aptos-processor.js +22 -23
  3. package/lib/aptos/aptos-processor.js.map +1 -1
  4. package/lib/eth/base-processor-template.d.ts +1 -1
  5. package/lib/eth/base-processor-template.js +5 -3
  6. package/lib/eth/base-processor-template.js.map +1 -1
  7. package/lib/eth/base-processor.d.ts +4 -4
  8. package/lib/eth/base-processor.js +17 -17
  9. package/lib/eth/base-processor.js.map +1 -1
  10. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js +31 -31
  11. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js.map +1 -1
  12. package/lib/eth/builtin/internal/erc1155-processor.js +16 -16
  13. package/lib/eth/builtin/internal/erc1155-processor.js.map +1 -1
  14. package/lib/eth/builtin/internal/erc20-processor.js +24 -24
  15. package/lib/eth/builtin/internal/erc20-processor.js.map +1 -1
  16. package/lib/eth/builtin/internal/erc20bytes-processor.js +13 -13
  17. package/lib/eth/builtin/internal/erc20bytes-processor.js.map +1 -1
  18. package/lib/eth/builtin/internal/erc721-processor.js +20 -20
  19. package/lib/eth/builtin/internal/erc721-processor.js.map +1 -1
  20. package/lib/eth/builtin/internal/weth9-processor.js +19 -19
  21. package/lib/eth/builtin/internal/weth9-processor.js.map +1 -1
  22. package/lib/eth/codegen/ethers-sentio.js +11 -11
  23. package/lib/eth/codegen/ethers-sentio.js.map +1 -1
  24. package/lib/eth/codegen/event-handler.js +1 -1
  25. package/lib/eth/codegen/event-handler.js.map +1 -1
  26. package/lib/eth/codegen/functions-handler.js +1 -1
  27. package/lib/eth/codegen/functions-handler.js.map +1 -1
  28. package/lib/eth/generic-processor.test.js.map +1 -1
  29. package/lib/sui/sui-plugin.js +1 -1
  30. package/lib/sui/sui-plugin.js.map +1 -1
  31. package/lib/sui/sui-processor.d.ts +5 -3
  32. package/lib/sui/sui-processor.js +24 -2
  33. package/lib/sui/sui-processor.js.map +1 -1
  34. package/package.json +3 -3
  35. package/src/aptos/aptos-processor.ts +38 -51
  36. package/src/eth/base-processor-template.ts +5 -3
  37. package/src/eth/base-processor.ts +25 -25
  38. package/src/eth/builtin/internal/eacaggregatorproxy-processor.ts +31 -31
  39. package/src/eth/builtin/internal/erc1155-processor.ts +16 -16
  40. package/src/eth/builtin/internal/erc20-processor.ts +24 -24
  41. package/src/eth/builtin/internal/erc20bytes-processor.ts +13 -13
  42. package/src/eth/builtin/internal/erc721-processor.ts +20 -20
  43. package/src/eth/builtin/internal/weth9-processor.ts +19 -19
  44. package/src/eth/codegen/ethers-sentio.ts +11 -11
  45. package/src/eth/codegen/event-handler.ts +1 -1
  46. package/src/eth/codegen/functions-handler.ts +1 -1
  47. package/src/sui/sui-plugin.ts +1 -1
  48. package/src/sui/sui-processor.ts +44 -4
@@ -47,7 +47,7 @@ function generateCallHandler(fn: FunctionDeclaration, contractName: string, over
47
47
  handler: (call: ${upperFirst(overloadedName ?? fn.name)}CallTrace, ctx: ${contractName}Context) => void,
48
48
  fetchConfig?: Partial<EthFetchConfig>
49
49
  ): this {
50
- return super.onTrace("${sighash}", handler as any, fetchConfig);
50
+ return super.onEthTrace("${sighash}", handler as any, fetchConfig);
51
51
  }
52
52
  `
53
53
  }
@@ -134,7 +134,7 @@ export class SuiPlugin extends Plugin {
134
134
  },
135
135
  type: handler.type || '',
136
136
  ownerType: processor.ownerType,
137
- fetchConfig: undefined,
137
+ fetchConfig: handler.fetchConfig,
138
138
  })
139
139
  }
140
140
  config.accountConfigs.push(accountConfig)
@@ -69,7 +69,7 @@ export class SuiBaseProcessor {
69
69
  return this.config.network
70
70
  }
71
71
 
72
- public onMoveEvent(
72
+ protected onMoveEvent(
73
73
  handler: (event: SuiEvent, ctx: SuiContext) => void,
74
74
  filter: EventFilter | EventFilter[],
75
75
  fetchConfig?: Partial<MoveFetchConfig>
@@ -130,7 +130,7 @@ export class SuiBaseProcessor {
130
130
  return this
131
131
  }
132
132
 
133
- public onEntryFunctionCall(
133
+ protected onEntryFunctionCall(
134
134
  handler: (call: MoveCallSuiTransaction, ctx: SuiContext) => void,
135
135
  filter: FunctionNameAndCallFilter | FunctionNameAndCallFilter[],
136
136
  fetchConfig?: Partial<MoveFetchConfig>
@@ -144,8 +144,6 @@ export class SuiBaseProcessor {
144
144
  _filters.push(filter)
145
145
  }
146
146
 
147
- // const address = this.config.address
148
- // const moduleName = this.moduleName
149
147
  const processor = this
150
148
  const allFunctionType = new Set(_filters.map((f) => processor.config.address + '::' + f.function))
151
149
 
@@ -193,4 +191,46 @@ export class SuiBaseProcessor {
193
191
  })
194
192
  return this
195
193
  }
194
+
195
+ onEvent(handler: (event: SuiEvent, ctx: SuiContext) => void, fetchConfig?: Partial<MoveFetchConfig>): this {
196
+ this.onMoveEvent(handler, { type: '' }, fetchConfig)
197
+ return this
198
+ }
199
+
200
+ onTransactionBlock(
201
+ handler: (call: SuiTransactionBlockResponse, ctx: SuiContext) => void,
202
+ includeFailed = false,
203
+ fetchConfig?: Partial<MoveFetchConfig>
204
+ ): this {
205
+ const _fetchConfig = MoveFetchConfig.fromPartial({ ...DEFAULT_FETCH_CONFIG, ...fetchConfig })
206
+
207
+ const processor = this
208
+
209
+ this.callHandlers.push({
210
+ handler: async function (data) {
211
+ if (!data.transaction) {
212
+ throw new ServerError(Status.INVALID_ARGUMENT, 'call is null')
213
+ }
214
+ const tx = data.transaction as SuiTransactionBlockResponse
215
+
216
+ const ctx = new SuiContext(
217
+ processor.moduleName,
218
+ processor.config.network,
219
+ processor.config.address,
220
+ data.timestamp || new Date(0),
221
+ data.slot,
222
+ tx,
223
+ 0,
224
+ processor.config.baseLabels
225
+ )
226
+ if (tx) {
227
+ await handler(tx, ctx)
228
+ }
229
+ return ctx.getProcessResult()
230
+ },
231
+ filters: [{ function: '', includeFailed }],
232
+ fetchConfig: _fetchConfig,
233
+ })
234
+ return this
235
+ }
196
236
  }