@thruputchain/client 0.0.0-stage → 0.26.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 (186) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +953 -2
  3. package/dist/actions-CXx6qzsv.cjs +513 -0
  4. package/dist/actions-CXx6qzsv.cjs.map +1 -0
  5. package/dist/actions-QHgiCqT6.js +430 -0
  6. package/dist/actions-QHgiCqT6.js.map +1 -0
  7. package/dist/actions.cjs +23 -0
  8. package/dist/actions.d.cts +4 -0
  9. package/dist/actions.d.ts +4 -0
  10. package/dist/actions.js +3 -0
  11. package/dist/artifact-BM_MVzhL.d.cts +35 -0
  12. package/dist/artifact-BM_MVzhL.d.cts.map +1 -0
  13. package/dist/artifact-BM_MVzhL.d.ts +35 -0
  14. package/dist/artifact-BM_MVzhL.d.ts.map +1 -0
  15. package/dist/client-JixxskeH.d.cts +746 -0
  16. package/dist/client-JixxskeH.d.cts.map +1 -0
  17. package/dist/client-JixxskeH.d.ts +746 -0
  18. package/dist/client-JixxskeH.d.ts.map +1 -0
  19. package/dist/codec-BHKoSaOP.js +9506 -0
  20. package/dist/codec-BHKoSaOP.js.map +1 -0
  21. package/dist/codec-C3OlYm98.cjs +9566 -0
  22. package/dist/codec-C3OlYm98.cjs.map +1 -0
  23. package/dist/contract-C7T2H2Oi.cjs +1628 -0
  24. package/dist/contract-C7T2H2Oi.cjs.map +1 -0
  25. package/dist/contract-DzvyyFCI.js +1472 -0
  26. package/dist/contract-DzvyyFCI.js.map +1 -0
  27. package/dist/contract.cjs +63 -0
  28. package/dist/contract.d.cts +4 -0
  29. package/dist/contract.d.ts +4 -0
  30. package/dist/contract.js +2 -0
  31. package/dist/contracts.cjs +1050 -0
  32. package/dist/contracts.cjs.map +1 -0
  33. package/dist/contracts.d.cts +397 -0
  34. package/dist/contracts.d.cts.map +1 -0
  35. package/dist/contracts.d.ts +397 -0
  36. package/dist/contracts.d.ts.map +1 -0
  37. package/dist/contracts.js +1030 -0
  38. package/dist/contracts.js.map +1 -0
  39. package/dist/dev_wallet-CSMA1PCt.js +497 -0
  40. package/dist/dev_wallet-CSMA1PCt.js.map +1 -0
  41. package/dist/dev_wallet-GX-NCAFk.cjs +530 -0
  42. package/dist/dev_wallet-GX-NCAFk.cjs.map +1 -0
  43. package/dist/domainSeparator-B_vU_zUD.cjs +102 -0
  44. package/dist/domainSeparator-B_vU_zUD.cjs.map +1 -0
  45. package/dist/domainSeparator-CBCvxIj-.js +79 -0
  46. package/dist/domainSeparator-CBCvxIj-.js.map +1 -0
  47. package/dist/execution-DYqPDn4O.d.cts +227 -0
  48. package/dist/execution-DYqPDn4O.d.cts.map +1 -0
  49. package/dist/execution-Dj6E4B_b.d.ts +227 -0
  50. package/dist/execution-Dj6E4B_b.d.ts.map +1 -0
  51. package/dist/hex-DIcaALXL.js +112 -0
  52. package/dist/hex-DIcaALXL.js.map +1 -0
  53. package/dist/hex-DkGpiZ5e.cjs +189 -0
  54. package/dist/hex-DkGpiZ5e.cjs.map +1 -0
  55. package/dist/index--5LsCotr.d.ts +192 -0
  56. package/dist/index--5LsCotr.d.ts.map +1 -0
  57. package/dist/index-1-rFirYe.d.cts +90 -0
  58. package/dist/index-1-rFirYe.d.cts.map +1 -0
  59. package/dist/index-B5KqSHeL.d.cts +192 -0
  60. package/dist/index-B5KqSHeL.d.cts.map +1 -0
  61. package/dist/index-BraLWObY.d.cts +164 -0
  62. package/dist/index-BraLWObY.d.cts.map +1 -0
  63. package/dist/index-ByNNqY7S.d.cts +83 -0
  64. package/dist/index-ByNNqY7S.d.cts.map +1 -0
  65. package/dist/index-ByvV2UF6.d.ts +164 -0
  66. package/dist/index-ByvV2UF6.d.ts.map +1 -0
  67. package/dist/index-CG2WRtGa.d.cts +164 -0
  68. package/dist/index-CG2WRtGa.d.cts.map +1 -0
  69. package/dist/index-CIHK7Ew9.d.cts +303 -0
  70. package/dist/index-CIHK7Ew9.d.cts.map +1 -0
  71. package/dist/index-CIHK7Ew9.d.ts +303 -0
  72. package/dist/index-CIHK7Ew9.d.ts.map +1 -0
  73. package/dist/index-CVrhB9Dr.d.cts +263 -0
  74. package/dist/index-CVrhB9Dr.d.cts.map +1 -0
  75. package/dist/index-D89ur7mO.d.ts +164 -0
  76. package/dist/index-D89ur7mO.d.ts.map +1 -0
  77. package/dist/index-DzrLv3EA.d.cts +82 -0
  78. package/dist/index-DzrLv3EA.d.cts.map +1 -0
  79. package/dist/index-DzrLv3EA.d.ts +82 -0
  80. package/dist/index-DzrLv3EA.d.ts.map +1 -0
  81. package/dist/index-SV-inhhO.d.ts +90 -0
  82. package/dist/index-SV-inhhO.d.ts.map +1 -0
  83. package/dist/index-dJ65V8se.d.ts +263 -0
  84. package/dist/index-dJ65V8se.d.ts.map +1 -0
  85. package/dist/index-fdTURpBk.d.ts +83 -0
  86. package/dist/index-fdTURpBk.d.ts.map +1 -0
  87. package/dist/index.cjs +445 -0
  88. package/dist/index.cjs.map +1 -0
  89. package/dist/index.d.cts +174 -0
  90. package/dist/index.d.cts.map +1 -0
  91. package/dist/index.d.ts +174 -0
  92. package/dist/index.d.ts.map +1 -0
  93. package/dist/index.js +189 -0
  94. package/dist/index.js.map +1 -0
  95. package/dist/provider.cjs +101 -0
  96. package/dist/provider.cjs.map +1 -0
  97. package/dist/provider.d.cts +2 -0
  98. package/dist/provider.d.ts +2 -0
  99. package/dist/provider.js +76 -0
  100. package/dist/provider.js.map +1 -0
  101. package/dist/readError-AoNjzW75.cjs +604 -0
  102. package/dist/readError-AoNjzW75.cjs.map +1 -0
  103. package/dist/readError-CZPYcW__.js +551 -0
  104. package/dist/readError-CZPYcW__.js.map +1 -0
  105. package/dist/readViews-DJyqc7im.d.cts +604 -0
  106. package/dist/readViews-DJyqc7im.d.cts.map +1 -0
  107. package/dist/readViews-DQoaUORa.d.ts +604 -0
  108. package/dist/readViews-DQoaUORa.d.ts.map +1 -0
  109. package/dist/rolldown-runtime-D6vf50IK.cjs +28 -0
  110. package/dist/sendInvocation-BwabRa2N.js +505 -0
  111. package/dist/sendInvocation-BwabRa2N.js.map +1 -0
  112. package/dist/sendInvocation-qO8AZcmU.cjs +661 -0
  113. package/dist/sendInvocation-qO8AZcmU.cjs.map +1 -0
  114. package/dist/sign-BewmV_EL.cjs +139 -0
  115. package/dist/sign-BewmV_EL.cjs.map +1 -0
  116. package/dist/sign-DVIRyW8Y.js +122 -0
  117. package/dist/sign-DVIRyW8Y.js.map +1 -0
  118. package/dist/sign-Ve0eetRO.d.ts +48 -0
  119. package/dist/sign-Ve0eetRO.d.ts.map +1 -0
  120. package/dist/sign-eUT0iGQG.d.cts +48 -0
  121. package/dist/sign-eUT0iGQG.d.cts.map +1 -0
  122. package/dist/signed-op.cjs +9 -0
  123. package/dist/signed-op.d.cts +3 -0
  124. package/dist/signed-op.d.ts +3 -0
  125. package/dist/signed-op.js +3 -0
  126. package/dist/signedOp-C52gOgpR.js +166 -0
  127. package/dist/signedOp-C52gOgpR.js.map +1 -0
  128. package/dist/signedOp-oqAXEqmE.cjs +183 -0
  129. package/dist/signedOp-oqAXEqmE.cjs.map +1 -0
  130. package/dist/signed_op-BokEDWr-.js +154 -0
  131. package/dist/signed_op-BokEDWr-.js.map +1 -0
  132. package/dist/signed_op-C4lY_TCc.d.ts +58 -0
  133. package/dist/signed_op-C4lY_TCc.d.ts.map +1 -0
  134. package/dist/signed_op-DX5WuyEh.d.cts +58 -0
  135. package/dist/signed_op-DX5WuyEh.d.cts.map +1 -0
  136. package/dist/signed_op-q8KKSm5e.cjs +175 -0
  137. package/dist/signed_op-q8KKSm5e.cjs.map +1 -0
  138. package/dist/signers-BFP84wJP.cjs +137 -0
  139. package/dist/signers-BFP84wJP.cjs.map +1 -0
  140. package/dist/signers-CzOSedwJ.js +120 -0
  141. package/dist/signers-CzOSedwJ.js.map +1 -0
  142. package/dist/signers.cjs +5 -0
  143. package/dist/signers.d.cts +3 -0
  144. package/dist/signers.d.ts +3 -0
  145. package/dist/signers.js +2 -0
  146. package/dist/size-506oTE28.js +91 -0
  147. package/dist/size-506oTE28.js.map +1 -0
  148. package/dist/size-OAFfOthl.cjs +108 -0
  149. package/dist/size-OAFfOthl.cjs.map +1 -0
  150. package/dist/transaction-CwkQxQOx.js +24 -0
  151. package/dist/transaction-CwkQxQOx.js.map +1 -0
  152. package/dist/transaction-DrSrCJ5y.cjs +47 -0
  153. package/dist/transaction-DrSrCJ5y.cjs.map +1 -0
  154. package/dist/transaction.cjs +13 -0
  155. package/dist/transaction.d.cts +3 -0
  156. package/dist/transaction.d.ts +3 -0
  157. package/dist/transaction.js +4 -0
  158. package/dist/transactionHash-CO9ajbvU.js +24 -0
  159. package/dist/transactionHash-CO9ajbvU.js.map +1 -0
  160. package/dist/transactionHash-D5yf4KoL.cjs +29 -0
  161. package/dist/transactionHash-D5yf4KoL.cjs.map +1 -0
  162. package/dist/transport-CBFwAIIv.js +261 -0
  163. package/dist/transport-CBFwAIIv.js.map +1 -0
  164. package/dist/transport-tWxKhXUt.cjs +279 -0
  165. package/dist/transport-tWxKhXUt.cjs.map +1 -0
  166. package/dist/transport.cjs +19 -0
  167. package/dist/transport.d.cts +3 -0
  168. package/dist/transport.d.ts +3 -0
  169. package/dist/transport.js +4 -0
  170. package/dist/types-BE40oD_Q.d.cts +18 -0
  171. package/dist/types-BE40oD_Q.d.cts.map +1 -0
  172. package/dist/types-BE40oD_Q.d.ts +18 -0
  173. package/dist/types-BE40oD_Q.d.ts.map +1 -0
  174. package/dist/validation-4w-vDGAi.cjs +543 -0
  175. package/dist/validation-4w-vDGAi.cjs.map +1 -0
  176. package/dist/validation-eXATmgO0.js +411 -0
  177. package/dist/validation-eXATmgO0.js.map +1 -0
  178. package/dist/wallet-7RELuTkf.js +667 -0
  179. package/dist/wallet-7RELuTkf.js.map +1 -0
  180. package/dist/wallet-T_JazXRc.cjs +709 -0
  181. package/dist/wallet-T_JazXRc.cjs.map +1 -0
  182. package/dist/wallet.cjs +27 -0
  183. package/dist/wallet.d.cts +3 -0
  184. package/dist/wallet.d.ts +3 -0
  185. package/dist/wallet.js +3 -0
  186. package/package.json +122 -4
@@ -0,0 +1,303 @@
1
+ import { SignedTransaction, Transaction } from "@thruputchain/protocol";
2
+
3
+ //#region src/provider/types.d.ts
4
+ /** Public identity advertised by a version 2 provider. Not an attestation. */
5
+ interface WalletProviderInfo {
6
+ /** Stable discovery ID: 1–64 ASCII letters, digits, dots, underscores, or hyphens. */
7
+ id: string;
8
+ /** Display text: 1–80 characters, without controls or surrounding whitespace. */
9
+ name: string;
10
+ /** Supported wire contract version. */
11
+ version: "2.0.0";
12
+ }
13
+ /** Wire pubkey account: unprefixed base58 and a decimal u64 derivation nonce. */
14
+ interface WalletAccount {
15
+ /** Derived pubkey account address: 32 bytes of case-sensitive base58. */
16
+ address: string;
17
+ /** Non-small-order, prime-order Ed25519 key in the same 32-byte base58 format. */
18
+ publicKey: string;
19
+ /** Canonical decimal u64 account-derivation nonce, not a transaction nonce. */
20
+ nonce: string;
21
+ }
22
+ /** Origin-authorized accounts on a network identified by a 32-byte base58 hash. */
23
+ interface WalletSession {
24
+ /** Current network identity, retained even when the origin has no permission. */
25
+ networkHash: string;
26
+ /** At most 32 unique addresses; empty for a disconnected or unauthorized origin. */
27
+ accounts: readonly WalletAccount[];
28
+ }
29
+ /** Non-interactive execution capabilities for one authorized account and network. */
30
+ interface WalletCapabilities {
31
+ /** Canonical account address used in the capability request. */
32
+ account: string;
33
+ /** Network identity: unprefixed, case-sensitive 32-byte base58. */
34
+ networkHash: string;
35
+ /** Ordered, all-or-nothing DefaultWallet calls; null means unsupported. */
36
+ atomicBatch: {
37
+ maxCalls: number;
38
+ } | null;
39
+ }
40
+ /**
41
+ * The complete provider request surface. Requests accept exactly the fields shown.
42
+ * See {@link WalletProvider.request} for each method's result and permission rules.
43
+ *
44
+ * Signing parameters select an authorized account address and the current session's
45
+ * network hash (unprefixed, case-sensitive base58). Transaction payloads are
46
+ * lowercase, even-length, 0x-prefixed canonical classic XDR, with no trailing bytes.
47
+ * Providers must enforce {@link MAX_UNSIGNED_TRANSACTION_BYTES} before user approval;
48
+ * signed payloads are bounded by {@link MAX_TRANSACTION_BYTES}.
49
+ *
50
+ * Signing never broadcasts. Submission requires the exact signed bytes previously
51
+ * approved for the trusted caller origin, account, and network. Providers must clear
52
+ * approvals on session changes or disconnect and recheck authorization before signing
53
+ * or broadcasting. Page-supplied parameters cannot establish the caller's origin.
54
+ *
55
+ * @see https://docs.thruput.network/tools/wallet-provider/
56
+ */
57
+ type ProviderRequest = {
58
+ method: "connect";
59
+ } | {
60
+ method: "getSession";
61
+ } | {
62
+ method: "disconnect";
63
+ } | {
64
+ method: "getCapabilities";
65
+ params: {
66
+ account: string;
67
+ networkHash: string;
68
+ };
69
+ } | {
70
+ method: "signTransaction";
71
+ params: {
72
+ account: string;
73
+ networkHash: string;
74
+ transaction: string;
75
+ };
76
+ } | {
77
+ method: "submitTransaction";
78
+ params: {
79
+ account: string;
80
+ networkHash: string;
81
+ signedTransaction: string;
82
+ };
83
+ };
84
+ /** Approved signed XDR and the canonical RPC transaction/receipt hash. */
85
+ interface SignTransactionResult {
86
+ /** Canonical signed XDR preserving the approved unsigned bytes, with one signature. */
87
+ signedTransaction: string;
88
+ /** Base58 SHA-256 of unsigned transaction XDR; excludes signatures and network. */
89
+ hash: string;
90
+ }
91
+ /** Broadcast acknowledgement, not an execution receipt. */
92
+ interface SubmitTransactionResult {
93
+ /** The previously approved transaction hash; query its receipt on the original network. */
94
+ hash: string;
95
+ }
96
+ /**
97
+ * Framework- and transport-neutral, origin-scoped wallet interface.
98
+ * Validate unknown results with the matching parser before using them.
99
+ *
100
+ * @see https://docs.thruput.network/tools/wallet-provider/
101
+ * @see https://docs.thruput.network/tools/wallet-integration/
102
+ */
103
+ interface WalletProvider {
104
+ info: WalletProviderInfo;
105
+ /** Optional request extensions. Absence means legacy single-call behavior. */
106
+ supportedMethods?: readonly string[];
107
+ /**
108
+ * Send a request across the wallet boundary. The result is unknown until validated.
109
+ *
110
+ * | Method | Result | Permission and behavior |
111
+ * | --- | --- | --- |
112
+ * | `connect` | {@link WalletSession} | Request origin-scoped permission through wallet UI; reject on refusal. Success has at least one authorized account. |
113
+ * | `getSession` | {@link WalletSession} | Non-interactive snapshot; never prompt or grant access. Unauthorized origins see empty accounts and the current network hash. |
114
+ * | `disconnect` | `null` | Idempotently revoke this origin's permission and pending approvals. |
115
+ * | `getCapabilities` | {@link WalletCapabilities} | Non-interactive; requires an authorized account on the requested network. Older providers return 4200. |
116
+ * | `signTransaction` | {@link SignTransactionResult} | Approve and sign the exact unsigned transaction; never broadcast. |
117
+ * | `submitTransaction` | {@link SubmitTransactionResult} | Broadcast only exact previously approved signed bytes; acknowledgement is not an execution receipt. |
118
+ *
119
+ * Changes caused by connect/disconnect must reach page-facing listeners before the
120
+ * request resolves, including across bridges with separate response/event paths.
121
+ */
122
+ request(request: ProviderRequest): Promise<unknown>;
123
+ /**
124
+ * Subscribe to full session snapshots for changes to accounts, authorization,
125
+ * account metadata, or network, including disconnect. Subscription itself emits
126
+ * no snapshot; use `getSession` to read one. See {@link request} for event ordering.
127
+ *
128
+ * @returns An idempotent unsubscribe function.
129
+ */
130
+ on(event: "change", listener: (session: WalletSession) => void): () => void;
131
+ }
132
+ /**
133
+ * Stable provider error codes, including JSON-RPC-style request failures.
134
+ *
135
+ * | Code | Meaning |
136
+ * | --- | --- |
137
+ * | 4001 | User rejected the request. |
138
+ * | 4100 | Origin/account unauthorized, stale session, or no matching approval. |
139
+ * | 4200 | Unsupported method. |
140
+ * | 4900 | Provider disconnected or transport unavailable. |
141
+ * | 4901 | Requested network does not match. |
142
+ * | -32602 | Invalid parameters, noncanonical encoding, or exceeded input limits. |
143
+ * | -32603 | Internal error or invalid provider result. |
144
+ * | -32002 | Another operation is pending. |
145
+ */
146
+ type WalletProviderErrorCode = 4001 | 4100 | 4200 | 4900 | 4901 | -32602 | -32603 | -32002;
147
+ /**
148
+ * A provider failure with a {@link WalletProviderErrorCode | stable numeric code}.
149
+ * Preserve `code` and a human-readable `message` across bridges; `instanceof` does
150
+ * not work across all realms. {@link parseWalletProviderError} reconstructs errors
151
+ * with recognized codes and messages of at most 1,024 characters.
152
+ *
153
+ * After submit starts, even failure may mean broadcast. Keep the previously saved
154
+ * hash and query its status on the original network instead of automatically
155
+ * preparing or signing a replacement transaction.
156
+ */
157
+ declare class WalletProviderError extends Error {
158
+ readonly code: WalletProviderErrorCode;
159
+ constructor(code: WalletProviderErrorCode, message: string);
160
+ }
161
+ //#endregion
162
+ //#region src/provider/validation.d.ts
163
+ /** Maximum decoded signed XDR size: 1,048,576 bytes (1 MiB). */
164
+ declare const MAX_TRANSACTION_BYTES = 1048576;
165
+ /**
166
+ * Maximum unsigned XDR size: 1,048,460 bytes. Providers must enforce this before
167
+ * requesting user approval. Reserves 116 bytes within {@link MAX_TRANSACTION_BYTES}
168
+ * for the Ed25519 pubkey envelope: the signature vector count, key ID, scheme,
169
+ * and 64-byte signature, plus the present `pubkey_claim_key` option holding the
170
+ * scheme-tagged 32-byte key.
171
+ */
172
+ declare const MAX_UNSIGNED_TRANSACTION_BYTES: number;
173
+ /** Maximum accounts in one session. */
174
+ declare const MAX_WALLET_ACCOUNTS = 32;
175
+ /** Current native DefaultWallet execute call limit. */
176
+ declare const MAX_DEFAULT_WALLET_CALLS = 16;
177
+ /** Validate scoped DefaultWallet capabilities. Does not establish authorization. */
178
+ declare function parseWalletCapabilities(value: unknown): WalletCapabilities;
179
+ /** Validate an unprefixed, case-sensitive base58 address, public key, or hash. */
180
+ declare function parseWalletIdentifier(value: unknown): string;
181
+ /** Validate a case-sensitive, unprefixed base58 network hash. */
182
+ declare function parseWalletNetworkHash(value: unknown): string;
183
+ /**
184
+ * Validate and freeze an account snapshot, including a non-small-order, prime-order
185
+ * Ed25519 key and its derived address. The nonce is canonical decimal u64 account
186
+ * derivation data, not a transaction nonce. Rejects extra fields and noncanonical
187
+ * values rather than normalizing them; malformed input throws code -32602.
188
+ */
189
+ declare function parseWalletAccount(value: unknown): WalletAccount;
190
+ /**
191
+ * Strictly validate a session and return a frozen snapshot with frozen accounts.
192
+ * Requires a canonical network hash and at most {@link MAX_WALLET_ACCOUNTS} unique
193
+ * account addresses. Empty accounts are valid for an unauthorized origin; this
194
+ * parser does not enforce the nonempty result required by a successful `connect`.
195
+ */
196
+ declare function parseWalletSession(value: unknown): WalletSession;
197
+ /** Validate bounded display metadata; never render provider names as HTML. */
198
+ declare function parseWalletProviderInfo(value: unknown): WalletProviderInfo;
199
+ /**
200
+ * Validate a provider's structural boundary and return the original live object.
201
+ * Preserves identity and method receivers; metadata is validated, not snapshotted.
202
+ * Unlike {@link parseWalletAccount} and {@link parseWalletSession}, this does not
203
+ * freeze the input. Checks versioned metadata and callable `request`/`on` members,
204
+ * not their behavior, permissions, returned values, or the provider's trustworthiness.
205
+ */
206
+ declare function parseWalletProvider(value: unknown): WalletProvider;
207
+ /**
208
+ * Reconstruct a serialized provider error, without relying on `instanceof`.
209
+ * Requires a recognized {@link WalletProviderErrorCode} and a message of at most
210
+ * 1,024 characters. Invalid errors throw a new error with code -32602.
211
+ */
212
+ declare function parseWalletProviderError(value: unknown): WalletProviderError;
213
+ /**
214
+ * Decode bounded canonical unsigned XDR, rejecting trailing or altered encodings.
215
+ * Accepts lowercase, even-length, 0x-prefixed hex within
216
+ * {@link MAX_UNSIGNED_TRANSACTION_BYTES}; providers must check this before approval.
217
+ * Does not establish account authorization; use {@link assertWalletTransaction}
218
+ * to check the transaction's account claim and enforce origin permission separately.
219
+ */
220
+ declare function parseTransactionHex(value: unknown): Transaction;
221
+ /** Decode bounded canonical signed XDR; signature verification is separate. */
222
+ declare function parseSignedTransactionHex(value: unknown): SignedTransaction;
223
+ /**
224
+ * Parse the exact request union into a new request object, including bounded,
225
+ * canonical XDR. Unknown methods fail with 4200; malformed known requests fail
226
+ * with -32602. This validates input, not origin permission or prior approval.
227
+ * Bridges must bound raw messages before JSON parsing: at most 2,096,922 unsigned
228
+ * or 2,097,154 signed transaction-hex characters, including 0x.
229
+ */
230
+ declare function parseProviderRequest(value: unknown): ProviderRequest;
231
+ /**
232
+ * Validate a signing response's wire structure and return a new result object.
233
+ * Checks canonical signed XDR and hash encoding, not signature, hash correctness,
234
+ * or approval. Use {@link verifySignTransactionResult} for cryptographic validation.
235
+ */
236
+ declare function parseSignTransactionResult(value: unknown): SignTransactionResult;
237
+ /**
238
+ * Validate a submission response's hash encoding and return a new result object.
239
+ * Does not compare the hash to approved bytes or confirm broadcast or execution.
240
+ */
241
+ declare function parseSubmitTransactionResult(value: unknown): SubmitTransactionResult;
242
+ /** Require the root address and complete pubkey claim to match a wire account. */
243
+ declare function assertWalletTransaction(tx: Transaction, account: WalletAccount): void;
244
+ /**
245
+ * Verify unchanged XDR, a single strict network-bound signature, and receipt hash.
246
+ * Requires the exact unsigned transaction bytes and matching root address/pubkey
247
+ * claim, and an attached `pubkey_claim_key` equal to the account's Ed25519 key.
248
+ * The signature must be Ed25519 with public-key ID zero, verified over
249
+ * `transactionSignaturePreimage(networkHash, tx)` with ZIP-215 disabled and both
250
+ * key and signature point R non-small-order and prime-order. The hash is SHA-256
251
+ * of unsigned XDR, excluding signatures and network.
252
+ *
253
+ * @param networkHash - A 32-byte base58 identifier from the authorized session.
254
+ * @returns A frozen verified result. This does not establish origin permission
255
+ * or a retained approval to submit; the provider must enforce both separately.
256
+ *
257
+ * @remarks
258
+ * Requires Web Crypto (HTTPS or localhost in browsers). Invalid signing results
259
+ * throw code -32603; invalid expected inputs fail their boundary validation first.
260
+ *
261
+ * @see https://docs.thruput.network/tools/wallet-provider/
262
+ */
263
+ declare function verifySignTransactionResult(value: unknown, transaction: string, account: WalletAccount, networkHash: string): Promise<SignTransactionResult>;
264
+ //#endregion
265
+ //#region src/provider/discovery.d.ts
266
+ /** Discovery request event name. */
267
+ declare const REQUEST_PROVIDER_EVENT = "thruput:requestProvider";
268
+ /** Announcement detail is the provider itself, not an envelope. */
269
+ declare const ANNOUNCE_PROVIDER_EVENT = "thruput:announceProvider";
270
+ /** Maximum distinct provider IDs retained by one discovery subscription. */
271
+ declare const MAX_DISCOVERED_PROVIDERS = 32;
272
+ /**
273
+ * Validate and announce a live provider now and on each discovery request.
274
+ * Announcement detail is the provider itself. Defaults to `window`; pass an
275
+ * `EventTarget` outside a browser. Importing this module needs no browser globals.
276
+ *
277
+ * @returns Idempotent cleanup that removes the request listener. It stops future
278
+ * announcements from this registration, but does not retract a provider already
279
+ * discovered, disconnect sessions, or revoke permissions. There is no unregister event.
280
+ *
281
+ * @see https://docs.thruput.network/tools/wallet-provider/
282
+ */
283
+ declare function registerWalletProvider(provider: WalletProvider, target?: EventTarget): () => void;
284
+ /**
285
+ * Discover multiple providers in either load order, reporting each valid ID once.
286
+ * Installs the announcement listener before requesting providers. Malformed
287
+ * announcements are ignored; the first valid announcement for an ID wins, up to
288
+ * {@link MAX_DISCOVERED_PROVIDERS} IDs per subscription. IDs remain reserved until
289
+ * cleanup, even if a provider stops announcing. Discovery does not track removals.
290
+ *
291
+ * Defaults to `window`; pass an `EventTarget` outside a browser. IDs and names can
292
+ * be spoofed by page scripts: discovery validates shape, not wallet identity or trust.
293
+ * Render names as text, never HTML.
294
+ *
295
+ * @returns Idempotent cleanup that removes the listener and releases retained IDs.
296
+ * It does not disconnect discovered providers or revoke their permissions.
297
+ *
298
+ * @see https://docs.thruput.network/tools/wallet-integration/
299
+ */
300
+ declare function discoverWalletProviders(listener: (provider: WalletProvider) => void, target?: EventTarget): () => void;
301
+ //#endregion
302
+ export { WalletProvider as A, parseWalletSession as C, SubmitTransactionResult as D, SignTransactionResult as E, WalletProviderErrorCode as M, WalletProviderInfo as N, WalletAccount as O, WalletSession as P, parseWalletProviderInfo as S, ProviderRequest as T, 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, WalletProviderError as j, WalletCapabilities as k, 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 };
303
+ //# sourceMappingURL=index-CIHK7Ew9.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CIHK7Ew9.d.cts","names":[],"sources":["../src/provider/types.ts","../src/provider/validation.ts","../src/provider/discovery.ts"],"mappings":";;;;UACiB,kBAAA;;EAEf,EAAA;EAFiC;EAIjC,IAAA;EAJiC;EAMjC,OAAA;AAAA;;UAIe,aAAA;EAJR;EAMP,OAAA;EAF4B;EAI5B,SAAA;EAJ4B;EAM5B,KAAA;AAAA;;UAIe,aAAA;EAJV;EAML,WAAA;EAF4B;EAI5B,QAAA,WAAmB,aAAa;AAAA;;UAIjB,kBAAA;EAJI;EAMnB,OAAA;EANgC;EAQhC,WAAA;EAJiC;EAMjC,WAAA;IAAe,QAAA;EAAA;AAAA;;;;AAAQ;AAoBzB;;;;;;;;;;;;;KAAY,eAAA;EACN,MAAA;AAAA;EACA,MAAA;AAAA;EACA,MAAA;AAAA;EAEA,MAAA;EACA,MAAA;IAAU,OAAA;IAAiB,WAAA;EAAA;AAAA;EAG3B,MAAA;EACA,MAAA;IAAU,OAAA;IAAiB,WAAA;IAAqB,WAAA;EAAA;AAAA;EAGhD,MAAA;EACA,MAAA;IACE,OAAA;IACA,WAAA;IACA,iBAAA;EAAA;AAAA;;UAKS,qBAAA;EAqBf;EAnBA,iBAAA;EAqBA;EAnBA,IAAI;AAAA;;UAIW,uBAAA;EAuCf;EArCA,IAAI;AAAA;;;;AAqC0D;AAiBhE;;;UA5CiB,cAAA;EACf,IAAA,EAAM,kBAAA;EA+DK;EA7DX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nRwC;AAiBhE;;;;AAAmC;AAoBnC;iBC0RsB,2BAAA,CACpB,KAAA,WACA,WAAA,UACA,OAAA,EAAS,aAAA,EACT,WAAA,WACC,OAAA,CAAQ,qBAAA;;;;cC5bE,sBAAA;AFHb;AAAA,cEKa,uBAAA;;cAEA,wBAAA;;;;;AFDJ;AAIT;;;;;;iBEoBgB,sBAAA,CACd,QAAA,EAAU,cAAA,EACV,MAAA,GAAQ,WAA6B;;AFhBhC;AAIP;;;;;;;;AAIkC;AAIlC;;;;;iBEiCgB,uBAAA,CACd,QAAA,GAAW,QAAA,EAAU,cAAA,WACrB,MAAA,GAAQ,WAA6B"}
@@ -0,0 +1,303 @@
1
+ import { SignedTransaction, Transaction } from "@thruputchain/protocol";
2
+
3
+ //#region src/provider/types.d.ts
4
+ /** Public identity advertised by a version 2 provider. Not an attestation. */
5
+ interface WalletProviderInfo {
6
+ /** Stable discovery ID: 1–64 ASCII letters, digits, dots, underscores, or hyphens. */
7
+ id: string;
8
+ /** Display text: 1–80 characters, without controls or surrounding whitespace. */
9
+ name: string;
10
+ /** Supported wire contract version. */
11
+ version: "2.0.0";
12
+ }
13
+ /** Wire pubkey account: unprefixed base58 and a decimal u64 derivation nonce. */
14
+ interface WalletAccount {
15
+ /** Derived pubkey account address: 32 bytes of case-sensitive base58. */
16
+ address: string;
17
+ /** Non-small-order, prime-order Ed25519 key in the same 32-byte base58 format. */
18
+ publicKey: string;
19
+ /** Canonical decimal u64 account-derivation nonce, not a transaction nonce. */
20
+ nonce: string;
21
+ }
22
+ /** Origin-authorized accounts on a network identified by a 32-byte base58 hash. */
23
+ interface WalletSession {
24
+ /** Current network identity, retained even when the origin has no permission. */
25
+ networkHash: string;
26
+ /** At most 32 unique addresses; empty for a disconnected or unauthorized origin. */
27
+ accounts: readonly WalletAccount[];
28
+ }
29
+ /** Non-interactive execution capabilities for one authorized account and network. */
30
+ interface WalletCapabilities {
31
+ /** Canonical account address used in the capability request. */
32
+ account: string;
33
+ /** Network identity: unprefixed, case-sensitive 32-byte base58. */
34
+ networkHash: string;
35
+ /** Ordered, all-or-nothing DefaultWallet calls; null means unsupported. */
36
+ atomicBatch: {
37
+ maxCalls: number;
38
+ } | null;
39
+ }
40
+ /**
41
+ * The complete provider request surface. Requests accept exactly the fields shown.
42
+ * See {@link WalletProvider.request} for each method's result and permission rules.
43
+ *
44
+ * Signing parameters select an authorized account address and the current session's
45
+ * network hash (unprefixed, case-sensitive base58). Transaction payloads are
46
+ * lowercase, even-length, 0x-prefixed canonical classic XDR, with no trailing bytes.
47
+ * Providers must enforce {@link MAX_UNSIGNED_TRANSACTION_BYTES} before user approval;
48
+ * signed payloads are bounded by {@link MAX_TRANSACTION_BYTES}.
49
+ *
50
+ * Signing never broadcasts. Submission requires the exact signed bytes previously
51
+ * approved for the trusted caller origin, account, and network. Providers must clear
52
+ * approvals on session changes or disconnect and recheck authorization before signing
53
+ * or broadcasting. Page-supplied parameters cannot establish the caller's origin.
54
+ *
55
+ * @see https://docs.thruput.network/tools/wallet-provider/
56
+ */
57
+ type ProviderRequest = {
58
+ method: "connect";
59
+ } | {
60
+ method: "getSession";
61
+ } | {
62
+ method: "disconnect";
63
+ } | {
64
+ method: "getCapabilities";
65
+ params: {
66
+ account: string;
67
+ networkHash: string;
68
+ };
69
+ } | {
70
+ method: "signTransaction";
71
+ params: {
72
+ account: string;
73
+ networkHash: string;
74
+ transaction: string;
75
+ };
76
+ } | {
77
+ method: "submitTransaction";
78
+ params: {
79
+ account: string;
80
+ networkHash: string;
81
+ signedTransaction: string;
82
+ };
83
+ };
84
+ /** Approved signed XDR and the canonical RPC transaction/receipt hash. */
85
+ interface SignTransactionResult {
86
+ /** Canonical signed XDR preserving the approved unsigned bytes, with one signature. */
87
+ signedTransaction: string;
88
+ /** Base58 SHA-256 of unsigned transaction XDR; excludes signatures and network. */
89
+ hash: string;
90
+ }
91
+ /** Broadcast acknowledgement, not an execution receipt. */
92
+ interface SubmitTransactionResult {
93
+ /** The previously approved transaction hash; query its receipt on the original network. */
94
+ hash: string;
95
+ }
96
+ /**
97
+ * Framework- and transport-neutral, origin-scoped wallet interface.
98
+ * Validate unknown results with the matching parser before using them.
99
+ *
100
+ * @see https://docs.thruput.network/tools/wallet-provider/
101
+ * @see https://docs.thruput.network/tools/wallet-integration/
102
+ */
103
+ interface WalletProvider {
104
+ info: WalletProviderInfo;
105
+ /** Optional request extensions. Absence means legacy single-call behavior. */
106
+ supportedMethods?: readonly string[];
107
+ /**
108
+ * Send a request across the wallet boundary. The result is unknown until validated.
109
+ *
110
+ * | Method | Result | Permission and behavior |
111
+ * | --- | --- | --- |
112
+ * | `connect` | {@link WalletSession} | Request origin-scoped permission through wallet UI; reject on refusal. Success has at least one authorized account. |
113
+ * | `getSession` | {@link WalletSession} | Non-interactive snapshot; never prompt or grant access. Unauthorized origins see empty accounts and the current network hash. |
114
+ * | `disconnect` | `null` | Idempotently revoke this origin's permission and pending approvals. |
115
+ * | `getCapabilities` | {@link WalletCapabilities} | Non-interactive; requires an authorized account on the requested network. Older providers return 4200. |
116
+ * | `signTransaction` | {@link SignTransactionResult} | Approve and sign the exact unsigned transaction; never broadcast. |
117
+ * | `submitTransaction` | {@link SubmitTransactionResult} | Broadcast only exact previously approved signed bytes; acknowledgement is not an execution receipt. |
118
+ *
119
+ * Changes caused by connect/disconnect must reach page-facing listeners before the
120
+ * request resolves, including across bridges with separate response/event paths.
121
+ */
122
+ request(request: ProviderRequest): Promise<unknown>;
123
+ /**
124
+ * Subscribe to full session snapshots for changes to accounts, authorization,
125
+ * account metadata, or network, including disconnect. Subscription itself emits
126
+ * no snapshot; use `getSession` to read one. See {@link request} for event ordering.
127
+ *
128
+ * @returns An idempotent unsubscribe function.
129
+ */
130
+ on(event: "change", listener: (session: WalletSession) => void): () => void;
131
+ }
132
+ /**
133
+ * Stable provider error codes, including JSON-RPC-style request failures.
134
+ *
135
+ * | Code | Meaning |
136
+ * | --- | --- |
137
+ * | 4001 | User rejected the request. |
138
+ * | 4100 | Origin/account unauthorized, stale session, or no matching approval. |
139
+ * | 4200 | Unsupported method. |
140
+ * | 4900 | Provider disconnected or transport unavailable. |
141
+ * | 4901 | Requested network does not match. |
142
+ * | -32602 | Invalid parameters, noncanonical encoding, or exceeded input limits. |
143
+ * | -32603 | Internal error or invalid provider result. |
144
+ * | -32002 | Another operation is pending. |
145
+ */
146
+ type WalletProviderErrorCode = 4001 | 4100 | 4200 | 4900 | 4901 | -32602 | -32603 | -32002;
147
+ /**
148
+ * A provider failure with a {@link WalletProviderErrorCode | stable numeric code}.
149
+ * Preserve `code` and a human-readable `message` across bridges; `instanceof` does
150
+ * not work across all realms. {@link parseWalletProviderError} reconstructs errors
151
+ * with recognized codes and messages of at most 1,024 characters.
152
+ *
153
+ * After submit starts, even failure may mean broadcast. Keep the previously saved
154
+ * hash and query its status on the original network instead of automatically
155
+ * preparing or signing a replacement transaction.
156
+ */
157
+ declare class WalletProviderError extends Error {
158
+ readonly code: WalletProviderErrorCode;
159
+ constructor(code: WalletProviderErrorCode, message: string);
160
+ }
161
+ //#endregion
162
+ //#region src/provider/validation.d.ts
163
+ /** Maximum decoded signed XDR size: 1,048,576 bytes (1 MiB). */
164
+ declare const MAX_TRANSACTION_BYTES = 1048576;
165
+ /**
166
+ * Maximum unsigned XDR size: 1,048,460 bytes. Providers must enforce this before
167
+ * requesting user approval. Reserves 116 bytes within {@link MAX_TRANSACTION_BYTES}
168
+ * for the Ed25519 pubkey envelope: the signature vector count, key ID, scheme,
169
+ * and 64-byte signature, plus the present `pubkey_claim_key` option holding the
170
+ * scheme-tagged 32-byte key.
171
+ */
172
+ declare const MAX_UNSIGNED_TRANSACTION_BYTES: number;
173
+ /** Maximum accounts in one session. */
174
+ declare const MAX_WALLET_ACCOUNTS = 32;
175
+ /** Current native DefaultWallet execute call limit. */
176
+ declare const MAX_DEFAULT_WALLET_CALLS = 16;
177
+ /** Validate scoped DefaultWallet capabilities. Does not establish authorization. */
178
+ declare function parseWalletCapabilities(value: unknown): WalletCapabilities;
179
+ /** Validate an unprefixed, case-sensitive base58 address, public key, or hash. */
180
+ declare function parseWalletIdentifier(value: unknown): string;
181
+ /** Validate a case-sensitive, unprefixed base58 network hash. */
182
+ declare function parseWalletNetworkHash(value: unknown): string;
183
+ /**
184
+ * Validate and freeze an account snapshot, including a non-small-order, prime-order
185
+ * Ed25519 key and its derived address. The nonce is canonical decimal u64 account
186
+ * derivation data, not a transaction nonce. Rejects extra fields and noncanonical
187
+ * values rather than normalizing them; malformed input throws code -32602.
188
+ */
189
+ declare function parseWalletAccount(value: unknown): WalletAccount;
190
+ /**
191
+ * Strictly validate a session and return a frozen snapshot with frozen accounts.
192
+ * Requires a canonical network hash and at most {@link MAX_WALLET_ACCOUNTS} unique
193
+ * account addresses. Empty accounts are valid for an unauthorized origin; this
194
+ * parser does not enforce the nonempty result required by a successful `connect`.
195
+ */
196
+ declare function parseWalletSession(value: unknown): WalletSession;
197
+ /** Validate bounded display metadata; never render provider names as HTML. */
198
+ declare function parseWalletProviderInfo(value: unknown): WalletProviderInfo;
199
+ /**
200
+ * Validate a provider's structural boundary and return the original live object.
201
+ * Preserves identity and method receivers; metadata is validated, not snapshotted.
202
+ * Unlike {@link parseWalletAccount} and {@link parseWalletSession}, this does not
203
+ * freeze the input. Checks versioned metadata and callable `request`/`on` members,
204
+ * not their behavior, permissions, returned values, or the provider's trustworthiness.
205
+ */
206
+ declare function parseWalletProvider(value: unknown): WalletProvider;
207
+ /**
208
+ * Reconstruct a serialized provider error, without relying on `instanceof`.
209
+ * Requires a recognized {@link WalletProviderErrorCode} and a message of at most
210
+ * 1,024 characters. Invalid errors throw a new error with code -32602.
211
+ */
212
+ declare function parseWalletProviderError(value: unknown): WalletProviderError;
213
+ /**
214
+ * Decode bounded canonical unsigned XDR, rejecting trailing or altered encodings.
215
+ * Accepts lowercase, even-length, 0x-prefixed hex within
216
+ * {@link MAX_UNSIGNED_TRANSACTION_BYTES}; providers must check this before approval.
217
+ * Does not establish account authorization; use {@link assertWalletTransaction}
218
+ * to check the transaction's account claim and enforce origin permission separately.
219
+ */
220
+ declare function parseTransactionHex(value: unknown): Transaction;
221
+ /** Decode bounded canonical signed XDR; signature verification is separate. */
222
+ declare function parseSignedTransactionHex(value: unknown): SignedTransaction;
223
+ /**
224
+ * Parse the exact request union into a new request object, including bounded,
225
+ * canonical XDR. Unknown methods fail with 4200; malformed known requests fail
226
+ * with -32602. This validates input, not origin permission or prior approval.
227
+ * Bridges must bound raw messages before JSON parsing: at most 2,096,922 unsigned
228
+ * or 2,097,154 signed transaction-hex characters, including 0x.
229
+ */
230
+ declare function parseProviderRequest(value: unknown): ProviderRequest;
231
+ /**
232
+ * Validate a signing response's wire structure and return a new result object.
233
+ * Checks canonical signed XDR and hash encoding, not signature, hash correctness,
234
+ * or approval. Use {@link verifySignTransactionResult} for cryptographic validation.
235
+ */
236
+ declare function parseSignTransactionResult(value: unknown): SignTransactionResult;
237
+ /**
238
+ * Validate a submission response's hash encoding and return a new result object.
239
+ * Does not compare the hash to approved bytes or confirm broadcast or execution.
240
+ */
241
+ declare function parseSubmitTransactionResult(value: unknown): SubmitTransactionResult;
242
+ /** Require the root address and complete pubkey claim to match a wire account. */
243
+ declare function assertWalletTransaction(tx: Transaction, account: WalletAccount): void;
244
+ /**
245
+ * Verify unchanged XDR, a single strict network-bound signature, and receipt hash.
246
+ * Requires the exact unsigned transaction bytes and matching root address/pubkey
247
+ * claim, and an attached `pubkey_claim_key` equal to the account's Ed25519 key.
248
+ * The signature must be Ed25519 with public-key ID zero, verified over
249
+ * `transactionSignaturePreimage(networkHash, tx)` with ZIP-215 disabled and both
250
+ * key and signature point R non-small-order and prime-order. The hash is SHA-256
251
+ * of unsigned XDR, excluding signatures and network.
252
+ *
253
+ * @param networkHash - A 32-byte base58 identifier from the authorized session.
254
+ * @returns A frozen verified result. This does not establish origin permission
255
+ * or a retained approval to submit; the provider must enforce both separately.
256
+ *
257
+ * @remarks
258
+ * Requires Web Crypto (HTTPS or localhost in browsers). Invalid signing results
259
+ * throw code -32603; invalid expected inputs fail their boundary validation first.
260
+ *
261
+ * @see https://docs.thruput.network/tools/wallet-provider/
262
+ */
263
+ declare function verifySignTransactionResult(value: unknown, transaction: string, account: WalletAccount, networkHash: string): Promise<SignTransactionResult>;
264
+ //#endregion
265
+ //#region src/provider/discovery.d.ts
266
+ /** Discovery request event name. */
267
+ declare const REQUEST_PROVIDER_EVENT = "thruput:requestProvider";
268
+ /** Announcement detail is the provider itself, not an envelope. */
269
+ declare const ANNOUNCE_PROVIDER_EVENT = "thruput:announceProvider";
270
+ /** Maximum distinct provider IDs retained by one discovery subscription. */
271
+ declare const MAX_DISCOVERED_PROVIDERS = 32;
272
+ /**
273
+ * Validate and announce a live provider now and on each discovery request.
274
+ * Announcement detail is the provider itself. Defaults to `window`; pass an
275
+ * `EventTarget` outside a browser. Importing this module needs no browser globals.
276
+ *
277
+ * @returns Idempotent cleanup that removes the request listener. It stops future
278
+ * announcements from this registration, but does not retract a provider already
279
+ * discovered, disconnect sessions, or revoke permissions. There is no unregister event.
280
+ *
281
+ * @see https://docs.thruput.network/tools/wallet-provider/
282
+ */
283
+ declare function registerWalletProvider(provider: WalletProvider, target?: EventTarget): () => void;
284
+ /**
285
+ * Discover multiple providers in either load order, reporting each valid ID once.
286
+ * Installs the announcement listener before requesting providers. Malformed
287
+ * announcements are ignored; the first valid announcement for an ID wins, up to
288
+ * {@link MAX_DISCOVERED_PROVIDERS} IDs per subscription. IDs remain reserved until
289
+ * cleanup, even if a provider stops announcing. Discovery does not track removals.
290
+ *
291
+ * Defaults to `window`; pass an `EventTarget` outside a browser. IDs and names can
292
+ * be spoofed by page scripts: discovery validates shape, not wallet identity or trust.
293
+ * Render names as text, never HTML.
294
+ *
295
+ * @returns Idempotent cleanup that removes the listener and releases retained IDs.
296
+ * It does not disconnect discovered providers or revoke their permissions.
297
+ *
298
+ * @see https://docs.thruput.network/tools/wallet-integration/
299
+ */
300
+ declare function discoverWalletProviders(listener: (provider: WalletProvider) => void, target?: EventTarget): () => void;
301
+ //#endregion
302
+ export { WalletProvider as A, parseWalletSession as C, SubmitTransactionResult as D, SignTransactionResult as E, WalletProviderErrorCode as M, WalletProviderInfo as N, WalletAccount as O, WalletSession as P, parseWalletProviderInfo as S, ProviderRequest as T, 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, WalletProviderError as j, WalletCapabilities as k, 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 };
303
+ //# sourceMappingURL=index-CIHK7Ew9.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CIHK7Ew9.d.ts","names":[],"sources":["../src/provider/types.ts","../src/provider/validation.ts","../src/provider/discovery.ts"],"mappings":";;;;UACiB,kBAAA;;EAEf,EAAA;EAFiC;EAIjC,IAAA;EAJiC;EAMjC,OAAA;AAAA;;UAIe,aAAA;EAJR;EAMP,OAAA;EAF4B;EAI5B,SAAA;EAJ4B;EAM5B,KAAA;AAAA;;UAIe,aAAA;EAJV;EAML,WAAA;EAF4B;EAI5B,QAAA,WAAmB,aAAa;AAAA;;UAIjB,kBAAA;EAJI;EAMnB,OAAA;EANgC;EAQhC,WAAA;EAJiC;EAMjC,WAAA;IAAe,QAAA;EAAA;AAAA;;;;AAAQ;AAoBzB;;;;;;;;;;;;;KAAY,eAAA;EACN,MAAA;AAAA;EACA,MAAA;AAAA;EACA,MAAA;AAAA;EAEA,MAAA;EACA,MAAA;IAAU,OAAA;IAAiB,WAAA;EAA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