@sentio/sdk 2.3.6-rc.1 → 2.4.0-rc.1

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 (279) hide show
  1. package/lib/aptos/tests/aptos.test.js.map +1 -1
  2. package/lib/eth/account-processor.d.ts +2 -2
  3. package/lib/eth/account-processor.js +2 -2
  4. package/lib/eth/account-processor.js.map +1 -1
  5. package/lib/eth/builtin/eacaggregatorproxy.d.ts +2 -2
  6. package/lib/eth/builtin/eacaggregatorproxy.js +2 -2
  7. package/lib/eth/builtin/eacaggregatorproxy.js.map +1 -1
  8. package/lib/eth/builtin/erc1155.d.ts +2 -2
  9. package/lib/eth/builtin/erc1155.js +2 -2
  10. package/lib/eth/builtin/erc1155.js.map +1 -1
  11. package/lib/eth/builtin/erc20.d.ts +2 -2
  12. package/lib/eth/builtin/erc20.js +2 -2
  13. package/lib/eth/builtin/erc20.js.map +1 -1
  14. package/lib/eth/builtin/erc20bytes.d.ts +2 -2
  15. package/lib/eth/builtin/erc20bytes.js +2 -2
  16. package/lib/eth/builtin/erc20bytes.js.map +1 -1
  17. package/lib/eth/builtin/erc721.d.ts +2 -2
  18. package/lib/eth/builtin/erc721.js +2 -2
  19. package/lib/eth/builtin/erc721.js.map +1 -1
  20. package/lib/eth/builtin/internal/{eacaggregatorproxy_processor.d.ts → eacaggregatorproxy-processor.d.ts} +0 -0
  21. package/lib/eth/builtin/internal/{eacaggregatorproxy_processor.js → eacaggregatorproxy-processor.js} +1 -1
  22. package/lib/eth/builtin/internal/{eacaggregatorproxy_processor.js.map → eacaggregatorproxy-processor.js.map} +1 -1
  23. package/lib/eth/builtin/internal/{eacaggregatorproxy_test-utils.d.ts → eacaggregatorproxy-test-utils.d.ts} +0 -0
  24. package/lib/eth/builtin/internal/{eacaggregatorproxy_test-utils.js → eacaggregatorproxy-test-utils.js} +2 -2
  25. package/lib/eth/builtin/internal/{eacaggregatorproxy_test-utils.js.map → eacaggregatorproxy-test-utils.js.map} +1 -1
  26. package/lib/eth/builtin/internal/{erc1155_processor.d.ts → erc1155-processor.d.ts} +0 -0
  27. package/lib/eth/builtin/internal/{erc1155_processor.js → erc1155-processor.js} +1 -1
  28. package/lib/eth/builtin/internal/{erc1155_processor.js.map → erc1155-processor.js.map} +1 -1
  29. package/lib/eth/builtin/internal/{erc1155_test-utils.d.ts → erc1155-test-utils.d.ts} +0 -0
  30. package/lib/eth/builtin/internal/{erc1155_test-utils.js → erc1155-test-utils.js} +2 -2
  31. package/lib/eth/builtin/internal/{erc1155_test-utils.js.map → erc1155-test-utils.js.map} +1 -1
  32. package/lib/eth/builtin/internal/{erc20_processor.d.ts → erc20-processor.d.ts} +0 -0
  33. package/lib/eth/builtin/internal/{erc20_processor.js → erc20-processor.js} +1 -1
  34. package/lib/eth/builtin/internal/{erc20_processor.js.map → erc20-processor.js.map} +1 -1
  35. package/lib/eth/builtin/internal/{erc20_test-utils.d.ts → erc20-test-utils.d.ts} +0 -0
  36. package/lib/eth/builtin/internal/{erc20_test-utils.js → erc20-test-utils.js} +2 -2
  37. package/lib/eth/builtin/internal/{erc20_test-utils.js.map → erc20-test-utils.js.map} +1 -1
  38. package/lib/eth/builtin/internal/{erc20bytes_processor.d.ts → erc20bytes-processor.d.ts} +0 -0
  39. package/lib/eth/builtin/internal/{erc20bytes_processor.js → erc20bytes-processor.js} +1 -1
  40. package/lib/eth/builtin/internal/{erc20bytes_processor.js.map → erc20bytes-processor.js.map} +1 -1
  41. package/lib/eth/builtin/internal/{erc20bytes_test-utils.d.ts → erc20bytes-test-utils.d.ts} +0 -0
  42. package/lib/eth/builtin/internal/{erc20bytes_test-utils.js → erc20bytes-test-utils.js} +2 -2
  43. package/lib/eth/builtin/internal/{erc20bytes_test-utils.js.map → erc20bytes-test-utils.js.map} +1 -1
  44. package/lib/eth/builtin/internal/{erc721_processor.d.ts → erc721-processor.d.ts} +0 -0
  45. package/lib/eth/builtin/internal/{erc721_processor.js → erc721-processor.js} +1 -1
  46. package/lib/eth/builtin/internal/{erc721_processor.js.map → erc721-processor.js.map} +1 -1
  47. package/lib/eth/builtin/internal/{erc721_test-utils.d.ts → erc721-test-utils.d.ts} +0 -0
  48. package/lib/eth/builtin/internal/{erc721_test-utils.js → erc721-test-utils.js} +2 -2
  49. package/lib/eth/builtin/internal/{erc721_test-utils.js.map → erc721-test-utils.js.map} +1 -1
  50. package/lib/eth/builtin/internal/{weth9_processor.d.ts → weth9-processor.d.ts} +0 -0
  51. package/lib/eth/builtin/internal/{weth9_processor.js → weth9-processor.js} +1 -1
  52. package/lib/eth/builtin/internal/{weth9_processor.js.map → weth9-processor.js.map} +1 -1
  53. package/lib/eth/builtin/internal/{weth9_test-utils.d.ts → weth9-test-utils.d.ts} +0 -0
  54. package/lib/eth/builtin/internal/{weth9_test-utils.js → weth9-test-utils.js} +2 -2
  55. package/lib/eth/builtin/internal/{weth9_test-utils.js.map → weth9-test-utils.js.map} +1 -1
  56. package/lib/eth/builtin/weth9.d.ts +2 -2
  57. package/lib/eth/builtin/weth9.js +2 -2
  58. package/lib/eth/builtin/weth9.js.map +1 -1
  59. package/lib/eth/codegen/ethers-sentio.js +2 -2
  60. package/lib/eth/codegen/ethers-sentio.js.map +1 -1
  61. package/lib/eth/codegen/file.js +3 -3
  62. package/lib/eth/codegen/file.js.map +1 -1
  63. package/lib/eth/generic-processor.test.js.map +1 -1
  64. package/lib/eth/tests/account.test.d.ts +1 -0
  65. package/lib/eth/tests/account.test.js.map +1 -0
  66. package/lib/eth/tests/codegen.test.d.ts +1 -0
  67. package/lib/eth/tests/codegen.test.js.map +1 -0
  68. package/lib/eth/tests/erc20-template.test.d.ts +1 -0
  69. package/lib/eth/tests/erc20-template.test.js.map +1 -0
  70. package/lib/eth/tests/erc20.d.ts +1 -0
  71. package/lib/eth/tests/erc20.js +52 -0
  72. package/lib/eth/tests/erc20.js.map +1 -0
  73. package/lib/eth/tests/erc20.test.d.ts +1 -0
  74. package/lib/eth/tests/erc20.test.js.map +1 -0
  75. package/lib/eth/tests/error-capture.test.d.ts +1 -0
  76. package/lib/eth/tests/error-capture.test.js.map +1 -0
  77. package/lib/eth/tests/logger.test.d.ts +1 -0
  78. package/lib/eth/tests/logger.test.js.map +1 -0
  79. package/lib/eth/tests/types/anyswaprouter.d.ts +3 -0
  80. package/lib/eth/tests/types/anyswaprouter.js +7 -0
  81. package/lib/eth/tests/types/anyswaprouter.js.map +1 -0
  82. package/lib/eth/tests/types/commitmentpool.d.ts +3 -0
  83. package/lib/eth/tests/types/commitmentpool.js +7 -0
  84. package/lib/eth/tests/types/commitmentpool.js.map +1 -0
  85. package/lib/eth/tests/types/index.d.ts +12 -0
  86. package/lib/eth/tests/types/index.js +16 -0
  87. package/lib/eth/tests/types/index.js.map +1 -0
  88. package/lib/eth/tests/types/internal/AnyswapRouter.d.ts +122 -0
  89. package/lib/eth/tests/types/internal/AnyswapRouter.js +2 -0
  90. package/lib/eth/tests/types/internal/AnyswapRouter.js.map +1 -0
  91. package/lib/eth/tests/types/internal/CommitmentPool.d.ts +176 -0
  92. package/lib/eth/tests/types/internal/CommitmentPool.js +2 -0
  93. package/lib/eth/tests/types/internal/CommitmentPool.js.map +1 -0
  94. package/lib/eth/tests/types/internal/MembershipStakerV3.d.ts +81 -0
  95. package/lib/eth/tests/types/internal/MembershipStakerV3.js +2 -0
  96. package/lib/eth/tests/types/internal/MembershipStakerV3.js.map +1 -0
  97. package/lib/eth/tests/types/internal/Pyth.d.ts +204 -0
  98. package/lib/eth/tests/types/internal/Pyth.js +2 -0
  99. package/lib/eth/tests/types/internal/Pyth.js.map +1 -0
  100. package/lib/eth/tests/types/internal/Seaport.d.ts +350 -0
  101. package/lib/eth/tests/types/internal/Seaport.js +2 -0
  102. package/lib/eth/tests/types/internal/Seaport.js.map +1 -0
  103. package/lib/eth/tests/types/internal/TokenExchange.d.ts +128 -0
  104. package/lib/eth/tests/types/internal/TokenExchange.js +2 -0
  105. package/lib/eth/tests/types/internal/TokenExchange.js.map +1 -0
  106. package/lib/eth/tests/types/internal/anyswaprouter-processor.d.ts +463 -0
  107. package/lib/eth/tests/types/internal/anyswaprouter-processor.js +425 -0
  108. package/lib/eth/tests/types/internal/anyswaprouter-processor.js.map +1 -0
  109. package/lib/eth/tests/types/internal/anyswaprouter-test-utils.d.ts +9 -0
  110. package/lib/eth/tests/types/internal/anyswaprouter-test-utils.js +124 -0
  111. package/lib/eth/tests/types/internal/anyswaprouter-test-utils.js.map +1 -0
  112. package/lib/eth/tests/types/internal/commitmentpool-processor.d.ts +348 -0
  113. package/lib/eth/tests/types/internal/commitmentpool-processor.js +607 -0
  114. package/lib/eth/tests/types/internal/commitmentpool-processor.js.map +1 -0
  115. package/lib/eth/tests/types/internal/commitmentpool-test-utils.d.ts +9 -0
  116. package/lib/eth/tests/types/internal/commitmentpool-test-utils.js +87 -0
  117. package/lib/eth/tests/types/internal/commitmentpool-test-utils.js.map +1 -0
  118. package/lib/eth/tests/types/internal/common.d.ts +10 -0
  119. package/lib/eth/tests/types/internal/common.js +8 -0
  120. package/lib/eth/tests/types/internal/common.js.map +1 -0
  121. package/lib/eth/tests/types/internal/factories/AnyswapRouter__factory.d.ts +988 -0
  122. package/lib/eth/tests/types/internal/factories/AnyswapRouter__factory.js +1269 -0
  123. package/lib/eth/tests/types/internal/factories/AnyswapRouter__factory.js.map +1 -0
  124. package/lib/eth/tests/types/internal/factories/CommitmentPool__factory.d.ts +792 -0
  125. package/lib/eth/tests/types/internal/factories/CommitmentPool__factory.js +1040 -0
  126. package/lib/eth/tests/types/internal/factories/CommitmentPool__factory.js.map +1 -0
  127. package/lib/eth/tests/types/internal/factories/MembershipStakerV3__factory.d.ts +549 -0
  128. package/lib/eth/tests/types/internal/factories/MembershipStakerV3__factory.js +721 -0
  129. package/lib/eth/tests/types/internal/factories/MembershipStakerV3__factory.js.map +1 -0
  130. package/lib/eth/tests/types/internal/factories/Pyth__factory.d.ts +1130 -0
  131. package/lib/eth/tests/types/internal/factories/Pyth__factory.js +1486 -0
  132. package/lib/eth/tests/types/internal/factories/Pyth__factory.js.map +1 -0
  133. package/lib/eth/tests/types/internal/factories/Seaport__factory.d.ts +2018 -0
  134. package/lib/eth/tests/types/internal/factories/Seaport__factory.js +2610 -0
  135. package/lib/eth/tests/types/internal/factories/Seaport__factory.js.map +1 -0
  136. package/lib/eth/tests/types/internal/factories/TokenExchange__factory.d.ts +651 -0
  137. package/lib/eth/tests/types/internal/factories/TokenExchange__factory.js +853 -0
  138. package/lib/eth/tests/types/internal/factories/TokenExchange__factory.js.map +1 -0
  139. package/lib/eth/tests/types/internal/factories/index.d.ts +6 -0
  140. package/lib/eth/tests/types/internal/factories/index.js +10 -0
  141. package/lib/eth/tests/types/internal/factories/index.js.map +1 -0
  142. package/lib/eth/tests/types/internal/index.d.ts +13 -0
  143. package/lib/eth/tests/types/internal/index.js +8 -0
  144. package/lib/eth/tests/types/internal/index.js.map +1 -0
  145. package/lib/eth/tests/types/internal/membershipstakerv3-processor.d.ts +287 -0
  146. package/lib/eth/tests/types/internal/membershipstakerv3-processor.js +596 -0
  147. package/lib/eth/tests/types/internal/membershipstakerv3-processor.js.map +1 -0
  148. package/lib/eth/tests/types/internal/membershipstakerv3-test-utils.d.ts +11 -0
  149. package/lib/eth/tests/types/internal/membershipstakerv3-test-utils.js +109 -0
  150. package/lib/eth/tests/types/internal/membershipstakerv3-test-utils.js.map +1 -0
  151. package/lib/eth/tests/types/internal/pyth-processor.d.ts +422 -0
  152. package/lib/eth/tests/types/internal/pyth-processor.js +890 -0
  153. package/lib/eth/tests/types/internal/pyth-processor.js.map +1 -0
  154. package/lib/eth/tests/types/internal/pyth-test-utils.d.ts +13 -0
  155. package/lib/eth/tests/types/internal/pyth-test-utils.js +131 -0
  156. package/lib/eth/tests/types/internal/pyth-test-utils.js.map +1 -0
  157. package/lib/eth/tests/types/internal/seaport-processor.d.ts +211 -0
  158. package/lib/eth/tests/types/internal/seaport-processor.js +237 -0
  159. package/lib/eth/tests/types/internal/seaport-processor.js.map +1 -0
  160. package/lib/eth/tests/types/internal/seaport-test-utils.d.ts +6 -0
  161. package/lib/eth/tests/types/internal/seaport-test-utils.js +61 -0
  162. package/lib/eth/tests/types/internal/seaport-test-utils.js.map +1 -0
  163. package/lib/eth/tests/types/internal/tokenexchange-processor.d.ts +334 -0
  164. package/lib/eth/tests/types/internal/tokenexchange-processor.js +667 -0
  165. package/lib/eth/tests/types/internal/tokenexchange-processor.js.map +1 -0
  166. package/lib/eth/tests/types/internal/tokenexchange-test-utils.d.ts +13 -0
  167. package/lib/eth/tests/types/internal/tokenexchange-test-utils.js +149 -0
  168. package/lib/eth/tests/types/internal/tokenexchange-test-utils.js.map +1 -0
  169. package/lib/eth/tests/types/membershipstakerv3.d.ts +3 -0
  170. package/lib/eth/tests/types/membershipstakerv3.js +7 -0
  171. package/lib/eth/tests/types/membershipstakerv3.js.map +1 -0
  172. package/lib/eth/tests/types/pyth.d.ts +3 -0
  173. package/lib/eth/tests/types/pyth.js +7 -0
  174. package/lib/eth/tests/types/pyth.js.map +1 -0
  175. package/lib/eth/tests/types/seaport.d.ts +3 -0
  176. package/lib/eth/tests/types/seaport.js +7 -0
  177. package/lib/eth/tests/types/seaport.js.map +1 -0
  178. package/lib/eth/tests/types/tokenexchange.d.ts +3 -0
  179. package/lib/eth/tests/types/tokenexchange.js +7 -0
  180. package/lib/eth/tests/types/tokenexchange.js.map +1 -0
  181. package/lib/solana/builtin/types.d.ts +8 -8
  182. package/lib/solana/tests/solana.test.js.map +1 -1
  183. package/lib/sui/sui-processor.js +2 -8
  184. package/lib/sui/sui-processor.js.map +1 -1
  185. package/lib/sui/tests/sui.test.js.map +1 -1
  186. package/lib/sui/utils.d.ts +2 -0
  187. package/lib/sui/utils.js +11 -0
  188. package/lib/sui/utils.js.map +1 -0
  189. package/lib/testing/aptos-facet.d.ts +12 -0
  190. package/lib/testing/aptos-facet.js +91 -0
  191. package/lib/testing/aptos-facet.js.map +1 -0
  192. package/lib/testing/eth-facet.d.ts +27 -0
  193. package/lib/testing/eth-facet.js +211 -0
  194. package/lib/testing/eth-facet.js.map +1 -0
  195. package/lib/testing/solana-facet.d.ts +7 -0
  196. package/lib/testing/solana-facet.js +22 -0
  197. package/lib/testing/solana-facet.js.map +1 -0
  198. package/lib/testing/sui-facet.d.ts +12 -0
  199. package/lib/testing/sui-facet.js +103 -0
  200. package/lib/testing/sui-facet.js.map +1 -0
  201. package/lib/testing/test-processor-server.d.ts +9 -23
  202. package/lib/testing/test-processor-server.js +13 -227
  203. package/lib/testing/test-processor-server.js.map +1 -1
  204. package/lib/utils/dex-price.js +1 -1
  205. package/lib/utils/dex-price.js.map +1 -1
  206. package/lib/utils/token.js +1 -1
  207. package/lib/utils/token.js.map +1 -1
  208. package/package.json +5 -5
  209. package/src/eth/account-processor.ts +2 -5
  210. package/src/eth/builtin/eacaggregatorproxy.ts +2 -2
  211. package/src/eth/builtin/erc1155.ts +2 -2
  212. package/src/eth/builtin/erc20.ts +2 -2
  213. package/src/eth/builtin/erc20bytes.ts +2 -2
  214. package/src/eth/builtin/erc721.ts +2 -2
  215. package/src/eth/builtin/internal/{eacaggregatorproxy_processor.ts → eacaggregatorproxy-processor.ts} +0 -0
  216. package/src/eth/builtin/internal/{eacaggregatorproxy_test-utils.ts → eacaggregatorproxy-test-utils.ts} +1 -1
  217. package/src/eth/builtin/internal/{erc1155_processor.ts → erc1155-processor.ts} +0 -0
  218. package/src/eth/builtin/internal/{erc1155_test-utils.ts → erc1155-test-utils.ts} +1 -1
  219. package/src/eth/builtin/internal/{erc20_processor.ts → erc20-processor.ts} +0 -0
  220. package/src/eth/builtin/internal/{erc20_test-utils.ts → erc20-test-utils.ts} +1 -1
  221. package/src/eth/builtin/internal/{erc20bytes_processor.ts → erc20bytes-processor.ts} +0 -0
  222. package/src/eth/builtin/internal/{erc20bytes_test-utils.ts → erc20bytes-test-utils.ts} +1 -1
  223. package/src/eth/builtin/internal/{erc721_processor.ts → erc721-processor.ts} +0 -0
  224. package/src/eth/builtin/internal/{erc721_test-utils.ts → erc721-test-utils.ts} +1 -1
  225. package/src/eth/builtin/internal/{weth9_processor.ts → weth9-processor.ts} +0 -0
  226. package/src/eth/builtin/internal/{weth9_test-utils.ts → weth9-test-utils.ts} +1 -1
  227. package/src/eth/builtin/weth9.ts +2 -2
  228. package/src/eth/codegen/ethers-sentio.ts +2 -2
  229. package/src/eth/codegen/file.ts +3 -3
  230. package/src/eth/tests/abis/eth/CommitmentPool.json +1034 -0
  231. package/src/eth/tests/abis/eth/MembershipStakerV3.json +706 -0
  232. package/src/eth/tests/abis/eth/Pyth.json +1471 -0
  233. package/src/eth/tests/abis/eth/Seaport.json +2595 -0
  234. package/src/eth/tests/abis/eth/TokenExchange.json +838 -0
  235. package/src/eth/tests/abis/eth/anyswapRouter.json +490 -0
  236. package/src/eth/tests/erc20.ts +63 -0
  237. package/src/eth/tests/types/anyswaprouter.ts +7 -0
  238. package/src/eth/tests/types/commitmentpool.ts +7 -0
  239. package/src/eth/tests/types/index.ts +33 -0
  240. package/src/eth/tests/types/internal/AnyswapRouter.ts +122 -0
  241. package/src/eth/tests/types/internal/CommitmentPool.ts +208 -0
  242. package/src/eth/tests/types/internal/MembershipStakerV3.ts +108 -0
  243. package/src/eth/tests/types/internal/Pyth.ts +246 -0
  244. package/src/eth/tests/types/internal/Seaport.ts +389 -0
  245. package/src/eth/tests/types/internal/TokenExchange.ts +142 -0
  246. package/src/eth/tests/types/internal/anyswaprouter-processor.ts +1396 -0
  247. package/src/eth/tests/types/internal/anyswaprouter-test-utils.ts +187 -0
  248. package/src/eth/tests/types/internal/commitmentpool-processor.ts +1575 -0
  249. package/src/eth/tests/types/internal/commitmentpool-test-utils.ts +150 -0
  250. package/src/eth/tests/types/internal/common.ts +23 -0
  251. package/src/eth/tests/types/internal/factories/AnyswapRouter__factory.ts +1278 -0
  252. package/src/eth/tests/types/internal/factories/CommitmentPool__factory.ts +1049 -0
  253. package/src/eth/tests/types/internal/factories/MembershipStakerV3__factory.ts +730 -0
  254. package/src/eth/tests/types/internal/factories/Pyth__factory.ts +1492 -0
  255. package/src/eth/tests/types/internal/factories/Seaport__factory.ts +2616 -0
  256. package/src/eth/tests/types/internal/factories/TokenExchange__factory.ts +862 -0
  257. package/src/eth/tests/types/internal/factories/index.ts +9 -0
  258. package/src/eth/tests/types/internal/index.ts +16 -0
  259. package/src/eth/tests/types/internal/membershipstakerv3-processor.ts +1399 -0
  260. package/src/eth/tests/types/internal/membershipstakerv3-test-utils.ts +188 -0
  261. package/src/eth/tests/types/internal/pyth-processor.ts +2043 -0
  262. package/src/eth/tests/types/internal/pyth-test-utils.ts +226 -0
  263. package/src/eth/tests/types/internal/seaport-processor.ts +678 -0
  264. package/src/eth/tests/types/internal/seaport-test-utils.ts +100 -0
  265. package/src/eth/tests/types/internal/tokenexchange-processor.ts +1570 -0
  266. package/src/eth/tests/types/internal/tokenexchange-test-utils.ts +244 -0
  267. package/src/eth/tests/types/membershipstakerv3.ts +7 -0
  268. package/src/eth/tests/types/pyth.ts +7 -0
  269. package/src/eth/tests/types/seaport.ts +7 -0
  270. package/src/eth/tests/types/tokenexchange.ts +7 -0
  271. package/src/sui/sui-processor.ts +2 -7
  272. package/src/sui/utils.ts +11 -0
  273. package/src/testing/aptos-facet.ts +111 -0
  274. package/src/testing/eth-facet.ts +233 -0
  275. package/src/testing/solana-facet.ts +25 -0
  276. package/src/testing/sui-facet.ts +119 -0
  277. package/src/testing/test-processor-server.ts +15 -252
  278. package/src/utils/dex-price.ts +1 -1
  279. package/src/utils/token.ts +1 -3
@@ -0,0 +1,119 @@
1
+ import { DataBinding, HandlerType } from '@sentio/protos'
2
+ import { getChainId } from '../sui/network.js'
3
+ import { TestProcessorServer } from './test-processor-server.js'
4
+ import { parseMoveType } from '../aptos/types.js'
5
+ import { SuiNetwork } from '../sui/index.js'
6
+ import { MoveEvent, SuiTransactionResponse, MoveCall } from '@mysten/sui.js'
7
+ import { getMoveCalls } from '../sui/utils.js'
8
+
9
+ export class SuiFacet {
10
+ server: TestProcessorServer
11
+ constructor(server: TestProcessorServer) {
12
+ this.server = server
13
+ }
14
+
15
+ testEntryFunctionCall(transaction: SuiTransactionResponse, network: SuiNetwork = SuiNetwork.MAIN_NET) {
16
+ return this.testEntryFunctionCalls([transaction], network)
17
+ }
18
+
19
+ testEntryFunctionCalls(transactions: SuiTransactionResponse[], network: SuiNetwork = SuiNetwork.MAIN_NET) {
20
+ const bindings = []
21
+ for (const trans of transactions) {
22
+ const binding = this.buildEntryFunctionCallBinding(trans, network)
23
+ if (!binding) {
24
+ throw Error('Invalid test transaction: ' + JSON.stringify(trans))
25
+ }
26
+ bindings.push(binding)
27
+ }
28
+ return this.server.processBindings({
29
+ bindings: bindings,
30
+ })
31
+ }
32
+
33
+ private buildEntryFunctionCallBinding(
34
+ transaction: SuiTransactionResponse,
35
+ network: SuiNetwork = SuiNetwork.MAIN_NET
36
+ ): DataBinding | undefined {
37
+ const calls: MoveCall[] = getMoveCalls(transaction)
38
+ if (calls.length !== 1) {
39
+ throw Error('Transaction has more than one calls')
40
+ }
41
+ const functionType = calls[0].package.objectId + calls[0].module + calls[0].function
42
+
43
+ for (const config of this.server.contractConfigs) {
44
+ if (config.contract?.chainId !== getChainId(network)) {
45
+ continue
46
+ }
47
+ for (const callConfig of config.moveCallConfigs) {
48
+ for (const callFilter of callConfig.filters) {
49
+ if (config.contract.address + '::' + callFilter.function === functionType) {
50
+ return {
51
+ data: {
52
+ suiCall: {
53
+ transaction,
54
+ timestamp: new Date(),
55
+ slot: 10000n,
56
+ },
57
+ },
58
+ handlerIds: [callConfig.handlerId],
59
+ handlerType: HandlerType.SUI_CALL,
60
+ }
61
+ }
62
+ }
63
+ }
64
+ }
65
+ return undefined
66
+ }
67
+
68
+ testEvent(transaction: SuiTransactionResponse, event: number | MoveEvent, network: SuiNetwork = SuiNetwork.MAIN_NET) {
69
+ if (typeof event !== 'number') {
70
+ const transaction2: SuiTransactionResponse = {} as any
71
+ Object.assign(transaction2, transaction)
72
+ transaction = transaction2
73
+ transaction.effects.events = [event]
74
+ event = 0
75
+ }
76
+ const binding = this.buildEventBinding(transaction, event, network)
77
+ if (!binding) {
78
+ throw Error('Invalid test event: ' + JSON.stringify(transaction))
79
+ }
80
+ return this.server.processBinding(binding)
81
+ }
82
+
83
+ private buildEventBinding(
84
+ transaction: SuiTransactionResponse,
85
+ eventIdx: number,
86
+ network: SuiNetwork = SuiNetwork.MAIN_NET
87
+ ): DataBinding | undefined {
88
+ // const allEvents = new Set(transaction.events.map(e => e.type))
89
+ const event = transaction.effects.events?.[eventIdx]
90
+ if (!event || !event.moveEvent) {
91
+ throw Error('Invaild test transaction, no event located')
92
+ }
93
+
94
+ for (const config of this.server.contractConfigs) {
95
+ if (config.contract?.chainId !== getChainId(network)) {
96
+ continue
97
+ }
98
+ for (const eventConfig of config.moveEventConfigs) {
99
+ for (const eventFilter of eventConfig.filters) {
100
+ if (config.contract.address + '::' + eventFilter.type === parseMoveType(event.moveEvent.type).qname) {
101
+ transaction.effects.events = [event]
102
+ return {
103
+ data: {
104
+ suiEvent: {
105
+ transaction,
106
+ timestamp: new Date(transaction.timestamp_ms || 0),
107
+ slot: 10000n,
108
+ },
109
+ },
110
+ handlerIds: [eventConfig.handlerId],
111
+ handlerType: HandlerType.SUI_EVENT,
112
+ }
113
+ }
114
+ }
115
+ }
116
+ }
117
+ return undefined
118
+ }
119
+ }
@@ -2,30 +2,27 @@ import {
2
2
  AccountConfig,
3
3
  ContractConfig,
4
4
  DataBinding,
5
- HandlerType,
6
- Data_SolInstruction,
5
+ Empty,
7
6
  ProcessBindingResponse,
8
7
  ProcessBindingsRequest,
9
8
  ProcessConfigRequest,
10
9
  ProcessConfigResponse,
11
10
  ProcessorServiceImplementation,
12
11
  StartRequest,
13
- Empty,
14
12
  } from '@sentio/protos'
15
13
  import { CallContext } from 'nice-grpc-common'
16
- import { ProcessorServiceImpl, Endpoints, State } from '@sentio/runtime'
14
+ import { Endpoints, ProcessorServiceImpl, State } from '@sentio/runtime'
17
15
  import { CHAIN_MAP } from '../core/chain.js'
18
16
 
19
- import { Trace } from '../eth/trace.js'
20
- import { LogParams, Networkish, BlockParams, Network } from 'ethers/providers'
21
-
22
- import { Block, Log } from 'ethers'
17
+ import { AptosFacet } from './aptos-facet.js'
18
+ import { SolanaFacet } from './solana-facet.js'
19
+ import { EthFacet } from './eth-facet.js'
20
+ import { SuiFacet } from './sui-facet.js'
23
21
 
24
22
  export const TEST_CONTEXT: CallContext = <CallContext>{}
25
23
 
26
24
  export function cleanTest() {
27
25
  State.reset()
28
- // Endpoints.reset()
29
26
  }
30
27
 
31
28
  export class TestProcessorServer implements ProcessorServiceImplementation {
@@ -33,10 +30,19 @@ export class TestProcessorServer implements ProcessorServiceImplementation {
33
30
  contractConfigs: ContractConfig[]
34
31
  accountConfigs: AccountConfig[]
35
32
 
33
+ aptos: AptosFacet
34
+ eth: EthFacet
35
+ solana: SolanaFacet
36
+ sui: SuiFacet
37
+
36
38
  constructor(loader: () => Promise<any>, httpEndpoints: Record<string, string> = {}) {
37
39
  cleanTest()
38
40
 
39
41
  this.service = new ProcessorServiceImpl(loader)
42
+ this.aptos = new AptosFacet(this)
43
+ this.solana = new SolanaFacet(this)
44
+ this.eth = new EthFacet(this)
45
+ this.sui = new SuiFacet(this)
40
46
 
41
47
  for (const k in CHAIN_MAP) {
42
48
  const http = httpEndpoints[k] || ''
@@ -60,249 +66,6 @@ export class TestProcessorServer implements ProcessorServiceImplementation {
60
66
  return this.service.getConfig(request, context)
61
67
  }
62
68
 
63
- // processLogs(request: ProcessBindingsRequest, context = TEST_CONTEXT): Promise<ProcessBindingResponse> {
64
- // return this.service.processLogs(request, context)
65
- // }
66
- //
67
- // processTraces(request: ProcessBindingsRequest, context: CallContext = TEST_CONTEXT): Promise<ProcessBindingResponse> {
68
- // return this.service.processTraces(request, context)
69
- // }
70
-
71
- testTrace(trace: Trace, network: Networkish = 1): Promise<ProcessBindingResponse> {
72
- return this.testTraces([trace], network)
73
- }
74
-
75
- testTraces(traces: Trace[], network: Networkish = 1): Promise<ProcessBindingResponse> {
76
- const bindings = []
77
- for (const trace of traces) {
78
- const binding = this.buildTraceBinding(trace, network)
79
- if (!binding) {
80
- throw Error('Invalid test trace: ' + JSON.stringify(trace))
81
- }
82
- bindings.push(binding)
83
- }
84
- return this.processBindings({
85
- bindings: bindings,
86
- })
87
- }
88
-
89
- buildTraceBinding(trace: Trace, network: Networkish = 1): DataBinding | undefined {
90
- if (trace.type !== 'call' || !trace.action.input) {
91
- throw Error('Invalid test trace: ' + JSON.stringify(trace))
92
- }
93
- const signature = trace.action.input.slice(0, 10)
94
-
95
- for (const contract of this.contractConfigs) {
96
- if (contract.contract?.chainId !== Network.from(network).chainId.toString()) {
97
- continue
98
- }
99
- if (trace.action.to?.toLowerCase() !== contract.contract?.address.toLowerCase()) {
100
- continue
101
- }
102
- for (const config of contract.traceConfigs) {
103
- if (config.signature == signature) {
104
- return {
105
- data: {
106
- ethTrace: {
107
- trace,
108
- timestamp: new Date(),
109
- },
110
- },
111
- handlerIds: [config.handlerId],
112
- handlerType: HandlerType.ETH_TRACE,
113
- }
114
- }
115
- }
116
- }
117
- return undefined
118
- }
119
-
120
- testLog(log: LogParams, network: Networkish = 1): Promise<ProcessBindingResponse> {
121
- return this.testLogs([log], network)
122
- }
123
-
124
- testLogs(logs: LogParams[], network: Networkish = 1): Promise<ProcessBindingResponse> {
125
- const bindings = []
126
- for (const log of logs) {
127
- const binding = this.buildLogBinding(log, network)
128
- if (!binding) {
129
- throw Error('Invalid test log: ' + JSON.stringify(log))
130
- }
131
- bindings.push(binding)
132
- }
133
- return this.processBindings({
134
- bindings: bindings,
135
- })
136
- }
137
-
138
- buildLogBinding(log: LogParams, network: Networkish = 1): DataBinding | undefined {
139
- for (const contract of this.contractConfigs) {
140
- if (contract.contract?.chainId !== Network.from(network).chainId.toString()) {
141
- continue
142
- }
143
- if (log.address.toLowerCase() !== contract.contract?.address.toLowerCase()) {
144
- continue
145
- }
146
- for (const config of contract.logConfigs) {
147
- for (const filter of config.filters) {
148
- // if (filter.topics.length != log.topics.length) {
149
- // continue
150
- // }
151
-
152
- let match = true
153
- for (const topicIdx in filter.topics) {
154
- const logTopic = log.topics[topicIdx]
155
- const possibleTopic = filter.topics[topicIdx].hashes
156
- if (possibleTopic.length === 0) {
157
- // match all
158
- continue
159
- }
160
- if (possibleTopic.find((e) => e.toLowerCase() === logTopic.toLowerCase())) {
161
- // find one
162
- continue
163
- }
164
- match = false
165
- break
166
- }
167
- if (match) {
168
- return {
169
- data: {
170
- ethLog: { log, timestamp: new Date() },
171
- },
172
- handlerIds: [config.handlerId],
173
- handlerType: HandlerType.ETH_LOG,
174
- }
175
- }
176
- }
177
- }
178
- }
179
- return undefined
180
- }
181
- testAccountLog(address: string, log: LogParams, network: Networkish = 1): Promise<ProcessBindingResponse> {
182
- return this.testAccountLogs(address, [log], network)
183
- }
184
-
185
- testAccountLogs(address: string, logs: LogParams[], network: Networkish = 1): Promise<ProcessBindingResponse> {
186
- const bindings = []
187
- for (const log of logs) {
188
- const binding = this.buildAccountLogBinding(address, log, network)
189
- if (!binding) {
190
- throw Error('Invalid test log: ' + JSON.stringify(log))
191
- }
192
- bindings.push(binding)
193
- }
194
- return this.processBindings({
195
- bindings: bindings,
196
- })
197
- }
198
-
199
- buildAccountLogBinding(address: string, log: LogParams, network: Networkish = 1): DataBinding | undefined {
200
- for (const account of this.accountConfigs) {
201
- if (account.chainId !== Network.from(network).chainId.toString()) {
202
- continue
203
- }
204
- if (address.toLowerCase() !== account.address.toLowerCase()) {
205
- continue
206
- }
207
- for (const config of account.logConfigs) {
208
- for (const filter of config.filters) {
209
- // if (filter.topics.length != log.topics.length) {
210
- // continue
211
- // }
212
-
213
- let match = true
214
- for (const topicIdx in filter.topics) {
215
- const logTopic = log.topics[topicIdx]
216
- const possibleTopic = filter.topics[topicIdx].hashes
217
- if (possibleTopic.length === 0) {
218
- // match all
219
- continue
220
- }
221
- if (possibleTopic.find((e) => e.toLowerCase() === logTopic.toLowerCase())) {
222
- // find one
223
- continue
224
- }
225
- match = false
226
- break
227
- }
228
- if (match) {
229
- return {
230
- data: {
231
- ethLog: { log, timestamp: new Date() },
232
- },
233
- handlerIds: [config.handlerId],
234
- handlerType: HandlerType.ETH_LOG,
235
- }
236
- }
237
- }
238
- }
239
- }
240
- return undefined
241
- }
242
-
243
- testBlock(
244
- block: Partial<BlockParams> & { number: number },
245
- network: Networkish = 1
246
- ): Promise<ProcessBindingResponse> {
247
- return this.testBlocks([block], network)
248
- }
249
-
250
- testBlocks(blocks: Partial<BlockParams> & { number: number }[], network: Networkish = 1) {
251
- const bindings = []
252
- for (const block of blocks) {
253
- const binding = this.buildBlockBinding(block, network)
254
- if (!binding) {
255
- throw Error('Invalid test block: ' + JSON.stringify(block))
256
- }
257
- bindings.push(binding)
258
- }
259
- return this.processBindings({
260
- bindings: bindings,
261
- })
262
- }
263
-
264
- buildBlockBinding(block: Partial<Block> & { number: number }, network: Networkish = 1): DataBinding {
265
- const binding: DataBinding = {
266
- data: {
267
- ethBlock: { block },
268
- },
269
- handlerType: HandlerType.ETH_BLOCK,
270
- handlerIds: [],
271
- }
272
- for (const contract of this.contractConfigs) {
273
- if (contract.contract?.chainId !== Network.from(network).chainId.toString()) {
274
- continue
275
- }
276
- const longBlockNumber = block.number
277
- if (longBlockNumber < contract.startBlock) {
278
- continue
279
- }
280
- if (contract.endBlock !== 0n && longBlockNumber >= contract.endBlock) {
281
- continue
282
- }
283
-
284
- for (const config of contract.intervalConfigs) {
285
- binding.handlerIds.push(config.handlerId)
286
- }
287
- }
288
- return binding
289
- }
290
-
291
- testInstructions(instructions: Data_SolInstruction[]): Promise<ProcessBindingResponse> {
292
- return this.processBindings({
293
- bindings: instructions.map((instruction) => {
294
- return {
295
- data: {
296
- raw: new Uint8Array(),
297
- solInstruction: instruction,
298
- },
299
- handlerIds: [],
300
- handlerType: HandlerType.SOL_INSTRUCTION,
301
- }
302
- }),
303
- })
304
- }
305
-
306
69
  processBindings(
307
70
  request: ProcessBindingsRequest,
308
71
  context: CallContext = TEST_CONTEXT
@@ -1,4 +1,4 @@
1
- import { getEACAggregatorProxyContract } from '../eth/builtin/internal/eacaggregatorproxy_processor.js'
1
+ import { getEACAggregatorProxyContract } from '../eth/builtin/eacaggregatorproxy.js'
2
2
  import fs from 'fs'
3
3
  import { parse } from 'csv-parse/sync'
4
4
  import { BlockTag } from 'ethers/providers'
@@ -1,8 +1,6 @@
1
1
  import { getERC20Contract } from '../eth/builtin/erc20.js'
2
- import { getERC20BytesContract } from '../eth/builtin/internal/erc20bytes_processor.js'
2
+ import { getERC20BytesContract } from '../eth/builtin/erc20bytes.js'
3
3
  import { BigDecimal, scaleDown } from '../core/big-decimal.js'
4
- // import { toBigDecimal } from './conversion'
5
- // import { utils } from 'ethers'
6
4
  import { PromiseOrValue } from '../eth/builtin/internal/common.js'
7
5
  import { decodeBytes32String } from 'ethers'
8
6