@sentio/sdk 3.9.0-rc.9 → 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 (340) 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 +4 -4
  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 +14 -8
  71. package/lib/eth/base-processor-template.js.map +1 -1
  72. package/lib/eth/base-processor.d.ts +3 -3
  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 +9 -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 +3 -3
  152. package/lib/iota/iota-processor.d.ts.map +1 -1
  153. package/lib/iota/iota-processor.js +20 -19
  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/codegen/codegen.d.ts +1 -1
  165. package/lib/solana/codegen/codegen.d.ts.map +1 -1
  166. package/lib/solana/codegen/codegen.js +2 -2
  167. package/lib/solana/codegen/codegen.js.map +1 -1
  168. package/lib/solana/solana-context.d.ts.map +1 -1
  169. package/lib/solana/solana-context.js +4 -3
  170. package/lib/solana/solana-context.js.map +1 -1
  171. package/lib/solana/solana-plugin.d.ts.map +1 -1
  172. package/lib/solana/solana-plugin.js +19 -18
  173. package/lib/solana/solana-plugin.js.map +1 -1
  174. package/lib/solana/solana-processor.d.ts +2 -2
  175. package/lib/solana/solana-processor.d.ts.map +1 -1
  176. package/lib/solana/solana-processor.js +8 -3
  177. package/lib/solana/solana-processor.js.map +1 -1
  178. package/lib/store/cache.d.ts.map +1 -1
  179. package/lib/store/cache.js +22 -17
  180. package/lib/store/cache.js.map +1 -1
  181. package/lib/store/codegen.js +2 -2
  182. package/lib/store/codegen.js.map +1 -1
  183. package/lib/store/convert.d.ts +1 -1
  184. package/lib/store/convert.d.ts.map +1 -1
  185. package/lib/store/convert.js +67 -104
  186. package/lib/store/convert.js.map +1 -1
  187. package/lib/store/decorators.d.ts +1 -1
  188. package/lib/store/decorators.d.ts.map +1 -1
  189. package/lib/store/decorators.js +3 -1
  190. package/lib/store/decorators.js.map +1 -1
  191. package/lib/store/store.d.ts.map +1 -1
  192. package/lib/store/store.js +24 -16
  193. package/lib/store/store.js.map +1 -1
  194. package/lib/store/types.js +24 -32
  195. package/lib/store/types.js.map +1 -1
  196. package/lib/store/util.d.ts +1 -1
  197. package/lib/store/util.d.ts.map +1 -1
  198. package/lib/store/util.js +13 -17
  199. package/lib/store/util.js.map +1 -1
  200. package/lib/sui/context.d.ts +1 -1
  201. package/lib/sui/context.d.ts.map +1 -1
  202. package/lib/sui/context.js +8 -6
  203. package/lib/sui/context.js.map +1 -1
  204. package/lib/sui/sui-object-processor-template.d.ts +1 -1
  205. package/lib/sui/sui-object-processor-template.d.ts.map +1 -1
  206. package/lib/sui/sui-object-processor-template.js +17 -12
  207. package/lib/sui/sui-object-processor-template.js.map +1 -1
  208. package/lib/sui/sui-object-processor.d.ts +1 -1
  209. package/lib/sui/sui-object-processor.d.ts.map +1 -1
  210. package/lib/sui/sui-object-processor.js +23 -16
  211. package/lib/sui/sui-object-processor.js.map +1 -1
  212. package/lib/sui/sui-plugin-part.d.ts +1 -1
  213. package/lib/sui/sui-plugin-part.d.ts.map +1 -1
  214. package/lib/sui/sui-plugin-part.js +16 -15
  215. package/lib/sui/sui-plugin-part.js.map +1 -1
  216. package/lib/sui/sui-plugin.d.ts +1 -1
  217. package/lib/sui/sui-plugin.d.ts.map +1 -1
  218. package/lib/sui/sui-plugin.js +35 -34
  219. package/lib/sui/sui-plugin.js.map +1 -1
  220. package/lib/sui/sui-processor.d.ts +3 -3
  221. package/lib/sui/sui-processor.d.ts.map +1 -1
  222. package/lib/sui/sui-processor.js +20 -19
  223. package/lib/sui/sui-processor.js.map +1 -1
  224. package/lib/testing/aptos-facet.d.ts.map +1 -1
  225. package/lib/testing/aptos-facet.js +18 -11
  226. package/lib/testing/aptos-facet.js.map +1 -1
  227. package/lib/testing/cosmos-facet.d.ts.map +1 -1
  228. package/lib/testing/cosmos-facet.js +10 -6
  229. package/lib/testing/cosmos-facet.js.map +1 -1
  230. package/lib/testing/eth-facet.d.ts +1 -1
  231. package/lib/testing/eth-facet.d.ts.map +1 -1
  232. package/lib/testing/eth-facet.js +34 -18
  233. package/lib/testing/eth-facet.js.map +1 -1
  234. package/lib/testing/fuel-facet.d.ts.map +1 -1
  235. package/lib/testing/fuel-facet.js +28 -18
  236. package/lib/testing/fuel-facet.js.map +1 -1
  237. package/lib/testing/iota-facet.d.ts.map +1 -1
  238. package/lib/testing/iota-facet.js +32 -20
  239. package/lib/testing/iota-facet.js.map +1 -1
  240. package/lib/testing/memory-database.d.ts +1 -1
  241. package/lib/testing/memory-database.d.ts.map +1 -1
  242. package/lib/testing/memory-database.js +82 -69
  243. package/lib/testing/memory-database.js.map +1 -1
  244. package/lib/testing/metric-utils.d.ts +2 -2
  245. package/lib/testing/metric-utils.d.ts.map +1 -1
  246. package/lib/testing/metric-utils.js +13 -12
  247. package/lib/testing/metric-utils.js.map +1 -1
  248. package/lib/testing/solana-facet.d.ts +3 -2
  249. package/lib/testing/solana-facet.d.ts.map +1 -1
  250. package/lib/testing/solana-facet.js +8 -5
  251. package/lib/testing/solana-facet.js.map +1 -1
  252. package/lib/testing/sui-facet.d.ts.map +1 -1
  253. package/lib/testing/sui-facet.js +30 -20
  254. package/lib/testing/sui-facet.js.map +1 -1
  255. package/lib/testing/test-processor-server.d.ts +19 -13
  256. package/lib/testing/test-processor-server.d.ts.map +1 -1
  257. package/lib/testing/test-processor-server.js +22 -20
  258. package/lib/testing/test-processor-server.js.map +1 -1
  259. package/lib/utils/price.d.ts +1 -1
  260. package/lib/utils/price.d.ts.map +1 -1
  261. package/lib/utils/price.js +19 -12
  262. package/lib/utils/price.js.map +1 -1
  263. package/package.json +10 -12
  264. package/src/aptos/aptos-plugin.ts +105 -91
  265. package/src/aptos/aptos-processor.ts +42 -34
  266. package/src/aptos/aptos-resource-processor-template.ts +15 -6
  267. package/src/aptos/context.ts +8 -7
  268. package/src/aptos/data.ts +4 -4
  269. package/src/core/base-context.ts +19 -12
  270. package/src/core/core-plugin.ts +10 -7
  271. package/src/core/event-logger.ts +63 -34
  272. package/src/core/exporter.ts +5 -4
  273. package/src/core/handler-options.ts +1 -1
  274. package/src/core/handler-register.ts +3 -3
  275. package/src/core/meter.ts +9 -7
  276. package/src/core/normalization.ts +53 -31
  277. package/src/core/numberish.ts +46 -30
  278. package/src/core/partition-handler-manager.ts +13 -11
  279. package/src/cosmos/context.ts +4 -3
  280. package/src/cosmos/cosmos-plugin.ts +19 -15
  281. package/src/cosmos/cosmos-processor.ts +2 -2
  282. package/src/eth/abi-decoder/decode-worker.ts +2 -2
  283. package/src/eth/account-processor.ts +21 -12
  284. package/src/eth/base-processor-template.ts +27 -11
  285. package/src/eth/base-processor.ts +77 -65
  286. package/src/eth/builtin/internal/eacaggregatorproxy-processor.ts +177 -116
  287. package/src/eth/builtin/internal/erc1155-processor.ts +73 -38
  288. package/src/eth/builtin/internal/erc20-processor.ts +152 -91
  289. package/src/eth/builtin/internal/erc20bytes-processor.ts +80 -46
  290. package/src/eth/builtin/internal/erc721-processor.ts +109 -65
  291. package/src/eth/builtin/internal/weth9-processor.ts +95 -56
  292. package/src/eth/codegen/file.ts +2 -1
  293. package/src/eth/codegen/function-calls.ts +1 -1
  294. package/src/eth/context.ts +18 -11
  295. package/src/eth/eth-plugin.ts +135 -118
  296. package/src/eth/eth.ts +29 -20
  297. package/src/eth/index.ts +1 -1
  298. package/src/fuel/asset-processor.ts +16 -8
  299. package/src/fuel/context.ts +4 -3
  300. package/src/fuel/fuel-plugin.ts +71 -73
  301. package/src/fuel/fuel-processor-template.ts +10 -7
  302. package/src/fuel/fuel-processor.ts +35 -23
  303. package/src/fuel/global-processor.ts +3 -3
  304. package/src/fuel/types.ts +10 -4
  305. package/src/iota/context.ts +8 -7
  306. package/src/iota/iota-object-processor-template.ts +25 -15
  307. package/src/iota/iota-object-processor.ts +33 -22
  308. package/src/iota/iota-plugin-part.ts +41 -34
  309. package/src/iota/iota-processor.ts +35 -27
  310. package/src/iota/network.ts +2 -2
  311. package/src/move/filter.ts +1 -1
  312. package/src/move/index.ts +1 -1
  313. package/src/solana/codegen/codegen.ts +2 -2
  314. package/src/solana/solana-context.ts +4 -3
  315. package/src/solana/solana-plugin.ts +27 -24
  316. package/src/solana/solana-processor.ts +23 -11
  317. package/src/store/cache.ts +22 -18
  318. package/src/store/codegen.ts +2 -2
  319. package/src/store/convert.ts +68 -104
  320. package/src/store/decorators.ts +3 -2
  321. package/src/store/store.ts +31 -23
  322. package/src/store/types.ts +24 -33
  323. package/src/store/util.ts +13 -18
  324. package/src/sui/context.ts +8 -7
  325. package/src/sui/sui-object-processor-template.ts +25 -15
  326. package/src/sui/sui-object-processor.ts +33 -22
  327. package/src/sui/sui-plugin-part.ts +41 -34
  328. package/src/sui/sui-plugin.ts +49 -47
  329. package/src/sui/sui-processor.ts +35 -27
  330. package/src/testing/aptos-facet.ts +18 -11
  331. package/src/testing/cosmos-facet.ts +10 -6
  332. package/src/testing/eth-facet.ts +40 -18
  333. package/src/testing/fuel-facet.ts +28 -18
  334. package/src/testing/iota-facet.ts +32 -20
  335. package/src/testing/memory-database.ts +109 -82
  336. package/src/testing/metric-utils.ts +15 -14
  337. package/src/testing/solana-facet.ts +11 -6
  338. package/src/testing/sui-facet.ts +30 -20
  339. package/src/testing/test-processor-server.ts +64 -58
  340. package/src/utils/price.ts +20 -13
@@ -1,4 +1,11 @@
1
- import { HandleInterval, MoveAccountFetchConfig, MoveFetchConfig, TemplateInstance } from '@sentio/protos'
1
+ import {
2
+ type HandleInterval,
3
+ HandleIntervalSchema,
4
+ type MoveAccountFetchConfig,
5
+ type MoveFetchConfig,
6
+ TemplateInstanceSchema
7
+ } from '@sentio/protos'
8
+ import { create } from '@bufbuild/protobuf'
2
9
  import { ListStateStorage, processMetrics } from '@sentio/runtime'
3
10
  import { IotaAddressContext, IotaContext, IotaObjectContext } from './context.js'
4
11
  import { IotaMoveObject, IotaTransactionBlockResponse } from '@iota/iota-sdk/client'
@@ -14,7 +21,7 @@ import {
14
21
  } from './iota-object-processor.js'
15
22
  import { IotaBindOptions } from './iota-processor.js'
16
23
  import { TransactionFilter, accountAddressString } from '../move/index.js'
17
- import { ServerError, Status } from 'nice-grpc'
24
+ import { ConnectError, Code } from '@connectrpc/connect'
18
25
  import { getHandlerName, proxyProcessor } from '../utils/metrics.js'
19
26
 
20
27
  class ObjectHandler<HandlerType> {
@@ -55,11 +62,11 @@ export abstract class IotaObjectOrAddressProcessorTemplate<
55
62
  let id = (options as IotaObjectBindOptions).objectId || (options as IotaBindOptions).address
56
63
 
57
64
  if (id === '*') {
58
- throw new ServerError(Status.INVALID_ARGUMENT, "can't bind template instance with *")
65
+ throw new ConnectError("can't bind template instance with *", Code.InvalidArgument)
59
66
  }
60
67
  id = accountAddressString(id)
61
68
 
62
- const instance: TemplateInstance = {
69
+ const instance = create(TemplateInstanceSchema, {
63
70
  templateId: this.id,
64
71
  contract: {
65
72
  name: '',
@@ -70,7 +77,7 @@ export abstract class IotaObjectOrAddressProcessorTemplate<
70
77
  startBlock: options.startCheckpoint || 0n,
71
78
  endBlock: options.endCheckpoint || 0n,
72
79
  baseLabels: options.baseLabels
73
- }
80
+ })
74
81
 
75
82
  ctx.sendTemplateInstance(instance)
76
83
 
@@ -92,7 +99,7 @@ export abstract class IotaObjectOrAddressProcessorTemplate<
92
99
  let id = (options as IotaObjectBindOptions).objectId || (options as IotaBindOptions).address
93
100
 
94
101
  if (id === '*') {
95
- throw new ServerError(Status.INVALID_ARGUMENT, "can't bind template instance with *")
102
+ throw new ConnectError("can't bind template instance with *", Code.InvalidArgument)
96
103
  }
97
104
  id = accountAddressString(id)
98
105
 
@@ -123,7 +130,7 @@ export abstract class IotaObjectOrAddressProcessorTemplate<
123
130
  let id = (options as IotaObjectBindOptions).objectId || (options as IotaBindOptions).address
124
131
 
125
132
  if (id === '*') {
126
- throw new ServerError(Status.INVALID_ARGUMENT, "can't delete template instance bind with *")
133
+ throw new ConnectError("can't delete template instance bind with *", Code.InvalidArgument)
127
134
  }
128
135
  id = accountAddressString(id)
129
136
 
@@ -147,9 +154,9 @@ export abstract class IotaObjectOrAddressProcessorTemplate<
147
154
  }
148
155
 
149
156
  if (deleted !== 1) {
150
- throw new ServerError(
151
- Status.INVALID_ARGUMENT,
152
- `Failed to delete processor for template ${this.id}, ${sig}. deleted ${deleted} times`
157
+ throw new ConnectError(
158
+ `Failed to delete processor for template ${this.id}, ${sig}. deleted ${deleted} times`,
159
+ Code.InvalidArgument
153
160
  )
154
161
  }
155
162
 
@@ -161,7 +168,7 @@ export abstract class IotaObjectOrAddressProcessorTemplate<
161
168
  }
162
169
  })
163
170
  ctx.sendTemplateInstance(
164
- {
171
+ create(TemplateInstanceSchema, {
165
172
  templateId: this.id,
166
173
  contract: {
167
174
  name: '',
@@ -172,7 +179,7 @@ export abstract class IotaObjectOrAddressProcessorTemplate<
172
179
  startBlock: options.startCheckpoint || 0n,
173
180
  endBlock: options.endCheckpoint || 0n,
174
181
  baseLabels: options.baseLabels
175
- },
182
+ }),
176
183
  true
177
184
  )
178
185
  }
@@ -204,10 +211,10 @@ export abstract class IotaObjectOrAddressProcessorTemplate<
204
211
  ): this {
205
212
  return this.onInterval(
206
213
  handler,
207
- {
214
+ create(HandleIntervalSchema, {
208
215
  recentInterval: timeIntervalInMinutes,
209
216
  backfillInterval: backfillTimeIntervalInMinutes
210
- },
217
+ }),
211
218
  undefined,
212
219
  type,
213
220
  fetchConfig
@@ -224,7 +231,10 @@ export abstract class IotaObjectOrAddressProcessorTemplate<
224
231
  return this.onInterval(
225
232
  handler,
226
233
  undefined,
227
- { recentInterval: checkpointInterval, backfillInterval: backfillCheckpointInterval },
234
+ create(HandleIntervalSchema, {
235
+ recentInterval: checkpointInterval,
236
+ backfillInterval: backfillCheckpointInterval
237
+ }),
228
238
  type,
229
239
  fetchConfig
230
240
  )
@@ -1,13 +1,18 @@
1
1
  import {
2
- Data_SuiCall,
3
- Data_SuiObject,
4
- Data_SuiObjectChange,
5
- HandleInterval,
6
- MoveAccountFetchConfig,
7
- MoveFetchConfig,
2
+ type Data_SuiCall,
3
+ type Data_SuiObject,
4
+ type Data_SuiObjectChange,
5
+ type HandleInterval,
6
+ HandleIntervalSchema,
7
+ type MoveAccountFetchConfig,
8
+ MoveAccountFetchConfigSchema,
9
+ type MoveFetchConfig,
10
+ MoveFetchConfigSchema,
8
11
  MoveOwnerType,
9
- ProcessResult
12
+ type ProcessResult,
13
+ timestampDate
10
14
  } from '@sentio/protos'
15
+ import { create } from '@bufbuild/protobuf'
11
16
  import { ListStateStorage } from '@sentio/runtime'
12
17
  import { IotaNetwork } from './network.js'
13
18
  import { IotaAddressContext, IotaContext, IotaObjectChangeContext, IotaObjectContext } from './context.js'
@@ -15,7 +20,7 @@ import { IotaMoveObject, IotaObjectChange, IotaTransactionBlockResponse } from '
15
20
  import { ALL_ADDRESS, PromiseOrVoid } from '../core/index.js'
16
21
  import { configure, DEFAULT_FETCH_CONFIG, IndexConfigure, IotaBindOptions } from './iota-processor.js'
17
22
  import { CallHandler, TransactionFilter, accountTypeString, ObjectChangeHandler } from '../move/index.js'
18
- import { ServerError, Status } from 'nice-grpc'
23
+ import { ConnectError, Code } from '@connectrpc/connect'
19
24
  import { TypeDescriptor } from '@typemove/move'
20
25
  import { TypedIotaMoveObject } from './models.js'
21
26
  import { getHandlerName, proxyProcessor } from '../utils/metrics.js'
@@ -45,9 +50,9 @@ interface ObjectHandler {
45
50
  handlerName: string
46
51
  }
47
52
 
48
- export const DEFAULT_ACCOUNT_FETCH_CONFIG: MoveAccountFetchConfig = {
53
+ export const DEFAULT_ACCOUNT_FETCH_CONFIG: MoveAccountFetchConfig = create(MoveAccountFetchConfigSchema, {
49
54
  owned: false
50
- }
55
+ })
51
56
 
52
57
  export class IotaAccountProcessorState extends ListStateStorage<IotaBaseObjectOrAddressProcessor<any>> {
53
58
  static INSTANCE = new IotaAccountProcessorState()
@@ -112,7 +117,7 @@ export abstract class IotaBaseObjectOrAddressProcessor<HandlerType> {
112
117
  data.objectId,
113
118
  data.objectVersion,
114
119
  data.slot,
115
- data.timestamp || new Date(0),
120
+ data.timestamp ? timestampDate(data.timestamp) : new Date(0),
116
121
  processor.config.baseLabels
117
122
  )
118
123
  await processor.doHandle(handler, data, ctx)
@@ -139,10 +144,10 @@ abstract class IotaBaseObjectOrAddressProcessorInternal<
139
144
  ): this {
140
145
  return this.onInterval(
141
146
  handler,
142
- {
147
+ create(HandleIntervalSchema, {
143
148
  recentInterval: timeIntervalInMinutes,
144
149
  backfillInterval: backfillTimeIntervalInMinutes
145
- },
150
+ }),
146
151
  undefined,
147
152
  type,
148
153
  fetchConfig
@@ -159,7 +164,10 @@ abstract class IotaBaseObjectOrAddressProcessorInternal<
159
164
  return this.onInterval(
160
165
  handler,
161
166
  undefined,
162
- { recentInterval: checkpointInterval, backfillInterval: backfillCheckpointInterval },
167
+ create(HandleIntervalSchema, {
168
+ recentInterval: checkpointInterval,
169
+ backfillInterval: backfillCheckpointInterval
170
+ }),
163
171
  type,
164
172
  fetchConfig
165
173
  )
@@ -188,7 +196,7 @@ export class IotaAddressProcessor extends IotaBaseObjectOrAddressProcessorIntern
188
196
  filter?: TransactionFilter,
189
197
  fetchConfig?: Partial<MoveFetchConfig>
190
198
  ) {
191
- const _fetchConfig = MoveFetchConfig.fromPartial({ ...DEFAULT_FETCH_CONFIG, ...fetchConfig })
199
+ const _fetchConfig = create(MoveFetchConfigSchema, { ...DEFAULT_FETCH_CONFIG, ...fetchConfig })
192
200
  const _filter: TransactionFilter = {
193
201
  fromAndToAddress: {
194
202
  from: '',
@@ -203,7 +211,7 @@ export class IotaAddressProcessor extends IotaBaseObjectOrAddressProcessorIntern
203
211
  handlerName: getHandlerName(),
204
212
  handler: async function (data) {
205
213
  if (!data.rawTransaction) {
206
- throw new ServerError(Status.INVALID_ARGUMENT, 'transaction is null')
214
+ throw new ConnectError('transaction is null', Code.InvalidArgument)
207
215
  }
208
216
  const tx = JSON.parse(data.rawTransaction) as IotaTransactionBlockResponse
209
217
 
@@ -211,7 +219,7 @@ export class IotaAddressProcessor extends IotaBaseObjectOrAddressProcessorIntern
211
219
  'object',
212
220
  processor.config.network,
213
221
  processor.config.address,
214
- data.timestamp || new Date(0),
222
+ data.timestamp ? timestampDate(data.timestamp) : new Date(0),
215
223
  data.slot,
216
224
  tx,
217
225
  0,
@@ -297,7 +305,7 @@ export class IotaObjectTypeProcessor<T> extends IotaBaseObjectOrAddressProcessor
297
305
 
298
306
  public onObjectChange(handler: (changes: IotaObjectChange[], ctx: IotaObjectChangeContext) => PromiseOrVoid): this {
299
307
  if (this.config.network === IotaNetwork.TEST_NET) {
300
- throw new ServerError(Status.INVALID_ARGUMENT, 'object change not supported in testnet')
308
+ throw new ConnectError('object change not supported in testnet', Code.InvalidArgument)
301
309
  }
302
310
  const processor = this
303
311
  this.objectChangeHandlers.push({
@@ -306,7 +314,7 @@ export class IotaObjectTypeProcessor<T> extends IotaBaseObjectOrAddressProcessor
306
314
  const ctx = new IotaObjectChangeContext(
307
315
  processor.config.network,
308
316
  processor.config.address,
309
- data.timestamp || new Date(0),
317
+ data.timestamp ? timestampDate(data.timestamp) : new Date(0),
310
318
  data.slot,
311
319
  data.txDigest,
312
320
  processor.config.baseLabels
@@ -332,10 +340,10 @@ export class IotaObjectTypeProcessor<T> extends IotaBaseObjectOrAddressProcessor
332
340
  ): this {
333
341
  return this.onInterval(
334
342
  handler,
335
- {
343
+ create(HandleIntervalSchema, {
336
344
  recentInterval: timeIntervalInMinutes,
337
345
  backfillInterval: backfillTimeIntervalInMinutes
338
- },
346
+ }),
339
347
  undefined,
340
348
  this.objectType.getSignature(),
341
349
  fetchConfig
@@ -355,7 +363,10 @@ export class IotaObjectTypeProcessor<T> extends IotaBaseObjectOrAddressProcessor
355
363
  return this.onInterval(
356
364
  handler,
357
365
  undefined,
358
- { recentInterval: checkpointInterval, backfillInterval: backfillCheckpointInterval },
366
+ create(HandleIntervalSchema, {
367
+ recentInterval: checkpointInterval,
368
+ backfillInterval: backfillCheckpointInterval
369
+ }),
359
370
  this.objectType.qname,
360
371
  fetchConfig
361
372
  )
@@ -1,15 +1,20 @@
1
1
  import { USER_PROCESSOR } from '@sentio/runtime'
2
2
  import {
3
- AccountConfig,
4
- ContractConfig,
3
+ AccountConfigSchema,
4
+ ContractConfigSchema,
5
5
  HandlerType,
6
- InitResponse,
7
- MoveCallHandlerConfig,
8
- MoveEventHandlerConfig,
9
- MoveResourceChangeConfig,
10
- ProcessConfigResponse,
11
- StartRequest
6
+ type InitResponse,
7
+ type MoveCallHandlerConfig,
8
+ MoveCallHandlerConfigSchema,
9
+ type MoveEventHandlerConfig,
10
+ MoveEventHandlerConfigSchema,
11
+ MoveOnIntervalConfigSchema,
12
+ type MoveResourceChangeConfig,
13
+ MoveResourceChangeConfigSchema,
14
+ type ProcessConfigResponse,
15
+ type StartRequest
12
16
  } from '@sentio/protos'
17
+ import { create } from '@bufbuild/protobuf'
13
18
 
14
19
  import { PartitionHandlerManager } from '../core/index.js'
15
20
  import { HandlerRegister } from '../core/handler-register.js'
@@ -75,7 +80,7 @@ export class IotaPluginPart {
75
80
  if (forChainId !== undefined && forChainId !== chainId.toString()) {
76
81
  continue
77
82
  }
78
- const contractConfig = ContractConfig.fromPartial({
83
+ const contractConfig = create(ContractConfigSchema, {
79
84
  transactionConfig: [],
80
85
  processorType: USER_PROCESSOR,
81
86
  contract: {
@@ -90,7 +95,7 @@ export class IotaPluginPart {
90
95
  for (const handler of suiProcessor.eventHandlers) {
91
96
  const handlerId = this.handlerRegister.register(handler.handler, chainId)
92
97
  this.partitionManager.registerPartitionHandler(HandlerType.SUI_EVENT, handlerId, handler.partitionHandler)
93
- const eventHandlerConfig: MoveEventHandlerConfig = {
98
+ const eventHandlerConfig: MoveEventHandlerConfig = create(MoveEventHandlerConfigSchema, {
94
99
  filters: handler.filters.map((f) => {
95
100
  return {
96
101
  type: f.type,
@@ -101,13 +106,13 @@ export class IotaPluginPart {
101
106
  fetchConfig: handler.fetchConfig,
102
107
  handlerId,
103
108
  handlerName: handler.handlerName
104
- }
109
+ })
105
110
  contractConfig.moveEventConfigs.push(eventHandlerConfig)
106
111
  }
107
112
  for (const handler of suiProcessor.callHandlers) {
108
113
  const handlerId = this.handlerRegister.register(handler.handler, chainId)
109
114
  this.partitionManager.registerPartitionHandler(HandlerType.SUI_CALL, handlerId, handler.partitionHandler)
110
- const functionHandlerConfig: MoveCallHandlerConfig = {
115
+ const functionHandlerConfig: MoveCallHandlerConfig = create(MoveCallHandlerConfigSchema, {
111
116
  filters: handler.filters.map((filter) => {
112
117
  return {
113
118
  function: filter.function,
@@ -121,18 +126,18 @@ export class IotaPluginPart {
121
126
  fetchConfig: handler.fetchConfig,
122
127
  handlerId,
123
128
  handlerName: handler.handlerName
124
- }
129
+ })
125
130
  contractConfig.moveCallConfigs.push(functionHandlerConfig)
126
131
  }
127
132
  // deprecated, use objectType processor instead
128
133
  for (const handler of suiProcessor.objectChangeHandlers) {
129
134
  const handlerId = this.handlerRegister.register(handler.handler, chainId)
130
- const objectChangeHandler: MoveResourceChangeConfig = {
135
+ const objectChangeHandler: MoveResourceChangeConfig = create(MoveResourceChangeConfigSchema, {
131
136
  types: typeof handler.type === 'string' ? [handler.type] : handler.type,
132
137
  handlerId,
133
138
  handlerName: handler.handlerName,
134
139
  includeDeleted: false
135
- }
140
+ })
136
141
  contractConfig.moveResourceChangeConfigs.push(objectChangeHandler)
137
142
  }
138
143
  config.contractConfigs.push(contractConfig)
@@ -143,7 +148,7 @@ export class IotaPluginPart {
143
148
  if (forChainId !== undefined && forChainId !== chainId.toString()) {
144
149
  continue
145
150
  }
146
- const accountConfig = AccountConfig.fromPartial({
151
+ const accountConfig = create(AccountConfigSchema, {
147
152
  address: processor.config.address,
148
153
  chainId: processor.getChainId(),
149
154
  startBlock: processor.config.startCheckpoint, // TODO maybe use another field
@@ -152,39 +157,41 @@ export class IotaPluginPart {
152
157
 
153
158
  for (const handler of processor.objectChangeHandlers) {
154
159
  const handlerId = this.handlerRegister.register(handler.handler, chainId)
155
- const objectChangeHandler: MoveResourceChangeConfig = {
160
+ const objectChangeHandler: MoveResourceChangeConfig = create(MoveResourceChangeConfigSchema, {
156
161
  types: typeof handler.type === 'string' ? [handler.type] : handler.type,
157
162
  handlerId,
158
163
  handlerName: handler.handlerName,
159
164
  includeDeleted: false
160
- }
165
+ })
161
166
  accountConfig.moveResourceChangeConfigs.push(objectChangeHandler)
162
167
  }
163
168
 
164
169
  for (const handler of processor.objectHandlers) {
165
170
  const handlerId = this.handlerRegister.register(handler.handler, chainId)
166
171
 
167
- accountConfig.moveIntervalConfigs.push({
168
- intervalConfig: {
169
- handlerId: handlerId,
170
- handlerName: handler.handlerName,
171
- minutes: 0,
172
- minutesInterval: handler.timeIntervalInMinutes,
173
- slot: 0,
174
- slotInterval: handler.checkPointInterval,
172
+ accountConfig.moveIntervalConfigs.push(
173
+ create(MoveOnIntervalConfigSchema, {
174
+ intervalConfig: {
175
+ handlerId: handlerId,
176
+ handlerName: handler.handlerName,
177
+ minutes: 0,
178
+ minutesInterval: handler.timeIntervalInMinutes,
179
+ slot: 0,
180
+ slotInterval: handler.checkPointInterval,
181
+ fetchConfig: undefined
182
+ },
183
+ type: handler.type || '',
184
+ ownerType: processor.ownerType,
185
+ resourceFetchConfig: handler.fetchConfig,
175
186
  fetchConfig: undefined
176
- },
177
- type: handler.type || '',
178
- ownerType: processor.ownerType,
179
- resourceFetchConfig: handler.fetchConfig,
180
- fetchConfig: undefined
181
- })
187
+ })
188
+ )
182
189
  }
183
190
 
184
191
  if (processor instanceof IotaAddressProcessor) {
185
192
  for (const handler of processor.callHandlers) {
186
193
  const handlerId = this.handlerRegister.register(handler.handler, chainId)
187
- const functionHandlerConfig: MoveCallHandlerConfig = {
194
+ const functionHandlerConfig: MoveCallHandlerConfig = create(MoveCallHandlerConfigSchema, {
188
195
  filters: handler.filters.map((filter) => {
189
196
  return {
190
197
  function: filter.function,
@@ -198,7 +205,7 @@ export class IotaPluginPart {
198
205
  fetchConfig: handler.fetchConfig,
199
206
  handlerId,
200
207
  handlerName: handler.handlerName
201
- }
208
+ })
202
209
  accountConfig.moveCallConfigs.push(functionHandlerConfig)
203
210
  }
204
211
  }
@@ -1,7 +1,15 @@
1
- import { Data_SuiCall, Data_SuiEvent, Data_SuiObjectChange, MoveFetchConfig } from '@sentio/protos'
1
+ import {
2
+ type Data_SuiCall,
3
+ type Data_SuiEvent,
4
+ type Data_SuiObjectChange,
5
+ type MoveFetchConfig,
6
+ MoveFetchConfigSchema,
7
+ timestampDate
8
+ } from '@sentio/protos'
9
+ import { create } from '@bufbuild/protobuf'
2
10
  import { ListStateStorage } from '@sentio/runtime'
3
11
  import { IotaNetwork } from './network.js'
4
- import { ServerError, Status } from 'nice-grpc'
12
+ import { ConnectError, Code } from '@connectrpc/connect'
5
13
  import { IotaContext, IotaObjectChangeContext } from './context.js'
6
14
  import {
7
15
  MoveCallIotaTransaction,
@@ -26,11 +34,11 @@ import { Required } from 'utility-types'
26
34
  import { getHandlerName, proxyProcessor } from '../utils/metrics.js'
27
35
  import { HandlerOptions } from './models.js'
28
36
 
29
- export const DEFAULT_FETCH_CONFIG: MoveFetchConfig = {
37
+ export const DEFAULT_FETCH_CONFIG: MoveFetchConfig = create(MoveFetchConfigSchema, {
30
38
  resourceChanges: false,
31
39
  allEvents: true,
32
40
  inputs: true
33
- }
41
+ })
34
42
 
35
43
  export type IndexConfigure = Required<IotaBindOptions, 'startCheckpoint' | 'network'>
36
44
 
@@ -79,13 +87,13 @@ export class IotaBaseProcessor {
79
87
  return this.config.network
80
88
  }
81
89
 
82
- protected onMoveEvent(
83
- handler: (event: IotaEvent, ctx: IotaContext) => PromiseOrVoid,
90
+ protected onMoveEvent<T extends IotaEvent = IotaEvent>(
91
+ handler: (event: T, ctx: IotaContext) => PromiseOrVoid,
84
92
  filter: EventFilter | EventFilter[],
85
- handlerOptions?: HandlerOptions<MoveFetchConfig, IotaEvent>
93
+ handlerOptions?: HandlerOptions<MoveFetchConfig, T>
86
94
  ): IotaBaseProcessor {
87
95
  let _filters: EventFilter[] = []
88
- const _fetchConfig = MoveFetchConfig.fromPartial({ ...DEFAULT_FETCH_CONFIG, ...handlerOptions })
96
+ const _fetchConfig = create(MoveFetchConfigSchema, { ...DEFAULT_FETCH_CONFIG, ...handlerOptions })
89
97
 
90
98
  if (Array.isArray(filter)) {
91
99
  _filters = filter
@@ -102,7 +110,7 @@ export class IotaBaseProcessor {
102
110
  handlerName: getHandlerName(),
103
111
  handler: async function (data) {
104
112
  if (!data.rawTransaction) {
105
- throw new ServerError(Status.INVALID_ARGUMENT, 'event is null')
113
+ throw new ConnectError('event is null', Code.InvalidArgument)
106
114
  }
107
115
  const txn = JSON.parse(data.rawTransaction) as IotaTransactionBlockResponse
108
116
  if (txn.events == null) {
@@ -116,7 +124,7 @@ export class IotaBaseProcessor {
116
124
  processor.moduleName,
117
125
  processor.config.network,
118
126
  processor.config.address,
119
- data.timestamp || new Date(0),
127
+ data.timestamp ? timestampDate(data.timestamp) : new Date(0),
120
128
  data.slot,
121
129
  txn,
122
130
  idx,
@@ -124,7 +132,7 @@ export class IotaBaseProcessor {
124
132
  )
125
133
 
126
134
  const decoded = await processor.coder.decodeEvent<any>(evt)
127
- await handler(decoded || evt, ctx)
135
+ await handler((decoded || evt) as T, ctx)
128
136
 
129
137
  return ctx.stopAndGetResult()
130
138
  },
@@ -136,7 +144,7 @@ export class IotaBaseProcessor {
136
144
  if (typeof p === 'function') {
137
145
  const evt = JSON.parse(data.rawEvent) as IotaEvent
138
146
  const decoded = await processor.coder.decodeEvent<any>(evt)
139
- return p(decoded || evt)
147
+ return p((decoded || evt) as T)
140
148
  }
141
149
  return p
142
150
  }
@@ -144,13 +152,13 @@ export class IotaBaseProcessor {
144
152
  return this
145
153
  }
146
154
 
147
- protected onEntryFunctionCall(
148
- handler: (call: MoveCallIotaTransaction, ctx: IotaContext) => PromiseOrVoid,
155
+ protected onEntryFunctionCall<T extends MoveCallIotaTransaction = MoveCallIotaTransaction>(
156
+ handler: (call: T, ctx: IotaContext) => PromiseOrVoid,
149
157
  filter: FunctionNameAndCallFilter | FunctionNameAndCallFilter[],
150
- handlerOptions?: HandlerOptions<MoveFetchConfig, MoveCallIotaTransaction>
158
+ handlerOptions?: HandlerOptions<MoveFetchConfig, T>
151
159
  ): IotaBaseProcessor {
152
160
  let _filters: FunctionNameAndCallFilter[] = []
153
- const _fetchConfig = MoveFetchConfig.fromPartial({ ...DEFAULT_FETCH_CONFIG, ...handlerOptions })
161
+ const _fetchConfig = create(MoveFetchConfigSchema, { ...DEFAULT_FETCH_CONFIG, ...handlerOptions })
154
162
 
155
163
  if (Array.isArray(filter)) {
156
164
  _filters = filter
@@ -165,7 +173,7 @@ export class IotaBaseProcessor {
165
173
  handlerName: getHandlerName(),
166
174
  handler: async function (data) {
167
175
  if (!data.rawTransaction) {
168
- throw new ServerError(Status.INVALID_ARGUMENT, 'call is null')
176
+ throw new ConnectError('call is null', Code.InvalidArgument)
169
177
  }
170
178
  const tx = JSON.parse(data.rawTransaction) as IotaTransactionBlockResponse
171
179
 
@@ -173,7 +181,7 @@ export class IotaBaseProcessor {
173
181
  processor.moduleName,
174
182
  processor.config.network,
175
183
  processor.config.address,
176
- data.timestamp || new Date(0),
184
+ data.timestamp ? timestampDate(data.timestamp) : new Date(0),
177
185
  data.slot,
178
186
  tx,
179
187
  0,
@@ -183,7 +191,7 @@ export class IotaBaseProcessor {
183
191
  const calls: MoveCallIotaTransaction[] = getMoveCalls(tx)
184
192
  const txKind = tx.transaction?.data?.transaction
185
193
  if (!txKind) {
186
- throw new ServerError(Status.INVALID_ARGUMENT, 'Unexpected getTransactionKind get empty')
194
+ throw new ConnectError('Unexpected getTransactionKind get empty', Code.InvalidArgument)
187
195
  }
188
196
 
189
197
  // getProgrammableTransaction(txKind)
@@ -198,7 +206,7 @@ export class IotaBaseProcessor {
198
206
 
199
207
  // TODO maybe do in parallel
200
208
  const decoded = await processor.coder.decodeFunctionPayload(call, programmableTx?.inputs || [])
201
- await handler(decoded, ctx)
209
+ await handler(decoded as T, ctx)
202
210
  }
203
211
  }
204
212
  return ctx.stopAndGetResult()
@@ -213,7 +221,7 @@ export class IotaBaseProcessor {
213
221
  const calls: MoveCallIotaTransaction[] = getMoveCalls(tx)
214
222
  // For simplicity, use the first call for partitioning
215
223
  if (calls.length > 0) {
216
- return p(calls[0])
224
+ return p(calls[0] as T)
217
225
  }
218
226
  return undefined
219
227
  }
@@ -236,7 +244,7 @@ export class IotaBaseProcessor {
236
244
  filter?: TransactionFilter,
237
245
  handlerOptions?: HandlerOptions<MoveFetchConfig, IotaTransactionBlockResponse>
238
246
  ): this {
239
- const _fetchConfig = MoveFetchConfig.fromPartial({ ...DEFAULT_FETCH_CONFIG, ...handlerOptions })
247
+ const _fetchConfig = create(MoveFetchConfigSchema, { ...DEFAULT_FETCH_CONFIG, ...handlerOptions })
240
248
 
241
249
  const processor = this
242
250
 
@@ -244,7 +252,7 @@ export class IotaBaseProcessor {
244
252
  handlerName: getHandlerName(),
245
253
  handler: async function (data) {
246
254
  if (!data.rawTransaction) {
247
- throw new ServerError(Status.INVALID_ARGUMENT, 'transaction is null')
255
+ throw new ConnectError('transaction is null', Code.InvalidArgument)
248
256
  }
249
257
  const tx = JSON.parse(data.rawTransaction) as IotaTransactionBlockResponse
250
258
 
@@ -252,7 +260,7 @@ export class IotaBaseProcessor {
252
260
  processor.moduleName,
253
261
  processor.config.network,
254
262
  processor.config.address,
255
- data.timestamp || new Date(0),
263
+ data.timestamp ? timestampDate(data.timestamp) : new Date(0),
256
264
  data.slot,
257
265
  tx,
258
266
  0,
@@ -283,7 +291,7 @@ export class IotaBaseProcessor {
283
291
  type: string | string[]
284
292
  ): this {
285
293
  if (this.config.network === IotaNetwork.TEST_NET) {
286
- throw new ServerError(Status.INVALID_ARGUMENT, 'object change not supported in testnet')
294
+ throw new ConnectError('object change not supported in testnet', Code.InvalidArgument)
287
295
  }
288
296
  const processor = this
289
297
  this.objectChangeHandlers.push({
@@ -292,7 +300,7 @@ export class IotaBaseProcessor {
292
300
  const ctx = new IotaObjectChangeContext(
293
301
  processor.config.network,
294
302
  processor.config.address,
295
- data.timestamp || new Date(0),
303
+ data.timestamp ? timestampDate(data.timestamp) : new Date(0),
296
304
  data.slot,
297
305
  data.txDigest,
298
306
  processor.config.baseLabels
@@ -324,7 +332,7 @@ export class IotaGlobalProcessor extends IotaBaseProcessor {
324
332
  ): this {
325
333
  // TODO enable more strict check
326
334
  // if (!filter.publicKeyPrefix || filter.publicKeyPrefix.length < 2) {
327
- // throw new ServerError(Status.INVALID_ARGUMENT, 'restriction too low for global processor')
335
+ // throw new ConnectError('restriction too low for global processor', Code.InvalidArgument)
328
336
  // }
329
337
  return super.onTransactionBlock(handler, filter, fetchConfig)
330
338
  }
@@ -1,6 +1,6 @@
1
1
  import { SuiChainId } from '@sentio/chain'
2
2
  import { Endpoints } from '@sentio/runtime'
3
- // import { ServerError, Status } from 'nice-grpc'
3
+ // import { ConnectError, Code } from '@connectrpc/connect'
4
4
  import { IotaClient } from '@iota/iota-sdk/client'
5
5
 
6
6
  export type IotaNetwork = SuiChainId
@@ -13,7 +13,7 @@ export function getClient(network: IotaNetwork): IotaClient {
13
13
  let chainServer = Endpoints.INSTANCE.chainServer.get(network)
14
14
  if (!chainServer) {
15
15
  chainServer = getRpcEndpoint(network)
16
- // throw new ServerError(Status.INTERNAL, 'RPC endpoint not provided')
16
+ // throw new ConnectError('RPC endpoint not provided', Code.Internal)
17
17
  }
18
18
  return new IotaClient({ url: chainServer })
19
19
  }
@@ -1,5 +1,5 @@
1
1
  // TODO extends ArgumentsFilter
2
- import {
2
+ import type {
3
3
  Data_AptCall,
4
4
  Data_AptResource,
5
5
  HandleInterval,
package/src/move/index.ts CHANGED
@@ -3,4 +3,4 @@ export * from './move-context.js'
3
3
 
4
4
  export * from '@typemove/move'
5
5
 
6
- export { MoveFetchConfig } from '@sentio/protos'
6
+ export type { MoveFetchConfig } from '@sentio/protos'
@@ -12,12 +12,12 @@ import {
12
12
  } from '@anchor-lang/core'
13
13
  import { recursiveCodegen } from '../../core/codegen.js'
14
14
 
15
- export function codegen(abisDir: string, targetPath = path.join('src', 'types', 'solana'), genExample = false) {
15
+ export async function codegen(abisDir: string, targetPath = path.join('src', 'types', 'solana'), genExample = false) {
16
16
  if (!fs.existsSync(abisDir)) {
17
17
  return
18
18
  }
19
19
 
20
- const numFiles = recursiveCodegen(abisDir, targetPath, codegenInternal)
20
+ const numFiles = await recursiveCodegen(abisDir, targetPath, codegenInternal)
21
21
 
22
22
  console.log(chalk.green(`Generated ${numFiles} for Solana`))
23
23
  }