@sentio/sdk 1.13.1 → 1.13.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 (351) hide show
  1. package/lib/cli/commands/run-create.js +2 -0
  2. package/lib/cli/commands/run-create.js.map +1 -1
  3. package/package.json +1 -1
  4. package/src/cli/commands/run-create.ts +3 -0
  5. package/template/package.json +2 -3
  6. package/template/src/processor.test.ts +1 -1
  7. package/template/src/processor.ts +20 -16
  8. package/template/node_modules/@sentio/sdk/lib/base-processor-template.d.ts +0 -27
  9. package/template/node_modules/@sentio/sdk/lib/base-processor-template.js +0 -80
  10. package/template/node_modules/@sentio/sdk/lib/base-processor-template.js.map +0 -1
  11. package/template/node_modules/@sentio/sdk/lib/base-processor.d.ts +0 -30
  12. package/template/node_modules/@sentio/sdk/lib/base-processor.js +0 -148
  13. package/template/node_modules/@sentio/sdk/lib/base-processor.js.map +0 -1
  14. package/template/node_modules/@sentio/sdk/lib/bind-options.d.ts +0 -21
  15. package/template/node_modules/@sentio/sdk/lib/bind-options.js +0 -42
  16. package/template/node_modules/@sentio/sdk/lib/bind-options.js.map +0 -1
  17. package/template/node_modules/@sentio/sdk/lib/binds.d.ts +0 -10
  18. package/template/node_modules/@sentio/sdk/lib/binds.js +0 -59
  19. package/template/node_modules/@sentio/sdk/lib/binds.js.map +0 -1
  20. package/template/node_modules/@sentio/sdk/lib/builtin/erc20/index.d.ts +0 -2
  21. package/template/node_modules/@sentio/sdk/lib/builtin/erc20/index.js +0 -22
  22. package/template/node_modules/@sentio/sdk/lib/builtin/erc20/index.js.map +0 -1
  23. package/template/node_modules/@sentio/sdk/lib/builtin/erc20/test-utils.d.ts +0 -5
  24. package/template/node_modules/@sentio/sdk/lib/builtin/erc20/test-utils.js +0 -46
  25. package/template/node_modules/@sentio/sdk/lib/builtin/erc20/test-utils.js.map +0 -1
  26. package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/index.d.ts +0 -2
  27. package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/index.js +0 -22
  28. package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/index.js.map +0 -1
  29. package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/test-utils.d.ts +0 -4
  30. package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/test-utils.js +0 -35
  31. package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/test-utils.js.map +0 -1
  32. package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20.d.ts +0 -307
  33. package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20.js +0 -3
  34. package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20.js.map +0 -1
  35. package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20Bytes.d.ts +0 -166
  36. package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20Bytes.js +0 -3
  37. package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20Bytes.js.map +0 -1
  38. package/template/node_modules/@sentio/sdk/lib/builtin/internal/WETH9.d.ts +0 -221
  39. package/template/node_modules/@sentio/sdk/lib/builtin/internal/WETH9.js +0 -3
  40. package/template/node_modules/@sentio/sdk/lib/builtin/internal/WETH9.js.map +0 -1
  41. package/template/node_modules/@sentio/sdk/lib/builtin/internal/common.d.ts +0 -22
  42. package/template/node_modules/@sentio/sdk/lib/builtin/internal/common.js +0 -3
  43. package/template/node_modules/@sentio/sdk/lib/builtin/internal/common.js.map +0 -1
  44. package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20_processor.d.ts +0 -184
  45. package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20_processor.js +0 -453
  46. package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20_processor.js.map +0 -1
  47. package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20bytes_processor.d.ts +0 -110
  48. package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20bytes_processor.js +0 -325
  49. package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20bytes_processor.js.map +0 -1
  50. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20Bytes__factory.d.ts +0 -48
  51. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20Bytes__factory.js +0 -254
  52. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20Bytes__factory.js.map +0 -1
  53. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20__factory.d.ts +0 -42
  54. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20__factory.js +0 -404
  55. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20__factory.js.map +0 -1
  56. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/WETH9__factory.d.ts +0 -45
  57. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/WETH9__factory.js +0 -297
  58. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/WETH9__factory.js.map +0 -1
  59. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/index.d.ts +0 -3
  60. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/index.js +0 -13
  61. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/index.js.map +0 -1
  62. package/template/node_modules/@sentio/sdk/lib/builtin/internal/index.d.ts +0 -7
  63. package/template/node_modules/@sentio/sdk/lib/builtin/internal/index.js +0 -34
  64. package/template/node_modules/@sentio/sdk/lib/builtin/internal/index.js.map +0 -1
  65. package/template/node_modules/@sentio/sdk/lib/builtin/internal/weth9_processor.d.ts +0 -126
  66. package/template/node_modules/@sentio/sdk/lib/builtin/internal/weth9_processor.js +0 -361
  67. package/template/node_modules/@sentio/sdk/lib/builtin/internal/weth9_processor.js.map +0 -1
  68. package/template/node_modules/@sentio/sdk/lib/builtin/weth9/index.d.ts +0 -2
  69. package/template/node_modules/@sentio/sdk/lib/builtin/weth9/index.js +0 -22
  70. package/template/node_modules/@sentio/sdk/lib/builtin/weth9/index.js.map +0 -1
  71. package/template/node_modules/@sentio/sdk/lib/builtin/weth9/test-utils.d.ts +0 -6
  72. package/template/node_modules/@sentio/sdk/lib/builtin/weth9/test-utils.js +0 -57
  73. package/template/node_modules/@sentio/sdk/lib/builtin/weth9/test-utils.js.map +0 -1
  74. package/template/node_modules/@sentio/sdk/lib/chain-config.d.ts +0 -6
  75. package/template/node_modules/@sentio/sdk/lib/chain-config.js +0 -3
  76. package/template/node_modules/@sentio/sdk/lib/chain-config.js.map +0 -1
  77. package/template/node_modules/@sentio/sdk/lib/cli/build.d.ts +0 -4
  78. package/template/node_modules/@sentio/sdk/lib/cli/build.js +0 -178
  79. package/template/node_modules/@sentio/sdk/lib/cli/build.js.map +0 -1
  80. package/template/node_modules/@sentio/sdk/lib/cli/cli.d.ts +0 -2
  81. package/template/node_modules/@sentio/sdk/lib/cli/cli.js +0 -163
  82. package/template/node_modules/@sentio/sdk/lib/cli/cli.js.map +0 -1
  83. package/template/node_modules/@sentio/sdk/lib/cli/commands/run-create.d.ts +0 -1
  84. package/template/node_modules/@sentio/sdk/lib/cli/commands/run-create.js +0 -43
  85. package/template/node_modules/@sentio/sdk/lib/cli/commands/run-create.js.map +0 -1
  86. package/template/node_modules/@sentio/sdk/lib/cli/commands/run-login.d.ts +0 -1
  87. package/template/node_modules/@sentio/sdk/lib/cli/commands/run-login.js +0 -77
  88. package/template/node_modules/@sentio/sdk/lib/cli/commands/run-login.js.map +0 -1
  89. package/template/node_modules/@sentio/sdk/lib/cli/config.d.ts +0 -16
  90. package/template/node_modules/@sentio/sdk/lib/cli/config.js +0 -36
  91. package/template/node_modules/@sentio/sdk/lib/cli/config.js.map +0 -1
  92. package/template/node_modules/@sentio/sdk/lib/cli/key.d.ts +0 -2
  93. package/template/node_modules/@sentio/sdk/lib/cli/key.js +0 -44
  94. package/template/node_modules/@sentio/sdk/lib/cli/key.js.map +0 -1
  95. package/template/node_modules/@sentio/sdk/lib/cli/solana-code-gen.d.ts +0 -2
  96. package/template/node_modules/@sentio/sdk/lib/cli/solana-code-gen.js +0 -19
  97. package/template/node_modules/@sentio/sdk/lib/cli/solana-code-gen.js.map +0 -1
  98. package/template/node_modules/@sentio/sdk/lib/cli/upload.d.ts +0 -2
  99. package/template/node_modules/@sentio/sdk/lib/cli/upload.js +0 -85
  100. package/template/node_modules/@sentio/sdk/lib/cli/upload.js.map +0 -1
  101. package/template/node_modules/@sentio/sdk/lib/cli/webpack.config.js +0 -42
  102. package/template/node_modules/@sentio/sdk/lib/context.d.ts +0 -49
  103. package/template/node_modules/@sentio/sdk/lib/context.js +0 -93
  104. package/template/node_modules/@sentio/sdk/lib/context.js.map +0 -1
  105. package/template/node_modules/@sentio/sdk/lib/contract-namer.d.ts +0 -6
  106. package/template/node_modules/@sentio/sdk/lib/contract-namer.js +0 -20
  107. package/template/node_modules/@sentio/sdk/lib/contract-namer.js.map +0 -1
  108. package/template/node_modules/@sentio/sdk/lib/error.d.ts +0 -7
  109. package/template/node_modules/@sentio/sdk/lib/error.js +0 -43
  110. package/template/node_modules/@sentio/sdk/lib/error.js.map +0 -1
  111. package/template/node_modules/@sentio/sdk/lib/gen/builtin.d.ts +0 -6
  112. package/template/node_modules/@sentio/sdk/lib/gen/builtin.js +0 -3
  113. package/template/node_modules/@sentio/sdk/lib/gen/builtin.js.map +0 -1
  114. package/template/node_modules/@sentio/sdk/lib/gen/google/protobuf/empty.d.ts +0 -16
  115. package/template/node_modules/@sentio/sdk/lib/gen/google/protobuf/empty.js +0 -47
  116. package/template/node_modules/@sentio/sdk/lib/gen/google/protobuf/empty.js.map +0 -1
  117. package/template/node_modules/@sentio/sdk/lib/gen/processor/protos/processor.d.ts +0 -666
  118. package/template/node_modules/@sentio/sdk/lib/gen/processor/protos/processor.js +0 -2837
  119. package/template/node_modules/@sentio/sdk/lib/gen/processor/protos/processor.js.map +0 -1
  120. package/template/node_modules/@sentio/sdk/lib/generic-processor.d.ts +0 -10
  121. package/template/node_modules/@sentio/sdk/lib/generic-processor.js +0 -32
  122. package/template/node_modules/@sentio/sdk/lib/generic-processor.js.map +0 -1
  123. package/template/node_modules/@sentio/sdk/lib/index.d.ts +0 -18
  124. package/template/node_modules/@sentio/sdk/lib/index.js +0 -63
  125. package/template/node_modules/@sentio/sdk/lib/index.js.map +0 -1
  126. package/template/node_modules/@sentio/sdk/lib/loader.d.ts +0 -5
  127. package/template/node_modules/@sentio/sdk/lib/loader.js +0 -30
  128. package/template/node_modules/@sentio/sdk/lib/loader.js.map +0 -1
  129. package/template/node_modules/@sentio/sdk/lib/meter.d.ts +0 -26
  130. package/template/node_modules/@sentio/sdk/lib/meter.js +0 -131
  131. package/template/node_modules/@sentio/sdk/lib/meter.js.map +0 -1
  132. package/template/node_modules/@sentio/sdk/lib/meter.test.d.ts +0 -1
  133. package/template/node_modules/@sentio/sdk/lib/meter.test.js +0 -16
  134. package/template/node_modules/@sentio/sdk/lib/meter.test.js.map +0 -1
  135. package/template/node_modules/@sentio/sdk/lib/numberish.d.ts +0 -6
  136. package/template/node_modules/@sentio/sdk/lib/numberish.js +0 -96
  137. package/template/node_modules/@sentio/sdk/lib/numberish.js.map +0 -1
  138. package/template/node_modules/@sentio/sdk/lib/numberish.test.d.ts +0 -1
  139. package/template/node_modules/@sentio/sdk/lib/numberish.test.js +0 -70
  140. package/template/node_modules/@sentio/sdk/lib/numberish.test.js.map +0 -1
  141. package/template/node_modules/@sentio/sdk/lib/processor-runner.d.ts +0 -2
  142. package/template/node_modules/@sentio/sdk/lib/processor-runner.js +0 -40
  143. package/template/node_modules/@sentio/sdk/lib/processor-runner.js.map +0 -1
  144. package/template/node_modules/@sentio/sdk/lib/processor-state.d.ts +0 -16
  145. package/template/node_modules/@sentio/sdk/lib/processor-state.js +0 -20
  146. package/template/node_modules/@sentio/sdk/lib/processor-state.js.map +0 -1
  147. package/template/node_modules/@sentio/sdk/lib/promise-or-void.d.ts +0 -1
  148. package/template/node_modules/@sentio/sdk/lib/promise-or-void.js +0 -3
  149. package/template/node_modules/@sentio/sdk/lib/promise-or-void.js.map +0 -1
  150. package/template/node_modules/@sentio/sdk/lib/provider.d.ts +0 -6
  151. package/template/node_modules/@sentio/sdk/lib/provider.js +0 -66
  152. package/template/node_modules/@sentio/sdk/lib/provider.js.map +0 -1
  153. package/template/node_modules/@sentio/sdk/lib/release.config.js +0 -31
  154. package/template/node_modules/@sentio/sdk/lib/service.d.ts +0 -25
  155. package/template/node_modules/@sentio/sdk/lib/service.js +0 -406
  156. package/template/node_modules/@sentio/sdk/lib/service.js.map +0 -1
  157. package/template/node_modules/@sentio/sdk/lib/solana/builtin/index.d.ts +0 -2
  158. package/template/node_modules/@sentio/sdk/lib/solana/builtin/index.js +0 -19
  159. package/template/node_modules/@sentio/sdk/lib/solana/builtin/index.js.map +0 -1
  160. package/template/node_modules/@sentio/sdk/lib/solana/builtin/spl-token-processor.d.ts +0 -26
  161. package/template/node_modules/@sentio/sdk/lib/solana/builtin/spl-token-processor.js +0 -138
  162. package/template/node_modules/@sentio/sdk/lib/solana/builtin/spl-token-processor.js.map +0 -1
  163. package/template/node_modules/@sentio/sdk/lib/solana/builtin/types.d.ts +0 -330
  164. package/template/node_modules/@sentio/sdk/lib/solana/builtin/types.js +0 -203
  165. package/template/node_modules/@sentio/sdk/lib/solana/builtin/types.js.map +0 -1
  166. package/template/node_modules/@sentio/sdk/lib/solana/builtin/wormhole-processor.d.ts +0 -18
  167. package/template/node_modules/@sentio/sdk/lib/solana/builtin/wormhole-processor.js +0 -192
  168. package/template/node_modules/@sentio/sdk/lib/solana/builtin/wormhole-processor.js.map +0 -1
  169. package/template/node_modules/@sentio/sdk/lib/solana-processor.d.ts +0 -34
  170. package/template/node_modules/@sentio/sdk/lib/solana-processor.js +0 -95
  171. package/template/node_modules/@sentio/sdk/lib/solana-processor.js.map +0 -1
  172. package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/codegen.d.ts +0 -4
  173. package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/codegen.js +0 -292
  174. package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/codegen.js.map +0 -1
  175. package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/functions.d.ts +0 -3
  176. package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/functions.js +0 -61
  177. package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/functions.js.map +0 -1
  178. package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/index.d.ts +0 -6
  179. package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/index.js +0 -51
  180. package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/index.js.map +0 -1
  181. package/template/node_modules/@sentio/sdk/lib/test/codegen.test.d.ts +0 -1
  182. package/template/node_modules/@sentio/sdk/lib/test/codegen.test.js +0 -49
  183. package/template/node_modules/@sentio/sdk/lib/test/codegen.test.js.map +0 -1
  184. package/template/node_modules/@sentio/sdk/lib/test/erc20-template.d.ts +0 -1
  185. package/template/node_modules/@sentio/sdk/lib/test/erc20-template.js +0 -23
  186. package/template/node_modules/@sentio/sdk/lib/test/erc20-template.js.map +0 -1
  187. package/template/node_modules/@sentio/sdk/lib/test/erc20-template.test.d.ts +0 -1
  188. package/template/node_modules/@sentio/sdk/lib/test/erc20-template.test.js +0 -37
  189. package/template/node_modules/@sentio/sdk/lib/test/erc20-template.test.js.map +0 -1
  190. package/template/node_modules/@sentio/sdk/lib/test/erc20.d.ts +0 -1
  191. package/template/node_modules/@sentio/sdk/lib/test/erc20.js +0 -44
  192. package/template/node_modules/@sentio/sdk/lib/test/erc20.js.map +0 -1
  193. package/template/node_modules/@sentio/sdk/lib/test/erc20.test.d.ts +0 -1
  194. package/template/node_modules/@sentio/sdk/lib/test/erc20.test.js +0 -96
  195. package/template/node_modules/@sentio/sdk/lib/test/erc20.test.js.map +0 -1
  196. package/template/node_modules/@sentio/sdk/lib/test/generic-processor.test.d.ts +0 -1
  197. package/template/node_modules/@sentio/sdk/lib/test/generic-processor.test.js +0 -59
  198. package/template/node_modules/@sentio/sdk/lib/test/generic-processor.test.js.map +0 -1
  199. package/template/node_modules/@sentio/sdk/lib/test/index.d.ts +0 -2
  200. package/template/node_modules/@sentio/sdk/lib/test/index.js +0 -8
  201. package/template/node_modules/@sentio/sdk/lib/test/index.js.map +0 -1
  202. package/template/node_modules/@sentio/sdk/lib/test/metric-utils.d.ts +0 -6
  203. package/template/node_modules/@sentio/sdk/lib/test/metric-utils.js +0 -50
  204. package/template/node_modules/@sentio/sdk/lib/test/metric-utils.js.map +0 -1
  205. package/template/node_modules/@sentio/sdk/lib/test/mirrorworld.d.ts +0 -1
  206. package/template/node_modules/@sentio/sdk/lib/test/mirrorworld.js +0 -42
  207. package/template/node_modules/@sentio/sdk/lib/test/mirrorworld.js.map +0 -1
  208. package/template/node_modules/@sentio/sdk/lib/test/solana.test.d.ts +0 -1
  209. package/template/node_modules/@sentio/sdk/lib/test/solana.test.js +0 -90
  210. package/template/node_modules/@sentio/sdk/lib/test/solana.test.js.map +0 -1
  211. package/template/node_modules/@sentio/sdk/lib/test/test-processor-server.d.ts +0 -34
  212. package/template/node_modules/@sentio/sdk/lib/test/test-processor-server.js +0 -205
  213. package/template/node_modules/@sentio/sdk/lib/test/test-processor-server.js.map +0 -1
  214. package/template/node_modules/@sentio/sdk/lib/test/test-provider.d.ts +0 -1
  215. package/template/node_modules/@sentio/sdk/lib/test/test-provider.js +0 -25
  216. package/template/node_modules/@sentio/sdk/lib/test/test-provider.js.map +0 -1
  217. package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet.d.ts +0 -45
  218. package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet.js +0 -1396
  219. package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet.js.map +0 -1
  220. package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet_processor.d.ts +0 -107
  221. package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet_processor.js +0 -105
  222. package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet_processor.js.map +0 -1
  223. package/template/node_modules/@sentio/sdk/lib/test/wormhole-token-bridge.d.ts +0 -1
  224. package/template/node_modules/@sentio/sdk/lib/test/wormhole-token-bridge.js +0 -22
  225. package/template/node_modules/@sentio/sdk/lib/test/wormhole-token-bridge.js.map +0 -1
  226. package/template/node_modules/@sentio/sdk/lib/trace.d.ts +0 -35
  227. package/template/node_modules/@sentio/sdk/lib/trace.js +0 -43
  228. package/template/node_modules/@sentio/sdk/lib/trace.js.map +0 -1
  229. package/template/node_modules/@sentio/sdk/lib/utils/chainmap.d.ts +0 -2
  230. package/template/node_modules/@sentio/sdk/lib/utils/chainmap.js +0 -98
  231. package/template/node_modules/@sentio/sdk/lib/utils/chainmap.js.map +0 -1
  232. package/template/node_modules/@sentio/sdk/lib/utils/convert.d.ts +0 -5
  233. package/template/node_modules/@sentio/sdk/lib/utils/convert.js +0 -27
  234. package/template/node_modules/@sentio/sdk/lib/utils/convert.js.map +0 -1
  235. package/template/node_modules/@sentio/sdk/lib/utils/erc20.d.ts +0 -14
  236. package/template/node_modules/@sentio/sdk/lib/utils/erc20.js +0 -62
  237. package/template/node_modules/@sentio/sdk/lib/utils/erc20.js.map +0 -1
  238. package/template/node_modules/@sentio/sdk/lib/utils/erc20.test.d.ts +0 -1
  239. package/template/node_modules/@sentio/sdk/lib/utils/erc20.test.js +0 -23
  240. package/template/node_modules/@sentio/sdk/lib/utils/erc20.test.js.map +0 -1
  241. package/template/node_modules/@sentio/sdk/lib/utils/index.d.ts +0 -3
  242. package/template/node_modules/@sentio/sdk/lib/utils/index.js +0 -14
  243. package/template/node_modules/@sentio/sdk/lib/utils/index.js.map +0 -1
  244. package/template/node_modules/@sentio/sdk/package.json +0 -78
  245. package/template/node_modules/@sentio/sdk/src/abis/ERC20.json +0 -174
  246. package/template/node_modules/@sentio/sdk/src/abis/ERC20Bytes.json +0 -236
  247. package/template/node_modules/@sentio/sdk/src/abis/WETH9.json +0 -153
  248. package/template/node_modules/@sentio/sdk/src/base-processor-template.ts +0 -105
  249. package/template/node_modules/@sentio/sdk/src/base-processor.ts +0 -172
  250. package/template/node_modules/@sentio/sdk/src/bind-options.ts +0 -41
  251. package/template/node_modules/@sentio/sdk/src/binds.ts +0 -73
  252. package/template/node_modules/@sentio/sdk/src/builtin/erc20/index.ts +0 -6
  253. package/template/node_modules/@sentio/sdk/src/builtin/erc20/test-utils.ts +0 -71
  254. package/template/node_modules/@sentio/sdk/src/builtin/erc20bytes/index.ts +0 -6
  255. package/template/node_modules/@sentio/sdk/src/builtin/erc20bytes/test-utils.ts +0 -53
  256. package/template/node_modules/@sentio/sdk/src/builtin/internal/ERC20.ts +0 -679
  257. package/template/node_modules/@sentio/sdk/src/builtin/internal/ERC20Bytes.ts +0 -384
  258. package/template/node_modules/@sentio/sdk/src/builtin/internal/WETH9.ts +0 -480
  259. package/template/node_modules/@sentio/sdk/src/builtin/internal/common.ts +0 -46
  260. package/template/node_modules/@sentio/sdk/src/builtin/internal/erc20_processor.ts +0 -762
  261. package/template/node_modules/@sentio/sdk/src/builtin/internal/erc20bytes_processor.ts +0 -531
  262. package/template/node_modules/@sentio/sdk/src/builtin/internal/factories/ERC20Bytes__factory.ts +0 -257
  263. package/template/node_modules/@sentio/sdk/src/builtin/internal/factories/ERC20__factory.ts +0 -404
  264. package/template/node_modules/@sentio/sdk/src/builtin/internal/factories/WETH9__factory.ts +0 -297
  265. package/template/node_modules/@sentio/sdk/src/builtin/internal/factories/index.ts +0 -6
  266. package/template/node_modules/@sentio/sdk/src/builtin/internal/index.ts +0 -10
  267. package/template/node_modules/@sentio/sdk/src/builtin/internal/weth9_processor.ts +0 -589
  268. package/template/node_modules/@sentio/sdk/src/builtin/weth9/index.ts +0 -6
  269. package/template/node_modules/@sentio/sdk/src/builtin/weth9/test-utils.ts +0 -89
  270. package/template/node_modules/@sentio/sdk/src/chain-config.ts +0 -6
  271. package/template/node_modules/@sentio/sdk/src/cli/build.ts +0 -196
  272. package/template/node_modules/@sentio/sdk/src/cli/cli.ts +0 -160
  273. package/template/node_modules/@sentio/sdk/src/cli/commands/run-create.ts +0 -36
  274. package/template/node_modules/@sentio/sdk/src/cli/commands/run-login.ts +0 -70
  275. package/template/node_modules/@sentio/sdk/src/cli/config.ts +0 -45
  276. package/template/node_modules/@sentio/sdk/src/cli/key.ts +0 -43
  277. package/template/node_modules/@sentio/sdk/src/cli/solana-code-gen.ts +0 -16
  278. package/template/node_modules/@sentio/sdk/src/cli/upload.ts +0 -88
  279. package/template/node_modules/@sentio/sdk/src/cli/webpack.config.js +0 -42
  280. package/template/node_modules/@sentio/sdk/src/context.ts +0 -103
  281. package/template/node_modules/@sentio/sdk/src/contract-namer.ts +0 -17
  282. package/template/node_modules/@sentio/sdk/src/error.ts +0 -45
  283. package/template/node_modules/@sentio/sdk/src/gen/builtin.ts +0 -22
  284. package/template/node_modules/@sentio/sdk/src/gen/google/protobuf/empty.ts +0 -70
  285. package/template/node_modules/@sentio/sdk/src/gen/processor/protos/processor.ts +0 -3626
  286. package/template/node_modules/@sentio/sdk/src/generic-processor.ts +0 -35
  287. package/template/node_modules/@sentio/sdk/src/index.ts +0 -21
  288. package/template/node_modules/@sentio/sdk/src/loader.ts +0 -24
  289. package/template/node_modules/@sentio/sdk/src/meter.test.ts +0 -16
  290. package/template/node_modules/@sentio/sdk/src/meter.ts +0 -140
  291. package/template/node_modules/@sentio/sdk/src/numberish.test.ts +0 -82
  292. package/template/node_modules/@sentio/sdk/src/numberish.ts +0 -100
  293. package/template/node_modules/@sentio/sdk/src/processor-runner.ts +0 -46
  294. package/template/node_modules/@sentio/sdk/src/processor-state.ts +0 -24
  295. package/template/node_modules/@sentio/sdk/src/promise-or-void.ts +0 -1
  296. package/template/node_modules/@sentio/sdk/src/provider.ts +0 -74
  297. package/template/node_modules/@sentio/sdk/src/service.ts +0 -491
  298. package/template/node_modules/@sentio/sdk/src/solana/builtin/index.ts +0 -2
  299. package/template/node_modules/@sentio/sdk/src/solana/builtin/spl-token-processor.ts +0 -164
  300. package/template/node_modules/@sentio/sdk/src/solana/builtin/types.ts +0 -268
  301. package/template/node_modules/@sentio/sdk/src/solana/builtin/wormhole-processor.ts +0 -178
  302. package/template/node_modules/@sentio/sdk/src/solana-processor.ts +0 -106
  303. package/template/node_modules/@sentio/sdk/src/target-ethers-sentio/codegen.ts +0 -315
  304. package/template/node_modules/@sentio/sdk/src/target-ethers-sentio/functions.ts +0 -68
  305. package/template/node_modules/@sentio/sdk/src/target-ethers-sentio/index.ts +0 -50
  306. package/template/node_modules/@sentio/sdk/src/target-ethers-sentio/tsconfig.json +0 -9
  307. package/template/node_modules/@sentio/sdk/src/test/abis/evm/CommitmentPool.json +0 -1034
  308. package/template/node_modules/@sentio/sdk/src/test/abis/evm/anyswapRouter.json +0 -490
  309. package/template/node_modules/@sentio/sdk/src/test/abis/solana/mirrorworld.json +0 -1392
  310. package/template/node_modules/@sentio/sdk/src/test/codegen.test.ts +0 -29
  311. package/template/node_modules/@sentio/sdk/src/test/erc20-template.test.ts +0 -37
  312. package/template/node_modules/@sentio/sdk/src/test/erc20-template.ts +0 -25
  313. package/template/node_modules/@sentio/sdk/src/test/erc20.test.ts +0 -117
  314. package/template/node_modules/@sentio/sdk/src/test/erc20.ts +0 -50
  315. package/template/node_modules/@sentio/sdk/src/test/generic-processor.test.ts +0 -70
  316. package/template/node_modules/@sentio/sdk/src/test/index.ts +0 -2
  317. package/template/node_modules/@sentio/sdk/src/test/metric-utils.ts +0 -49
  318. package/template/node_modules/@sentio/sdk/src/test/mirrorworld.ts +0 -40
  319. package/template/node_modules/@sentio/sdk/src/test/sentio.yaml +0 -4
  320. package/template/node_modules/@sentio/sdk/src/test/solana.test.ts +0 -93
  321. package/template/node_modules/@sentio/sdk/src/test/test-processor-server.ts +0 -258
  322. package/template/node_modules/@sentio/sdk/src/test/test-provider.ts +0 -25
  323. package/template/node_modules/@sentio/sdk/src/test/types/game_wallet.ts +0 -1392
  324. package/template/node_modules/@sentio/sdk/src/test/types/game_wallet_processor.ts +0 -113
  325. package/template/node_modules/@sentio/sdk/src/test/wormhole-token-bridge.ts +0 -21
  326. package/template/node_modules/@sentio/sdk/src/trace.ts +0 -86
  327. package/template/node_modules/@sentio/sdk/src/types/global.d.ts +0 -17
  328. package/template/node_modules/@sentio/sdk/src/utils/chainmap.ts +0 -95
  329. package/template/node_modules/@sentio/sdk/src/utils/convert.ts +0 -26
  330. package/template/node_modules/@sentio/sdk/src/utils/erc20.test.ts +0 -26
  331. package/template/node_modules/@sentio/sdk/src/utils/erc20.ts +0 -66
  332. package/template/node_modules/@sentio/sdk/src/utils/index.ts +0 -3
  333. package/template/node_modules/base-x/LICENSE.md +0 -22
  334. package/template/node_modules/base-x/README.md +0 -73
  335. package/template/node_modules/base-x/package.json +0 -46
  336. package/template/node_modules/base-x/src/index.d.ts +0 -9
  337. package/template/node_modules/base-x/src/index.js +0 -121
  338. package/template/node_modules/bs58/CHANGELOG.md +0 -65
  339. package/template/node_modules/bs58/LICENSE +0 -21
  340. package/template/node_modules/bs58/README.md +0 -91
  341. package/template/node_modules/bs58/index.d.ts +0 -5
  342. package/template/node_modules/bs58/index.js +0 -4
  343. package/template/node_modules/bs58/package.json +0 -39
  344. package/template/src/types/internal/X2y2.ts +0 -684
  345. package/template/src/types/internal/common.ts +0 -46
  346. package/template/src/types/internal/factories/X2y2__factory.ts +0 -436
  347. package/template/src/types/internal/factories/index.ts +0 -4
  348. package/template/src/types/internal/index.ts +0 -6
  349. package/template/src/types/internal/x2y2_processor.ts +0 -1004
  350. package/template/src/types/x2y2/index.ts +0 -6
  351. package/template/src/types/x2y2/test-utils.ts +0 -89
@@ -1,491 +0,0 @@
1
- import { Block, Log } from '@ethersproject/abstract-provider'
2
- import { CallContext, ServerError, Status } from 'nice-grpc'
3
-
4
- import {
5
- BlockBinding,
6
- ContractConfig,
7
- HandlerType,
8
- LogFilter,
9
- LogHandlerConfig,
10
- ProcessResult,
11
- ProcessBlocksRequest,
12
- ProcessBlocksResponse,
13
- ProcessConfigRequest,
14
- ProcessConfigResponse,
15
- ProcessInstructionsRequest,
16
- ProcessInstructionsResponse,
17
- ProcessLogsRequest,
18
- ProcessLogsResponse,
19
- ProcessorServiceImplementation,
20
- ProcessTracesRequest,
21
- ProcessTracesResponse,
22
- ProcessTransactionsRequest,
23
- ProcessTransactionsResponse,
24
- StartRequest,
25
- TemplateInstance,
26
- TraceBinding,
27
- } from './gen/processor/protos/processor'
28
-
29
- import { Empty } from './gen/google/protobuf/empty'
30
- import Long from 'long'
31
- import { TextDecoder } from 'util'
32
- import { Trace } from './trace'
33
-
34
- const DEFAULT_MAX_BLOCK = Long.ZERO
35
-
36
- export class ProcessorServiceImpl implements ProcessorServiceImplementation {
37
- private eventHandlers: ((event: Log) => Promise<ProcessResult>)[] = []
38
- private traceHandlers: ((trace: Trace) => Promise<ProcessResult>)[] = []
39
- private blockHandlers: ((block: Block) => Promise<ProcessResult>)[] = []
40
-
41
- // map from chain id to list of processors
42
- // private blockHandlers = new Map<string, ((block: Block) => Promise<ProcessResult>)[]>()
43
- // private processorsByChainId = new Map<string, BaseProcessor<BaseContract, BoundContractView<BaseContract, any>>>()
44
-
45
- private started = false
46
- private contractConfigs: ContractConfig[]
47
- private templateInstances: TemplateInstance[]
48
- private readonly loader: () => void
49
-
50
- private readonly shutdownHandler?: () => void
51
-
52
- constructor(loader: () => void, shutdownHandler?: () => void) {
53
- this.loader = loader
54
- this.shutdownHandler = shutdownHandler
55
- }
56
-
57
- async getConfig(request: ProcessConfigRequest, context: CallContext): Promise<ProcessConfigResponse> {
58
- if (!this.started) {
59
- throw new ServerError(Status.UNAVAILABLE, 'Service Not started.')
60
- }
61
- return {
62
- // TODO project setting
63
- config: undefined,
64
- contractConfigs: this.contractConfigs,
65
- templateInstances: this.templateInstances,
66
- }
67
- }
68
-
69
- async configure() {
70
- this.eventHandlers = []
71
- this.templateInstances = []
72
- // this.processorsByChainId.clear()
73
- this.contractConfigs = []
74
-
75
- this.templateInstances = [...global.PROCESSOR_STATE.templatesInstances]
76
-
77
- // Part 1, prepare EVM processors
78
- for (const processor of global.PROCESSOR_STATE.processors) {
79
- // If server favor incremental update this need to change
80
- // Start basic config for contract
81
- const chainId = processor.getChainId()
82
- // this.processorsByChainId.set(chainId, processor)
83
-
84
- const contractConfig: ContractConfig = {
85
- processorType: 'user_processor',
86
- contract: {
87
- name: processor.config.name,
88
- chainId: chainId.toString(),
89
- address: processor.config.address,
90
- abi: '',
91
- },
92
- blockConfigs: [],
93
- logConfigs: [],
94
- traceConfigs: [],
95
- startBlock: processor.config.startBlock,
96
- endBlock: DEFAULT_MAX_BLOCK,
97
- instructionConfig: undefined,
98
- }
99
- if (processor.config.endBlock) {
100
- contractConfig.endBlock = processor.config.endBlock
101
- }
102
-
103
- // Step 1. Prepare all the block handlers
104
- for (const blockHandler of processor.blockHandlers) {
105
- const handlerId = this.blockHandlers.push(blockHandler) - 1
106
- contractConfig.blockConfigs.push({
107
- handlerId: handlerId,
108
- })
109
- }
110
-
111
- // Step 2. Prepare all trace handlers
112
- for (const traceHandler of processor.traceHandlers) {
113
- const handlerId = this.traceHandlers.push(traceHandler.handler) - 1
114
- contractConfig.traceConfigs.push({
115
- signature: traceHandler.signature,
116
- handlerId: handlerId,
117
- })
118
- }
119
-
120
- // Step 3. Prepare all the event handlers
121
- for (const eventsHandler of processor.eventHandlers) {
122
- // associate id with filter
123
- const handlerId = this.eventHandlers.push(eventsHandler.handler) - 1
124
- const logConfig: LogHandlerConfig = {
125
- handlerId: handlerId,
126
- filters: [],
127
- }
128
-
129
- for (const filter of eventsHandler.filters) {
130
- if (!filter.topics) {
131
- throw new ServerError(Status.INVALID_ARGUMENT, 'Topic should not be null')
132
- }
133
- const logFilter: LogFilter = {
134
- topics: [],
135
- }
136
-
137
- for (const ts of filter.topics) {
138
- let hashes: string[] = []
139
- if (Array.isArray(ts)) {
140
- hashes = hashes.concat(ts)
141
- } else if (ts) {
142
- hashes.push(ts)
143
- }
144
- logFilter.topics.push({ hashes: hashes })
145
- }
146
- logConfig.filters.push(logFilter)
147
- }
148
- contractConfig.logConfigs.push(logConfig)
149
- }
150
-
151
- // Finish up a contract
152
- this.contractConfigs.push(contractConfig)
153
- }
154
-
155
- // Part 2, prepare solana constractors
156
- for (const solanaProcessor of global.PROCESSOR_STATE.solanaProcessors) {
157
- const contractConfig: ContractConfig = {
158
- processorType: 'user_processor',
159
- contract: {
160
- name: solanaProcessor.contractName,
161
- chainId: 'SOL_mainnet', // TODO set in processor
162
- address: solanaProcessor.address,
163
- abi: '',
164
- },
165
- blockConfigs: [],
166
- logConfigs: [],
167
- traceConfigs: [],
168
- startBlock: solanaProcessor.config.startSlot,
169
- endBlock: DEFAULT_MAX_BLOCK,
170
- instructionConfig: {
171
- innerInstruction: solanaProcessor.processInnerInstruction,
172
- parsedInstruction: solanaProcessor.fromParsedInstruction !== null,
173
- rawDataInstruction: solanaProcessor.decodeInstruction !== null,
174
- },
175
- }
176
- this.contractConfigs.push(contractConfig)
177
- }
178
- }
179
-
180
- async start(request: StartRequest, context: CallContext): Promise<Empty> {
181
- if (this.started) {
182
- return {}
183
- }
184
-
185
- this.loader()
186
-
187
- for (const instance of request.templateInstances) {
188
- const template = global.PROCESSOR_STATE.templates[instance.templateId]
189
- if (!template) {
190
- throw new ServerError(Status.INVALID_ARGUMENT, 'Invalid template contract:' + instance)
191
- }
192
- if (!instance.contract) {
193
- throw new ServerError(Status.INVALID_ARGUMENT, 'Contract Empty from:' + instance)
194
- }
195
- template.bind({
196
- name: instance.contract.name,
197
- address: instance.contract.address,
198
- network: Number(instance.contract.chainId),
199
- startBlock: instance.startBlock,
200
- endBlock: instance.endBlock,
201
- })
202
- }
203
- await this.configure()
204
- this.started = true
205
- return {}
206
- }
207
-
208
- async stop(request: Empty, context: CallContext): Promise<Empty> {
209
- console.log('Server Shutting down in 5 seconds')
210
- if (this.shutdownHandler) {
211
- setTimeout(this.shutdownHandler, 5000)
212
- }
213
- return {}
214
- }
215
-
216
- async processLogs(request: ProcessLogsRequest, context: CallContext): Promise<ProcessLogsResponse> {
217
- if (!this.started) {
218
- throw new ServerError(Status.UNAVAILABLE, 'Service Not started.')
219
- }
220
-
221
- const resp: ProcessResult = {
222
- gauges: [],
223
- counters: [],
224
- logs: [],
225
- }
226
-
227
- const promises: Promise<ProcessResult>[] = []
228
- for (const l of request.logBindings) {
229
- if (!l.log) {
230
- throw new ServerError(Status.INVALID_ARGUMENT, "Log can't be null")
231
- }
232
- // const jsonString = Buffer.from(l.log.raw.buffer).toString("utf-8")
233
- // const jsonString = String.fromCharCode.apply(null, l.log.raw)
234
-
235
- try {
236
- const jsonString = Utf8ArrayToStr(l.log.raw)
237
- const log: Log = JSON.parse(jsonString)
238
- const handler = this.eventHandlers[l.handlerId]
239
- const promise = handler(log).catch((e) => {
240
- throw new ServerError(Status.INTERNAL, 'error processing log: ' + jsonString + '\n' + e.toString())
241
- })
242
-
243
- promises.push(promise)
244
- } catch (e) {
245
- throw new ServerError(Status.INTERNAL, 'error parse log: ' + l)
246
- }
247
- }
248
-
249
- const results = await Promise.all(promises)
250
- for (const res of results) {
251
- resp.counters = resp.counters.concat(res.counters)
252
- resp.gauges = resp.gauges.concat(res.gauges)
253
- }
254
-
255
- let updated = false
256
- if (
257
- global.PROCESSOR_STATE.templatesInstances &&
258
- this.templateInstances.length != global.PROCESSOR_STATE.templatesInstances.length
259
- ) {
260
- await this.configure()
261
- updated = true
262
- }
263
-
264
- recordRuntimeInfo(resp, HandlerType.LOG)
265
- return {
266
- result: resp,
267
- configUpdated: updated,
268
- }
269
- }
270
-
271
- async processTransactions(
272
- request: ProcessTransactionsRequest,
273
- context: CallContext
274
- ): Promise<ProcessTransactionsResponse> {
275
- if (!this.started) {
276
- throw new ServerError(Status.UNAVAILABLE, 'Service not started.')
277
- }
278
-
279
- throw new ServerError(Status.UNIMPLEMENTED, 'Processing transaction is not suppored.')
280
- }
281
-
282
- async processInstructions(
283
- request: ProcessInstructionsRequest,
284
- context: CallContext
285
- ): Promise<ProcessInstructionsResponse> {
286
- if (!this.started) {
287
- throw new ServerError(Status.UNAVAILABLE, 'Service not started.')
288
- }
289
-
290
- const result: ProcessResult = {
291
- gauges: [],
292
- counters: [],
293
- logs: [],
294
- }
295
-
296
- // Only have instruction handlers for solana processors
297
- if (global.PROCESSOR_STATE.solanaProcessors) {
298
- const processorPromises: Promise<void>[] = []
299
- for (const instruction of request.instructions) {
300
- if (!instruction) {
301
- throw new ServerError(Status.INVALID_ARGUMENT, 'instruction cannot be null')
302
- }
303
-
304
- processorPromises.push(
305
- new Promise((resolve, _) => {
306
- for (const processor of global.PROCESSOR_STATE.solanaProcessors) {
307
- if (processor.address === instruction.programAccountId) {
308
- let res: ProcessResult | null
309
- if (instruction.parsed) {
310
- res = processor.handleInstruction(JSON.parse(new TextDecoder().decode(instruction.parsed)))
311
- } else if (instruction.instructionData) {
312
- res = processor.handleInstruction(instruction.instructionData)
313
- } else {
314
- continue
315
- }
316
- if (res) {
317
- try {
318
- res.gauges.forEach((g) => {
319
- if (g.metadata) {
320
- g.metadata.blockNumber = instruction.slot
321
- }
322
- result.gauges.push(g)
323
- })
324
- res.counters.forEach((c) => {
325
- if (c.metadata) {
326
- c.metadata.blockNumber = instruction.slot
327
- }
328
- result.counters.push(c)
329
- })
330
- } catch (e) {
331
- console.error('error processing instruction ' + e.toString())
332
- }
333
- } else {
334
- console.warn(
335
- `Failed to decode the instruction: ${instruction.instructionData} with slot: ${instruction.slot}`
336
- )
337
- }
338
- }
339
- }
340
- resolve()
341
- })
342
- )
343
- }
344
-
345
- await Promise.all(processorPromises)
346
- }
347
-
348
- recordRuntimeInfo(result, HandlerType.INSTRUCTION)
349
- return {
350
- result,
351
- }
352
- }
353
-
354
- async processBlocks(request: ProcessBlocksRequest, context: CallContext): Promise<ProcessBlocksResponse> {
355
- if (!this.started) {
356
- throw new ServerError(Status.UNAVAILABLE, 'Service Not started.')
357
- }
358
-
359
- const promises = request.blockBindings.map((binding) => this.processBlock(binding))
360
- const results = await Promise.all(promises)
361
-
362
- const res = ProcessResult.fromPartial({})
363
-
364
- for (const r of results) {
365
- res.counters = res.counters.concat(r.counters)
366
- res.gauges = res.gauges.concat(r.gauges)
367
- }
368
-
369
- recordRuntimeInfo(res, HandlerType.BLOCK)
370
- return {
371
- result: res,
372
- }
373
- }
374
-
375
- async processBlock(binding: BlockBinding): Promise<ProcessResult> {
376
- if (!binding.block) {
377
- throw new ServerError(Status.INVALID_ARGUMENT, "Block can't be empty")
378
- }
379
- const jsonString = Utf8ArrayToStr(binding.block.raw)
380
-
381
- const block: Block = JSON.parse(jsonString)
382
-
383
- const resp: ProcessResult = {
384
- gauges: [],
385
- counters: [],
386
- logs: [],
387
- }
388
-
389
- const promises: Promise<ProcessResult>[] = []
390
- for (const handlerId of binding.handlerIds) {
391
- const promise = this.blockHandlers[handlerId](block).catch((e) => {
392
- throw new ServerError(Status.INTERNAL, 'error processing block: ' + block.number + '\n' + e.toString())
393
- })
394
- promises.push(promise)
395
- }
396
- const allRes = await Promise.all(promises)
397
- for (const res of allRes) {
398
- resp.counters = resp.counters.concat(res.counters)
399
- resp.gauges = resp.gauges.concat(res.gauges)
400
- }
401
- return resp
402
- }
403
-
404
- async processTraces(request: ProcessTracesRequest, context: CallContext): Promise<ProcessTracesResponse> {
405
- if (!this.started) {
406
- throw new ServerError(Status.UNAVAILABLE, 'Service Not started.')
407
- }
408
-
409
- const promises = request.traceBindings.map((binding) => this.processTrace(binding))
410
- const results = await Promise.all(promises)
411
-
412
- const res = ProcessResult.fromPartial({})
413
-
414
- for (const r of results) {
415
- res.counters = res.counters.concat(r.counters)
416
- res.gauges = res.gauges.concat(r.gauges)
417
- }
418
-
419
- recordRuntimeInfo(res, HandlerType.TRACE)
420
- return {
421
- result: res,
422
- }
423
- }
424
-
425
- async processTrace(binding: TraceBinding): Promise<ProcessResult> {
426
- if (!binding.trace) {
427
- throw new ServerError(Status.INVALID_ARGUMENT, "Trace can't be empty")
428
- }
429
- const jsonString = Utf8ArrayToStr(binding.trace.raw)
430
- const trace: Trace = JSON.parse(jsonString)
431
-
432
- return this.traceHandlers[binding.handlerId](trace).catch((e) => {
433
- throw new ServerError(Status.INTERNAL, 'error processing trace: ' + jsonString + '\n' + e.toString())
434
- })
435
- }
436
- }
437
-
438
- // https://ourcodeworld.com/articles/read/164/how-to-convert-an-uint8array-to-string-in-javascript
439
- /* eslint-disable */
440
- function Utf8ArrayToStr(array: Uint8Array) {
441
- let out, i, len, c
442
- let char2, char3
443
-
444
- out = ''
445
- len = array.length
446
- i = 0
447
- while (i < len) {
448
- c = array[i++]
449
- switch (c >> 4) {
450
- case 0:
451
- case 1:
452
- case 2:
453
- case 3:
454
- case 4:
455
- case 5:
456
- case 6:
457
- case 7:
458
- // 0xxxxxxx
459
- out += String.fromCharCode(c)
460
- break
461
- case 12:
462
- case 13:
463
- // 110x xxxx 10xx xxxx
464
- char2 = array[i++]
465
- out += String.fromCharCode(((c & 0x1f) << 6) | (char2 & 0x3f))
466
- break
467
- case 14:
468
- // 1110 xxxx 10xx xxxx 10xx xxxx
469
- char2 = array[i++]
470
- char3 = array[i++]
471
- out += String.fromCharCode(((c & 0x0f) << 12) | ((char2 & 0x3f) << 6) | ((char3 & 0x3f) << 0))
472
- break
473
- }
474
- }
475
-
476
- return out
477
- }
478
-
479
- function recordRuntimeInfo(results: ProcessResult, handlerType: HandlerType) {
480
- results.gauges.forEach((e) => {
481
- e.runtimeInfo = {
482
- from: handlerType,
483
- }
484
- })
485
-
486
- results.counters.forEach((e) => {
487
- e.runtimeInfo = {
488
- from: handlerType,
489
- }
490
- })
491
- }
@@ -1,2 +0,0 @@
1
- export * from './spl-token-processor'
2
- export * from './wormhole-processor'
@@ -1,164 +0,0 @@
1
- import { SolanaBaseProcessor } from '../../solana-processor'
2
- import { SolanaContext } from '../../context'
3
- import { Instruction } from '@project-serum/anchor'
4
- import { Approve, Burn, CloseAccount, FreezeAccount, InitializeAccount, InitializeAccount2, InitializeAccount3, InitializeMint, InitializeMultisig, MintTo, Revoke, ThawAccount, Transfer } from './types';
5
- import { SolanaBindOptions } from '../../bind-options';
6
-
7
- export class SPLTokenProcessor extends SolanaBaseProcessor {
8
- static bind(options: SolanaBindOptions): SPLTokenProcessor {
9
- if (options && !options.name) {
10
- options.name = 'SPL Token Program'
11
- }
12
- return new SPLTokenProcessor(options)
13
- }
14
-
15
- fromParsedInstruction: (instruction: { type: string, info: any }) => Instruction | null = (instruction: { type: string, info: any }) => {
16
- const instructionType = instruction.type
17
- if (!instructionType) {
18
- return null
19
- }
20
- return {
21
- name: instruction.type,
22
- data: {
23
- ...instruction.info,
24
- },
25
- }
26
- }
27
-
28
- public onInitializeMint(
29
- handler: (data: InitializeMint, ctx: SolanaContext) => void
30
- ): SPLTokenProcessor {
31
- this.onInstruction('initializeMint', (ins: Instruction, ctx) => {
32
- if (ins) {
33
- handler(ins.data as InitializeMint, ctx)
34
- }
35
- })
36
- return this
37
- }
38
-
39
- public onInitializeAccount(
40
- hanlder: (data: InitializeAccount, ctx: SolanaContext) => void
41
- ): SPLTokenProcessor {
42
- this.onInstruction('initializeAccount', (ins: Instruction, ctx) => {
43
- if (ins) {
44
- hanlder(ins.data as InitializeAccount, ctx)
45
- }
46
- })
47
- return this
48
- }
49
-
50
- public onInitializeAccount2(
51
- hanlder: (data: InitializeAccount2, ctx: SolanaContext) => void
52
- ): SPLTokenProcessor {
53
- this.onInstruction('initializeAccount2', (ins: Instruction, ctx) => {
54
- if (ins) {
55
- hanlder(ins.data as InitializeAccount2, ctx)
56
- }
57
- })
58
- return this
59
- }
60
-
61
- public onInitializeAccount3(
62
- hanlder: (data: InitializeAccount3, ctx: SolanaContext) => void
63
- ): SPLTokenProcessor {
64
- this.onInstruction('initializeAccount3', (ins: Instruction, ctx) => {
65
- if (ins) {
66
- hanlder(ins.data as InitializeAccount3, ctx)
67
- }
68
- })
69
- return this
70
- }
71
-
72
- public onInitializeMultisig(
73
- handler: (data: InitializeMultisig, ctx: SolanaContext) => void
74
- ): SPLTokenProcessor {
75
- this.onInstruction('initializeMultisig', (ins: Instruction, ctx) => {
76
- if (ins) {
77
- handler(ins.data as InitializeMultisig, ctx)
78
- }
79
- })
80
- return this
81
- }
82
-
83
- public onTransfer(handler: (data: Transfer, ctx: SolanaContext) => void): SPLTokenProcessor {
84
- this.onInstruction('transfer', (ins: Instruction, ctx) => {
85
- if (ins) {
86
- handler(ins.data as Transfer, ctx)
87
- }
88
- })
89
- return this
90
- }
91
-
92
- public onApprovend(handler: (data: Approve, ctx: SolanaContext) => void): SPLTokenProcessor {
93
- this.onInstruction('approve', (ins: Instruction, ctx) => {
94
- if (ins) {
95
- handler(ins.data as Approve, ctx)
96
- }
97
- })
98
- return this
99
- }
100
-
101
- public onRevoke(handler: (data: Revoke, ctx: SolanaContext) => void): SPLTokenProcessor {
102
- this.onInstruction('revoke', (ins: Instruction, ctx) => {
103
- if (ins) {
104
- handler(ins.data as Revoke, ctx)
105
- }
106
- })
107
- return this
108
- }
109
-
110
- public onSetAuthority(handler: (data: any, ctx: SolanaContext) => void): SPLTokenProcessor {
111
- this.onInstruction('setAuthority', (ins: Instruction, ctx) => {
112
- if (ins) {
113
- handler(ins.data as any, ctx)
114
- }
115
- })
116
- return this
117
- }
118
-
119
- public onMintTo(handler: (data: MintTo, ctx: SolanaContext) => void): SPLTokenProcessor {
120
- this.onInstruction('mintTo', (ins: Instruction, ctx) => {
121
- if (ins) {
122
- handler(ins.data as MintTo, ctx)
123
- }
124
- })
125
- return this
126
- }
127
-
128
- public onBurn(handler: (data: Burn, ctx: SolanaContext) => void): SPLTokenProcessor {
129
- this.onInstruction('burn', (ins: Instruction, ctx) => {
130
- if (ins) {
131
- handler(ins.data as Burn, ctx)
132
- }
133
- })
134
- return this
135
- }
136
-
137
- public onCloseAccount(handler: (data: CloseAccount, ctx: SolanaContext) => void): SPLTokenProcessor {
138
- this.onInstruction('closeAccount', (ins: Instruction, ctx) => {
139
- if (ins) {
140
- handler(ins.data as CloseAccount, ctx)
141
- }
142
- })
143
- return this
144
- }
145
-
146
- public onFreezeAccount(handler: (data: FreezeAccount, ctx: SolanaContext) => void): SPLTokenProcessor {
147
- this.onInstruction('freezeAccount', (ins: Instruction, ctx) => {
148
- if (ins) {
149
- handler(ins.data as FreezeAccount, ctx)
150
- }
151
- })
152
- return this
153
- }
154
-
155
- public onThawAccount(handler: (data: ThawAccount, ctx: SolanaContext) => void): SPLTokenProcessor {
156
- this.onInstruction('thawAccount', (ins: Instruction, ctx) => {
157
- if (ins) {
158
- handler(ins.data as ThawAccount, ctx)
159
- }
160
- })
161
- return this
162
- }
163
- // Todo(pcxu): auto gen this file
164
- }