@hyperweb/telescope 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (382) hide show
  1. package/README.md +1529 -0
  2. package/main/build.js +183 -0
  3. package/main/builder.js +229 -0
  4. package/main/bundle.js +162 -0
  5. package/main/bundler.js +100 -0
  6. package/main/cli.js +71 -0
  7. package/main/cmds.js +28 -0
  8. package/main/commands/download.js +122 -0
  9. package/main/commands/generate.js +151 -0
  10. package/main/commands/install.js +143 -0
  11. package/main/commands/transpile.js +197 -0
  12. package/main/contracts/generate.js +31 -0
  13. package/main/contracts/install.js +107 -0
  14. package/main/contracts/message-composer.js +31 -0
  15. package/main/contracts/react-query.js +31 -0
  16. package/main/contracts/recoil.js +31 -0
  17. package/main/file.js +20 -0
  18. package/main/generators/create-aggregated-lcd-client.js +87 -0
  19. package/main/generators/create-all-stargate-clients.js +96 -0
  20. package/main/generators/create-amino-converters.js +43 -0
  21. package/main/generators/create-bundle.js +83 -0
  22. package/main/generators/create-cosmwasm-bundle.js +15 -0
  23. package/main/generators/create-custom-stargate-clients.js +100 -0
  24. package/main/generators/create-helpers.js +119 -0
  25. package/main/generators/create-index.js +75 -0
  26. package/main/generators/create-lcd-client-all.js +116 -0
  27. package/main/generators/create-lcd-client-scoped.js +89 -0
  28. package/main/generators/create-lcd-clients.js +78 -0
  29. package/main/generators/create-mcp-server.js +1853 -0
  30. package/main/generators/create-mobx-bundle.js +52 -0
  31. package/main/generators/create-msg-funcs.js +132 -0
  32. package/main/generators/create-pinia-store-bundle.js +50 -0
  33. package/main/generators/create-pinia-store.js +90 -0
  34. package/main/generators/create-query-funcs.js +133 -0
  35. package/main/generators/create-react-query-bundle.js +103 -0
  36. package/main/generators/create-registries.js +49 -0
  37. package/main/generators/create-root-readme.js +259 -0
  38. package/main/generators/create-rpc-msg-client-all.js +135 -0
  39. package/main/generators/create-rpc-msg-client-scoped.js +114 -0
  40. package/main/generators/create-rpc-msg-clients.js +116 -0
  41. package/main/generators/create-rpc-ops-bundle.js +119 -0
  42. package/main/generators/create-rpc-query-client-all.js +137 -0
  43. package/main/generators/create-rpc-query-client-scoped.js +110 -0
  44. package/main/generators/create-rpc-query-clients.js +198 -0
  45. package/main/generators/create-sdk-module-stargate-clients.js +95 -0
  46. package/main/generators/create-stargate-clients.js +96 -0
  47. package/main/generators/create-types.js +164 -0
  48. package/main/generators/customize-utils.js +50 -0
  49. package/main/helpers/__test__/internalTimestamp.js +49 -0
  50. package/main/helpers/__test__/internalTimestampBigint.js +45 -0
  51. package/main/helpers/binary-coder.js +535 -0
  52. package/main/helpers/decimals.js +111 -0
  53. package/main/helpers/external-comet.js +52 -0
  54. package/main/helpers/external-icjs.js +36 -0
  55. package/main/helpers/external.js +31 -0
  56. package/main/helpers/grpc-gateway.js +348 -0
  57. package/main/helpers/grpc-web.js +14 -0
  58. package/main/helpers/helper-func-types-interface.js +106 -0
  59. package/main/helpers/helper-func-types.js +93 -0
  60. package/main/helpers/index.js +38 -0
  61. package/main/helpers/internal-for-bigint.js +259 -0
  62. package/main/helpers/internal.js +240 -0
  63. package/main/helpers/json-safe.js +12 -0
  64. package/main/helpers/mobx.js +80 -0
  65. package/main/helpers/pinia-endpoint.js +20 -0
  66. package/main/helpers/react-query-hooks-icjs.js +223 -0
  67. package/main/helpers/react-query-hooks.js +258 -0
  68. package/main/helpers/react-query.js +93 -0
  69. package/main/helpers/registry-helper.js +229 -0
  70. package/main/helpers/types-helper.js +165 -0
  71. package/main/helpers/utf8-helper.js +146 -0
  72. package/main/helpers/varint.js +486 -0
  73. package/main/helpers/vue-query-hooks.js +226 -0
  74. package/main/imports.js +416 -0
  75. package/main/index.js +24 -0
  76. package/main/parse.js +194 -0
  77. package/main/prompt.js +64 -0
  78. package/main/protod/bufbuild.js +87 -0
  79. package/main/protod/config.js +30 -0
  80. package/main/protod/git-repo.js +58 -0
  81. package/main/protod/index.js +17 -0
  82. package/main/protod/recursive.js +134 -0
  83. package/main/protod/types.js +2 -0
  84. package/main/protod/utils.js +91 -0
  85. package/main/telescope.js +10 -0
  86. package/main/types.js +2 -0
  87. package/main/utils/common-create-bundle.js +29 -0
  88. package/main/utils/contracts.js +39 -0
  89. package/main/utils/files.js +138 -0
  90. package/main/utils/index.js +163 -0
  91. package/main/utils/unused.js +73 -0
  92. package/module/build.js +176 -0
  93. package/module/builder.js +222 -0
  94. package/module/bundle.js +128 -0
  95. package/module/bundler.js +96 -0
  96. package/module/cli.js +44 -0
  97. package/module/cmds.js +22 -0
  98. package/module/commands/download.js +94 -0
  99. package/module/commands/generate.js +123 -0
  100. package/module/commands/install.js +141 -0
  101. package/module/commands/transpile.js +169 -0
  102. package/module/contracts/generate.js +29 -0
  103. package/module/contracts/install.js +105 -0
  104. package/module/contracts/message-composer.js +29 -0
  105. package/module/contracts/react-query.js +29 -0
  106. package/module/contracts/recoil.js +29 -0
  107. package/module/file.js +18 -0
  108. package/module/generators/create-aggregated-lcd-client.js +83 -0
  109. package/module/generators/create-all-stargate-clients.js +92 -0
  110. package/module/generators/create-amino-converters.js +39 -0
  111. package/module/generators/create-bundle.js +79 -0
  112. package/module/generators/create-cosmwasm-bundle.js +11 -0
  113. package/module/generators/create-custom-stargate-clients.js +96 -0
  114. package/module/generators/create-helpers.js +112 -0
  115. package/module/generators/create-index.js +45 -0
  116. package/module/generators/create-lcd-client-all.js +89 -0
  117. package/module/generators/create-lcd-client-scoped.js +62 -0
  118. package/module/generators/create-lcd-clients.js +74 -0
  119. package/module/generators/create-mcp-server.js +1849 -0
  120. package/module/generators/create-mobx-bundle.js +25 -0
  121. package/module/generators/create-msg-funcs.js +128 -0
  122. package/module/generators/create-pinia-store-bundle.js +23 -0
  123. package/module/generators/create-pinia-store.js +86 -0
  124. package/module/generators/create-query-funcs.js +129 -0
  125. package/module/generators/create-react-query-bundle.js +76 -0
  126. package/module/generators/create-registries.js +45 -0
  127. package/module/generators/create-root-readme.js +255 -0
  128. package/module/generators/create-rpc-msg-client-all.js +108 -0
  129. package/module/generators/create-rpc-msg-client-scoped.js +87 -0
  130. package/module/generators/create-rpc-msg-clients.js +112 -0
  131. package/module/generators/create-rpc-ops-bundle.js +92 -0
  132. package/module/generators/create-rpc-query-client-all.js +110 -0
  133. package/module/generators/create-rpc-query-client-scoped.js +83 -0
  134. package/module/generators/create-rpc-query-clients.js +198 -0
  135. package/module/generators/create-sdk-module-stargate-clients.js +91 -0
  136. package/module/generators/create-stargate-clients.js +92 -0
  137. package/module/generators/create-types.js +137 -0
  138. package/module/generators/customize-utils.js +46 -0
  139. package/module/helpers/__test__/internalTimestamp.js +39 -0
  140. package/module/helpers/__test__/internalTimestampBigint.js +38 -0
  141. package/module/helpers/binary-coder.js +531 -0
  142. package/module/helpers/decimals.js +108 -0
  143. package/module/helpers/external-comet.js +49 -0
  144. package/module/helpers/external-icjs.js +33 -0
  145. package/module/helpers/external.js +28 -0
  146. package/module/helpers/grpc-gateway.js +345 -0
  147. package/module/helpers/grpc-web.js +11 -0
  148. package/module/helpers/helper-func-types-interface.js +102 -0
  149. package/module/helpers/helper-func-types.js +89 -0
  150. package/module/helpers/index.js +22 -0
  151. package/module/helpers/internal-for-bigint.js +255 -0
  152. package/module/helpers/internal.js +236 -0
  153. package/module/helpers/json-safe.js +9 -0
  154. package/module/helpers/mobx.js +77 -0
  155. package/module/helpers/pinia-endpoint.js +17 -0
  156. package/module/helpers/react-query-hooks-icjs.js +219 -0
  157. package/module/helpers/react-query-hooks.js +254 -0
  158. package/module/helpers/react-query.js +89 -0
  159. package/module/helpers/registry-helper.js +225 -0
  160. package/module/helpers/types-helper.js +161 -0
  161. package/module/helpers/utf8-helper.js +143 -0
  162. package/module/helpers/varint.js +483 -0
  163. package/module/helpers/vue-query-hooks.js +222 -0
  164. package/module/imports.js +382 -0
  165. package/module/index.js +8 -0
  166. package/module/parse.js +185 -0
  167. package/module/prompt.js +58 -0
  168. package/module/protod/bufbuild.js +76 -0
  169. package/module/protod/config.js +27 -0
  170. package/module/protod/git-repo.js +54 -0
  171. package/module/protod/index.js +1 -0
  172. package/module/protod/recursive.js +125 -0
  173. package/module/protod/types.js +1 -0
  174. package/module/protod/utils.js +77 -0
  175. package/module/telescope.js +8 -0
  176. package/module/types.js +1 -0
  177. package/module/utils/common-create-bundle.js +25 -0
  178. package/module/utils/contracts.js +33 -0
  179. package/module/utils/files.js +106 -0
  180. package/module/utils/index.js +143 -0
  181. package/module/utils/unused.js +47 -0
  182. package/package.json +115 -0
  183. package/src/build.ts +255 -0
  184. package/src/builder.ts +302 -0
  185. package/src/bundle.ts +160 -0
  186. package/src/bundler.ts +153 -0
  187. package/src/cli.js +51 -0
  188. package/src/cmds.js +25 -0
  189. package/src/commands/download.ts +120 -0
  190. package/src/commands/generate.ts +156 -0
  191. package/src/commands/install.ts +154 -0
  192. package/src/commands/transpile.ts +198 -0
  193. package/src/contracts/generate.ts +33 -0
  194. package/src/contracts/install.ts +118 -0
  195. package/src/contracts/message-composer.ts +34 -0
  196. package/src/contracts/react-query.ts +33 -0
  197. package/src/contracts/recoil.ts +32 -0
  198. package/src/file.js +20 -0
  199. package/src/generators/create-aggregated-lcd-client.ts +133 -0
  200. package/src/generators/create-all-stargate-clients.ts +121 -0
  201. package/src/generators/create-amino-converters.ts +62 -0
  202. package/src/generators/create-bundle.ts +97 -0
  203. package/src/generators/create-cosmwasm-bundle.ts +17 -0
  204. package/src/generators/create-custom-stargate-clients.ts +128 -0
  205. package/src/generators/create-helpers.ts +196 -0
  206. package/src/generators/create-index.ts +72 -0
  207. package/src/generators/create-lcd-client-all.ts +139 -0
  208. package/src/generators/create-lcd-client-scoped.ts +109 -0
  209. package/src/generators/create-lcd-clients.ts +108 -0
  210. package/src/generators/create-mcp-server.ts +1902 -0
  211. package/src/generators/create-mobx-bundle.ts +31 -0
  212. package/src/generators/create-msg-funcs.ts +219 -0
  213. package/src/generators/create-pinia-store-bundle.ts +35 -0
  214. package/src/generators/create-pinia-store.ts +121 -0
  215. package/src/generators/create-query-funcs.ts +224 -0
  216. package/src/generators/create-react-query-bundle.ts +111 -0
  217. package/src/generators/create-registries.ts +70 -0
  218. package/src/generators/create-root-readme.ts +316 -0
  219. package/src/generators/create-rpc-msg-client-all.ts +167 -0
  220. package/src/generators/create-rpc-msg-client-scoped.ts +147 -0
  221. package/src/generators/create-rpc-msg-clients.ts +165 -0
  222. package/src/generators/create-rpc-ops-bundle.ts +155 -0
  223. package/src/generators/create-rpc-query-client-all.ts +173 -0
  224. package/src/generators/create-rpc-query-client-scoped.ts +142 -0
  225. package/src/generators/create-rpc-query-clients.ts +304 -0
  226. package/src/generators/create-sdk-module-stargate-clients.ts +120 -0
  227. package/src/generators/create-stargate-clients.ts +123 -0
  228. package/src/generators/create-types.ts +236 -0
  229. package/src/generators/customize-utils.ts +54 -0
  230. package/src/helpers/__test__/internalTimestamp.test.ts +79 -0
  231. package/src/helpers/__test__/internalTimestamp.ts +58 -0
  232. package/src/helpers/__test__/internalTimestampBigint.test.ts +78 -0
  233. package/src/helpers/__test__/internalTimestampBigint.ts +58 -0
  234. package/src/helpers/binary-coder.ts +533 -0
  235. package/src/helpers/decimals.ts +108 -0
  236. package/src/helpers/external-comet.ts +49 -0
  237. package/src/helpers/external-icjs.ts +33 -0
  238. package/src/helpers/external.ts +28 -0
  239. package/src/helpers/grpc-gateway.ts +345 -0
  240. package/src/helpers/grpc-web.ts +11 -0
  241. package/src/helpers/helper-func-types-interface.ts +104 -0
  242. package/src/helpers/helper-func-types.ts +91 -0
  243. package/src/helpers/index.ts +22 -0
  244. package/src/helpers/internal-for-bigint.ts +257 -0
  245. package/src/helpers/internal.ts +238 -0
  246. package/src/helpers/json-safe.ts +11 -0
  247. package/src/helpers/mobx.ts +77 -0
  248. package/src/helpers/pinia-endpoint.ts +17 -0
  249. package/src/helpers/react-query-hooks-icjs.ts +223 -0
  250. package/src/helpers/react-query-hooks.ts +266 -0
  251. package/src/helpers/react-query.ts +101 -0
  252. package/src/helpers/registry-helper.ts +227 -0
  253. package/src/helpers/types-helper.ts +169 -0
  254. package/src/helpers/utf8-helper.ts +143 -0
  255. package/src/helpers/varint.ts +483 -0
  256. package/src/helpers/vue-query-hooks.ts +224 -0
  257. package/src/imports.ts +499 -0
  258. package/src/index.ts +12 -0
  259. package/src/parse.ts +243 -0
  260. package/src/prompt.js +65 -0
  261. package/src/protod/bufbuild.spec.ts +80 -0
  262. package/src/protod/bufbuild.ts +95 -0
  263. package/src/protod/config.ts +30 -0
  264. package/src/protod/git-repo.ts +74 -0
  265. package/src/protod/index.ts +1 -0
  266. package/src/protod/recursive.spec.ts +164 -0
  267. package/src/protod/recursive.ts +180 -0
  268. package/src/protod/test-data/.protod.config.json +42 -0
  269. package/src/protod/test-data/buf.lock +23 -0
  270. package/src/protod/test-data/buf.yaml +25 -0
  271. package/src/protod/test-data/buf2.yaml +20 -0
  272. package/src/protod/test-data/cosmos/buf.lock +23 -0
  273. package/src/protod/test-data/cosmos/crypto/secp256k1/keys.proto +38 -0
  274. package/src/protod/test-data/model.proto +101 -0
  275. package/src/protod/types.ts +55 -0
  276. package/src/protod/utils.spec.ts +68 -0
  277. package/src/protod/utils.ts +90 -0
  278. package/src/telescope.js +9 -0
  279. package/src/types.ts +46 -0
  280. package/src/utils/common-create-bundle.ts +62 -0
  281. package/src/utils/contracts.ts +37 -0
  282. package/src/utils/files.ts +145 -0
  283. package/src/utils/index.ts +150 -0
  284. package/src/utils/unused.ts +52 -0
  285. package/types/build.d.ts +41 -0
  286. package/types/builder.d.ts +50 -0
  287. package/types/bundle.d.ts +30 -0
  288. package/types/bundler.d.ts +31 -0
  289. package/types/cli.d.ts +1 -0
  290. package/types/cmds.d.ts +11 -0
  291. package/types/commands/download.d.ts +5 -0
  292. package/types/commands/generate.d.ts +2 -0
  293. package/types/commands/install.d.ts +2 -0
  294. package/types/commands/transpile.d.ts +4 -0
  295. package/types/contracts/generate.d.ts +2 -0
  296. package/types/contracts/install.d.ts +2 -0
  297. package/types/contracts/message-composer.d.ts +2 -0
  298. package/types/contracts/react-query.d.ts +2 -0
  299. package/types/contracts/recoil.d.ts +2 -0
  300. package/types/file.d.ts +2 -0
  301. package/types/generators/create-aggregated-lcd-client.d.ts +2 -0
  302. package/types/generators/create-all-stargate-clients.d.ts +3 -0
  303. package/types/generators/create-amino-converters.d.ts +3 -0
  304. package/types/generators/create-bundle.d.ts +3 -0
  305. package/types/generators/create-combined-stargate-clients.d.ts +3 -0
  306. package/types/generators/create-cosmwasm-bundle.d.ts +2 -0
  307. package/types/generators/create-custom-stargate-clients.d.ts +3 -0
  308. package/types/generators/create-helpers.d.ts +2 -0
  309. package/types/generators/create-index.d.ts +2 -0
  310. package/types/generators/create-lcd-client-all.d.ts +3 -0
  311. package/types/generators/create-lcd-client-scoped.d.ts +3 -0
  312. package/types/generators/create-lcd-clients.d.ts +3 -0
  313. package/types/generators/create-mcp-server.d.ts +3 -0
  314. package/types/generators/create-mobx-bundle.d.ts +2 -0
  315. package/types/generators/create-msg-funcs.d.ts +3 -0
  316. package/types/generators/create-pinia-store-bundle.d.ts +2 -0
  317. package/types/generators/create-pinia-store.d.ts +3 -0
  318. package/types/generators/create-query-funcs.d.ts +3 -0
  319. package/types/generators/create-react-query-bundle.d.ts +2 -0
  320. package/types/generators/create-registries.d.ts +3 -0
  321. package/types/generators/create-root-readme.d.ts +2 -0
  322. package/types/generators/create-rpc-msg-client-all.d.ts +3 -0
  323. package/types/generators/create-rpc-msg-client-scoped.d.ts +3 -0
  324. package/types/generators/create-rpc-msg-clients.d.ts +3 -0
  325. package/types/generators/create-rpc-ops-bundle.d.ts +2 -0
  326. package/types/generators/create-rpc-query-client-all.d.ts +3 -0
  327. package/types/generators/create-rpc-query-client-scoped.d.ts +3 -0
  328. package/types/generators/create-rpc-query-clients.d.ts +3 -0
  329. package/types/generators/create-scoped-stargate-clients.d.ts +3 -0
  330. package/types/generators/create-sdk-module-stargate-clients.d.ts +3 -0
  331. package/types/generators/create-stargate-clients.d.ts +3 -0
  332. package/types/generators/create-types.d.ts +3 -0
  333. package/types/generators/create-unified-stargate-clients.d.ts +3 -0
  334. package/types/generators/customize-utils.d.ts +2 -0
  335. package/types/helpers/__test__/internalTimestamp.d.ts +21 -0
  336. package/types/helpers/__test__/internalTimestampBigint.d.ts +20 -0
  337. package/types/helpers/binary-coder.d.ts +2 -0
  338. package/types/helpers/decimals.d.ts +1 -0
  339. package/types/helpers/external-comet.d.ts +1 -0
  340. package/types/helpers/external-icjs.d.ts +1 -0
  341. package/types/helpers/external.d.ts +1 -0
  342. package/types/helpers/generated-type.d.ts +1 -0
  343. package/types/helpers/grpc-gateway.d.ts +1 -0
  344. package/types/helpers/grpc-web.d.ts +1 -0
  345. package/types/helpers/helper-func-types-interface.d.ts +2 -0
  346. package/types/helpers/helper-func-types.d.ts +2 -0
  347. package/types/helpers/index.d.ts +22 -0
  348. package/types/helpers/internal-for-bigint.d.ts +2 -0
  349. package/types/helpers/internal.d.ts +2 -0
  350. package/types/helpers/internalForBigInt.d.ts +1 -0
  351. package/types/helpers/json-safe.d.ts +1 -0
  352. package/types/helpers/mobx.d.ts +1 -0
  353. package/types/helpers/pinia-endpoint.d.ts +1 -0
  354. package/types/helpers/react-query-hooks-icjs.d.ts +2 -0
  355. package/types/helpers/react-query-hooks.d.ts +2 -0
  356. package/types/helpers/react-query.d.ts +2 -0
  357. package/types/helpers/registry-helper.d.ts +2 -0
  358. package/types/helpers/types-helper.d.ts +2 -0
  359. package/types/helpers/types.d.ts +1 -0
  360. package/types/helpers/utf8-helper.d.ts +1 -0
  361. package/types/helpers/varint.d.ts +1 -0
  362. package/types/helpers/vue-query-hooks.d.ts +2 -0
  363. package/types/helpers/vue-query.d.ts +2 -0
  364. package/types/imports.d.ts +17 -0
  365. package/types/index.d.ts +6 -0
  366. package/types/parse.d.ts +15 -0
  367. package/types/prompt.d.ts +3 -0
  368. package/types/protod/bufbuild.d.ts +6 -0
  369. package/types/protod/config.d.ts +7 -0
  370. package/types/protod/git-repo.d.ts +11 -0
  371. package/types/protod/index.d.ts +1 -0
  372. package/types/protod/proto-download.d.ts +2 -0
  373. package/types/protod/recursive.d.ts +4 -0
  374. package/types/protod/types.d.ts +49 -0
  375. package/types/protod/utils.d.ts +11 -0
  376. package/types/telescope.d.ts +2 -0
  377. package/types/types.d.ts +43 -0
  378. package/types/utils/common-create-bundle.d.ts +18 -0
  379. package/types/utils/contracts.d.ts +6 -0
  380. package/types/utils/files.d.ts +5 -0
  381. package/types/utils/index.d.ts +16 -0
  382. package/types/utils/unused.d.ts +5 -0
@@ -0,0 +1,259 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getHelperForBigint = void 0;
4
+ const getHelperForBigint = (options) => {
5
+ return `
6
+ declare var self: any | undefined;
7
+ declare var window: any | undefined;
8
+ declare var global: any | undefined;
9
+ var globalThis: any = (() => {
10
+ if (typeof globalThis !== 'undefined') return globalThis;
11
+ if (typeof self !== 'undefined') return self;
12
+ if (typeof window !== 'undefined') return window;
13
+ if (typeof global !== 'undefined') return global;
14
+ throw 'Unable to locate global object';
15
+ })();
16
+
17
+ const atob: (b64: string) => string =
18
+ globalThis.atob ||
19
+ ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary'));
20
+
21
+ export function bytesFromBase64(b64: string): Uint8Array {
22
+ const bin = atob(b64);
23
+ const arr = new Uint8Array(bin.length);
24
+ for (let i = 0; i < bin.length; ++i) {
25
+ arr[i] = bin.charCodeAt(i);
26
+ }
27
+ return arr;
28
+ }
29
+
30
+ const btoa: (bin: string) => string =
31
+ globalThis.btoa ||
32
+ ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64'));
33
+
34
+ export function base64FromBytes(arr: Uint8Array): string {
35
+ const bin: string[] = [];
36
+ arr.forEach((byte) => {
37
+ bin.push(String.fromCharCode(byte));
38
+ });
39
+ return btoa(bin.join(''));
40
+ }
41
+
42
+ export interface AminoHeight {
43
+ readonly revision_number?: string;
44
+ readonly revision_height?: string;
45
+ }
46
+
47
+ export function omitDefault<T extends string | number | bigint | boolean>(
48
+ input: T
49
+ ): T | undefined {
50
+ if (typeof input === 'string') {
51
+ return input === '' ? undefined : input;
52
+ }
53
+
54
+ if (typeof input === 'number') {
55
+ return input === 0 ? undefined : input;
56
+ }
57
+
58
+ if (typeof input === "boolean"){
59
+ return input === false ? undefined : input;
60
+ }
61
+
62
+ if (typeof input === 'bigint') {
63
+ return input === BigInt(0) ? undefined : input;
64
+ }
65
+
66
+ throw new Error(\`Got unsupported type \${typeof input}\`);
67
+ }
68
+
69
+ interface Duration {
70
+ /**
71
+ * Signed seconds of the span of time. Must be from -315,576,000,000
72
+ * to +315,576,000,000 inclusive. Note: these bounds are computed from:
73
+ * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
74
+ */
75
+ seconds: bigint;
76
+ /**
77
+ * Signed fractions of a second at nanosecond resolution of the span
78
+ * of time. Durations less than one second are represented with a 0
79
+ * \`seconds\` field and a positive or negative \`nanos\` field. For durations
80
+ * of one second or more, a non-zero value for the \`nanos\` field must be
81
+ * of the same sign as the \`seconds\` field. Must be from -999,999,999
82
+ * to +999,999,999 inclusive.
83
+ */
84
+
85
+ nanos: number;
86
+ }
87
+
88
+ export function toDuration(duration: string): Duration {
89
+ return {
90
+ seconds: BigInt(Math.floor(parseInt(duration) / 1000000000)),
91
+ nanos: parseInt(duration) % 1000000000
92
+ };
93
+ }
94
+
95
+ export function fromDuration(duration: Duration): string {
96
+ return (
97
+ parseInt(duration.seconds.toString()) * 1000000000 +
98
+ duration.nanos
99
+ ).toString();
100
+ }
101
+
102
+ export function isSet(value: any): boolean {
103
+ return value !== null && value !== undefined;
104
+ }
105
+
106
+ export function isObject(value: any): boolean {
107
+ return typeof value === 'object' && value !== null;
108
+ }
109
+
110
+ export interface PageRequest {
111
+ key: Uint8Array;
112
+ offset: bigint;
113
+ limit: bigint;
114
+ countTotal: boolean;
115
+ reverse: boolean;
116
+ }
117
+
118
+ export interface PageRequestParams {
119
+ 'pagination.key'?: string;
120
+ 'pagination.offset'?: string;
121
+ 'pagination.limit'?: string;
122
+ 'pagination.count_total'?: boolean;
123
+ 'pagination.reverse'?: boolean;
124
+ }
125
+
126
+ export interface Params {
127
+ params: PageRequestParams;
128
+ }
129
+
130
+ export const setPaginationParams = (
131
+ options: Params,
132
+ pagination?: PageRequest
133
+ ) => {
134
+ if (!pagination) {
135
+ return options;
136
+ }
137
+
138
+ if (typeof pagination?.countTotal !== 'undefined') {
139
+ options.params['pagination.count_total'] = pagination.countTotal;
140
+ }
141
+ if (typeof pagination?.key !== 'undefined') {
142
+ // String to Uint8Array
143
+ // let uint8arr = new Uint8Array(Buffer.from(data,'base64'));
144
+
145
+ // Uint8Array to String
146
+ options.params['pagination.key'] = Buffer.from(pagination.key).toString(
147
+ 'base64'
148
+ );
149
+ }
150
+ if (typeof pagination?.limit !== 'undefined') {
151
+ options.params['pagination.limit'] = pagination.limit.toString();
152
+ }
153
+ if (typeof pagination?.offset !== 'undefined') {
154
+ options.params['pagination.offset'] = pagination.offset.toString();
155
+ }
156
+ if (typeof pagination?.reverse !== 'undefined') {
157
+ options.params['pagination.reverse'] = pagination.reverse;
158
+ }
159
+
160
+ return options;
161
+ };
162
+
163
+ type Builtin =
164
+ | Date
165
+ | Function
166
+ | Uint8Array
167
+ | string
168
+ | number
169
+ | bigint
170
+ | boolean
171
+ | undefined;
172
+
173
+ export type DeepPartial<T> = T extends Builtin
174
+ ? T
175
+ : T extends Array<infer U>
176
+ ? Array<DeepPartial<U>>
177
+ : T extends ReadonlyArray<infer U>
178
+ ? ReadonlyArray<DeepPartial<U>>
179
+ : T extends {}
180
+ ? { [K in keyof T]?: DeepPartial<T[K]> }
181
+ : Partial<T>;
182
+
183
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
184
+ export type Exact<P, I extends P> = P extends Builtin
185
+ ? P
186
+ : P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<
187
+ Exclude<keyof I, KeysOfUnion<P>>,
188
+ never
189
+ >;
190
+
191
+ export interface Rpc {
192
+ request(
193
+ service: string,
194
+ method: string,
195
+ data: Uint8Array
196
+ ): Promise<Uint8Array>;
197
+ }
198
+
199
+ export function isRpc(rpc: unknown): rpc is Rpc {
200
+ return rpc !== null && rpc !== undefined && typeof (rpc as Rpc).request === 'function';
201
+ }
202
+
203
+ interface Timestamp {
204
+ /**
205
+ * Represents seconds of UTC time since Unix epoch
206
+ * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
207
+ * 9999-12-31T23:59:59Z inclusive.
208
+ */
209
+ seconds: bigint;
210
+ /**
211
+ * Non-negative fractions of a second at nanosecond resolution. Negative
212
+ * second values with fractions must still have non-negative nanos values
213
+ * that count forward in time. Must be from 0 to 999,999,999
214
+ * inclusive.
215
+ */
216
+
217
+ nanos: number;
218
+ }
219
+
220
+ export function toTimestamp(date: Date): Timestamp {
221
+ const seconds = numberToLong(date.getTime() / 1_000);
222
+ const nanos = (date.getTime() % 1000) * 1000000;
223
+ return {
224
+ seconds,
225
+ nanos
226
+ };
227
+ }
228
+
229
+ export function fromTimestamp(t: Timestamp): Date {
230
+ let millis = Number(t.seconds) * 1000;
231
+ millis += t.nanos / 1000000;
232
+ return new Date(millis);
233
+ }
234
+
235
+ const timestampFromJSON = (object: any): Timestamp => {
236
+ return {
237
+ seconds: isSet(object.seconds)
238
+ ? BigInt(object.seconds.toString())
239
+ : BigInt(0),
240
+ nanos: isSet(object.nanos) ? Number(object.nanos) : 0
241
+ };
242
+ };
243
+
244
+ export function fromJsonTimestamp(o: any): Timestamp {
245
+ if (o instanceof Date) {
246
+ return toTimestamp(o);
247
+ } else if (typeof o === 'string') {
248
+ return toTimestamp(new Date(o));
249
+ } else {
250
+ return timestampFromJSON(o);
251
+ }
252
+ }
253
+
254
+ function numberToLong(number: number) {
255
+ return BigInt(Math.trunc(number));
256
+ }
257
+ `;
258
+ };
259
+ exports.getHelperForBigint = getHelperForBigint;
@@ -0,0 +1,240 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getHelper = void 0;
4
+ const getHelper = (options) => {
5
+ return `import * as _m0 from "protobufjs/minimal";
6
+ import Long from 'long';
7
+
8
+ // @ts-ignore
9
+ if (_m0.util.Long !== Long) {
10
+ _m0.util.Long = (Long as any);
11
+
12
+ _m0.configure();
13
+ }
14
+
15
+ export { Long };
16
+
17
+ declare var self: any | undefined;
18
+ declare var window: any | undefined;
19
+ declare var global: any | undefined;
20
+ var globalThis: any = (() => {
21
+ if (typeof globalThis !== 'undefined') return globalThis;
22
+ if (typeof self !== 'undefined') return self;
23
+ if (typeof window !== 'undefined') return window;
24
+ if (typeof global !== 'undefined') return global;
25
+ throw 'Unable to locate global object';
26
+ })();
27
+
28
+ const atob: (b64: string) => string =
29
+ globalThis.atob || ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary'));
30
+
31
+ export function bytesFromBase64(b64: string): Uint8Array {
32
+ const bin = atob(b64);
33
+ const arr = new Uint8Array(bin.length);
34
+ for (let i = 0; i < bin.length; ++i) {
35
+ arr[i] = bin.charCodeAt(i);
36
+ }
37
+ return arr;
38
+ }
39
+
40
+ const btoa: (bin: string) => string =
41
+ globalThis.btoa || ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64'));
42
+
43
+ export function base64FromBytes(arr: Uint8Array): string {
44
+ const bin: string[] = [];
45
+ arr.forEach((byte) => {
46
+ bin.push(String.fromCharCode(byte));
47
+ });
48
+ return btoa(bin.join(''));
49
+ }
50
+
51
+ export interface AminoHeight {
52
+ readonly revision_number?: string;
53
+ readonly revision_height?: string;
54
+ };
55
+
56
+ export function omitDefault<T extends string | number | Long | boolean>(input: T): T | undefined {
57
+ if (typeof input === "string") {
58
+ return input === "" ? undefined : input;
59
+ }
60
+
61
+ if (typeof input === "number") {
62
+ return input === 0 ? undefined : input;
63
+ }
64
+
65
+ if (typeof input === "boolean"){
66
+ return input === false ? undefined : input;
67
+ }
68
+
69
+ if (Long.isLong(input)) {
70
+ return (input as Long).isZero() ? undefined : input;
71
+ }
72
+
73
+ throw new Error(\`Got unsupported type \${typeof input}\`);
74
+ };
75
+
76
+ interface Duration {
77
+ /**
78
+ * Signed seconds of the span of time. Must be from -315,576,000,000
79
+ * to +315,576,000,000 inclusive. Note: these bounds are computed from:
80
+ * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
81
+ */
82
+ seconds: Long;
83
+ /**
84
+ * Signed fractions of a second at nanosecond resolution of the span
85
+ * of time. Durations less than one second are represented with a 0
86
+ * \`seconds\` field and a positive or negative \`nanos\` field. For durations
87
+ * of one second or more, a non-zero value for the \`nanos\` field must be
88
+ * of the same sign as the \`seconds\` field. Must be from -999,999,999
89
+ * to +999,999,999 inclusive.
90
+ */
91
+
92
+ nanos: number;
93
+ }
94
+
95
+ export function toDuration(duration: string): Duration {
96
+ return {
97
+ seconds: Long.fromNumber(Math.floor(parseInt(duration) / 1000000000)),
98
+ nanos: parseInt(duration) % 1000000000
99
+ };
100
+ };
101
+
102
+ export function fromDuration(duration: Duration): string {
103
+ return (parseInt(duration.seconds.toString()) * 1000000000 + duration.nanos).toString();
104
+ };
105
+
106
+ export function isSet(value: any): boolean {
107
+ return value !== null && value !== undefined;
108
+ };
109
+
110
+ export function isObject(value: any): boolean {
111
+ return typeof value === 'object' && value !== null;
112
+ };
113
+
114
+ export interface PageRequest {
115
+ key: Uint8Array;
116
+ offset: Long;
117
+ limit: Long;
118
+ countTotal: boolean;
119
+ reverse: boolean;
120
+ };
121
+
122
+ export interface PageRequestParams {
123
+ "pagination.key"?: string;
124
+ "pagination.offset"?: string;
125
+ "pagination.limit"?: string;
126
+ "pagination.count_total"?: boolean;
127
+ "pagination.reverse"?: boolean;
128
+ };
129
+
130
+ export interface Params {
131
+ params: PageRequestParams;
132
+ };
133
+
134
+ export const setPaginationParams = (options: Params, pagination?: PageRequest) => {
135
+
136
+ if (!pagination) {
137
+ return options;
138
+ }
139
+
140
+ if (typeof pagination?.countTotal !== "undefined") {
141
+ options.params['pagination.count_total'] = pagination.countTotal;
142
+ }
143
+ if (typeof pagination?.key !== "undefined") {
144
+ // String to Uint8Array
145
+ // let uint8arr = new Uint8Array(Buffer.from(data,'base64'));
146
+
147
+ // Uint8Array to String
148
+ options.params['pagination.key'] = Buffer.from(pagination.key).toString('base64');
149
+ }
150
+ if (typeof pagination?.limit !== "undefined") {
151
+ options.params["pagination.limit"] = pagination.limit.toString()
152
+ }
153
+ if (typeof pagination?.offset !== "undefined") {
154
+ options.params["pagination.offset"] = pagination.offset.toString()
155
+ }
156
+ if (typeof pagination?.reverse !== "undefined") {
157
+ options.params['pagination.reverse'] = pagination.reverse;
158
+ }
159
+
160
+ return options;
161
+ };
162
+
163
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
164
+
165
+ export type DeepPartial<T> = T extends Builtin
166
+ ? T
167
+ : T extends Long
168
+ ? string | number | Long
169
+ : T extends Array<infer U>
170
+ ? Array<DeepPartial<U>>
171
+ : T extends ReadonlyArray<infer U>
172
+ ? ReadonlyArray<DeepPartial<U>>
173
+ : T extends {}
174
+ ? { [K in keyof T]?: DeepPartial<T[K]> }
175
+ : Partial<T>;
176
+
177
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
178
+ export type Exact<P, I extends P> = P extends Builtin
179
+ ? P
180
+ : P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;
181
+
182
+ export interface Rpc {
183
+ request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
184
+ };
185
+
186
+ interface Timestamp {
187
+ /**
188
+ * Represents seconds of UTC time since Unix epoch
189
+ * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
190
+ * 9999-12-31T23:59:59Z inclusive.
191
+ */
192
+ seconds: Long;
193
+ /**
194
+ * Non-negative fractions of a second at nanosecond resolution. Negative
195
+ * second values with fractions must still have non-negative nanos values
196
+ * that count forward in time. Must be from 0 to 999,999,999
197
+ * inclusive.
198
+ */
199
+
200
+ nanos: number;
201
+ }
202
+
203
+ export function toTimestamp(date: Date): Timestamp {
204
+ const seconds = numberToLong(date.getTime() / 1_000);
205
+ const nanos = date.getTime() % 1000 * 1000000;
206
+ return {
207
+ seconds,
208
+ nanos
209
+ };
210
+ };
211
+
212
+ export function fromTimestamp(t: Timestamp): Date {
213
+ let millis = t.seconds.toNumber() * 1000;
214
+ millis += t.nanos / 1000000;
215
+ return new Date(millis);
216
+ };
217
+
218
+ const timestampFromJSON = (object: any): Timestamp => {
219
+ return {
220
+ seconds: isSet(object.seconds) ? Long.fromValue(object.seconds) : Long.ZERO,
221
+ nanos: isSet(object.nanos) ? Number(object.nanos) : 0,
222
+ };
223
+ }
224
+
225
+ export function fromJsonTimestamp(o: any): Timestamp {
226
+ if (o instanceof Date) {
227
+ return toTimestamp(o);
228
+ } else if (typeof o === "string") {
229
+ return toTimestamp(new Date(o));
230
+ } else {
231
+ return timestampFromJSON(o);
232
+ }
233
+ }
234
+
235
+ function numberToLong(number: number) {
236
+ return Long.fromNumber(number);
237
+ }
238
+ `;
239
+ };
240
+ exports.getHelper = getHelper;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.jsonSafe = void 0;
4
+ exports.jsonSafe = `
5
+ export type JsonSafe<T> = T extends Uint8Array | bigint | Date
6
+ ? string
7
+ : T extends Array<infer U>
8
+ ? Array<JsonSafe<U>>
9
+ : T extends object
10
+ ? { [K in keyof T]: JsonSafe<T[K]> }
11
+ : T;
12
+ `;
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mobx = void 0;
4
+ exports.mobx = `
5
+ import {
6
+ makeAutoObservable,
7
+ runInAction
8
+ } from 'mobx';
9
+
10
+ import { QueryStatus } from '@tanstack/react-query';
11
+
12
+ export interface MobxResponse<T> {
13
+ data: T | undefined;
14
+ isSuccess: boolean;
15
+ isLoading: boolean;
16
+ refetch: () => Promise<void>;
17
+ }
18
+
19
+ export class QueryStore<Request, Response> {
20
+ state?: QueryStatus;
21
+ request?: Request;
22
+ response?: Response;
23
+ fetchFunc?: (request: Request) => Promise<Response>;
24
+
25
+ constructor(fetchFunc?: (request: Request) => Promise<Response>) {
26
+ this.fetchFunc = fetchFunc;
27
+ makeAutoObservable(this)
28
+ }
29
+
30
+ get isLoading() {
31
+ return this.state === 'loading';
32
+ }
33
+
34
+ get isSuccess() {
35
+ return this.state === 'success';
36
+ }
37
+
38
+ refetch = async (): Promise<void> => {
39
+ runInAction(() => {
40
+ this.response = void 0;
41
+ this.state = 'loading';
42
+ });
43
+ try {
44
+ if (!this.fetchFunc)
45
+ throw new Error(
46
+ 'Query Service not initialized or request function not implemented'
47
+ );
48
+ if (!this.request) throw new Error('Request not provided');
49
+ const response = await this.fetchFunc(this.request);
50
+ runInAction(() => {
51
+ this.response = response;
52
+ this.state = 'success';
53
+ });
54
+ console.log(
55
+ '%cquery.rpc.Query.ts line:572 this.state',
56
+ 'color: #007acc;',
57
+ this.state,
58
+ this.response
59
+ );
60
+ } catch (e) {
61
+ console.error(e);
62
+ runInAction(() => {
63
+ this.state = 'error';
64
+ });
65
+ }
66
+ }
67
+
68
+ getData(request?: Request): MobxResponse<Response> {
69
+ runInAction(() => {
70
+ this.request = request;
71
+ });
72
+ return {
73
+ data: this.response,
74
+ isSuccess: this.isSuccess,
75
+ isLoading: this.isLoading,
76
+ refetch: this.refetch,
77
+ };
78
+ }
79
+ }
80
+ `;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pinia = void 0;
4
+ exports.pinia = `
5
+ import { defineStore } from "pinia";
6
+ import type { LCDClient } from '@cosmology/lcd';
7
+
8
+ export const useEndpoint = defineStore('pinia.endpoint', {
9
+ state: () => {
10
+ return {
11
+ restClient: {} as LCDClient,
12
+ }
13
+ },
14
+ actions: {
15
+ setRestClient(client: LCDClient) {
16
+ this.restClient = client
17
+ }
18
+ }
19
+ })
20
+ `;