@sentio/sdk 2.59.0-rc.8 → 2.59.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.
Files changed (263) hide show
  1. package/lib/aptos/api.d.ts +1 -0
  2. package/lib/aptos/api.d.ts.map +1 -1
  3. package/lib/aptos/api.js +13 -1
  4. package/lib/aptos/api.js.map +1 -1
  5. package/lib/aptos/aptos-plugin.d.ts +8 -4
  6. package/lib/aptos/aptos-plugin.d.ts.map +1 -1
  7. package/lib/aptos/aptos-plugin.js +40 -3
  8. package/lib/aptos/aptos-plugin.js.map +1 -1
  9. package/lib/aptos/aptos-processor.d.ts +20 -19
  10. package/lib/aptos/aptos-processor.d.ts.map +1 -1
  11. package/lib/aptos/aptos-processor.js +101 -50
  12. package/lib/aptos/aptos-processor.js.map +1 -1
  13. package/lib/aptos/aptos-resource-processor-template.d.ts +5 -4
  14. package/lib/aptos/aptos-resource-processor-template.d.ts.map +1 -1
  15. package/lib/aptos/aptos-resource-processor-template.js +8 -8
  16. package/lib/aptos/aptos-resource-processor-template.js.map +1 -1
  17. package/lib/aptos/builtin/0x1.d.ts +333 -332
  18. package/lib/aptos/builtin/0x1.d.ts.map +1 -1
  19. package/lib/aptos/builtin/0x1.js +664 -664
  20. package/lib/aptos/builtin/0x1.js.map +1 -1
  21. package/lib/aptos/builtin/0x3.d.ts +66 -65
  22. package/lib/aptos/builtin/0x3.d.ts.map +1 -1
  23. package/lib/aptos/builtin/0x3.js +130 -130
  24. package/lib/aptos/builtin/0x3.js.map +1 -1
  25. package/lib/aptos/builtin/0x4.d.ts +29 -28
  26. package/lib/aptos/builtin/0x4.d.ts.map +1 -1
  27. package/lib/aptos/builtin/0x4.js +56 -56
  28. package/lib/aptos/builtin/0x4.js.map +1 -1
  29. package/lib/aptos/codegen/codegen.js +27 -0
  30. package/lib/aptos/codegen/codegen.js.map +1 -1
  31. package/lib/aptos/data.d.ts +45 -0
  32. package/lib/aptos/data.d.ts.map +1 -0
  33. package/lib/aptos/data.js +99 -0
  34. package/lib/aptos/data.js.map +1 -0
  35. package/lib/aptos/index.d.ts +1 -0
  36. package/lib/aptos/index.d.ts.map +1 -1
  37. package/lib/aptos/index.js.map +1 -1
  38. package/lib/aptos/models.d.ts +1 -0
  39. package/lib/aptos/models.d.ts.map +1 -1
  40. package/lib/aptos/move-coder.d.ts +8 -2
  41. package/lib/aptos/move-coder.d.ts.map +1 -1
  42. package/lib/aptos/move-coder.js +84 -1
  43. package/lib/aptos/move-coder.js.map +1 -1
  44. package/lib/btc/btc-plugin.d.ts +4 -1
  45. package/lib/btc/btc-plugin.d.ts.map +1 -1
  46. package/lib/btc/btc-plugin.js +27 -0
  47. package/lib/btc/btc-plugin.js.map +1 -1
  48. package/lib/btc/btc-processor.d.ts +6 -5
  49. package/lib/btc/btc-processor.d.ts.map +1 -1
  50. package/lib/btc/btc-processor.js +35 -9
  51. package/lib/btc/btc-processor.js.map +1 -1
  52. package/lib/btc/types.d.ts +2 -1
  53. package/lib/btc/types.d.ts.map +1 -1
  54. package/lib/core/base-context.d.ts +4 -2
  55. package/lib/core/base-context.d.ts.map +1 -1
  56. package/lib/core/base-context.js +10 -5
  57. package/lib/core/base-context.js.map +1 -1
  58. package/lib/core/event-logger.d.ts +5 -0
  59. package/lib/core/event-logger.d.ts.map +1 -1
  60. package/lib/core/event-logger.js +36 -1
  61. package/lib/core/event-logger.js.map +1 -1
  62. package/lib/core/handler-options.d.ts +25 -0
  63. package/lib/core/handler-options.d.ts.map +1 -0
  64. package/lib/core/handler-options.js +21 -0
  65. package/lib/core/handler-options.js.map +1 -0
  66. package/lib/core/index.d.ts +3 -1
  67. package/lib/core/index.d.ts.map +1 -1
  68. package/lib/core/index.js +3 -1
  69. package/lib/core/index.js.map +1 -1
  70. package/lib/core/meter.d.ts +45 -2
  71. package/lib/core/meter.d.ts.map +1 -1
  72. package/lib/core/meter.js +124 -2
  73. package/lib/core/meter.js.map +1 -1
  74. package/lib/core/numberish.d.ts +2 -1
  75. package/lib/core/numberish.d.ts.map +1 -1
  76. package/lib/core/numberish.js +35 -1
  77. package/lib/core/numberish.js.map +1 -1
  78. package/lib/core/partition-handler-manager.d.ts +44 -0
  79. package/lib/core/partition-handler-manager.d.ts.map +1 -0
  80. package/lib/core/partition-handler-manager.js +76 -0
  81. package/lib/core/partition-handler-manager.js.map +1 -0
  82. package/lib/cosmos/cosmos-processor.d.ts +3 -2
  83. package/lib/cosmos/cosmos-processor.d.ts.map +1 -1
  84. package/lib/cosmos/cosmos-processor.js +11 -1
  85. package/lib/cosmos/cosmos-processor.js.map +1 -1
  86. package/lib/cosmos/types.d.ts +1 -0
  87. package/lib/cosmos/types.d.ts.map +1 -1
  88. package/lib/eth/base-processor.d.ts +21 -16
  89. package/lib/eth/base-processor.d.ts.map +1 -1
  90. package/lib/eth/base-processor.js +173 -34
  91. package/lib/eth/base-processor.js.map +1 -1
  92. package/lib/eth/bind-options.d.ts +6 -0
  93. package/lib/eth/bind-options.d.ts.map +1 -1
  94. package/lib/eth/bind-options.js +2 -0
  95. package/lib/eth/bind-options.js.map +1 -1
  96. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.d.ts +32 -31
  97. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.d.ts.map +1 -1
  98. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js +62 -62
  99. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js.map +1 -1
  100. package/lib/eth/builtin/internal/erc1155-processor.d.ts +17 -16
  101. package/lib/eth/builtin/internal/erc1155-processor.d.ts.map +1 -1
  102. package/lib/eth/builtin/internal/erc1155-processor.js +32 -32
  103. package/lib/eth/builtin/internal/erc1155-processor.js.map +1 -1
  104. package/lib/eth/builtin/internal/erc20-processor.d.ts +25 -24
  105. package/lib/eth/builtin/internal/erc20-processor.d.ts.map +1 -1
  106. package/lib/eth/builtin/internal/erc20-processor.js +48 -48
  107. package/lib/eth/builtin/internal/erc20-processor.js.map +1 -1
  108. package/lib/eth/builtin/internal/erc20bytes-processor.d.ts +14 -13
  109. package/lib/eth/builtin/internal/erc20bytes-processor.d.ts.map +1 -1
  110. package/lib/eth/builtin/internal/erc20bytes-processor.js +26 -26
  111. package/lib/eth/builtin/internal/erc20bytes-processor.js.map +1 -1
  112. package/lib/eth/builtin/internal/erc721-processor.d.ts +21 -20
  113. package/lib/eth/builtin/internal/erc721-processor.d.ts.map +1 -1
  114. package/lib/eth/builtin/internal/erc721-processor.js +40 -40
  115. package/lib/eth/builtin/internal/erc721-processor.js.map +1 -1
  116. package/lib/eth/builtin/internal/weth9-processor.d.ts +20 -19
  117. package/lib/eth/builtin/internal/weth9-processor.d.ts.map +1 -1
  118. package/lib/eth/builtin/internal/weth9-processor.js +38 -38
  119. package/lib/eth/builtin/internal/weth9-processor.js.map +1 -1
  120. package/lib/eth/codegen/event-handler.js +2 -2
  121. package/lib/eth/codegen/event-handler.js.map +1 -1
  122. package/lib/eth/codegen/file.d.ts.map +1 -1
  123. package/lib/eth/codegen/file.js +1 -0
  124. package/lib/eth/codegen/file.js.map +1 -1
  125. package/lib/eth/codegen/functions-handler.js +2 -2
  126. package/lib/eth/codegen/functions-handler.js.map +1 -1
  127. package/lib/eth/eth-plugin.d.ts +4 -1
  128. package/lib/eth/eth-plugin.d.ts.map +1 -1
  129. package/lib/eth/eth-plugin.js +53 -5
  130. package/lib/eth/eth-plugin.js.map +1 -1
  131. package/lib/eth/eth.d.ts +2 -7
  132. package/lib/eth/eth.d.ts.map +1 -1
  133. package/lib/eth/eth.js +8 -1
  134. package/lib/eth/eth.js.map +1 -1
  135. package/lib/fuel/codegen/codegen.js +5 -5
  136. package/lib/fuel/codegen/codegen.js.map +1 -1
  137. package/lib/fuel/fuel-plugin.d.ts +4 -1
  138. package/lib/fuel/fuel-plugin.d.ts.map +1 -1
  139. package/lib/fuel/fuel-plugin.js +41 -0
  140. package/lib/fuel/fuel-plugin.js.map +1 -1
  141. package/lib/fuel/fuel-processor-template.d.ts +7 -4
  142. package/lib/fuel/fuel-processor-template.d.ts.map +1 -1
  143. package/lib/fuel/fuel-processor-template.js +11 -9
  144. package/lib/fuel/fuel-processor-template.js.map +1 -1
  145. package/lib/fuel/fuel-processor.d.ts +7 -7
  146. package/lib/fuel/fuel-processor.d.ts.map +1 -1
  147. package/lib/fuel/fuel-processor.js +91 -28
  148. package/lib/fuel/fuel-processor.js.map +1 -1
  149. package/lib/fuel/types.d.ts +3 -0
  150. package/lib/fuel/types.d.ts.map +1 -1
  151. package/lib/move/filter.d.ts +5 -0
  152. package/lib/move/filter.d.ts.map +1 -1
  153. package/lib/move/filter.js +5 -0
  154. package/lib/move/filter.js.map +1 -1
  155. package/lib/move/shared-network-codegen.d.ts.map +1 -1
  156. package/lib/move/shared-network-codegen.js +5 -4
  157. package/lib/move/shared-network-codegen.js.map +1 -1
  158. package/lib/solana/solana-processor.d.ts +10 -4
  159. package/lib/solana/solana-processor.d.ts.map +1 -1
  160. package/lib/solana/solana-processor.js +13 -4
  161. package/lib/solana/solana-processor.js.map +1 -1
  162. package/lib/stark/starknet-processor.d.ts +3 -1
  163. package/lib/stark/starknet-processor.d.ts.map +1 -1
  164. package/lib/stark/starknet-processor.js +32 -14
  165. package/lib/stark/starknet-processor.js.map +1 -1
  166. package/lib/store/codegen.d.ts.map +1 -1
  167. package/lib/store/codegen.js +36 -2
  168. package/lib/store/codegen.js.map +1 -1
  169. package/lib/store/schema.d.ts.map +1 -1
  170. package/lib/store/schema.js +3 -1
  171. package/lib/store/schema.js.map +1 -1
  172. package/lib/store/store.d.ts +4 -3
  173. package/lib/store/store.d.ts.map +1 -1
  174. package/lib/store/store.js +41 -1
  175. package/lib/store/store.js.map +1 -1
  176. package/lib/store/types.d.ts +20 -1
  177. package/lib/store/types.d.ts.map +1 -1
  178. package/lib/store/types.js +22 -0
  179. package/lib/store/types.js.map +1 -1
  180. package/lib/sui/builtin/0x1.d.ts +7 -6
  181. package/lib/sui/builtin/0x1.d.ts.map +1 -1
  182. package/lib/sui/builtin/0x1.js +12 -12
  183. package/lib/sui/builtin/0x1.js.map +1 -1
  184. package/lib/sui/builtin/0x2.d.ts +61 -60
  185. package/lib/sui/builtin/0x2.d.ts.map +1 -1
  186. package/lib/sui/builtin/0x2.js +120 -120
  187. package/lib/sui/builtin/0x2.js.map +1 -1
  188. package/lib/sui/builtin/0x3.d.ts +49 -48
  189. package/lib/sui/builtin/0x3.d.ts.map +1 -1
  190. package/lib/sui/builtin/0x3.js +96 -96
  191. package/lib/sui/builtin/0x3.js.map +1 -1
  192. package/lib/sui/models.d.ts +1 -0
  193. package/lib/sui/models.d.ts.map +1 -1
  194. package/lib/sui/sui-plugin.d.ts +6 -3
  195. package/lib/sui/sui-plugin.d.ts.map +1 -1
  196. package/lib/sui/sui-plugin.js +59 -20
  197. package/lib/sui/sui-plugin.js.map +1 -1
  198. package/lib/sui/sui-processor.d.ts +5 -4
  199. package/lib/sui/sui-processor.d.ts.map +1 -1
  200. package/lib/sui/sui-processor.js +47 -11
  201. package/lib/sui/sui-processor.js.map +1 -1
  202. package/lib/utils/block.d.ts +2 -0
  203. package/lib/utils/block.d.ts.map +1 -1
  204. package/lib/utils/block.js +13 -0
  205. package/lib/utils/block.js.map +1 -1
  206. package/package.json +4 -4
  207. package/src/aptos/api.ts +13 -1
  208. package/src/aptos/aptos-plugin.ts +51 -8
  209. package/src/aptos/aptos-processor.ts +112 -74
  210. package/src/aptos/aptos-resource-processor-template.ts +9 -8
  211. package/src/aptos/builtin/0x1.ts +1565 -664
  212. package/src/aptos/builtin/0x3.ts +302 -130
  213. package/src/aptos/builtin/0x4.ts +123 -56
  214. package/src/aptos/codegen/codegen.ts +34 -1
  215. package/src/aptos/data.ts +123 -0
  216. package/src/aptos/index.ts +2 -0
  217. package/src/aptos/models.ts +2 -0
  218. package/src/aptos/move-coder.ts +96 -3
  219. package/src/btc/btc-plugin.ts +38 -0
  220. package/src/btc/btc-processor.ts +35 -10
  221. package/src/btc/types.ts +2 -1
  222. package/src/core/base-context.ts +10 -5
  223. package/src/core/event-logger.ts +45 -1
  224. package/src/core/handler-options.ts +40 -0
  225. package/src/core/index.ts +17 -1
  226. package/src/core/meter.ts +159 -4
  227. package/src/core/numberish.ts +34 -1
  228. package/src/core/partition-handler-manager.ts +94 -0
  229. package/src/cosmos/cosmos-processor.ts +12 -1
  230. package/src/cosmos/types.ts +1 -0
  231. package/src/eth/base-processor.ts +162 -37
  232. package/src/eth/bind-options.ts +7 -0
  233. package/src/eth/builtin/internal/eacaggregatorproxy-processor.ts +118 -62
  234. package/src/eth/builtin/internal/erc1155-processor.ts +76 -32
  235. package/src/eth/builtin/internal/erc20-processor.ts +79 -48
  236. package/src/eth/builtin/internal/erc20bytes-processor.ts +47 -26
  237. package/src/eth/builtin/internal/erc721-processor.ts +77 -40
  238. package/src/eth/builtin/internal/weth9-processor.ts +79 -38
  239. package/src/eth/codegen/event-handler.ts +2 -2
  240. package/src/eth/codegen/file.ts +1 -0
  241. package/src/eth/codegen/functions-handler.ts +2 -2
  242. package/src/eth/eth-plugin.ts +74 -5
  243. package/src/eth/eth.ts +12 -1
  244. package/src/fuel/codegen/codegen.ts +5 -5
  245. package/src/fuel/fuel-plugin.ts +56 -0
  246. package/src/fuel/fuel-processor-template.ts +17 -10
  247. package/src/fuel/fuel-processor.ts +90 -22
  248. package/src/fuel/types.ts +3 -0
  249. package/src/move/filter.ts +5 -0
  250. package/src/move/shared-network-codegen.ts +5 -4
  251. package/src/solana/solana-processor.ts +28 -6
  252. package/src/stark/starknet-processor.ts +31 -13
  253. package/src/store/codegen.ts +50 -2
  254. package/src/store/schema.ts +3 -1
  255. package/src/store/store.ts +57 -4
  256. package/src/store/types.ts +30 -1
  257. package/src/sui/builtin/0x1.ts +22 -12
  258. package/src/sui/builtin/0x2.ts +220 -120
  259. package/src/sui/builtin/0x3.ts +241 -96
  260. package/src/sui/models.ts +2 -0
  261. package/src/sui/sui-plugin.ts +68 -22
  262. package/src/sui/sui-processor.ts +48 -11
  263. package/src/utils/block.ts +15 -0
@@ -1,10 +1,9 @@
1
1
  import { errorString, GLOBAL_CONFIG, mergeProcessResults, Plugin, PluginManager, USER_PROCESSOR } from '@sentio/runtime'
2
+ import { PartitionHandlerManager } from '../core/index.js'
2
3
  import {
3
4
  AccountConfig,
4
5
  ContractConfig,
5
6
  Data_AptCall,
6
- Data_AptEvent,
7
- Data_AptResource,
8
7
  DataBinding,
9
8
  HandlerType,
10
9
  MoveCallHandlerConfig,
@@ -12,6 +11,7 @@ import {
12
11
  MoveOwnerType,
13
12
  ProcessConfigResponse,
14
13
  ProcessResult,
14
+ ProcessStreamResponse_Partitions,
15
15
  StartRequest
16
16
  } from '@sentio/protos'
17
17
 
@@ -27,13 +27,15 @@ import {
27
27
  AptosResourceProcessorTemplateState
28
28
  } from './aptos-resource-processor-template.js'
29
29
  import { AptosNetwork } from './network.js'
30
+ import { AptEvent, AptCall, AptResource } from './data.js'
30
31
 
31
32
  interface Handlers {
32
- aptosEventHandlers: ((event: Data_AptEvent) => Promise<ProcessResult>)[]
33
- aptosCallHandlers: ((func: Data_AptCall) => Promise<ProcessResult>)[]
34
- aptosResourceHandlers: ((resourceWithVersion: Data_AptResource) => Promise<ProcessResult>)[]
33
+ aptosEventHandlers: ((event: AptEvent) => Promise<ProcessResult>)[]
34
+ aptosCallHandlers: ((func: AptCall) => Promise<ProcessResult>)[]
35
+ aptosResourceHandlers: ((resourceWithVersion: AptResource) => Promise<ProcessResult>)[]
35
36
  aptosTransactionIntervalHandlers: ((txn: Data_AptCall) => Promise<ProcessResult>)[]
36
37
  }
38
+
37
39
  export class AptosPlugin extends Plugin {
38
40
  name: string = 'AptosPlugin'
39
41
  handlers: Handlers = {
@@ -43,6 +45,8 @@ export class AptosPlugin extends Plugin {
43
45
  aptosTransactionIntervalHandlers: []
44
46
  }
45
47
 
48
+ partitionManager = new PartitionHandlerManager()
49
+
46
50
  async start(request: StartRequest) {
47
51
  await initTokenList()
48
52
 
@@ -90,6 +94,7 @@ export class AptosPlugin extends Plugin {
90
94
  // 1. Prepare event handlers
91
95
  for (const handler of aptosProcessor.eventHandlers) {
92
96
  const handlerId = handlers.aptosEventHandlers.push(handler.handler) - 1
97
+ this.partitionManager.registerPartitionHandler(HandlerType.APT_EVENT, handlerId, handler.partitionHandler)
93
98
  const eventHandlerConfig: MoveEventHandlerConfig = {
94
99
  filters: handler.filters.map((f) => {
95
100
  return {
@@ -108,6 +113,7 @@ export class AptosPlugin extends Plugin {
108
113
  // 2. Prepare function handlers
109
114
  for (const handler of aptosProcessor.callHandlers) {
110
115
  const handlerId = handlers.aptosCallHandlers.push(handler.handler) - 1
116
+ this.partitionManager.registerPartitionHandler(HandlerType.APT_CALL, handlerId, handler.partitionHandler)
111
117
  const functionHandlerConfig: MoveCallHandlerConfig = {
112
118
  filters: handler.filters.map((filter) => {
113
119
  return {
@@ -139,6 +145,7 @@ export class AptosPlugin extends Plugin {
139
145
  })
140
146
  for (const handler of aptosProcessor.resourceChangeHandlers) {
141
147
  const handlerId = handlers.aptosResourceHandlers.push(handler.handler) - 1
148
+ this.partitionManager.registerPartitionHandler(HandlerType.APT_RESOURCE, handlerId, handler.partitionHandler)
142
149
  accountConfig.moveResourceChangeConfigs.push({
143
150
  handlerId: handlerId,
144
151
  handlerName: handler.handlerName,
@@ -150,6 +157,7 @@ export class AptosPlugin extends Plugin {
150
157
  // Prepare interval handlers
151
158
  for (const handler of aptosProcessor.transactionIntervalHandlers) {
152
159
  const handlerId = handlers.aptosTransactionIntervalHandlers.push(handler.handler) - 1
160
+ this.partitionManager.registerPartitionHandler(HandlerType.APT_CALL, handlerId, handler.partitionHandler)
153
161
  accountConfig.moveIntervalConfigs.push({
154
162
  intervalConfig: {
155
163
  handlerId: handlerId,
@@ -179,6 +187,7 @@ export class AptosPlugin extends Plugin {
179
187
  })
180
188
  for (const handler of aptosProcessor.resourceIntervalHandlers) {
181
189
  const handlerId = handlers.aptosResourceHandlers.push(handler.handler) - 1
190
+ this.partitionManager.registerPartitionHandler(HandlerType.APT_RESOURCE, handlerId, handler.partitionHandler)
182
191
  if (handler.timeIntervalInMinutes || handler.versionInterval) {
183
192
  accountConfig.moveIntervalConfigs.push({
184
193
  intervalConfig: {
@@ -225,12 +234,46 @@ export class AptosPlugin extends Plugin {
225
234
  }
226
235
  }
227
236
 
237
+ async partition(request: DataBinding): Promise<ProcessStreamResponse_Partitions> {
238
+ let data: any
239
+ switch (request.handlerType) {
240
+ case HandlerType.APT_EVENT:
241
+ if (!request.data?.aptEvent) {
242
+ throw new ServerError(Status.INVALID_ARGUMENT, "aptEvent can't be empty")
243
+ }
244
+ data = new AptEvent(request.data.aptEvent)
245
+ break
246
+ case HandlerType.APT_CALL:
247
+ if (!request.data?.aptCall) {
248
+ throw new ServerError(Status.INVALID_ARGUMENT, "aptCall can't be empty")
249
+ }
250
+ data = new AptCall(request.data.aptCall)
251
+ break
252
+ case HandlerType.APT_RESOURCE:
253
+ if (!request.data?.aptResource) {
254
+ throw new ServerError(Status.INVALID_ARGUMENT, "aptResource can't be empty")
255
+ }
256
+ data = new AptResource(request.data.aptResource)
257
+ break
258
+ default:
259
+ throw new ServerError(Status.INVALID_ARGUMENT, 'No handle type registered ' + request.handlerType)
260
+ }
261
+ const partitions = await this.partitionManager.processPartitionForHandlerType(
262
+ request.handlerType,
263
+ request.handlerIds,
264
+ data
265
+ )
266
+ return {
267
+ partitions
268
+ }
269
+ }
270
+
228
271
  async processAptosEvent(binding: DataBinding): Promise<ProcessResult> {
229
272
  if (!binding.data?.aptEvent) {
230
273
  throw new ServerError(Status.INVALID_ARGUMENT, "Event can't be empty")
231
274
  }
232
275
  const promises: Promise<ProcessResult>[] = []
233
- const event = binding.data.aptEvent
276
+ const event = new AptEvent(binding.data.aptEvent)
234
277
 
235
278
  for (const handlerId of binding.handlerIds) {
236
279
  const promise = this.handlers.aptosEventHandlers[handlerId](event).catch((e) => {
@@ -251,7 +294,7 @@ export class AptosPlugin extends Plugin {
251
294
  if (!binding.data?.aptResource) {
252
295
  throw new ServerError(Status.INVALID_ARGUMENT, "Resource can't be empty")
253
296
  }
254
- const resource = binding.data.aptResource
297
+ const resource = new AptResource(binding.data.aptResource)
255
298
 
256
299
  const promises: Promise<ProcessResult>[] = []
257
300
  for (const handlerId of binding.handlerIds) {
@@ -273,7 +316,7 @@ export class AptosPlugin extends Plugin {
273
316
  if (!binding.data?.aptCall) {
274
317
  throw new ServerError(Status.INVALID_ARGUMENT, "Call can't be empty")
275
318
  }
276
- const call = binding.data.aptCall
319
+ const call = new AptCall(binding.data.aptCall)
277
320
 
278
321
  const promises: Promise<ProcessResult>[] = []
279
322
  for (const handlerId of binding.handlerIds) {
@@ -1,25 +1,17 @@
1
1
  import { defaultMoveCoder, MoveCoder } from './index.js'
2
2
 
3
3
  import {
4
+ EntryFunctionPayloadResponse,
4
5
  Event,
5
6
  MoveResource,
6
7
  UserTransactionResponse,
7
- EntryFunctionPayloadResponse,
8
- MultisigPayloadResponse,
9
8
  WriteSetChangeWriteResource
10
9
  } from '@aptos-labs/ts-sdk'
11
10
 
12
11
  import { AptosBindOptions, AptosNetwork } from './network.js'
13
12
  import { AptosContext, AptosResourcesContext, AptosTransactionContext } from './context.js'
14
13
  import { ListStateStorage } from '@sentio/runtime'
15
- import {
16
- MoveFetchConfig,
17
- Data_AptResource,
18
- HandleInterval,
19
- Data_AptEvent,
20
- Data_AptCall,
21
- MoveAccountFetchConfig
22
- } from '@sentio/protos'
14
+ import { Data_AptResource, HandleInterval, MoveAccountFetchConfig, MoveFetchConfig } from '@sentio/protos'
23
15
  import { ServerError, Status } from 'nice-grpc'
24
16
  import {
25
17
  accountTypeString,
@@ -33,10 +25,11 @@ import {
33
25
  TransactionIntervalHandler
34
26
  } from '../move/index.js'
35
27
  import { ALL_ADDRESS, Labels, PromiseOrVoid } from '../core/index.js'
36
- import { TypeDescriptor, matchType, NestedDecodedStruct } from '@typemove/move'
37
- import { decodeResourceChange, ResourceChange } from '@typemove/aptos'
38
- import { GeneralTransactionResponse } from './models.js'
28
+ import { matchType, NestedDecodedStruct, TypeDescriptor } from '@typemove/move'
29
+ import { ResourceChange } from '@typemove/aptos'
30
+ import { GeneralTransactionResponse, HandlerOptions } from './models.js'
39
31
  import { getHandlerName, proxyProcessor } from '../utils/metrics.js'
32
+ import { AptCall, AptEvent, AptResource } from './data.js'
40
33
 
41
34
  const DEFAULT_FETCH_CONFIG: MoveFetchConfig = {
42
35
  resourceChanges: false,
@@ -66,9 +59,9 @@ export class AptosProcessorState extends ListStateStorage<AptosTransactionProces
66
59
  export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT extends AptosTransactionContext<T>> {
67
60
  readonly moduleName: string
68
61
  config: IndexConfigure
69
- eventHandlers: EventHandler<Data_AptEvent>[] = []
70
- callHandlers: CallHandler<Data_AptCall>[] = []
71
- resourceChangeHandlers: ResourceChangeHandler<Data_AptResource>[] = []
62
+ eventHandlers: EventHandler<AptEvent>[] = []
63
+ callHandlers: CallHandler<AptCall>[] = []
64
+ resourceChangeHandlers: ResourceChangeHandler<AptResource>[] = []
72
65
  transactionIntervalHandlers: TransactionIntervalHandler[] = []
73
66
  coder: MoveCoder
74
67
 
@@ -85,10 +78,10 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
85
78
  protected onMoveEvent(
86
79
  handler: (event: Event, ctx: AptosContext) => PromiseOrVoid,
87
80
  filter: EventFilter | EventFilter[],
88
- fetchConfig?: Partial<MoveFetchConfig>
81
+ handlerOptions?: HandlerOptions<MoveFetchConfig, Event>
89
82
  ): this {
90
83
  let _filters: EventFilter[] = []
91
- const _fetchConfig = MoveFetchConfig.fromPartial({ ...DEFAULT_FETCH_CONFIG, ...fetchConfig })
84
+ const _fetchConfig = MoveFetchConfig.fromPartial({ ...DEFAULT_FETCH_CONFIG, ...handlerOptions })
92
85
 
93
86
  if (Array.isArray(filter)) {
94
87
  _filters = filter
@@ -106,12 +99,7 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
106
99
  if (!data.rawTransaction) {
107
100
  throw new ServerError(Status.INVALID_ARGUMENT, 'event is null')
108
101
  }
109
- const txn = JSON.parse(data.rawTransaction) as UserTransactionResponse
110
- if (txn.events == null) {
111
- txn.events = []
112
- }
113
-
114
- const evt = JSON.parse(data.rawEvent)
102
+ const txn = data.transaction
115
103
 
116
104
  const ctx = new AptosContext(
117
105
  processor.moduleName,
@@ -123,13 +111,21 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
123
111
  processor.config.baseLabels
124
112
  )
125
113
 
126
- const decoded = await processor.coder.decodeEvent<any>(evt)
127
- await handler(decoded || evt, ctx)
128
-
114
+ const decoded = await data.decodeEvent(processor.coder)
115
+ await handler(decoded || data.event, ctx)
129
116
  return ctx.stopAndGetResult()
130
117
  },
131
118
  filters: _filters,
132
- fetchConfig: _fetchConfig
119
+ fetchConfig: _fetchConfig,
120
+ partitionHandler: async (data: AptEvent): Promise<string | undefined> => {
121
+ const p = handlerOptions?.partitionKey
122
+ if (!p) return undefined
123
+ if (typeof p === 'function') {
124
+ const decoded = await data.decodeEvent(processor.coder)
125
+ return p(decoded || data.event)
126
+ }
127
+ return p
128
+ }
133
129
  })
134
130
  return this
135
131
  }
@@ -137,10 +133,10 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
137
133
  protected onEntryFunctionCall(
138
134
  handler: (call: EntryFunctionPayloadResponse, ctx: AptosContext) => PromiseOrVoid,
139
135
  filter: FunctionNameAndCallFilter | FunctionNameAndCallFilter[],
140
- fetchConfig?: Partial<MoveFetchConfig>
136
+ handlerOptions?: HandlerOptions<MoveFetchConfig, EntryFunctionPayloadResponse>
141
137
  ): this {
142
138
  let _filters: FunctionNameAndCallFilter[] = []
143
- const _fetchConfig = MoveFetchConfig.fromPartial({ ...DEFAULT_FETCH_CONFIG, ...fetchConfig })
139
+ const _fetchConfig = MoveFetchConfig.fromPartial({ ...DEFAULT_FETCH_CONFIG, ...handlerOptions })
144
140
 
145
141
  if (Array.isArray(filter)) {
146
142
  _filters = filter
@@ -158,7 +154,7 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
158
154
  if (!data.rawTransaction) {
159
155
  throw new ServerError(Status.INVALID_ARGUMENT, 'call is null')
160
156
  }
161
- const tx = JSON.parse(data.rawTransaction) as UserTransactionResponse
157
+ const tx = data.transaction
162
158
 
163
159
  const ctx = new AptosContext(
164
160
  processor.moduleName,
@@ -170,18 +166,22 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
170
166
  processor.config.baseLabels
171
167
  )
172
168
  if (tx) {
173
- let payload = tx.payload
174
- if (payload.type === 'multisig_payload') {
175
- payload = (payload as MultisigPayloadResponse).transaction_payload ?? payload
176
- }
177
-
178
- const decoded = await processor.coder.decodeFunctionPayload(payload as EntryFunctionPayloadResponse)
169
+ const decoded = await data.decodeCall(processor.coder)
179
170
  await handler(decoded, ctx)
180
171
  }
181
172
  return ctx.stopAndGetResult()
182
173
  },
183
174
  filters: _filters,
184
- fetchConfig: _fetchConfig
175
+ fetchConfig: _fetchConfig,
176
+ partitionHandler: async (data: AptCall): Promise<string | undefined> => {
177
+ const p = handlerOptions?.partitionKey
178
+ if (!p) return undefined
179
+ if (typeof p === 'function') {
180
+ const decoded = await data.decodeCall(processor.coder)
181
+ return p(decoded)
182
+ }
183
+ return p
184
+ }
185
185
  })
186
186
  return this
187
187
  }
@@ -192,9 +192,9 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
192
192
  includeFailed?: boolean
193
193
  sender?: string
194
194
  },
195
- fetchConfig?: Partial<MoveFetchConfig>
195
+ handleOptions?: HandlerOptions<MoveFetchConfig, UserTransactionResponse>
196
196
  ): this {
197
- const _fetchConfig = MoveFetchConfig.fromPartial({ ...DEFAULT_FETCH_CONFIG, ...fetchConfig })
197
+ const _fetchConfig = MoveFetchConfig.fromPartial({ ...DEFAULT_FETCH_CONFIG, ...handleOptions })
198
198
 
199
199
  const processor = this
200
200
  const filter: FunctionNameAndCallFilter = { function: '', includeFailed: transactionFilter?.includeFailed }
@@ -211,10 +211,7 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
211
211
  if (!data.rawTransaction) {
212
212
  throw new ServerError(Status.INVALID_ARGUMENT, 'call is null')
213
213
  }
214
- const call = JSON.parse(data.rawTransaction) as UserTransactionResponse
215
- if (call.events == null) {
216
- call.events = []
217
- }
214
+ const call = data.transaction
218
215
  const ctx = new AptosContext(
219
216
  processor.moduleName,
220
217
  processor.config.network,
@@ -228,19 +225,31 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
228
225
  return ctx.stopAndGetResult()
229
226
  },
230
227
  filters: [filter],
231
- fetchConfig: _fetchConfig
228
+ fetchConfig: _fetchConfig,
229
+ partitionHandler: async (data: AptCall): Promise<string | undefined> => {
230
+ const p = handleOptions?.partitionKey
231
+ if (!p) return undefined
232
+ if (typeof p === 'function') {
233
+ return p(data.transaction)
234
+ }
235
+ return p
236
+ }
232
237
  })
233
238
  return this
234
239
  }
235
240
 
236
- public onEvent(handler: (event: Event, ctx: AptosContext) => void, fetchConfig?: Partial<MoveFetchConfig>): this {
237
- this.onMoveEvent(handler, { type: '' }, fetchConfig)
241
+ public onEvent(
242
+ handler: (event: Event, ctx: AptosContext) => void,
243
+ handlerOptions?: HandlerOptions<MoveFetchConfig, Event>
244
+ ): this {
245
+ this.onMoveEvent(handler, { type: '' }, handlerOptions)
238
246
  return this
239
247
  }
240
248
 
241
249
  public onResourceChange<T>(
242
250
  handler: (changes: ResourceChange<T>[], ctx: AptosResourcesContext) => PromiseOrVoid,
243
- typeDesc: TypeDescriptor<T> | string
251
+ typeDesc: TypeDescriptor<T> | string,
252
+ handlerOptions?: HandlerOptions<object, ResourceChange<T>[]>
244
253
  ): this {
245
254
  if (typeof typeDesc === 'string') {
246
255
  typeDesc = parseMoveType(typeDesc)
@@ -255,6 +264,7 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
255
264
  if (!data.rawResources || !data.version) {
256
265
  throw new ServerError(Status.INVALID_ARGUMENT, 'resource is null')
257
266
  }
267
+ const aptResource = new AptResource(data)
258
268
  const timestamp = Number(data.timestampMicros)
259
269
  const ctx = new AptosResourcesContext(
260
270
  processor.config.network,
@@ -263,10 +273,7 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
263
273
  timestamp,
264
274
  processor.config.baseLabels
265
275
  )
266
- let resources = await decodeResourceChange<T>(
267
- data.rawResources.map((r) => JSON.parse(r)),
268
- ctx.coder
269
- )
276
+ let resources = await aptResource.decodeResources<T>(processor.coder)
270
277
 
271
278
  if (hasAny) {
272
279
  resources = resources.filter((r) => {
@@ -280,7 +287,16 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
280
287
  }
281
288
  return ctx.stopAndGetResult()
282
289
  },
283
- type: hasAny ? typeDesc.qname : typeDesc.getNormalizedSignature()
290
+ type: hasAny ? typeDesc.qname : typeDesc.getNormalizedSignature(),
291
+ partitionHandler: async (data): Promise<string | undefined> => {
292
+ const p = handlerOptions?.partitionKey
293
+ if (!p) return undefined
294
+ if (typeof p === 'function') {
295
+ const resources = await data.decodeResources<T>(processor.coder)
296
+ return p(resources)
297
+ }
298
+ return p
299
+ }
284
300
  })
285
301
  return this
286
302
  }
@@ -289,7 +305,7 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
289
305
  handler: (transaction: T, ctx: CT) => PromiseOrVoid,
290
306
  timeInterval: HandleInterval | undefined,
291
307
  versionInterval: HandleInterval | undefined,
292
- fetchConfig: Partial<MoveFetchConfig> | undefined
308
+ handlerOptions?: HandlerOptions<MoveFetchConfig, T>
293
309
  ): this {
294
310
  const processor = this
295
311
  this.transactionIntervalHandlers.push({
@@ -318,7 +334,16 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
318
334
  },
319
335
  timeIntervalInMinutes: timeInterval,
320
336
  versionInterval: versionInterval,
321
- fetchConfig: { ...DEFAULT_FETCH_CONFIG, ...fetchConfig }
337
+ fetchConfig: { ...DEFAULT_FETCH_CONFIG, ...handlerOptions },
338
+ partitionHandler: async (data): Promise<string | undefined> => {
339
+ const p = handlerOptions?.partitionKey
340
+ if (!p) return undefined
341
+ if (typeof p === 'function') {
342
+ const transaction = JSON.parse(data.rawTransaction) as T
343
+ return p(transaction)
344
+ }
345
+ return p
346
+ }
322
347
  })
323
348
  return this
324
349
  }
@@ -327,7 +352,7 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
327
352
  handler: (transaction: T, ctx: CT) => PromiseOrVoid,
328
353
  timeIntervalInMinutes = 60,
329
354
  backfillTimeIntervalInMinutes = 240,
330
- fetchConfig?: Partial<MoveFetchConfig>
355
+ handlerOptions?: HandlerOptions<MoveFetchConfig, T>
331
356
  ): this {
332
357
  return this.onInterval(
333
358
  handler,
@@ -336,7 +361,7 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
336
361
  backfillInterval: backfillTimeIntervalInMinutes
337
362
  },
338
363
  undefined,
339
- fetchConfig
364
+ handlerOptions
340
365
  )
341
366
  }
342
367
 
@@ -344,13 +369,13 @@ export class AptosTransactionProcessor<T extends GeneralTransactionResponse, CT
344
369
  handler: (transaction: T, context: CT) => PromiseOrVoid,
345
370
  versionInterval = 100000,
346
371
  backfillVersionInterval = 400000,
347
- fetchConfig?: Partial<MoveFetchConfig>
372
+ handlerOptions?: HandlerOptions<MoveFetchConfig, T>
348
373
  ): this {
349
374
  return this.onInterval(
350
375
  handler,
351
376
  undefined,
352
377
  { recentInterval: versionInterval, backfillInterval: backfillVersionInterval },
353
- fetchConfig
378
+ handlerOptions
354
379
  )
355
380
  }
356
381
 
@@ -377,6 +402,7 @@ export class AptosModulesProcessor extends AptosTransactionProcessor<
377
402
 
378
403
  export class AptosGlobalProcessor {
379
404
  private baseProcessor
405
+
380
406
  private constructor(options: AptosBindOptions) {
381
407
  this.baseProcessor = new AptosTransactionProcessor('*', options)
382
408
  return proxyProcessor(this)
@@ -405,9 +431,9 @@ export class AptosGlobalProcessor {
405
431
  ) => PromiseOrVoid,
406
432
  timeIntervalInMinutes = 60,
407
433
  backfillTimeIntervalInMinutes = 240,
408
- fetchConfig?: Partial<MoveFetchConfig>
434
+ handlerOptions?: HandlerOptions<MoveFetchConfig, GeneralTransactionResponse>
409
435
  ): this {
410
- this.baseProcessor.onTimeInterval(handler, timeIntervalInMinutes, backfillTimeIntervalInMinutes, fetchConfig)
436
+ this.baseProcessor.onTimeInterval(handler, timeIntervalInMinutes, backfillTimeIntervalInMinutes, handlerOptions)
411
437
  return this
412
438
  }
413
439
 
@@ -418,9 +444,9 @@ export class AptosGlobalProcessor {
418
444
  ) => PromiseOrVoid,
419
445
  versionInterval = 100000,
420
446
  backfillVersionInterval = 400000,
421
- fetchConfig?: Partial<MoveFetchConfig>
447
+ handlerOptions?: HandlerOptions<MoveFetchConfig, GeneralTransactionResponse>
422
448
  ): this {
423
- this.baseProcessor.onVersionInterval(handler, versionInterval, backfillVersionInterval, fetchConfig)
449
+ this.baseProcessor.onVersionInterval(handler, versionInterval, backfillVersionInterval, handlerOptions)
424
450
  return this
425
451
  }
426
452
  }
@@ -454,7 +480,7 @@ export class AptosResourcesProcessor {
454
480
  timeInterval: HandleInterval | undefined,
455
481
  versionInterval: HandleInterval | undefined,
456
482
  type: string | undefined,
457
- fetchConfig: Partial<MoveAccountFetchConfig> | undefined,
483
+ handlerOptions?: HandlerOptions<MoveAccountFetchConfig, MoveResource[]>,
458
484
  handlerName = getHandlerName()
459
485
  ): this {
460
486
  const processor = this
@@ -464,6 +490,7 @@ export class AptosResourcesProcessor {
464
490
  if (data.timestampMicros > Number.MAX_SAFE_INTEGER) {
465
491
  throw new ServerError(Status.INVALID_ARGUMENT, 'timestamp is too large')
466
492
  }
493
+ const aptResource = new AptResource(data)
467
494
  const timestamp = Number(data.timestampMicros)
468
495
 
469
496
  const ctx = new AptosResourcesContext(
@@ -473,13 +500,22 @@ export class AptosResourcesProcessor {
473
500
  timestamp,
474
501
  processor.config.baseLabels
475
502
  )
476
- await handler(data.rawResources.map((r) => JSON.parse(r)) as MoveResource[], ctx)
503
+ await handler(aptResource.resources, ctx)
477
504
  return ctx.stopAndGetResult()
478
505
  },
479
506
  timeIntervalInMinutes: timeInterval,
480
507
  versionInterval: versionInterval,
481
508
  type: type,
482
- fetchConfig: { ...DEFAULT_RESOURCE_FETCH_CONFIG, ...fetchConfig }
509
+ fetchConfig: { ...DEFAULT_RESOURCE_FETCH_CONFIG, ...handlerOptions },
510
+ partitionHandler: async (data: Data_AptResource): Promise<string | undefined> => {
511
+ const p = handlerOptions?.partitionKey
512
+ if (!p) return undefined
513
+ if (typeof p === 'function') {
514
+ const aptResource = new AptResource(data)
515
+ return p(aptResource.resources)
516
+ }
517
+ return p
518
+ }
483
519
  })
484
520
  return this
485
521
  }
@@ -489,7 +525,7 @@ export class AptosResourcesProcessor {
489
525
  timeIntervalInMinutes = 60,
490
526
  backfillTimeIntervalInMinutes = 240,
491
527
  type?: string,
492
- fetchConfig?: Partial<MoveAccountFetchConfig>
528
+ handlerOptions?: HandlerOptions<MoveAccountFetchConfig, MoveResource[]>
493
529
  ): this {
494
530
  return this.onInterval(
495
531
  handler,
@@ -499,7 +535,7 @@ export class AptosResourcesProcessor {
499
535
  },
500
536
  undefined,
501
537
  type,
502
- fetchConfig
538
+ handlerOptions
503
539
  )
504
540
  }
505
541
 
@@ -508,14 +544,14 @@ export class AptosResourcesProcessor {
508
544
  versionInterval = 100000,
509
545
  backfillVersionInterval = 400000,
510
546
  typePrefix?: string,
511
- fetchConfig?: Partial<MoveAccountFetchConfig>
547
+ handlerOptions?: HandlerOptions<MoveAccountFetchConfig, MoveResource[]>
512
548
  ): this {
513
549
  return this.onInterval(
514
550
  handler,
515
551
  undefined,
516
552
  { recentInterval: versionInterval, backfillInterval: backfillVersionInterval },
517
553
  typePrefix,
518
- fetchConfig
554
+ handlerOptions
519
555
  )
520
556
  }
521
557
 
@@ -539,6 +575,7 @@ export class AptosResourcesProcessor {
539
575
  if (!data.rawResources || !data.version) {
540
576
  throw new ServerError(Status.INVALID_ARGUMENT, 'resource is null')
541
577
  }
578
+ const aptResource = new AptResource(data)
542
579
  const ctx = new AptosResourcesContext(
543
580
  processor.config.network,
544
581
  processor.config.address,
@@ -547,10 +584,11 @@ export class AptosResourcesProcessor {
547
584
  processor.config.baseLabels
548
585
  )
549
586
 
550
- let resources = (await decodeResourceChange(
551
- data.rawResources.map((r) => JSON.parse(r)),
552
- ctx.coder
553
- )) as NestedDecodedStruct<MoveResource, WriteSetChangeWriteResource, T>[]
587
+ let resources = (await aptResource.decodeResources<T>(ctx.coder)) as NestedDecodedStruct<
588
+ MoveResource,
589
+ WriteSetChangeWriteResource,
590
+ T
591
+ >[]
554
592
 
555
593
  if (hasAny) {
556
594
  resources = resources.filter((r) => {
@@ -7,6 +7,7 @@ import { HandleInterval, MoveAccountFetchConfig } from '@sentio/protos'
7
7
  import { MoveResource } from '@aptos-labs/ts-sdk'
8
8
  import { PromiseOrVoid } from '../core/index.js'
9
9
  import { getHandlerName, proxyProcessor } from '../utils/metrics.js'
10
+ import { HandlerOptions } from './models.js'
10
11
 
11
12
  export class AptosResourceProcessorTemplateState extends ListStateStorage<AptosResourceProcessorTemplate> {
12
13
  static INSTANCE = new AptosResourceProcessorTemplateState()
@@ -18,7 +19,7 @@ class Handler {
18
19
  timeIntervalInMinutes?: HandleInterval
19
20
  handlerName: string
20
21
  handler: (resources: MoveResource[], ctx: AptosResourcesContext) => PromiseOrVoid
21
- fetchConfig: MoveAccountFetchConfig
22
+ handlerOptions: HandlerOptions<MoveAccountFetchConfig, MoveResource[]>
22
23
  }
23
24
 
24
25
  export class AptosResourceProcessorTemplate {
@@ -55,7 +56,7 @@ export class AptosResourceProcessorTemplate {
55
56
  h.timeIntervalInMinutes,
56
57
  h.checkpointInterval,
57
58
  h.type,
58
- h.fetchConfig,
59
+ h.handlerOptions,
59
60
  h.handlerName
60
61
  )
61
62
  }
@@ -90,7 +91,7 @@ export class AptosResourceProcessorTemplate {
90
91
  timeInterval: HandleInterval | undefined,
91
92
  checkpointInterval: HandleInterval | undefined,
92
93
  type: string | undefined,
93
- fetchConfig: Partial<MoveAccountFetchConfig> | undefined
94
+ handlerOptions?: HandlerOptions<MoveAccountFetchConfig, MoveResource[]>
94
95
  ): this {
95
96
  this.handlers.push({
96
97
  handlerName: getHandlerName(),
@@ -98,7 +99,7 @@ export class AptosResourceProcessorTemplate {
98
99
  timeIntervalInMinutes: timeInterval,
99
100
  checkpointInterval: checkpointInterval,
100
101
  type,
101
- fetchConfig: { ...DEFAULT_RESOURCE_FETCH_CONFIG, ...fetchConfig }
102
+ handlerOptions: { ...DEFAULT_RESOURCE_FETCH_CONFIG, ...handlerOptions }
102
103
  })
103
104
  return this
104
105
  }
@@ -108,7 +109,7 @@ export class AptosResourceProcessorTemplate {
108
109
  timeIntervalInMinutes = 60,
109
110
  backfillTimeIntervalInMinutes = 240,
110
111
  type?: string,
111
- fetchConfig?: Partial<MoveAccountFetchConfig>
112
+ handlerOptions?: HandlerOptions<MoveAccountFetchConfig, MoveResource[]>
112
113
  ): this {
113
114
  return this.onInterval(
114
115
  handler,
@@ -118,7 +119,7 @@ export class AptosResourceProcessorTemplate {
118
119
  },
119
120
  undefined,
120
121
  type,
121
- fetchConfig
122
+ handlerOptions
122
123
  )
123
124
  }
124
125
 
@@ -127,14 +128,14 @@ export class AptosResourceProcessorTemplate {
127
128
  checkpointInterval = 100000,
128
129
  backfillCheckpointInterval = 400000,
129
130
  type?: string,
130
- fetchConfig?: Partial<MoveAccountFetchConfig>
131
+ handlerOptions?: HandlerOptions<MoveAccountFetchConfig, MoveResource[]>
131
132
  ): this {
132
133
  return this.onInterval(
133
134
  handler,
134
135
  undefined,
135
136
  { recentInterval: checkpointInterval, backfillInterval: backfillCheckpointInterval },
136
137
  type,
137
- fetchConfig
138
+ handlerOptions
138
139
  )
139
140
  }
140
141
  }