@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,63 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.SPLTokenProcessor = exports.getContractName = exports.addContractByABI = exports.getContractByABI = exports.addProcessor = exports.getProcessor = exports.EthersError = exports.BigDecimal = exports.ProcessorState = exports.transformEtherError = exports.SolanaBindOptions = exports.BindOptions = exports.ContractNamer = exports.SolanaBaseProcessor = exports.DummyProvider = exports.setProvider = exports.getProvider = exports.Gauge = exports.Meter = exports.Counter = exports.ProcessorServiceImpl = exports.SolanaContext = exports.BoundContractView = exports.ContractView = exports.Context = exports.BaseProcessorTemplate = exports.GenericProcessor = exports.BaseProcessor = void 0;
18
- var base_processor_1 = require("./base-processor");
19
- Object.defineProperty(exports, "BaseProcessor", { enumerable: true, get: function () { return base_processor_1.BaseProcessor; } });
20
- var generic_processor_1 = require("./generic-processor");
21
- Object.defineProperty(exports, "GenericProcessor", { enumerable: true, get: function () { return generic_processor_1.GenericProcessor; } });
22
- var base_processor_template_1 = require("./base-processor-template");
23
- Object.defineProperty(exports, "BaseProcessorTemplate", { enumerable: true, get: function () { return base_processor_template_1.BaseProcessorTemplate; } });
24
- var context_1 = require("./context");
25
- Object.defineProperty(exports, "Context", { enumerable: true, get: function () { return context_1.Context; } });
26
- Object.defineProperty(exports, "ContractView", { enumerable: true, get: function () { return context_1.ContractView; } });
27
- Object.defineProperty(exports, "BoundContractView", { enumerable: true, get: function () { return context_1.BoundContractView; } });
28
- Object.defineProperty(exports, "SolanaContext", { enumerable: true, get: function () { return context_1.SolanaContext; } });
29
- var service_1 = require("./service");
30
- Object.defineProperty(exports, "ProcessorServiceImpl", { enumerable: true, get: function () { return service_1.ProcessorServiceImpl; } });
31
- var meter_1 = require("./meter");
32
- Object.defineProperty(exports, "Counter", { enumerable: true, get: function () { return meter_1.Counter; } });
33
- Object.defineProperty(exports, "Meter", { enumerable: true, get: function () { return meter_1.Meter; } });
34
- Object.defineProperty(exports, "Gauge", { enumerable: true, get: function () { return meter_1.Gauge; } });
35
- var provider_1 = require("./provider");
36
- Object.defineProperty(exports, "getProvider", { enumerable: true, get: function () { return provider_1.getProvider; } });
37
- Object.defineProperty(exports, "setProvider", { enumerable: true, get: function () { return provider_1.setProvider; } });
38
- Object.defineProperty(exports, "DummyProvider", { enumerable: true, get: function () { return provider_1.DummyProvider; } });
39
- var solana_processor_1 = require("./solana-processor");
40
- Object.defineProperty(exports, "SolanaBaseProcessor", { enumerable: true, get: function () { return solana_processor_1.SolanaBaseProcessor; } });
41
- var contract_namer_1 = require("./contract-namer");
42
- Object.defineProperty(exports, "ContractNamer", { enumerable: true, get: function () { return contract_namer_1.ContractNamer; } });
43
- var bind_options_1 = require("./bind-options");
44
- Object.defineProperty(exports, "BindOptions", { enumerable: true, get: function () { return bind_options_1.BindOptions; } });
45
- Object.defineProperty(exports, "SolanaBindOptions", { enumerable: true, get: function () { return bind_options_1.SolanaBindOptions; } });
46
- var error_1 = require("./error");
47
- Object.defineProperty(exports, "transformEtherError", { enumerable: true, get: function () { return error_1.transformEtherError; } });
48
- var processor_state_1 = require("./processor-state");
49
- Object.defineProperty(exports, "ProcessorState", { enumerable: true, get: function () { return processor_state_1.ProcessorState; } });
50
- var bignumber_js_1 = require("bignumber.js");
51
- Object.defineProperty(exports, "BigDecimal", { enumerable: true, get: function () { return bignumber_js_1.BigNumber; } });
52
- var error_2 = require("./error");
53
- Object.defineProperty(exports, "EthersError", { enumerable: true, get: function () { return error_2.EthersError; } });
54
- var binds_1 = require("./binds");
55
- Object.defineProperty(exports, "getProcessor", { enumerable: true, get: function () { return binds_1.getProcessor; } });
56
- Object.defineProperty(exports, "addProcessor", { enumerable: true, get: function () { return binds_1.addProcessor; } });
57
- Object.defineProperty(exports, "getContractByABI", { enumerable: true, get: function () { return binds_1.getContractByABI; } });
58
- Object.defineProperty(exports, "addContractByABI", { enumerable: true, get: function () { return binds_1.addContractByABI; } });
59
- Object.defineProperty(exports, "getContractName", { enumerable: true, get: function () { return binds_1.getContractName; } });
60
- __exportStar(require("./gen/processor/protos/processor"), exports);
61
- var builtin_1 = require("./solana/builtin");
62
- Object.defineProperty(exports, "SPLTokenProcessor", { enumerable: true, get: function () { return builtin_1.SPLTokenProcessor; } });
63
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mDAAgD;AAAvC,+GAAA,aAAa,OAAA;AACtB,yDAAsD;AAA7C,qHAAA,gBAAgB,OAAA;AACzB,qEAAiE;AAAxD,gIAAA,qBAAqB,OAAA;AAC9B,qCAAmF;AAA1E,kGAAA,OAAO,OAAA;AAAE,uGAAA,YAAY,OAAA;AAAE,4GAAA,iBAAiB,OAAA;AAAE,wGAAA,aAAa,OAAA;AAChE,qCAAgD;AAAvC,+GAAA,oBAAoB,OAAA;AAC7B,iCAA+C;AAAtC,gGAAA,OAAO,OAAA;AAAE,8FAAA,KAAK,OAAA;AAAE,8FAAA,KAAK,OAAA;AAC9B,uCAAoE;AAA3D,uGAAA,WAAW,OAAA;AAAE,uGAAA,WAAW,OAAA;AAAE,yGAAA,aAAa,OAAA;AAChD,uDAAwD;AAA/C,uHAAA,mBAAmB,OAAA;AAC5B,mDAAgD;AAAvC,+GAAA,aAAa,OAAA;AACtB,+CAA+D;AAAtD,2GAAA,WAAW,OAAA;AAAE,iHAAA,iBAAiB,OAAA;AACvC,iCAA6C;AAApC,4GAAA,mBAAmB,OAAA;AAC5B,qDAAkD;AAAzC,iHAAA,cAAc,OAAA;AACvB,6CAAsD;AAA7C,0GAAA,SAAS,OAAc;AAChC,iCAAqC;AAA5B,oGAAA,WAAW,OAAA;AAGpB,iCAAyG;AAAhG,qGAAA,YAAY,OAAA;AAAE,qGAAA,YAAY,OAAA;AAAE,yGAAA,gBAAgB,OAAA;AAAE,yGAAA,gBAAgB,OAAA;AAAE,wGAAA,eAAe,OAAA;AAExF,mEAAgD;AAEhD,4CAAoD;AAA3C,4GAAA,iBAAiB,OAAA","sourcesContent":["export { BaseProcessor } from './base-processor'\nexport { GenericProcessor } from './generic-processor'\nexport { BaseProcessorTemplate } from './base-processor-template'\nexport { Context, ContractView, BoundContractView, SolanaContext } from './context'\nexport { ProcessorServiceImpl } from './service'\nexport { Counter, Meter, Gauge } from './meter'\nexport { getProvider, setProvider, DummyProvider } from './provider'\nexport { SolanaBaseProcessor } from './solana-processor'\nexport { ContractNamer } from './contract-namer'\nexport { BindOptions, SolanaBindOptions } from './bind-options'\nexport { transformEtherError } from './error'\nexport { ProcessorState } from './processor-state'\nexport { BigNumber as BigDecimal } from 'bignumber.js'\nexport { EthersError } from './error'\nexport type { TypedCallTrace } from './trace'\n\nexport { getProcessor, addProcessor, getContractByABI, addContractByABI, getContractName } from './binds'\n\nexport * from './gen/processor/protos/processor'\n\nexport { SPLTokenProcessor } from './solana/builtin'\n"]}
@@ -1,5 +0,0 @@
1
- export declare function load(name: string): {
2
- module: any;
3
- name: string;
4
- path: string;
5
- } | undefined;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.load = void 0;
4
- function load(name) {
5
- const req = eval('require');
6
- try {
7
- let path;
8
- try {
9
- path = req.resolve(name, { paths: [process.cwd()] });
10
- }
11
- catch {
12
- path = req.resolve(name);
13
- }
14
- const module = { module: req(path), name, path };
15
- console.log('Load successfully: ', name);
16
- return module;
17
- }
18
- catch (err) {
19
- if (err instanceof Error && err.message.startsWith(`Cannot find module '${name}'`)) {
20
- // this error is expected
21
- console.log("Couldn't load (expected): ", name);
22
- return undefined;
23
- }
24
- else {
25
- throw err;
26
- }
27
- }
28
- }
29
- exports.load = load;
30
- //# sourceMappingURL=loader.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"loader.js","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":";;;AAAA,SAAgB,IAAI,CAAC,IAAY;IAC/B,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,CAAA;IAE3B,IAAI;QACF,IAAI,IAAY,CAAA;QAChB,IAAI;YACF,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAA;SACrD;QAAC,MAAM;YACN,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;SACzB;QAED,MAAM,MAAM,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;QAChD,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,IAAI,CAAC,CAAA;QACxC,OAAO,MAAM,CAAA;KACd;IAAC,OAAO,GAAG,EAAE;QACZ,IAAI,GAAG,YAAY,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,uBAAuB,IAAI,GAAG,CAAC,EAAE;YAClF,yBAAyB;YACzB,OAAO,CAAC,GAAG,CAAC,4BAA4B,EAAE,IAAI,CAAC,CAAA;YAC/C,OAAO,SAAS,CAAA;SACjB;aAAM;YACL,MAAM,GAAG,CAAA;SACV;KACF;AACH,CAAC;AAvBD,oBAuBC","sourcesContent":["export function load(name: string): { module: any; name: string; path: string } | undefined {\n const req = eval('require')\n\n try {\n let path: string\n try {\n path = req.resolve(name, { paths: [process.cwd()] })\n } catch {\n path = req.resolve(name)\n }\n\n const module = { module: req(path), name, path }\n console.log('Load successfully: ', name)\n return module\n } catch (err) {\n if (err instanceof Error && err.message.startsWith(`Cannot find module '${name}'`)) {\n // this error is expected\n console.log(\"Couldn't load (expected): \", name)\n return undefined\n } else {\n throw err\n }\n }\n}\n"]}
@@ -1,26 +0,0 @@
1
- import { BaseContext } from './context';
2
- import { Numberish } from './numberish';
3
- export declare function normalizeName(name: string): string;
4
- export declare type Labels = {
5
- [key: string]: string;
6
- };
7
- export declare class Counter {
8
- private readonly ctx;
9
- private readonly name;
10
- constructor(name: string, ctx: BaseContext);
11
- add(value: Numberish, labels?: Labels): void;
12
- sub(value: Numberish, labels?: Labels): void;
13
- private record;
14
- }
15
- export declare class Gauge {
16
- private readonly name;
17
- private readonly ctx;
18
- constructor(name: string, ctx: BaseContext);
19
- record(value: Numberish, labels?: Labels): void;
20
- }
21
- export declare class Meter {
22
- private readonly ctx;
23
- constructor(ctx: BaseContext);
24
- Counter(name: string): Counter;
25
- Gauge(name: string): Gauge;
26
- }
@@ -1,131 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Meter = exports.Gauge = exports.Counter = exports.normalizeName = void 0;
7
- const context_1 = require("./context");
8
- const numberish_1 = require("./numberish");
9
- const long_1 = __importDefault(require("long"));
10
- function normalizeName(name) {
11
- const regex = new RegExp('![_.a-zA-Z0-9]');
12
- return name.slice(0, 100).replace(regex, '_');
13
- }
14
- exports.normalizeName = normalizeName;
15
- function GetRecordMetaData(ctx, name, labels) {
16
- name = normalizeName(name);
17
- if (ctx instanceof context_1.Context) {
18
- if (ctx.log) {
19
- return {
20
- contractAddress: ctx.contract.rawContract.address,
21
- blockNumber: long_1.default.fromNumber(ctx.log.blockNumber, true),
22
- transactionIndex: ctx.log.transactionIndex,
23
- logIndex: ctx.log.logIndex,
24
- chainId: ctx.chainId.toString(),
25
- name: name,
26
- labels: labels,
27
- };
28
- }
29
- if (ctx.block) {
30
- return {
31
- contractAddress: ctx.contract.rawContract.address,
32
- blockNumber: long_1.default.fromNumber(ctx.block.number, true),
33
- transactionIndex: -1,
34
- logIndex: -1,
35
- chainId: ctx.chainId.toString(),
36
- name: name,
37
- labels: labels,
38
- };
39
- }
40
- if (ctx.trace) {
41
- return {
42
- contractAddress: ctx.contract.rawContract.address,
43
- blockNumber: long_1.default.fromNumber(ctx.trace.blockNumber, true),
44
- transactionIndex: ctx.trace.transactionPosition,
45
- logIndex: -1,
46
- chainId: ctx.chainId.toString(),
47
- name: name,
48
- labels: labels,
49
- };
50
- }
51
- }
52
- else if (ctx instanceof context_1.SolanaContext) {
53
- return {
54
- contractAddress: ctx.address,
55
- blockNumber: long_1.default.ZERO,
56
- transactionIndex: 0,
57
- logIndex: 0,
58
- chainId: 'SOL_mainnet',
59
- name: name,
60
- labels: labels,
61
- };
62
- }
63
- throw new Error("This can't happen");
64
- }
65
- class Counter {
66
- ctx;
67
- name;
68
- constructor(name, ctx) {
69
- this.name = name;
70
- this.ctx = ctx;
71
- }
72
- add(value, labels = {}) {
73
- this.record(value, labels, true);
74
- }
75
- sub(value, labels = {}) {
76
- this.record(value, labels, false);
77
- }
78
- record(value, labels, add) {
79
- this.ctx.counters.push({
80
- metadata: GetRecordMetaData(this.ctx, this.name, labels),
81
- metricValue: (0, numberish_1.toMetricValue)(value),
82
- add: add,
83
- runtimeInfo: undefined,
84
- });
85
- }
86
- }
87
- exports.Counter = Counter;
88
- class Gauge {
89
- name;
90
- ctx;
91
- constructor(name, ctx) {
92
- this.name = name;
93
- this.ctx = ctx;
94
- }
95
- record(value, labels = {}) {
96
- this.ctx.gauges.push({
97
- metadata: GetRecordMetaData(this.ctx, this.name, labels),
98
- metricValue: (0, numberish_1.toMetricValue)(value),
99
- runtimeInfo: undefined,
100
- });
101
- }
102
- }
103
- exports.Gauge = Gauge;
104
- class Meter {
105
- ctx;
106
- // TODO is map necessary since we are sending request remotely?
107
- // counterMap = new Map<string, Counter>()
108
- // gaugeMap = new Map<string, Gauge>()
109
- constructor(ctx) {
110
- this.ctx = ctx;
111
- }
112
- Counter(name) {
113
- // let counter = this.counterMap.get(name)
114
- // if (!counter) {
115
- // counter = new Counter(name, this.ctx)
116
- // }
117
- // return counter
118
- return new Counter(name, this.ctx);
119
- }
120
- Gauge(name) {
121
- // let gauge = this.gaugeMap.get(name)
122
- //
123
- // if (!gauge) {
124
- // gauge = new Gauge(name, this.ctx)
125
- // }
126
- // return gauge
127
- return new Gauge(name, this.ctx);
128
- }
129
- }
130
- exports.Meter = Meter;
131
- //# sourceMappingURL=meter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"meter.js","sourceRoot":"","sources":["../src/meter.ts"],"names":[],"mappings":";;;;;;AACA,uCAA+D;AAC/D,2CAAsD;AACtD,gDAAuB;AAEvB,SAAgB,aAAa,CAAC,IAAY;IACxC,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,gBAAgB,CAAC,CAAA;IAC1C,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;AAC/C,CAAC;AAHD,sCAGC;AAED,SAAS,iBAAiB,CAAC,GAAgB,EAAE,IAAY,EAAE,MAAc;IACvE,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC,CAAA;IAE1B,IAAI,GAAG,YAAY,iBAAO,EAAE;QAC1B,IAAI,GAAG,CAAC,GAAG,EAAE;YACX,OAAO;gBACL,eAAe,EAAE,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,OAAO;gBACjD,WAAW,EAAE,cAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC;gBACvD,gBAAgB,EAAE,GAAG,CAAC,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MAAM,CAAC;YACxD,WAAW,EAAE,IAAA,yBAAa,EAAC,KAAK,CAAC;YACjC,WAAW,EAAE,SAAS;SACvB,CAAC,CAAA;IACJ,CAAC;CACF;AAhBD,sBAgBC;AAED,MAAa,KAAK;IACC,GAAG,CAAa;IAEjC,+DAA+D;IAC/D,0CAA0C;IAC1C,sCAAsC;IAEtC,YAAY,GAAgB;QAC1B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAChB,CAAC;IAED,OAAO,CAAC,IAAY;QAClB,0CAA0C;QAE1C,kBAAkB;QAClB,6CAA6C;QAC7C,IAAI;QACJ,iBAAiB;QAEjB,OAAO,IAAI,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;IACpC,CAAC;IAED,KAAK,CAAC,IAAY;QAChB,sCAAsC;QACtC,EAAE;QACF,gBAAgB;QAChB,wCAAwC;QACxC,IAAI;QACJ,eAAe;QACf,OAAO,IAAI,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;IAClC,CAAC;CACF;AA/BD,sBA+BC","sourcesContent":["import { RecordMetaData } from './gen/processor/protos/processor'\nimport { BaseContext, Context, SolanaContext } from './context'\nimport { toMetricValue, Numberish } from './numberish'\nimport Long from 'long'\n\nexport function normalizeName(name: string) {\n const regex = new RegExp('![_.a-zA-Z0-9]')\n return name.slice(0, 100).replace(regex, '_')\n}\n\nfunction GetRecordMetaData(ctx: BaseContext, name: string, labels: Labels): RecordMetaData {\n name = normalizeName(name)\n\n if (ctx instanceof Context) {\n if (ctx.log) {\n return {\n contractAddress: ctx.contract.rawContract.address,\n blockNumber: Long.fromNumber(ctx.log.blockNumber, true), // TODO need number type to be long\n transactionIndex: ctx.log.transactionIndex,\n logIndex: ctx.log.logIndex,\n chainId: ctx.chainId.toString(),\n name: name,\n labels: labels,\n }\n }\n if (ctx.block) {\n return {\n contractAddress: ctx.contract.rawContract.address,\n blockNumber: Long.fromNumber(ctx.block.number, true),\n transactionIndex: -1,\n logIndex: -1,\n chainId: ctx.chainId.toString(),\n name: name,\n labels: labels,\n }\n }\n if (ctx.trace) {\n return {\n contractAddress: ctx.contract.rawContract.address,\n blockNumber: Long.fromNumber(ctx.trace.blockNumber, true),\n transactionIndex: ctx.trace.transactionPosition, // TODO make sure if this is the right value to set\n logIndex: -1,\n chainId: ctx.chainId.toString(),\n name: name,\n labels: labels,\n }\n }\n } else if (ctx instanceof SolanaContext) {\n return {\n contractAddress: ctx.address,\n blockNumber: Long.ZERO, // TODO need number type to be long\n transactionIndex: 0,\n logIndex: 0,\n chainId: 'SOL_mainnet', // TODO set in context\n name: name,\n labels: labels,\n }\n }\n throw new Error(\"This can't happen\")\n}\n\nexport type Labels = { [key: string]: string }\n\nexport class Counter {\n private readonly ctx: BaseContext\n private readonly name: string\n\n constructor(name: string, ctx: BaseContext) {\n this.name = name\n this.ctx = ctx\n }\n\n add(value: Numberish, labels: Labels = {}) {\n this.record(value, labels, true)\n }\n\n sub(value: Numberish, labels: Labels = {}) {\n this.record(value, labels, false)\n }\n\n private record(value: Numberish, labels: Labels, add: boolean) {\n this.ctx.counters.push({\n metadata: GetRecordMetaData(this.ctx, this.name, labels),\n metricValue: toMetricValue(value),\n add: add,\n runtimeInfo: undefined,\n })\n }\n}\n\nexport class Gauge {\n private readonly name: string\n private readonly ctx: BaseContext\n\n constructor(name: string, ctx: BaseContext) {\n this.name = name\n this.ctx = ctx\n }\n\n record(value: Numberish, labels: Labels = {}) {\n this.ctx.gauges.push({\n metadata: GetRecordMetaData(this.ctx, this.name, labels),\n metricValue: toMetricValue(value),\n runtimeInfo: undefined,\n })\n }\n}\n\nexport class Meter {\n private readonly ctx: BaseContext\n\n // TODO is map necessary since we are sending request remotely?\n // counterMap = new Map<string, Counter>()\n // gaugeMap = new Map<string, Gauge>()\n\n constructor(ctx: BaseContext) {\n this.ctx = ctx\n }\n\n Counter(name: string): Counter {\n // let counter = this.counterMap.get(name)\n\n // if (!counter) {\n // counter = new Counter(name, this.ctx)\n // }\n // return counter\n\n return new Counter(name, this.ctx)\n }\n\n Gauge(name: string): Gauge {\n // let gauge = this.gaugeMap.get(name)\n //\n // if (!gauge) {\n // gauge = new Gauge(name, this.ctx)\n // }\n // return gauge\n return new Gauge(name, this.ctx)\n }\n}\n"]}
@@ -1 +0,0 @@
1
- export {};
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const chai_1 = require("chai");
4
- const meter_1 = require("./meter");
5
- describe('meter tests', () => {
6
- test('test normalization ', async () => {
7
- (0, chai_1.expect)((0, meter_1.normalizeName)('abc') === 'abc');
8
- (0, chai_1.expect)((0, meter_1.normalizeName)('a-b-c') === 'a-b-c');
9
- (0, chai_1.expect)((0, meter_1.normalizeName)('_a-B-1.') === '_a-B-1.');
10
- (0, chai_1.expect)((0, meter_1.normalizeName)('a/b\\c\n') === 'abc');
11
- (0, chai_1.expect)((0, meter_1.normalizeName)('abc abc') === 'abc_abc');
12
- (0, chai_1.expect)((0, meter_1.normalizeName)('*&~') === '___');
13
- (0, chai_1.expect)((0, meter_1.normalizeName)('x'.repeat(200)).length === 100);
14
- });
15
- });
16
- //# sourceMappingURL=meter.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"meter.test.js","sourceRoot":"","sources":["../src/meter.test.ts"],"names":[],"mappings":";;AAAA,+BAA6B;AAC7B,mCAAuC;AAEvC,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,IAAI,CAAC,qBAAqB,EAAE,KAAK,IAAI,EAAE;QACrC,IAAA,aAAM,EAAC,IAAA,qBAAa,EAAC,KAAK,CAAC,KAAK,KAAK,CAAC,CAAA;QACtC,IAAA,aAAM,EAAC,IAAA,qBAAa,EAAC,OAAO,CAAC,KAAK,OAAO,CAAC,CAAA;QAC1C,IAAA,aAAM,EAAC,IAAA,qBAAa,EAAC,SAAS,CAAC,KAAK,SAAS,CAAC,CAAA;QAE9C,IAAA,aAAM,EAAC,IAAA,qBAAa,EAAC,UAAU,CAAC,KAAK,KAAK,CAAC,CAAA;QAC3C,IAAA,aAAM,EAAC,IAAA,qBAAa,EAAC,SAAS,CAAC,KAAK,SAAS,CAAC,CAAA;QAC9C,IAAA,aAAM,EAAC,IAAA,qBAAa,EAAC,KAAK,CAAC,KAAK,KAAK,CAAC,CAAA;QAEtC,IAAA,aAAM,EAAC,IAAA,qBAAa,EAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,KAAK,GAAG,CAAC,CAAA;IACvD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import { expect } from 'chai'\nimport { normalizeName } from './meter'\n\ndescribe('meter tests', () => {\n test('test normalization ', async () => {\n expect(normalizeName('abc') === 'abc')\n expect(normalizeName('a-b-c') === 'a-b-c')\n expect(normalizeName('_a-B-1.') === '_a-B-1.')\n\n expect(normalizeName('a/b\\\\c\\n') === 'abc')\n expect(normalizeName('abc abc') === 'abc_abc')\n expect(normalizeName('*&~') === '___')\n\n expect(normalizeName('x'.repeat(200)).length === 100)\n })\n})\n"]}
@@ -1,6 +0,0 @@
1
- import { BigNumber } from 'ethers';
2
- import { BigInteger, MetricValue } from './gen/processor/protos/processor';
3
- import { BigDecimal } from '.';
4
- export declare type Numberish = number | BigNumber | bigint | BigDecimal;
5
- export declare function toMetricValue(value: Numberish): MetricValue;
6
- export declare function toBigInteger(a: Numberish): BigInteger;
@@ -1,96 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toBigInteger = exports.toMetricValue = void 0;
4
- const ethers_1 = require("ethers");
5
- const processor_1 = require("./gen/processor/protos/processor");
6
- const _1 = require(".");
7
- const anchor_1 = require("@project-serum/anchor");
8
- function toMetricValue(value) {
9
- if (value instanceof ethers_1.BigNumber) {
10
- return processor_1.MetricValue.fromPartial({
11
- bigInteger: toBigInteger(value.toBigInt()),
12
- });
13
- }
14
- if (value instanceof _1.BigDecimal) {
15
- // Carefully consider the use case here
16
- if (value.isInteger()) {
17
- return processor_1.MetricValue.fromPartial({
18
- bigInteger: bigDecimalToBigInteger(value),
19
- });
20
- }
21
- else {
22
- return processor_1.MetricValue.fromPartial({
23
- bigDecimal: value.toString(), // e.g. -7.350918e-428
24
- });
25
- }
26
- }
27
- if (anchor_1.BN.isBN(value)) {
28
- return processor_1.MetricValue.fromPartial({
29
- bigInteger: bnToBigInteger(value),
30
- });
31
- }
32
- if (typeof value === 'bigint' || Number.isInteger(value)) {
33
- return processor_1.MetricValue.fromPartial({
34
- bigInteger: toBigInteger(value),
35
- });
36
- }
37
- return processor_1.MetricValue.fromPartial({
38
- doubleValue: Number(value),
39
- });
40
- }
41
- exports.toMetricValue = toMetricValue;
42
- function bigDecimalToBigInteger(a) {
43
- const negative = a.isNegative();
44
- if (negative) {
45
- a = a.abs();
46
- }
47
- return hexToBigInteger(a.toString(16), negative);
48
- }
49
- function bnToBigInteger(a) {
50
- const negative = a.isNeg();
51
- if (negative) {
52
- a = a.abs();
53
- }
54
- return hexToBigInteger(a.toString(16), negative);
55
- }
56
- function intToBigInteger(a) {
57
- const negative = a < 0;
58
- if (negative) {
59
- a = -a;
60
- }
61
- return hexToBigInteger(a.toString(16), negative);
62
- }
63
- function toBigInteger(a) {
64
- if (a instanceof _1.BigDecimal) {
65
- return bigDecimalToBigInteger(a);
66
- }
67
- if (a instanceof anchor_1.BN) {
68
- return bnToBigInteger(a);
69
- }
70
- if (a instanceof ethers_1.BigNumber) {
71
- return intToBigInteger(a.toBigInt());
72
- }
73
- return intToBigInteger(a);
74
- // Following code is actually very slow
75
- // while (a > 0) {
76
- // const d = a & 0xffn
77
- // a >>= 8n
78
- // value.push(Number(d))
79
- // }
80
- //
81
- // return {
82
- // negative, value: new Uint8Array(value.reverse()),
83
- // }
84
- }
85
- exports.toBigInteger = toBigInteger;
86
- function hexToBigInteger(hex, negative) {
87
- if (hex.length % 2 === 1) {
88
- hex = '0' + hex;
89
- }
90
- const buffer = Buffer.from(hex, 'hex');
91
- return {
92
- negative: negative,
93
- data: new Uint8Array(buffer),
94
- };
95
- }
96
- //# sourceMappingURL=numberish.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"numberish.js","sourceRoot":"","sources":["../src/numberish.ts"],"names":[],"mappings":";;;AAAA,mCAAkC;AAClC,gEAA0E;AAC1E,wBAA8B;AAC9B,kDAA0C;AAI1C,SAAgB,aAAa,CAAC,KAAgB;IAC5C,IAAI,KAAK,YAAY,kBAAS,EAAE;QAC9B,OAAO,uBAAW,CAAC,WAAW,CAAC;YAC7B,UAAU,EAAE,YAAY,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;SAC3C,CAAC,CAAA;KACH;IACD,IAAI,KAAK,YAAY,aAAU,EAAE;QAC/B,uCAAuC;QACvC,IAAI,KAAK,CAAC,SAAS,EAAE,EAAE;YACrB,OAAO,uBAAW,CAAC,WAAW,CAAC;gBAC7B,UAAU,EAAE,sBAAsB,CAAC,KAAK,CAAC;aAC1C,CAAC,CAAA;SACH;aAAM;YACL,OAAO,uBAAW,CAAC,WAAW,CAAC;gBAC7B,UAAU,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,sBAAsB;aACrD,CAAC,CAAA;SACH;KACF;IACD,IAAI,WAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;QAClB,OAAO,uBAAW,CAAC,WAAW,CAAC;YAC7B,UAAU,EAAE,cAAc,CAAC,KAAK,CAAC;SAClC,CAAC,CAAA;KACH;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;QACxD,OAAO,uBAAW,CAAC,WAAW,CAAC;YAC7B,UAAU,EAAE,YAAY,CAAC,KAAK,CAAC;SAChC,CAAC,CAAA;KACH;IAED,OAAO,uBAAW,CAAC,WAAW,CAAC;QAC7B,WAAW,EAAE,MAAM,CAAC,KAAK,CAAC;KAC3B,CAAC,CAAA;AACJ,CAAC;A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,WAAW;IACX,sDAAsD;IACtD,IAAI;AACN,CAAC;AAtBD,oCAsBC;AAED,SAAS,eAAe,CAAC,GAAW,EAAE,QAAiB;IACrD,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,EAAE;QACxB,GAAG,GAAG,GAAG,GAAG,GAAG,CAAA;KAChB;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IAEtC,OAAO;QACL,QAAQ,EAAE,QAAQ;QAClB,IAAI,EAAE,IAAI,UAAU,CAAC,MAAM,CAAC;KAC7B,CAAA;AACH,CAAC","sourcesContent":["import { BigNumber } from 'ethers'\nimport { BigInteger, MetricValue } from './gen/processor/protos/processor'\nimport { BigDecimal } from '.'\nimport { BN } from '@project-serum/anchor'\n\nexport type Numberish = number | BigNumber | bigint | BigDecimal\n\nexport function toMetricValue(value: Numberish): MetricValue {\n if (value instanceof BigNumber) {\n return MetricValue.fromPartial({\n bigInteger: toBigInteger(value.toBigInt()),\n })\n }\n if (value instanceof BigDecimal) {\n // Carefully consider the use case here\n if (value.isInteger()) {\n return MetricValue.fromPartial({\n bigInteger: bigDecimalToBigInteger(value),\n })\n } else {\n return MetricValue.fromPartial({\n bigDecimal: value.toString(), // e.g. -7.350918e-428\n })\n }\n }\n if (BN.isBN(value)) {\n return MetricValue.fromPartial({\n bigInteger: bnToBigInteger(value),\n })\n }\n if (typeof value === 'bigint' || Number.isInteger(value)) {\n return MetricValue.fromPartial({\n bigInteger: toBigInteger(value),\n })\n }\n\n return MetricValue.fromPartial({\n doubleValue: Number(value),\n })\n}\n\nfunction bigDecimalToBigInteger(a: BigDecimal): BigInteger {\n const negative = a.isNegative()\n if (negative) {\n a = a.abs()\n }\n return hexToBigInteger(a.toString(16), negative)\n}\n\nfunction bnToBigInteger(a: BN): BigInteger {\n const negative = a.isNeg()\n if (negative) {\n a = a.abs()\n }\n return hexToBigInteger(a.toString(16), negative)\n}\n\nfunction intToBigInteger(a: bigint | number): BigInteger {\n const negative = a < 0\n if (negative) {\n a = -a\n }\n return hexToBigInteger(a.toString(16), negative)\n}\n\nexport function toBigInteger(a: Numberish): BigInteger {\n if (a instanceof BigDecimal) {\n return bigDecimalToBigInteger(a)\n }\n if (a instanceof BN) {\n return bnToBigInteger(a)\n }\n if (a instanceof BigNumber) {\n return intToBigInteger(a.toBigInt())\n }\n return intToBigInteger(a)\n\n // Following code is actually very slow\n // while (a > 0) {\n // const d = a & 0xffn\n // a >>= 8n\n // value.push(Number(d))\n // }\n //\n // return {\n // negative, value: new Uint8Array(value.reverse()),\n // }\n}\n\nfunction hexToBigInteger(hex: string, negative: boolean): BigInteger {\n if (hex.length % 2 === 1) {\n hex = '0' + hex\n }\n const buffer = Buffer.from(hex, 'hex')\n\n return {\n negative: negative,\n data: new Uint8Array(buffer),\n }\n}\n"]}
@@ -1,70 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const chai_1 = require("chai");
4
- const numberish_1 = require("./numberish");
5
- const crypto_1 = require("crypto");
6
- const ethers_1 = require("ethers");
7
- const perf_hooks_1 = require("perf_hooks");
8
- const index_1 = require("./index");
9
- // TODO add test for type conversion
10
- describe('Numberish tests', () => {
11
- const values = [0n, -0n, 3815372408723498172304781320847103784n, 2132n, -18708707n, 123n << 100n];
12
- test('big integer conversion correctness ', async () => {
13
- for (const v of values) {
14
- const b = (0, numberish_1.toBigInteger)(v);
15
- const hex1 = BigIntegerToHex(b);
16
- const hex2 = v.toString(16);
17
- (0, chai_1.expect)(hex1).equals(hex2);
18
- }
19
- });
20
- test('random big integer conversion correctness ', async () => {
21
- for (let i = 0; i < 1000; i++) {
22
- const random = crypto_1.webcrypto.getRandomValues(new Uint8Array(256));
23
- const v = ethers_1.BigNumber.from(random).toBigInt();
24
- const b = (0, numberish_1.toBigInteger)(v);
25
- (0, chai_1.expect)(ethers_1.BigNumber.from(b.data).eq(v)).to.equals(true);
26
- }
27
- });
28
- test.skip('random big integer performance', async () => {
29
- jest.setTimeout(100000);
30
- jest.retryTimes(3);
31
- let timer1 = 0;
32
- let timer2 = 0;
33
- for (let i = 0; i < 1000; i++) {
34
- // Use higher value for local debugging
35
- const random = crypto_1.webcrypto.getRandomValues(new Uint8Array(256));
36
- const v = ethers_1.BigNumber.from(random).toBigInt();
37
- let start = perf_hooks_1.performance.now();
38
- (0, numberish_1.toBigInteger)(v);
39
- timer1 += perf_hooks_1.performance.now() - start;
40
- start = perf_hooks_1.performance.now();
41
- v.toString(16);
42
- timer2 += perf_hooks_1.performance.now() - start;
43
- }
44
- console.log(timer1, timer2);
45
- (0, chai_1.expect)(timer1).to.lessThan(timer2 * 3);
46
- });
47
- test('metric values', async () => {
48
- const longDec = '12.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002';
49
- (0, chai_1.expect)((0, numberish_1.toMetricValue)(new index_1.BigDecimal(longDec)).bigDecimal == longDec);
50
- const complexDec = '-7.350918e-428';
51
- (0, chai_1.expect)((0, numberish_1.toMetricValue)(new index_1.BigDecimal(complexDec)).bigDecimal == complexDec);
52
- (0, chai_1.expect)(BigIntegerToBigInt((0, numberish_1.toMetricValue)(new index_1.BigDecimal('100000')).bigInteger) === 100000n);
53
- });
54
- });
55
- // Performance very bad
56
- function BigIntegerToHex(b) {
57
- let res = ethers_1.BigNumber.from(b.data).toBigInt().toString(16);
58
- if (b.negative) {
59
- res = '-' + res;
60
- }
61
- return res;
62
- }
63
- function BigIntegerToBigInt(b) {
64
- let res = ethers_1.BigNumber.from(b.data).toBigInt();
65
- if (b.negative) {
66
- res = -res;
67
- }
68
- return res;
69
- }
70
- //# sourceMappingURL=numberish.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"numberish.test.js","sourceRoot":"","sources":["../src/numberish.test.ts"],"names":[],"mappings":";;AAAA,+BAA6B;AAC7B,2CAAyD;AACzD,mCAAkC;AAClC,mCAAkC;AAClC,2CAAwC;AAExC,mCAAoC;AAEpC,oCAAoC;AAC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AAC,CAAC,UAAU,IAAI,UAAU,CAAC,CAAA;QAE1E,IAAA,aAAM,EAAC,kBAAkB,CAAC,IAAA,yBAAa,EAAC,IAAI,kBAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAW,CAAC,KAAK,OAAO,CAAC,CAAA;IAC7F,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,uBAAuB;AACvB,SAAS,eAAe,CAAC,CAAa;IACpC,IAAI,GAAG,GAAG,kBAAS,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IACxD,IAAI,CAAC,CAAC,QAAQ,EAAE;QACd,GAAG,GAAG,GAAG,GAAG,GAAG,CAAA;KAChB;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,SAAS,kBAAkB,CAAC,CAAa;IACvC,IAAI,GAAG,GAAG,kBAAS,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAA;IAC3C,IAAI,CAAC,CAAC,QAAQ,EAAE;QACd,GAAG,GAAG,CAAC,GAAG,CAAA;KACX;IACD,OAAO,GAAG,CAAA;AACZ,CAAC","sourcesContent":["import { expect } from 'chai'\nimport { toBigInteger, toMetricValue } from './numberish'\nimport { webcrypto } from 'crypto'\nimport { BigNumber } from 'ethers'\nimport { performance } from 'perf_hooks'\nimport { BigInteger } from './gen/processor/protos/processor'\nimport { BigDecimal } from './index'\n\n// TODO add test for type conversion\ndescribe('Numberish tests', () => {\n const values: bigint[] = [0n, -0n, 3815372408723498172304781320847103784n, 2132n, -18708707n, 123n << 100n]\n\n test('big integer conversion correctness ', async () => {\n for (const v of values) {\n const b = toBigInteger(v)\n const hex1 = BigIntegerToHex(b)\n const hex2 = v.toString(16)\n expect(hex1).equals(hex2)\n }\n })\n\n test('random big integer conversion correctness ', async () => {\n for (let i = 0; i < 1000; i++) {\n const random = webcrypto.getRandomValues(new Uint8Array(256))\n const v = BigNumber.from(random).toBigInt()\n const b = toBigInteger(v)\n\n expect(BigNumber.from(b.data).eq(v)).to.equals(true)\n }\n })\n\n test.skip('random big integer performance', async () => {\n jest.setTimeout(100000)\n jest.retryTimes(3)\n\n let timer1 = 0\n let timer2 = 0\n for (let i = 0; i < 1000; i++) {\n // Use higher value for local debugging\n const random = webcrypto.getRandomValues(new Uint8Array(256))\n const v = BigNumber.from(random).toBigInt()\n\n let start = performance.now()\n toBigInteger(v)\n timer1 += performance.now() - start\n\n start = performance.now()\n v.toString(16)\n timer2 += performance.now() - start\n }\n\n console.log(timer1, timer2)\n expect(timer1).to.lessThan(timer2 * 3)\n })\n\n test('metric values', async () => {\n const longDec = '12.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002'\n expect(toMetricValue(new BigDecimal(longDec)).bigDecimal == longDec)\n\n const complexDec = '-7.350918e-428'\n expect(toMetricValue(new BigDecimal(complexDec)).bigDecimal == complexDec)\n\n expect(BigIntegerToBigInt(toMetricValue(new BigDecimal('100000')).bigInteger!) === 100000n)\n })\n})\n\n// Performance very bad\nfunction BigIntegerToHex(b: BigInteger): string {\n let res = BigNumber.from(b.data).toBigInt().toString(16)\n if (b.negative) {\n res = '-' + res\n }\n return res\n}\n\nfunction BigIntegerToBigInt(b: BigInteger): bigint {\n let res = BigNumber.from(b.data).toBigInt()\n if (b.negative) {\n res = -res\n }\n return res\n}\n"]}
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,40 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const command_line_args_1 = __importDefault(require("command-line-args"));
8
- const nice_grpc_1 = require("nice-grpc");
9
- const processor_1 = require("./gen/processor/protos/processor");
10
- const service_1 = require("./service");
11
- const provider_1 = require("./provider");
12
- const path_1 = __importDefault(require("path"));
13
- const fs_extra_1 = __importDefault(require("fs-extra"));
14
- const processor_state_1 = require("./processor-state");
15
- const loader_1 = require("./loader");
16
- global.sentio_sdk = require('.');
17
- global.PROCESSOR_STATE = new processor_state_1.ProcessorState();
18
- const optionDefinitions = [
19
- { name: 'target', type: String, defaultOption: true },
20
- { name: 'port', alias: 'p', type: String, defaultValue: '4000' },
21
- { name: 'concurrency', type: Number, defaultValue: 4 },
22
- { name: 'use-chainserver', type: Boolean, defaultValue: false },
23
- {
24
- name: 'chains-config',
25
- alias: 'c',
26
- type: String,
27
- defaultValue: 'chains-config.json',
28
- },
29
- ];
30
- const options = (0, command_line_args_1.default)(optionDefinitions, { partial: true });
31
- console.log('loading', options.target);
32
- const fullPath = path_1.default.resolve(options['chains-config']);
33
- const chainsConfig = fs_extra_1.default.readJsonSync(fullPath);
34
- (0, provider_1.setProvider)(chainsConfig, options.concurrency, options['use-chainserver']);
35
- console.log('Start Server', options);
36
- const server = (0, nice_grpc_1.createServer)();
37
- const service = new service_1.ProcessorServiceImpl(() => (0, loader_1.load)(options.target), server.shutdown);
38
- server.add(processor_1.ProcessorDefinition, service);
39
- server.listen('0.0.0.0:' + options.port);
40
- //# sourceMappingURL=processor-runner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"processor-runner.js","sourceRoot":"","sources":["../src/processor-runner.ts"],"names":[],"mappings":";;;;;;AAEA,0EAA+C;AAC/C,yCAAwC;AACxC,gEAAsE;AACtE,uCAAgD;AAChD,yCAAwC;AAExC,gDAAuB;AACvB,wDAAyB;AACzB,uDAAkD;AAClD,qCAA+B;AAE/B,MAAM,CAAC,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;AAChC,MAAM,CAAC,eAAe,GAAG,IAAI,gCAAc,EAAE,CAAA;AAE7C,MAAM,iBAAiB,GAAG;IACxB,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE;IACrD,E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\n\nimport commandLineArgs from 'command-line-args'\nimport { createServer } from 'nice-grpc'\nimport { ProcessorDefinition } from './gen/processor/protos/processor'\nimport { ProcessorServiceImpl } from './service'\nimport { setProvider } from './provider'\n\nimport path from 'path'\nimport fs from 'fs-extra'\nimport { ProcessorState } from './processor-state'\nimport { load } from './loader'\n\nglobal.sentio_sdk = require('.')\nglobal.PROCESSOR_STATE = new ProcessorState()\n\nconst optionDefinitions = [\n { name: 'target', type: String, defaultOption: true },\n { name: 'port', alias: 'p', type: String, defaultValue: '4000' },\n { name: 'concurrency', type: Number, defaultValue: 4 },\n { name: 'use-chainserver', type: Boolean, defaultValue: false },\n {\n name: 'chains-config',\n alias: 'c',\n type: String,\n defaultValue: 'chains-config.json',\n },\n]\n\nconst options = commandLineArgs(optionDefinitions, { partial: true })\n\nconsole.log('loading', options.target)\n\nconst fullPath = path.resolve(options['chains-config'])\nconst chainsConfig = fs.readJsonSync(fullPath)\n\nsetProvider(chainsConfig, options.concurrency, options['use-chainserver'])\n\nconsole.log('Start Server', options)\n\nconst server = createServer()\n\nconst service = new ProcessorServiceImpl(() => load(options.target), server.shutdown)\nserver.add(ProcessorDefinition, service)\n\nserver.listen('0.0.0.0:' + options.port)\n"]}
@@ -1,16 +0,0 @@
1
- import { BaseProcessor } from './base-processor';
2
- import { BaseContract } from 'ethers';
3
- import { BoundContractView, ContractView } from './context';
4
- import { BaseProcessorTemplate } from './base-processor-template';
5
- import { TemplateInstance } from './gen/processor/protos/processor';
6
- import { Provider } from '@ethersproject/providers';
7
- import { SolanaBaseProcessor } from './solana-processor';
8
- export declare class ProcessorState {
9
- contracts: Map<string, ContractView<BaseContract>>;
10
- processors: BaseProcessor<BaseContract, BoundContractView<BaseContract, any>>[];
11
- processorMap: Map<string, BaseProcessor<any, any>>;
12
- providers: Map<number, Provider>;
13
- templates: BaseProcessorTemplate<BaseContract, BoundContractView<BaseContract, any>>[];
14
- templatesInstances: TemplateInstance[];
15
- solanaProcessors: SolanaBaseProcessor[];
16
- }
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProcessorState = void 0;
4
- class ProcessorState {
5
- // from abiName_address_chainId => contract wrapper
6
- contracts = new Map();
7
- // all evm processors
8
- processors = [];
9
- // from abiName_options to contracts
10
- processorMap = new Map();
11
- // evm providers
12
- providers = new Map();
13
- // evm processor templates
14
- templates = [];
15
- // evm processor template instances spec
16
- templatesInstances = [];
17
- solanaProcessors = [];
18
- }
19
- exports.ProcessorState = ProcessorState;
20
- //# sourceMappingURL=processor-state.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"processor-state.js","sourceRoot":"","sources":["../src/processor-state.ts"],"names":[],"mappings":";;;AAQA,MAAa,cAAc;IACzB,mDAAmD;IACnD,SAAS,GAAG,IAAI,GAAG,EAAsC,CAAA;IACzD,qBAAqB;IACrB,UAAU,GAAwE,EAAE,CAAA;IACpF,oCAAoC;IACpC,YAAY,GAAG,IAAI,GAAG,EAAmC,CAAA;IACzD,gBAAgB;IAChB,SAAS,GAAG,IAAI,GAAG,EAAoB,CAAA;IACvC,0BAA0B;IAC1B,SAAS,GAAgF,EAAE,CAAA;IAC3F,wCAAwC;IACxC,kBAAkB,GAAuB,EAAE,CAAA;IAE3C,gBAAgB,GAA0B,EAAE,CAAA;CAC7C;AAfD,wCAeC","sourcesContent":["import { BaseProcessor } from './base-processor'\nimport { BaseContract } from 'ethers'\nimport { BoundContractView, ContractView } from './context'\nimport { BaseProcessorTemplate } from './base-processor-template'\nimport { TemplateInstance } from './gen/processor/protos/processor'\nimport { Provider } from '@ethersproject/providers'\nimport { SolanaBaseProcessor } from './solana-processor'\n\nexport class ProcessorState {\n // from abiName_address_chainId => contract wrapper\n contracts = new Map<string, ContractView<BaseContract>>()\n // all evm processors\n processors: BaseProcessor<BaseContract, BoundContractView<BaseContract, any>>[] = []\n // from abiName_options to contracts\n processorMap = new Map<string, BaseProcessor<any, any>>()\n // evm providers\n providers = new Map<number, Provider>()\n // evm processor templates\n templates: BaseProcessorTemplate<BaseContract, BoundContractView<BaseContract, any>>[] = []\n // evm processor template instances spec\n templatesInstances: TemplateInstance[] = []\n\n solanaProcessors: SolanaBaseProcessor[] = []\n}\n"]}
@@ -1 +0,0 @@
1
- export declare type PromiseOrVoid = void | Promise<any>;
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=promise-or-void.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"promise-or-void.js","sourceRoot":"","sources":["../src/promise-or-void.ts"],"names":[],"mappings":"","sourcesContent":["export type PromiseOrVoid = void | Promise<any>\n"]}