@hyperweb/telescope 2.1.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (448) hide show
  1. package/README.md +13 -13
  2. package/{main/bundle.js → bundle.js} +17 -7
  3. package/{types/commands → commands}/download.d.ts +2 -2
  4. package/{main/commands → commands}/download.js +17 -7
  5. package/{main/commands → commands}/generate.js +17 -7
  6. package/{main/commands → commands}/transpile.js +17 -7
  7. package/esm/build.d.ts +41 -0
  8. package/esm/builder.d.ts +50 -0
  9. package/esm/bundle.d.ts +30 -0
  10. package/esm/bundler.d.ts +31 -0
  11. package/esm/commands/download.d.ts +5 -0
  12. package/esm/commands/generate.d.ts +2 -0
  13. package/esm/commands/transpile.d.ts +4 -0
  14. package/{module → esm}/generators/create-helpers.js +2 -1
  15. package/{module → esm}/generators/create-index.js +2 -2
  16. package/{module → esm}/generators/create-sdk-module-stargate-clients.js +1 -1
  17. package/{module → esm}/generators/create-stargate-clients.js +1 -1
  18. package/{types → esm}/utils/index.d.ts +1 -1
  19. package/generators/create-aggregated-lcd-client.d.ts +2 -0
  20. package/generators/create-amino-converters.d.ts +3 -0
  21. package/generators/create-bundle.d.ts +3 -0
  22. package/generators/create-helpers.d.ts +2 -0
  23. package/{main/generators → generators}/create-helpers.js +4 -6
  24. package/generators/create-index.d.ts +2 -0
  25. package/{main/generators → generators}/create-index.js +21 -11
  26. package/generators/create-lcd-client-all.d.ts +3 -0
  27. package/{main/generators → generators}/create-lcd-client-all.js +17 -7
  28. package/generators/create-lcd-client-scoped.d.ts +3 -0
  29. package/{main/generators → generators}/create-lcd-client-scoped.js +17 -7
  30. package/generators/create-lcd-clients.d.ts +3 -0
  31. package/generators/create-mcp-server.d.ts +3 -0
  32. package/generators/create-mobx-bundle.d.ts +2 -0
  33. package/{main/generators → generators}/create-mobx-bundle.js +17 -7
  34. package/generators/create-msg-funcs.d.ts +3 -0
  35. package/generators/create-pinia-store-bundle.d.ts +2 -0
  36. package/{main/generators → generators}/create-pinia-store-bundle.js +17 -7
  37. package/generators/create-pinia-store.d.ts +3 -0
  38. package/generators/create-query-funcs.d.ts +3 -0
  39. package/generators/create-react-query-bundle.d.ts +2 -0
  40. package/{main/generators → generators}/create-react-query-bundle.js +17 -7
  41. package/generators/create-registries.d.ts +3 -0
  42. package/generators/create-root-readme.d.ts +2 -0
  43. package/generators/create-rpc-msg-client-all.d.ts +3 -0
  44. package/{main/generators → generators}/create-rpc-msg-client-all.js +17 -7
  45. package/generators/create-rpc-msg-client-scoped.d.ts +3 -0
  46. package/{main/generators → generators}/create-rpc-msg-client-scoped.js +17 -7
  47. package/generators/create-rpc-msg-clients.d.ts +3 -0
  48. package/generators/create-rpc-ops-bundle.d.ts +2 -0
  49. package/{main/generators → generators}/create-rpc-ops-bundle.js +17 -7
  50. package/generators/create-rpc-query-client-all.d.ts +3 -0
  51. package/{main/generators → generators}/create-rpc-query-client-all.js +17 -7
  52. package/generators/create-rpc-query-client-scoped.d.ts +3 -0
  53. package/{main/generators → generators}/create-rpc-query-client-scoped.js +17 -7
  54. package/generators/create-rpc-query-clients.d.ts +3 -0
  55. package/generators/create-sdk-module-stargate-clients.d.ts +3 -0
  56. package/{main/generators → generators}/create-sdk-module-stargate-clients.js +1 -1
  57. package/generators/create-stargate-clients.d.ts +3 -0
  58. package/{main/generators → generators}/create-stargate-clients.js +1 -1
  59. package/generators/create-types.d.ts +3 -0
  60. package/{main/generators → generators}/create-types.js +17 -7
  61. package/generators/customize-utils.d.ts +2 -0
  62. package/helpers/__test__/internalTimestamp.d.ts +21 -0
  63. package/{main/helpers → helpers}/__test__/internalTimestamp.js +4 -5
  64. package/helpers/__test__/internalTimestampBigint.d.ts +20 -0
  65. package/{main/helpers → helpers}/__test__/internalTimestampBigint.js +4 -5
  66. package/helpers/binary-coder.d.ts +2 -0
  67. package/helpers/decimals.d.ts +1 -0
  68. package/helpers/external-comet.d.ts +1 -0
  69. package/helpers/external-icjs.d.ts +1 -0
  70. package/helpers/external.d.ts +1 -0
  71. package/helpers/grpc-gateway.d.ts +1 -0
  72. package/helpers/grpc-web.d.ts +1 -0
  73. package/helpers/helper-func-types-interface.d.ts +2 -0
  74. package/helpers/helper-func-types.d.ts +2 -0
  75. package/helpers/internal-for-bigint.d.ts +2 -0
  76. package/helpers/internal.d.ts +2 -0
  77. package/helpers/json-safe.d.ts +1 -0
  78. package/helpers/mobx.d.ts +1 -0
  79. package/helpers/pinia-endpoint.d.ts +1 -0
  80. package/helpers/react-query-hooks-icjs.d.ts +2 -0
  81. package/helpers/react-query-hooks.d.ts +2 -0
  82. package/helpers/react-query.d.ts +2 -0
  83. package/{types/helpers/vue-query.d.ts → helpers/registry-helper.d.ts} +1 -1
  84. package/helpers/types-helper.d.ts +2 -0
  85. package/helpers/utf8-helper.d.ts +1 -0
  86. package/helpers/varint.d.ts +1 -0
  87. package/helpers/vue-query-hooks.d.ts +2 -0
  88. package/imports.d.ts +17 -0
  89. package/{main/imports.js → imports.js} +17 -7
  90. package/index.d.ts +6 -0
  91. package/package.json +30 -48
  92. package/parse.d.ts +15 -0
  93. package/prompt.d.ts +3 -0
  94. package/protod/bufbuild.d.ts +6 -0
  95. package/{main/protod → protod}/bufbuild.js +5 -6
  96. package/protod/config.d.ts +7 -0
  97. package/protod/git-repo.d.ts +11 -0
  98. package/protod/recursive.d.ts +4 -0
  99. package/{main/protod → protod}/recursive.js +3 -4
  100. package/protod/types.d.ts +49 -0
  101. package/protod/utils.d.ts +11 -0
  102. package/{main/protod → protod}/utils.js +8 -9
  103. package/types.d.ts +43 -0
  104. package/utils/common-create-bundle.d.ts +18 -0
  105. package/utils/files.d.ts +5 -0
  106. package/{main/utils → utils}/files.js +19 -9
  107. package/utils/index.d.ts +16 -0
  108. package/utils/unused.d.ts +5 -0
  109. package/{main/utils → utils}/unused.js +17 -7
  110. package/main/cli.js +0 -52
  111. package/main/cmds.js +0 -16
  112. package/main/contracts/generate.js +0 -31
  113. package/main/contracts/install.js +0 -107
  114. package/main/contracts/message-composer.js +0 -31
  115. package/main/contracts/react-query.js +0 -31
  116. package/main/contracts/recoil.js +0 -31
  117. package/main/file.js +0 -20
  118. package/main/generators/create-cosmwasm-bundle.js +0 -15
  119. package/main/telescope.js +0 -10
  120. package/main/utils/contracts.js +0 -39
  121. package/module/cli.js +0 -25
  122. package/module/cmds.js +0 -10
  123. package/module/contracts/generate.js +0 -29
  124. package/module/contracts/install.js +0 -105
  125. package/module/contracts/message-composer.js +0 -29
  126. package/module/contracts/react-query.js +0 -29
  127. package/module/contracts/recoil.js +0 -29
  128. package/module/file.js +0 -18
  129. package/module/generators/create-cosmwasm-bundle.js +0 -11
  130. package/module/telescope.js +0 -8
  131. package/module/utils/contracts.js +0 -33
  132. package/src/build.ts +0 -255
  133. package/src/builder.ts +0 -292
  134. package/src/bundle.ts +0 -160
  135. package/src/bundler.ts +0 -153
  136. package/src/cli.js +0 -31
  137. package/src/cmds.js +0 -11
  138. package/src/commands/download.ts +0 -120
  139. package/src/commands/generate.ts +0 -156
  140. package/src/commands/install.ts +0 -154
  141. package/src/commands/transpile.ts +0 -205
  142. package/src/file.js +0 -20
  143. package/src/generators/create-aggregated-lcd-client.ts +0 -133
  144. package/src/generators/create-all-stargate-clients.ts +0 -121
  145. package/src/generators/create-amino-converters.ts +0 -62
  146. package/src/generators/create-bundle.ts +0 -143
  147. package/src/generators/create-custom-stargate-clients.ts +0 -128
  148. package/src/generators/create-helpers.ts +0 -209
  149. package/src/generators/create-index.ts +0 -72
  150. package/src/generators/create-lcd-client-all.ts +0 -139
  151. package/src/generators/create-lcd-client-scoped.ts +0 -109
  152. package/src/generators/create-lcd-clients.ts +0 -108
  153. package/src/generators/create-mcp-server.ts +0 -1774
  154. package/src/generators/create-mobx-bundle.ts +0 -31
  155. package/src/generators/create-msg-funcs.ts +0 -219
  156. package/src/generators/create-pinia-store-bundle.ts +0 -35
  157. package/src/generators/create-pinia-store.ts +0 -121
  158. package/src/generators/create-query-funcs.ts +0 -224
  159. package/src/generators/create-react-query-bundle.ts +0 -111
  160. package/src/generators/create-registries.ts +0 -70
  161. package/src/generators/create-root-readme.ts +0 -403
  162. package/src/generators/create-rpc-msg-client-all.ts +0 -167
  163. package/src/generators/create-rpc-msg-client-scoped.ts +0 -147
  164. package/src/generators/create-rpc-msg-clients.ts +0 -165
  165. package/src/generators/create-rpc-ops-bundle.ts +0 -155
  166. package/src/generators/create-rpc-query-client-all.ts +0 -173
  167. package/src/generators/create-rpc-query-client-scoped.ts +0 -142
  168. package/src/generators/create-rpc-query-clients.ts +0 -304
  169. package/src/generators/create-sdk-module-stargate-clients.ts +0 -120
  170. package/src/generators/create-stargate-clients.ts +0 -123
  171. package/src/generators/create-types.ts +0 -236
  172. package/src/generators/customize-utils.ts +0 -52
  173. package/src/helpers/__test__/internalTimestamp.test.ts +0 -79
  174. package/src/helpers/__test__/internalTimestamp.ts +0 -58
  175. package/src/helpers/__test__/internalTimestampBigint.test.ts +0 -78
  176. package/src/helpers/__test__/internalTimestampBigint.ts +0 -58
  177. package/src/helpers/binary-coder.ts +0 -533
  178. package/src/helpers/decimals.ts +0 -108
  179. package/src/helpers/external-comet.ts +0 -49
  180. package/src/helpers/external-icjs.ts +0 -43
  181. package/src/helpers/external.ts +0 -28
  182. package/src/helpers/grpc-gateway.ts +0 -345
  183. package/src/helpers/grpc-web.ts +0 -11
  184. package/src/helpers/helper-func-types-interface.ts +0 -104
  185. package/src/helpers/helper-func-types.ts +0 -91
  186. package/src/helpers/internal-for-bigint.ts +0 -259
  187. package/src/helpers/internal.ts +0 -241
  188. package/src/helpers/json-safe.ts +0 -11
  189. package/src/helpers/mobx.ts +0 -77
  190. package/src/helpers/pinia-endpoint.ts +0 -17
  191. package/src/helpers/react-query-hooks-icjs.ts +0 -223
  192. package/src/helpers/react-query-hooks.ts +0 -266
  193. package/src/helpers/react-query.ts +0 -101
  194. package/src/helpers/registry-helper.ts +0 -227
  195. package/src/helpers/types-helper.ts +0 -169
  196. package/src/helpers/utf8-helper.ts +0 -143
  197. package/src/helpers/varint.ts +0 -483
  198. package/src/helpers/vue-query-hooks.ts +0 -224
  199. package/src/imports.ts +0 -499
  200. package/src/index.ts +0 -12
  201. package/src/parse.ts +0 -243
  202. package/src/prompt.js +0 -65
  203. package/src/protod/bufbuild.spec.ts +0 -80
  204. package/src/protod/bufbuild.ts +0 -95
  205. package/src/protod/config.ts +0 -30
  206. package/src/protod/git-repo.ts +0 -74
  207. package/src/protod/recursive.spec.ts +0 -164
  208. package/src/protod/recursive.ts +0 -190
  209. package/src/protod/test-data/.protod.config.json +0 -42
  210. package/src/protod/test-data/buf.lock +0 -23
  211. package/src/protod/test-data/buf.yaml +0 -25
  212. package/src/protod/test-data/buf2.yaml +0 -20
  213. package/src/protod/test-data/cosmos/buf.lock +0 -23
  214. package/src/protod/test-data/cosmos/crypto/secp256k1/keys.proto +0 -38
  215. package/src/protod/test-data/model.proto +0 -101
  216. package/src/protod/types.ts +0 -55
  217. package/src/protod/utils.spec.ts +0 -68
  218. package/src/protod/utils.ts +0 -90
  219. package/src/telescope.js +0 -9
  220. package/src/types.ts +0 -46
  221. package/src/utils/common-create-bundle.ts +0 -62
  222. package/src/utils/files.ts +0 -145
  223. package/src/utils/index.ts +0 -149
  224. package/src/utils/unused.ts +0 -52
  225. package/types/cli.d.ts +0 -1
  226. package/types/cmds.d.ts +0 -10
  227. package/types/contracts/generate.d.ts +0 -2
  228. package/types/contracts/message-composer.d.ts +0 -2
  229. package/types/contracts/react-query.d.ts +0 -2
  230. package/types/contracts/recoil.d.ts +0 -2
  231. package/types/file.d.ts +0 -2
  232. package/types/generators/create-cosmwasm-bundle.d.ts +0 -2
  233. package/types/generators/create-unified-stargate-clients.d.ts +0 -3
  234. package/types/helpers/generated-type.d.ts +0 -1
  235. package/types/helpers/internalForBigInt.d.ts +0 -1
  236. package/types/helpers/types.d.ts +0 -1
  237. package/types/protod/proto-download.d.ts +0 -2
  238. package/types/telescope.d.ts +0 -2
  239. package/types/utils/contracts.d.ts +0 -6
  240. /package/{types/build.d.ts → build.d.ts} +0 -0
  241. /package/{main/build.js → build.js} +0 -0
  242. /package/{types/builder.d.ts → builder.d.ts} +0 -0
  243. /package/{main/builder.js → builder.js} +0 -0
  244. /package/{types/bundle.d.ts → bundle.d.ts} +0 -0
  245. /package/{types/bundler.d.ts → bundler.d.ts} +0 -0
  246. /package/{main/bundler.js → bundler.js} +0 -0
  247. /package/{types/commands → commands}/generate.d.ts +0 -0
  248. /package/{types/commands → commands}/install.d.ts +0 -0
  249. /package/{main/commands → commands}/install.js +0 -0
  250. /package/{types/commands → commands}/transpile.d.ts +0 -0
  251. /package/{module → esm}/build.js +0 -0
  252. /package/{module → esm}/builder.js +0 -0
  253. /package/{module → esm}/bundle.js +0 -0
  254. /package/{module → esm}/bundler.js +0 -0
  255. /package/{module → esm}/commands/download.js +0 -0
  256. /package/{module → esm}/commands/generate.js +0 -0
  257. /package/{types/contracts → esm/commands}/install.d.ts +0 -0
  258. /package/{module → esm}/commands/install.js +0 -0
  259. /package/{module → esm}/commands/transpile.js +0 -0
  260. /package/{types → esm}/generators/create-aggregated-lcd-client.d.ts +0 -0
  261. /package/{module → esm}/generators/create-aggregated-lcd-client.js +0 -0
  262. /package/{types → esm}/generators/create-all-stargate-clients.d.ts +0 -0
  263. /package/{module → esm}/generators/create-all-stargate-clients.js +0 -0
  264. /package/{types → esm}/generators/create-amino-converters.d.ts +0 -0
  265. /package/{module → esm}/generators/create-amino-converters.js +0 -0
  266. /package/{types → esm}/generators/create-bundle.d.ts +0 -0
  267. /package/{module → esm}/generators/create-bundle.js +0 -0
  268. /package/{types → esm}/generators/create-custom-stargate-clients.d.ts +0 -0
  269. /package/{module → esm}/generators/create-custom-stargate-clients.js +0 -0
  270. /package/{types → esm}/generators/create-helpers.d.ts +0 -0
  271. /package/{types → esm}/generators/create-index.d.ts +0 -0
  272. /package/{types → esm}/generators/create-lcd-client-all.d.ts +0 -0
  273. /package/{module → esm}/generators/create-lcd-client-all.js +0 -0
  274. /package/{types → esm}/generators/create-lcd-client-scoped.d.ts +0 -0
  275. /package/{module → esm}/generators/create-lcd-client-scoped.js +0 -0
  276. /package/{types → esm}/generators/create-lcd-clients.d.ts +0 -0
  277. /package/{module → esm}/generators/create-lcd-clients.js +0 -0
  278. /package/{types → esm}/generators/create-mcp-server.d.ts +0 -0
  279. /package/{module → esm}/generators/create-mcp-server.js +0 -0
  280. /package/{types → esm}/generators/create-mobx-bundle.d.ts +0 -0
  281. /package/{module → esm}/generators/create-mobx-bundle.js +0 -0
  282. /package/{types → esm}/generators/create-msg-funcs.d.ts +0 -0
  283. /package/{module → esm}/generators/create-msg-funcs.js +0 -0
  284. /package/{types → esm}/generators/create-pinia-store-bundle.d.ts +0 -0
  285. /package/{module → esm}/generators/create-pinia-store-bundle.js +0 -0
  286. /package/{types → esm}/generators/create-pinia-store.d.ts +0 -0
  287. /package/{module → esm}/generators/create-pinia-store.js +0 -0
  288. /package/{types → esm}/generators/create-query-funcs.d.ts +0 -0
  289. /package/{module → esm}/generators/create-query-funcs.js +0 -0
  290. /package/{types → esm}/generators/create-react-query-bundle.d.ts +0 -0
  291. /package/{module → esm}/generators/create-react-query-bundle.js +0 -0
  292. /package/{types → esm}/generators/create-registries.d.ts +0 -0
  293. /package/{module → esm}/generators/create-registries.js +0 -0
  294. /package/{types → esm}/generators/create-root-readme.d.ts +0 -0
  295. /package/{module → esm}/generators/create-root-readme.js +0 -0
  296. /package/{types → esm}/generators/create-rpc-msg-client-all.d.ts +0 -0
  297. /package/{module → esm}/generators/create-rpc-msg-client-all.js +0 -0
  298. /package/{types → esm}/generators/create-rpc-msg-client-scoped.d.ts +0 -0
  299. /package/{module → esm}/generators/create-rpc-msg-client-scoped.js +0 -0
  300. /package/{types → esm}/generators/create-rpc-msg-clients.d.ts +0 -0
  301. /package/{module → esm}/generators/create-rpc-msg-clients.js +0 -0
  302. /package/{types → esm}/generators/create-rpc-ops-bundle.d.ts +0 -0
  303. /package/{module → esm}/generators/create-rpc-ops-bundle.js +0 -0
  304. /package/{types → esm}/generators/create-rpc-query-client-all.d.ts +0 -0
  305. /package/{module → esm}/generators/create-rpc-query-client-all.js +0 -0
  306. /package/{types → esm}/generators/create-rpc-query-client-scoped.d.ts +0 -0
  307. /package/{module → esm}/generators/create-rpc-query-client-scoped.js +0 -0
  308. /package/{types → esm}/generators/create-rpc-query-clients.d.ts +0 -0
  309. /package/{module → esm}/generators/create-rpc-query-clients.js +0 -0
  310. /package/{types → esm}/generators/create-sdk-module-stargate-clients.d.ts +0 -0
  311. /package/{types → esm}/generators/create-stargate-clients.d.ts +0 -0
  312. /package/{types → esm}/generators/create-types.d.ts +0 -0
  313. /package/{module → esm}/generators/create-types.js +0 -0
  314. /package/{types → esm}/generators/customize-utils.d.ts +0 -0
  315. /package/{module → esm}/generators/customize-utils.js +0 -0
  316. /package/{types → esm}/helpers/__test__/internalTimestamp.d.ts +0 -0
  317. /package/{module → esm}/helpers/__test__/internalTimestamp.js +0 -0
  318. /package/{types → esm}/helpers/__test__/internalTimestampBigint.d.ts +0 -0
  319. /package/{module → esm}/helpers/__test__/internalTimestampBigint.js +0 -0
  320. /package/{types → esm}/helpers/binary-coder.d.ts +0 -0
  321. /package/{module → esm}/helpers/binary-coder.js +0 -0
  322. /package/{types → esm}/helpers/decimals.d.ts +0 -0
  323. /package/{module → esm}/helpers/decimals.js +0 -0
  324. /package/{types → esm}/helpers/external-comet.d.ts +0 -0
  325. /package/{module → esm}/helpers/external-comet.js +0 -0
  326. /package/{types → esm}/helpers/external-icjs.d.ts +0 -0
  327. /package/{module → esm}/helpers/external-icjs.js +0 -0
  328. /package/{types → esm}/helpers/external.d.ts +0 -0
  329. /package/{module → esm}/helpers/external.js +0 -0
  330. /package/{types → esm}/helpers/grpc-gateway.d.ts +0 -0
  331. /package/{module → esm}/helpers/grpc-gateway.js +0 -0
  332. /package/{types → esm}/helpers/grpc-web.d.ts +0 -0
  333. /package/{module → esm}/helpers/grpc-web.js +0 -0
  334. /package/{types → esm}/helpers/helper-func-types-interface.d.ts +0 -0
  335. /package/{module → esm}/helpers/helper-func-types-interface.js +0 -0
  336. /package/{types → esm}/helpers/helper-func-types.d.ts +0 -0
  337. /package/{module → esm}/helpers/helper-func-types.js +0 -0
  338. /package/{types → esm}/helpers/index.d.ts +0 -0
  339. /package/{module → esm}/helpers/index.js +0 -0
  340. /package/{types → esm}/helpers/internal-for-bigint.d.ts +0 -0
  341. /package/{module → esm}/helpers/internal-for-bigint.js +0 -0
  342. /package/{types → esm}/helpers/internal.d.ts +0 -0
  343. /package/{module → esm}/helpers/internal.js +0 -0
  344. /package/{types → esm}/helpers/json-safe.d.ts +0 -0
  345. /package/{module → esm}/helpers/json-safe.js +0 -0
  346. /package/{types → esm}/helpers/mobx.d.ts +0 -0
  347. /package/{module → esm}/helpers/mobx.js +0 -0
  348. /package/{types → esm}/helpers/pinia-endpoint.d.ts +0 -0
  349. /package/{module → esm}/helpers/pinia-endpoint.js +0 -0
  350. /package/{types → esm}/helpers/react-query-hooks-icjs.d.ts +0 -0
  351. /package/{module → esm}/helpers/react-query-hooks-icjs.js +0 -0
  352. /package/{types → esm}/helpers/react-query-hooks.d.ts +0 -0
  353. /package/{module → esm}/helpers/react-query-hooks.js +0 -0
  354. /package/{types → esm}/helpers/react-query.d.ts +0 -0
  355. /package/{module → esm}/helpers/react-query.js +0 -0
  356. /package/{types → esm}/helpers/registry-helper.d.ts +0 -0
  357. /package/{module → esm}/helpers/registry-helper.js +0 -0
  358. /package/{types → esm}/helpers/types-helper.d.ts +0 -0
  359. /package/{module → esm}/helpers/types-helper.js +0 -0
  360. /package/{types → esm}/helpers/utf8-helper.d.ts +0 -0
  361. /package/{module → esm}/helpers/utf8-helper.js +0 -0
  362. /package/{types → esm}/helpers/varint.d.ts +0 -0
  363. /package/{module → esm}/helpers/varint.js +0 -0
  364. /package/{types → esm}/helpers/vue-query-hooks.d.ts +0 -0
  365. /package/{module → esm}/helpers/vue-query-hooks.js +0 -0
  366. /package/{types → esm}/imports.d.ts +0 -0
  367. /package/{module → esm}/imports.js +0 -0
  368. /package/{types → esm}/index.d.ts +0 -0
  369. /package/{module → esm}/index.js +0 -0
  370. /package/{types → esm}/parse.d.ts +0 -0
  371. /package/{module → esm}/parse.js +0 -0
  372. /package/{types → esm}/prompt.d.ts +0 -0
  373. /package/{module → esm}/prompt.js +0 -0
  374. /package/{types → esm}/protod/bufbuild.d.ts +0 -0
  375. /package/{module → esm}/protod/bufbuild.js +0 -0
  376. /package/{types → esm}/protod/config.d.ts +0 -0
  377. /package/{module → esm}/protod/config.js +0 -0
  378. /package/{types → esm}/protod/git-repo.d.ts +0 -0
  379. /package/{module → esm}/protod/git-repo.js +0 -0
  380. /package/{types → esm}/protod/index.d.ts +0 -0
  381. /package/{module → esm}/protod/index.js +0 -0
  382. /package/{types → esm}/protod/recursive.d.ts +0 -0
  383. /package/{module → esm}/protod/recursive.js +0 -0
  384. /package/{types → esm}/protod/types.d.ts +0 -0
  385. /package/{module → esm}/protod/types.js +0 -0
  386. /package/{types → esm}/protod/utils.d.ts +0 -0
  387. /package/{module → esm}/protod/utils.js +0 -0
  388. /package/{types → esm}/types.d.ts +0 -0
  389. /package/{module → esm}/types.js +0 -0
  390. /package/{types → esm}/utils/common-create-bundle.d.ts +0 -0
  391. /package/{module → esm}/utils/common-create-bundle.js +0 -0
  392. /package/{types → esm}/utils/files.d.ts +0 -0
  393. /package/{module → esm}/utils/files.js +0 -0
  394. /package/{module → esm}/utils/index.js +0 -0
  395. /package/{types → esm}/utils/unused.d.ts +0 -0
  396. /package/{module → esm}/utils/unused.js +0 -0
  397. /package/{main/generators → generators}/create-aggregated-lcd-client.js +0 -0
  398. /package/{types/generators/create-combined-stargate-clients.d.ts → generators/create-all-stargate-clients.d.ts} +0 -0
  399. /package/{main/generators → generators}/create-all-stargate-clients.js +0 -0
  400. /package/{main/generators → generators}/create-amino-converters.js +0 -0
  401. /package/{main/generators → generators}/create-bundle.js +0 -0
  402. /package/{types/generators/create-scoped-stargate-clients.d.ts → generators/create-custom-stargate-clients.d.ts} +0 -0
  403. /package/{main/generators → generators}/create-custom-stargate-clients.js +0 -0
  404. /package/{main/generators → generators}/create-lcd-clients.js +0 -0
  405. /package/{main/generators → generators}/create-mcp-server.js +0 -0
  406. /package/{main/generators → generators}/create-msg-funcs.js +0 -0
  407. /package/{main/generators → generators}/create-pinia-store.js +0 -0
  408. /package/{main/generators → generators}/create-query-funcs.js +0 -0
  409. /package/{main/generators → generators}/create-registries.js +0 -0
  410. /package/{main/generators → generators}/create-root-readme.js +0 -0
  411. /package/{main/generators → generators}/create-rpc-msg-clients.js +0 -0
  412. /package/{main/generators → generators}/create-rpc-query-clients.js +0 -0
  413. /package/{main/generators → generators}/customize-utils.js +0 -0
  414. /package/{main/helpers → helpers}/binary-coder.js +0 -0
  415. /package/{main/helpers → helpers}/decimals.js +0 -0
  416. /package/{main/helpers → helpers}/external-comet.js +0 -0
  417. /package/{main/helpers → helpers}/external-icjs.js +0 -0
  418. /package/{main/helpers → helpers}/external.js +0 -0
  419. /package/{main/helpers → helpers}/grpc-gateway.js +0 -0
  420. /package/{main/helpers → helpers}/grpc-web.js +0 -0
  421. /package/{main/helpers → helpers}/helper-func-types-interface.js +0 -0
  422. /package/{main/helpers → helpers}/helper-func-types.js +0 -0
  423. /package/{src/helpers/index.ts → helpers/index.d.ts} +0 -0
  424. /package/{main/helpers → helpers}/index.js +0 -0
  425. /package/{main/helpers → helpers}/internal-for-bigint.js +0 -0
  426. /package/{main/helpers → helpers}/internal.js +0 -0
  427. /package/{main/helpers → helpers}/json-safe.js +0 -0
  428. /package/{main/helpers → helpers}/mobx.js +0 -0
  429. /package/{main/helpers → helpers}/pinia-endpoint.js +0 -0
  430. /package/{main/helpers → helpers}/react-query-hooks-icjs.js +0 -0
  431. /package/{main/helpers → helpers}/react-query-hooks.js +0 -0
  432. /package/{main/helpers → helpers}/react-query.js +0 -0
  433. /package/{main/helpers → helpers}/registry-helper.js +0 -0
  434. /package/{main/helpers → helpers}/types-helper.js +0 -0
  435. /package/{main/helpers → helpers}/utf8-helper.js +0 -0
  436. /package/{main/helpers → helpers}/varint.js +0 -0
  437. /package/{main/helpers → helpers}/vue-query-hooks.js +0 -0
  438. /package/{main/index.js → index.js} +0 -0
  439. /package/{main/parse.js → parse.js} +0 -0
  440. /package/{main/prompt.js → prompt.js} +0 -0
  441. /package/{main/protod → protod}/config.js +0 -0
  442. /package/{main/protod → protod}/git-repo.js +0 -0
  443. /package/{src/protod/index.ts → protod/index.d.ts} +0 -0
  444. /package/{main/protod → protod}/index.js +0 -0
  445. /package/{main/protod → protod}/types.js +0 -0
  446. /package/{main/types.js → types.js} +0 -0
  447. /package/{main/utils → utils}/common-create-bundle.js +0 -0
  448. /package/{main/utils → utils}/index.js +0 -0
@@ -1,29 +0,0 @@
1
- import { prompt } from '../prompt';
2
- import { generateReactQuery } from '@cosmwasm/ts-codegen';
3
- import { getContracts, getContractSchemata } from '../utils/contracts';
4
- export default async (argv) => {
5
- const contracts = getContracts();
6
- const questions = [
7
- {
8
- _: true,
9
- type: 'checkbox',
10
- name: 'schema',
11
- message: 'which directory contains the the Rust contracts?',
12
- choices: contracts
13
- },
14
- {
15
- _: true,
16
- type: 'path',
17
- name: 'out',
18
- message: 'where is the output directory?',
19
- default: './src/contracts'
20
- }
21
- ];
22
- let { schema, out } = await prompt(questions, argv);
23
- if (!Array.isArray(schema))
24
- schema = [schema];
25
- const s = await getContractSchemata(schema, out, argv);
26
- s.forEach(async ({ contractName, schemas, outPath }) => {
27
- await generateReactQuery(contractName, schemas, outPath);
28
- });
29
- };
@@ -1,29 +0,0 @@
1
- import { prompt } from '../prompt';
2
- import { generateRecoil } from '@cosmwasm/ts-codegen';
3
- import { getContracts, getContractSchemata } from '../utils/contracts';
4
- export default async (argv) => {
5
- const contracts = getContracts();
6
- const questions = [
7
- {
8
- _: true,
9
- type: 'checkbox',
10
- name: 'schema',
11
- message: 'which directory contains the the Rust contracts?',
12
- choices: contracts
13
- },
14
- {
15
- _: true,
16
- type: 'path',
17
- name: 'out',
18
- message: 'where is the output directory?',
19
- default: './src/contracts'
20
- }
21
- ];
22
- let { schema, out } = await prompt(questions, argv);
23
- if (!Array.isArray(schema))
24
- schema = [schema];
25
- const s = await getContractSchemata(schema, out, argv);
26
- s.forEach(async ({ contractName, schemas, outPath }) => {
27
- await generateRecoil(contractName, schemas, outPath);
28
- });
29
- };
package/module/file.js DELETED
@@ -1,18 +0,0 @@
1
- #!/usr/bin/env node
2
- import { prompt } from './prompt';
3
- import { cli } from './cli';
4
- import { readFileSync } from 'fs';
5
- const argv = require('minimist')(process.argv.slice(2));
6
- const question = [
7
- {
8
- _: true,
9
- type: 'string',
10
- name: 'file',
11
- message: 'file'
12
- }
13
- ];
14
- (async () => {
15
- const { file } = await prompt(question, argv);
16
- const argvv = JSON.parse(readFileSync(file, 'utf-8'));
17
- await cli(argvv);
18
- })();
@@ -1,11 +0,0 @@
1
- import { TSBuilder } from '@cosmwasm/ts-codegen';
2
- export const plugin = async (builder) => {
3
- if (!builder.options.cosmwasm) {
4
- return;
5
- }
6
- const input = builder.options.cosmwasm;
7
- const cosmWasmBuilder = new TSBuilder(input);
8
- await cosmWasmBuilder.build();
9
- const file = input.options.bundle.bundleFile;
10
- builder.files.push(file);
11
- };
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
2
- import { cli } from './cli';
3
- var argv = require('minimist')(process.argv.slice(2), {
4
- boolean: ['ssh']
5
- });
6
- (async () => {
7
- await cli(argv);
8
- })();
@@ -1,33 +0,0 @@
1
- import { readSchemas } from '@cosmwasm/ts-codegen';
2
- import { pascal } from 'case';
3
- import { basename, dirname, join } from 'path';
4
- import { readFileSync, readdirSync } from 'fs';
5
- export const getDirectories = source => readdirSync(source, { withFileTypes: true })
6
- .filter(dirent => dirent.isDirectory())
7
- .map(dirent => dirent.name);
8
- export const getContracts = () => {
9
- const contracts = getDirectories('./contracts')
10
- .map(contractDirname => {
11
- return {
12
- name: `${contractDirname}`,
13
- value: `./contracts/${contractDirname}`
14
- };
15
- });
16
- return contracts;
17
- };
18
- export const getContractSchemata = async (schemata, out, argv) => {
19
- const s = [];
20
- for (let i = 0; i < schemata.length; i++) {
21
- const path = schemata[i];
22
- const pkg = JSON.parse(readFileSync(join(path, 'package.json'), 'utf-8'));
23
- const name = basename(path);
24
- const folder = basename(dirname(path));
25
- const contractName = pascal(pkg.contract) || pascal(name);
26
- const schemas = await readSchemas({ schemaDir: path });
27
- const outPath = join(out, folder);
28
- s.push({
29
- contractName, schemas, outPath
30
- });
31
- }
32
- return s;
33
- };
package/src/build.ts DELETED
@@ -1,255 +0,0 @@
1
- import { ProtoRef, TelescopeOptions } from '@cosmology/types';
2
- import { ProtoStore } from '@cosmology/proto-parser';
3
- import {
4
- AminoParseContext,
5
- createAminoConverter,
6
- createCreateProtoType,
7
- createObjectWithMethods,
8
- createRegisterObject,
9
- createProtoEnum,
10
- createProtoEnumToJSON,
11
- createProtoEnumFromJSON,
12
- createProtoType,
13
- createProtoInterfaceEncodedType,
14
- createProtoTypeType,
15
- createSDKType,
16
- createAminoType,
17
- createAminoTypeType,
18
- createEnumSDKType,
19
- createEnumAminoType,
20
- makeAminoTypeInterface,
21
- GenericParseContext,
22
- ProtoParseContext,
23
- createTypeRegistry,
24
- createRegistryLoader,
25
-
26
- // helper
27
- createHelperObject,
28
- createInterfaceDecoder,
29
- createInterfaceFromAmino,
30
- createInterfaceToAmino,
31
- createRegisterAminoProtoMapping,
32
- } from '@cosmology/ast';
33
- import { ServiceMutation, ServiceQuery } from '@cosmology/types';
34
-
35
- export const getMutations = (mutations: ServiceMutation[]) => {
36
- return mutations.map((mutation: ServiceMutation) => {
37
- return {
38
- typeUrl: `/${mutation.package}.${mutation.message}`,
39
- TypeName: mutation.message,
40
- methodName: mutation.methodName
41
- }
42
- });
43
- };
44
-
45
- export const getAminoProtos = (mutations: ServiceMutation[], store: ProtoStore) => {
46
- return mutations.map(mutation => {
47
- const ref = store.findProto(mutation.messageImport);
48
- return store.get(ref, mutation.message).obj;
49
- });
50
- };
51
-
52
- export const buildBaseTypeScriptClass = (
53
- context: TelescopeParseContext,
54
- name: string,
55
- obj: any
56
- ) => {
57
- if (context.options.prototypes.enabled) {
58
- context.body.push(createCreateProtoType(context.proto, name, obj));
59
- context.body.push(createObjectWithMethods(context.proto, name, obj));
60
-
61
- if(context.options.interfaces?.enabled && context.options.interfaces?.useGlobalDecoderRegistry && context.options.interfaces?.registerAllDecodersToGlobal){
62
- const registerObj = createRegisterObject(context.proto, name, obj);
63
- if(registerObj){
64
- context.body.push(registerObj);
65
-
66
- //createRegisterAminoProtoMapping
67
- const registerAminoObj = createRegisterAminoProtoMapping(context.proto, name, obj);
68
- if(registerAminoObj){
69
- context.body.push(registerAminoObj);
70
- }
71
- }
72
- }
73
- }
74
- };
75
-
76
- export const buildBaseTypeScriptInterface = (
77
- context: TelescopeParseContext,
78
- name: string,
79
- obj: any
80
- ) => {
81
-
82
- context.body.push(createProtoType(context.proto, name, obj));
83
-
84
- if (context.options.aminoEncoding?.enabled && !context.options.aminoEncoding?.useLegacyInlineEncoding || context.options.prototypes?.methods?.fromProto || context.options.prototypes?.methods?.toProto) {
85
- context.body.push(createProtoTypeType(context.proto, name, obj));
86
- }
87
-
88
- if (context.options.aminoEncoding?.enabled && !context.options.aminoEncoding?.useLegacyInlineEncoding) {
89
- // conditional type
90
- const interfaceType = createProtoInterfaceEncodedType(context.proto, name, obj);
91
- if (interfaceType) {
92
- context.body.push(interfaceType);
93
- }
94
- context.body.push(createAminoType(context.proto, name, obj));
95
-
96
- if(!context.options.aminoEncoding?.disableMsgTypes){
97
- context.body.push(createAminoTypeType(context.proto, name, obj));
98
- }
99
- }
100
- if (context.options.useSDKTypes) {
101
- context.body.push(createSDKType(context.proto, name, obj));
102
- }
103
- };
104
-
105
- export const buildEnums = (
106
- context: TelescopeParseContext,
107
- name: string,
108
- obj: any
109
- ) => {
110
- context.body.push(createProtoEnum(context.proto, name, obj));
111
- if (context.options.useSDKTypes) {
112
- context.body.push(createEnumSDKType(context.proto, name, obj));
113
- }
114
- if (context.options.aminoEncoding?.enabled && !context.options.aminoEncoding?.useLegacyInlineEncoding) {
115
- context.body.push(createEnumAminoType(context.proto, name, obj));
116
- }
117
- context.body.push(createProtoEnumFromJSON(context.proto, name, obj));
118
- context.body.push(createProtoEnumToJSON(context.proto, name, obj));
119
- };
120
- export interface TelescopeParseContext {
121
- options: TelescopeOptions;
122
- generic: GenericParseContext;
123
- proto: ProtoParseContext;
124
- amino: AminoParseContext;
125
- store: ProtoStore;
126
- ref: ProtoRef;
127
- parsedImports: Record<string, any>;
128
- body: any[];
129
- mutations: ServiceMutation[];
130
- queries: any[];
131
- services: any[];
132
- types: any[];
133
- }
134
- export class TelescopeParseContext implements TelescopeParseContext {
135
- constructor(ref: ProtoRef, store: ProtoStore, options: TelescopeOptions) {
136
- this.generic = new GenericParseContext(
137
- ref, store, options
138
- );
139
- this.proto = new ProtoParseContext(
140
- ref, store, options
141
- );
142
- this.amino = new AminoParseContext(
143
- ref, store, options
144
- );
145
- this.options = options;
146
- this.ref = ref;
147
- this.store = store;
148
- this.parsedImports = {};
149
- this.body = [];
150
- this.queries = [];
151
- this.services = [];
152
- this.mutations = [];
153
- this.types = [];
154
- }
155
-
156
- hasMutations() {
157
- return this.mutations.length > 0;
158
- }
159
-
160
- addType(name: string, obj: any, isNested: boolean) {
161
- this.types.push({
162
- name,
163
- obj,
164
- isNested
165
- });
166
- }
167
- addMutation(mutation: ServiceMutation) {
168
- this.mutations.push(mutation);
169
- }
170
- addQuery(query: ServiceQuery) {
171
- this.queries.push(query);
172
- }
173
- addService(query: any) {
174
- this.services.push(query);
175
- }
176
- // build main Class with methods
177
- buildBase() {
178
- this.types.forEach(typeReg => {
179
- const { name, obj } = typeReg;
180
- if (obj.type === 'Enum') {
181
- buildEnums(this, name, obj);
182
- }
183
- });
184
- this.types.forEach(typeReg => {
185
- const { name, obj } = typeReg;
186
- if (obj.type === 'Type') {
187
- buildBaseTypeScriptInterface(this, name, obj);
188
- }
189
- });
190
- this.types.forEach(typeReg => {
191
- const { name, obj } = typeReg;
192
- if (obj.type === 'Type') {
193
- buildBaseTypeScriptClass(this, name, obj);
194
- }
195
- });
196
-
197
- // interfaces
198
- if (this.options.interfaces.enabled && !this.options.interfaces.useGlobalDecoderRegistry) {
199
- const interfaces = Object.keys(this.ref.traversed.acceptsInterface ?? {});
200
- if (interfaces.length) {
201
- interfaces.forEach(interfaceName => {
202
- this.body.push(createInterfaceDecoder(this.proto, this.ref, interfaceName));
203
- if (
204
- this.options.aminoEncoding?.enabled &&
205
- !this.options.aminoEncoding?.useLegacyInlineEncoding
206
- ) {
207
- this.body.push(createInterfaceFromAmino(this.proto, this.ref, interfaceName));
208
- this.body.push(createInterfaceToAmino(this.proto, this.ref, interfaceName));
209
- }
210
- })
211
- }
212
- }
213
- }
214
-
215
- buildRegistry() {
216
- this.body.push(createTypeRegistry(this.amino, getMutations(this.mutations)));
217
- }
218
- buildRegistryLoader() {
219
- if (!this.options?.prototypes?.enableRegistryLoader) {
220
- return
221
- }
222
-
223
- this.body.push(createRegistryLoader(this.amino));
224
- }
225
- buildAminoInterfaces() {
226
- if (!this.options?.aminoEncoding?.enabled || !this.options?.aminoEncoding?.useLegacyInlineEncoding) return;
227
- //
228
- const protos = getAminoProtos(this.mutations, this.store);
229
- protos.forEach(proto => {
230
- this.body.push(makeAminoTypeInterface({
231
- context: this.amino,
232
- proto
233
- }));
234
- });
235
- }
236
- buildAminoConverter() {
237
- this.body.push(createAminoConverter({
238
- name: 'AminoConverter',
239
- context: this.amino,
240
- root: this.ref.traversed,
241
- protos: getAminoProtos(this.mutations, this.store)
242
- }));
243
- }
244
- buildHelperObject() {
245
- if (!this.options?.prototypes?.enableMessageComposer) {
246
- return
247
- }
248
- // add methods
249
- this.body.push(createHelperObject({
250
- context: this.amino,
251
- name: 'MessageComposer',
252
- mutations: getMutations(this.mutations)
253
- }));
254
- }
255
- }
package/src/builder.ts DELETED
@@ -1,292 +0,0 @@
1
- import { ProtoStore } from '@cosmology/proto-parser';
2
- import { TelescopeParseContext } from './build';
3
- import { TelescopeOptions, defaultTelescopeOptions } from '@cosmology/types';
4
- import { toPosixPath } from '@cosmology/utils';
5
- import { bundlePackages } from './bundle';
6
- import { BundlerFile, TelescopeInput } from './types';
7
- import { Bundler } from './bundler';
8
- import deepmerge from 'deepmerge';
9
- import { resolve } from 'path';
10
-
11
- import { plugin as createTypes } from './generators/create-types';
12
- import { plugin as createAminoConverters } from './generators/create-amino-converters';
13
- import { plugin as createRegistries } from './generators/create-registries';
14
- import { plugin as createLCDClients } from './generators/create-lcd-clients';
15
- import { plugin as createAggregatedLCDClient } from './generators/create-aggregated-lcd-client';
16
- import { plugin as createLCDClientsScoped } from './generators/create-lcd-client-scoped';
17
- import { plugin as createLCDClientsAll } from './generators/create-lcd-client-all';
18
- import { plugin as createRPCQueryClientsScoped } from './generators/create-rpc-query-client-scoped';
19
- import { plugin as createRPCQueryClientsAll } from './generators/create-rpc-query-client-all';
20
- import { plugin as createRPCMsgClientsScoped } from './generators/create-rpc-msg-client-scoped';
21
- import { plugin as createRPCMsgClientsAll } from './generators/create-rpc-msg-client-all';
22
- import { plugin as createRPCQueryClients } from './generators/create-rpc-query-clients';
23
- import { plugin as createRPCMsgClients } from './generators/create-rpc-msg-clients';
24
- import { plugin as createQueryFuncs } from './generators/create-query-funcs';
25
- import { plugin as createMsgFuncs } from './generators/create-msg-funcs';
26
- import { plugin as createReactQueryBundle } from './generators/create-react-query-bundle';
27
- import { plugin as createMobxBundle } from './generators/create-mobx-bundle';
28
- import { plugin as createStargateClients } from './generators/create-stargate-clients';
29
- import { plugin as createCustomStargateClients } from './generators/create-custom-stargate-clients';
30
- import { plugin as createAllStargateClients } from './generators/create-all-stargate-clients';
31
- import { plugin as createSdkModuleStargateClients } from './generators/create-sdk-module-stargate-clients';
32
- import { plugin as createBundle } from './generators/create-bundle';
33
- import { plugin as createIndex } from './generators/create-index';
34
- import { plugin as createHelpers } from './generators/create-helpers';
35
-
36
- import { plugin as createPiniaStore } from './generators/create-pinia-store';
37
- import { plugin as createPiniaStoreBundle } from './generators/create-pinia-store-bundle';
38
- import { plugin as createRpcOpsBundle } from './generators/create-rpc-ops-bundle';
39
- import { plugin as customizeUtils } from './generators/customize-utils';
40
- import { plugin as createRootReadme } from './generators/create-root-readme';
41
- import { plugin as createMcpServer } from './generators/create-mcp-server';
42
-
43
- const sanitizeOptions = (options: TelescopeOptions): TelescopeOptions => {
44
- // If an element at the same key is present for both x and y, the value from y will appear in the result.
45
- options = deepmerge(defaultTelescopeOptions, options ?? {});
46
-
47
- // strip off leading slashes
48
- options.tsDisable.files = options.tsDisable.files.map((file) =>
49
- file.startsWith('/') ? file : file.replace(/^\//, '')
50
- );
51
- options.eslintDisable.files = options.eslintDisable.files.map((file) =>
52
- file.startsWith('/') ? file : file.replace(/^\//, '')
53
- );
54
- // uniq bc of deepmerge
55
- options.rpcClients.enabledServices = [
56
- ...new Set([...options.rpcClients.enabledServices]),
57
- ];
58
- return options;
59
- };
60
-
61
- export class TelescopeBuilder {
62
- store: ProtoStore;
63
- protoDirs: string[];
64
- outPath: string;
65
- options: TelescopeOptions;
66
- contexts: TelescopeParseContext[] = [];
67
- files: string[] = [];
68
-
69
- readonly converters: BundlerFile[] = [];
70
- readonly lcdClients: BundlerFile[] = [];
71
- readonly rpcQueryClients: BundlerFile[] = [];
72
- readonly rpcMsgClients: BundlerFile[] = [];
73
- readonly registries: BundlerFile[] = [];
74
- readonly stateManagers: Record<string, BundlerFile[]> = {};
75
-
76
- // Function mapping storage: package -> service -> method -> functionName
77
- readonly functionMappings: Record<string, Record<string, Record<string, {
78
- functionName: string;
79
- hookName: string;
80
- comment?: string;
81
- requestType: string;
82
- responseType: string;
83
- sourceFilename?: string;
84
- hookSourceFilename?: string;
85
- typeSourceFilename?: string;
86
- }>>> = {};
87
-
88
- constructor({
89
- protoDirs,
90
- outPath,
91
- store,
92
- options,
93
- }: TelescopeInput & { store?: ProtoStore }) {
94
- const fixedDirs = protoDirs.map((directory) => {
95
- return toPosixPath(directory);
96
- });
97
-
98
- this.protoDirs = fixedDirs;
99
- this.outPath = resolve(toPosixPath(outPath));
100
- this.options = sanitizeOptions(options);
101
- this.store = store ?? new ProtoStore(fixedDirs, this.options);
102
- this.store.traverseAll();
103
-
104
- }
105
-
106
- context(ref) {
107
- const ctx = new TelescopeParseContext(ref, this.store, this.options);
108
- this.contexts.push(ctx);
109
- return ctx;
110
- }
111
-
112
- addFunctionMapping(
113
- packageName: string,
114
- serviceName: string,
115
- methodName: string,
116
- functionName: string,
117
- hookName: string,
118
- comment?: string,
119
- requestType?: string,
120
- responseType?: string,
121
- sourceFilename?: string,
122
- hookSourceFilename?: string,
123
- typeSourceFilename?: string
124
- ) {
125
- if (!this.functionMappings[packageName]) {
126
- this.functionMappings[packageName] = {};
127
- }
128
- if (!this.functionMappings[packageName][serviceName]) {
129
- this.functionMappings[packageName][serviceName] = {};
130
- }
131
-
132
- this.functionMappings[packageName][serviceName][methodName] = {
133
- functionName,
134
- hookName,
135
- comment,
136
- requestType,
137
- responseType,
138
- sourceFilename,
139
- hookSourceFilename,
140
- typeSourceFilename
141
- };
142
- }
143
-
144
- getFunctionMappings() {
145
- return this.functionMappings;
146
- }
147
-
148
- addStateManagers(type: string, files: BundlerFile[]) {
149
- const state = this.stateManagers[type];
150
-
151
- if (!state) {
152
- this.stateManagers[type] = [];
153
- }
154
-
155
- [].push.apply(this.stateManagers[type], files);
156
- }
157
-
158
- addRPCQueryClients(files: BundlerFile[]) {
159
- [].push.apply(this.rpcQueryClients, files);
160
- }
161
-
162
- addRPCMsgClients(files: BundlerFile[]) {
163
- [].push.apply(this.rpcMsgClients, files);
164
- }
165
-
166
- addLCDClients(files: BundlerFile[]) {
167
- [].push.apply(this.lcdClients, files);
168
- }
169
-
170
- addRegistries(files: BundlerFile[]) {
171
- [].push.apply(this.registries, files);
172
- }
173
-
174
- addConverters(files: BundlerFile[]) {
175
- [].push.apply(this.converters, files);
176
- }
177
-
178
-
179
-
180
-
181
- async build() {
182
- // check warnings
183
- if (
184
- !this.options.aminoEncoding?.enabled &&
185
- (this.options.prototypes?.methods?.fromAmino ||
186
- this.options.prototypes?.methods?.toAmino)
187
- ) {
188
- console.warn(
189
- "There could be compilation errors in generated code, because 'aminoEncoding.enabled: false' means amino types wouldn't be created, but 'toAmino' or 'fromAmino' need amino types."
190
- );
191
- }
192
-
193
- if (!this.options.prototypes.methods.fromPartial) {
194
- console.warn(
195
- "The 'fromPartial' option will be deprecated in a future version. Encoder objects need fromPartial to be a creator function to create instance of the type. So it should always be left on, otherwise there could be compilation errors in generated code."
196
- );
197
- }
198
-
199
- customizeUtils(this);
200
-
201
- const allConverters = [];
202
- const allRegistries = [];
203
- // [x] get bundle of all packages
204
- const bundles = bundlePackages(this.store).map((bundle) => {
205
- // store bundleFile in filesToInclude
206
- const bundler = new Bundler(this, bundle);
207
-
208
-
209
- // [x] write out all TS files for package
210
- createTypes(this, bundler);
211
-
212
- // [x] write out one amino helper for all contexts w/mutations
213
- createAminoConverters(this, bundler);
214
-
215
- // [x] write out one registry helper for all contexts w/mutations
216
- createRegistries(this, bundler);
217
-
218
- // [x] write out one registry helper for all contexts w/mutations
219
- createLCDClients(this, bundler);
220
-
221
- createQueryFuncs(this, bundler);
222
- createRPCQueryClients(this, bundler);
223
- createMsgFuncs(this, bundler);
224
- createRPCMsgClients(this, bundler);
225
- createPiniaStore(this, bundler);
226
-
227
- if (this.options.rpcClients.clientStyle.useUpdatedClientStyle) {
228
- // generate sdk-module client file
229
- if (this.options.rpcClients.clientStyle.type.includes('sdk-module-client') && this.options.rpcClients.clientStyle.sdkModuleClientOption.includes(bundler.bundle.base)) {
230
- createSdkModuleStargateClients(this, bundler)
231
- }
232
-
233
- // store registry and converter for all/custom client generation
234
- if (bundler.registries) {
235
- allRegistries.push(...bundler.registries)
236
- }
237
- if (bundler.converters) {
238
- allConverters.push(...bundler.converters)
239
- }
240
- } else {
241
- // [x] write out one client for each base package, referencing the last two steps
242
- createStargateClients(this, bundler);
243
- }
244
- return bundler;
245
- });
246
-
247
- if (this.options.rpcClients.clientStyle.useUpdatedClientStyle) {
248
- // generate cutsom client file
249
- if (this.options.rpcClients.clientStyle.type.includes('custom-client') && this.options.rpcClients.clientStyle.customClientOption && this.options.rpcClients.clientStyle.customClientOption.length !== 0) {
250
- createCustomStargateClients(this, allRegistries, allConverters)
251
- }
252
- // generate all module client file
253
- if (this.options.rpcClients.clientStyle.type.includes('all-client')) {
254
- createAllStargateClients(this, allRegistries, allConverters)
255
- }
256
- }
257
-
258
- // post run plugins
259
- bundles.forEach((bundler) => {
260
- createLCDClientsAll(this, bundler);
261
- createLCDClientsScoped(this, bundler);
262
- createRPCQueryClientsAll(this, bundler);
263
- createRPCQueryClientsScoped(this, bundler);
264
- createRPCMsgClientsAll(this, bundler);
265
- createRPCMsgClientsScoped(this, bundler);
266
- createBundle(this, bundler);
267
- });
268
-
269
- createRpcOpsBundle(this);
270
- createReactQueryBundle(this);
271
- createMobxBundle(this);
272
- createAggregatedLCDClient(this);
273
-
274
- createHelpers(this);
275
- createPiniaStoreBundle(this);
276
-
277
- // finally, write one index file with all files, exported
278
- createIndex(this);
279
- createRootReadme(this);
280
-
281
- // Generate MCP server at the very end after all files are written
282
- if (this.options.mcpServer?.enabled && bundles.length > 0) {
283
- // Use the first bundle that has contexts (typically the main aggregated bundle)
284
- const primaryBundle = bundles.find(bundler => bundler.contexts.length > 0);
285
- if (primaryBundle) {
286
- createMcpServer(this, primaryBundle);
287
- }
288
- }
289
-
290
- console.log(`✨ files transpiled in '${this.outPath}'`);
291
- }
292
- }