@sentio/sdk 1.13.1 → 1.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (351) hide show
  1. package/lib/cli/commands/run-create.js +2 -0
  2. package/lib/cli/commands/run-create.js.map +1 -1
  3. package/package.json +1 -1
  4. package/src/cli/commands/run-create.ts +3 -0
  5. package/template/package.json +2 -3
  6. package/template/src/processor.test.ts +1 -1
  7. package/template/src/processor.ts +20 -16
  8. package/template/node_modules/@sentio/sdk/lib/base-processor-template.d.ts +0 -27
  9. package/template/node_modules/@sentio/sdk/lib/base-processor-template.js +0 -80
  10. package/template/node_modules/@sentio/sdk/lib/base-processor-template.js.map +0 -1
  11. package/template/node_modules/@sentio/sdk/lib/base-processor.d.ts +0 -30
  12. package/template/node_modules/@sentio/sdk/lib/base-processor.js +0 -148
  13. package/template/node_modules/@sentio/sdk/lib/base-processor.js.map +0 -1
  14. package/template/node_modules/@sentio/sdk/lib/bind-options.d.ts +0 -21
  15. package/template/node_modules/@sentio/sdk/lib/bind-options.js +0 -42
  16. package/template/node_modules/@sentio/sdk/lib/bind-options.js.map +0 -1
  17. package/template/node_modules/@sentio/sdk/lib/binds.d.ts +0 -10
  18. package/template/node_modules/@sentio/sdk/lib/binds.js +0 -59
  19. package/template/node_modules/@sentio/sdk/lib/binds.js.map +0 -1
  20. package/template/node_modules/@sentio/sdk/lib/builtin/erc20/index.d.ts +0 -2
  21. package/template/node_modules/@sentio/sdk/lib/builtin/erc20/index.js +0 -22
  22. package/template/node_modules/@sentio/sdk/lib/builtin/erc20/index.js.map +0 -1
  23. package/template/node_modules/@sentio/sdk/lib/builtin/erc20/test-utils.d.ts +0 -5
  24. package/template/node_modules/@sentio/sdk/lib/builtin/erc20/test-utils.js +0 -46
  25. package/template/node_modules/@sentio/sdk/lib/builtin/erc20/test-utils.js.map +0 -1
  26. package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/index.d.ts +0 -2
  27. package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/index.js +0 -22
  28. package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/index.js.map +0 -1
  29. package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/test-utils.d.ts +0 -4
  30. package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/test-utils.js +0 -35
  31. package/template/node_modules/@sentio/sdk/lib/builtin/erc20bytes/test-utils.js.map +0 -1
  32. package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20.d.ts +0 -307
  33. package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20.js +0 -3
  34. package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20.js.map +0 -1
  35. package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20Bytes.d.ts +0 -166
  36. package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20Bytes.js +0 -3
  37. package/template/node_modules/@sentio/sdk/lib/builtin/internal/ERC20Bytes.js.map +0 -1
  38. package/template/node_modules/@sentio/sdk/lib/builtin/internal/WETH9.d.ts +0 -221
  39. package/template/node_modules/@sentio/sdk/lib/builtin/internal/WETH9.js +0 -3
  40. package/template/node_modules/@sentio/sdk/lib/builtin/internal/WETH9.js.map +0 -1
  41. package/template/node_modules/@sentio/sdk/lib/builtin/internal/common.d.ts +0 -22
  42. package/template/node_modules/@sentio/sdk/lib/builtin/internal/common.js +0 -3
  43. package/template/node_modules/@sentio/sdk/lib/builtin/internal/common.js.map +0 -1
  44. package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20_processor.d.ts +0 -184
  45. package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20_processor.js +0 -453
  46. package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20_processor.js.map +0 -1
  47. package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20bytes_processor.d.ts +0 -110
  48. package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20bytes_processor.js +0 -325
  49. package/template/node_modules/@sentio/sdk/lib/builtin/internal/erc20bytes_processor.js.map +0 -1
  50. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20Bytes__factory.d.ts +0 -48
  51. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20Bytes__factory.js +0 -254
  52. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20Bytes__factory.js.map +0 -1
  53. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20__factory.d.ts +0 -42
  54. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20__factory.js +0 -404
  55. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/ERC20__factory.js.map +0 -1
  56. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/WETH9__factory.d.ts +0 -45
  57. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/WETH9__factory.js +0 -297
  58. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/WETH9__factory.js.map +0 -1
  59. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/index.d.ts +0 -3
  60. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/index.js +0 -13
  61. package/template/node_modules/@sentio/sdk/lib/builtin/internal/factories/index.js.map +0 -1
  62. package/template/node_modules/@sentio/sdk/lib/builtin/internal/index.d.ts +0 -7
  63. package/template/node_modules/@sentio/sdk/lib/builtin/internal/index.js +0 -34
  64. package/template/node_modules/@sentio/sdk/lib/builtin/internal/index.js.map +0 -1
  65. package/template/node_modules/@sentio/sdk/lib/builtin/internal/weth9_processor.d.ts +0 -126
  66. package/template/node_modules/@sentio/sdk/lib/builtin/internal/weth9_processor.js +0 -361
  67. package/template/node_modules/@sentio/sdk/lib/builtin/internal/weth9_processor.js.map +0 -1
  68. package/template/node_modules/@sentio/sdk/lib/builtin/weth9/index.d.ts +0 -2
  69. package/template/node_modules/@sentio/sdk/lib/builtin/weth9/index.js +0 -22
  70. package/template/node_modules/@sentio/sdk/lib/builtin/weth9/index.js.map +0 -1
  71. package/template/node_modules/@sentio/sdk/lib/builtin/weth9/test-utils.d.ts +0 -6
  72. package/template/node_modules/@sentio/sdk/lib/builtin/weth9/test-utils.js +0 -57
  73. package/template/node_modules/@sentio/sdk/lib/builtin/weth9/test-utils.js.map +0 -1
  74. package/template/node_modules/@sentio/sdk/lib/chain-config.d.ts +0 -6
  75. package/template/node_modules/@sentio/sdk/lib/chain-config.js +0 -3
  76. package/template/node_modules/@sentio/sdk/lib/chain-config.js.map +0 -1
  77. package/template/node_modules/@sentio/sdk/lib/cli/build.d.ts +0 -4
  78. package/template/node_modules/@sentio/sdk/lib/cli/build.js +0 -178
  79. package/template/node_modules/@sentio/sdk/lib/cli/build.js.map +0 -1
  80. package/template/node_modules/@sentio/sdk/lib/cli/cli.d.ts +0 -2
  81. package/template/node_modules/@sentio/sdk/lib/cli/cli.js +0 -163
  82. package/template/node_modules/@sentio/sdk/lib/cli/cli.js.map +0 -1
  83. package/template/node_modules/@sentio/sdk/lib/cli/commands/run-create.d.ts +0 -1
  84. package/template/node_modules/@sentio/sdk/lib/cli/commands/run-create.js +0 -43
  85. package/template/node_modules/@sentio/sdk/lib/cli/commands/run-create.js.map +0 -1
  86. package/template/node_modules/@sentio/sdk/lib/cli/commands/run-login.d.ts +0 -1
  87. package/template/node_modules/@sentio/sdk/lib/cli/commands/run-login.js +0 -77
  88. package/template/node_modules/@sentio/sdk/lib/cli/commands/run-login.js.map +0 -1
  89. package/template/node_modules/@sentio/sdk/lib/cli/config.d.ts +0 -16
  90. package/template/node_modules/@sentio/sdk/lib/cli/config.js +0 -36
  91. package/template/node_modules/@sentio/sdk/lib/cli/config.js.map +0 -1
  92. package/template/node_modules/@sentio/sdk/lib/cli/key.d.ts +0 -2
  93. package/template/node_modules/@sentio/sdk/lib/cli/key.js +0 -44
  94. package/template/node_modules/@sentio/sdk/lib/cli/key.js.map +0 -1
  95. package/template/node_modules/@sentio/sdk/lib/cli/solana-code-gen.d.ts +0 -2
  96. package/template/node_modules/@sentio/sdk/lib/cli/solana-code-gen.js +0 -19
  97. package/template/node_modules/@sentio/sdk/lib/cli/solana-code-gen.js.map +0 -1
  98. package/template/node_modules/@sentio/sdk/lib/cli/upload.d.ts +0 -2
  99. package/template/node_modules/@sentio/sdk/lib/cli/upload.js +0 -85
  100. package/template/node_modules/@sentio/sdk/lib/cli/upload.js.map +0 -1
  101. package/template/node_modules/@sentio/sdk/lib/cli/webpack.config.js +0 -42
  102. package/template/node_modules/@sentio/sdk/lib/context.d.ts +0 -49
  103. package/template/node_modules/@sentio/sdk/lib/context.js +0 -93
  104. package/template/node_modules/@sentio/sdk/lib/context.js.map +0 -1
  105. package/template/node_modules/@sentio/sdk/lib/contract-namer.d.ts +0 -6
  106. package/template/node_modules/@sentio/sdk/lib/contract-namer.js +0 -20
  107. package/template/node_modules/@sentio/sdk/lib/contract-namer.js.map +0 -1
  108. package/template/node_modules/@sentio/sdk/lib/error.d.ts +0 -7
  109. package/template/node_modules/@sentio/sdk/lib/error.js +0 -43
  110. package/template/node_modules/@sentio/sdk/lib/error.js.map +0 -1
  111. package/template/node_modules/@sentio/sdk/lib/gen/builtin.d.ts +0 -6
  112. package/template/node_modules/@sentio/sdk/lib/gen/builtin.js +0 -3
  113. package/template/node_modules/@sentio/sdk/lib/gen/builtin.js.map +0 -1
  114. package/template/node_modules/@sentio/sdk/lib/gen/google/protobuf/empty.d.ts +0 -16
  115. package/template/node_modules/@sentio/sdk/lib/gen/google/protobuf/empty.js +0 -47
  116. package/template/node_modules/@sentio/sdk/lib/gen/google/protobuf/empty.js.map +0 -1
  117. package/template/node_modules/@sentio/sdk/lib/gen/processor/protos/processor.d.ts +0 -666
  118. package/template/node_modules/@sentio/sdk/lib/gen/processor/protos/processor.js +0 -2837
  119. package/template/node_modules/@sentio/sdk/lib/gen/processor/protos/processor.js.map +0 -1
  120. package/template/node_modules/@sentio/sdk/lib/generic-processor.d.ts +0 -10
  121. package/template/node_modules/@sentio/sdk/lib/generic-processor.js +0 -32
  122. package/template/node_modules/@sentio/sdk/lib/generic-processor.js.map +0 -1
  123. package/template/node_modules/@sentio/sdk/lib/index.d.ts +0 -18
  124. package/template/node_modules/@sentio/sdk/lib/index.js +0 -63
  125. package/template/node_modules/@sentio/sdk/lib/index.js.map +0 -1
  126. package/template/node_modules/@sentio/sdk/lib/loader.d.ts +0 -5
  127. package/template/node_modules/@sentio/sdk/lib/loader.js +0 -30
  128. package/template/node_modules/@sentio/sdk/lib/loader.js.map +0 -1
  129. package/template/node_modules/@sentio/sdk/lib/meter.d.ts +0 -26
  130. package/template/node_modules/@sentio/sdk/lib/meter.js +0 -131
  131. package/template/node_modules/@sentio/sdk/lib/meter.js.map +0 -1
  132. package/template/node_modules/@sentio/sdk/lib/meter.test.d.ts +0 -1
  133. package/template/node_modules/@sentio/sdk/lib/meter.test.js +0 -16
  134. package/template/node_modules/@sentio/sdk/lib/meter.test.js.map +0 -1
  135. package/template/node_modules/@sentio/sdk/lib/numberish.d.ts +0 -6
  136. package/template/node_modules/@sentio/sdk/lib/numberish.js +0 -96
  137. package/template/node_modules/@sentio/sdk/lib/numberish.js.map +0 -1
  138. package/template/node_modules/@sentio/sdk/lib/numberish.test.d.ts +0 -1
  139. package/template/node_modules/@sentio/sdk/lib/numberish.test.js +0 -70
  140. package/template/node_modules/@sentio/sdk/lib/numberish.test.js.map +0 -1
  141. package/template/node_modules/@sentio/sdk/lib/processor-runner.d.ts +0 -2
  142. package/template/node_modules/@sentio/sdk/lib/processor-runner.js +0 -40
  143. package/template/node_modules/@sentio/sdk/lib/processor-runner.js.map +0 -1
  144. package/template/node_modules/@sentio/sdk/lib/processor-state.d.ts +0 -16
  145. package/template/node_modules/@sentio/sdk/lib/processor-state.js +0 -20
  146. package/template/node_modules/@sentio/sdk/lib/processor-state.js.map +0 -1
  147. package/template/node_modules/@sentio/sdk/lib/promise-or-void.d.ts +0 -1
  148. package/template/node_modules/@sentio/sdk/lib/promise-or-void.js +0 -3
  149. package/template/node_modules/@sentio/sdk/lib/promise-or-void.js.map +0 -1
  150. package/template/node_modules/@sentio/sdk/lib/provider.d.ts +0 -6
  151. package/template/node_modules/@sentio/sdk/lib/provider.js +0 -66
  152. package/template/node_modules/@sentio/sdk/lib/provider.js.map +0 -1
  153. package/template/node_modules/@sentio/sdk/lib/release.config.js +0 -31
  154. package/template/node_modules/@sentio/sdk/lib/service.d.ts +0 -25
  155. package/template/node_modules/@sentio/sdk/lib/service.js +0 -406
  156. package/template/node_modules/@sentio/sdk/lib/service.js.map +0 -1
  157. package/template/node_modules/@sentio/sdk/lib/solana/builtin/index.d.ts +0 -2
  158. package/template/node_modules/@sentio/sdk/lib/solana/builtin/index.js +0 -19
  159. package/template/node_modules/@sentio/sdk/lib/solana/builtin/index.js.map +0 -1
  160. package/template/node_modules/@sentio/sdk/lib/solana/builtin/spl-token-processor.d.ts +0 -26
  161. package/template/node_modules/@sentio/sdk/lib/solana/builtin/spl-token-processor.js +0 -138
  162. package/template/node_modules/@sentio/sdk/lib/solana/builtin/spl-token-processor.js.map +0 -1
  163. package/template/node_modules/@sentio/sdk/lib/solana/builtin/types.d.ts +0 -330
  164. package/template/node_modules/@sentio/sdk/lib/solana/builtin/types.js +0 -203
  165. package/template/node_modules/@sentio/sdk/lib/solana/builtin/types.js.map +0 -1
  166. package/template/node_modules/@sentio/sdk/lib/solana/builtin/wormhole-processor.d.ts +0 -18
  167. package/template/node_modules/@sentio/sdk/lib/solana/builtin/wormhole-processor.js +0 -192
  168. package/template/node_modules/@sentio/sdk/lib/solana/builtin/wormhole-processor.js.map +0 -1
  169. package/template/node_modules/@sentio/sdk/lib/solana-processor.d.ts +0 -34
  170. package/template/node_modules/@sentio/sdk/lib/solana-processor.js +0 -95
  171. package/template/node_modules/@sentio/sdk/lib/solana-processor.js.map +0 -1
  172. package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/codegen.d.ts +0 -4
  173. package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/codegen.js +0 -292
  174. package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/codegen.js.map +0 -1
  175. package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/functions.d.ts +0 -3
  176. package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/functions.js +0 -61
  177. package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/functions.js.map +0 -1
  178. package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/index.d.ts +0 -6
  179. package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/index.js +0 -51
  180. package/template/node_modules/@sentio/sdk/lib/target-ethers-sentio/index.js.map +0 -1
  181. package/template/node_modules/@sentio/sdk/lib/test/codegen.test.d.ts +0 -1
  182. package/template/node_modules/@sentio/sdk/lib/test/codegen.test.js +0 -49
  183. package/template/node_modules/@sentio/sdk/lib/test/codegen.test.js.map +0 -1
  184. package/template/node_modules/@sentio/sdk/lib/test/erc20-template.d.ts +0 -1
  185. package/template/node_modules/@sentio/sdk/lib/test/erc20-template.js +0 -23
  186. package/template/node_modules/@sentio/sdk/lib/test/erc20-template.js.map +0 -1
  187. package/template/node_modules/@sentio/sdk/lib/test/erc20-template.test.d.ts +0 -1
  188. package/template/node_modules/@sentio/sdk/lib/test/erc20-template.test.js +0 -37
  189. package/template/node_modules/@sentio/sdk/lib/test/erc20-template.test.js.map +0 -1
  190. package/template/node_modules/@sentio/sdk/lib/test/erc20.d.ts +0 -1
  191. package/template/node_modules/@sentio/sdk/lib/test/erc20.js +0 -44
  192. package/template/node_modules/@sentio/sdk/lib/test/erc20.js.map +0 -1
  193. package/template/node_modules/@sentio/sdk/lib/test/erc20.test.d.ts +0 -1
  194. package/template/node_modules/@sentio/sdk/lib/test/erc20.test.js +0 -96
  195. package/template/node_modules/@sentio/sdk/lib/test/erc20.test.js.map +0 -1
  196. package/template/node_modules/@sentio/sdk/lib/test/generic-processor.test.d.ts +0 -1
  197. package/template/node_modules/@sentio/sdk/lib/test/generic-processor.test.js +0 -59
  198. package/template/node_modules/@sentio/sdk/lib/test/generic-processor.test.js.map +0 -1
  199. package/template/node_modules/@sentio/sdk/lib/test/index.d.ts +0 -2
  200. package/template/node_modules/@sentio/sdk/lib/test/index.js +0 -8
  201. package/template/node_modules/@sentio/sdk/lib/test/index.js.map +0 -1
  202. package/template/node_modules/@sentio/sdk/lib/test/metric-utils.d.ts +0 -6
  203. package/template/node_modules/@sentio/sdk/lib/test/metric-utils.js +0 -50
  204. package/template/node_modules/@sentio/sdk/lib/test/metric-utils.js.map +0 -1
  205. package/template/node_modules/@sentio/sdk/lib/test/mirrorworld.d.ts +0 -1
  206. package/template/node_modules/@sentio/sdk/lib/test/mirrorworld.js +0 -42
  207. package/template/node_modules/@sentio/sdk/lib/test/mirrorworld.js.map +0 -1
  208. package/template/node_modules/@sentio/sdk/lib/test/solana.test.d.ts +0 -1
  209. package/template/node_modules/@sentio/sdk/lib/test/solana.test.js +0 -90
  210. package/template/node_modules/@sentio/sdk/lib/test/solana.test.js.map +0 -1
  211. package/template/node_modules/@sentio/sdk/lib/test/test-processor-server.d.ts +0 -34
  212. package/template/node_modules/@sentio/sdk/lib/test/test-processor-server.js +0 -205
  213. package/template/node_modules/@sentio/sdk/lib/test/test-processor-server.js.map +0 -1
  214. package/template/node_modules/@sentio/sdk/lib/test/test-provider.d.ts +0 -1
  215. package/template/node_modules/@sentio/sdk/lib/test/test-provider.js +0 -25
  216. package/template/node_modules/@sentio/sdk/lib/test/test-provider.js.map +0 -1
  217. package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet.d.ts +0 -45
  218. package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet.js +0 -1396
  219. package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet.js.map +0 -1
  220. package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet_processor.d.ts +0 -107
  221. package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet_processor.js +0 -105
  222. package/template/node_modules/@sentio/sdk/lib/test/types/game_wallet_processor.js.map +0 -1
  223. package/template/node_modules/@sentio/sdk/lib/test/wormhole-token-bridge.d.ts +0 -1
  224. package/template/node_modules/@sentio/sdk/lib/test/wormhole-token-bridge.js +0 -22
  225. package/template/node_modules/@sentio/sdk/lib/test/wormhole-token-bridge.js.map +0 -1
  226. package/template/node_modules/@sentio/sdk/lib/trace.d.ts +0 -35
  227. package/template/node_modules/@sentio/sdk/lib/trace.js +0 -43
  228. package/template/node_modules/@sentio/sdk/lib/trace.js.map +0 -1
  229. package/template/node_modules/@sentio/sdk/lib/utils/chainmap.d.ts +0 -2
  230. package/template/node_modules/@sentio/sdk/lib/utils/chainmap.js +0 -98
  231. package/template/node_modules/@sentio/sdk/lib/utils/chainmap.js.map +0 -1
  232. package/template/node_modules/@sentio/sdk/lib/utils/convert.d.ts +0 -5
  233. package/template/node_modules/@sentio/sdk/lib/utils/convert.js +0 -27
  234. package/template/node_modules/@sentio/sdk/lib/utils/convert.js.map +0 -1
  235. package/template/node_modules/@sentio/sdk/lib/utils/erc20.d.ts +0 -14
  236. package/template/node_modules/@sentio/sdk/lib/utils/erc20.js +0 -62
  237. package/template/node_modules/@sentio/sdk/lib/utils/erc20.js.map +0 -1
  238. package/template/node_modules/@sentio/sdk/lib/utils/erc20.test.d.ts +0 -1
  239. package/template/node_modules/@sentio/sdk/lib/utils/erc20.test.js +0 -23
  240. package/template/node_modules/@sentio/sdk/lib/utils/erc20.test.js.map +0 -1
  241. package/template/node_modules/@sentio/sdk/lib/utils/index.d.ts +0 -3
  242. package/template/node_modules/@sentio/sdk/lib/utils/index.js +0 -14
  243. package/template/node_modules/@sentio/sdk/lib/utils/index.js.map +0 -1
  244. package/template/node_modules/@sentio/sdk/package.json +0 -78
  245. package/template/node_modules/@sentio/sdk/src/abis/ERC20.json +0 -174
  246. package/template/node_modules/@sentio/sdk/src/abis/ERC20Bytes.json +0 -236
  247. package/template/node_modules/@sentio/sdk/src/abis/WETH9.json +0 -153
  248. package/template/node_modules/@sentio/sdk/src/base-processor-template.ts +0 -105
  249. package/template/node_modules/@sentio/sdk/src/base-processor.ts +0 -172
  250. package/template/node_modules/@sentio/sdk/src/bind-options.ts +0 -41
  251. package/template/node_modules/@sentio/sdk/src/binds.ts +0 -73
  252. package/template/node_modules/@sentio/sdk/src/builtin/erc20/index.ts +0 -6
  253. package/template/node_modules/@sentio/sdk/src/builtin/erc20/test-utils.ts +0 -71
  254. package/template/node_modules/@sentio/sdk/src/builtin/erc20bytes/index.ts +0 -6
  255. package/template/node_modules/@sentio/sdk/src/builtin/erc20bytes/test-utils.ts +0 -53
  256. package/template/node_modules/@sentio/sdk/src/builtin/internal/ERC20.ts +0 -679
  257. package/template/node_modules/@sentio/sdk/src/builtin/internal/ERC20Bytes.ts +0 -384
  258. package/template/node_modules/@sentio/sdk/src/builtin/internal/WETH9.ts +0 -480
  259. package/template/node_modules/@sentio/sdk/src/builtin/internal/common.ts +0 -46
  260. package/template/node_modules/@sentio/sdk/src/builtin/internal/erc20_processor.ts +0 -762
  261. package/template/node_modules/@sentio/sdk/src/builtin/internal/erc20bytes_processor.ts +0 -531
  262. package/template/node_modules/@sentio/sdk/src/builtin/internal/factories/ERC20Bytes__factory.ts +0 -257
  263. package/template/node_modules/@sentio/sdk/src/builtin/internal/factories/ERC20__factory.ts +0 -404
  264. package/template/node_modules/@sentio/sdk/src/builtin/internal/factories/WETH9__factory.ts +0 -297
  265. package/template/node_modules/@sentio/sdk/src/builtin/internal/factories/index.ts +0 -6
  266. package/template/node_modules/@sentio/sdk/src/builtin/internal/index.ts +0 -10
  267. package/template/node_modules/@sentio/sdk/src/builtin/internal/weth9_processor.ts +0 -589
  268. package/template/node_modules/@sentio/sdk/src/builtin/weth9/index.ts +0 -6
  269. package/template/node_modules/@sentio/sdk/src/builtin/weth9/test-utils.ts +0 -89
  270. package/template/node_modules/@sentio/sdk/src/chain-config.ts +0 -6
  271. package/template/node_modules/@sentio/sdk/src/cli/build.ts +0 -196
  272. package/template/node_modules/@sentio/sdk/src/cli/cli.ts +0 -160
  273. package/template/node_modules/@sentio/sdk/src/cli/commands/run-create.ts +0 -36
  274. package/template/node_modules/@sentio/sdk/src/cli/commands/run-login.ts +0 -70
  275. package/template/node_modules/@sentio/sdk/src/cli/config.ts +0 -45
  276. package/template/node_modules/@sentio/sdk/src/cli/key.ts +0 -43
  277. package/template/node_modules/@sentio/sdk/src/cli/solana-code-gen.ts +0 -16
  278. package/template/node_modules/@sentio/sdk/src/cli/upload.ts +0 -88
  279. package/template/node_modules/@sentio/sdk/src/cli/webpack.config.js +0 -42
  280. package/template/node_modules/@sentio/sdk/src/context.ts +0 -103
  281. package/template/node_modules/@sentio/sdk/src/contract-namer.ts +0 -17
  282. package/template/node_modules/@sentio/sdk/src/error.ts +0 -45
  283. package/template/node_modules/@sentio/sdk/src/gen/builtin.ts +0 -22
  284. package/template/node_modules/@sentio/sdk/src/gen/google/protobuf/empty.ts +0 -70
  285. package/template/node_modules/@sentio/sdk/src/gen/processor/protos/processor.ts +0 -3626
  286. package/template/node_modules/@sentio/sdk/src/generic-processor.ts +0 -35
  287. package/template/node_modules/@sentio/sdk/src/index.ts +0 -21
  288. package/template/node_modules/@sentio/sdk/src/loader.ts +0 -24
  289. package/template/node_modules/@sentio/sdk/src/meter.test.ts +0 -16
  290. package/template/node_modules/@sentio/sdk/src/meter.ts +0 -140
  291. package/template/node_modules/@sentio/sdk/src/numberish.test.ts +0 -82
  292. package/template/node_modules/@sentio/sdk/src/numberish.ts +0 -100
  293. package/template/node_modules/@sentio/sdk/src/processor-runner.ts +0 -46
  294. package/template/node_modules/@sentio/sdk/src/processor-state.ts +0 -24
  295. package/template/node_modules/@sentio/sdk/src/promise-or-void.ts +0 -1
  296. package/template/node_modules/@sentio/sdk/src/provider.ts +0 -74
  297. package/template/node_modules/@sentio/sdk/src/service.ts +0 -491
  298. package/template/node_modules/@sentio/sdk/src/solana/builtin/index.ts +0 -2
  299. package/template/node_modules/@sentio/sdk/src/solana/builtin/spl-token-processor.ts +0 -164
  300. package/template/node_modules/@sentio/sdk/src/solana/builtin/types.ts +0 -268
  301. package/template/node_modules/@sentio/sdk/src/solana/builtin/wormhole-processor.ts +0 -178
  302. package/template/node_modules/@sentio/sdk/src/solana-processor.ts +0 -106
  303. package/template/node_modules/@sentio/sdk/src/target-ethers-sentio/codegen.ts +0 -315
  304. package/template/node_modules/@sentio/sdk/src/target-ethers-sentio/functions.ts +0 -68
  305. package/template/node_modules/@sentio/sdk/src/target-ethers-sentio/index.ts +0 -50
  306. package/template/node_modules/@sentio/sdk/src/target-ethers-sentio/tsconfig.json +0 -9
  307. package/template/node_modules/@sentio/sdk/src/test/abis/evm/CommitmentPool.json +0 -1034
  308. package/template/node_modules/@sentio/sdk/src/test/abis/evm/anyswapRouter.json +0 -490
  309. package/template/node_modules/@sentio/sdk/src/test/abis/solana/mirrorworld.json +0 -1392
  310. package/template/node_modules/@sentio/sdk/src/test/codegen.test.ts +0 -29
  311. package/template/node_modules/@sentio/sdk/src/test/erc20-template.test.ts +0 -37
  312. package/template/node_modules/@sentio/sdk/src/test/erc20-template.ts +0 -25
  313. package/template/node_modules/@sentio/sdk/src/test/erc20.test.ts +0 -117
  314. package/template/node_modules/@sentio/sdk/src/test/erc20.ts +0 -50
  315. package/template/node_modules/@sentio/sdk/src/test/generic-processor.test.ts +0 -70
  316. package/template/node_modules/@sentio/sdk/src/test/index.ts +0 -2
  317. package/template/node_modules/@sentio/sdk/src/test/metric-utils.ts +0 -49
  318. package/template/node_modules/@sentio/sdk/src/test/mirrorworld.ts +0 -40
  319. package/template/node_modules/@sentio/sdk/src/test/sentio.yaml +0 -4
  320. package/template/node_modules/@sentio/sdk/src/test/solana.test.ts +0 -93
  321. package/template/node_modules/@sentio/sdk/src/test/test-processor-server.ts +0 -258
  322. package/template/node_modules/@sentio/sdk/src/test/test-provider.ts +0 -25
  323. package/template/node_modules/@sentio/sdk/src/test/types/game_wallet.ts +0 -1392
  324. package/template/node_modules/@sentio/sdk/src/test/types/game_wallet_processor.ts +0 -113
  325. package/template/node_modules/@sentio/sdk/src/test/wormhole-token-bridge.ts +0 -21
  326. package/template/node_modules/@sentio/sdk/src/trace.ts +0 -86
  327. package/template/node_modules/@sentio/sdk/src/types/global.d.ts +0 -17
  328. package/template/node_modules/@sentio/sdk/src/utils/chainmap.ts +0 -95
  329. package/template/node_modules/@sentio/sdk/src/utils/convert.ts +0 -26
  330. package/template/node_modules/@sentio/sdk/src/utils/erc20.test.ts +0 -26
  331. package/template/node_modules/@sentio/sdk/src/utils/erc20.ts +0 -66
  332. package/template/node_modules/@sentio/sdk/src/utils/index.ts +0 -3
  333. package/template/node_modules/base-x/LICENSE.md +0 -22
  334. package/template/node_modules/base-x/README.md +0 -73
  335. package/template/node_modules/base-x/package.json +0 -46
  336. package/template/node_modules/base-x/src/index.d.ts +0 -9
  337. package/template/node_modules/base-x/src/index.js +0 -121
  338. package/template/node_modules/bs58/CHANGELOG.md +0 -65
  339. package/template/node_modules/bs58/LICENSE +0 -21
  340. package/template/node_modules/bs58/README.md +0 -91
  341. package/template/node_modules/bs58/index.d.ts +0 -5
  342. package/template/node_modules/bs58/index.js +0 -4
  343. package/template/node_modules/bs58/package.json +0 -39
  344. package/template/src/types/internal/X2y2.ts +0 -684
  345. package/template/src/types/internal/common.ts +0 -46
  346. package/template/src/types/internal/factories/X2y2__factory.ts +0 -436
  347. package/template/src/types/internal/factories/index.ts +0 -4
  348. package/template/src/types/internal/index.ts +0 -6
  349. package/template/src/types/internal/x2y2_processor.ts +0 -1004
  350. package/template/src/types/x2y2/index.ts +0 -6
  351. package/template/src/types/x2y2/test-utils.ts +0 -89
@@ -1,178 +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.codeGenSolanaProcessor = exports.codeGenEthersProcessor = exports.buildProcessor = void 0;
7
- const chalk_1 = __importDefault(require("chalk"));
8
- const path_1 = __importDefault(require("path"));
9
- const fs_1 = __importDefault(require("fs"));
10
- const child_process_1 = require("child_process");
11
- const config_1 = require("./config");
12
- async function buildProcessor(onlyGen, targets) {
13
- if (!onlyGen) {
14
- await installDeps();
15
- }
16
- // targets.forEach(async (target) => await buildProcessorForTarget(onlyGen, target))
17
- for (const target of targets) {
18
- await buildProcessorForTarget(onlyGen, target);
19
- }
20
- if (!onlyGen) {
21
- const WEBPACK_CONFIG = path_1.default.join(__dirname, 'webpack.config.js');
22
- await execStep('yarn tsc -p .', 'Compile');
23
- await execStep('yarn webpack --config=' + WEBPACK_CONFIG, 'Packaging');
24
- }
25
- }
26
- exports.buildProcessor = buildProcessor;
27
- async function buildProcessorForTarget(onlyGen, target) {
28
- if (target.chain === config_1.EVM) {
29
- await codeGenEthersProcessor(target.abisDir ?? path_1.default.join('abis', 'evm'));
30
- }
31
- else if (target.chain === config_1.SOLANA) {
32
- codeGenSolanaProcessor(target.abisDir ?? path_1.default.join('abis', 'solana'));
33
- }
34
- if (onlyGen) {
35
- return;
36
- }
37
- }
38
- async function installDeps() {
39
- await execStep('yarn install --ignore-scripts', 'Yarn Install');
40
- }
41
- async function codeGenEthersProcessor(abisDir, ETHERS_TARGET = path_1.default.join(__dirname, '../target-ethers-sentio'), outDir = 'src/types/internal') {
42
- if (!fs_1.default.existsSync(abisDir)) {
43
- return;
44
- }
45
- let haveJson = false;
46
- const files = fs_1.default.readdirSync(abisDir);
47
- for (const file of files) {
48
- if (file.toLowerCase().endsWith('.json')) {
49
- haveJson = true;
50
- break;
51
- }
52
- }
53
- if (!haveJson) {
54
- return;
55
- }
56
- // TODO this will fail during postinstall, need to locate real typechain path
57
- await execStep('yarn typechain --target ' + ETHERS_TARGET + ` --out-dir ${outDir} ${path_1.default.join(abisDir, '*.json')}`, 'Type definitions gen');
58
- }
59
- exports.codeGenEthersProcessor = codeGenEthersProcessor;
60
- function codeGenSolanaProcessor(abisDir, root = '', targetPath = path_1.default.join('src', 'types')) {
61
- const abisFolder = path_1.default.join(root, abisDir);
62
- const abisFiles = fs_1.default.readdirSync(abisFolder);
63
- const typeFolder = path_1.default.join(root, targetPath);
64
- for (const file of abisFiles) {
65
- if (path_1.default.extname(file) === '.json') {
66
- if (!fs_1.default.existsSync(typeFolder)) {
67
- fs_1.default.mkdirSync(typeFolder);
68
- }
69
- const idlContent = fs_1.default.readFileSync(path_1.default.join(abisFolder, file), 'utf-8');
70
- const idlObj = JSON.parse(idlContent);
71
- const idlName = idlObj.name;
72
- const idlFile = path_1.default.join(typeFolder, idlName + '.ts');
73
- fs_1.default.writeFileSync(idlFile, `export const ${idlName}_idl = ${idlContent}`);
74
- fs_1.default.writeFileSync(path_1.default.join(typeFolder, `${idlName}_processor.ts`), codeGenSolanaIdlProcessor(idlObj));
75
- }
76
- }
77
- }
78
- exports.codeGenSolanaProcessor = codeGenSolanaProcessor;
79
- function codeGenSolanaIdlProcessor(idlObj) {
80
- const idlName = idlObj.name;
81
- const idlNamePascalCase = toPascalCase(idlName);
82
- const instructions = idlObj.instructions;
83
- return `import { BorshInstructionCoder, Instruction, Idl, BN } from '@project-serum/anchor'
84
- import { SolanaBaseProcessor, SolanaContext, SolanaBindOptions } from "@sentio/sdk"
85
- import { ${idlName}_idl } from "./${idlName}"
86
- import bs58 from 'bs58'
87
- import { PublicKey } from '@solana/web3.js'
88
-
89
- export class ${idlNamePascalCase}Processor extends SolanaBaseProcessor {
90
- static bind(options: SolanaBindOptions): ${idlNamePascalCase}Processor {
91
- if (options && !options.name) {
92
- options.name = '${idlNamePascalCase}'
93
- }
94
- return new ${idlNamePascalCase}Processor(options)
95
- }
96
-
97
- decodeInstruction: (rawInstruction: string) => Instruction | null = (rawInstruction) => {
98
- const instructionCoder = new BorshInstructionCoder(${idlName}_idl as Idl)
99
- const decodedIns = instructionCoder.decode(Buffer.from(bs58.decode(rawInstruction)))
100
- return decodedIns
101
- }
102
-
103
- ${instructions.map((ins) => codeGenSolanaInstruction(idlNamePascalCase, ins)).join('')}
104
- }
105
- `;
106
- }
107
- function codeGenSolanaInstruction(idlName, ins) {
108
- const instructionName = ins.name;
109
- const argsTypeString = codeGenInstructionArgs(ins.args);
110
- return `
111
- on${instructionName.charAt(0).toUpperCase() + instructionName.slice(1)}(handler: (args: ${argsTypeString}, ctx: SolanaContext) => void): ${idlName}Processor {
112
- this.onInstruction('${instructionName}', (ins: Instruction, ctx) => {
113
- if (ins) {
114
- handler(ins.data as ${argsTypeString}, ctx)
115
- }
116
- })
117
- return this
118
- }
119
- `;
120
- }
121
- function codeGenInstructionArgs(args) {
122
- return `{ ${args.map((arg) => arg.name + ': ' + mapType(arg.type)).join(', ')} }`;
123
- }
124
- // Reference: https://github.com/coral-xyz/anchor/blob/93332766f13e86efbe77c9986722731742317ede/ts/src/program/namespace/types.ts#L104
125
- function mapType(tpe) {
126
- switch (tpe) {
127
- case 'publicKey':
128
- return 'PublicKey';
129
- case 'bool':
130
- return 'boolean';
131
- case 'string':
132
- return 'string';
133
- case 'u8':
134
- case 'i8':
135
- case 'u16':
136
- case 'i16':
137
- case 'u32':
138
- case 'i32':
139
- case 'f32':
140
- case 'f64':
141
- return 'number';
142
- case 'u64':
143
- case 'i64':
144
- case 'u128':
145
- case 'i128':
146
- return 'BN';
147
- default:
148
- return 'any';
149
- }
150
- }
151
- function toPascalCase(str) {
152
- return `${str}`
153
- .toLowerCase()
154
- .replace(new RegExp(/[-_]+/, 'g'), ' ')
155
- .replace(new RegExp(/[^\w\s]/, 'g'), '')
156
- .replace(new RegExp(/\s+(.)(\w*)/, 'g'), ($1, $2, $3) => `${$2.toUpperCase() + $3}`)
157
- .replace(new RegExp(/\w/), (s) => s.toUpperCase());
158
- }
159
- async function execStep(cmd, stepName) {
160
- const child = (0, child_process_1.exec)(cmd);
161
- console.log(chalk_1.default.blue(stepName + ' begin'));
162
- if (!child.stdout || !child.stderr) {
163
- console.error(chalk_1.default.red(stepName + ' failed'));
164
- process.exit(1);
165
- }
166
- child.stdout.pipe(process.stdout);
167
- child.stderr.pipe(process.stderr);
168
- await new Promise((resolve) => {
169
- child.on('close', resolve);
170
- });
171
- if (child.exitCode) {
172
- console.error(chalk_1.default.red(stepName + ' failed'));
173
- process.exit(child.exitCode);
174
- }
175
- console.log(chalk_1.default.blue(stepName + ' success'));
176
- console.log();
177
- }
178
- //# sourceMappingURL=build.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/cli/build.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AACzB,gDAAuB;AACvB,4CAAmB;AACnB,iDAAoC;AACpC,qCAA8C;AAEvC,KAAK,UAAU,cAAc,CAAC,OAAgB,EAAE,OAAiB;IACtE,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,WAAW,EAAE,CAAA;KACpB;IAED,oFAAoF;IACpF,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;QAC5B,MAAM,uBAAuB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;KAC/C;IAED,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,cAAc,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAA;QAChE,MAAM,QAAQ,CAAC,eAAe,EAAE,SAAS,CAAC,CAAA;QAC1C,MAAM,QAAQ,CAAC,wBAAwB,GAAG,cAAc,EAAE,WAAW,CAAC,CAAA;KACvE;AACH,CAAC;AAfD,wCAeC;AAED,KAAK,UAAU,uBAAuB,CAAC,OAAgB,EAAE,MAAc;IACrE,IAAI,MAAM,CAAC,KAAK,KAAK,YAAG,EAAE;QACxB,MAAM,sBAAsB,CAAC,MAAM,CAAC,OAAO,IAAI,cAAI,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAA;KACzE;SAAM,IAAI,MAAM,CAAC,KAAK,KAAK,eAAM,EAAE;QAClC,sBAAsB,CAAC,MAAM,CAAC,OAAO,IAAI,cAAI,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAA;KACtE;IAED,IAAI,OAAO,EAAE;QACX,OA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AAK,CAAC,eAAK,CAAC,GAAG,CAAC,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAA;QAC9C,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;KAC7B;IACD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAA;IAC9C,OAAO,CAAC,GAAG,EAAE,CAAA;AACf,CAAC","sourcesContent":["import chalk from 'chalk'\nimport path from 'path'\nimport fs from 'fs'\nimport { exec } from 'child_process'\nimport { EVM, SOLANA, Target } from './config'\n\nexport async function buildProcessor(onlyGen: boolean, targets: Target[]) {\n if (!onlyGen) {\n await installDeps()\n }\n\n // targets.forEach(async (target) => await buildProcessorForTarget(onlyGen, target))\n for (const target of targets) {\n await buildProcessorForTarget(onlyGen, target)\n }\n\n if (!onlyGen) {\n const WEBPACK_CONFIG = path.join(__dirname, 'webpack.config.js')\n await execStep('yarn tsc -p .', 'Compile')\n await execStep('yarn webpack --config=' + WEBPACK_CONFIG, 'Packaging')\n }\n}\n\nasync function buildProcessorForTarget(onlyGen: boolean, target: Target) {\n if (target.chain === EVM) {\n await codeGenEthersProcessor(target.abisDir ?? path.join('abis', 'evm'))\n } else if (target.chain === SOLANA) {\n codeGenSolanaProcessor(target.abisDir ?? path.join('abis', 'solana'))\n }\n\n if (onlyGen) {\n return\n }\n}\n\nasync function installDeps() {\n await execStep('yarn install --ignore-scripts', 'Yarn Install')\n}\n\nexport async function codeGenEthersProcessor(\n abisDir: string,\n ETHERS_TARGET = path.join(__dirname, '../target-ethers-sentio'),\n outDir = 'src/types/internal'\n) {\n if (!fs.existsSync(abisDir)) {\n return\n }\n\n let haveJson = false\n const files = fs.readdirSync(abisDir)\n for (const file of files) {\n if (file.toLowerCase().endsWith('.json')) {\n haveJson = true\n break\n }\n }\n if (!haveJson) {\n return\n }\n\n // TODO this will fail during postinstall, need to locate real typechain path\n await execStep(\n 'yarn typechain --target ' + ETHERS_TARGET + ` --out-dir ${outDir} ${path.join(abisDir, '*.json')}`,\n 'Type definitions gen'\n )\n}\n\nexport function codeGenSolanaProcessor(abisDir: string, root = '', targetPath = path.join('src', 'types')) {\n const abisFolder = path.join(root, abisDir)\n const abisFiles = fs.readdirSync(abisFolder)\n const typeFolder = path.join(root, targetPath)\n for (const file of abisFiles) {\n if (path.extname(file) === '.json') {\n if (!fs.existsSync(typeFolder)) {\n fs.mkdirSync(typeFolder)\n }\n const idlContent = fs.readFileSync(path.join(abisFolder, file), 'utf-8')\n const idlObj = JSON.parse(idlContent)\n const idlName = idlObj.name\n const idlFile = path.join(typeFolder, idlName + '.ts')\n fs.writeFileSync(idlFile, `export const ${idlName}_idl = ${idlContent}`)\n fs.writeFileSync(path.join(typeFolder, `${idlName}_processor.ts`), codeGenSolanaIdlProcessor(idlObj))\n }\n }\n}\n\nfunction codeGenSolanaIdlProcessor(idlObj: any): string {\n const idlName = idlObj.name\n const idlNamePascalCase = toPascalCase(idlName)\n const instructions: any[] = idlObj.instructions\n return `import { BorshInstructionCoder, Instruction, Idl, BN } from '@project-serum/anchor'\nimport { SolanaBaseProcessor, SolanaContext, SolanaBindOptions } from \"@sentio/sdk\"\nimport { ${idlName}_idl } from \"./${idlName}\"\nimport bs58 from 'bs58'\nimport { PublicKey } from '@solana/web3.js'\n\nexport class ${idlNamePascalCase}Processor extends SolanaBaseProcessor {\n static bind(options: SolanaBindOptions): ${idlNamePascalCase}Processor {\n if (options && !options.name) {\n options.name = '${idlNamePascalCase}'\n }\n return new ${idlNamePascalCase}Processor(options)\n }\n\n decodeInstruction: (rawInstruction: string) => Instruction | null = (rawInstruction) => {\n const instructionCoder = new BorshInstructionCoder(${idlName}_idl as Idl)\n const decodedIns = instructionCoder.decode(Buffer.from(bs58.decode(rawInstruction)))\n return decodedIns\n }\n\n ${instructions.map((ins) => codeGenSolanaInstruction(idlNamePascalCase, ins)).join('')}\n}\n `\n}\n\nfunction codeGenSolanaInstruction(idlName: string, ins: any): string {\n const instructionName = ins.name\n const argsTypeString = codeGenInstructionArgs(ins.args)\n return `\n on${\n instructionName.charAt(0).toUpperCase() + instructionName.slice(1)\n }(handler: (args: ${argsTypeString}, ctx: SolanaContext) => void): ${idlName}Processor {\n this.onInstruction('${instructionName}', (ins: Instruction, ctx) => {\n if (ins) {\n handler(ins.data as ${argsTypeString}, ctx)\n }\n })\n return this\n }\n `\n}\n\nfunction codeGenInstructionArgs(args: { name: string; type: string }[]): string {\n return `{ ${args.map((arg) => arg.name + ': ' + mapType(arg.type)).join(', ')} }`\n}\n\n// Reference: https://github.com/coral-xyz/anchor/blob/93332766f13e86efbe77c9986722731742317ede/ts/src/program/namespace/types.ts#L104\nfunction mapType(tpe: string): string {\n switch (tpe) {\n case 'publicKey':\n return 'PublicKey'\n case 'bool':\n return 'boolean'\n case 'string':\n return 'string'\n case 'u8':\n case 'i8':\n case 'u16':\n case 'i16':\n case 'u32':\n case 'i32':\n case 'f32':\n case 'f64':\n return 'number'\n case 'u64':\n case 'i64':\n case 'u128':\n case 'i128':\n return 'BN'\n default:\n return 'any'\n }\n}\n\nfunction toPascalCase(str: string) {\n return `${str}`\n .toLowerCase()\n .replace(new RegExp(/[-_]+/, 'g'), ' ')\n .replace(new RegExp(/[^\\w\\s]/, 'g'), '')\n .replace(new RegExp(/\\s+(.)(\\w*)/, 'g'), ($1, $2, $3) => `${$2.toUpperCase() + $3}`)\n .replace(new RegExp(/\\w/), (s) => s.toUpperCase())\n}\n\nasync function execStep(cmd: string, stepName: string) {\n const child = exec(cmd)\n console.log(chalk.blue(stepName + ' begin'))\n\n if (!child.stdout || !child.stderr) {\n console.error(chalk.red(stepName + ' failed'))\n process.exit(1)\n }\n\n child.stdout.pipe(process.stdout)\n child.stderr.pipe(process.stderr)\n\n await new Promise((resolve) => {\n child.on('close', resolve)\n })\n\n if (child.exitCode) {\n console.error(chalk.red(stepName + ' failed'))\n process.exit(child.exitCode)\n }\n console.log(chalk.blue(stepName + ' success'))\n console.log()\n}\n"]}
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,163 +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 command_line_usage_1 = __importDefault(require("command-line-usage"));
9
- const fs_1 = __importDefault(require("fs"));
10
- const path_1 = __importDefault(require("path"));
11
- const js_yaml_1 = __importDefault(require("js-yaml"));
12
- const config_1 = require("./config");
13
- const upload_1 = require("./upload");
14
- const chalk_1 = __importDefault(require("chalk"));
15
- const build_1 = require("./build");
16
- const run_login_1 = require("./commands/run-login");
17
- const run_create_1 = require("./commands/run-create");
18
- const mainDefinitions = [{ name: 'command', defaultOption: true }];
19
- const mainOptions = (0, command_line_args_1.default)(mainDefinitions, {
20
- stopAtFirstUnknown: true,
21
- });
22
- const argv = mainOptions._unknown || [];
23
- if (mainOptions.command === 'login') {
24
- (0, run_login_1.runLogin)(argv);
25
- }
26
- else if (mainOptions.command === 'create') {
27
- (0, run_create_1.runCreate)(argv);
28
- }
29
- else {
30
- // For all the commands that need read project configs
31
- // TODO move them to their own modules
32
- // Process configs
33
- let processorConfig = { host: '', project: '', source: '', build: true, targets: [] };
34
- // Fist step, read from project yaml file
35
- try {
36
- console.log(chalk_1.default.blue('Loading Process config'));
37
- // TODO correctly located sentio.yaml
38
- const pwd = process.cwd();
39
- const packageJson = path_1.default.join(pwd, 'package.json');
40
- if (!fs_1.default.existsSync(packageJson)) {
41
- console.error('package.json not found, please run this command in the root of your project');
42
- process.exit(1);
43
- }
44
- const yamlPath = path_1.default.join(pwd, 'sentio.yaml');
45
- if (!fs_1.default.existsSync(yamlPath)) {
46
- console.error('sentio.yaml not found, please create one according to: TODO docs');
47
- process.exit(1);
48
- }
49
- processorConfig = js_yaml_1.default.load(fs_1.default.readFileSync('sentio.yaml', 'utf8'));
50
- if (!processorConfig.project === undefined) {
51
- console.error('Config yaml must have contain a valid project identifier');
52
- process.exit(1);
53
- }
54
- if (processorConfig.build === undefined) {
55
- processorConfig.build = true;
56
- }
57
- if (!processorConfig.host) {
58
- processorConfig.host = 'prod';
59
- }
60
- if (!processorConfig.source) {
61
- processorConfig.source = 'src/processor.ts';
62
- }
63
- if (!processorConfig.targets) {
64
- console.warn('targets is not defined, use EVM as the default target');
65
- processorConfig.targets = [];
66
- }
67
- if (processorConfig.targets.length === 0) {
68
- // By default evm
69
- processorConfig.targets.push({ chain: config_1.EVM });
70
- }
71
- }
72
- catch (e) {
73
- console.error(e);
74
- process.exit(1);
75
- }
76
- if (mainOptions.command === 'upload') {
77
- const optionDefinitions = [
78
- {
79
- name: 'help',
80
- alias: 'h',
81
- type: Boolean,
82
- description: 'Display this usage guide.',
83
- },
84
- {
85
- name: 'api-key',
86
- type: String,
87
- description: '(Optional) Manually provide API key rather than use saved credential',
88
- },
89
- {
90
- name: 'host',
91
- description: '(Optional) Override Sentio Host name',
92
- type: String,
93
- },
94
- {
95
- name: 'owner',
96
- description: '(Optional) Override Project owner',
97
- type: String,
98
- },
99
- {
100
- name: 'nobuild',
101
- description: '(Optional) Skip build & pack file before uploading, default false',
102
- type: Boolean,
103
- },
104
- ];
105
- const options = (0, command_line_args_1.default)(optionDefinitions, { argv });
106
- if (options.help) {
107
- const usage = (0, command_line_usage_1.default)([
108
- {
109
- header: 'Sentio upload',
110
- content: 'Upload your project files to Sentio.',
111
- },
112
- {
113
- header: 'Options',
114
- optionList: optionDefinitions,
115
- },
116
- ]);
117
- console.log(usage);
118
- }
119
- else {
120
- if (options.host) {
121
- processorConfig.host = options.host;
122
- }
123
- if (options.nobuild) {
124
- processorConfig.build = false;
125
- }
126
- (0, config_1.finalizeHost)(processorConfig);
127
- (0, config_1.FinalizeProjectName)(processorConfig, options.owner);
128
- console.log(processorConfig);
129
- let apiOverride = undefined;
130
- if (options['api-key']) {
131
- apiOverride = options['api-key'];
132
- }
133
- (0, upload_1.uploadFile)(processorConfig, apiOverride);
134
- }
135
- }
136
- else if (mainOptions.command === 'build') {
137
- (0, build_1.buildProcessor)(false, processorConfig.targets);
138
- }
139
- else if (mainOptions.command === 'gen') {
140
- (0, build_1.buildProcessor)(true, processorConfig.targets);
141
- }
142
- else {
143
- const usage = (0, command_line_usage_1.default)([
144
- {
145
- header: 'Sentio',
146
- content: 'Login & Manage your project files to Sentio.',
147
- },
148
- {
149
- header: 'Usage',
150
- content: [
151
- 'sentio $command --help\t\tshow detail usage of specific command',
152
- 'sentio login --api-key=xx\t\tsave credential to local',
153
- 'sentio create\t\t\t\tcreate a template project',
154
- 'sentio upload\t\t\t\tbuild and upload processor to sentio',
155
- 'sentio gen\t\t\t\tgenerate abi',
156
- 'sentio build\t\t\t\tgenerate abi and build',
157
- ],
158
- },
159
- ]);
160
- console.log(usage);
161
- }
162
- }
163
- //# sourceMappingURL=cli.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli/cli.ts"],"names":[],"mappings":";;;;;;AAEA,0EAA+C;AAC/C,4EAAiD;AACjD,4CAAmB;AACnB,gDAAuB;AAEvB,sDAA0B;AAC1B,qCAAsF;AACtF,qCAAqC;AACrC,kDAAyB;AACzB,mCAAwC;AACxC,oDAA+C;AAC/C,sDAAiD;AAEjD,MAAM,eAAe,GAAG,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAA;AAClE,MAAM,WAAW,GAAG,IAAA,2BAAe,EAAC,eAAe,EAAE;IACnD,kBAAkB,EAAE,IAAI;CACzB,CAAC,CAAA;AACF,MAAM,IAAI,GAAG,WAAW,CAAC,QAAQ,IAAI,EAAE,CAAA;AAEvC,IAAI,WAAW,CAAC,OAAO,KAAK,OAAO,EAAE;IACnC,IAAA,oBAAQ,EAAC,IAAI,CAAC,CAAA;CACf;KAAM,IAAI,WAAW,C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AC7B;gBACE,MAAM,EAAE,QAAQ;gBAChB,OAAO,EAAE,8CAA8C;aACxD;YACD;gBACE,MAAM,EAAE,OAAO;gBACf,OAAO,EAAE;oBACP,iEAAiE;oBACjE,uDAAuD;oBACvD,gDAAgD;oBAChD,2DAA2D;oBAC3D,gCAAgC;oBAChC,4CAA4C;iBAC7C;aACF;SACF,CAAC,CAAA;QACF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;KACnB;CACF","sourcesContent":["#!/usr/bin/env node\n\nimport commandLineArgs from 'command-line-args'\nimport commandLineUsage from 'command-line-usage'\nimport fs from 'fs'\nimport path from 'path'\n\nimport yaml from 'js-yaml'\nimport { EVM, finalizeHost, FinalizeProjectName, SentioProjectConfig } from './config'\nimport { uploadFile } from './upload'\nimport chalk from 'chalk'\nimport { buildProcessor } from './build'\nimport { runLogin } from './commands/run-login'\nimport { runCreate } from './commands/run-create'\n\nconst mainDefinitions = [{ name: 'command', defaultOption: true }]\nconst mainOptions = commandLineArgs(mainDefinitions, {\n stopAtFirstUnknown: true,\n})\nconst argv = mainOptions._unknown || []\n\nif (mainOptions.command === 'login') {\n runLogin(argv)\n} else if (mainOptions.command === 'create') {\n runCreate(argv)\n} else {\n // For all the commands that need read project configs\n // TODO move them to their own modules\n\n // Process configs\n let processorConfig: SentioProjectConfig = { host: '', project: '', source: '', build: true, targets: [] }\n // Fist step, read from project yaml file\n try {\n console.log(chalk.blue('Loading Process config'))\n // TODO correctly located sentio.yaml\n const pwd = process.cwd()\n const packageJson = path.join(pwd, 'package.json')\n if (!fs.existsSync(packageJson)) {\n console.error('package.json not found, please run this command in the root of your project')\n process.exit(1)\n }\n\n const yamlPath = path.join(pwd, 'sentio.yaml')\n if (!fs.existsSync(yamlPath)) {\n console.error('sentio.yaml not found, please create one according to: TODO docs')\n process.exit(1)\n }\n\n processorConfig = yaml.load(fs.readFileSync('sentio.yaml', 'utf8')) as SentioProjectConfig\n if (!processorConfig.project === undefined) {\n console.error('Config yaml must have contain a valid project identifier')\n process.exit(1)\n }\n if (processorConfig.build === undefined) {\n processorConfig.build = true\n }\n if (!processorConfig.host) {\n processorConfig.host = 'prod'\n }\n\n if (!processorConfig.source) {\n processorConfig.source = 'src/processor.ts'\n }\n if (!processorConfig.targets) {\n console.warn('targets is not defined, use EVM as the default target')\n processorConfig.targets = []\n }\n if (processorConfig.targets.length === 0) {\n // By default evm\n processorConfig.targets.push({ chain: EVM })\n }\n } catch (e) {\n console.error(e)\n process.exit(1)\n }\n\n if (mainOptions.command === 'upload') {\n const optionDefinitions = [\n {\n name: 'help',\n alias: 'h',\n type: Boolean,\n description: 'Display this usage guide.',\n },\n {\n name: 'api-key',\n type: String,\n description: '(Optional) Manually provide API key rather than use saved credential',\n },\n {\n name: 'host',\n description: '(Optional) Override Sentio Host name',\n type: String,\n },\n {\n name: 'owner',\n description: '(Optional) Override Project owner',\n type: String,\n },\n {\n name: 'nobuild',\n description: '(Optional) Skip build & pack file before uploading, default false',\n type: Boolean,\n },\n ]\n const options = commandLineArgs(optionDefinitions, { argv })\n if (options.help) {\n const usage = commandLineUsage([\n {\n header: 'Sentio upload',\n content: 'Upload your project files to Sentio.',\n },\n {\n header: 'Options',\n optionList: optionDefinitions,\n },\n ])\n console.log(usage)\n } else {\n if (options.host) {\n processorConfig.host = options.host\n }\n if (options.nobuild) {\n processorConfig.build = false\n }\n finalizeHost(processorConfig)\n FinalizeProjectName(processorConfig, options.owner)\n console.log(processorConfig)\n\n let apiOverride = undefined\n if (options['api-key']) {\n apiOverride = options['api-key']\n }\n uploadFile(processorConfig, apiOverride)\n }\n } else if (mainOptions.command === 'build') {\n buildProcessor(false, processorConfig.targets)\n } else if (mainOptions.command === 'gen') {\n buildProcessor(true, processorConfig.targets)\n } else {\n const usage = commandLineUsage([\n {\n header: 'Sentio',\n content: 'Login & Manage your project files to Sentio.',\n },\n {\n header: 'Usage',\n content: [\n 'sentio $command --help\\t\\tshow detail usage of specific command',\n 'sentio login --api-key=xx\\t\\tsave credential to local',\n 'sentio create\\t\\t\\t\\tcreate a template project',\n 'sentio upload\\t\\t\\t\\tbuild and upload processor to sentio',\n 'sentio gen\\t\\t\\t\\tgenerate abi',\n 'sentio build\\t\\t\\t\\tgenerate abi and build',\n ],\n },\n ])\n console.log(usage)\n }\n}\n"]}
@@ -1 +0,0 @@
1
- export declare function runCreate(argv: string[]): void;
@@ -1,43 +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.runCreate = void 0;
7
- const command_line_args_1 = __importDefault(require("command-line-args"));
8
- const command_line_usage_1 = __importDefault(require("command-line-usage"));
9
- function runCreate(argv) {
10
- const optionDefinitions = [
11
- {
12
- name: 'help',
13
- alias: 'h',
14
- type: Boolean,
15
- description: 'Display this usage guide.',
16
- },
17
- {
18
- name: 'name',
19
- alias: 'n',
20
- type: String,
21
- description: '(Required) Project name',
22
- },
23
- ];
24
- const options = (0, command_line_args_1.default)(optionDefinitions, { argv });
25
- if (options.help || !options.name) {
26
- const usage = (0, command_line_usage_1.default)([
27
- {
28
- header: 'Sentio Create',
29
- content: 'Create a template project',
30
- },
31
- {
32
- header: 'Options',
33
- optionList: optionDefinitions,
34
- },
35
- ]);
36
- console.log(usage);
37
- }
38
- else {
39
- //
40
- }
41
- }
42
- exports.runCreate = runCreate;
43
- //# sourceMappingURL=run-create.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"run-create.js","sourceRoot":"","sources":["../../../src/cli/commands/run-create.ts"],"names":[],"mappings":";;;;;;AAAA,0EAA+C;AAC/C,4EAAiD;AAEjD,SAAgB,SAAS,CAAC,IAAc;IACtC,MAAM,iBAAiB,GAAG;QACxB;YACE,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,2BAA2B;SACzC;QACD;YACE,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,yBAAyB;SACvC;KACF,CAAA;IAED,MAAM,OAAO,GAAG,IAAA,2BAAe,EAAC,iBAAiB,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;IAC5D,IAAI,OAAO,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;QACjC,MAAM,KAAK,GAAG,IAAA,4BAAgB,EAAC;YAC7B;gBACE,MAAM,EAAE,eAAe;gBACvB,OAAO,EAAE,2BAA2B;aACrC;YACD;gBACE,MAAM,EAAE,SAAS;gBACjB,UAAU,EAAE,iBAAiB;aAC9B;SACF,CAAC,CAAA;QACF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;KACnB;SAAM;QACL,EAAE;KACH;AACH,CAAC;AAhCD,8BAgCC","sourcesContent":["import commandLineArgs from 'command-line-args'\nimport commandLineUsage from 'command-line-usage'\n\nexport function runCreate(argv: string[]) {\n const optionDefinitions = [\n {\n name: 'help',\n alias: 'h',\n type: Boolean,\n description: 'Display this usage guide.',\n },\n {\n name: 'name',\n alias: 'n',\n type: String,\n description: '(Required) Project name',\n },\n ]\n\n const options = commandLineArgs(optionDefinitions, { argv })\n if (options.help || !options.name) {\n const usage = commandLineUsage([\n {\n header: 'Sentio Create',\n content: 'Create a template project',\n },\n {\n header: 'Options',\n optionList: optionDefinitions,\n },\n ])\n console.log(usage)\n } else {\n //\n }\n}\n"]}
@@ -1 +0,0 @@
1
- export declare function runLogin(argv: string[]): void;
@@ -1,77 +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.runLogin = void 0;
7
- const command_line_args_1 = __importDefault(require("command-line-args"));
8
- const command_line_usage_1 = __importDefault(require("command-line-usage"));
9
- const config_1 = require("../config");
10
- const chalk_1 = __importDefault(require("chalk"));
11
- const https_1 = __importDefault(require("https"));
12
- const http_1 = __importDefault(require("http"));
13
- const key_1 = require("../key");
14
- function runLogin(argv) {
15
- const optionDefinitions = [
16
- {
17
- name: 'help',
18
- alias: 'h',
19
- type: Boolean,
20
- description: 'Display this usage guide.',
21
- },
22
- {
23
- name: 'api-key',
24
- type: String,
25
- description: '(Required) Your API key',
26
- },
27
- {
28
- name: 'host',
29
- description: '(Optional) Override Sentio Host name',
30
- type: String,
31
- },
32
- ];
33
- const options = (0, command_line_args_1.default)(optionDefinitions, { argv });
34
- if (options.help || !options['api-key']) {
35
- const usage = (0, command_line_usage_1.default)([
36
- {
37
- header: 'Sentio Login',
38
- content: 'Try login to Sentio with your apikey.',
39
- },
40
- {
41
- header: 'Options',
42
- optionList: optionDefinitions,
43
- },
44
- ]);
45
- console.log(usage);
46
- }
47
- else {
48
- const host = (0, config_1.getFinalizedHost)(options.host);
49
- console.log(chalk_1.default.blue('login to ' + host));
50
- const url = new URL(host);
51
- const reqOptions = {
52
- hostname: url.hostname,
53
- port: url.port,
54
- path: '/api/v1/processors/check_key',
55
- method: 'HEAD',
56
- headers: {
57
- 'api-key': options['api-key'],
58
- },
59
- };
60
- const h = url.protocol == 'https:' ? https_1.default : http_1.default;
61
- const req = h.request(reqOptions, (res) => {
62
- if (res.statusCode == 200) {
63
- (0, key_1.WriteKey)(host, options['api-key']);
64
- console.log(chalk_1.default.green('login success'));
65
- }
66
- else {
67
- console.error(chalk_1.default.red('login failed, code:', res.statusCode, res.statusMessage));
68
- }
69
- });
70
- req.on('error', (error) => {
71
- console.error(error);
72
- });
73
- req.end();
74
- }
75
- }
76
- exports.runLogin = runLogin;
77
- //# sourceMappingURL=run-login.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"run-login.js","sourceRoot":"","sources":["../../../src/cli/commands/run-login.ts"],"names":[],"mappings":";;;;;;AAAA,0EAA+C;AAC/C,4EAAiD;AACjD,sCAA4C;AAC5C,kDAAyB;AACzB,kDAA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AAA;QACD,MAAM,CAAC,GAAG,GAAG,CAAC,QAAQ,IAAI,QAAQ,CAAC,CAAC,CAAC,eAAK,CAAC,CAAC,CAAC,cAAI,CAAA;QACjD,MAAM,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,GAAG,EAAE,EAAE;YACxC,IAAI,GAAG,CAAC,UAAU,IAAI,GAAG,EAAE;gBACzB,IAAA,cAAQ,EAAC,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAA;gBAClC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAA;aAC1C;iBAAM;gBACL,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,qBAAqB,EAAE,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,aAAa,CAAC,CAAC,CAAA;aACnF;QACH,CAAC,CAAC,CAAA;QAEF,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YACxB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACtB,CAAC,CAAC,CAAA;QACF,GAAG,CAAC,GAAG,EAAE,CAAA;KACV;AACH,CAAC;AA7DD,4BA6DC","sourcesContent":["import commandLineArgs from 'command-line-args'\nimport commandLineUsage from 'command-line-usage'\nimport { getFinalizedHost } from '../config'\nimport chalk from 'chalk'\nimport https from 'https'\nimport http from 'http'\nimport { WriteKey } from '../key'\n\nexport function runLogin(argv: string[]) {\n const optionDefinitions = [\n {\n name: 'help',\n alias: 'h',\n type: Boolean,\n description: 'Display this usage guide.',\n },\n {\n name: 'api-key',\n type: String,\n description: '(Required) Your API key',\n },\n {\n name: 'host',\n description: '(Optional) Override Sentio Host name',\n type: String,\n },\n ]\n const options = commandLineArgs(optionDefinitions, { argv })\n\n if (options.help || !options['api-key']) {\n const usage = commandLineUsage([\n {\n header: 'Sentio Login',\n content: 'Try login to Sentio with your apikey.',\n },\n {\n header: 'Options',\n optionList: optionDefinitions,\n },\n ])\n console.log(usage)\n } else {\n const host = getFinalizedHost(options.host)\n console.log(chalk.blue('login to ' + host))\n const url = new URL(host)\n const reqOptions = {\n hostname: url.hostname,\n port: url.port,\n path: '/api/v1/processors/check_key',\n method: 'HEAD',\n headers: {\n 'api-key': options['api-key'],\n },\n }\n const h = url.protocol == 'https:' ? https : http\n const req = h.request(reqOptions, (res) => {\n if (res.statusCode == 200) {\n WriteKey(host, options['api-key'])\n console.log(chalk.green('login success'))\n } else {\n console.error(chalk.red('login failed, code:', res.statusCode, res.statusMessage))\n }\n })\n\n req.on('error', (error) => {\n console.error(error)\n })\n req.end()\n }\n}\n"]}
@@ -1,16 +0,0 @@
1
- export interface SentioProjectConfig {
2
- project: string;
3
- host: string;
4
- source: string;
5
- build: boolean;
6
- targets: Target[];
7
- }
8
- export declare function getFinalizedHost(host: string): string;
9
- export declare function finalizeHost(config: SentioProjectConfig): void;
10
- export declare function FinalizeProjectName(config: SentioProjectConfig, owner: string | undefined): void;
11
- export interface Target {
12
- chain: string;
13
- abisDir?: string;
14
- }
15
- export declare const EVM = "evm";
16
- export declare const SOLANA = "solana";
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SOLANA = exports.EVM = exports.FinalizeProjectName = exports.finalizeHost = exports.getFinalizedHost = void 0;
4
- function getFinalizedHost(host) {
5
- switch (host) {
6
- case '':
7
- case 'prod':
8
- return 'https://app.sentio.xyz';
9
- case 'test':
10
- return 'https://test.sentio.xyz';
11
- case 'staging':
12
- return 'https://staging.sentio.xyz';
13
- case 'local':
14
- return 'http://localhost:10000';
15
- }
16
- return host;
17
- }
18
- exports.getFinalizedHost = getFinalizedHost;
19
- function finalizeHost(config) {
20
- config.host = getFinalizedHost(config.host);
21
- }
22
- exports.finalizeHost = finalizeHost;
23
- function FinalizeProjectName(config, owner) {
24
- if (owner) {
25
- let name = config.project;
26
- if (name.includes('/')) {
27
- name = config.project.split('/')[1];
28
- }
29
- config.project = [owner, name].join('/');
30
- }
31
- }
32
- exports.FinalizeProjectName = FinalizeProjectName;
33
- // Supported target chain, lower case
34
- exports.EVM = 'evm';
35
- exports.SOLANA = 'solana';
36
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/cli/config.ts"],"names":[],"mappings":";;;AAQA,SAAgB,gBAAgB,CAAC,IAAY;IAC3C,QAAQ,IAAI,EAAE;QACZ,KAAK,EAAE,CAAC;QACR,KAAK,MAAM;YACT,OAAO,wBAAwB,CAAA;QACjC,KAAK,MAAM;YACT,OAAO,yBAAyB,CAAA;QAClC,KAAK,SAAS;YACZ,OAAO,4BAA4B,CAAA;QACrC,KAAK,OAAO;YACV,OAAO,wBAAwB,CAAA;KAClC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAbD,4CAaC;AAED,SAAgB,YAAY,CAAC,MAA2B;IACtD,MAAM,CAAC,IAAI,GAAG,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;AAC7C,CAAC;AAFD,oCAEC;AAED,SAAgB,mBAAmB,CAAC,MAA2B,EAAE,KAAyB;IACxF,IAAI,KAAK,EAAE;QACT,IAAI,IAAI,GAAG,MAAM,CAAC,OAAO,CAAA;QACzB,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACtB,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;SACpC;QACD,MAAM,CAAC,OAAO,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;KACzC;AACH,CAAC;AARD,kDAQC;AAOD,qCAAqC;AACxB,QAAA,GAAG,GAAG,KAAK,CAAA;AACX,QAAA,MAAM,GAAG,QAAQ,CAAA","sourcesContent":["export interface SentioProjectConfig {\n project: string\n host: string\n source: string\n build: boolean\n targets: Target[]\n}\n\nexport function getFinalizedHost(host: string): string {\n switch (host) {\n case '':\n case 'prod':\n return 'https://app.sentio.xyz'\n case 'test':\n return 'https://test.sentio.xyz'\n case 'staging':\n return 'https://staging.sentio.xyz'\n case 'local':\n return 'http://localhost:10000'\n }\n return host\n}\n\nexport function finalizeHost(config: SentioProjectConfig) {\n config.host = getFinalizedHost(config.host)\n}\n\nexport function FinalizeProjectName(config: SentioProjectConfig, owner: string | undefined) {\n if (owner) {\n let name = config.project\n if (name.includes('/')) {\n name = config.project.split('/')[1]\n }\n config.project = [owner, name].join('/')\n }\n}\n\nexport interface Target {\n chain: string\n abisDir?: string\n}\n\n// Supported target chain, lower case\nexport const EVM = 'evm'\nexport const SOLANA = 'solana'\n"]}
@@ -1,2 +0,0 @@
1
- export declare function WriteKey(host: string, api_key: string): void;
2
- export declare function ReadKey(host: string): string | undefined;
@@ -1,44 +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.ReadKey = exports.WriteKey = void 0;
7
- const path_1 = __importDefault(require("path"));
8
- const fs_1 = __importDefault(require("fs"));
9
- const os_1 = __importDefault(require("os"));
10
- const homeDir = os_1.default.homedir();
11
- const sentioDir = path_1.default.join(homeDir, '.sentio');
12
- const configFile = path_1.default.join(sentioDir, 'config.json');
13
- function WriteKey(host, api_key) {
14
- const sentioDir = path_1.default.join(homeDir, '.sentio');
15
- if (!fs_1.default.existsSync(sentioDir)) {
16
- fs_1.default.mkdirSync(sentioDir, { recursive: true });
17
- }
18
- let config = {};
19
- if (fs_1.default.existsSync(configFile)) {
20
- const content = fs_1.default.readFileSync(configFile, 'utf8');
21
- config = JSON.parse(content);
22
- }
23
- const hostConfig = config[host] || { api_keys: {} };
24
- hostConfig.api_keys = api_key;
25
- config[host] = hostConfig;
26
- fs_1.default.writeFileSync(configFile, JSON.stringify(config, null, 2));
27
- }
28
- exports.WriteKey = WriteKey;
29
- function ReadKey(host) {
30
- if (!fs_1.default.existsSync(sentioDir)) {
31
- return undefined;
32
- }
33
- const configFile = path_1.default.join(sentioDir, 'config.json');
34
- if (fs_1.default.existsSync(configFile)) {
35
- const content = fs_1.default.readFileSync(configFile, 'utf8');
36
- const config = JSON.parse(content);
37
- return config[host]?.api_keys;
38
- }
39
- else {
40
- return undefined;
41
- }
42
- }
43
- exports.ReadKey = ReadKey;
44
- //# sourceMappingURL=key.js.map