@thruputchain/client 0.28.0 → 0.29.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 (181) hide show
  1. package/README.md +112 -17
  2. package/dist/{actions-B5-CjpEF.cjs → actions-B2gV8Vzr.cjs} +297 -73
  3. package/dist/actions-B2gV8Vzr.cjs.map +1 -0
  4. package/dist/actions-UEYKD22C.js +653 -0
  5. package/dist/actions-UEYKD22C.js.map +1 -0
  6. package/dist/actions.cjs +4 -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/{artifact-BM_MVzhL.d.ts → artifact-RIAPVmVX.d.cts} +4 -3
  11. package/dist/artifact-RIAPVmVX.d.cts.map +1 -0
  12. package/dist/{artifact-BM_MVzhL.d.cts → artifact-RIAPVmVX.d.ts} +4 -3
  13. package/dist/artifact-RIAPVmVX.d.ts.map +1 -0
  14. package/dist/{contract-D77iA2iY.js → contract-BOlNskwd.js} +235 -87
  15. package/dist/contract-BOlNskwd.js.map +1 -0
  16. package/dist/{contract-DSu2UPPm.cjs → contract-D_vxUudr.cjs} +281 -109
  17. package/dist/contract-D_vxUudr.cjs.map +1 -0
  18. package/dist/contract.cjs +1 -5
  19. package/dist/contract.d.cts +4 -4
  20. package/dist/contract.d.ts +4 -4
  21. package/dist/contract.js +2 -2
  22. package/dist/contracts.cjs +5 -5
  23. package/dist/contracts.d.cts +19 -4
  24. package/dist/contracts.d.cts.map +1 -1
  25. package/dist/contracts.d.ts +19 -4
  26. package/dist/contracts.d.ts.map +1 -1
  27. package/dist/contracts.js +4 -4
  28. package/dist/decimal-BX7abv5J.cjs +171 -0
  29. package/dist/decimal-BX7abv5J.cjs.map +1 -0
  30. package/dist/decimal-CoHOISys.js +124 -0
  31. package/dist/decimal-CoHOISys.js.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-Bb01ytjJ.d.ts → index-BZ5j5P5d.d.ts} +11 -9
  49. package/dist/index-BZ5j5P5d.d.ts.map +1 -0
  50. package/dist/{index-CedOvhGY.d.cts → index-BfYEEVHm.d.cts} +3 -13
  51. package/dist/index-BfYEEVHm.d.cts.map +1 -0
  52. package/dist/{index-CtjWsAXV.d.cts → index-BhOeIyrZ.d.cts} +11 -9
  53. package/dist/index-BhOeIyrZ.d.cts.map +1 -0
  54. package/dist/{index-B5KqSHeL.d.cts → index-BsvYcU_Y.d.cts} +2 -2
  55. package/dist/{index-B5KqSHeL.d.cts.map → index-BsvYcU_Y.d.cts.map} +1 -1
  56. package/dist/{index-DeS1S0m-.d.ts → index-Btl_jMCT.d.ts} +3 -13
  57. package/dist/index-Btl_jMCT.d.ts.map +1 -0
  58. package/dist/{index-CtjZ61tl.d.cts → index-CG-q0j9w.d.ts} +12 -62
  59. package/dist/index-CG-q0j9w.d.ts.map +1 -0
  60. package/dist/index-CPtBvHE8.d.ts +145 -0
  61. package/dist/index-CPtBvHE8.d.ts.map +1 -0
  62. package/dist/{index-DfmDUk5Y.d.ts → index-DBKsOzCN.d.cts} +24 -21
  63. package/dist/index-DBKsOzCN.d.cts.map +1 -0
  64. package/dist/index-Xre-0Jka.d.cts +145 -0
  65. package/dist/index-Xre-0Jka.d.cts.map +1 -0
  66. package/dist/index.cjs +39 -68
  67. package/dist/index.cjs.map +1 -1
  68. package/dist/index.d.cts +12 -17
  69. package/dist/index.d.cts.map +1 -1
  70. package/dist/index.d.ts +12 -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-D2usgASc.d.cts → signed_op-BvbOHWKK.d.ts} +3 -3
  103. package/dist/{signed_op-zGq4eBo8.d.ts.map → signed_op-BvbOHWKK.d.ts.map} +1 -1
  104. package/dist/{signed_op-zGq4eBo8.d.ts → signed_op-DoHFpSH4.d.cts} +3 -3
  105. package/dist/{signed_op-D2usgASc.d.cts.map → signed_op-DoHFpSH4.d.cts.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 +2 -2
  133. package/dist/actions-B5-CjpEF.cjs.map +0 -1
  134. package/dist/actions-C1SMLWO5.js +0 -430
  135. package/dist/actions-C1SMLWO5.js.map +0 -1
  136. package/dist/artifact-BM_MVzhL.d.cts.map +0 -1
  137. package/dist/artifact-BM_MVzhL.d.ts.map +0 -1
  138. package/dist/client-jOZxB8yW.d.cts +0 -798
  139. package/dist/client-jOZxB8yW.d.cts.map +0 -1
  140. package/dist/client-jOZxB8yW.d.ts +0 -798
  141. package/dist/client-jOZxB8yW.d.ts.map +0 -1
  142. package/dist/codec-BcK8ASsg.cjs.map +0 -1
  143. package/dist/codec-Bxlt1gKO.js.map +0 -1
  144. package/dist/contract-D77iA2iY.js.map +0 -1
  145. package/dist/contract-DSu2UPPm.cjs.map +0 -1
  146. package/dist/dev_wallet-CAbOSrak.cjs.map +0 -1
  147. package/dist/dev_wallet-CU3RpQLm.js.map +0 -1
  148. package/dist/execution-J5jkXhV1.d.cts.map +0 -1
  149. package/dist/execution-XJ0iwFaX.d.ts.map +0 -1
  150. package/dist/index-Bb01ytjJ.d.ts.map +0 -1
  151. package/dist/index-C3HVRvQd.d.ts.map +0 -1
  152. package/dist/index-CIHK7Ew9.d.cts +0 -303
  153. package/dist/index-CIHK7Ew9.d.cts.map +0 -1
  154. package/dist/index-CIHK7Ew9.d.ts +0 -303
  155. package/dist/index-CIHK7Ew9.d.ts.map +0 -1
  156. package/dist/index-CedOvhGY.d.cts.map +0 -1
  157. package/dist/index-CtjWsAXV.d.cts.map +0 -1
  158. package/dist/index-CtjZ61tl.d.cts.map +0 -1
  159. package/dist/index-DeS1S0m-.d.ts.map +0 -1
  160. package/dist/index-DfmDUk5Y.d.ts.map +0 -1
  161. package/dist/index-soFVQX9j.d.cts.map +0 -1
  162. package/dist/readError-CCVlmBhj.cjs +0 -624
  163. package/dist/readError-CCVlmBhj.cjs.map +0 -1
  164. package/dist/readError-D1dppovI.js +0 -571
  165. package/dist/readError-D1dppovI.js.map +0 -1
  166. package/dist/readViews-DbWELMMq.d.cts +0 -609
  167. package/dist/readViews-DbWELMMq.d.cts.map +0 -1
  168. package/dist/readViews-nV3jbpYc.d.ts +0 -609
  169. package/dist/readViews-nV3jbpYc.d.ts.map +0 -1
  170. package/dist/sendInvocation-Dsr9ij5P.cjs +0 -661
  171. package/dist/sendInvocation-Dsr9ij5P.cjs.map +0 -1
  172. package/dist/sendInvocation-tBmf8haQ.js +0 -505
  173. package/dist/sendInvocation-tBmf8haQ.js.map +0 -1
  174. package/dist/transport-5FPeNwuv.cjs +0 -279
  175. package/dist/transport-5FPeNwuv.cjs.map +0 -1
  176. package/dist/transport-IrhVlS4w.js +0 -261
  177. package/dist/transport-IrhVlS4w.js.map +0 -1
  178. package/dist/validation-4w-vDGAi.cjs.map +0 -1
  179. package/dist/validation-eXATmgO0.js.map +0 -1
  180. package/dist/wallet-7R5M_7h4.cjs.map +0 -1
  181. package/dist/wallet-BNKgOXrF.js.map +0 -1
@@ -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.js";
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-CPtBvHE8.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CPtBvHE8.d.ts","names":[],"sources":["../src/provider/validation.ts","../src/provider/discovery.ts"],"mappings":";;;;;cAuCa,q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C;;;;AAAqC;AAGrC;;;;AAA2E;AA6C3E;;;;AAAoD;AAYpD;AA5DA,iBCSgB,uBAAA,CACd,QAAA,GAAW,QAAA,EAAU,cAAA,WACrB,MAAA,GAAQ,WAA6B"}
@@ -1,7 +1,6 @@
1
- import { Ft as TransportRequestOptions } from "./client-jOZxB8yW.js";
2
- import { $t as WaitForTransactionReceiptOptions, E as AirdropActions, Kt as RequestAirdropOptions, a as ContractCall, k as CoreThruputClient, sn as AirdropSucceeded, un as BalanceResponse } from "./readViews-nV3jbpYc.js";
3
- import { F as WalletAccount, N as PubkeyAccount, P as SourceAddressAccount, T as DeploymentOptions, _ as WalletBatchExecutionRequest, a as SubmissionEvidence, k as PrepareTransactionRequest, r as ExecutionResult, t as CallResults, v as WalletExecutionRequest, w as ContractDeployment, y as WalletInvocationAdapter } from "./execution-XJ0iwFaX.js";
4
- import { A as WalletProvider, D as SubmitTransactionResult, E as SignTransactionResult, O as WalletAccount$1, k as WalletCapabilities } from "./index-CIHK7Ew9.js";
1
+ import { $ as AirdropActions, Fn as BalanceResponse, Mn as AirdropSucceeded, N as ContractCall, b as SubmissionEvidence, cn as TransportRequestOptions, nt as CoreThruputClient, t as RequestAirdropOptions, wn as WaitForTransactionReceiptOptions } from "./requestAirdrop-T1eVn3l5.cjs";
2
+ import { a as WalletCapabilities, i as WalletAccount, n as SignTransactionResult, o as WalletProvider, r as SubmitTransactionResult } from "./types-VYjJcTip.cjs";
3
+ import { D as WalletAccount$1, E as SourceAddressAccount, T as PubkeyAccount, _ as DeploymentOptions, d as WalletInvocationAdapter, g as ContractDeployment, l as WalletBatchExecutionRequest, n as ExecutionResult, t as CallResults, u as WalletExecutionRequest, x as PrepareTransactionRequest } from "./execution-pSt6k620.cjs";
5
4
  import { ContractAddress, GasAmount, NetworkHash, SHA256Hash, SignedTransaction, Transaction } from "@thruputchain/protocol";
6
5
 
7
6
  //#region src/wallet/providerClient.d.ts
@@ -9,7 +8,7 @@ import { ContractAddress, GasAmount, NetworkHash, SHA256Hash, SignedTransaction,
9
8
  type PrepareBatchExecutionRequest = WalletBatchExecutionRequest & Omit<PrepareExecutionRequest, "invocation">;
10
9
  /** Exact signed evidence available before broadcasting. Persist on the original network. */
11
10
  interface PendingWalletTransaction extends SignTransactionResult {
12
- readonly account: WalletAccount$1;
11
+ readonly account: WalletAccount;
13
12
  readonly networkHash: string;
14
13
  }
15
14
  /** Lifecycle controls. Cancellation can prevent dispatch; it never cancels a broadcast already sent. */
@@ -37,18 +36,21 @@ interface CreateProviderWalletClientOptions {
37
36
  /** Live external provider with an already authorized session. */
38
37
  provider: WalletProvider;
39
38
  /** Wire pubkey account from the provider subpath, snapshotted at construction. */
40
- account: WalletAccount$1;
39
+ account: WalletAccount;
41
40
  /** Trusted application network identity: 32-byte base58; must match the session exactly. */
42
41
  networkHash: string;
43
42
  }
44
43
  /**
45
44
  * Explicit prepare/sign/persist/submit flow without access to a raw signer.
46
- * Allows one in-flight operation; concurrent calls fail with code -32002. Checks
45
+ * Errors are `ThruputError`s with named codes: provider code 4001 becomes
46
+ * `userRejected`, and the others become `wallet*` codes, with the wire code in
47
+ * `context.providerCode`. Allows one in-flight operation; concurrent calls fail
48
+ * with code `walletRequestPending` (provider code -32002). Checks
47
49
  * `getSession` before each operation and permanently invalidates on every `change`,
48
50
  * a failed session read, or a mismatched session. Dispose and recreate after a
49
51
  * change or reconnect; there is no automatic reconnect or retry.
50
52
  *
51
- * @see https://docs.thruput.network/tools/wallet-integration/
53
+ * @see https://www.thruput.network/docs/typescript/wallet-integration/
52
54
  */
53
55
  interface ProviderWalletClient {
54
56
  /** Prepare a root deployment, preserving the explicit signing boundary. */
@@ -63,7 +65,7 @@ interface ProviderWalletClient {
63
65
  executeCallsAndWait<T extends readonly ContractCall[]>(request: ExecuteCallsRequest<T>, options: ProviderExecutionOptions): Promise<ExecutionResult & {
64
66
  values: CallResults<T>;
65
67
  }>;
66
- /** Read fresh account/network capabilities; only 4200 falls back to unsupported. */
68
+ /** Read fresh account/network capabilities; only provider code 4200 falls back to unsupported. */
67
69
  getCapabilities(): Promise<WalletCapabilities>;
68
70
  /** Prepare one atomic batch after checking support. Does not sign or submit. */
69
71
  prepareBatchExecution(request: PrepareBatchExecutionRequest): Promise<Transaction>;
@@ -92,10 +94,11 @@ interface ProviderWalletClient {
92
94
  * fails; the adapter never retries. Returns a broadcast acknowledgement, not an
93
95
  * execution receipt, and verifies its hash against the approved result.
94
96
  *
95
- * Treat a submit failure as potentially broadcast. Keep the previously persisted
96
- * hash and query status/receipt on the original network; do not automatically
97
- * prepare, sign, or execute a replacement transaction. A timeout, session change,
98
- * or invalid response can occur after broadcast. See the factory's persistence example.
97
+ * Every failure has `transaction` facts. When `transaction.outcome` is
98
+ * `unknown`, the bytes may have been broadcast: keep the persisted hash and
99
+ * query status/receipt on the original network; do not automatically prepare,
100
+ * sign, or execute a replacement transaction. A timeout, session change, or
101
+ * invalid response can occur after broadcast. See the factory's persistence example.
99
102
  */
100
103
  submitTransaction(signed: SignTransactionResult): Promise<SubmitTransactionResult>;
101
104
  /**
@@ -171,8 +174,8 @@ interface ProviderWalletClient {
171
174
  * }
172
175
  * ```
173
176
  *
174
- * @see https://docs.thruput.network/tools/wallet-integration/
175
- * @see https://docs.thruput.network/tools/wallet-provider/
177
+ * @see https://www.thruput.network/docs/typescript/wallet-integration/
178
+ * @see https://www.thruput.network/docs/typescript/reference/wallet-provider/
176
179
  */
177
180
  declare function createProviderWalletClient(options: CreateProviderWalletClientOptions): ProviderWalletClient;
178
181
  //#endregion
@@ -182,7 +185,7 @@ type WalletRequestAirdropOptions = Omit<RequestAirdropOptions, "recipient"> & {
182
185
  readonly recipient?: ContractAddress;
183
186
  };
184
187
  /** Signer-bound transaction and account actions. */
185
- interface WalletActions<TAccount extends WalletAccount = WalletAccount> {
188
+ interface WalletActions<TAccount extends WalletAccount$1 = WalletAccount$1> {
186
189
  readonly account: TAccount;
187
190
  getBalance(request?: {
188
191
  address?: Uint8Array;
@@ -220,9 +223,9 @@ interface WalletAirdropActions {
220
223
  requestAirdrop(options?: WalletRequestAirdropOptions): Promise<AirdropSucceeded>;
221
224
  }
222
225
  /** Existing client methods plus signer-bound wallet actions. */
223
- type WalletClient<TClient extends CoreThruputClient, TAccount extends WalletAccount = WalletAccount> = Omit<TClient, "getBalance" | "requestAirdrop" | "account" | "prepareTransaction" | "signTransaction" | "sendInvocation" | "prepareExecution" | "execute"> & WalletActions<TAccount> & (TClient extends AirdropActions ? WalletAirdropActions : object);
226
+ type WalletClient<TClient extends CoreThruputClient, TAccount extends WalletAccount$1 = WalletAccount$1> = Omit<TClient, "getBalance" | "requestAirdrop" | "account" | "prepareTransaction" | "signTransaction" | "sendInvocation" | "prepareExecution" | "execute"> & WalletActions<TAccount> & (TClient extends AirdropActions ? WalletAirdropActions : object);
224
227
  /** Wallet client with adapter-aware inner invocation execution. */
225
- type ExecutableWalletClient<TClient extends CoreThruputClient, TAccount extends WalletAccount = WalletAccount, TRequest extends WalletExecutionRequest = WalletExecutionRequest> = WalletClient<TClient, TAccount> & WalletExecutionActions<TRequest>;
228
+ type ExecutableWalletClient<TClient extends CoreThruputClient, TAccount extends WalletAccount$1 = WalletAccount$1, TRequest extends WalletExecutionRequest = WalletExecutionRequest> = WalletClient<TClient, TAccount> & WalletExecutionActions<TRequest>;
226
229
  /** Signing-network input inferred from whether a client has validated identity. */
227
230
  type WalletNetworkOptions<TClient extends CoreThruputClient> = TClient extends {
228
231
  readonly network: {
@@ -234,7 +237,7 @@ type WalletNetworkOptions<TClient extends CoreThruputClient> = TClient extends {
234
237
  /** Signing network required when the client has no validated identity. */readonly networkHash: NetworkHash;
235
238
  };
236
239
  /** Decorate an existing client with signer-bound wallet behavior. */
237
- declare function createWalletClient<TClient extends CoreThruputClient, TAccount extends WalletAccount, TRequest extends WalletExecutionRequest>(options: {
240
+ declare function createWalletClient<TClient extends CoreThruputClient, TAccount extends WalletAccount$1, TRequest extends WalletExecutionRequest>(options: {
238
241
  readonly client: TClient;
239
242
  readonly account: TAccount;
240
243
  readonly onSigned?: (submission: SubmissionEvidence) => void | Promise<void>;
@@ -252,7 +255,7 @@ declare function createWalletClient<TClient extends CoreThruputClient, TAccount
252
255
  readonly onSigned?: (submission: SubmissionEvidence) => void | Promise<void>;
253
256
  readonly invocationAdapter?: undefined;
254
257
  } & WalletNetworkOptions<TClient>): WalletClient<TClient, TAccount>;
255
- declare function createWalletClient<TClient extends CoreThruputClient, TAccount extends WalletAccount>(options: {
258
+ declare function createWalletClient<TClient extends CoreThruputClient, TAccount extends WalletAccount$1>(options: {
256
259
  readonly client: TClient;
257
260
  readonly account: TAccount;
258
261
  readonly onSigned?: (submission: SubmissionEvidence) => void | Promise<void>;
@@ -260,4 +263,4 @@ declare function createWalletClient<TClient extends CoreThruputClient, TAccount
260
263
  } & WalletNetworkOptions<TClient>): WalletClient<TClient, TAccount>;
261
264
  //#endregion
262
265
  export { WalletClient as a, WalletRequestAirdropOptions as c, ExecuteCallsRequest as d, PendingWalletTransaction as f, createProviderWalletClient as g, ProviderWalletClient as h, WalletAirdropActions as i, createWalletClient as l, ProviderExecutionOptions as m, PrepareExecutionRequest as n, WalletExecutionActions as o, PrepareBatchExecutionRequest as p, WalletActions as r, WalletNetworkOptions as s, ExecutableWalletClient as t, CreateProviderWalletClientOptions as u };
263
- //# sourceMappingURL=index-DfmDUk5Y.d.ts.map
266
+ //# sourceMappingURL=index-DBKsOzCN.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-DBKsOzCN.d.cts","names":[],"sources":["../src/wallet/providerClient.ts","../src/wallet/client.ts"],"mappings":";;;;;;;KAyEY,4BAAA,GAA+B,2BAAA,GACzC,IAAA,CAAK,uBAAA;;UAGU,wBAAA,SAAiC,qBAAqB;EAAA,SAC5D,OAAA,EAAS,aAAA;EAAA,SACT,WAAA;AAAA;;UAIM,wBAAA;EATa;EAW5B,QAAA,GAAW,OAAA,EAAS,wBAAA,YAAoC,OAAA;EARzC;EAUf,IAAA,GAAO,gCAAA;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Q,OAAA;EAAA,SACR,OAAA,EAAS,QAAA;EAAA,SACT,QAAA,IACP,UAAA,EAAY,kBAAA,YACF,OAAA;EAAA,SACH,iBAAA;AAAA,IACP,oBAAA,CAAqB,OAAA,IACxB,sBAAA,CAAuB,OAAA,EAAS,QAAA;AAAA,iBACnB,kBAAA,iBACE,iBAAA,mBACC,oBAAA,EAEjB,OAAA;EAAA,SACW,MAAA,EAAQ,OAAA;EAAA,SACR,OAAA,EAAS,QAAA;EAAA,SACT,QAAA,IACP,UAAA,EAAY,kBAAA,YACF,OAAA;EAAA,SACH,iBAAA;AAAA,IACP,oBAAA,CAAqB,OAAA,IACxB,YAAA,CAAa,OAAA,EAAS,QAAA;AAAA,iBACT,kBAAA,iBACE,iBAAA,mBACC,eAAA,EAEjB,OAAA;EAAA,SACW,MAAA,EAAQ,OAAA;EAAA,SACR,OAAA,EAAS,QAAA;EAAA,SACT,QAAA,IACP,UAAA,EAAY,kBAAA,YACF,OAAA;EAAA,SACH,iBAAA;AAAA,IACP,oBAAA,CAAqB,OAAA,IACxB,YAAA,CAAa,OAAA,EAAS,QAAA"}
@@ -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,aAA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