@sentio/sdk 1.13.1 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (361) 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/lib/gen/processor/protos/processor.d.ts +0 -1
  4. package/lib/gen/processor/protos/processor.js +0 -10
  5. package/lib/gen/processor/protos/processor.js.map +1 -1
  6. package/lib/meter.js +0 -5
  7. package/lib/meter.js.map +1 -1
  8. package/lib/test/metric-utils.js +2 -2
  9. package/lib/test/metric-utils.js.map +1 -1
  10. package/package.json +1 -1
  11. package/src/cli/commands/run-create.ts +3 -0
  12. package/src/gen/processor/protos/processor.ts +0 -11
  13. package/src/meter.ts +0 -5
  14. package/src/test/metric-utils.ts +2 -2
  15. package/template/package.json +2 -3
  16. package/template/src/processor.test.ts +1 -1
  17. package/template/src/processor.ts +20 -16
  18. package/template/node_modules/@sentio/sdk/lib/base-processor-template.d.ts +0 -27
  19. package/template/node_modules/@sentio/sdk/lib/base-processor-template.js +0 -80
  20. package/template/node_modules/@sentio/sdk/lib/base-processor-template.js.map +0 -1
  21. package/template/node_modules/@sentio/sdk/lib/base-processor.d.ts +0 -30
  22. package/template/node_modules/@sentio/sdk/lib/base-processor.js +0 -148
  23. package/template/node_modules/@sentio/sdk/lib/base-processor.js.map +0 -1
  24. package/template/node_modules/@sentio/sdk/lib/bind-options.d.ts +0 -21
  25. package/template/node_modules/@sentio/sdk/lib/bind-options.js +0 -42
  26. package/template/node_modules/@sentio/sdk/lib/bind-options.js.map +0 -1
  27. package/template/node_modules/@sentio/sdk/lib/binds.d.ts +0 -10
  28. package/template/node_modules/@sentio/sdk/lib/binds.js +0 -59
  29. package/template/node_modules/@sentio/sdk/lib/binds.js.map +0 -1
  30. package/template/node_modules/@sentio/sdk/lib/builtin/erc20/index.d.ts +0 -2
  31. package/template/node_modules/@sentio/sdk/lib/builtin/erc20/index.js +0 -22
  32. package/template/node_modules/@sentio/sdk/lib/builtin/erc20/index.js.map +0 -1
  33. package/template/node_modules/@sentio/sdk/lib/builtin/erc20/test-utils.d.ts +0 -5
  34. package/template/node_modules/@sentio/sdk/lib/builtin/erc20/test-utils.js +0 -46
  35. package/template/node_modules/@sentio/sdk/lib/builtin/erc20/test-utils.js.map +0 -1
  36. package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/index.d.ts +0 -2
  37. package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/index.js +0 -22
  38. package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/index.js.map +0 -1
  39. package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/test-utils.d.ts +0 -4
  40. package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/test-utils.js +0 -35
  41. package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/test-utils.js.map +0 -1
  42. package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20.d.ts +0 -307
  43. package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20.js +0 -3
  44. package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20.js.map +0 -1
  45. package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20Bytes.d.ts +0 -166
  46. package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20Bytes.js +0 -3
  47. package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20Bytes.js.map +0 -1
  48. package/template/node_modules/@sentio/sdk/lib/builtin/internal/WETH9.d.ts +0 -221
  49. package/template/node_modules/@sentio/sdk/lib/builtin/internal/WETH9.js +0 -3
  50. package/template/node_modules/@sentio/sdk/lib/builtin/internal/WETH9.js.map +0 -1
  51. package/template/node_modules/@sentio/sdk/lib/builtin/internal/common.d.ts +0 -22
  52. package/template/node_modules/@sentio/sdk/lib/builtin/internal/common.js +0 -3
  53. package/template/node_modules/@sentio/sdk/lib/builtin/internal/common.js.map +0 -1
  54. package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20_processor.d.ts +0 -184
  55. package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20_processor.js +0 -453
  56. package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20_processor.js.map +0 -1
  57. package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20bytes_processor.d.ts +0 -110
  58. package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20bytes_processor.js +0 -325
  59. package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20bytes_processor.js.map +0 -1
  60. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20Bytes__factory.d.ts +0 -48
  61. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20Bytes__factory.js +0 -254
  62. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20Bytes__factory.js.map +0 -1
  63. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20__factory.d.ts +0 -42
  64. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20__factory.js +0 -404
  65. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20__factory.js.map +0 -1
  66. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/WETH9__factory.d.ts +0 -45
  67. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/WETH9__factory.js +0 -297
  68. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/WETH9__factory.js.map +0 -1
  69. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/index.d.ts +0 -3
  70. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/index.js +0 -13
  71. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/index.js.map +0 -1
  72. package/template/node_modules/@sentio/sdk/lib/builtin/internal/index.d.ts +0 -7
  73. package/template/node_modules/@sentio/sdk/lib/builtin/internal/index.js +0 -34
  74. package/template/node_modules/@sentio/sdk/lib/builtin/internal/index.js.map +0 -1
  75. package/template/node_modules/@sentio/sdk/lib/builtin/internal/weth9_processor.d.ts +0 -126
  76. package/template/node_modules/@sentio/sdk/lib/builtin/internal/weth9_processor.js +0 -361
  77. package/template/node_modules/@sentio/sdk/lib/builtin/internal/weth9_processor.js.map +0 -1
  78. package/template/node_modules/@sentio/sdk/lib/builtin/weth9/index.d.ts +0 -2
  79. package/template/node_modules/@sentio/sdk/lib/builtin/weth9/index.js +0 -22
  80. package/template/node_modules/@sentio/sdk/lib/builtin/weth9/index.js.map +0 -1
  81. package/template/node_modules/@sentio/sdk/lib/builtin/weth9/test-utils.d.ts +0 -6
  82. package/template/node_modules/@sentio/sdk/lib/builtin/weth9/test-utils.js +0 -57
  83. package/template/node_modules/@sentio/sdk/lib/builtin/weth9/test-utils.js.map +0 -1
  84. package/template/node_modules/@sentio/sdk/lib/chain-config.d.ts +0 -6
  85. package/template/node_modules/@sentio/sdk/lib/chain-config.js +0 -3
  86. package/template/node_modules/@sentio/sdk/lib/chain-config.js.map +0 -1
  87. package/template/node_modules/@sentio/sdk/lib/cli/build.d.ts +0 -4
  88. package/template/node_modules/@sentio/sdk/lib/cli/build.js +0 -178
  89. package/template/node_modules/@sentio/sdk/lib/cli/build.js.map +0 -1
  90. package/template/node_modules/@sentio/sdk/lib/cli/cli.d.ts +0 -2
  91. package/template/node_modules/@sentio/sdk/lib/cli/cli.js +0 -163
  92. package/template/node_modules/@sentio/sdk/lib/cli/cli.js.map +0 -1
  93. package/template/node_modules/@sentio/sdk/lib/cli/commands/run-create.d.ts +0 -1
  94. package/template/node_modules/@sentio/sdk/lib/cli/commands/run-create.js +0 -43
  95. package/template/node_modules/@sentio/sdk/lib/cli/commands/run-create.js.map +0 -1
  96. package/template/node_modules/@sentio/sdk/lib/cli/commands/run-login.d.ts +0 -1
  97. package/template/node_modules/@sentio/sdk/lib/cli/commands/run-login.js +0 -77
  98. package/template/node_modules/@sentio/sdk/lib/cli/commands/run-login.js.map +0 -1
  99. package/template/node_modules/@sentio/sdk/lib/cli/config.d.ts +0 -16
  100. package/template/node_modules/@sentio/sdk/lib/cli/config.js +0 -36
  101. package/template/node_modules/@sentio/sdk/lib/cli/config.js.map +0 -1
  102. package/template/node_modules/@sentio/sdk/lib/cli/key.d.ts +0 -2
  103. package/template/node_modules/@sentio/sdk/lib/cli/key.js +0 -44
  104. package/template/node_modules/@sentio/sdk/lib/cli/key.js.map +0 -1
  105. package/template/node_modules/@sentio/sdk/lib/cli/solana-code-gen.d.ts +0 -2
  106. package/template/node_modules/@sentio/sdk/lib/cli/solana-code-gen.js +0 -19
  107. package/template/node_modules/@sentio/sdk/lib/cli/solana-code-gen.js.map +0 -1
  108. package/template/node_modules/@sentio/sdk/lib/cli/upload.d.ts +0 -2
  109. package/template/node_modules/@sentio/sdk/lib/cli/upload.js +0 -85
  110. package/template/node_modules/@sentio/sdk/lib/cli/upload.js.map +0 -1
  111. package/template/node_modules/@sentio/sdk/lib/cli/webpack.config.js +0 -42
  112. package/template/node_modules/@sentio/sdk/lib/context.d.ts +0 -49
  113. package/template/node_modules/@sentio/sdk/lib/context.js +0 -93
  114. package/template/node_modules/@sentio/sdk/lib/context.js.map +0 -1
  115. package/template/node_modules/@sentio/sdk/lib/contract-namer.d.ts +0 -6
  116. package/template/node_modules/@sentio/sdk/lib/contract-namer.js +0 -20
  117. package/template/node_modules/@sentio/sdk/lib/contract-namer.js.map +0 -1
  118. package/template/node_modules/@sentio/sdk/lib/error.d.ts +0 -7
  119. package/template/node_modules/@sentio/sdk/lib/error.js +0 -43
  120. package/template/node_modules/@sentio/sdk/lib/error.js.map +0 -1
  121. package/template/node_modules/@sentio/sdk/lib/gen/builtin.d.ts +0 -6
  122. package/template/node_modules/@sentio/sdk/lib/gen/builtin.js +0 -3
  123. package/template/node_modules/@sentio/sdk/lib/gen/builtin.js.map +0 -1
  124. package/template/node_modules/@sentio/sdk/lib/gen/google/protobuf/empty.d.ts +0 -16
  125. package/template/node_modules/@sentio/sdk/lib/gen/google/protobuf/empty.js +0 -47
  126. package/template/node_modules/@sentio/sdk/lib/gen/google/protobuf/empty.js.map +0 -1
  127. package/template/node_modules/@sentio/sdk/lib/gen/processor/protos/processor.d.ts +0 -666
  128. package/template/node_modules/@sentio/sdk/lib/gen/processor/protos/processor.js +0 -2837
  129. package/template/node_modules/@sentio/sdk/lib/gen/processor/protos/processor.js.map +0 -1
  130. package/template/node_modules/@sentio/sdk/lib/generic-processor.d.ts +0 -10
  131. package/template/node_modules/@sentio/sdk/lib/generic-processor.js +0 -32
  132. package/template/node_modules/@sentio/sdk/lib/generic-processor.js.map +0 -1
  133. package/template/node_modules/@sentio/sdk/lib/index.d.ts +0 -18
  134. package/template/node_modules/@sentio/sdk/lib/index.js +0 -63
  135. package/template/node_modules/@sentio/sdk/lib/index.js.map +0 -1
  136. package/template/node_modules/@sentio/sdk/lib/loader.d.ts +0 -5
  137. package/template/node_modules/@sentio/sdk/lib/loader.js +0 -30
  138. package/template/node_modules/@sentio/sdk/lib/loader.js.map +0 -1
  139. package/template/node_modules/@sentio/sdk/lib/meter.d.ts +0 -26
  140. package/template/node_modules/@sentio/sdk/lib/meter.js +0 -131
  141. package/template/node_modules/@sentio/sdk/lib/meter.js.map +0 -1
  142. package/template/node_modules/@sentio/sdk/lib/meter.test.d.ts +0 -1
  143. package/template/node_modules/@sentio/sdk/lib/meter.test.js +0 -16
  144. package/template/node_modules/@sentio/sdk/lib/meter.test.js.map +0 -1
  145. package/template/node_modules/@sentio/sdk/lib/numberish.d.ts +0 -6
  146. package/template/node_modules/@sentio/sdk/lib/numberish.js +0 -96
  147. package/template/node_modules/@sentio/sdk/lib/numberish.js.map +0 -1
  148. package/template/node_modules/@sentio/sdk/lib/numberish.test.d.ts +0 -1
  149. package/template/node_modules/@sentio/sdk/lib/numberish.test.js +0 -70
  150. package/template/node_modules/@sentio/sdk/lib/numberish.test.js.map +0 -1
  151. package/template/node_modules/@sentio/sdk/lib/processor-runner.d.ts +0 -2
  152. package/template/node_modules/@sentio/sdk/lib/processor-runner.js +0 -40
  153. package/template/node_modules/@sentio/sdk/lib/processor-runner.js.map +0 -1
  154. package/template/node_modules/@sentio/sdk/lib/processor-state.d.ts +0 -16
  155. package/template/node_modules/@sentio/sdk/lib/processor-state.js +0 -20
  156. package/template/node_modules/@sentio/sdk/lib/processor-state.js.map +0 -1
  157. package/template/node_modules/@sentio/sdk/lib/promise-or-void.d.ts +0 -1
  158. package/template/node_modules/@sentio/sdk/lib/promise-or-void.js +0 -3
  159. package/template/node_modules/@sentio/sdk/lib/promise-or-void.js.map +0 -1
  160. package/template/node_modules/@sentio/sdk/lib/provider.d.ts +0 -6
  161. package/template/node_modules/@sentio/sdk/lib/provider.js +0 -66
  162. package/template/node_modules/@sentio/sdk/lib/provider.js.map +0 -1
  163. package/template/node_modules/@sentio/sdk/lib/release.config.js +0 -31
  164. package/template/node_modules/@sentio/sdk/lib/service.d.ts +0 -25
  165. package/template/node_modules/@sentio/sdk/lib/service.js +0 -406
  166. package/template/node_modules/@sentio/sdk/lib/service.js.map +0 -1
  167. package/template/node_modules/@sentio/sdk/lib/solana/builtin/index.d.ts +0 -2
  168. package/template/node_modules/@sentio/sdk/lib/solana/builtin/index.js +0 -19
  169. package/template/node_modules/@sentio/sdk/lib/solana/builtin/index.js.map +0 -1
  170. package/template/node_modules/@sentio/sdk/lib/solana/builtin/spl-token-processor.d.ts +0 -26
  171. package/template/node_modules/@sentio/sdk/lib/solana/builtin/spl-token-processor.js +0 -138
  172. package/template/node_modules/@sentio/sdk/lib/solana/builtin/spl-token-processor.js.map +0 -1
  173. package/template/node_modules/@sentio/sdk/lib/solana/builtin/types.d.ts +0 -330
  174. package/template/node_modules/@sentio/sdk/lib/solana/builtin/types.js +0 -203
  175. package/template/node_modules/@sentio/sdk/lib/solana/builtin/types.js.map +0 -1
  176. package/template/node_modules/@sentio/sdk/lib/solana/builtin/wormhole-processor.d.ts +0 -18
  177. package/template/node_modules/@sentio/sdk/lib/solana/builtin/wormhole-processor.js +0 -192
  178. package/template/node_modules/@sentio/sdk/lib/solana/builtin/wormhole-processor.js.map +0 -1
  179. package/template/node_modules/@sentio/sdk/lib/solana-processor.d.ts +0 -34
  180. package/template/node_modules/@sentio/sdk/lib/solana-processor.js +0 -95
  181. package/template/node_modules/@sentio/sdk/lib/solana-processor.js.map +0 -1
  182. package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/codegen.d.ts +0 -4
  183. package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/codegen.js +0 -292
  184. package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/codegen.js.map +0 -1
  185. package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/functions.d.ts +0 -3
  186. package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/functions.js +0 -61
  187. package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/functions.js.map +0 -1
  188. package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/index.d.ts +0 -6
  189. package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/index.js +0 -51
  190. package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/index.js.map +0 -1
  191. package/template/node_modules/@sentio/sdk/lib/test/codegen.test.d.ts +0 -1
  192. package/template/node_modules/@sentio/sdk/lib/test/codegen.test.js +0 -49
  193. package/template/node_modules/@sentio/sdk/lib/test/codegen.test.js.map +0 -1
  194. package/template/node_modules/@sentio/sdk/lib/test/erc20-template.d.ts +0 -1
  195. package/template/node_modules/@sentio/sdk/lib/test/erc20-template.js +0 -23
  196. package/template/node_modules/@sentio/sdk/lib/test/erc20-template.js.map +0 -1
  197. package/template/node_modules/@sentio/sdk/lib/test/erc20-template.test.d.ts +0 -1
  198. package/template/node_modules/@sentio/sdk/lib/test/erc20-template.test.js +0 -37
  199. package/template/node_modules/@sentio/sdk/lib/test/erc20-template.test.js.map +0 -1
  200. package/template/node_modules/@sentio/sdk/lib/test/erc20.d.ts +0 -1
  201. package/template/node_modules/@sentio/sdk/lib/test/erc20.js +0 -44
  202. package/template/node_modules/@sentio/sdk/lib/test/erc20.js.map +0 -1
  203. package/template/node_modules/@sentio/sdk/lib/test/erc20.test.d.ts +0 -1
  204. package/template/node_modules/@sentio/sdk/lib/test/erc20.test.js +0 -96
  205. package/template/node_modules/@sentio/sdk/lib/test/erc20.test.js.map +0 -1
  206. package/template/node_modules/@sentio/sdk/lib/test/generic-processor.test.d.ts +0 -1
  207. package/template/node_modules/@sentio/sdk/lib/test/generic-processor.test.js +0 -59
  208. package/template/node_modules/@sentio/sdk/lib/test/generic-processor.test.js.map +0 -1
  209. package/template/node_modules/@sentio/sdk/lib/test/index.d.ts +0 -2
  210. package/template/node_modules/@sentio/sdk/lib/test/index.js +0 -8
  211. package/template/node_modules/@sentio/sdk/lib/test/index.js.map +0 -1
  212. package/template/node_modules/@sentio/sdk/lib/test/metric-utils.d.ts +0 -6
  213. package/template/node_modules/@sentio/sdk/lib/test/metric-utils.js +0 -50
  214. package/template/node_modules/@sentio/sdk/lib/test/metric-utils.js.map +0 -1
  215. package/template/node_modules/@sentio/sdk/lib/test/mirrorworld.d.ts +0 -1
  216. package/template/node_modules/@sentio/sdk/lib/test/mirrorworld.js +0 -42
  217. package/template/node_modules/@sentio/sdk/lib/test/mirrorworld.js.map +0 -1
  218. package/template/node_modules/@sentio/sdk/lib/test/solana.test.d.ts +0 -1
  219. package/template/node_modules/@sentio/sdk/lib/test/solana.test.js +0 -90
  220. package/template/node_modules/@sentio/sdk/lib/test/solana.test.js.map +0 -1
  221. package/template/node_modules/@sentio/sdk/lib/test/test-processor-server.d.ts +0 -34
  222. package/template/node_modules/@sentio/sdk/lib/test/test-processor-server.js +0 -205
  223. package/template/node_modules/@sentio/sdk/lib/test/test-processor-server.js.map +0 -1
  224. package/template/node_modules/@sentio/sdk/lib/test/test-provider.d.ts +0 -1
  225. package/template/node_modules/@sentio/sdk/lib/test/test-provider.js +0 -25
  226. package/template/node_modules/@sentio/sdk/lib/test/test-provider.js.map +0 -1
  227. package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet.d.ts +0 -45
  228. package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet.js +0 -1396
  229. package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet.js.map +0 -1
  230. package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet_processor.d.ts +0 -107
  231. package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet_processor.js +0 -105
  232. package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet_processor.js.map +0 -1
  233. package/template/node_modules/@sentio/sdk/lib/test/wormhole-token-bridge.d.ts +0 -1
  234. package/template/node_modules/@sentio/sdk/lib/test/wormhole-token-bridge.js +0 -22
  235. package/template/node_modules/@sentio/sdk/lib/test/wormhole-token-bridge.js.map +0 -1
  236. package/template/node_modules/@sentio/sdk/lib/trace.d.ts +0 -35
  237. package/template/node_modules/@sentio/sdk/lib/trace.js +0 -43
  238. package/template/node_modules/@sentio/sdk/lib/trace.js.map +0 -1
  239. package/template/node_modules/@sentio/sdk/lib/utils/chainmap.d.ts +0 -2
  240. package/template/node_modules/@sentio/sdk/lib/utils/chainmap.js +0 -98
  241. package/template/node_modules/@sentio/sdk/lib/utils/chainmap.js.map +0 -1
  242. package/template/node_modules/@sentio/sdk/lib/utils/convert.d.ts +0 -5
  243. package/template/node_modules/@sentio/sdk/lib/utils/convert.js +0 -27
  244. package/template/node_modules/@sentio/sdk/lib/utils/convert.js.map +0 -1
  245. package/template/node_modules/@sentio/sdk/lib/utils/erc20.d.ts +0 -14
  246. package/template/node_modules/@sentio/sdk/lib/utils/erc20.js +0 -62
  247. package/template/node_modules/@sentio/sdk/lib/utils/erc20.js.map +0 -1
  248. package/template/node_modules/@sentio/sdk/lib/utils/erc20.test.d.ts +0 -1
  249. package/template/node_modules/@sentio/sdk/lib/utils/erc20.test.js +0 -23
  250. package/template/node_modules/@sentio/sdk/lib/utils/erc20.test.js.map +0 -1
  251. package/template/node_modules/@sentio/sdk/lib/utils/index.d.ts +0 -3
  252. package/template/node_modules/@sentio/sdk/lib/utils/index.js +0 -14
  253. package/template/node_modules/@sentio/sdk/lib/utils/index.js.map +0 -1
  254. package/template/node_modules/@sentio/sdk/package.json +0 -78
  255. package/template/node_modules/@sentio/sdk/src/abis/ERC20.json +0 -174
  256. package/template/node_modules/@sentio/sdk/src/abis/ERC20Bytes.json +0 -236
  257. package/template/node_modules/@sentio/sdk/src/abis/WETH9.json +0 -153
  258. package/template/node_modules/@sentio/sdk/src/base-processor-template.ts +0 -105
  259. package/template/node_modules/@sentio/sdk/src/base-processor.ts +0 -172
  260. package/template/node_modules/@sentio/sdk/src/bind-options.ts +0 -41
  261. package/template/node_modules/@sentio/sdk/src/binds.ts +0 -73
  262. package/template/node_modules/@sentio/sdk/src/builtin/erc20/index.ts +0 -6
  263. package/template/node_modules/@sentio/sdk/src/builtin/erc20/test-utils.ts +0 -71
  264. package/template/node_modules/@sentio/sdk/src/builtin/erc20bytes/index.ts +0 -6
  265. package/template/node_modules/@sentio/sdk/src/builtin/erc20bytes/test-utils.ts +0 -53
  266. package/template/node_modules/@sentio/sdk/src/builtin/internal/ERC20.ts +0 -679
  267. package/template/node_modules/@sentio/sdk/src/builtin/internal/ERC20Bytes.ts +0 -384
  268. package/template/node_modules/@sentio/sdk/src/builtin/internal/WETH9.ts +0 -480
  269. package/template/node_modules/@sentio/sdk/src/builtin/internal/common.ts +0 -46
  270. package/template/node_modules/@sentio/sdk/src/builtin/internal/erc20_processor.ts +0 -762
  271. package/template/node_modules/@sentio/sdk/src/builtin/internal/erc20bytes_processor.ts +0 -531
  272. package/template/node_modules/@sentio/sdk/src/builtin/internal/factories/ERC20Bytes__factory.ts +0 -257
  273. package/template/node_modules/@sentio/sdk/src/builtin/internal/factories/ERC20__factory.ts +0 -404
  274. package/template/node_modules/@sentio/sdk/src/builtin/internal/factories/WETH9__factory.ts +0 -297
  275. package/template/node_modules/@sentio/sdk/src/builtin/internal/factories/index.ts +0 -6
  276. package/template/node_modules/@sentio/sdk/src/builtin/internal/index.ts +0 -10
  277. package/template/node_modules/@sentio/sdk/src/builtin/internal/weth9_processor.ts +0 -589
  278. package/template/node_modules/@sentio/sdk/src/builtin/weth9/index.ts +0 -6
  279. package/template/node_modules/@sentio/sdk/src/builtin/weth9/test-utils.ts +0 -89
  280. package/template/node_modules/@sentio/sdk/src/chain-config.ts +0 -6
  281. package/template/node_modules/@sentio/sdk/src/cli/build.ts +0 -196
  282. package/template/node_modules/@sentio/sdk/src/cli/cli.ts +0 -160
  283. package/template/node_modules/@sentio/sdk/src/cli/commands/run-create.ts +0 -36
  284. package/template/node_modules/@sentio/sdk/src/cli/commands/run-login.ts +0 -70
  285. package/template/node_modules/@sentio/sdk/src/cli/config.ts +0 -45
  286. package/template/node_modules/@sentio/sdk/src/cli/key.ts +0 -43
  287. package/template/node_modules/@sentio/sdk/src/cli/solana-code-gen.ts +0 -16
  288. package/template/node_modules/@sentio/sdk/src/cli/upload.ts +0 -88
  289. package/template/node_modules/@sentio/sdk/src/cli/webpack.config.js +0 -42
  290. package/template/node_modules/@sentio/sdk/src/context.ts +0 -103
  291. package/template/node_modules/@sentio/sdk/src/contract-namer.ts +0 -17
  292. package/template/node_modules/@sentio/sdk/src/error.ts +0 -45
  293. package/template/node_modules/@sentio/sdk/src/gen/builtin.ts +0 -22
  294. package/template/node_modules/@sentio/sdk/src/gen/google/protobuf/empty.ts +0 -70
  295. package/template/node_modules/@sentio/sdk/src/gen/processor/protos/processor.ts +0 -3626
  296. package/template/node_modules/@sentio/sdk/src/generic-processor.ts +0 -35
  297. package/template/node_modules/@sentio/sdk/src/index.ts +0 -21
  298. package/template/node_modules/@sentio/sdk/src/loader.ts +0 -24
  299. package/template/node_modules/@sentio/sdk/src/meter.test.ts +0 -16
  300. package/template/node_modules/@sentio/sdk/src/meter.ts +0 -140
  301. package/template/node_modules/@sentio/sdk/src/numberish.test.ts +0 -82
  302. package/template/node_modules/@sentio/sdk/src/numberish.ts +0 -100
  303. package/template/node_modules/@sentio/sdk/src/processor-runner.ts +0 -46
  304. package/template/node_modules/@sentio/sdk/src/processor-state.ts +0 -24
  305. package/template/node_modules/@sentio/sdk/src/promise-or-void.ts +0 -1
  306. package/template/node_modules/@sentio/sdk/src/provider.ts +0 -74
  307. package/template/node_modules/@sentio/sdk/src/service.ts +0 -491
  308. package/template/node_modules/@sentio/sdk/src/solana/builtin/index.ts +0 -2
  309. package/template/node_modules/@sentio/sdk/src/solana/builtin/spl-token-processor.ts +0 -164
  310. package/template/node_modules/@sentio/sdk/src/solana/builtin/types.ts +0 -268
  311. package/template/node_modules/@sentio/sdk/src/solana/builtin/wormhole-processor.ts +0 -178
  312. package/template/node_modules/@sentio/sdk/src/solana-processor.ts +0 -106
  313. package/template/node_modules/@sentio/sdk/src/target-ethers-sentio/codegen.ts +0 -315
  314. package/template/node_modules/@sentio/sdk/src/target-ethers-sentio/functions.ts +0 -68
  315. package/template/node_modules/@sentio/sdk/src/target-ethers-sentio/index.ts +0 -50
  316. package/template/node_modules/@sentio/sdk/src/target-ethers-sentio/tsconfig.json +0 -9
  317. package/template/node_modules/@sentio/sdk/src/test/abis/evm/CommitmentPool.json +0 -1034
  318. package/template/node_modules/@sentio/sdk/src/test/abis/evm/anyswapRouter.json +0 -490
  319. package/template/node_modules/@sentio/sdk/src/test/abis/solana/mirrorworld.json +0 -1392
  320. package/template/node_modules/@sentio/sdk/src/test/codegen.test.ts +0 -29
  321. package/template/node_modules/@sentio/sdk/src/test/erc20-template.test.ts +0 -37
  322. package/template/node_modules/@sentio/sdk/src/test/erc20-template.ts +0 -25
  323. package/template/node_modules/@sentio/sdk/src/test/erc20.test.ts +0 -117
  324. package/template/node_modules/@sentio/sdk/src/test/erc20.ts +0 -50
  325. package/template/node_modules/@sentio/sdk/src/test/generic-processor.test.ts +0 -70
  326. package/template/node_modules/@sentio/sdk/src/test/index.ts +0 -2
  327. package/template/node_modules/@sentio/sdk/src/test/metric-utils.ts +0 -49
  328. package/template/node_modules/@sentio/sdk/src/test/mirrorworld.ts +0 -40
  329. package/template/node_modules/@sentio/sdk/src/test/sentio.yaml +0 -4
  330. package/template/node_modules/@sentio/sdk/src/test/solana.test.ts +0 -93
  331. package/template/node_modules/@sentio/sdk/src/test/test-processor-server.ts +0 -258
  332. package/template/node_modules/@sentio/sdk/src/test/test-provider.ts +0 -25
  333. package/template/node_modules/@sentio/sdk/src/test/types/game_wallet.ts +0 -1392
  334. package/template/node_modules/@sentio/sdk/src/test/types/game_wallet_processor.ts +0 -113
  335. package/template/node_modules/@sentio/sdk/src/test/wormhole-token-bridge.ts +0 -21
  336. package/template/node_modules/@sentio/sdk/src/trace.ts +0 -86
  337. package/template/node_modules/@sentio/sdk/src/types/global.d.ts +0 -17
  338. package/template/node_modules/@sentio/sdk/src/utils/chainmap.ts +0 -95
  339. package/template/node_modules/@sentio/sdk/src/utils/convert.ts +0 -26
  340. package/template/node_modules/@sentio/sdk/src/utils/erc20.test.ts +0 -26
  341. package/template/node_modules/@sentio/sdk/src/utils/erc20.ts +0 -66
  342. package/template/node_modules/@sentio/sdk/src/utils/index.ts +0 -3
  343. package/template/node_modules/base-x/LICENSE.md +0 -22
  344. package/template/node_modules/base-x/README.md +0 -73
  345. package/template/node_modules/base-x/package.json +0 -46
  346. package/template/node_modules/base-x/src/index.d.ts +0 -9
  347. package/template/node_modules/base-x/src/index.js +0 -121
  348. package/template/node_modules/bs58/CHANGELOG.md +0 -65
  349. package/template/node_modules/bs58/LICENSE +0 -21
  350. package/template/node_modules/bs58/README.md +0 -91
  351. package/template/node_modules/bs58/index.d.ts +0 -5
  352. package/template/node_modules/bs58/index.js +0 -4
  353. package/template/node_modules/bs58/package.json +0 -39
  354. package/template/src/types/internal/X2y2.ts +0 -684
  355. package/template/src/types/internal/common.ts +0 -46
  356. package/template/src/types/internal/factories/X2y2__factory.ts +0 -436
  357. package/template/src/types/internal/factories/index.ts +0 -4
  358. package/template/src/types/internal/index.ts +0 -6
  359. package/template/src/types/internal/x2y2_processor.ts +0 -1004
  360. package/template/src/types/x2y2/index.ts +0 -6
  361. 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
- }