@thruputchain/client 0.28.0 → 0.30.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 (184) hide show
  1. package/README.md +113 -18
  2. package/dist/actions-B7htk5FS.js +698 -0
  3. package/dist/actions-B7htk5FS.js.map +1 -0
  4. package/dist/actions-CIaI049y.cjs +788 -0
  5. package/dist/actions-CIaI049y.cjs.map +1 -0
  6. package/dist/actions.cjs +5 -8
  7. package/dist/actions.d.cts +4 -4
  8. package/dist/actions.d.ts +4 -4
  9. package/dist/actions.js +3 -3
  10. package/dist/{contract-D77iA2iY.js → contract-BOlNskwd.js} +235 -87
  11. package/dist/contract-BOlNskwd.js.map +1 -0
  12. package/dist/{contract-DSu2UPPm.cjs → contract-D_vxUudr.cjs} +281 -109
  13. package/dist/contract-D_vxUudr.cjs.map +1 -0
  14. package/dist/contract.cjs +1 -5
  15. package/dist/contract.d.cts +3 -4
  16. package/dist/contract.d.ts +3 -4
  17. package/dist/contract.js +2 -2
  18. package/dist/contracts.cjs +5 -5
  19. package/dist/contracts.d.cts +6 -74
  20. package/dist/contracts.d.cts.map +1 -1
  21. package/dist/contracts.d.ts +6 -74
  22. package/dist/contracts.d.ts.map +1 -1
  23. package/dist/contracts.js +4 -4
  24. package/dist/decimal-BX7abv5J.cjs +171 -0
  25. package/dist/decimal-BX7abv5J.cjs.map +1 -0
  26. package/dist/decimal-CoHOISys.js +124 -0
  27. package/dist/decimal-CoHOISys.js.map +1 -0
  28. package/dist/default_wallet-DkqsCa5C.d.ts +90 -0
  29. package/dist/default_wallet-DkqsCa5C.d.ts.map +1 -0
  30. package/dist/default_wallet-Dqs4_iTD.d.cts +90 -0
  31. package/dist/default_wallet-Dqs4_iTD.d.cts.map +1 -0
  32. package/dist/{dev_wallet-CAbOSrak.cjs → dev_wallet-BVChhV6j.cjs} +85 -6
  33. package/dist/dev_wallet-BVChhV6j.cjs.map +1 -0
  34. package/dist/{dev_wallet-CU3RpQLm.js → dev_wallet-D9LuPZ-h.js} +84 -5
  35. package/dist/dev_wallet-D9LuPZ-h.js.map +1 -0
  36. package/dist/{execution-J5jkXhV1.d.cts → execution-pSt6k620.d.cts} +23 -50
  37. package/dist/execution-pSt6k620.d.cts.map +1 -0
  38. package/dist/{execution-XJ0iwFaX.d.ts → execution-uiuFPV0d.d.ts} +23 -50
  39. package/dist/execution-uiuFPV0d.d.ts.map +1 -0
  40. package/dist/{hex-DIcaALXL.js → hex-B8D-jBgz.js} +2 -2
  41. package/dist/{hex-DIcaALXL.js.map → hex-B8D-jBgz.js.map} +1 -1
  42. package/dist/{hex-DkGpiZ5e.cjs → hex-CSDZ9d6z.cjs} +2 -2
  43. package/dist/{hex-DkGpiZ5e.cjs.map → hex-CSDZ9d6z.cjs.map} +1 -1
  44. package/dist/{index-soFVQX9j.d.cts → index-B1efA-Y_.d.ts} +24 -21
  45. package/dist/index-B1efA-Y_.d.ts.map +1 -0
  46. package/dist/{index-C3HVRvQd.d.ts → index-BGmH_Sm7.d.cts} +12 -62
  47. package/dist/index-BGmH_Sm7.d.cts.map +1 -0
  48. package/dist/{index-DeS1S0m-.d.ts → index-BmOG68Hd.d.ts} +39 -17
  49. package/dist/index-BmOG68Hd.d.ts.map +1 -0
  50. package/dist/{index-B5KqSHeL.d.cts → index-BsvYcU_Y.d.cts} +2 -2
  51. package/dist/{index-B5KqSHeL.d.cts.map → index-BsvYcU_Y.d.cts.map} +1 -1
  52. package/dist/{index-CtjZ61tl.d.cts → index-CG-q0j9w.d.ts} +12 -62
  53. package/dist/index-CG-q0j9w.d.ts.map +1 -0
  54. package/dist/index-CPtBvHE8.d.ts +145 -0
  55. package/dist/index-CPtBvHE8.d.ts.map +1 -0
  56. package/dist/{index-DfmDUk5Y.d.ts → index-DBKsOzCN.d.cts} +24 -21
  57. package/dist/index-DBKsOzCN.d.cts.map +1 -0
  58. package/dist/{index-Bb01ytjJ.d.ts → index-Dtv_GV6M.d.ts} +40 -11
  59. package/dist/index-Dtv_GV6M.d.ts.map +1 -0
  60. package/dist/{index-CtjWsAXV.d.cts → index-JKm4TBlY.d.cts} +40 -11
  61. package/dist/index-JKm4TBlY.d.cts.map +1 -0
  62. package/dist/index-Xre-0Jka.d.cts +145 -0
  63. package/dist/index-Xre-0Jka.d.cts.map +1 -0
  64. package/dist/{index-CedOvhGY.d.cts → index-ozfbEuYI.d.cts} +39 -17
  65. package/dist/index-ozfbEuYI.d.cts.map +1 -0
  66. package/dist/index.cjs +40 -68
  67. package/dist/index.cjs.map +1 -1
  68. package/dist/index.d.cts +11 -17
  69. package/dist/index.d.cts.map +1 -1
  70. package/dist/index.d.ts +11 -17
  71. package/dist/index.d.ts.map +1 -1
  72. package/dist/index.js +27 -38
  73. package/dist/index.js.map +1 -1
  74. package/dist/provider.cjs +3 -3
  75. package/dist/provider.cjs.map +1 -1
  76. package/dist/provider.d.cts +2 -1
  77. package/dist/provider.d.ts +2 -1
  78. package/dist/provider.js +3 -3
  79. package/dist/provider.js.map +1 -1
  80. package/dist/{codec-Bxlt1gKO.js → readError-B3Rz7rgs.js} +359 -56
  81. package/dist/readError-B3Rz7rgs.js.map +1 -0
  82. package/dist/{codec-BcK8ASsg.cjs → readError-COcEDNoZ.cjs} +363 -96
  83. package/dist/readError-COcEDNoZ.cjs.map +1 -0
  84. package/dist/requestAirdrop-DBCOST2B.d.ts +1818 -0
  85. package/dist/requestAirdrop-DBCOST2B.d.ts.map +1 -0
  86. package/dist/requestAirdrop-T1eVn3l5.d.cts +1818 -0
  87. package/dist/requestAirdrop-T1eVn3l5.d.cts.map +1 -0
  88. package/dist/sendInvocation-185ZJrta.cjs +583 -0
  89. package/dist/sendInvocation-185ZJrta.cjs.map +1 -0
  90. package/dist/sendInvocation-DBaNWhr3.js +439 -0
  91. package/dist/sendInvocation-DBaNWhr3.js.map +1 -0
  92. package/dist/signed-op.cjs +2 -2
  93. package/dist/signed-op.d.cts +2 -2
  94. package/dist/signed-op.d.ts +1 -1
  95. package/dist/signed-op.js +2 -2
  96. package/dist/{signedOp-DAucp6xg.cjs → signedOp-CVyeJ5ig.cjs} +3 -3
  97. package/dist/{signedOp-DAucp6xg.cjs.map → signedOp-CVyeJ5ig.cjs.map} +1 -1
  98. package/dist/{signedOp-DpmUpH-e.js → signedOp-D6WYZG9j.js} +3 -3
  99. package/dist/{signedOp-DpmUpH-e.js.map → signedOp-D6WYZG9j.js.map} +1 -1
  100. package/dist/{signed_op-_lR85dn2.cjs → signed_op-BBsDKOlD.cjs} +4 -4
  101. package/dist/{signed_op-_lR85dn2.cjs.map → signed_op-BBsDKOlD.cjs.map} +1 -1
  102. package/dist/{signed_op-zGq4eBo8.d.ts → signed_op-DHb4n2JO.d.cts} +3 -3
  103. package/dist/{signed_op-D2usgASc.d.cts.map → signed_op-DHb4n2JO.d.cts.map} +1 -1
  104. package/dist/{signed_op-D2usgASc.d.cts → signed_op-Dfa8WD0j.d.ts} +3 -3
  105. package/dist/{signed_op-zGq4eBo8.d.ts.map → signed_op-Dfa8WD0j.d.ts.map} +1 -1
  106. package/dist/{signed_op-CwN-_CXw.js → signed_op-h9X9-vBL.js} +3 -3
  107. package/dist/{signed_op-CwN-_CXw.js.map → signed_op-h9X9-vBL.js.map} +1 -1
  108. package/dist/transport-BhWZxHcz.cjs +528 -0
  109. package/dist/transport-BhWZxHcz.cjs.map +1 -0
  110. package/dist/transport-EyDYuibb.js +504 -0
  111. package/dist/transport-EyDYuibb.js.map +1 -0
  112. package/dist/transport.cjs +6 -13
  113. package/dist/transport.d.cts +3 -3
  114. package/dist/transport.d.ts +3 -3
  115. package/dist/transport.js +4 -4
  116. package/dist/types-VYjJcTip.d.cts +161 -0
  117. package/dist/types-VYjJcTip.d.cts.map +1 -0
  118. package/dist/types-VYjJcTip.d.ts +161 -0
  119. package/dist/types-VYjJcTip.d.ts.map +1 -0
  120. package/dist/{validation-eXATmgO0.js → validation-BLQ64Dfh.js} +3 -3
  121. package/dist/validation-BLQ64Dfh.js.map +1 -0
  122. package/dist/{validation-4w-vDGAi.cjs → validation-CZqtmMLJ.cjs} +3 -3
  123. package/dist/validation-CZqtmMLJ.cjs.map +1 -0
  124. package/dist/{wallet-BNKgOXrF.js → wallet-NlZiI4-3.js} +161 -77
  125. package/dist/wallet-NlZiI4-3.js.map +1 -0
  126. package/dist/{wallet-7R5M_7h4.cjs → wallet-UvyXtxh5.cjs} +161 -77
  127. package/dist/wallet-UvyXtxh5.cjs.map +1 -0
  128. package/dist/wallet.cjs +2 -8
  129. package/dist/wallet.d.cts +4 -3
  130. package/dist/wallet.d.ts +4 -3
  131. package/dist/wallet.js +3 -3
  132. package/package.json +5 -5
  133. package/dist/actions-B5-CjpEF.cjs +0 -513
  134. package/dist/actions-B5-CjpEF.cjs.map +0 -1
  135. package/dist/actions-C1SMLWO5.js +0 -430
  136. package/dist/actions-C1SMLWO5.js.map +0 -1
  137. package/dist/artifact-BM_MVzhL.d.cts +0 -35
  138. package/dist/artifact-BM_MVzhL.d.cts.map +0 -1
  139. package/dist/artifact-BM_MVzhL.d.ts +0 -35
  140. package/dist/artifact-BM_MVzhL.d.ts.map +0 -1
  141. package/dist/client-jOZxB8yW.d.cts +0 -798
  142. package/dist/client-jOZxB8yW.d.cts.map +0 -1
  143. package/dist/client-jOZxB8yW.d.ts +0 -798
  144. package/dist/client-jOZxB8yW.d.ts.map +0 -1
  145. package/dist/codec-BcK8ASsg.cjs.map +0 -1
  146. package/dist/codec-Bxlt1gKO.js.map +0 -1
  147. package/dist/contract-D77iA2iY.js.map +0 -1
  148. package/dist/contract-DSu2UPPm.cjs.map +0 -1
  149. package/dist/dev_wallet-CAbOSrak.cjs.map +0 -1
  150. package/dist/dev_wallet-CU3RpQLm.js.map +0 -1
  151. package/dist/execution-J5jkXhV1.d.cts.map +0 -1
  152. package/dist/execution-XJ0iwFaX.d.ts.map +0 -1
  153. package/dist/index-Bb01ytjJ.d.ts.map +0 -1
  154. package/dist/index-C3HVRvQd.d.ts.map +0 -1
  155. package/dist/index-CIHK7Ew9.d.cts +0 -303
  156. package/dist/index-CIHK7Ew9.d.cts.map +0 -1
  157. package/dist/index-CIHK7Ew9.d.ts +0 -303
  158. package/dist/index-CIHK7Ew9.d.ts.map +0 -1
  159. package/dist/index-CedOvhGY.d.cts.map +0 -1
  160. package/dist/index-CtjWsAXV.d.cts.map +0 -1
  161. package/dist/index-CtjZ61tl.d.cts.map +0 -1
  162. package/dist/index-DeS1S0m-.d.ts.map +0 -1
  163. package/dist/index-DfmDUk5Y.d.ts.map +0 -1
  164. package/dist/index-soFVQX9j.d.cts.map +0 -1
  165. package/dist/readError-CCVlmBhj.cjs +0 -624
  166. package/dist/readError-CCVlmBhj.cjs.map +0 -1
  167. package/dist/readError-D1dppovI.js +0 -571
  168. package/dist/readError-D1dppovI.js.map +0 -1
  169. package/dist/readViews-DbWELMMq.d.cts +0 -609
  170. package/dist/readViews-DbWELMMq.d.cts.map +0 -1
  171. package/dist/readViews-nV3jbpYc.d.ts +0 -609
  172. package/dist/readViews-nV3jbpYc.d.ts.map +0 -1
  173. package/dist/sendInvocation-Dsr9ij5P.cjs +0 -661
  174. package/dist/sendInvocation-Dsr9ij5P.cjs.map +0 -1
  175. package/dist/sendInvocation-tBmf8haQ.js +0 -505
  176. package/dist/sendInvocation-tBmf8haQ.js.map +0 -1
  177. package/dist/transport-5FPeNwuv.cjs +0 -279
  178. package/dist/transport-5FPeNwuv.cjs.map +0 -1
  179. package/dist/transport-IrhVlS4w.js +0 -261
  180. package/dist/transport-IrhVlS4w.js.map +0 -1
  181. package/dist/validation-4w-vDGAi.cjs.map +0 -1
  182. package/dist/validation-eXATmgO0.js.map +0 -1
  183. package/dist/wallet-7R5M_7h4.cjs.map +0 -1
  184. package/dist/wallet-BNKgOXrF.js.map +0 -1
@@ -1,8 +1,8 @@
1
- import { F as RpcContractDeploymentResult, Ft as TransportRequestOptions, Mt as UnsupportedRpcValue, V as RpcEffectiveContractResult, t as RpcClient } from "./client-jOZxB8yW.cjs";
2
- import { Ot as ContractSpec, k as CoreThruputClient } from "./readViews-DbWELMMq.cjs";
3
- import { t as ContractArtifactSpec } from "./artifact-BM_MVzhL.cjs";
4
- import { F as WalletAccount, a as SubmissionEvidence, k as PrepareTransactionRequest } from "./execution-J5jkXhV1.cjs";
5
- import { Invocation, NetworkHash, SHA256Hash, SignedTransaction, Transaction } from "@thruputchain/protocol";
1
+ import { Bt as ContractSpec, Wi as UnsupportedRpcValue, Yr as RpcContractDeploymentResult, b as SubmissionEvidence, cn as TransportRequestOptions, i as RpcClient, nt as CoreThruputClient, ti as RpcEffectiveContractResult } from "./requestAirdrop-T1eVn3l5.cjs";
2
+ import { b as ContractArtifactSpec } from "./index-ozfbEuYI.cjs";
3
+ import { t as DefaultWallet } from "./default_wallet-Dqs4_iTD.cjs";
4
+ import { D as WalletAccount, x as PrepareTransactionRequest } from "./execution-pSt6k620.cjs";
5
+ import { AuthTokenNode, Invocation, NetworkHash, SHA256Hash, SignedTransaction, Transaction } from "@thruputchain/protocol";
6
6
 
7
7
  //#region src/actions/public/getContractSpec.d.ts
8
8
  /** Snapshot deployment evidence and its authenticated metadata, if deployed. */
@@ -43,10 +43,37 @@ interface WalletRequests {
43
43
  wrapper: "DefaultWallet.execute" | "DefaultWallet.deploy";
44
44
  requestedCalls: Invocation[];
45
45
  }
46
+ /** A mint in its original position, including the bytes of an unreadable grant. */
47
+ type WalletMint = {
48
+ kind: "decoded";
49
+ node: AuthTokenNode;
50
+ } | {
51
+ kind: "unreadable";
52
+ bytes: Uint8Array;
53
+ };
54
+ /** Calls and grants requested by a wallet root, in calldata order. */
55
+ interface WalletRequestDescription {
56
+ wrapper: WalletRequests["wrapper"];
57
+ mints: WalletMint[];
58
+ calls: {
59
+ invocation: Invocation; /** Ordered references to mints or to tokens returned by earlier calls. */
60
+ tokens: DefaultWallet.v0_1.ExecuteArgs["calls"][number]["tokens"];
61
+ }[];
62
+ }
63
+ /**
64
+ * Describe the grants and calls in a known DefaultWallet root before execution.
65
+ * The caller must establish wallet identity. An unknown selector returns null;
66
+ * malformed wrapper calldata throws. An unreadable mint retains its bytes and
67
+ * position. Token references describe requests; they do not establish that a
68
+ * token exists or will be returned.
69
+ */
70
+ declare function describeDefaultWalletRequests(root: Invocation): WalletRequestDescription | null;
46
71
  /**
47
72
  * Interpret a known DefaultWallet root using built-in binding descriptors.
48
73
  * Call only after identifying the root as DefaultWallet; matching selectors
49
- * alone do not establish wallet identity. Malformed recognized inputs throw.
74
+ * alone do not establish wallet identity. Malformed recognized inputs throw,
75
+ * as does an `execute` that mints or forwards auth tokens. To read grants,
76
+ * use {@link describeDefaultWalletRequests}.
50
77
  */
51
78
  declare function decodeDefaultWalletRequests(root: Invocation): WalletRequests | null;
52
79
  //#endregion
@@ -73,9 +100,11 @@ declare function readTransactionInput(client: RpcClient, request: {
73
100
  //#region src/actions/wallet/sendTransaction.d.ts
74
101
  /**
75
102
  * Serialize and submit once through the native RPC boundary.
76
- * Unknown admission throws TransactionObservationError with the signed bytes and
77
- * destination discovery network; that network does not prove the signing network
78
- * of an already-signed envelope. RPC and transport failures propagate unchanged.
103
+ * Every failure has `transaction` facts with the signed bytes and destination
104
+ * discovery network; that network does not prove the signing network of an
105
+ * already-signed envelope. Unknown admission throws code
106
+ * `transactionAdmissionUnsupported`. RPC and transport failures keep their
107
+ * code, with outcome `unknown`, or `notSubmitted` for a local request error.
79
108
  */
80
109
  declare function sendTransaction(client: Pick<RpcClient, "sendTransaction" | "discovery">, signedTx: SignedTransaction, options?: TransportRequestOptions): Promise<SHA256Hash>;
81
110
  //#endregion
@@ -86,5 +115,5 @@ declare function sendInvocation(client: Pick<CoreThruputClient, "getChainTip" |
86
115
  onSigned?: (evidence: SubmissionEvidence) => void | Promise<void>;
87
116
  }): Promise<SHA256Hash>;
88
117
  //#endregion
89
- export { WalletRequests as a, getEffectiveContractSpec as c, readTransactionInput as i, ContractSpecResult as l, sendTransaction as n, decodeDefaultWalletRequests as o, VerifiedTransactionInput as r, EffectiveContractSpecResult as s, sendInvocation as t, getContractSpec as u };
90
- //# sourceMappingURL=index-CtjWsAXV.d.cts.map
118
+ export { WalletMint as a, decodeDefaultWalletRequests as c, getEffectiveContractSpec as d, ContractSpecResult as f, readTransactionInput as i, describeDefaultWalletRequests as l, sendTransaction as n, WalletRequestDescription as o, getContractSpec as p, VerifiedTransactionInput as r, WalletRequests as s, sendInvocation as t, EffectiveContractSpecResult as u };
119
+ //# sourceMappingURL=index-JKm4TBlY.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-JKm4TBlY.d.cts","names":[],"sources":["../src/actions/public/getContractSpec.ts","../src/actions/public/getEffectiveContractSpec.ts","../src/actions/public/decodeWalletRequests.ts","../src/actions/public/readTransactionInput.ts","../src/actions/wallet/sendTransaction.ts","../src/actions/wallet/sendInvocation.ts"],"mappings":";;;;;;;;UAoBiB,kBAAA,SAA2B,2BAA2B;EACrE,YAAA,EAAc,oBAAA;AAAA;;;;;;iBAQM,eAAA,CACpB,MAAA,EAAQ,SAAA,EACR,OAAA;EAAW,OAAA,EAAS,UAAA;AAAA,GACpB,OAAA,GAAU,uBAAA,GACT,OAAA,CAAQ,kBAAA;;;UCVM,2BAAA,SAAoC,0BAAA;EACnD,YAAA,EAAc,oBAAA;EDJC;ECMf,eAAA;IAAmB,IAAA;IAAuB,IAAA,EAAM,YAAA;EAAA;AAAA;;;ADLd;AAQpC;;iBCKsB,wBAAA,CACpB,MAAA,EAAQ,SAAA,EACR,OAAA;EAAW,OAAA,EAAS,UAAA;EAAY,OAAA;AAAA,GAChC,OAAA,GAAU,uBAAA,GACT,OAAA,CAAQ,2BAAA;;;;UCvBM,cAAA;EACf,OAAA;EACA,cAAA,EAAgB,UAAU;AAAA;AFG5B;AAAA,KECY,UAAA;EACN,IAAA;EAAiB,IAAA,EAAM,aAAA;AAAA;EACvB,IAAA;EAAoB,KAAA,EAAO,UAAU;AAAA;AFFP;AAAA,UEKnB,wBAAA;EACf,OAAA,EAAS,cAAA;EACT,KAAA,EAAO,UAAA;EACP,KAAA;IACE,UAAA,EAAY,UAAA,EFEJ;IEAR,MAAA,EAAQ,aAAA,CAAc,IAAA,CAAK,WAAA;EAAA;AAAA;;;;;;;;iBAWf,6BAAA,CACd,IAAA,EAAM,UAAA,GACL,wBAAwB;;;;AFZE;;;;iBEiCb,2BAAA,CACd,IAAA,EAAM,UAAA,GACL,cAAc;;;;KCnDL,wBAAA;EAEN,MAAA;EACA,eAAA,EAAiB,UAAA;EACjB,WAAA;EACA,cAAA,EAAgB,UAAA;EAChB,WAAA,EAAa,WAAA;AAAA;EAEb,MAAA;AAAA,IACF,mBAAA;;AHLgC;AAQpC;;;iBGIsB,oBAAA,CACpB,MAAA,EAAQ,SAAA,EACR,OAAA;EAAW,eAAA,EAAiB,UAAA;AAAA,GAC5B,OAAA,GAAU,uBAAA,GACT,OAAA,CAAQ,wBAAA;;;;;;;AHjBX;;;;iBIWsB,eAAA,CACpB,MAAA,EAAQ,IAAA,CAAK,SAAA,oCACb,QAAA,EAAU,iBAAA,EACV,OAAA,GAAU,uBAAA,GACT,OAAA,CAAQ,UAAA;;;AJfX;AAAA,iBKkBsB,cAAA,CACpB,MAAA,EAAQ,IAAA,CACN,iBAAA,uEAGF,OAAA,EAAS,aAAA,EACT,WAAA,EAAa,WAAA,EACb,OAAA,EAAS,yBAAA,EACT,QAAA;EACE,MAAA,GAAS,WAAA;EACT,QAAA,IAAY,QAAA,EAAU,kBAAA,YAA8B,OAAA;AAAA,IAErD,OAAA,CAAQ,UAAA"}
@@ -0,0 +1,145 @@
1
+ import { a as WalletCapabilities, i as WalletAccount, l as WalletProviderInfo, n as SignTransactionResult, o as WalletProvider, r as SubmitTransactionResult, s as WalletProviderError, t as ProviderRequest, u as WalletSession } from "./types-VYjJcTip.cjs";
2
+ import { SignedTransaction, Transaction } from "@thruputchain/protocol";
3
+
4
+ //#region src/provider/validation.d.ts
5
+ /** Maximum decoded signed XDR size: 1,048,576 bytes (1 MiB). */
6
+ declare const MAX_TRANSACTION_BYTES = 1048576;
7
+ /**
8
+ * Maximum unsigned XDR size: 1,048,460 bytes. Providers must enforce this before
9
+ * requesting user approval. Reserves 116 bytes within {@link MAX_TRANSACTION_BYTES}
10
+ * for the Ed25519 pubkey envelope: the signature vector count, key ID, scheme,
11
+ * and 64-byte signature, plus the present `pubkey_claim_key` option holding the
12
+ * scheme-tagged 32-byte key.
13
+ */
14
+ declare const MAX_UNSIGNED_TRANSACTION_BYTES: number;
15
+ /** Maximum accounts in one session. */
16
+ declare const MAX_WALLET_ACCOUNTS = 32;
17
+ /** Current native DefaultWallet execute call limit. */
18
+ declare const MAX_DEFAULT_WALLET_CALLS = 16;
19
+ /** Validate scoped DefaultWallet capabilities. Does not establish authorization. */
20
+ declare function parseWalletCapabilities(value: unknown): WalletCapabilities;
21
+ /** Validate an unprefixed, case-sensitive base58 address, public key, or hash. */
22
+ declare function parseWalletIdentifier(value: unknown): string;
23
+ /** Validate a case-sensitive, unprefixed base58 network hash. */
24
+ declare function parseWalletNetworkHash(value: unknown): string;
25
+ /**
26
+ * Validate and freeze an account snapshot, including a non-small-order, prime-order
27
+ * Ed25519 key and its derived address. The nonce is canonical decimal u64 account
28
+ * derivation data, not a transaction nonce. Rejects extra fields and noncanonical
29
+ * values rather than normalizing them; malformed input throws code -32602.
30
+ */
31
+ declare function parseWalletAccount(value: unknown): WalletAccount;
32
+ /**
33
+ * Strictly validate a session and return a frozen snapshot with frozen accounts.
34
+ * Requires a canonical network hash and at most {@link MAX_WALLET_ACCOUNTS} unique
35
+ * account addresses. Empty accounts are valid for an unauthorized origin; this
36
+ * parser does not enforce the nonempty result required by a successful `connect`.
37
+ */
38
+ declare function parseWalletSession(value: unknown): WalletSession;
39
+ /** Validate bounded display metadata; never render provider names as HTML. */
40
+ declare function parseWalletProviderInfo(value: unknown): WalletProviderInfo;
41
+ /**
42
+ * Validate a provider's structural boundary and return the original live object.
43
+ * Preserves identity and method receivers; metadata is validated, not snapshotted.
44
+ * Unlike {@link parseWalletAccount} and {@link parseWalletSession}, this does not
45
+ * freeze the input. Checks versioned metadata and callable `request`/`on` members,
46
+ * not their behavior, permissions, returned values, or the provider's trustworthiness.
47
+ */
48
+ declare function parseWalletProvider(value: unknown): WalletProvider;
49
+ /**
50
+ * Reconstruct a serialized provider error, without relying on `instanceof`.
51
+ * Requires a recognized {@link WalletProviderErrorCode} and a message of at most
52
+ * 1,024 characters. Invalid errors throw a new error with code -32602.
53
+ */
54
+ declare function parseWalletProviderError(value: unknown): WalletProviderError;
55
+ /**
56
+ * Decode bounded canonical unsigned XDR, rejecting trailing or altered encodings.
57
+ * Accepts lowercase, even-length, 0x-prefixed hex within
58
+ * {@link MAX_UNSIGNED_TRANSACTION_BYTES}; providers must check this before approval.
59
+ * Does not establish account authorization; use {@link assertWalletTransaction}
60
+ * to check the transaction's account claim and enforce origin permission separately.
61
+ */
62
+ declare function parseTransactionHex(value: unknown): Transaction;
63
+ /** Decode bounded canonical signed XDR; signature verification is separate. */
64
+ declare function parseSignedTransactionHex(value: unknown): SignedTransaction;
65
+ /**
66
+ * Parse the exact request union into a new request object, including bounded,
67
+ * canonical XDR. Unknown methods fail with 4200; malformed known requests fail
68
+ * with -32602. This validates input, not origin permission or prior approval.
69
+ * Bridges must bound raw messages before JSON parsing: at most 2,096,922 unsigned
70
+ * or 2,097,154 signed transaction-hex characters, including 0x.
71
+ */
72
+ declare function parseProviderRequest(value: unknown): ProviderRequest;
73
+ /**
74
+ * Validate a signing response's wire structure and return a new result object.
75
+ * Checks canonical signed XDR and hash encoding, not signature, hash correctness,
76
+ * or approval. Use {@link verifySignTransactionResult} for cryptographic validation.
77
+ */
78
+ declare function parseSignTransactionResult(value: unknown): SignTransactionResult;
79
+ /**
80
+ * Validate a submission response's hash encoding and return a new result object.
81
+ * Does not compare the hash to approved bytes or confirm broadcast or execution.
82
+ */
83
+ declare function parseSubmitTransactionResult(value: unknown): SubmitTransactionResult;
84
+ /** Require the root address and complete pubkey claim to match a wire account. */
85
+ declare function assertWalletTransaction(tx: Transaction, account: WalletAccount): void;
86
+ /**
87
+ * Verify unchanged XDR, a single strict network-bound signature, and receipt hash.
88
+ * Requires the exact unsigned transaction bytes and matching root address/pubkey
89
+ * claim, and an attached `pubkey_claim_key` equal to the account's Ed25519 key.
90
+ * The signature must be Ed25519 with public-key ID zero, verified over
91
+ * `transactionSignaturePreimage(networkHash, tx)` with ZIP-215 disabled and both
92
+ * key and signature point R non-small-order and prime-order. The hash is SHA-256
93
+ * of unsigned XDR, excluding signatures and network.
94
+ *
95
+ * @param networkHash - A 32-byte base58 identifier from the authorized session.
96
+ * @returns A frozen verified result. This does not establish origin permission
97
+ * or a retained approval to submit; the provider must enforce both separately.
98
+ *
99
+ * @remarks
100
+ * Requires Web Crypto (HTTPS or localhost in browsers). Invalid signing results
101
+ * throw code -32603; invalid expected inputs fail their boundary validation first.
102
+ *
103
+ * @see https://www.thruput.network/docs/typescript/reference/wallet-provider/
104
+ */
105
+ declare function verifySignTransactionResult(value: unknown, transaction: string, account: WalletAccount, networkHash: string): Promise<SignTransactionResult>;
106
+ //#endregion
107
+ //#region src/provider/discovery.d.ts
108
+ /** Discovery request event name. */
109
+ declare const REQUEST_PROVIDER_EVENT = "thruput:requestProvider";
110
+ /** Announcement detail is the provider itself, not an envelope. */
111
+ declare const ANNOUNCE_PROVIDER_EVENT = "thruput:announceProvider";
112
+ /** Maximum distinct provider IDs retained by one discovery subscription. */
113
+ declare const MAX_DISCOVERED_PROVIDERS = 32;
114
+ /**
115
+ * Validate and announce a live provider now and on each discovery request.
116
+ * Announcement detail is the provider itself. Defaults to `window`; pass an
117
+ * `EventTarget` outside a browser. Importing this module needs no browser globals.
118
+ *
119
+ * @returns Idempotent cleanup that removes the request listener. It stops future
120
+ * announcements from this registration, but does not retract a provider already
121
+ * discovered, disconnect sessions, or revoke permissions. There is no unregister event.
122
+ *
123
+ * @see https://www.thruput.network/docs/typescript/reference/wallet-provider/
124
+ */
125
+ declare function registerWalletProvider(provider: WalletProvider, target?: EventTarget): () => void;
126
+ /**
127
+ * Discover multiple providers in either load order, reporting each valid ID once.
128
+ * Installs the announcement listener before requesting providers. Malformed
129
+ * announcements are ignored; the first valid announcement for an ID wins, up to
130
+ * {@link MAX_DISCOVERED_PROVIDERS} IDs per subscription. IDs remain reserved until
131
+ * cleanup, even if a provider stops announcing. Discovery does not track removals.
132
+ *
133
+ * Defaults to `window`; pass an `EventTarget` outside a browser. IDs and names can
134
+ * be spoofed by page scripts: discovery validates shape, not wallet identity or trust.
135
+ * Render names as text, never HTML.
136
+ *
137
+ * @returns Idempotent cleanup that removes the listener and releases retained IDs.
138
+ * It does not disconnect discovered providers or revoke their permissions.
139
+ *
140
+ * @see https://www.thruput.network/docs/typescript/wallet-integration/
141
+ */
142
+ declare function discoverWalletProviders(listener: (provider: WalletProvider) => void, target?: EventTarget): () => void;
143
+ //#endregion
144
+ export { parseWalletSession as C, parseWalletProviderInfo as S, parseWalletCapabilities as _, registerWalletProvider as a, parseWalletProvider as b, MAX_UNSIGNED_TRANSACTION_BYTES as c, parseProviderRequest as d, parseSignTransactionResult as f, parseWalletAccount as g, parseTransactionHex as h, discoverWalletProviders as i, MAX_WALLET_ACCOUNTS as l, parseSubmitTransactionResult as m, MAX_DISCOVERED_PROVIDERS as n, MAX_DEFAULT_WALLET_CALLS as o, parseSignedTransactionHex as p, REQUEST_PROVIDER_EVENT as r, MAX_TRANSACTION_BYTES as s, ANNOUNCE_PROVIDER_EVENT as t, assertWalletTransaction as u, parseWalletIdentifier as v, verifySignTransactionResult as w, parseWalletProviderError as x, parseWalletNetworkHash as y };
145
+ //# sourceMappingURL=index-Xre-0Jka.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-Xre-0Jka.d.cts","names":[],"sources":["../src/provider/validation.ts","../src/provider/discovery.ts"],"mappings":";;;;;cAuCa,qBAAA;AAAb;;;;AAAkC;AAQlC;;AARA,cAQa,8BAAA;;cAIA,mBAAA;AAAb;AAAA,cAEa,wBAAA;;iBAGG,uBAAA,CAAwB,KAAA,YAAiB,kBAAkB;AAL3C;AAAA,iBAkDhB,qBAAA,CAAsB,KAAc;;iBAYpC,sBAAA,CAAuB,KAAc;;AA5DhB;AAGrC;;;;iBAmEgB,kBAAA,CAAmB,KAAA,YAAiB,aAAa;AAtBjE;;;;AAAoD;AAYpD;AAZA,iBA+DgB,kBAAA,CAAmB,KAAA,YAAiB,aAAa;;iBAqBjD,uBAAA,CAAwB,KAAA,YAAiB,kBAAkB;AAxEtB;AAUrD;;;;AAAiE;AAyCjE;AAnDqD,iBAuGrC,mBAAA,CAAoB,KAAA,YAAiB,cAAc;;;AApDF;AAqBjE;;iBAsDgB,wBAAA,CAAyB,KAAA,YAAiB,mBAAmB;;AAtDF;AA+B3E;;;;AAAmE;iBA2DnD,mBAAA,CAAoB,KAAA,YAAiB,WAAW;;iBAahD,yBAAA,CAA0B,KAAA,YAAiB,iBAAiB;;AAjDC;AAoC7E;;;;AAAgE;iBAgChD,oBAAA,CAAqB,KAAA,YAAiB,eAAe;;;;AAnBO;AAmB5E;iBAgEgB,0BAAA,CACd,KAAA,YACC,qBAAqB;;;AAlE6C;AAgErE;iBAiBgB,4BAAA,CACd,KAAA,YACC,uBAAuB;;iBAOV,uBAAA,CACd,EAAA,EAAI,WAAA,EACJ,OAAA,EAAS,aAAa;AA1BA;AAexB;;;;AAE0B;AAO1B;;;;;;;;;AAEwB;AA4CxB;;;AAtEwB,iBAsEF,2BAAA,CACpB,KAAA,WACA,WAAA,UACA,OAAA,EAAS,aAAA,EACT,WAAA,WACC,OAAA,CAAQ,qBAAA;;;;cC5bE,sBAAA;;cAEA,uBAAA;;cAEA,wBAAA;;AD+BqB;AAQlC;;;;AAE2D;AAE3D;;;;iBCpBgB,sBAAA,CACd,QAAA,EAAU,cAAA,EACV,MAAA,GAAQ,WAA6B;ADoBvC;;;;AAAqC;AAGrC;;;;AAA2E;AA6C3E;;;;AAAoD;AAYpD;AA5DA,iBCSgB,uBAAA,CACd,QAAA,GAAW,QAAA,EAAU,cAAA,WACrB,MAAA,GAAQ,WAA6B"}
@@ -1,7 +1,39 @@
1
- import { A as ThruputClient, Ft as ContractTypeDef, Ot as ContractSpec, Pt as ContractType, l as ContractMethod, y as ContractViewOptions } from "./readViews-DbWELMMq.cjs";
1
+ import { Bt as ContractSpec$1, K as ContractViewOptions, Kt as ContractType, R as ContractMethod, qt as ContractTypeDef$1, rt as ThruputClient } from "./requestAirdrop-T1eVn3l5.cjs";
2
2
  import { Calldata, Contract, ContractAddress, Invocation, SHA256Hash } from "@thruputchain/protocol";
3
+ import { ContractSpec } from "@thruputchain/contract-spec";
3
4
  import { FixedArray, FixedBytes as FixedBytes$1, XdrCodec, fixedArray, fixedBytes } from "@thruputchain/xdr";
4
5
 
6
+ //#region src/contract/artifact.d.ts
7
+ /** Authenticated metadata. Native identifiers do not authenticate runtime code. */
8
+ type ContractArtifactSpec = {
9
+ kind: "native";
10
+ } | {
11
+ kind: "unsupportedContract";
12
+ contractType: number;
13
+ } | {
14
+ kind: "unsupportedFormat";
15
+ formatVersion: number;
16
+ } | {
17
+ kind: "absent";
18
+ } | {
19
+ kind: "unsupportedSchema";
20
+ schemaVersion: number;
21
+ bytes: Uint8Array;
22
+ } | {
23
+ kind: "spec";
24
+ schemaVersion: 1;
25
+ spec: ContractSpec;
26
+ };
27
+ /**
28
+ * Verify complete Contract XDR against the requested hash, then read its spec.
29
+ * Rejects malformed known envelopes. Unknown versions remain explicit results.
30
+ * Reads RV32 artifact formats v5, v6 and v7. Reads v5 as having no spec. In v6
31
+ * and v7, validates all extension framing and skips unknown kinds. Only the
32
+ * contract-spec extension body is interpreted.
33
+ * This proves byte identity, not deployment, executable validity, or spec truth.
34
+ */
35
+ declare function readContractArtifactSpec(contractXdr: Uint8Array, expectedHash: SHA256Hash): ContractArtifactSpec;
36
+ //#endregion
5
37
  //#region src/contract/encode.d.ts
6
38
  /**
7
39
  * Resolve a contract-spec type into the XDR/CXS codec used to encode values.
@@ -28,14 +60,14 @@ declare function resolveCodec(ty: ContractType, namedCodecs?: Record<string, Xdr
28
60
  * );
29
61
  * ```
30
62
  */
31
- declare function encodeCalldata(spec: ContractSpec, interfaceName: string, methodName: string, args: unknown[], namedCodecs: Record<string, XdrCodec<unknown>>): Calldata;
63
+ declare function encodeCalldata(spec: ContractSpec$1, interfaceName: string, methodName: string, args: unknown[], namedCodecs: Record<string, XdrCodec<unknown>>): Calldata;
32
64
  /**
33
65
  * Decode contract calldata into an object keyed by argument name.
34
66
  *
35
67
  * This is primarily useful for tooling, tests, and debugging generated
36
68
  * invocations.
37
69
  */
38
- declare function decodeCalldata(spec: ContractSpec, interfaceName: string, methodName: string, data: Uint8Array, namedCodecs: Record<string, XdrCodec<unknown>>): Record<string, unknown>;
70
+ declare function decodeCalldata(spec: ContractSpec$1, interfaceName: string, methodName: string, data: Uint8Array, namedCodecs: Record<string, XdrCodec<unknown>>): Record<string, unknown>;
39
71
  //#endregion
40
72
  //#region src/contract/specMethod.d.ts
41
73
  /** A declared exception decoded from a spec without generated value types. */
@@ -58,7 +90,7 @@ interface SpecDecodedCall {
58
90
  * Unknown selectors return null; malformed known inputs throw. The caller must
59
91
  * establish the spec's identity. A current spec does not prove historical code.
60
92
  */
61
- declare function createContractCallDecoder(spec: ContractSpec): (invocation: Pick<Invocation, "entrypoint" | "calldata">) => SpecDecodedCall | null;
93
+ declare function createContractCallDecoder(spec: ContractSpec$1): (invocation: Pick<Invocation, "entrypoint" | "calldata">) => SpecDecodedCall | null;
62
94
  //#endregion
63
95
  //#region src/contract/codegen.d.ts
64
96
  /**
@@ -71,7 +103,7 @@ declare function createContractCallDecoder(spec: ContractSpec): (invocation: Pic
71
103
  *
72
104
  * @throws If two definitions share a spec id.
73
105
  */
74
- declare function buildNamedCodecs(typeDefs: ContractTypeDef[]): Record<string, XdrCodec<unknown>>;
106
+ declare function buildNamedCodecs(typeDefs: ContractTypeDef$1[]): Record<string, XdrCodec<unknown>>;
75
107
  //#endregion
76
108
  //#region src/contract/hash.d.ts
77
109
  /**
@@ -102,16 +134,6 @@ declare function hashContract(contract: Contract): SHA256Hash;
102
134
  */
103
135
  declare function deriveContractAddress(deployer: ContractAddress, nonce: SHA256Hash, contractHash: SHA256Hash): ContractAddress;
104
136
  //#endregion
105
- //#region src/contract/errors.d.ts
106
- /** Error raised when contract bytes do not match their declared ABI type. */
107
- declare class ContractDecodeError extends Error {
108
- constructor(message: string, options?: ErrorOptions);
109
- }
110
- /** Retrieved bytes or response metadata failed identity/canonical validation. */
111
- declare class ContractVerificationError extends Error {
112
- constructor(message: string, options?: ErrorOptions);
113
- }
114
- //#endregion
115
137
  //#region src/contract/signedToken.d.ts
116
138
  declare const signedTokenPreimageBrand: unique symbol;
117
139
  /**
@@ -160,5 +182,5 @@ declare function getContract<T extends Record<string, ContractMethod<any, unknow
160
182
  client: Pick<ThruputClient, "simulateInvocation">;
161
183
  }): ContractInstance<T>;
162
184
  //#endregion
163
- export { SpecDecodedCall as _, BoundContractMethod as a, encodeCalldata as b, SignedToken as c, ContractDecodeError as d, ContractVerificationError as f, SpecDeclaredException as g, buildNamedCodecs as h, fixedBytes as i, isSignedToken as l, hashContract as m, FixedBytes$1 as n, ContractInstance as o, deriveContractAddress as p, fixedArray as r, getContract as s, FixedArray as t, signedToken as u, createContractCallDecoder as v, resolveCodec as x, decodeCalldata as y };
164
- //# sourceMappingURL=index-CedOvhGY.d.cts.map
185
+ export { decodeCalldata as _, BoundContractMethod as a, ContractArtifactSpec as b, SignedToken as c, deriveContractAddress as d, hashContract as f, createContractCallDecoder as g, SpecDecodedCall as h, fixedBytes as i, isSignedToken as l, SpecDeclaredException as m, FixedBytes$1 as n, ContractInstance as o, buildNamedCodecs as p, fixedArray as r, getContract as s, FixedArray as t, signedToken as u, encodeCalldata as v, readContractArtifactSpec as x, resolveCodec as y };
186
+ //# sourceMappingURL=index-ozfbEuYI.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-ozfbEuYI.d.cts","names":[],"sources":["../src/contract/artifact.ts","../src/contract/encode.ts","../src/contract/specMethod.ts","../src/contract/codegen.ts","../src/contract/hash.ts","../src/derivation/contractAddress.ts","../src/contract/signedToken.ts","../src/contract/instance.ts"],"mappings":";;;;;;;KAsBY,oBAAA;EACN,IAAA;AAAA;EACA,IAAA;EAA6B,YAAA;AAAA;EAC7B,IAAA;EAA2B,aAAA;AAAA;EAC3B,IAAA;AAAA;EACA,IAAA;EAA2B,aAAA;EAAuB,KAAA,EAAO,UAAA;AAAA;EACzD,IAAA;EAAc,aAAA;EAAkB,IAAA,EAAM,YAAY;AAAA;;;;AAAA;AAuBxD;;;;iBAAgB,wBAAA,CACd,WAAA,EAAa,UAAA,EACb,YAAA,EAAc,UAAA,GACb,oBAAA;;;;AAhCH;;;;;iBCiJgB,YAAA,CACd,EAAA,EAAI,YAAA,EACJ,WAAA,GAAc,MAAA,SAAe,QAAA,aAC5B,QAAA;;;;;;;;;;;;;;AD9IqD;AAuBxD;;;;iBC2RgB,cAAA,CACd,IAAA,EAAM,cAAA,EACN,aAAA,UACA,UAAA,UACA,IAAA,aACA,WAAA,EAAa,MAAA,SAAe,QAAA,aAC3B,QAAA;;;;;;;iBAwBa,cAAA,CACd,IAAA,EAAM,cAAA,EACN,aAAA,UACA,UAAA,UACA,IAAA,EAAM,UAAA,EACN,WAAA,EAAa,MAAA,SAAe,QAAA,aAC3B,MAAA;;;;UCtWc,qBAAA;EACf,IAAA;EACA,QAAA;EACA,IAAA;EACA,KAAA;AAAA;;UAIe,eAAA;EACf,aAAA;EACA,gBAAA;EACA,UAAA;EACA,IAAA,EAAM,MAAA;EACN,MAAA,EAAQ,cAAA,CACN,MAAA,mCAEA,qBAAA;AAAA;;;;;;iBASY,yBAAA,CACd,IAAA,EAAM,cAAA,IAEN,UAAA,EAAY,IAAA,CAAK,UAAA,iCACd,eAAA;;;;;;;AFnBL;;;;;;iBGGgB,gBAAA,CACd,QAAA,EAAU,iBAAA,KACT,MAAA,SAAe,QAAA;;;;;;;;AHLlB;;;;;;;;;;;;;iBIAgB,YAAA,CAAa,QAAA,EAAU,QAAA,GAAW,UAAU;;;;;;;;iBCb5C,qBAAA,CACd,QAAA,EAAU,eAAA,EACV,KAAA,EAAO,UAAA,EACP,YAAA,EAAc,UAAA,GACb,eAAA;;;cCXW,wBAAA;;;;;ANoBd;;;;;UMTiB,WAAA;EAAA,SACN,IAAA;EAAA,UACC,wBAAwB,IAAI,SAAA;AAAA;;iBAMxB,WAAA,yBAAoC,WAAW,CAAC,SAAA;;iBAKhD,aAAA,CAAc,KAAA,YAAiB,KAAA,IAAS,WAAW;;;;KCrBvD,mBAAA,YAA+B,IAAA,CACzC,cAAA,CAAe,CAAA,EAAG,CAAA,EAAG,CAAA;EAGrB,WAAA,CACE,OAAA,EAAS,IAAA,CACP,UAAA,CAAW,cAAA,CAAe,CAAA,EAAG,CAAA,EAAG,CAAA,mCAGjC,UAAA,CAAW,cAAA,CAAe,CAAA,EAAG,CAAA,EAAG,CAAA;EACnC,IAAA,CACE,OAAA,EAAS,IAAA,CAAK,mBAAA,CAAoB,CAAA,2BACjC,UAAA,CAAW,cAAA,CAAe,CAAA,EAAG,CAAA,EAAG,CAAA;EACnC,WAAA,CACE,OAAA,EAAS,IAAA,CAAK,mBAAA,CAAoB,CAAA,2BACjC,UAAA,CAAW,cAAA,CAAe,CAAA,EAAG,CAAA,EAAG,CAAA;EACnC,IAAA,CACE,OAAA,EAAS,IAAA,CAAK,UAAA,CAAW,cAAA,CAAe,CAAA,EAAG,CAAA,EAAG,CAAA,4BAC7C,UAAA,CAAW,cAAA,CAAe,CAAA,EAAG,CAAA,EAAG,CAAA;AAAA;;KAIzB,gBAAA,oBACE,CAAA,GAAI,CAAA,CAAE,CAAA,UAAW,cAAA,8BACzB,mBAAA,CAAoB,CAAA,EAAG,CAAA,EAAG,CAAA;;;;;;;;;;;;APDwB;iBOiBxC,WAAA,WAEJ,MAAA,SAAe,cAAA,0BACzB,OAAA;EACA,OAAA,EAAS,CAAA;EACT,OAAA,EAAS,eAAA;EACT,MAAA,EAAQ,IAAA,CAAK,aAAA;AAAA,IACX,gBAAA,CAAiB,CAAA"}
package/dist/index.cjs CHANGED
@@ -1,19 +1,19 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_decimal = require("./decimal-BX7abv5J.cjs");
3
+ const require_hex = require("./hex-CSDZ9d6z.cjs");
4
+ const require_contract = require("./contract-D_vxUudr.cjs");
2
5
  const require_sign = require("./sign-BewmV_EL.cjs");
3
6
  const require_transaction = require("./transaction-DrSrCJ5y.cjs");
4
7
  const require_size = require("./size-OAFfOthl.cjs");
5
- const require_contract = require("./contract-DSu2UPPm.cjs");
6
- const require_codec = require("./codec-BcK8ASsg.cjs");
7
- const require_hex = require("./hex-DkGpiZ5e.cjs");
8
8
  const require_transactionHash = require("./transactionHash-D5yf4KoL.cjs");
9
- const require_readError = require("./readError-CCVlmBhj.cjs");
10
- const require_sendInvocation = require("./sendInvocation-Dsr9ij5P.cjs");
11
- const require_validation = require("./validation-4w-vDGAi.cjs");
12
- const require_actions = require("./actions-B5-CjpEF.cjs");
13
- const require_wallet = require("./wallet-7R5M_7h4.cjs");
14
- const require_signedOp = require("./signedOp-DAucp6xg.cjs");
15
- const require_signed_op = require("./signed_op-_lR85dn2.cjs");
16
- const require_transport = require("./transport-5FPeNwuv.cjs");
9
+ const require_readError = require("./readError-COcEDNoZ.cjs");
10
+ const require_sendInvocation = require("./sendInvocation-185ZJrta.cjs");
11
+ const require_actions = require("./actions-CIaI049y.cjs");
12
+ const require_validation = require("./validation-CZqtmMLJ.cjs");
13
+ const require_wallet = require("./wallet-UvyXtxh5.cjs");
14
+ const require_signedOp = require("./signedOp-CVyeJ5ig.cjs");
15
+ const require_signed_op = require("./signed_op-BBsDKOlD.cjs");
16
+ const require_transport = require("./transport-BhWZxHcz.cjs");
17
17
  const require_signers = require("./signers-BFP84wJP.cjs");
18
18
  let _thruputchain_protocol = require("@thruputchain/protocol");
19
19
  let _thruputchain_protocol_utils = require("@thruputchain/protocol/utils");
@@ -72,21 +72,12 @@ function localnet(options = {}) {
72
72
  capabilities: ["airdrop"]
73
73
  });
74
74
  }
75
- /** Error thrown when an RPC endpoint does not match its declared cluster. */
76
- var NetworkMismatchError = class extends Error {
77
- cluster;
78
- actual;
79
- constructor(cluster, actual) {
80
- const expected = cluster.networkHash === void 0 ? "an unpinned network" : `network ${(0, _thruputchain_protocol_utils.toBase58)(cluster.networkHash)}`;
81
- super(`Network mismatch${cluster.name ? ` for ${cluster.name}` : ""}: expected ${expected}, received network ${(0, _thruputchain_protocol_utils.toBase58)(actual.networkHash)}`);
82
- this.name = "NetworkMismatchError";
83
- this.cluster = cluster;
84
- this.actual = actual;
85
- }
86
- };
87
- /** Assert that runtime network information matches a cluster descriptor. */
75
+ /** Assert that runtime network information matches a cluster descriptor. Throws code `networkMismatch`. */
88
76
  function assertNetworkMatchesCluster(cluster, actual) {
89
- if (cluster.networkHash !== void 0 && !bytesEqual$1(actual.networkHash, cluster.networkHash)) throw new NetworkMismatchError(cluster, actual);
77
+ if (cluster.networkHash !== void 0 && !bytesEqual$1(actual.networkHash, cluster.networkHash)) throw new require_decimal.ThruputError("networkMismatch", `Network mismatch${cluster.name ? ` for ${cluster.name}` : ""}: expected network ${(0, _thruputchain_protocol_utils.toBase58)(cluster.networkHash)}, received network ${(0, _thruputchain_protocol_utils.toBase58)(actual.networkHash)}`, { context: {
78
+ cluster,
79
+ actual
80
+ } });
90
81
  }
91
82
  function withNetworkHash(options) {
92
83
  return options.networkHash === void 0 ? {} : { networkHash: options.networkHash };
@@ -111,7 +102,7 @@ function bytesEqual$1(left, right) {
111
102
  //#region src/client.ts
112
103
  async function createThruputClient(options) {
113
104
  const cluster = options.cluster === void 0 ? void 0 : defineCluster(options.cluster);
114
- const transport = options.transport ?? (cluster?.rpcUrl ? new require_readError.HttpTransport(cluster.rpcUrl) : void 0);
105
+ const transport = options.transport ?? (cluster?.rpcUrl ? new require_transport.HttpTransport(cluster.rpcUrl) : void 0);
115
106
  if (!transport) throw new Error("Cluster has no default RPC URL; provide a transport or rpcUrl");
116
107
  const requiredMethods = [...options.requiredMethods ?? []];
117
108
  if (cluster?.capabilities.includes("airdrop")) requiredMethods.push("faucet_requestAirdrop");
@@ -122,8 +113,8 @@ async function createThruputClient(options) {
122
113
  signal: options.signal
123
114
  });
124
115
  const client = Object.assign(rpc, {
125
- waitForTransactionReceipt: (hash, wait) => require_sendInvocation.waitForTransactionReceipt(rpc, hash, wait),
126
- waitForCommitment: (hash, wait) => require_sendInvocation.waitForCommitment(rpc, hash, wait),
116
+ waitForTransactionReceipt: (hash, wait) => require_actions.waitForTransactionReceipt(rpc, hash, wait),
117
+ waitForCommitment: (hash, wait) => require_actions.waitForCommitment(rpc, hash, wait),
127
118
  readViews: (request, control) => require_actions.readViews(rpc, request, control),
128
119
  getContractEvents: (query, control) => require_actions.getContractEvents(rpc, query, control),
129
120
  iterateTransactionsByRootAddress: (query, options) => require_actions.iterateTransactionsByRootAddress(rpc, query, options),
@@ -141,30 +132,28 @@ async function createThruputClient(options) {
141
132
  }
142
133
  //#endregion
143
134
  //#region src/units.ts
144
- /** Invalid decimal input to {@link parseUnits}. */
145
- var ParseUnitsError = class extends Error {
146
- code;
147
- constructor(code, decimals) {
148
- super(code === "malformed" ? "Use a plain decimal amount" : `Use at most ${decimals} decimal places`);
149
- this.code = code;
150
- this.name = "ParseUnitsError";
151
- }
152
- };
135
+ function amountInvalid(kind, decimals) {
136
+ return new require_decimal.ThruputError("amountInvalid", kind === "malformed" ? "Use a plain decimal amount" : `Use at most ${decimals} decimal places`, { context: {
137
+ kind,
138
+ decimals
139
+ } });
140
+ }
153
141
  /**
154
142
  * Convert a plain decimal string to raw units without rounding.
155
143
  *
156
144
  * Accepts a leading minus sign. Rejects whitespace, exponent notation, and
157
145
  * excess fractional digits, including zeroes. Decimals must be 0–255.
158
- * Token positivity and ABI bounds are separate validation steps.
146
+ * Token positivity and ABI bounds are separate validation steps. Invalid text
147
+ * throws code `amountInvalid`, with `context.kind` `malformed` or `precision`.
159
148
  *
160
149
  * @example `parseUnits("12.05", 2)` returns `1205n`.
161
150
  */
162
151
  function parseUnits(text, decimals) {
163
152
  assertDecimals(decimals);
164
- if (typeof text !== "string" || text.trim() !== text || !/^-?[0-9]+(?:\.[0-9]+)?$/.test(text)) throw new ParseUnitsError("malformed", decimals);
153
+ if (typeof text !== "string" || text.trim() !== text || !/^-?[0-9]+(?:\.[0-9]+)?$/.test(text)) throw amountInvalid("malformed", decimals);
165
154
  const negative = text.startsWith("-");
166
155
  const [whole, fraction = ""] = (negative ? text.slice(1) : text).split(".");
167
- if (fraction.length > decimals) throw new ParseUnitsError("precision", decimals);
156
+ if (fraction.length > decimals) throw amountInvalid("precision", decimals);
168
157
  const units = BigInt(whole + fraction.padEnd(decimals, "0"));
169
158
  return negative ? -units : units;
170
159
  }
@@ -188,14 +177,12 @@ function assertDecimals(decimals) {
188
177
  if (!Number.isInteger(decimals) || decimals < 0 || decimals > 255) throw new RangeError("decimals must be an integer between 0 and 255");
189
178
  }
190
179
  //#endregion
191
- exports.ContractDecodeError = require_contract.ContractDecodeError;
192
180
  Object.defineProperty(exports, "ContractMethodEffect", {
193
181
  enumerable: true,
194
182
  get: function() {
195
183
  return _thruputchain_contract_spec.ContractMethodEffect;
196
184
  }
197
185
  });
198
- exports.ContractReceiptError = require_contract.ContractReceiptError;
199
186
  Object.defineProperty(exports, "ContractTypeDefKind", {
200
187
  enumerable: true,
201
188
  get: function() {
@@ -214,8 +201,6 @@ Object.defineProperty(exports, "ContractUnionCaseKind", {
214
201
  return _thruputchain_contract_spec.ContractUnionCaseKind;
215
202
  }
216
203
  });
217
- exports.ContractVerificationError = require_contract.ContractVerificationError;
218
- exports.ContractViewError = require_contract.ContractViewError;
219
204
  exports.DEVNET_RPC_URL = DEVNET_RPC_URL;
220
205
  exports.Ed25519Signer = require_signers.Ed25519Signer;
221
206
  Object.defineProperty(exports, "ExecResult", {
@@ -224,41 +209,22 @@ Object.defineProperty(exports, "ExecResult", {
224
209
  return _thruputchain_protocol.ExecResult;
225
210
  }
226
211
  });
227
- exports.ExecutionDecodeError = require_sendInvocation.ExecutionDecodeError;
228
- exports.ExecutionReturnUnavailableError = require_sendInvocation.ExecutionReturnUnavailableError;
229
212
  exports.FUTURENET_RPC_URL = FUTURENET_RPC_URL;
230
- exports.FundingObservationError = require_actions.FundingObservationError;
231
- exports.HistoryWalkError = require_actions.HistoryWalkError;
232
- exports.HttpRequestError = require_readError.HttpRequestError;
233
- exports.HttpResponseError = require_readError.HttpResponseError;
234
- exports.HttpTransport = require_readError.HttpTransport;
213
+ exports.HttpTransport = require_transport.HttpTransport;
235
214
  Object.defineProperty(exports, "InvokeFlag", {
236
215
  enumerable: true,
237
216
  get: function() {
238
217
  return _thruputchain_protocol.InvokeFlag;
239
218
  }
240
219
  });
241
- exports.JsonRpcError = require_readError.JsonRpcError;
242
220
  exports.LOCALNET_RPC_URL = LOCALNET_RPC_URL;
243
221
  exports.MlDsa65Signer = require_signers.MlDsa65Signer;
244
222
  exports.MockTransport = require_transport.MockTransport;
245
- exports.NativeRpcError = require_readError.NativeRpcError;
246
223
  exports.NativeRpcErrorCode = require_transport.NativeRpcErrorCode;
247
- exports.NetworkMismatchError = NetworkMismatchError;
248
- exports.ParseUnitsError = ParseUnitsError;
249
- exports.RpcCompatibilityError = require_readError.RpcCompatibilityError;
250
- exports.RpcDecodingError = require_codec.RpcDecodingError;
251
- exports.RpcRequestValidationError = require_codec.RpcRequestValidationError;
252
- exports.RpcResponseError = require_readError.RpcResponseError;
253
224
  exports.SignedOp = require_signed_op.SignedOp;
254
225
  exports.SignedOpSpec = require_signed_op.spec;
255
- exports.TransactionExecutionError = require_sendInvocation.TransactionExecutionError;
256
- exports.TransactionObservationError = require_sendInvocation.TransactionObservationError;
257
- exports.TransactionReceiptObservationError = require_sendInvocation.TransactionReceiptObservationError;
258
- exports.TransactionReceiptTimeoutError = require_sendInvocation.TransactionReceiptTimeoutError;
259
- exports.UnsupportedRpcValue = require_codec.UnsupportedRpcValue;
260
- exports.UnsupportedTransactionAdmissionError = require_sendInvocation.UnsupportedTransactionAdmissionError;
261
- exports.UnsupportedTransactionOutcomeError = require_sendInvocation.UnsupportedTransactionOutcomeError;
226
+ exports.ThruputError = require_decimal.ThruputError;
227
+ exports.UnsupportedRpcValue = require_decimal.UnsupportedRpcValue;
262
228
  exports.addressFromBase58 = require_hex.addressFromBase58;
263
229
  exports.addressFromHex = require_hex.addressFromHex;
264
230
  exports.addressToStrkey = require_hex.addressToStrkey;
@@ -319,6 +285,7 @@ exports.deriveContractAddress = require_contract.deriveContractAddress;
319
285
  exports.deriveEntrypointID = require_contract.deriveEntrypointID;
320
286
  exports.derivePubkeyAccountAddress = require_validation.derivePubkeyAccountAddress;
321
287
  exports.derivePublicKeyHash = require_size.derivePublicKeyHash;
288
+ exports.describeDefaultWalletRequests = require_actions.describeDefaultWalletRequests;
322
289
  exports.deserializeSignedTransaction = require_transaction.deserializeSignedTransaction;
323
290
  exports.deserializeTransaction = require_transaction.deserializeTransaction;
324
291
  exports.devWalletAdapter = require_sendInvocation.devWalletAdapter;
@@ -368,6 +335,8 @@ Object.defineProperty(exports, "invokeFlagSet", {
368
335
  }
369
336
  });
370
337
  exports.isSignedToken = require_contract.isSignedToken;
338
+ exports.isThruputError = require_decimal.isThruputError;
339
+ exports.isUnsupportedRpcValue = require_decimal.isUnsupportedRpcValue;
371
340
  exports.iterateEventPages = require_actions.iterateEventPages;
372
341
  exports.iterateTransactionsByBlock = require_actions.iterateTransactionsByBlock;
373
342
  exports.iterateTransactionsByRootAddress = require_actions.iterateTransactionsByRootAddress;
@@ -434,12 +403,15 @@ Object.defineProperty(exports, "toBase58", {
434
403
  });
435
404
  exports.toHex0x = require_hex.toHex0x;
436
405
  exports.topicRepresentation = require_contract.topicRepresentation;
406
+ exports.transactionErrorCodes = require_decimal.transactionErrorCodes;
407
+ exports.transactionOutcomes = require_contract.transactionOutcomes;
408
+ exports.transactionReasons = require_contract.transactionReasons;
437
409
  exports.transactionSignaturePreimage = require_size.transactionSignaturePreimage;
438
410
  exports.txInvalidDetail = require_transport.txInvalidDetail;
439
411
  exports.verifyMlDsa65 = require_signers.verifyMlDsa65;
440
- exports.waitForCommitment = require_sendInvocation.waitForCommitment;
412
+ exports.waitForCommitment = require_actions.waitForCommitment;
441
413
  exports.waitForExecution = require_sendInvocation.waitForExecution;
442
- exports.waitForTransactionReceipt = require_sendInvocation.waitForTransactionReceipt;
414
+ exports.waitForTransactionReceipt = require_actions.waitForTransactionReceipt;
443
415
  exports.walletGasLimit = require_sendInvocation.walletGasLimit;
444
416
 
445
417
  //# sourceMappingURL=index.cjs.map