@sentio/sdk 4.0.0-rc.1 → 4.0.0-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 (331) hide show
  1. package/lib/aptos/aptos-plugin.d.ts +1 -1
  2. package/lib/aptos/aptos-plugin.d.ts.map +1 -1
  3. package/lib/aptos/aptos-plugin.js +43 -42
  4. package/lib/aptos/aptos-plugin.js.map +1 -1
  5. package/lib/aptos/aptos-processor.d.ts +1 -1
  6. package/lib/aptos/aptos-processor.d.ts.map +1 -1
  7. package/lib/aptos/aptos-processor.js +25 -25
  8. package/lib/aptos/aptos-processor.js.map +1 -1
  9. package/lib/aptos/aptos-resource-processor-template.d.ts +1 -1
  10. package/lib/aptos/aptos-resource-processor-template.d.ts.map +1 -1
  11. package/lib/aptos/aptos-resource-processor-template.js +10 -5
  12. package/lib/aptos/aptos-resource-processor-template.js.map +1 -1
  13. package/lib/aptos/context.d.ts +1 -1
  14. package/lib/aptos/context.d.ts.map +1 -1
  15. package/lib/aptos/context.js +8 -6
  16. package/lib/aptos/context.js.map +1 -1
  17. package/lib/aptos/data.d.ts +4 -4
  18. package/lib/aptos/data.d.ts.map +1 -1
  19. package/lib/core/base-context.d.ts +3 -2
  20. package/lib/core/base-context.d.ts.map +1 -1
  21. package/lib/core/base-context.js +12 -11
  22. package/lib/core/base-context.js.map +1 -1
  23. package/lib/core/core-plugin.d.ts.map +1 -1
  24. package/lib/core/core-plugin.js +6 -4
  25. package/lib/core/core-plugin.js.map +1 -1
  26. package/lib/core/event-logger.d.ts +10 -2
  27. package/lib/core/event-logger.d.ts.map +1 -1
  28. package/lib/core/event-logger.js +42 -26
  29. package/lib/core/event-logger.js.map +1 -1
  30. package/lib/core/exporter.d.ts.map +1 -1
  31. package/lib/core/exporter.js +5 -3
  32. package/lib/core/exporter.js.map +1 -1
  33. package/lib/core/handler-options.d.ts +1 -1
  34. package/lib/core/handler-options.d.ts.map +1 -1
  35. package/lib/core/handler-register.d.ts +1 -1
  36. package/lib/core/handler-register.d.ts.map +1 -1
  37. package/lib/core/handler-register.js +2 -2
  38. package/lib/core/handler-register.js.map +1 -1
  39. package/lib/core/meter.d.ts +4 -3
  40. package/lib/core/meter.d.ts.map +1 -1
  41. package/lib/core/meter.js +5 -4
  42. package/lib/core/meter.js.map +1 -1
  43. package/lib/core/normalization.d.ts +1 -1
  44. package/lib/core/normalization.d.ts.map +1 -1
  45. package/lib/core/normalization.js +41 -31
  46. package/lib/core/normalization.js.map +1 -1
  47. package/lib/core/numberish.d.ts +1 -1
  48. package/lib/core/numberish.d.ts.map +1 -1
  49. package/lib/core/numberish.js +35 -30
  50. package/lib/core/numberish.js.map +1 -1
  51. package/lib/core/partition-handler-manager.d.ts +1 -1
  52. package/lib/core/partition-handler-manager.d.ts.map +1 -1
  53. package/lib/core/partition-handler-manager.js +10 -9
  54. package/lib/core/partition-handler-manager.js.map +1 -1
  55. package/lib/cosmos/context.d.ts.map +1 -1
  56. package/lib/cosmos/context.js +4 -2
  57. package/lib/cosmos/context.js.map +1 -1
  58. package/lib/cosmos/cosmos-plugin.d.ts.map +1 -1
  59. package/lib/cosmos/cosmos-plugin.js +11 -10
  60. package/lib/cosmos/cosmos-plugin.js.map +1 -1
  61. package/lib/cosmos/cosmos-processor.js.map +1 -1
  62. package/lib/eth/abi-decoder/decode-worker.js +2 -2
  63. package/lib/eth/abi-decoder/decode-worker.js.map +1 -1
  64. package/lib/eth/account-processor.d.ts +2 -2
  65. package/lib/eth/account-processor.d.ts.map +1 -1
  66. package/lib/eth/account-processor.js +10 -9
  67. package/lib/eth/account-processor.js.map +1 -1
  68. package/lib/eth/base-processor-template.d.ts +3 -3
  69. package/lib/eth/base-processor-template.d.ts.map +1 -1
  70. package/lib/eth/base-processor-template.js +12 -8
  71. package/lib/eth/base-processor-template.js.map +1 -1
  72. package/lib/eth/base-processor.d.ts +1 -1
  73. package/lib/eth/base-processor.d.ts.map +1 -1
  74. package/lib/eth/base-processor.js +53 -46
  75. package/lib/eth/base-processor.js.map +1 -1
  76. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.d.ts.map +1 -1
  77. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js +48 -46
  78. package/lib/eth/builtin/internal/eacaggregatorproxy-processor.js.map +1 -1
  79. package/lib/eth/builtin/internal/erc1155-processor.d.ts.map +1 -1
  80. package/lib/eth/builtin/internal/erc1155-processor.js +18 -16
  81. package/lib/eth/builtin/internal/erc1155-processor.js.map +1 -1
  82. package/lib/eth/builtin/internal/erc20-processor.d.ts.map +1 -1
  83. package/lib/eth/builtin/internal/erc20-processor.js +38 -36
  84. package/lib/eth/builtin/internal/erc20-processor.js.map +1 -1
  85. package/lib/eth/builtin/internal/erc20bytes-processor.d.ts.map +1 -1
  86. package/lib/eth/builtin/internal/erc20bytes-processor.js +20 -18
  87. package/lib/eth/builtin/internal/erc20bytes-processor.js.map +1 -1
  88. package/lib/eth/builtin/internal/erc721-processor.d.ts.map +1 -1
  89. package/lib/eth/builtin/internal/erc721-processor.js +30 -28
  90. package/lib/eth/builtin/internal/erc721-processor.js.map +1 -1
  91. package/lib/eth/builtin/internal/weth9-processor.d.ts.map +1 -1
  92. package/lib/eth/builtin/internal/weth9-processor.js +24 -22
  93. package/lib/eth/builtin/internal/weth9-processor.js.map +1 -1
  94. package/lib/eth/codegen/file.d.ts.map +1 -1
  95. package/lib/eth/codegen/file.js +2 -1
  96. package/lib/eth/codegen/file.js.map +1 -1
  97. package/lib/eth/codegen/function-calls.js +1 -1
  98. package/lib/eth/context.d.ts +1 -1
  99. package/lib/eth/context.d.ts.map +1 -1
  100. package/lib/eth/context.js +12 -10
  101. package/lib/eth/context.js.map +1 -1
  102. package/lib/eth/eth-plugin.d.ts.map +1 -1
  103. package/lib/eth/eth-plugin.js +83 -75
  104. package/lib/eth/eth-plugin.js.map +1 -1
  105. package/lib/eth/eth.d.ts +6 -6
  106. package/lib/eth/eth.d.ts.map +1 -1
  107. package/lib/eth/eth.js +22 -14
  108. package/lib/eth/eth.js.map +1 -1
  109. package/lib/eth/index.d.ts +1 -1
  110. package/lib/eth/index.d.ts.map +1 -1
  111. package/lib/eth/index.js +0 -1
  112. package/lib/eth/index.js.map +1 -1
  113. package/lib/fuel/asset-processor.d.ts +2 -2
  114. package/lib/fuel/asset-processor.d.ts.map +1 -1
  115. package/lib/fuel/asset-processor.js +5 -3
  116. package/lib/fuel/asset-processor.js.map +1 -1
  117. package/lib/fuel/context.d.ts.map +1 -1
  118. package/lib/fuel/context.js +4 -2
  119. package/lib/fuel/context.js.map +1 -1
  120. package/lib/fuel/fuel-plugin.d.ts.map +1 -1
  121. package/lib/fuel/fuel-plugin.js +41 -53
  122. package/lib/fuel/fuel-plugin.js.map +1 -1
  123. package/lib/fuel/fuel-processor-template.d.ts.map +1 -1
  124. package/lib/fuel/fuel-processor-template.js +7 -5
  125. package/lib/fuel/fuel-processor-template.js.map +1 -1
  126. package/lib/fuel/fuel-processor.d.ts.map +1 -1
  127. package/lib/fuel/fuel-processor.js +30 -20
  128. package/lib/fuel/fuel-processor.js.map +1 -1
  129. package/lib/fuel/global-processor.d.ts.map +1 -1
  130. package/lib/fuel/global-processor.js +2 -1
  131. package/lib/fuel/global-processor.js.map +1 -1
  132. package/lib/fuel/types.d.ts +10 -4
  133. package/lib/fuel/types.d.ts.map +1 -1
  134. package/lib/fuel/types.js.map +1 -1
  135. package/lib/iota/context.d.ts +1 -1
  136. package/lib/iota/context.d.ts.map +1 -1
  137. package/lib/iota/context.js +8 -6
  138. package/lib/iota/context.js.map +1 -1
  139. package/lib/iota/iota-object-processor-template.d.ts +1 -1
  140. package/lib/iota/iota-object-processor-template.d.ts.map +1 -1
  141. package/lib/iota/iota-object-processor-template.js +17 -12
  142. package/lib/iota/iota-object-processor-template.js.map +1 -1
  143. package/lib/iota/iota-object-processor.d.ts +1 -1
  144. package/lib/iota/iota-object-processor.d.ts.map +1 -1
  145. package/lib/iota/iota-object-processor.js +23 -16
  146. package/lib/iota/iota-object-processor.js.map +1 -1
  147. package/lib/iota/iota-plugin-part.d.ts +1 -1
  148. package/lib/iota/iota-plugin-part.d.ts.map +1 -1
  149. package/lib/iota/iota-plugin-part.js +16 -15
  150. package/lib/iota/iota-plugin-part.js.map +1 -1
  151. package/lib/iota/iota-processor.d.ts +1 -1
  152. package/lib/iota/iota-processor.d.ts.map +1 -1
  153. package/lib/iota/iota-processor.js +18 -17
  154. package/lib/iota/iota-processor.js.map +1 -1
  155. package/lib/iota/network.js +2 -2
  156. package/lib/iota/network.js.map +1 -1
  157. package/lib/move/filter.d.ts +1 -1
  158. package/lib/move/filter.d.ts.map +1 -1
  159. package/lib/move/index.d.ts +1 -1
  160. package/lib/move/index.d.ts.map +1 -1
  161. package/lib/move/index.js +0 -1
  162. package/lib/move/index.js.map +1 -1
  163. package/lib/solana/builtin/types.d.ts +4 -4
  164. package/lib/solana/solana-context.d.ts.map +1 -1
  165. package/lib/solana/solana-context.js +4 -3
  166. package/lib/solana/solana-context.js.map +1 -1
  167. package/lib/solana/solana-plugin.d.ts.map +1 -1
  168. package/lib/solana/solana-plugin.js +19 -18
  169. package/lib/solana/solana-plugin.js.map +1 -1
  170. package/lib/solana/solana-processor.d.ts.map +1 -1
  171. package/lib/solana/solana-processor.js +8 -3
  172. package/lib/solana/solana-processor.js.map +1 -1
  173. package/lib/store/cache.d.ts.map +1 -1
  174. package/lib/store/cache.js +22 -17
  175. package/lib/store/cache.js.map +1 -1
  176. package/lib/store/convert.d.ts +1 -1
  177. package/lib/store/convert.d.ts.map +1 -1
  178. package/lib/store/convert.js +67 -104
  179. package/lib/store/convert.js.map +1 -1
  180. package/lib/store/decorators.d.ts +1 -1
  181. package/lib/store/decorators.d.ts.map +1 -1
  182. package/lib/store/decorators.js +3 -1
  183. package/lib/store/decorators.js.map +1 -1
  184. package/lib/store/store.d.ts.map +1 -1
  185. package/lib/store/store.js +24 -16
  186. package/lib/store/store.js.map +1 -1
  187. package/lib/store/types.js +24 -32
  188. package/lib/store/types.js.map +1 -1
  189. package/lib/store/util.d.ts +1 -1
  190. package/lib/store/util.d.ts.map +1 -1
  191. package/lib/store/util.js +13 -17
  192. package/lib/store/util.js.map +1 -1
  193. package/lib/sui/context.d.ts +1 -1
  194. package/lib/sui/context.d.ts.map +1 -1
  195. package/lib/sui/context.js +8 -6
  196. package/lib/sui/context.js.map +1 -1
  197. package/lib/sui/sui-object-processor-template.d.ts +1 -1
  198. package/lib/sui/sui-object-processor-template.d.ts.map +1 -1
  199. package/lib/sui/sui-object-processor-template.js +17 -12
  200. package/lib/sui/sui-object-processor-template.js.map +1 -1
  201. package/lib/sui/sui-object-processor.d.ts +1 -1
  202. package/lib/sui/sui-object-processor.d.ts.map +1 -1
  203. package/lib/sui/sui-object-processor.js +23 -16
  204. package/lib/sui/sui-object-processor.js.map +1 -1
  205. package/lib/sui/sui-plugin-part.d.ts +1 -1
  206. package/lib/sui/sui-plugin-part.d.ts.map +1 -1
  207. package/lib/sui/sui-plugin-part.js +16 -15
  208. package/lib/sui/sui-plugin-part.js.map +1 -1
  209. package/lib/sui/sui-plugin.d.ts +1 -1
  210. package/lib/sui/sui-plugin.d.ts.map +1 -1
  211. package/lib/sui/sui-plugin.js +35 -34
  212. package/lib/sui/sui-plugin.js.map +1 -1
  213. package/lib/sui/sui-processor.d.ts +1 -1
  214. package/lib/sui/sui-processor.d.ts.map +1 -1
  215. package/lib/sui/sui-processor.js +18 -17
  216. package/lib/sui/sui-processor.js.map +1 -1
  217. package/lib/testing/aptos-facet.d.ts.map +1 -1
  218. package/lib/testing/aptos-facet.js +18 -11
  219. package/lib/testing/aptos-facet.js.map +1 -1
  220. package/lib/testing/cosmos-facet.d.ts.map +1 -1
  221. package/lib/testing/cosmos-facet.js +10 -6
  222. package/lib/testing/cosmos-facet.js.map +1 -1
  223. package/lib/testing/eth-facet.d.ts +1 -1
  224. package/lib/testing/eth-facet.d.ts.map +1 -1
  225. package/lib/testing/eth-facet.js +34 -18
  226. package/lib/testing/eth-facet.js.map +1 -1
  227. package/lib/testing/fuel-facet.d.ts.map +1 -1
  228. package/lib/testing/fuel-facet.js +28 -18
  229. package/lib/testing/fuel-facet.js.map +1 -1
  230. package/lib/testing/iota-facet.d.ts.map +1 -1
  231. package/lib/testing/iota-facet.js +32 -20
  232. package/lib/testing/iota-facet.js.map +1 -1
  233. package/lib/testing/memory-database.d.ts +1 -1
  234. package/lib/testing/memory-database.d.ts.map +1 -1
  235. package/lib/testing/memory-database.js +81 -71
  236. package/lib/testing/memory-database.js.map +1 -1
  237. package/lib/testing/metric-utils.d.ts +2 -2
  238. package/lib/testing/metric-utils.d.ts.map +1 -1
  239. package/lib/testing/metric-utils.js +13 -12
  240. package/lib/testing/metric-utils.js.map +1 -1
  241. package/lib/testing/solana-facet.d.ts +3 -2
  242. package/lib/testing/solana-facet.d.ts.map +1 -1
  243. package/lib/testing/solana-facet.js +8 -5
  244. package/lib/testing/solana-facet.js.map +1 -1
  245. package/lib/testing/sui-facet.d.ts.map +1 -1
  246. package/lib/testing/sui-facet.js +30 -20
  247. package/lib/testing/sui-facet.js.map +1 -1
  248. package/lib/testing/test-processor-server.d.ts +19 -13
  249. package/lib/testing/test-processor-server.d.ts.map +1 -1
  250. package/lib/testing/test-processor-server.js +22 -20
  251. package/lib/testing/test-processor-server.js.map +1 -1
  252. package/lib/utils/price.d.ts +1 -1
  253. package/lib/utils/price.d.ts.map +1 -1
  254. package/lib/utils/price.js +19 -12
  255. package/lib/utils/price.js.map +1 -1
  256. package/package.json +5 -7
  257. package/src/aptos/aptos-plugin.ts +105 -91
  258. package/src/aptos/aptos-processor.ts +33 -25
  259. package/src/aptos/aptos-resource-processor-template.ts +15 -6
  260. package/src/aptos/context.ts +8 -7
  261. package/src/aptos/data.ts +4 -4
  262. package/src/core/base-context.ts +19 -12
  263. package/src/core/core-plugin.ts +10 -7
  264. package/src/core/event-logger.ts +63 -34
  265. package/src/core/exporter.ts +5 -4
  266. package/src/core/handler-options.ts +1 -1
  267. package/src/core/handler-register.ts +3 -3
  268. package/src/core/meter.ts +9 -7
  269. package/src/core/normalization.ts +53 -31
  270. package/src/core/numberish.ts +46 -30
  271. package/src/core/partition-handler-manager.ts +13 -11
  272. package/src/cosmos/context.ts +4 -3
  273. package/src/cosmos/cosmos-plugin.ts +19 -15
  274. package/src/cosmos/cosmos-processor.ts +2 -2
  275. package/src/eth/abi-decoder/decode-worker.ts +2 -2
  276. package/src/eth/account-processor.ts +21 -12
  277. package/src/eth/base-processor-template.ts +22 -10
  278. package/src/eth/base-processor.ts +66 -54
  279. package/src/eth/builtin/internal/eacaggregatorproxy-processor.ts +177 -116
  280. package/src/eth/builtin/internal/erc1155-processor.ts +73 -38
  281. package/src/eth/builtin/internal/erc20-processor.ts +152 -91
  282. package/src/eth/builtin/internal/erc20bytes-processor.ts +80 -46
  283. package/src/eth/builtin/internal/erc721-processor.ts +109 -65
  284. package/src/eth/builtin/internal/weth9-processor.ts +95 -56
  285. package/src/eth/codegen/file.ts +2 -1
  286. package/src/eth/codegen/function-calls.ts +1 -1
  287. package/src/eth/context.ts +18 -11
  288. package/src/eth/eth-plugin.ts +135 -118
  289. package/src/eth/eth.ts +29 -20
  290. package/src/eth/index.ts +1 -1
  291. package/src/fuel/asset-processor.ts +16 -8
  292. package/src/fuel/context.ts +4 -3
  293. package/src/fuel/fuel-plugin.ts +71 -73
  294. package/src/fuel/fuel-processor-template.ts +7 -6
  295. package/src/fuel/fuel-processor.ts +35 -23
  296. package/src/fuel/global-processor.ts +3 -3
  297. package/src/fuel/types.ts +10 -4
  298. package/src/iota/context.ts +8 -7
  299. package/src/iota/iota-object-processor-template.ts +25 -15
  300. package/src/iota/iota-object-processor.ts +33 -22
  301. package/src/iota/iota-plugin-part.ts +41 -34
  302. package/src/iota/iota-processor.ts +25 -17
  303. package/src/iota/network.ts +2 -2
  304. package/src/move/filter.ts +1 -1
  305. package/src/move/index.ts +1 -1
  306. package/src/solana/solana-context.ts +4 -3
  307. package/src/solana/solana-plugin.ts +27 -24
  308. package/src/solana/solana-processor.ts +14 -6
  309. package/src/store/cache.ts +22 -18
  310. package/src/store/convert.ts +68 -104
  311. package/src/store/decorators.ts +3 -2
  312. package/src/store/store.ts +30 -22
  313. package/src/store/types.ts +24 -33
  314. package/src/store/util.ts +13 -18
  315. package/src/sui/context.ts +8 -7
  316. package/src/sui/sui-object-processor-template.ts +25 -15
  317. package/src/sui/sui-object-processor.ts +33 -22
  318. package/src/sui/sui-plugin-part.ts +41 -34
  319. package/src/sui/sui-plugin.ts +49 -47
  320. package/src/sui/sui-processor.ts +25 -17
  321. package/src/testing/aptos-facet.ts +18 -11
  322. package/src/testing/cosmos-facet.ts +10 -6
  323. package/src/testing/eth-facet.ts +40 -18
  324. package/src/testing/fuel-facet.ts +28 -18
  325. package/src/testing/iota-facet.ts +32 -20
  326. package/src/testing/memory-database.ts +109 -85
  327. package/src/testing/metric-utils.ts +15 -14
  328. package/src/testing/solana-facet.ts +11 -6
  329. package/src/testing/sui-facet.ts +30 -20
  330. package/src/testing/test-processor-server.ts +64 -58
  331. package/src/utils/price.ts +20 -13
@@ -9,22 +9,28 @@ import {
9
9
  } from '@sentio/runtime'
10
10
  import { PartitionHandlerManager } from '../core/index.js'
11
11
  import {
12
- AccountConfig,
13
- ContractConfig,
12
+ AccountConfigSchema,
13
+ ContractConfigSchema,
14
14
  DataBinding,
15
15
  HandlerType,
16
16
  InitResponse,
17
- LogFilter,
18
- LogHandlerConfig,
17
+ LogFilterSchema,
18
+ LogHandlerConfigSchema,
19
+ OnIntervalConfigSchema,
19
20
  PreparedData,
20
21
  PreprocessResult,
22
+ PreprocessResultSchema,
21
23
  ProcessConfigResponse,
22
24
  ProcessResult,
23
25
  ProcessStreamResponse_Partitions,
24
- StartRequest
26
+ ProcessStreamResponse_PartitionsSchema,
27
+ StartRequest,
28
+ TopicSchema,
29
+ TraceHandlerConfigSchema,
30
+ TransactionHandlerConfigSchema
25
31
  } from '@sentio/protos'
26
-
27
- import { ServerError, Status } from 'nice-grpc'
32
+ import { create } from '@bufbuild/protobuf'
33
+ import { ConnectError, Code } from '@connectrpc/connect'
28
34
  import { EthProcessorState } from './binds.js'
29
35
  import { AccountProcessorState } from './account-processor-state.js'
30
36
  import { ProcessorTemplateProcessorState } from './base-processor-template.js'
@@ -65,7 +71,7 @@ export class EthPlugin extends Plugin {
65
71
  const startBlock = await timeOrBlockToBlockNumber(provider, processor.config.start)
66
72
  const endBlock = processor.config.end ? await timeOrBlockToBlockNumber(provider, processor.config.end) : undefined
67
73
 
68
- const contractConfig = ContractConfig.fromPartial({
74
+ const contractConfig = create(ContractConfigSchema, {
69
75
  processorType: USER_PROCESSOR,
70
76
  contract: {
71
77
  name: processor.config.name,
@@ -84,15 +90,17 @@ export class EthPlugin extends Plugin {
84
90
  this.partitionManager.registerPartitionHandler(HandlerType.ETH_BLOCK, handlerId, blockHandler.partitionHandler)
85
91
  // TODO wrap the block handler into one
86
92
 
87
- contractConfig.intervalConfigs.push({
88
- slot: 0,
89
- slotInterval: blockHandler.blockInterval,
90
- minutes: 0,
91
- minutesInterval: blockHandler.timeIntervalInMinutes,
92
- handlerId: handlerId,
93
- handlerName: blockHandler.handlerName,
94
- fetchConfig: blockHandler.fetchConfig
95
- })
93
+ contractConfig.intervalConfigs.push(
94
+ create(OnIntervalConfigSchema, {
95
+ slot: 0,
96
+ slotInterval: blockHandler.blockInterval,
97
+ minutes: 0,
98
+ minutesInterval: blockHandler.timeIntervalInMinutes,
99
+ handlerId: handlerId,
100
+ handlerName: blockHandler.handlerName,
101
+ fetchConfig: blockHandler.fetchConfig
102
+ })
103
+ )
96
104
  }
97
105
 
98
106
  // Step 2. Prepare all trace handlers
@@ -101,12 +109,14 @@ export class EthPlugin extends Plugin {
101
109
 
102
110
  this.partitionManager.registerPartitionHandler(HandlerType.ETH_TRACE, handlerId, traceHandler.partitionHandler)
103
111
  for (const signature of traceHandler.signatures) {
104
- contractConfig.traceConfigs.push({
105
- signature: signature,
106
- handlerId: handlerId,
107
- handlerName: traceHandler.handlerName,
108
- fetchConfig: traceHandler.fetchConfig
109
- })
112
+ contractConfig.traceConfigs.push(
113
+ create(TraceHandlerConfigSchema, {
114
+ signature: signature,
115
+ handlerId: handlerId,
116
+ handlerName: traceHandler.handlerName,
117
+ fetchConfig: traceHandler.fetchConfig
118
+ })
119
+ )
110
120
  }
111
121
  }
112
122
 
@@ -115,24 +125,25 @@ export class EthPlugin extends Plugin {
115
125
  // associate id with filter
116
126
  const handlerId = this.handlerRegister.register(eventsHandler.handler, chainId)
117
127
  this.partitionManager.registerPartitionHandler(HandlerType.ETH_LOG, handlerId, eventsHandler.partitionHandler)
118
- const logConfig: LogHandlerConfig = {
128
+ const logConfig = create(LogHandlerConfigSchema, {
119
129
  handlerId: handlerId,
120
130
  handlerName: eventsHandler.handlerName,
121
131
  filters: [],
122
132
  fetchConfig: eventsHandler.fetchConfig
123
- }
133
+ })
124
134
 
125
135
  for (const filter of eventsHandler.filters) {
126
136
  const topics = await filter.getTopicFilter()
127
137
 
128
138
  // if (!filter.topics) {
129
- // throw new ServerError(Status.INVALID_ARGUMENT, 'Topic should not be null')
139
+ // throw new ConnectError('Topic should not be null', Code.InvalidArgument)
130
140
  // }
131
- const logFilter: LogFilter = {
132
- addressType: undefined,
133
- address: contractConfig.contract?.address && validateAndNormalizeAddress(contractConfig.contract.address),
141
+ const logFilter = create(LogFilterSchema, {
142
+ addressOrType: contractConfig.contract?.address
143
+ ? { case: 'address', value: validateAndNormalizeAddress(contractConfig.contract.address) }
144
+ : undefined,
134
145
  topics: []
135
- }
146
+ })
136
147
 
137
148
  for (const ts of topics) {
138
149
  let hashes: string[] = []
@@ -141,7 +152,7 @@ export class EthPlugin extends Plugin {
141
152
  } else if (ts) {
142
153
  hashes.push(ts)
143
154
  }
144
- logFilter.topics.push({ hashes: hashes })
155
+ logFilter.topics.push(create(TopicSchema, { hashes: hashes }))
145
156
  }
146
157
  logConfig.filters.push(logFilter)
147
158
  }
@@ -168,7 +179,7 @@ export class EthPlugin extends Plugin {
168
179
  endBlock = processor.config.end?.block != undefined ? BigInt(processor.config.end.block) : undefined
169
180
  }
170
181
 
171
- const contractConfig = ContractConfig.fromPartial({
182
+ const contractConfig = create(ContractConfigSchema, {
172
183
  processorType: USER_PROCESSOR,
173
184
  contract: {
174
185
  name: processor.config.name,
@@ -182,15 +193,17 @@ export class EthPlugin extends Plugin {
182
193
 
183
194
  for (const blockHandler of processor.blockHandlers) {
184
195
  const handlerId = this.handlerRegister.register(blockHandler.handler, chainId)
185
- contractConfig.intervalConfigs.push({
186
- slot: 0,
187
- slotInterval: blockHandler.blockInterval,
188
- minutes: 0,
189
- minutesInterval: blockHandler.timeIntervalInMinutes,
190
- handlerId: handlerId,
191
- handlerName: blockHandler.handlerName,
192
- fetchConfig: blockHandler.fetchConfig
193
- })
196
+ contractConfig.intervalConfigs.push(
197
+ create(OnIntervalConfigSchema, {
198
+ slot: 0,
199
+ slotInterval: blockHandler.blockInterval,
200
+ minutes: 0,
201
+ minutesInterval: blockHandler.timeIntervalInMinutes,
202
+ handlerId: handlerId,
203
+ handlerName: blockHandler.handlerName,
204
+ fetchConfig: blockHandler.fetchConfig
205
+ })
206
+ )
194
207
  }
195
208
 
196
209
  for (const transactionHandler of processor.transactionHandler) {
@@ -200,55 +213,65 @@ export class EthPlugin extends Plugin {
200
213
  handlerId,
201
214
  transactionHandler.partitionHandler
202
215
  )
203
- contractConfig.transactionConfig.push({
204
- handlerId: handlerId,
205
- handlerName: transactionHandler.handlerName,
206
- fetchConfig: transactionHandler.fetchConfig
207
- })
216
+ contractConfig.transactionConfig.push(
217
+ create(TransactionHandlerConfigSchema, {
218
+ handlerId: handlerId,
219
+ handlerName: transactionHandler.handlerName,
220
+ fetchConfig: transactionHandler.fetchConfig
221
+ })
222
+ )
208
223
  }
209
224
 
210
225
  for (const traceHandler of processor.traceHandlers) {
211
226
  const handlerId = this.handlerRegister.register(traceHandler.handler, chainId)
212
227
  for (const signature of traceHandler.signatures) {
213
- contractConfig.traceConfigs.push({
214
- signature: signature,
215
- handlerId: handlerId,
216
- handlerName: traceHandler.handlerName,
217
- fetchConfig: traceHandler.fetchConfig
218
- })
228
+ contractConfig.traceConfigs.push(
229
+ create(TraceHandlerConfigSchema, {
230
+ signature: signature,
231
+ handlerId: handlerId,
232
+ handlerName: traceHandler.handlerName,
233
+ fetchConfig: traceHandler.fetchConfig
234
+ })
235
+ )
219
236
  }
220
237
  }
221
238
 
222
239
  for (const eventsHandler of processor.eventHandlers) {
223
240
  // associate id with filter
224
241
  const handlerId = this.handlerRegister.register(eventsHandler.handler, processor.getChainId())
225
- const logConfig: LogHandlerConfig = {
242
+ const logConfig = create(LogHandlerConfigSchema, {
226
243
  handlerId: handlerId,
227
244
  handlerName: eventsHandler.handlerName,
228
245
  filters: [],
229
246
  fetchConfig: eventsHandler.fetchConfig
230
- }
247
+ })
231
248
 
232
249
  if (!eventsHandler.filters || eventsHandler.filters.length === 0) {
233
250
  // if no filter, then we assume all logs
234
- logConfig.filters.push({
235
- topics: []
236
- })
251
+ logConfig.filters.push(
252
+ create(LogFilterSchema, {
253
+ topics: []
254
+ })
255
+ )
237
256
  } else {
238
257
  for (const filter of eventsHandler.filters) {
239
258
  const topics = await filter.getTopicFilter()
240
259
  // if (!filter.topics) {
241
- // throw new ServerError(Status.INVALID_ARGUMENT, 'Topic should not be null')
260
+ // throw new ConnectError('Topic should not be null', Code.InvalidArgument)
242
261
  // }
243
262
  let address = undefined
244
263
  if (filter.address) {
245
264
  address = filter.address.toString()
246
265
  }
247
- const logFilter: LogFilter = {
248
- addressType: filter.addressType,
249
- address: address && validateAndNormalizeAddress(address),
266
+ const logFilter = create(LogFilterSchema, {
267
+ addressOrType:
268
+ filter.addressType != undefined
269
+ ? { case: 'addressType', value: filter.addressType }
270
+ : address
271
+ ? { case: 'address', value: validateAndNormalizeAddress(address) }
272
+ : undefined,
250
273
  topics: []
251
- }
274
+ })
252
275
 
253
276
  for (const ts of topics) {
254
277
  let hashes: string[] = []
@@ -257,7 +280,7 @@ export class EthPlugin extends Plugin {
257
280
  } else if (ts) {
258
281
  hashes.push(ts)
259
282
  }
260
- logFilter.topics.push({ hashes: hashes })
283
+ logFilter.topics.push(create(TopicSchema, { hashes: hashes }))
261
284
  }
262
285
  logConfig.filters.push(logFilter)
263
286
  }
@@ -273,7 +296,7 @@ export class EthPlugin extends Plugin {
273
296
  if (forChainId !== undefined && forChainId !== processor.getChainId().toString()) {
274
297
  continue
275
298
  }
276
- const accountConfig = AccountConfig.fromPartial({
299
+ const accountConfig = create(AccountConfigSchema, {
277
300
  address: validateAndNormalizeAddress(processor.config.address),
278
301
  chainId: processor.getChainId().toString(),
279
302
  startBlock: processor.config.startBlock ? BigInt(processor.config.startBlock) : 0n
@@ -282,12 +305,12 @@ export class EthPlugin extends Plugin {
282
305
  for (const eventsHandler of processor.eventHandlers) {
283
306
  // associate id with filter
284
307
  const handlerId = this.handlerRegister.register(eventsHandler.handler, processor.getChainId())
285
- const logConfig: LogHandlerConfig = {
308
+ const logConfig = create(LogHandlerConfigSchema, {
286
309
  handlerId: handlerId,
287
310
  handlerName: eventsHandler.handlerName,
288
311
  filters: [],
289
312
  fetchConfig: eventsHandler.fetchConfig
290
- }
313
+ })
291
314
 
292
315
  for (const filter of eventsHandler.filters) {
293
316
  const topics = await filter.getTopicFilter()
@@ -296,11 +319,14 @@ export class EthPlugin extends Plugin {
296
319
  if (filter.address) {
297
320
  address = filter.address.toString()
298
321
  }
299
- const logFilter: LogFilter = {
300
- addressType: filter.addressType,
301
- address: address && validateAndNormalizeAddress(address),
322
+ const logFilter = create(LogFilterSchema, {
323
+ addressOrType: filter.addressType
324
+ ? { case: 'addressType', value: filter.addressType }
325
+ : address
326
+ ? { case: 'address', value: validateAndNormalizeAddress(address) }
327
+ : undefined,
302
328
  topics: []
303
- }
329
+ })
304
330
 
305
331
  for (const ts of topics) {
306
332
  let hashes: string[] = []
@@ -309,7 +335,7 @@ export class EthPlugin extends Plugin {
309
335
  } else if (ts) {
310
336
  hashes.push(ts)
311
337
  }
312
- logFilter.topics.push({ hashes: hashes })
338
+ logFilter.topics.push(create(TopicSchema, { hashes: hashes }))
313
339
  }
314
340
  logConfig.filters.push(logFilter)
315
341
  }
@@ -338,7 +364,7 @@ export class EthPlugin extends Plugin {
338
364
  case HandlerType.ETH_TRANSACTION:
339
365
  return this.processTransaction(request, preparedData)
340
366
  default:
341
- throw new ServerError(Status.INVALID_ARGUMENT, 'No handle type registered ' + request.handlerType)
367
+ throw new ConnectError('No handle type registered ' + request.handlerType, Code.InvalidArgument)
342
368
  }
343
369
  }
344
370
 
@@ -346,40 +372,40 @@ export class EthPlugin extends Plugin {
346
372
  let data: any
347
373
  switch (request.handlerType) {
348
374
  case HandlerType.ETH_LOG:
349
- if (!request.data?.ethLog) {
350
- throw new ServerError(Status.INVALID_ARGUMENT, "ethLog can't be empty")
375
+ if (request.data?.value.case !== 'ethLog' || !request.data.value.value) {
376
+ throw new ConnectError("ethLog can't be empty", Code.InvalidArgument)
351
377
  }
352
- data = request.data.ethLog
378
+ data = request.data.value.value
353
379
  break
354
380
  case HandlerType.ETH_TRACE:
355
- if (!request.data?.ethTrace) {
356
- throw new ServerError(Status.INVALID_ARGUMENT, "ethTrace can't be empty")
381
+ if (request.data?.value.case !== 'ethTrace' || !request.data.value.value) {
382
+ throw new ConnectError("ethTrace can't be empty", Code.InvalidArgument)
357
383
  }
358
- data = request.data.ethTrace
384
+ data = request.data.value.value
359
385
  break
360
386
  case HandlerType.ETH_BLOCK:
361
- if (!request.data?.ethBlock) {
362
- throw new ServerError(Status.INVALID_ARGUMENT, "ethBlock can't be empty")
387
+ if (request.data?.value.case !== 'ethBlock' || !request.data.value.value) {
388
+ throw new ConnectError("ethBlock can't be empty", Code.InvalidArgument)
363
389
  }
364
- data = request.data.ethBlock
390
+ data = request.data.value.value
365
391
  break
366
392
  case HandlerType.ETH_TRANSACTION:
367
- if (!request.data?.ethTransaction) {
368
- throw new ServerError(Status.INVALID_ARGUMENT, "ethTransaction can't be empty")
393
+ if (request.data?.value.case !== 'ethTransaction' || !request.data.value.value) {
394
+ throw new ConnectError("ethTransaction can't be empty", Code.InvalidArgument)
369
395
  }
370
- data = request.data.ethTransaction
396
+ data = request.data.value.value
371
397
  break
372
398
  default:
373
- throw new ServerError(Status.INVALID_ARGUMENT, 'No handle type registered ' + request.handlerType)
399
+ throw new ConnectError('No handle type registered ' + request.handlerType, Code.InvalidArgument)
374
400
  }
375
401
  const partitions = await this.partitionManager.processPartitionForHandlerType(
376
402
  request.handlerType,
377
403
  request.handlerIds,
378
404
  data
379
405
  )
380
- return {
406
+ return create(ProcessStreamResponse_PartitionsSchema, {
381
407
  partitions
382
- }
408
+ })
383
409
  }
384
410
 
385
411
  async start(request: StartRequest) {
@@ -392,10 +418,10 @@ export class EthPlugin extends Plugin {
392
418
 
393
419
  const template = ProcessorTemplateProcessorState.INSTANCE.getValues()[instance.templateId]
394
420
  if (!template) {
395
- throw new ServerError(Status.INVALID_ARGUMENT, 'Invalid template contract:' + instance)
421
+ throw new ConnectError('Invalid template contract:' + instance, Code.InvalidArgument)
396
422
  }
397
423
  if (!instance.contract) {
398
- throw new ServerError(Status.INVALID_ARGUMENT, 'Contract Empty from:' + instance)
424
+ throw new ConnectError('Contract Empty from:' + instance, Code.InvalidArgument)
399
425
  }
400
426
  const ctx = new NoopContext(instance.contract.chainId as EthChainId)
401
427
  template.startInstance(
@@ -404,7 +430,7 @@ export class EthPlugin extends Plugin {
404
430
  address: validateAndNormalizeAddress(instance.contract.address),
405
431
  startBlock: instance.startBlock,
406
432
  endBlock: instance.endBlock,
407
- baseLabels: instance.baseLabels
433
+ baseLabels: instance.baseLabels as { [key: string]: string } | undefined
408
434
  },
409
435
  ctx
410
436
  )
@@ -412,20 +438,17 @@ export class EthPlugin extends Plugin {
412
438
  }
413
439
 
414
440
  async processLog(request: DataBinding, preparedData: PreparedData | undefined): Promise<ProcessResult> {
415
- if (!request.data?.ethLog?.log) {
416
- throw new ServerError(Status.INVALID_ARGUMENT, "Log can't be null")
441
+ if (request.data?.value.case !== 'ethLog' || !request.data.value.value.rawLog) {
442
+ throw new ConnectError("Log can't be null", Code.InvalidArgument)
417
443
  }
418
- const ethLog = request.data.ethLog
444
+ const ethLog = request.data.value.value
419
445
 
420
446
  const promises: Promise<ProcessResult>[] = []
421
447
  for (const handlerId of request.handlerIds) {
422
448
  const handler = this.handlerRegister.getHandlerById(request.chainId, handlerId)
423
449
  const promise = handler(ethLog, preparedData).catch((e: any) => {
424
450
  console.error('error processing log: ', e)
425
- throw new ServerError(
426
- Status.INTERNAL,
427
- 'error processing log: ' + JSON.stringify(ethLog.log) + '\n' + errorString(e)
428
- )
451
+ throw new ConnectError('error processing log: ' + ethLog.rawLog + '\n' + errorString(e), Code.Internal)
429
452
  })
430
453
  if (GLOBAL_CONFIG.execution.sequential) {
431
454
  await promise
@@ -436,10 +459,10 @@ export class EthPlugin extends Plugin {
436
459
  }
437
460
 
438
461
  async processTrace(binding: DataBinding, preparedData: PreparedData | undefined): Promise<ProcessResult> {
439
- if (!binding.data?.ethTrace?.trace) {
440
- throw new ServerError(Status.INVALID_ARGUMENT, "Trace can't be null")
462
+ if (binding.data?.value.case !== 'ethTrace' || !binding.data.value.value.rawTrace) {
463
+ throw new ConnectError("Trace can't be null", Code.InvalidArgument)
441
464
  }
442
- const ethTrace = binding.data.ethTrace
465
+ const ethTrace = binding.data.value.value
443
466
 
444
467
  const promises: Promise<ProcessResult>[] = []
445
468
 
@@ -448,10 +471,7 @@ export class EthPlugin extends Plugin {
448
471
  .getHandlerById(binding.chainId, handlerId)(ethTrace, preparedData)
449
472
  .catch((e: any) => {
450
473
  console.error('error processing trace: ', e)
451
- throw new ServerError(
452
- Status.INTERNAL,
453
- 'error processing trace: ' + JSON.stringify(ethTrace.trace) + '\n' + errorString(e)
454
- )
474
+ throw new ConnectError('error processing trace: ' + ethTrace.rawTrace + '\n' + errorString(e), Code.Internal)
455
475
  })
456
476
  if (GLOBAL_CONFIG.execution.sequential) {
457
477
  await promise
@@ -462,10 +482,10 @@ export class EthPlugin extends Plugin {
462
482
  }
463
483
 
464
484
  async processBlock(binding: DataBinding, preparedData: PreparedData | undefined): Promise<ProcessResult> {
465
- if (!binding.data?.ethBlock?.block) {
466
- throw new ServerError(Status.INVALID_ARGUMENT, "Block can't be empty")
485
+ if (binding.data?.value.case !== 'ethBlock' || !binding.data.value.value.rawBlock) {
486
+ throw new ConnectError("Block can't be empty", Code.InvalidArgument)
467
487
  }
468
- const ethBlock = binding.data.ethBlock
488
+ const ethBlock = binding.data.value.value
469
489
 
470
490
  const promises: Promise<ProcessResult>[] = []
471
491
  for (const handlerId of binding.handlerIds) {
@@ -473,10 +493,7 @@ export class EthPlugin extends Plugin {
473
493
  .getHandlerById(binding.chainId, handlerId)(ethBlock, preparedData)
474
494
  .catch((e: any) => {
475
495
  console.error('error processing block: ', e)
476
- throw new ServerError(
477
- Status.INTERNAL,
478
- 'error processing block: ' + ethBlock.block?.number + '\n' + errorString(e)
479
- )
496
+ throw new ConnectError('error processing block: ' + errorString(e), Code.Internal)
480
497
  })
481
498
  if (GLOBAL_CONFIG.execution.sequential) {
482
499
  await promise
@@ -487,10 +504,10 @@ export class EthPlugin extends Plugin {
487
504
  }
488
505
 
489
506
  async processTransaction(binding: DataBinding, preparedData: PreparedData | undefined): Promise<ProcessResult> {
490
- if (!binding.data?.ethTransaction?.transaction) {
491
- throw new ServerError(Status.INVALID_ARGUMENT, "transaction can't be null")
507
+ if (binding.data?.value.case !== 'ethTransaction' || !binding.data.value.value.rawTransaction) {
508
+ throw new ConnectError("transaction can't be null", Code.InvalidArgument)
492
509
  }
493
- const ethTransaction = binding.data.ethTransaction
510
+ const ethTransaction = binding.data.value.value
494
511
 
495
512
  const promises: Promise<ProcessResult>[] = []
496
513
 
@@ -498,9 +515,9 @@ export class EthPlugin extends Plugin {
498
515
  const promise = this.handlerRegister
499
516
  .getHandlerById(binding.chainId, handlerId)(ethTransaction, preparedData)
500
517
  .catch((e: any) => {
501
- throw new ServerError(
502
- Status.INTERNAL,
503
- 'error processing transaction: ' + JSON.stringify(ethTransaction.transaction) + '\n' + errorString(e)
518
+ throw new ConnectError(
519
+ 'error processing transaction: ' + ethTransaction.rawTransaction + '\n' + errorString(e),
520
+ Code.Internal
504
521
  )
505
522
  })
506
523
  if (GLOBAL_CONFIG.execution.sequential) {
@@ -525,7 +542,7 @@ class NoopContext extends EthContext {
525
542
  }
526
543
 
527
544
  function mergePreprocessResults(results: PreprocessResult[]): PreprocessResult {
528
- const res: PreprocessResult = { ethCallParams: [] }
545
+ const res = create(PreprocessResultSchema, { ethCallParams: [] })
529
546
  for (const r of results) {
530
547
  res.ethCallParams = res.ethCallParams.concat(r.ethCallParams)
531
548
  }
package/src/eth/eth.ts CHANGED
@@ -24,7 +24,8 @@ import type { AccessList } from 'ethers/transaction'
24
24
  import { ContractContext } from './context.js'
25
25
  import { getAddress } from 'ethers/address'
26
26
  import { getBigInt } from 'ethers/utils'
27
- import { EthCallContext, EthCallParam } from '@sentio/protos'
27
+ import { type EthCallContext, type EthCallParam, EthCallParamSchema } from '@sentio/protos'
28
+ import { create } from '@bufbuild/protobuf'
28
29
  import { ALL_ADDRESS } from '../core/index.js'
29
30
 
30
31
  export interface IResult {
@@ -240,11 +241,12 @@ function formatLog(log: any): LogParams {
240
241
  }
241
242
 
242
243
  export function formatEthData(data: {
243
- log?: any
244
- block?: any
245
- trace?: any
246
- transaction?: any
247
- transactionReceipt?: any
244
+ // raw_* JSON payloads sent by the driver
245
+ rawLog?: string
246
+ rawBlock?: string
247
+ rawTrace?: string
248
+ rawTransaction?: string
249
+ rawTransactionReceipt?: string
248
250
  __formattedEthData?: any
249
251
  }) {
250
252
  // Return cached result if it exists
@@ -253,22 +255,29 @@ export function formatEthData(data: {
253
255
  }
254
256
 
255
257
  try {
256
- const log = data.log ? formatLog(data.log) : undefined
257
- if (data.block && !data.block.transactions) {
258
- data.block.transactions = []
258
+ // All Eth* data is delivered as raw_* JSON payloads; parse them here.
259
+ const logObj = data.rawLog ? JSON.parse(data.rawLog) : undefined
260
+ const blockObj = data.rawBlock ? JSON.parse(data.rawBlock) : undefined
261
+ const traceObj = data.rawTrace ? JSON.parse(data.rawTrace) : undefined
262
+ const transactionObj = data.rawTransaction ? JSON.parse(data.rawTransaction) : undefined
263
+ const transactionReceiptObj = data.rawTransactionReceipt ? JSON.parse(data.rawTransactionReceipt) : undefined
264
+
265
+ const log = logObj ? formatLog(logObj) : undefined
266
+ if (blockObj && !blockObj.transactions) {
267
+ blockObj.transactions = []
259
268
  }
260
- const block = data.block ? formatRichBlock(data.block) : undefined
261
- const trace = data.trace ? (data.trace as Trace) : undefined
269
+ const block = blockObj ? formatRichBlock(blockObj) : undefined
270
+ const trace = traceObj ? (traceObj as Trace) : undefined
262
271
  let transaction = undefined
263
- if (data.transaction) {
264
- if (!data.transaction.v) {
265
- data.transaction.v = '0x1c'
266
- data.transaction.r = '0x88ff6cf0fefd94db46111149ae4bfc179e9b94721fffd821d38d16464b3f71d0'
267
- data.transaction.s = '0x45e0aff800961cfce805daef7016b9b675c137a6a41a548f7b60a3484c06a33a'
272
+ if (transactionObj) {
273
+ if (!transactionObj.v) {
274
+ transactionObj.v = '0x1c'
275
+ transactionObj.r = '0x88ff6cf0fefd94db46111149ae4bfc179e9b94721fffd821d38d16464b3f71d0'
276
+ transactionObj.s = '0x45e0aff800961cfce805daef7016b9b675c137a6a41a548f7b60a3484c06a33a'
268
277
  }
269
- transaction = formatTransactionResponse(data.transaction)
278
+ transaction = formatTransactionResponse(transactionObj)
270
279
  }
271
- const transactionReceipt = data.transactionReceipt ? formatTransactionReceipt(data.transactionReceipt) : undefined
280
+ const transactionReceipt = transactionReceiptObj ? formatTransactionReceipt(transactionReceiptObj) : undefined
272
281
 
273
282
  const result = {
274
283
  log,
@@ -528,10 +537,10 @@ export function encodeCallData(
528
537
  try {
529
538
  const iface = new Interface([funcABI])
530
539
  const calldata = iface.encodeFunctionData(name, values)
531
- return {
540
+ return create(EthCallParamSchema, {
532
541
  context,
533
542
  calldata
534
- }
543
+ })
535
544
  } catch (e) {
536
545
  const stack = new Error().stack
537
546
  throw transformEtherError(e, undefined, stack)
package/src/eth/index.ts CHANGED
@@ -13,7 +13,7 @@ export { AccountContext, ContractContext, GlobalContext, ContractView, BoundCont
13
13
 
14
14
  export { EthPlugin } from './eth-plugin.js'
15
15
 
16
- export { EthFetchConfig, PreprocessResult } from '@sentio/protos'
16
+ export type { EthFetchConfig, PreprocessResult } from '@sentio/protos'
17
17
 
18
18
  export { EthChainId } from '@sentio/chain'
19
19
 
@@ -1,5 +1,11 @@
1
1
  import { CallHandler, FuelBaseProcessor, FuelProcessorState } from './types.js'
2
- import { Data_FuelReceipt, Data_FuelTransaction, FuelAssetHandlerConfig_AssetFilter } from '@sentio/protos'
2
+ import {
3
+ Data_FuelTransaction,
4
+ FuelAssetHandlerConfig_AssetFilter,
5
+ FuelAssetHandlerConfig_AssetFilterSchema,
6
+ timestampDate
7
+ } from '@sentio/protos'
8
+ import { create } from '@bufbuild/protobuf'
3
9
  import { FuelNetwork, getProvider } from './network.js'
4
10
  import { FuelContext } from './context.js'
5
11
  import { decodeFuelTransaction } from './transaction.js'
@@ -8,7 +14,7 @@ import { getOptionsSignature } from './fuel-processor.js'
8
14
  import { getHandlerName, proxyProcessor } from '../utils/metrics.js'
9
15
 
10
16
  export class FuelAssetProcessor implements FuelBaseProcessor<FuelAssetProcessorConfig> {
11
- txHandlers: CallHandler<Data_FuelTransaction | Data_FuelReceipt>[] = []
17
+ txHandlers: CallHandler<Data_FuelTransaction>[] = []
12
18
  blockHandlers = []
13
19
  private provider: Provider
14
20
 
@@ -42,11 +48,13 @@ export class FuelAssetProcessor implements FuelBaseProcessor<FuelAssetProcessorC
42
48
  for (const assetId of assetIds) {
43
49
  for (const from of froms) {
44
50
  for (const to of tos) {
45
- filters.push({
46
- assetId: assetId,
47
- fromAddress: from,
48
- toAddress: to
49
- })
51
+ filters.push(
52
+ create(FuelAssetHandlerConfig_AssetFilterSchema, {
53
+ assetId: assetId,
54
+ fromAddress: from,
55
+ toAddress: to
56
+ })
57
+ )
50
58
  }
51
59
  }
52
60
  }
@@ -94,7 +102,7 @@ export class FuelAssetProcessor implements FuelBaseProcessor<FuelAssetProcessorC
94
102
  this.config.chainId,
95
103
  assetId,
96
104
  this.config.name ?? '',
97
- call.timestamp || new Date(0),
105
+ call.timestamp ? timestampDate(call.timestamp) : new Date(0),
98
106
  tx,
99
107
  null
100
108
  )