@geeqdev/geeq-sdk 0.1.0 → 0.2.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 (392) hide show
  1. package/.idea/geeq_sdk.iml +12 -0
  2. package/.idea/modules.xml +8 -0
  3. package/.idea/vcs.xml +6 -0
  4. package/.nvmrc +1 -0
  5. package/CONTRIBUTING.md +20 -0
  6. package/dist/src/address/record-type.d.ts +10 -0
  7. package/dist/src/address/record-type.js +59 -0
  8. package/dist/src/address/record-type.js.map +1 -0
  9. package/dist/src/address/wallet-address.d.ts +34 -0
  10. package/dist/src/address/wallet-address.js +90 -0
  11. package/dist/src/address/wallet-address.js.map +1 -0
  12. package/dist/src/amount.d.ts +43 -0
  13. package/dist/src/amount.js +105 -0
  14. package/dist/src/amount.js.map +1 -0
  15. package/dist/src/assert.d.ts +12 -0
  16. package/dist/src/assert.js +24 -0
  17. package/dist/src/assert.js.map +1 -0
  18. package/dist/src/capnp/adminNetTx.capnp.d.ts +75 -0
  19. package/dist/src/capnp/adminNetTx.capnp.js +66 -0
  20. package/dist/src/capnp/adminNetTx.capnp.js.map +1 -0
  21. package/dist/src/capnp/appLayBlock.capnp.d.ts +26 -0
  22. package/dist/src/capnp/appLayBlock.capnp.js +24 -0
  23. package/dist/src/capnp/appLayBlock.capnp.js.map +1 -0
  24. package/dist/src/capnp/appLayLedger.capnp.d.ts +34 -0
  25. package/dist/src/capnp/appLayLedger.capnp.js +32 -0
  26. package/dist/src/capnp/appLayLedger.capnp.js.map +1 -0
  27. package/dist/src/capnp/appLayRec.capnp.d.ts +129 -0
  28. package/dist/src/capnp/appLayRec.capnp.js +156 -0
  29. package/dist/src/capnp/appLayRec.capnp.js.map +1 -0
  30. package/dist/src/capnp/chainStateView.capnp.d.ts +50 -0
  31. package/dist/src/capnp/chainStateView.capnp.js +48 -0
  32. package/dist/src/capnp/chainStateView.capnp.js.map +1 -0
  33. package/dist/src/capnp/coinAcctRec.capnp.d.ts +178 -0
  34. package/dist/src/capnp/coinAcctRec.capnp.js +189 -0
  35. package/dist/src/capnp/coinAcctRec.capnp.js.map +1 -0
  36. package/dist/src/capnp/genesisBlock.capnp.d.ts +61 -0
  37. package/dist/src/capnp/genesisBlock.capnp.js +55 -0
  38. package/dist/src/capnp/genesisBlock.capnp.js.map +1 -0
  39. package/dist/src/capnp/hubContentStmt.capnp.d.ts +63 -0
  40. package/dist/src/capnp/hubContentStmt.capnp.js +57 -0
  41. package/dist/src/capnp/hubContentStmt.capnp.js.map +1 -0
  42. package/dist/src/capnp/misc.capnp.d.ts +20 -0
  43. package/dist/src/capnp/misc.capnp.js +18 -0
  44. package/dist/src/capnp/misc.capnp.js.map +1 -0
  45. package/dist/src/capnp/netActorRec.capnp.d.ts +65 -0
  46. package/dist/src/capnp/netActorRec.capnp.js +65 -0
  47. package/dist/src/capnp/netActorRec.capnp.js.map +1 -0
  48. package/dist/src/capnp/nodeContentStmt.capnp.d.ts +67 -0
  49. package/dist/src/capnp/nodeContentStmt.capnp.js +61 -0
  50. package/dist/src/capnp/nodeContentStmt.capnp.js.map +1 -0
  51. package/dist/src/capnp/nodePayloadList.capnp.d.ts +28 -0
  52. package/dist/src/capnp/nodePayloadList.capnp.js +26 -0
  53. package/dist/src/capnp/nodePayloadList.capnp.js.map +1 -0
  54. package/dist/src/capnp/nodeTxList.capnp.d.ts +36 -0
  55. package/dist/src/capnp/nodeTxList.capnp.js +34 -0
  56. package/dist/src/capnp/nodeTxList.capnp.js.map +1 -0
  57. package/dist/src/capnp/paramAcctRec.capnp.d.ts +338 -0
  58. package/dist/src/capnp/paramAcctRec.capnp.js +669 -0
  59. package/dist/src/capnp/paramAcctRec.capnp.js.map +1 -0
  60. package/dist/src/capnp/payload.capnp.d.ts +237 -0
  61. package/dist/src/capnp/payload.capnp.js +260 -0
  62. package/dist/src/capnp/payload.capnp.js.map +1 -0
  63. package/dist/src/capnp/proxyAcctRec.capnp.d.ts +223 -0
  64. package/dist/src/capnp/proxyAcctRec.capnp.js +255 -0
  65. package/dist/src/capnp/proxyAcctRec.capnp.js.map +1 -0
  66. package/dist/src/capnp/relayContentStmt.capnp.d.ts +82 -0
  67. package/dist/src/capnp/relayContentStmt.capnp.js +85 -0
  68. package/dist/src/capnp/relayContentStmt.capnp.js.map +1 -0
  69. package/dist/src/capnp/sysAcctRec.capnp.d.ts +48 -0
  70. package/dist/src/capnp/sysAcctRec.capnp.js +46 -0
  71. package/dist/src/capnp/sysAcctRec.capnp.js.map +1 -0
  72. package/dist/src/capnp/userAppTx.capnp.d.ts +230 -0
  73. package/dist/src/capnp/userAppTx.capnp.js +270 -0
  74. package/dist/src/capnp/userAppTx.capnp.js.map +1 -0
  75. package/dist/src/capnp/userValTx.capnp.d.ts +1575 -0
  76. package/dist/src/capnp/userValTx.capnp.js +2004 -0
  77. package/dist/src/capnp/userValTx.capnp.js.map +1 -0
  78. package/dist/src/capnp/valLayBlock.capnp.d.ts +88 -0
  79. package/dist/src/capnp/valLayBlock.capnp.js +86 -0
  80. package/dist/src/capnp/valLayBlock.capnp.js.map +1 -0
  81. package/dist/src/capnp/valLayLedger.capnp.d.ts +85 -0
  82. package/dist/src/capnp/valLayLedger.capnp.js +75 -0
  83. package/dist/src/capnp/valLayLedger.capnp.js.map +1 -0
  84. package/dist/src/chain/geeq-chain.d.ts +474 -0
  85. package/dist/src/chain/geeq-chain.js +721 -0
  86. package/dist/src/chain/geeq-chain.js.map +1 -0
  87. package/dist/src/chain/geeq-node.d.ts +57 -0
  88. package/dist/src/chain/geeq-node.js +62 -0
  89. package/dist/src/chain/geeq-node.js.map +1 -0
  90. package/dist/src/chain/nonce-guard.d.ts +42 -0
  91. package/dist/src/chain/nonce-guard.js +68 -0
  92. package/dist/src/chain/nonce-guard.js.map +1 -0
  93. package/dist/src/chain/select.d.ts +40 -0
  94. package/dist/src/chain/select.js +114 -0
  95. package/dist/src/chain/select.js.map +1 -0
  96. package/dist/src/crypto/account-id.d.ts +35 -0
  97. package/dist/src/crypto/account-id.js +58 -0
  98. package/dist/src/crypto/account-id.js.map +1 -0
  99. package/dist/src/crypto/keypair.d.ts +24 -0
  100. package/dist/src/crypto/keypair.js +158 -0
  101. package/dist/src/crypto/keypair.js.map +1 -0
  102. package/dist/src/crypto/mnemonic.d.ts +34 -0
  103. package/dist/src/crypto/mnemonic.js +57 -0
  104. package/dist/src/crypto/mnemonic.js.map +1 -0
  105. package/dist/src/encoding/base64.d.ts +8 -0
  106. package/dist/src/encoding/base64.js +53 -0
  107. package/dist/src/encoding/base64.js.map +1 -0
  108. package/dist/src/encoding/hex.d.ts +2 -0
  109. package/dist/src/encoding/hex.js +35 -0
  110. package/dist/src/encoding/hex.js.map +1 -0
  111. package/dist/src/errors.d.ts +83 -0
  112. package/dist/src/errors.js +49 -0
  113. package/dist/src/errors.js.map +1 -0
  114. package/dist/src/index.d.ts +59 -0
  115. package/dist/src/index.js +53 -0
  116. package/dist/src/index.js.map +1 -0
  117. package/dist/src/ledger/coin-accounts.d.ts +42 -0
  118. package/dist/src/ledger/coin-accounts.js +37 -0
  119. package/dist/src/ledger/coin-accounts.js.map +1 -0
  120. package/dist/src/ledger/decode.d.ts +18 -0
  121. package/dist/src/ledger/decode.js +113 -0
  122. package/dist/src/ledger/decode.js.map +1 -0
  123. package/dist/src/ledger/geeq-ledger.d.ts +99 -0
  124. package/dist/src/ledger/geeq-ledger.js +125 -0
  125. package/dist/src/ledger/geeq-ledger.js.map +1 -0
  126. package/dist/src/ledger/net-actors.d.ts +65 -0
  127. package/dist/src/ledger/net-actors.js +53 -0
  128. package/dist/src/ledger/net-actors.js.map +1 -0
  129. package/dist/src/ledger/nft-records.d.ts +13 -0
  130. package/dist/src/ledger/nft-records.js +41 -0
  131. package/dist/src/ledger/nft-records.js.map +1 -0
  132. package/dist/src/ledger/params.d.ts +34 -0
  133. package/dist/src/ledger/params.js +71 -0
  134. package/dist/src/ledger/params.js.map +1 -0
  135. package/dist/src/ledger/proxy-accounts.d.ts +26 -0
  136. package/dist/src/ledger/proxy-accounts.js +27 -0
  137. package/dist/src/ledger/proxy-accounts.js.map +1 -0
  138. package/dist/src/net/discovery.d.ts +62 -0
  139. package/dist/src/net/discovery.js +136 -0
  140. package/dist/src/net/discovery.js.map +1 -0
  141. package/dist/src/net/explorer.d.ts +57 -0
  142. package/dist/src/net/explorer.js +64 -0
  143. package/dist/src/net/explorer.js.map +1 -0
  144. package/dist/src/net/read-ledger.d.ts +7 -0
  145. package/dist/src/net/read-ledger.js +39 -0
  146. package/dist/src/net/read-ledger.js.map +1 -0
  147. package/dist/src/net/routes.d.ts +49 -0
  148. package/dist/src/net/routes.js +70 -0
  149. package/dist/src/net/routes.js.map +1 -0
  150. package/dist/src/net/transport.d.ts +55 -0
  151. package/dist/src/net/transport.js +168 -0
  152. package/dist/src/net/transport.js.map +1 -0
  153. package/dist/src/net/websocket.d.ts +49 -0
  154. package/dist/src/net/websocket.js +54 -0
  155. package/dist/src/net/websocket.js.map +1 -0
  156. package/dist/src/runtime/bindings.d.ts +9 -0
  157. package/dist/src/runtime/bindings.js +27 -0
  158. package/dist/src/runtime/bindings.js.map +1 -0
  159. package/dist/src/runtime/init.d.ts +13 -0
  160. package/dist/src/runtime/init.js +40 -0
  161. package/dist/src/runtime/init.js.map +1 -0
  162. package/dist/src/runtime/wasm-loader.browser.d.ts +14 -0
  163. package/dist/src/runtime/wasm-loader.browser.js +20 -0
  164. package/dist/src/runtime/wasm-loader.browser.js.map +1 -0
  165. package/dist/src/runtime/wasm-loader.node.d.ts +7 -0
  166. package/dist/src/runtime/wasm-loader.node.js +14 -0
  167. package/dist/src/runtime/wasm-loader.node.js.map +1 -0
  168. package/dist/src/socket/geeq-socket.d.ts +232 -0
  169. package/dist/src/socket/geeq-socket.js +634 -0
  170. package/dist/src/socket/geeq-socket.js.map +1 -0
  171. package/dist/src/socket/tracked-tx.d.ts +148 -0
  172. package/dist/src/socket/tracked-tx.js +212 -0
  173. package/dist/src/socket/tracked-tx.js.map +1 -0
  174. package/dist/src/socket/tx-status.d.ts +69 -0
  175. package/dist/src/socket/tx-status.js +72 -0
  176. package/dist/src/socket/tx-status.js.map +1 -0
  177. package/dist/src/tx/attestation.d.ts +60 -0
  178. package/dist/src/tx/attestation.js +163 -0
  179. package/dist/src/tx/attestation.js.map +1 -0
  180. package/dist/src/tx/content.d.ts +27 -0
  181. package/dist/src/tx/content.js +62 -0
  182. package/dist/src/tx/content.js.map +1 -0
  183. package/dist/src/tx/encode.d.ts +60 -0
  184. package/dist/src/tx/encode.js +82 -0
  185. package/dist/src/tx/encode.js.map +1 -0
  186. package/dist/src/tx/expiry.d.ts +11 -0
  187. package/dist/src/tx/expiry.js +12 -0
  188. package/dist/src/tx/expiry.js.map +1 -0
  189. package/dist/src/tx/fee.d.ts +16 -0
  190. package/dist/src/tx/fee.js +29 -0
  191. package/dist/src/tx/fee.js.map +1 -0
  192. package/dist/src/tx/metadata.d.ts +39 -0
  193. package/dist/src/tx/metadata.js +66 -0
  194. package/dist/src/tx/metadata.js.map +1 -0
  195. package/dist/src/tx/nft.d.ts +16 -0
  196. package/dist/src/tx/nft.js +98 -0
  197. package/dist/src/tx/nft.js.map +1 -0
  198. package/dist/src/tx/proxy.d.ts +37 -0
  199. package/dist/src/tx/proxy.js +134 -0
  200. package/dist/src/tx/proxy.js.map +1 -0
  201. package/dist/src/tx/transfer.d.ts +31 -0
  202. package/dist/src/tx/transfer.js +123 -0
  203. package/dist/src/tx/transfer.js.map +1 -0
  204. package/dist/src/types.d.ts +448 -0
  205. package/dist/src/types.js +2 -0
  206. package/dist/src/types.js.map +1 -0
  207. package/dist/tests/account-id.test.d.ts +1 -0
  208. package/dist/tests/account-id.test.js +27 -0
  209. package/dist/tests/account-id.test.js.map +1 -0
  210. package/dist/tests/amount.test.d.ts +1 -0
  211. package/dist/tests/amount.test.js +113 -0
  212. package/dist/tests/amount.test.js.map +1 -0
  213. package/dist/tests/attestation.test.d.ts +1 -0
  214. package/dist/tests/attestation.test.js +182 -0
  215. package/dist/tests/attestation.test.js.map +1 -0
  216. package/dist/tests/chain.test.d.ts +1 -0
  217. package/dist/tests/chain.test.js +647 -0
  218. package/dist/tests/chain.test.js.map +1 -0
  219. package/dist/tests/content.test.d.ts +1 -0
  220. package/dist/tests/content.test.js +90 -0
  221. package/dist/tests/content.test.js.map +1 -0
  222. package/dist/tests/documented-api.test.d.ts +1 -0
  223. package/dist/tests/documented-api.test.js +229 -0
  224. package/dist/tests/documented-api.test.js.map +1 -0
  225. package/dist/tests/explorer.test.d.ts +1 -0
  226. package/dist/tests/explorer.test.js +95 -0
  227. package/dist/tests/explorer.test.js.map +1 -0
  228. package/dist/tests/fee.test.d.ts +1 -0
  229. package/dist/tests/fee.test.js +179 -0
  230. package/dist/tests/fee.test.js.map +1 -0
  231. package/dist/tests/fixtures/build-vll.d.ts +71 -0
  232. package/dist/tests/fixtures/build-vll.js +141 -0
  233. package/dist/tests/fixtures/build-vll.js.map +1 -0
  234. package/dist/tests/fixtures/fake-socket.d.ts +44 -0
  235. package/dist/tests/fixtures/fake-socket.js +93 -0
  236. package/dist/tests/fixtures/fake-socket.js.map +1 -0
  237. package/dist/tests/fixtures/fake-transport.d.ts +24 -0
  238. package/dist/tests/fixtures/fake-transport.js +30 -0
  239. package/dist/tests/fixtures/fake-transport.js.map +1 -0
  240. package/dist/tests/keypair.test.d.ts +1 -0
  241. package/dist/tests/keypair.test.js +163 -0
  242. package/dist/tests/keypair.test.js.map +1 -0
  243. package/dist/tests/ledger.test.d.ts +1 -0
  244. package/dist/tests/ledger.test.js +234 -0
  245. package/dist/tests/ledger.test.js.map +1 -0
  246. package/dist/tests/mnemonic.test.d.ts +1 -0
  247. package/dist/tests/mnemonic.test.js +97 -0
  248. package/dist/tests/mnemonic.test.js.map +1 -0
  249. package/dist/tests/nft-transfer.test.d.ts +1 -0
  250. package/dist/tests/nft-transfer.test.js +170 -0
  251. package/dist/tests/nft-transfer.test.js.map +1 -0
  252. package/dist/tests/nft.test.d.ts +1 -0
  253. package/dist/tests/nft.test.js +180 -0
  254. package/dist/tests/nft.test.js.map +1 -0
  255. package/dist/tests/offline.test.d.ts +1 -0
  256. package/dist/tests/offline.test.js +95 -0
  257. package/dist/tests/offline.test.js.map +1 -0
  258. package/dist/tests/proxy.test.d.ts +1 -0
  259. package/dist/tests/proxy.test.js +183 -0
  260. package/dist/tests/proxy.test.js.map +1 -0
  261. package/dist/tests/select.test.d.ts +1 -0
  262. package/dist/tests/select.test.js +200 -0
  263. package/dist/tests/select.test.js.map +1 -0
  264. package/dist/tests/socket.test.d.ts +1 -0
  265. package/dist/tests/socket.test.js +607 -0
  266. package/dist/tests/socket.test.js.map +1 -0
  267. package/dist/tests/transfer.test.d.ts +1 -0
  268. package/dist/tests/transfer.test.js +225 -0
  269. package/dist/tests/transfer.test.js.map +1 -0
  270. package/dist/tests/wallet-address.test.d.ts +1 -0
  271. package/dist/tests/wallet-address.test.js +101 -0
  272. package/dist/tests/wallet-address.test.js.map +1 -0
  273. package/dist/tests/wasm-loader.jest.d.ts +13 -0
  274. package/dist/tests/wasm-loader.jest.js +15 -0
  275. package/dist/tests/wasm-loader.jest.js.map +1 -0
  276. package/example/.env.example +4 -0
  277. package/example/README.md +304 -0
  278. package/example/USAGE.md +74 -0
  279. package/example/index.html +12 -0
  280. package/example/package-lock.json +1557 -0
  281. package/example/package.json +25 -0
  282. package/example/scripts/browser-check.mjs +1421 -0
  283. package/example/scripts/match-derivation.mjs +65 -0
  284. package/example/src/App.vue +138 -0
  285. package/example/src/components/AuthorityPanel.vue +277 -0
  286. package/example/src/components/ChainPanel.vue +267 -0
  287. package/example/src/components/ChainState.vue +59 -0
  288. package/example/src/components/CopyButton.vue +25 -0
  289. package/example/src/components/CreateAssetPanel.vue +313 -0
  290. package/example/src/components/DigitalAssetsPanel.vue +68 -0
  291. package/example/src/components/EvidencePanel.vue +396 -0
  292. package/example/src/components/ExplorerPanel.vue +119 -0
  293. package/example/src/components/KeypairPanel.vue +182 -0
  294. package/example/src/components/PhrasePanel.vue +105 -0
  295. package/example/src/components/SocketWarning.vue +18 -0
  296. package/example/src/components/StepGate.vue +24 -0
  297. package/example/src/components/TransferPanel.vue +416 -0
  298. package/example/src/components/TxDeadline.vue +19 -0
  299. package/example/src/components/TxFee.vue +31 -0
  300. package/example/src/components/TxStatus.vue +105 -0
  301. package/example/src/composables/useSocketConnection.ts +80 -0
  302. package/example/src/env.d.ts +12 -0
  303. package/example/src/main.ts +5 -0
  304. package/example/src/pennies.ts +7 -0
  305. package/example/src/style.css +149 -0
  306. package/example/tsconfig.json +19 -0
  307. package/example/vite.config.ts +26 -0
  308. package/jest.config.js +18 -0
  309. package/package.json +2 -6
  310. package/scripts/copy-wasm.mjs +21 -0
  311. package/scripts/smoke.mjs +382 -0
  312. package/src/address/record-type.ts +77 -0
  313. package/src/address/wallet-address.ts +105 -0
  314. package/src/amount.ts +143 -0
  315. package/src/assert.ts +30 -0
  316. package/src/capnp/README.md +15 -0
  317. package/src/capnp/adminNetTx.capnp.ts +66 -0
  318. package/src/capnp/appLayBlock.capnp.ts +26 -0
  319. package/src/capnp/appLayLedger.capnp.ts +35 -0
  320. package/src/capnp/appLayRec.capnp.ts +159 -0
  321. package/src/capnp/chainStateView.capnp.ts +49 -0
  322. package/src/capnp/coinAcctRec.capnp.ts +193 -0
  323. package/src/capnp/genesisBlock.capnp.ts +56 -0
  324. package/src/capnp/hubContentStmt.capnp.ts +59 -0
  325. package/src/capnp/misc.capnp.ts +19 -0
  326. package/src/capnp/netActorRec.capnp.ts +64 -0
  327. package/src/capnp/nodeContentStmt.capnp.ts +62 -0
  328. package/src/capnp/nodePayloadList.capnp.ts +28 -0
  329. package/src/capnp/nodeTxList.capnp.ts +37 -0
  330. package/src/capnp/paramAcctRec.capnp.ts +669 -0
  331. package/src/capnp/payload.capnp.ts +261 -0
  332. package/src/capnp/proxyAcctRec.capnp.ts +259 -0
  333. package/src/capnp/relayContentStmt.capnp.ts +85 -0
  334. package/src/capnp/sysAcctRec.capnp.ts +47 -0
  335. package/src/capnp/userAppTx.capnp.ts +269 -0
  336. package/src/capnp/userValTx.capnp.ts +1999 -0
  337. package/src/capnp/valLayBlock.capnp.ts +93 -0
  338. package/src/capnp/valLayLedger.capnp.ts +80 -0
  339. package/src/chain/geeq-chain.ts +1094 -0
  340. package/src/chain/geeq-node.ts +105 -0
  341. package/src/chain/nonce-guard.ts +73 -0
  342. package/src/chain/select.ts +149 -0
  343. package/src/crypto/account-id.ts +83 -0
  344. package/src/crypto/keypair.ts +221 -0
  345. package/src/crypto/mnemonic.ts +69 -0
  346. package/src/encoding/base64.ts +58 -0
  347. package/src/encoding/hex.ts +42 -0
  348. package/src/errors.ts +122 -0
  349. package/src/index.ts +195 -0
  350. package/src/ledger/coin-accounts.ts +73 -0
  351. package/src/ledger/decode.ts +147 -0
  352. package/src/ledger/geeq-ledger.ts +184 -0
  353. package/src/ledger/net-actors.ts +129 -0
  354. package/src/ledger/nft-records.ts +49 -0
  355. package/src/ledger/params.ts +82 -0
  356. package/src/ledger/proxy-accounts.ts +51 -0
  357. package/src/net/discovery.ts +231 -0
  358. package/src/net/explorer.ts +123 -0
  359. package/src/net/read-ledger.ts +58 -0
  360. package/src/net/routes.ts +79 -0
  361. package/src/net/transport.ts +221 -0
  362. package/src/net/websocket.ts +94 -0
  363. package/src/runtime/bindings.ts +38 -0
  364. package/src/runtime/init.ts +49 -0
  365. package/src/runtime/wasm-loader.browser.ts +22 -0
  366. package/src/runtime/wasm-loader.node.ts +16 -0
  367. package/src/socket/geeq-socket.ts +827 -0
  368. package/src/socket/tracked-tx.ts +319 -0
  369. package/src/socket/tx-status.ts +131 -0
  370. package/src/tx/attestation.ts +222 -0
  371. package/src/tx/content.ts +82 -0
  372. package/src/tx/encode.ts +107 -0
  373. package/src/tx/expiry.ts +11 -0
  374. package/src/tx/fee.ts +31 -0
  375. package/src/tx/metadata.ts +100 -0
  376. package/src/tx/nft.ts +108 -0
  377. package/src/tx/proxy.ts +156 -0
  378. package/src/tx/transfer.ts +162 -0
  379. package/src/types.ts +503 -0
  380. package/src/wasm/README.md +22 -0
  381. package/src/wasm/browser/geeq_core.d.ts +1224 -0
  382. package/src/wasm/browser/geeq_core.js +6014 -0
  383. package/src/wasm/browser/geeq_core_bg.wasm +0 -0
  384. package/src/wasm/browser/geeq_core_bg.wasm.d.ts +447 -0
  385. package/src/wasm/nodejs/geeq_core.d.ts +753 -0
  386. package/src/wasm/nodejs/geeq_core.js +6016 -0
  387. package/src/wasm/nodejs/geeq_core_bg.wasm +0 -0
  388. package/src/wasm/nodejs/geeq_core_bg.wasm.d.ts +447 -0
  389. package/src/wasm/nodejs/package.json +3 -0
  390. package/tsconfig.build.json +8 -0
  391. package/tsconfig.json +21 -0
  392. package/tsup.config.ts +60 -0
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Every node route the SDK knows, in one place.
3
+ *
4
+ * `origin` is an absolute node URL with no trailing slash — see `originOf`.
5
+ */
6
+ /** `GET` the current validation layer ledger, base64 packed capnp under `result`. */
7
+ export function ledgerRoute(origin) {
8
+ return `${origin}/api/blocks?type=vll`;
9
+ }
10
+ /** `GET` the current application layer ledger, where NFT records live. Same envelope. */
11
+ export function appLedgerRoute(origin) {
12
+ return `${origin}/api/blocks?type=all`;
13
+ }
14
+ /**
15
+ * Where a signed transaction is POSTed.
16
+ *
17
+ * The SDK does not submit — this is exported so an application builds the same URL the
18
+ * SDK read from, rather than keeping its own copy of the path.
19
+ */
20
+ export function submitRoute(origin) {
21
+ return `${origin}/api/blocks/process`;
22
+ }
23
+ /**
24
+ * The node's client WebSocket, where transaction status events arrive.
25
+ *
26
+ * Same host and port as the HTTP API — the node's TLS front door routes `/ws/` to the
27
+ * socket server and `/api/` to the HTTP one — so the only change is the scheme. The
28
+ * trailing slash is part of the route: the proxy answers `/ws` with a redirect, and a
29
+ * WebSocket handshake treats a redirect as failure.
30
+ */
31
+ export function socketRoute(origin) {
32
+ const url = new URL(origin);
33
+ const scheme = url.protocol === 'https:' ? 'wss:' : url.protocol === 'http:' ? 'ws:' : url.protocol;
34
+ return `${scheme}//${url.host}${url.pathname.replace(/\/+$/u, '')}/ws/`;
35
+ }
36
+ /**
37
+ * The body a node expects for an application-layer transaction: an attestation or an NFT
38
+ * mint, each a transaction and its payload.
39
+ */
40
+ export function attestationSubmitBody(transaction, payload) {
41
+ return JSON.stringify({ type: 'uat', data: { transaction, payload } });
42
+ }
43
+ /**
44
+ * The body a node expects for a coin transfer.
45
+ *
46
+ * A different type and a different shape from an attestation: a validation-layer
47
+ * transaction carries no separate payload, so there is one blob rather than two.
48
+ */
49
+ export function coinTransferSubmitBody(transaction) {
50
+ return JSON.stringify({ type: 'uvt', data: { transaction } });
51
+ }
52
+ /**
53
+ * Discovery routes on the chain's directory service.
54
+ *
55
+ * Only these two are ever called. The same service also exposes routes that start and
56
+ * stop nodes, install a genesis block, and — on `/api/accounts` — hand out plaintext
57
+ * private keys. None of those belong anywhere near an SDK, so the paths live here and
58
+ * nowhere else, and nothing constructs a URL against that origin by hand.
59
+ */
60
+ export function chainsRoute(origin) {
61
+ return `${origin}/api/admin/simulation/chains`;
62
+ }
63
+ export function nodesRoute(origin, systemId) {
64
+ return `${origin}/api/nodes?systemId=${encodeURIComponent(String(systemId))}`;
65
+ }
66
+ /** A block explorer's transaction lookup. The explorer files transactions by hex refHash. */
67
+ export function explorerTransactionRoute(explorer, refHashHex) {
68
+ return `${explorer}/api/transactions/byRefHash?refHash=${refHashHex}`;
69
+ }
70
+ //# sourceMappingURL=routes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.js","sourceRoot":"","sources":["../../../src/net/routes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,qFAAqF;AACrF,MAAM,UAAU,WAAW,CAAC,MAAc;IACxC,OAAO,GAAG,MAAM,sBAAsB,CAAA;AACxC,CAAC;AAED,yFAAyF;AACzF,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,OAAO,GAAG,MAAM,sBAAsB,CAAA;AACxC,CAAC;AAED;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QAAgB,EAAE,UAAkB;IAC3E,OAAO,GAAG,QAAQ,uCAAuC,UAAU,EAAE,CAAA;AACvE,CAAC"}
@@ -0,0 +1,55 @@
1
+ /** A response, narrowed to what this SDK reads. A WHATWG `Response` satisfies it. */
2
+ export interface GeeqHttpResponse {
3
+ readonly ok: boolean;
4
+ readonly status: number;
5
+ text(): Promise<string>;
6
+ }
7
+ /** A request, narrowed to what this SDK sends. Assignable to `RequestInit`. */
8
+ export interface GeeqRequestInit {
9
+ readonly method?: string;
10
+ readonly headers?: Readonly<Record<string, string>>;
11
+ readonly body?: string;
12
+ readonly signal?: AbortSignal;
13
+ }
14
+ /**
15
+ * How the SDK reaches a node.
16
+ *
17
+ * Deliberately a structural subset of WHATWG `fetch`, so `{ transport: fetch }`
18
+ * typechecks with no adapter, and so does undici with a custom dispatcher, a relative
19
+ * URL through a dev proxy, or a scripted array of responses in a test.
20
+ */
21
+ export type GeeqTransport = (url: string, init?: GeeqRequestInit) => Promise<GeeqHttpResponse>;
22
+ /**
23
+ * `globalThis.fetch`, resolved at call time.
24
+ *
25
+ * Never a stored reference: an unbound `fetch` throws `Illegal invocation` in a
26
+ * browser, and capturing it would defeat any test that swaps `globalThis.fetch` after
27
+ * this module is imported.
28
+ */
29
+ export declare const defaultTransport: GeeqTransport;
30
+ export interface RequestOptions {
31
+ readonly transport: GeeqTransport;
32
+ readonly timeoutMs: number;
33
+ readonly retries: number;
34
+ readonly headers?: Readonly<Record<string, string>> | undefined;
35
+ readonly signal?: AbortSignal | undefined;
36
+ readonly method?: string | undefined;
37
+ readonly body?: string | undefined;
38
+ }
39
+ /**
40
+ * Make one request and return its body, mapping every failure onto a typed error.
41
+ *
42
+ * Retries only a transport failure, and only because reads are idempotent. A response
43
+ * that arrived is never retried: the node has decided.
44
+ */
45
+ export declare function requestText(url: string, options: RequestOptions): Promise<string>;
46
+ /**
47
+ * Wait for `promise`, or stop waiting when `signal` aborts.
48
+ *
49
+ * For a request several callers share: aborting one caller's wait must not cancel the
50
+ * request out from under the others, so the request runs on without any caller's signal
51
+ * and each caller races its own against it.
52
+ *
53
+ * @internal
54
+ */
55
+ export declare function raceAbort<T>(promise: Promise<T>, signal: AbortSignal | undefined): Promise<T>;
@@ -0,0 +1,168 @@
1
+ import { GeeqError, networkUnreachable, nodeError } from '../errors';
2
+ /**
3
+ * `globalThis.fetch`, resolved at call time.
4
+ *
5
+ * Never a stored reference: an unbound `fetch` throws `Illegal invocation` in a
6
+ * browser, and capturing it would defeat any test that swaps `globalThis.fetch` after
7
+ * this module is imported.
8
+ */
9
+ export const defaultTransport = (url, init) => globalThis.fetch(url, init);
10
+ /**
11
+ * The one failure a browser can be certain about before making a request.
12
+ *
13
+ * An https page may not load an http subresource. The browser blocks it and reports a
14
+ * generic network failure, so issuing the request would only turn a knowable cause into
15
+ * an ambiguous one.
16
+ */
17
+ function assertSchemeReachable(url) {
18
+ const location = globalThis.location;
19
+ if (location?.protocol !== 'https:')
20
+ return;
21
+ let scheme;
22
+ try {
23
+ scheme = new URL(url).protocol;
24
+ }
25
+ catch {
26
+ return;
27
+ }
28
+ if (scheme !== 'http:')
29
+ return;
30
+ throw networkUnreachable(`This page is served over https and the node URL ${url} is http, so the browser ` +
31
+ 'will block the request as mixed content before it is sent. Use the node\'s https ' +
32
+ 'URL (port 2082 by default), or serve this page over http while developing.');
33
+ }
34
+ /** The four causes a browser cannot tell apart, each with what to do about it. */
35
+ function opaqueFailureMessage(url) {
36
+ return (`Could not reach the Geeq node at ${url}. A browser reports network failures ` +
37
+ 'opaquely, so this is one of four things: (1) the node does not answer CORS for ' +
38
+ 'this origin — pass your own `transport` routing through a proxy you control; ' +
39
+ "(2) the node's TLS certificate is not trusted, which is common because nodes are " +
40
+ 'addressed by bare IP — open the URL in a tab to see the interstitial; (3) this ' +
41
+ 'page is https and the node is http, which browsers block; or (4) the node is down ' +
42
+ 'or the URL is wrong.');
43
+ }
44
+ function describeCause(cause) {
45
+ if (cause !== null && typeof cause === 'object') {
46
+ const { code } = cause;
47
+ if (typeof code === 'string')
48
+ return code;
49
+ }
50
+ return undefined;
51
+ }
52
+ /** Pull the node's own `details` out of an error body without trusting its shape. */
53
+ function nodeDetailsOf(body) {
54
+ try {
55
+ const parsed = JSON.parse(body);
56
+ if (parsed !== null && typeof parsed === 'object') {
57
+ const { details, error } = parsed;
58
+ if (typeof details === 'string' && details !== '')
59
+ return details;
60
+ // A block explorer sends its reasons as a list.
61
+ if (Array.isArray(details)) {
62
+ const joined = details.filter((item) => typeof item === 'string').join('; ');
63
+ if (joined !== '')
64
+ return joined;
65
+ }
66
+ if (typeof error === 'string' && error !== '')
67
+ return error;
68
+ }
69
+ }
70
+ catch {
71
+ // Not JSON. The raw body is still the most useful thing we have.
72
+ }
73
+ return body === '' ? undefined : body.slice(0, 400);
74
+ }
75
+ /**
76
+ * `signal.throwIfAborted()`, written out: a polyfilled `AbortSignal` may not have it.
77
+ * A call rather than an inline check also keeps TypeScript from narrowing `aborted` to
78
+ * false for the rest of the function — it can change across an `await`.
79
+ */
80
+ function throwIfAborted(signal) {
81
+ if (signal?.aborted === true)
82
+ throw signal.reason;
83
+ }
84
+ /**
85
+ * Make one request and return its body, mapping every failure onto a typed error.
86
+ *
87
+ * Retries only a transport failure, and only because reads are idempotent. A response
88
+ * that arrived is never retried: the node has decided.
89
+ */
90
+ export async function requestText(url, options) {
91
+ assertSchemeReachable(url);
92
+ const { signal } = options;
93
+ let lastCause;
94
+ for (let attempt = 0; attempt <= options.retries; attempt += 1) {
95
+ // An 'abort' listener never fires for a signal that is already aborted, so without
96
+ // this the request would go out anyway — and so would a retry after an abort.
97
+ throwIfAborted(signal);
98
+ // Composed by hand rather than with AbortSignal.any, which needs Node 20.3 and
99
+ // Safari 17.4 — too new for a library that supports Node 20. The caller's reason is
100
+ // passed on, so a fetch that honours it rejects with exactly what the caller aborted with.
101
+ const controller = new AbortController();
102
+ const onAbort = () => controller.abort(signal?.reason);
103
+ signal?.addEventListener('abort', onAbort);
104
+ let timedOut = false;
105
+ const timer = setTimeout(() => {
106
+ timedOut = true;
107
+ controller.abort();
108
+ }, options.timeoutMs);
109
+ try {
110
+ const response = await options.transport(url, {
111
+ signal: controller.signal,
112
+ ...(options.method === undefined ? {} : { method: options.method }),
113
+ ...(options.headers === undefined ? {} : { headers: options.headers }),
114
+ ...(options.body === undefined ? {} : { body: options.body }),
115
+ });
116
+ const body = await response.text();
117
+ if (!response.ok) {
118
+ const details = nodeDetailsOf(body);
119
+ throw nodeError(`The node at ${url} answered HTTP ${response.status}` +
120
+ (details === undefined ? ' with no detail.' : `: ${JSON.stringify(details)}.`), response.status, details);
121
+ }
122
+ return body;
123
+ }
124
+ catch (cause) {
125
+ if (cause instanceof GeeqError)
126
+ throw cause;
127
+ // A caller-driven abort is theirs to observe, not ours to relabel.
128
+ if (signal?.aborted === true)
129
+ throw signal.reason;
130
+ if (timedOut) {
131
+ throw networkUnreachable(`The node at ${url} did not answer within ${options.timeoutMs}ms. Raise ` +
132
+ 'timeoutMs if the node is simply slow, or try another node.', cause);
133
+ }
134
+ lastCause = cause;
135
+ }
136
+ finally {
137
+ clearTimeout(timer);
138
+ signal?.removeEventListener('abort', onAbort);
139
+ }
140
+ }
141
+ const code = describeCause(lastCause);
142
+ throw networkUnreachable(code === undefined
143
+ ? opaqueFailureMessage(url)
144
+ : `Could not reach the Geeq node at ${url}: ${code}.`, lastCause);
145
+ }
146
+ /**
147
+ * Wait for `promise`, or stop waiting when `signal` aborts.
148
+ *
149
+ * For a request several callers share: aborting one caller's wait must not cancel the
150
+ * request out from under the others, so the request runs on without any caller's signal
151
+ * and each caller races its own against it.
152
+ *
153
+ * @internal
154
+ */
155
+ export function raceAbort(promise, signal) {
156
+ if (signal === undefined)
157
+ return promise;
158
+ if (signal.aborted)
159
+ return Promise.reject(signal.reason);
160
+ return new Promise((resolve, reject) => {
161
+ const onAbort = () => reject(signal.reason);
162
+ signal.addEventListener('abort', onAbort, { once: true });
163
+ promise
164
+ .then(resolve, reject)
165
+ .finally(() => signal.removeEventListener('abort', onAbort));
166
+ });
167
+ }
168
+ //# sourceMappingURL=transport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.js","sourceRoot":"","sources":["../../../src/net/transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AA6BpE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAkB,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAC3D,UAAU,CAAC,KAAK,CAAC,GAAG,EAAE,IAAmB,CAAC,CAAA;AAY5C;;;;;;GAMG;AACH,SAAS,qBAAqB,CAAC,GAAW;IACxC,MAAM,QAAQ,GAAI,UAAmD,CAAC,QAAQ,CAAA;IAC9E,IAAI,QAAQ,EAAE,QAAQ,KAAK,QAAQ;QAAE,OAAM;IAE3C,IAAI,MAAc,CAAA;IAClB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAA;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,OAAM;IACR,CAAC;IACD,IAAI,MAAM,KAAK,OAAO;QAAE,OAAM;IAE9B,MAAM,kBAAkB,CACtB,mDAAmD,GAAG,2BAA2B;QAC/E,mFAAmF;QACnF,4EAA4E,CAC/E,CAAA;AACH,CAAC;AAED,kFAAkF;AAClF,SAAS,oBAAoB,CAAC,GAAW;IACvC,OAAO,CACL,oCAAoC,GAAG,uCAAuC;QAC9E,iFAAiF;QACjF,+EAA+E;QAC/E,mFAAmF;QACnF,iFAAiF;QACjF,oFAAoF;QACpF,sBAAsB,CACvB,CAAA;AACH,CAAC;AAED,SAAS,aAAa,CAAC,KAAc;IACnC,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChD,MAAM,EAAE,IAAI,EAAE,GAAG,KAA2B,CAAA;QAC5C,IAAI,OAAO,IAAI,KAAK,QA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S,CACV,CAAA;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS,CAAI,OAAmB,EAAE,MAA+B;IAC/E,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,OAAO,CAAA;IACxC,IAAI,MAAM,CAAC,OAAO;QAAE,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IACxD,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACxC,MAAM,OAAO,GAAG,GAAS,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QACjD,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;QACzD,OAAO;aACJ,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC;aACrB,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAA;IAChE,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,49 @@
1
+ /** `readyState` of an open connection. The same number in browsers and in `ws`. */
2
+ export declare const WEBSOCKET_OPEN = 1;
3
+ /** What a WebSocket hands its `message` listeners, narrowed to the one field read. */
4
+ export interface GeeqWebSocketMessageEvent {
5
+ readonly data: unknown;
6
+ }
7
+ /**
8
+ * A WebSocket, narrowed to what this SDK uses.
9
+ *
10
+ * Deliberately structural, like {@link GeeqTransport}: a browser `WebSocket`, Node 22's
11
+ * global one and the `ws` package's class all satisfy it with no adapter, and so does a
12
+ * scripted fake in a test. Listeners are attached with `addEventListener` rather than
13
+ * `onmessage` and friends because a method is compared bivariantly, which is what lets
14
+ * each implementation's own event types through.
15
+ */
16
+ export interface GeeqWebSocketLike {
17
+ readonly readyState: number;
18
+ send(data: string): void;
19
+ close(code?: number, reason?: string): void;
20
+ addEventListener(type: 'open', listener: (event: unknown) => void): void;
21
+ addEventListener(type: 'message', listener: (event: GeeqWebSocketMessageEvent) => void): void;
22
+ addEventListener(type: 'close', listener: (event: unknown) => void): void;
23
+ addEventListener(type: 'error', listener: (event: unknown) => void): void;
24
+ }
25
+ /**
26
+ * How the SDK opens a socket.
27
+ *
28
+ * `(url) => new WebSocket(url)` is the whole contract. Pass one to use the `ws` package on
29
+ * Node 20, to add headers or a TLS agent there, or to script a connection in a test.
30
+ */
31
+ export type GeeqWebSocketFactory = (url: string) => GeeqWebSocketLike;
32
+ /**
33
+ * `new globalThis.WebSocket(url)`, resolved at call time.
34
+ *
35
+ * Never a stored reference, for the same reason as `defaultTransport`: a test that swaps
36
+ * the global after import must still be honoured. Node 20 has no global WebSocket at all,
37
+ * and a library that supports Node 20 cannot assume one, so its absence is reported with
38
+ * the one-line fix rather than as a `TypeError`.
39
+ */
40
+ export declare const defaultWebSocketFactory: GeeqWebSocketFactory;
41
+ /**
42
+ * The one socket failure a browser can be certain about before trying.
43
+ *
44
+ * An https page may not open a `ws://` socket; the browser refuses it outright and reports
45
+ * nothing useful, so the handshake would only turn a knowable cause into an opaque one.
46
+ */
47
+ export declare function assertSocketSchemeReachable(url: string): void;
48
+ /** The causes a browser cannot tell apart when a handshake fails, with the fix for each. */
49
+ export declare function opaqueSocketFailureMessage(url: string): string;
@@ -0,0 +1,54 @@
1
+ import { socketUnreachable } from '../errors';
2
+ /** `readyState` of an open connection. The same number in browsers and in `ws`. */
3
+ export const WEBSOCKET_OPEN = 1;
4
+ /**
5
+ * `new globalThis.WebSocket(url)`, resolved at call time.
6
+ *
7
+ * Never a stored reference, for the same reason as `defaultTransport`: a test that swaps
8
+ * the global after import must still be honoured. Node 20 has no global WebSocket at all,
9
+ * and a library that supports Node 20 cannot assume one, so its absence is reported with
10
+ * the one-line fix rather than as a `TypeError`.
11
+ */
12
+ export const defaultWebSocketFactory = (url) => {
13
+ const WebSocketClass = globalThis
14
+ .WebSocket;
15
+ if (typeof WebSocketClass !== 'function') {
16
+ throw socketUnreachable('This runtime has no global WebSocket — Node 20 does not, Node 22 and every browser ' +
17
+ 'do. Pass one explicitly: `webSocket: (url) => new WebSocket(url)` with ' +
18
+ '`import WebSocket from "ws"`.');
19
+ }
20
+ return new WebSocketClass(url);
21
+ };
22
+ /**
23
+ * The one socket failure a browser can be certain about before trying.
24
+ *
25
+ * An https page may not open a `ws://` socket; the browser refuses it outright and reports
26
+ * nothing useful, so the handshake would only turn a knowable cause into an opaque one.
27
+ */
28
+ export function assertSocketSchemeReachable(url) {
29
+ const location = globalThis.location;
30
+ if (location?.protocol !== 'https:')
31
+ return;
32
+ let scheme;
33
+ try {
34
+ scheme = new URL(url).protocol;
35
+ }
36
+ catch {
37
+ return;
38
+ }
39
+ if (scheme !== 'ws:')
40
+ return;
41
+ throw socketUnreachable(`This page is served over https and the socket URL ${url} is ws://, so the browser ` +
42
+ 'will block it as mixed content before it connects. Use the node\'s wss:// URL ' +
43
+ '(port 2082 by default), or serve this page over http while developing.');
44
+ }
45
+ /** The causes a browser cannot tell apart when a handshake fails, with the fix for each. */
46
+ export function opaqueSocketFailureMessage(url) {
47
+ return (`Could not open the Geeq node socket at ${url}. A browser reports a failed handshake ` +
48
+ 'with no detail, so this is one of four things: (1) the node\'s TLS certificate is ' +
49
+ 'not trusted, which is common because nodes are addressed by bare IP — open the ' +
50
+ "node's https URL in a tab to see the interstitial; (2) this page is https and the " +
51
+ 'socket is ws://, which browsers block; (3) the URL is wrong — the path is /ws/, with ' +
52
+ 'the trailing slash, on the same port as the HTTP API; or (4) the node is down.');
53
+ }
54
+ //# sourceMappingURL=websocket.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"websocket.js","sourceRoot":"","sources":["../../../src/net/websocket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAE7C,mFAAmF;AACnF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAA;AAkC/B;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAyB,CAAC,GAAG,EAAE,EAAE;IACnE,MAAM,cAAc,GAAI,UAAqE;SAC1F,SAAS,CAAA;IACZ,IAAI,OAAO,cAAc,KAAK,UAAU,EAAE,CAAC;QACzC,MAAM,iBAAiB,CACrB,qFAAqF;YACnF,yEAAyE;YACzE,+BAA+B,CAClC,CAAA;IACH,CAAC;IACD,OAAO,IAAI,cAAc,CAAC,GAAG,CAAC,CAAA;AAChC,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CAAC,GAAW;IACrD,MAAM,QAAQ,GAAI,UAAmD,CAAC,QAAQ,CAAA;IAC9E,IAAI,QAAQ,EAAE,QAAQ,KAAK,QAAQ;QAAE,OAAM;IAE3C,IAAI,MAAc,CAAA;IAClB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAA;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,OAAM;IACR,CAAC;IACD,IAAI,MAAM,KAAK,KAAK;QAAE,OAAM;IAE5B,MAAM,iBAAiB,CACrB,qDAAqD,GAAG,4BAA4B;QAClF,gFAAgF;QAChF,wEAAwE,CAC3E,CAAA;AACH,CAAC;AAED,4FAA4F;AAC5F,MAAM,UAAU,0BAA0B,CAAC,GAAW;IACpD,OAAO,CACL,0CAA0C,GAAG,yCAAyC;QACtF,oFAAoF;QACpF,iFAAiF;QACjF,oFAAoF;QACpF,uFAAuF;QACvF,gFAAgF,CACjF,CAAA;AACH,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The single place the SDK reaches into the WebAssembly engine.
3
+ *
4
+ * Every binding is imported by name and re-exported as a real identifier, never
5
+ * looked up by string. A string-keyed lookup here would break under any consumer
6
+ * minifier that renames module bindings, and it would fail silently for exactly
7
+ * one code path — the failure mode this indirection exists to prevent.
8
+ */
9
+ export { Keypair as WasmKeypair, WalletAddress as WasmWalletAddress, RecordType as WasmRecordType, CoinType as WasmCoinType, verify as wasmVerify, mnemonicToSeed as wasmMnemonicToSeed, generateSeedId as wasmGenerateSeedId, generateIrn as wasmGenerateIrn, IrnRecordType as WasmIrnRecordType, Payload as WasmPayload, UserAppTx as WasmUserAppTx, UserAppTxData as WasmUserAppTxData, UserValTx as WasmUserValTx, UserValTxData as WasmUserValTxData, AttestationSubgroupData as WasmAttestationSubgroupData, } from '../wasm/browser/geeq_core';
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The single place the SDK reaches into the WebAssembly engine.
3
+ *
4
+ * Every binding is imported by name and re-exported as a real identifier, never
5
+ * looked up by string. A string-keyed lookup here would break under any consumer
6
+ * minifier that renames module bindings, and it would fail silently for exactly
7
+ * one code path — the failure mode this indirection exists to prevent.
8
+ */
9
+ export { Keypair as WasmKeypair, WalletAddress as WasmWalletAddress, RecordType as WasmRecordType, CoinType as WasmCoinType, verify as wasmVerify, mnemonicToSeed as wasmMnemonicToSeed, generateSeedId as wasmGenerateSeedId,
10
+ // A proxy's account id, derived from its admin's public key and an index exactly as the
11
+ // Geeq wallet derives it. See src/tx/proxy.ts.
12
+ generateIrn as wasmGenerateIrn, IrnRecordType as WasmIrnRecordType,
13
+ // Transaction canonicalisation. The engine cannot *build* a transaction — every
14
+ // transaction class it exposes has a private constructor — but it is the only
15
+ // thing that can turn a Cap'n Proto message into the flattened byte form the
16
+ // chain signs over, so structures are built with capnp and flattened here.
17
+ Payload as WasmPayload,
18
+ // Both forms of the transaction are needed and they are NOT interchangeable. The
19
+ // engine flattens `UserAppTxData` without the signature — that is the preimage the
20
+ // signature is made over — and `UserAppTx` with it, which is what the chain hashes to
21
+ // identify the transaction. See src/tx/attestation.ts.
22
+ UserAppTx as WasmUserAppTx, UserAppTxData as WasmUserAppTxData,
23
+ // The validation-layer transaction — coin transfers — has the same two forms, but the
24
+ // node identifies it by the Data (signature-excluded) flatten, not the signed one.
25
+ // See src/tx/transfer.ts.
26
+ UserValTx as WasmUserValTx, UserValTxData as WasmUserValTxData, AttestationSubgroupData as WasmAttestationSubgroupData, } from '../wasm/browser/geeq_core';
27
+ //# sourceMappingURL=bindings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bindings.js","sourceRoot":"","sources":["../../../src/runtime/bindings.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,OAAO,IAAI,WAAW,EACtB,aAAa,IAAI,iBAAiB,EAClC,UAAU,IAAI,cAAc,EAC5B,QAAQ,IAAI,YAAY,EACxB,MAAM,IAAI,UAAU,EACpB,cAAc,IAAI,kBAAkB,EACpC,cAAc,IAAI,kBAAkB;AACpC,wFAAwF;AACxF,+CAA+C;AAC/C,WAAW,IAAI,eAAe,EAC9B,aAAa,IAAI,iBAAiB;AAClC,gFAAgF;AAChF,8EAA8E;AAC9E,6EAA6E;AAC7E,2EAA2E;AAC3E,OAAO,IAAI,WAAW;AACtB,iFAAiF;AACjF,mFAAmF;AACnF,sFAAsF;AACtF,uDAAuD;AACvD,SAAS,IAAI,aAAa,EAC1B,aAAa,IAAI,iBAAiB;AAClC,sFAAsF;AACtF,mFAAmF;AACnF,0BAA0B;AAC1B,SAAS,IAAI,aAAa,EAC1B,aAAa,IAAI,iBAAiB,EAClC,uBAAuB,IAAI,2BAA2B,GACvD,MAAM,2BAA2B,CAAA"}
@@ -0,0 +1,13 @@
1
+ import type { InitOptions } from '../types';
2
+ /**
3
+ * Load the Geeq engine. Idempotent and single-flight: concurrent callers share one
4
+ * load, and repeat calls after success resolve immediately.
5
+ *
6
+ * You rarely need to call this yourself — every async entry point in the SDK awaits
7
+ * it first. Call it at startup if you would rather pay the cost up front.
8
+ */
9
+ export declare function initGeeq(options?: InitOptions): Promise<void>;
10
+ /** True once the engine is loaded and the synchronous APIs are usable. */
11
+ export declare function isGeeqReady(): boolean;
12
+ /** @internal Guard for synchronous APIs that require a loaded engine. */
13
+ export declare function assertReady(what: string): void;
@@ -0,0 +1,40 @@
1
+ import { GeeqError, notInitialized } from '../errors';
2
+ import { loadWasm } from './wasm-loader.browser';
3
+ let inflight = null;
4
+ let ready = false;
5
+ /**
6
+ * Load the Geeq engine. Idempotent and single-flight: concurrent callers share one
7
+ * load, and repeat calls after success resolve immediately.
8
+ *
9
+ * You rarely need to call this yourself — every async entry point in the SDK awaits
10
+ * it first. Call it at startup if you would rather pay the cost up front.
11
+ */
12
+ export function initGeeq(options = {}) {
13
+ if (ready)
14
+ return Promise.resolve();
15
+ if (inflight === null) {
16
+ inflight = loadWasm(options.wasm)
17
+ .then(() => {
18
+ ready = true;
19
+ })
20
+ .catch((cause) => {
21
+ // Clear the cached promise so a later call can retry with, say, an
22
+ // explicit `wasm` source rather than being stuck with the first failure.
23
+ inflight = null;
24
+ throw new GeeqError('init-failed', 'Could not load the Geeq WebAssembly engine. If your bundler does not emit ' +
25
+ 'geeq_core_bg.wasm automatically, pass its URL as initGeeq({ wasm }).', { cause });
26
+ });
27
+ }
28
+ return inflight;
29
+ }
30
+ /** True once the engine is loaded and the synchronous APIs are usable. */
31
+ export function isGeeqReady() {
32
+ return ready;
33
+ }
34
+ /** @internal Guard for synchronous APIs that require a loaded engine. */
35
+ export function assertReady(what) {
36
+ if (!ready) {
37
+ throw notInitialized(what);
38
+ }
39
+ }
40
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/runtime/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAErD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAEhD,IAAI,QAAQ,GAAyB,IAAI,CAAA;AACzC,IAAI,KAAK,GAAG,KAAK,CAAA;AAEjB;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,UAAuB,EAAE;IAChD,IAAI,KAAK;QAAE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;IAEnC,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtB,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC;aAC9B,IAAI,CAAC,GAAG,EAAE;YACT,KAAK,GAAG,IAAI,CAAA;QACd,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;YACxB,mEAAmE;YACnE,yEAAyE;YACzE,QAAQ,GAAG,IAAI,CAAA;YACf,MAAM,IAAI,SAAS,CACjB,aAAa,EACb,4EAA4E;gBAC1E,sEAAsE,EACxE,EAAE,KAAK,EAAE,CACV,CAAA;QACH,CAAC,CAAC,CAAA;IACN,CAAC;IAED,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,WAAW;IACzB,OAAO,KAAK,CAAA;AACd,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,cAAc,CAAC,IAAI,CAAC,CAAA;IAC5B,CAAC;AACH,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { WasmSource } from '../types';
2
+ /**
3
+ * Browser loader: finds the engine's .wasm file and starts it.
4
+ *
5
+ * If the app passes its own `source`, that is used. Otherwise it is the .wasm file
6
+ * that ships next to this script in `dist/browser/`.
7
+ *
8
+ * `new URL('./geeq_core_bg.wasm', import.meta.url)` means "geeq_core_bg.wasm in the
9
+ * same folder as this file". Keep it written exactly this way: Vite, webpack, Rollup
10
+ * and Parcel spot this pattern and copy the .wasm into the app's build for you.
11
+ *
12
+ * The Node build swaps this module for `wasm-loader.node.ts` at bundle time.
13
+ */
14
+ export declare function loadWasm(source?: WasmSource): Promise<void>;
@@ -0,0 +1,20 @@
1
+ import initWasm from '../wasm/browser/geeq_core';
2
+ /**
3
+ * Browser loader: finds the engine's .wasm file and starts it.
4
+ *
5
+ * If the app passes its own `source`, that is used. Otherwise it is the .wasm file
6
+ * that ships next to this script in `dist/browser/`.
7
+ *
8
+ * `new URL('./geeq_core_bg.wasm', import.meta.url)` means "geeq_core_bg.wasm in the
9
+ * same folder as this file". Keep it written exactly this way: Vite, webpack, Rollup
10
+ * and Parcel spot this pattern and copy the .wasm into the app's build for you.
11
+ *
12
+ * The Node build swaps this module for `wasm-loader.node.ts` at bundle time.
13
+ */
14
+ export async function loadWasm(source) {
15
+ const wasm = source ?? new URL('./geeq_core_bg.wasm', import.meta.url);
16
+ // `module_or_path` is the option name wasm-bindgen expects. Passing `wasm`
17
+ // directly instead also works, but prints a deprecation warning.
18
+ await initWasm({ module_or_path: wasm });
19
+ }
20
+ //# sourceMappingURL=wasm-loader.browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wasm-loader.browser.js","sourceRoot":"","sources":["../../../src/runtime/wasm-loader.browser.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,2BAA2B,CAAA;AAGhD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,MAAmB;IAChD,MAAM,IAAI,GAAG,MAAM,IAAI,IAAI,GAAG,CAAC,qBAAqB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAEtE,2EAA2E;IAC3E,iEAAiE;IACjE,MAAM,QAAQ,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAA;AAC1C,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { WasmSource } from '../types';
2
+ /**
3
+ * Node loader: same job as the browser loader, but Node's `fetch` cannot read
4
+ * local files, so the .wasm is read off disk here and passed in as bytes.
5
+ * Used by the Node build; the test suite swaps in its own stub (see jest.config.js).
6
+ */
7
+ export declare function loadWasm(source?: WasmSource): Promise<void>;
@@ -0,0 +1,14 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import initWasm from '../wasm/browser/geeq_core';
3
+ /**
4
+ * Node loader: same job as the browser loader, but Node's `fetch` cannot read
5
+ * local files, so the .wasm is read off disk here and passed in as bytes.
6
+ * Used by the Node build; the test suite swaps in its own stub (see jest.config.js).
7
+ */
8
+ export async function loadWasm(source) {
9
+ const wasm = source ?? (await readFile(new URL('./geeq_core_bg.wasm', import.meta.url)));
10
+ // `module_or_path` is the option name wasm-bindgen expects. Passing `wasm`
11
+ // directly instead also works, but prints a deprecation warning.
12
+ await initWasm({ module_or_path: wasm });
13
+ }
14
+ //# sourceMappingURL=wasm-loader.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wasm-loader.node.js","sourceRoot":"","sources":["../../../src/runtime/wasm-loader.node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,QAAQ,MAAM,2BAA2B,CAAA;AAGhD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,MAAmB;IAChD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,QAAQ,CAAC,IAAI,GAAG,CAAC,qBAAqB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;IAExF,2EAA2E;IAC3E,iEAAiE;IACjE,MAAM,QAAQ,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAA;AAC1C,CAAC"}