@thruputchain/client 0.0.0-stage → 0.25.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 (182) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +935 -2
  3. package/dist/actions-CdFSUTO2.js +298 -0
  4. package/dist/actions-CdFSUTO2.js.map +1 -0
  5. package/dist/actions-DxJZ3yIv.cjs +357 -0
  6. package/dist/actions-DxJZ3yIv.cjs.map +1 -0
  7. package/dist/actions.cjs +19 -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/client-BxB6ktQd.d.cts +690 -0
  12. package/dist/client-BxB6ktQd.d.cts.map +1 -0
  13. package/dist/client-BxB6ktQd.d.ts +690 -0
  14. package/dist/client-BxB6ktQd.d.ts.map +1 -0
  15. package/dist/codec-B7HJjMzI.cjs +8190 -0
  16. package/dist/codec-B7HJjMzI.cjs.map +1 -0
  17. package/dist/codec-CX-19jac.js +8130 -0
  18. package/dist/codec-CX-19jac.js.map +1 -0
  19. package/dist/contract-BpxjDMHw.js +1105 -0
  20. package/dist/contract-BpxjDMHw.js.map +1 -0
  21. package/dist/contract-D0wCFcAN.cjs +1219 -0
  22. package/dist/contract-D0wCFcAN.cjs.map +1 -0
  23. package/dist/contract.cjs +58 -0
  24. package/dist/contract.d.cts +3 -0
  25. package/dist/contract.d.ts +3 -0
  26. package/dist/contract.js +2 -0
  27. package/dist/contracts.cjs +1050 -0
  28. package/dist/contracts.cjs.map +1 -0
  29. package/dist/contracts.d.cts +397 -0
  30. package/dist/contracts.d.cts.map +1 -0
  31. package/dist/contracts.d.ts +397 -0
  32. package/dist/contracts.d.ts.map +1 -0
  33. package/dist/contracts.js +1030 -0
  34. package/dist/contracts.js.map +1 -0
  35. package/dist/dev_wallet-BXWK5KR6.cjs +530 -0
  36. package/dist/dev_wallet-BXWK5KR6.cjs.map +1 -0
  37. package/dist/dev_wallet-C9eMQROk.js +497 -0
  38. package/dist/dev_wallet-C9eMQROk.js.map +1 -0
  39. package/dist/domainSeparator-B_vU_zUD.cjs +102 -0
  40. package/dist/domainSeparator-B_vU_zUD.cjs.map +1 -0
  41. package/dist/domainSeparator-CBCvxIj-.js +79 -0
  42. package/dist/domainSeparator-CBCvxIj-.js.map +1 -0
  43. package/dist/execution-CRDyKu45.d.ts +227 -0
  44. package/dist/execution-CRDyKu45.d.ts.map +1 -0
  45. package/dist/execution-DyxaIG4v.d.cts +227 -0
  46. package/dist/execution-DyxaIG4v.d.cts.map +1 -0
  47. package/dist/hex-DIcaALXL.js +112 -0
  48. package/dist/hex-DIcaALXL.js.map +1 -0
  49. package/dist/hex-DkGpiZ5e.cjs +189 -0
  50. package/dist/hex-DkGpiZ5e.cjs.map +1 -0
  51. package/dist/index--5LsCotr.d.ts +192 -0
  52. package/dist/index--5LsCotr.d.ts.map +1 -0
  53. package/dist/index-B5KqSHeL.d.cts +192 -0
  54. package/dist/index-B5KqSHeL.d.cts.map +1 -0
  55. package/dist/index-BZ0O5jZG.d.cts +163 -0
  56. package/dist/index-BZ0O5jZG.d.cts.map +1 -0
  57. package/dist/index-BuPQcAK2.d.ts +23 -0
  58. package/dist/index-BuPQcAK2.d.ts.map +1 -0
  59. package/dist/index-ByNNqY7S.d.cts +83 -0
  60. package/dist/index-ByNNqY7S.d.cts.map +1 -0
  61. package/dist/index-C-M-4jMR.d.cts +263 -0
  62. package/dist/index-C-M-4jMR.d.cts.map +1 -0
  63. package/dist/index-C97zw2rk.d.ts +137 -0
  64. package/dist/index-C97zw2rk.d.ts.map +1 -0
  65. package/dist/index-CIHK7Ew9.d.cts +303 -0
  66. package/dist/index-CIHK7Ew9.d.cts.map +1 -0
  67. package/dist/index-CIHK7Ew9.d.ts +303 -0
  68. package/dist/index-CIHK7Ew9.d.ts.map +1 -0
  69. package/dist/index-CXuO2Zjx.d.ts +263 -0
  70. package/dist/index-CXuO2Zjx.d.ts.map +1 -0
  71. package/dist/index-DOEBWXY2.d.cts +137 -0
  72. package/dist/index-DOEBWXY2.d.cts.map +1 -0
  73. package/dist/index-DzrLv3EA.d.cts +82 -0
  74. package/dist/index-DzrLv3EA.d.cts.map +1 -0
  75. package/dist/index-DzrLv3EA.d.ts +82 -0
  76. package/dist/index-DzrLv3EA.d.ts.map +1 -0
  77. package/dist/index-fdTURpBk.d.ts +83 -0
  78. package/dist/index-fdTURpBk.d.ts.map +1 -0
  79. package/dist/index-sAzHHayu.d.ts +163 -0
  80. package/dist/index-sAzHHayu.d.ts.map +1 -0
  81. package/dist/index-uQqRk9Ww.d.cts +23 -0
  82. package/dist/index-uQqRk9Ww.d.cts.map +1 -0
  83. package/dist/index.cjs +478 -0
  84. package/dist/index.cjs.map +1 -0
  85. package/dist/index.d.cts +173 -0
  86. package/dist/index.d.cts.map +1 -0
  87. package/dist/index.d.ts +173 -0
  88. package/dist/index.d.ts.map +1 -0
  89. package/dist/index.js +231 -0
  90. package/dist/index.js.map +1 -0
  91. package/dist/provider.cjs +101 -0
  92. package/dist/provider.cjs.map +1 -0
  93. package/dist/provider.d.cts +2 -0
  94. package/dist/provider.d.ts +2 -0
  95. package/dist/provider.js +76 -0
  96. package/dist/provider.js.map +1 -0
  97. package/dist/readError-BVbfTMLv.cjs +604 -0
  98. package/dist/readError-BVbfTMLv.cjs.map +1 -0
  99. package/dist/readError-Dn_XN98x.js +551 -0
  100. package/dist/readError-Dn_XN98x.js.map +1 -0
  101. package/dist/readViews-BKJtE5J3.d.cts +594 -0
  102. package/dist/readViews-BKJtE5J3.d.cts.map +1 -0
  103. package/dist/readViews-C_FX8wby.d.ts +594 -0
  104. package/dist/readViews-C_FX8wby.d.ts.map +1 -0
  105. package/dist/rolldown-runtime-D6vf50IK.cjs +28 -0
  106. package/dist/sendInvocation-2EZanZZr.cjs +661 -0
  107. package/dist/sendInvocation-2EZanZZr.cjs.map +1 -0
  108. package/dist/sendInvocation-C4ruTC-9.js +505 -0
  109. package/dist/sendInvocation-C4ruTC-9.js.map +1 -0
  110. package/dist/sign-BewmV_EL.cjs +139 -0
  111. package/dist/sign-BewmV_EL.cjs.map +1 -0
  112. package/dist/sign-DVIRyW8Y.js +122 -0
  113. package/dist/sign-DVIRyW8Y.js.map +1 -0
  114. package/dist/sign-Ve0eetRO.d.ts +48 -0
  115. package/dist/sign-Ve0eetRO.d.ts.map +1 -0
  116. package/dist/sign-eUT0iGQG.d.cts +48 -0
  117. package/dist/sign-eUT0iGQG.d.cts.map +1 -0
  118. package/dist/signed-op.cjs +9 -0
  119. package/dist/signed-op.d.cts +3 -0
  120. package/dist/signed-op.d.ts +3 -0
  121. package/dist/signed-op.js +3 -0
  122. package/dist/signedOp-Bluo0OAd.cjs +183 -0
  123. package/dist/signedOp-Bluo0OAd.cjs.map +1 -0
  124. package/dist/signedOp-x4fakrr4.js +166 -0
  125. package/dist/signedOp-x4fakrr4.js.map +1 -0
  126. package/dist/signed_op-BzVbBgv4.js +154 -0
  127. package/dist/signed_op-BzVbBgv4.js.map +1 -0
  128. package/dist/signed_op-DFgQ2yFj.d.ts +58 -0
  129. package/dist/signed_op-DFgQ2yFj.d.ts.map +1 -0
  130. package/dist/signed_op-LwxrDud8.d.cts +58 -0
  131. package/dist/signed_op-LwxrDud8.d.cts.map +1 -0
  132. package/dist/signed_op-z_8fqAi1.cjs +175 -0
  133. package/dist/signed_op-z_8fqAi1.cjs.map +1 -0
  134. package/dist/signers-BFP84wJP.cjs +137 -0
  135. package/dist/signers-BFP84wJP.cjs.map +1 -0
  136. package/dist/signers-CzOSedwJ.js +120 -0
  137. package/dist/signers-CzOSedwJ.js.map +1 -0
  138. package/dist/signers.cjs +5 -0
  139. package/dist/signers.d.cts +3 -0
  140. package/dist/signers.d.ts +3 -0
  141. package/dist/signers.js +2 -0
  142. package/dist/size-506oTE28.js +91 -0
  143. package/dist/size-506oTE28.js.map +1 -0
  144. package/dist/size-OAFfOthl.cjs +108 -0
  145. package/dist/size-OAFfOthl.cjs.map +1 -0
  146. package/dist/transaction-CwkQxQOx.js +24 -0
  147. package/dist/transaction-CwkQxQOx.js.map +1 -0
  148. package/dist/transaction-DrSrCJ5y.cjs +47 -0
  149. package/dist/transaction-DrSrCJ5y.cjs.map +1 -0
  150. package/dist/transaction.cjs +13 -0
  151. package/dist/transaction.d.cts +3 -0
  152. package/dist/transaction.d.ts +3 -0
  153. package/dist/transaction.js +4 -0
  154. package/dist/transactionHash-CO9ajbvU.js +24 -0
  155. package/dist/transactionHash-CO9ajbvU.js.map +1 -0
  156. package/dist/transactionHash-D5yf4KoL.cjs +29 -0
  157. package/dist/transactionHash-D5yf4KoL.cjs.map +1 -0
  158. package/dist/transport-B-P16rs6.cjs +252 -0
  159. package/dist/transport-B-P16rs6.cjs.map +1 -0
  160. package/dist/transport-DqyoNtUy.js +234 -0
  161. package/dist/transport-DqyoNtUy.js.map +1 -0
  162. package/dist/transport.cjs +19 -0
  163. package/dist/transport.d.cts +3 -0
  164. package/dist/transport.d.ts +3 -0
  165. package/dist/transport.js +4 -0
  166. package/dist/types-BE40oD_Q.d.cts +18 -0
  167. package/dist/types-BE40oD_Q.d.cts.map +1 -0
  168. package/dist/types-BE40oD_Q.d.ts +18 -0
  169. package/dist/types-BE40oD_Q.d.ts.map +1 -0
  170. package/dist/validation-4w-vDGAi.cjs +543 -0
  171. package/dist/validation-4w-vDGAi.cjs.map +1 -0
  172. package/dist/validation-eXATmgO0.js +411 -0
  173. package/dist/validation-eXATmgO0.js.map +1 -0
  174. package/dist/wallet-Bthapk8i.cjs +709 -0
  175. package/dist/wallet-Bthapk8i.cjs.map +1 -0
  176. package/dist/wallet-CwWPYoHF.js +667 -0
  177. package/dist/wallet-CwWPYoHF.js.map +1 -0
  178. package/dist/wallet.cjs +27 -0
  179. package/dist/wallet.d.cts +3 -0
  180. package/dist/wallet.d.ts +3 -0
  181. package/dist/wallet.js +3 -0
  182. package/package.json +122 -4
@@ -0,0 +1,263 @@
1
+ import { xt as TransportRequestOptions } from "./client-BxB6ktQd.js";
2
+ import { E as AirdropActions, Ut as RequestAirdropOptions, Xt as WaitForTransactionReceiptOptions, a as ContractCall, in as AirdropSucceeded, k as CoreThruputClient, sn as BalanceResponse } from "./readViews-C_FX8wby.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-CRDyKu45.js";
4
+ import { A as WalletProvider, D as SubmitTransactionResult, E as SignTransactionResult, O as WalletAccount$1, k as WalletCapabilities } from "./index-CIHK7Ew9.js";
5
+ import { ContractAddress, GasAmount, NetworkHash, SHA256Hash, SignedTransaction, Transaction } from "@thruputchain/protocol";
6
+
7
+ //#region src/wallet/providerClient.d.ts
8
+ /** Root options and ordered calls for atomic provider-wallet execution. */
9
+ type PrepareBatchExecutionRequest = WalletBatchExecutionRequest & Omit<PrepareExecutionRequest, "invocation">;
10
+ /** Exact signed evidence available before broadcasting. Persist on the original network. */
11
+ interface PendingWalletTransaction extends SignTransactionResult {
12
+ readonly account: WalletAccount$1;
13
+ readonly networkHash: string;
14
+ }
15
+ /** Lifecycle controls. Cancellation can prevent dispatch; it never cancels a broadcast already sent. */
16
+ interface ProviderExecutionOptions {
17
+ /** Await durable application persistence before submitting; rejection prevents broadcast. */
18
+ onSigned: (pending: PendingWalletTransaction) => void | Promise<void>;
19
+ /** Shared submission/receipt budget after signing and persistence; network identity is pinned. */
20
+ wait?: WaitForTransactionReceiptOptions;
21
+ }
22
+ /** Typed calls executed atomically through DefaultWallet. */
23
+ interface ExecuteCallsRequest<T extends readonly ContractCall[]> {
24
+ calls: T;
25
+ gasLimit: GasAmount;
26
+ contractsToDeploy?: PrepareExecutionRequest["contractsToDeploy"];
27
+ expiryBlocks?: bigint;
28
+ }
29
+ /** External wallet binding. Network hash uses unprefixed, case-sensitive base58. */
30
+ interface CreateProviderWalletClientOptions {
31
+ /**
32
+ * RPC client connected to and verified against the application's expected network.
33
+ * A validated client identity must match `networkHash`; an unqualified
34
+ * CoreThruputClient requires the caller to verify its RPC network separately.
35
+ */
36
+ client: CoreThruputClient;
37
+ /** Live external provider with an already authorized session. */
38
+ provider: WalletProvider;
39
+ /** Wire pubkey account from the provider subpath, snapshotted at construction. */
40
+ account: WalletAccount$1;
41
+ /** Trusted application network identity: 32-byte base58; must match the session exactly. */
42
+ networkHash: string;
43
+ }
44
+ /**
45
+ * 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
47
+ * `getSession` before each operation and permanently invalidates on every `change`,
48
+ * a failed session read, or a mismatched session. Dispose and recreate after a
49
+ * change or reconnect; there is no automatic reconnect or retry.
50
+ *
51
+ * @see https://docs.thruput.network/tools/wallet-integration/
52
+ */
53
+ interface ProviderWalletClient {
54
+ /** Prepare a root deployment, preserving the explicit signing boundary. */
55
+ prepareDeployment(deployment: ContractDeployment, options: DeploymentOptions): Promise<Transaction>;
56
+ /** Persist approved evidence, deploy once, and verify the committed address. */
57
+ deployContractAndWait(deployment: ContractDeployment, options: DeploymentOptions, controls: ProviderExecutionOptions): Promise<ExecutionResult & {
58
+ address: import("@thruputchain/protocol").ContractAddress;
59
+ }>;
60
+ /** Prepare, sign, persist, submit once, then observe a successful receipt. */
61
+ executeAndWait(request: PrepareExecutionRequest, options: ProviderExecutionOptions): Promise<ExecutionResult>;
62
+ /** Execute an ordered atomic batch and decode typed child results. */
63
+ executeCallsAndWait<T extends readonly ContractCall[]>(request: ExecuteCallsRequest<T>, options: ProviderExecutionOptions): Promise<ExecutionResult & {
64
+ values: CallResults<T>;
65
+ }>;
66
+ /** Read fresh account/network capabilities; only 4200 falls back to unsupported. */
67
+ getCapabilities(): Promise<WalletCapabilities>;
68
+ /** Prepare one atomic batch after checking support. Does not sign or submit. */
69
+ prepareBatchExecution(request: PrepareBatchExecutionRequest): Promise<Transaction>;
70
+ /**
71
+ * Prepare a transaction using the default-wallet wrapper and existing nonce and
72
+ * expiry handling. Generates a random transaction nonce when none is supplied;
73
+ * this is separate from the account-derivation nonce. Snapshots input before
74
+ * asynchronous work and enforces the unsigned size bound. Does not sign or submit.
75
+ */
76
+ prepareExecution(request: PrepareExecutionRequest): Promise<Transaction>;
77
+ /**
78
+ * Request approval and sign without broadcasting. Snapshots the unsigned bytes,
79
+ * checks the account claim, and verifies exact bytes, strict network-bound
80
+ * signature, and canonical hash with {@link verifySignTransactionResult}.
81
+ * Once a new request passes local transaction and account-claim validation, it
82
+ * clears the previous approval before awaiting the session or provider. Failure
83
+ * or user rejection does not restore that approval. Only the latest successfully
84
+ * verified result can be submitted; invalid provider results invalidate the adapter.
85
+ * Await durable persistence of the result,
86
+ * account, and network before calling {@link submitTransaction}.
87
+ */
88
+ signTransaction(transaction: Transaction): Promise<SignTransactionResult>;
89
+ /**
90
+ * Submit the exact signed bytes and hash of this adapter's latest approval.
91
+ * Consumes approval before requesting broadcast, including when that request
92
+ * fails; the adapter never retries. Returns a broadcast acknowledgement, not an
93
+ * execution receipt, and verifies its hash against the approved result.
94
+ *
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.
99
+ */
100
+ submitTransaction(signed: SignTransactionResult): Promise<SubmitTransactionResult>;
101
+ /**
102
+ * Idempotently unsubscribe and permanently invalidate this adapter, clearing its
103
+ * approval. Does not revoke provider permission or cancel pending requests.
104
+ * A late response cannot reactivate the adapter. Use provider `disconnect` to
105
+ * revoke permission; create a new adapter for a later authorized session.
106
+ */
107
+ dispose(): void;
108
+ }
109
+ /**
110
+ * Synchronously bind a pubkey provider account without modifying the RPC client.
111
+ * Does not connect or request permission: first await provider `connect` and
112
+ * validate its session. Snapshots account/network configuration, validates account
113
+ * derivation and any validated client network identity, and subscribes to changes.
114
+ * Supply the application's trusted expected network hash, not a value adopted from
115
+ * the wallet. The RPC client must be connected to and verified against that same
116
+ * network. Every native client carries a discovered network identity, checked here.
117
+ * See {@link ProviderWalletClient} for invalidation and concurrency rules.
118
+ * Providers own signing UI deadlines. Execution controls bound submission and
119
+ * observation after signing; they cannot cancel a broadcast already sent.
120
+ *
121
+ * @example
122
+ * Await an application-owned `onSigned` callback to durably save the signed result
123
+ * and its original account/network before broadcasting. If saving fails, submission
124
+ * is never requested.
125
+ * `expectedNetworkHash` comes from trusted application configuration, and `client`
126
+ * must already be connected to and verified against that network.
127
+ *
128
+ * ```ts
129
+ * import type { CoreThruputClient } from "@thruputchain/client";
130
+ * import {
131
+ * parseWalletSession,
132
+ * parseWalletNetworkHash,
133
+ * type SignTransactionResult,
134
+ * type WalletAccount,
135
+ * type WalletProvider,
136
+ * } from "@thruputchain/client/provider";
137
+ * import {
138
+ * createProviderWalletClient,
139
+ * type PrepareExecutionRequest,
140
+ * } from "@thruputchain/client/wallet";
141
+ *
142
+ * async function sendWithWallet(
143
+ * client: CoreThruputClient,
144
+ * provider: WalletProvider,
145
+ * expectedNetworkHash: string,
146
+ * request: PrepareExecutionRequest,
147
+ * onSigned: (pending: SignTransactionResult & {
148
+ * account: WalletAccount;
149
+ * networkHash: string;
150
+ * }) => Promise<void>,
151
+ * ) {
152
+ * const networkHash = parseWalletNetworkHash(expectedNetworkHash);
153
+ * const session = parseWalletSession(await provider.request({ method: "connect" }));
154
+ * if (session.networkHash !== networkHash) {
155
+ * throw new Error("Wallet network does not match the application network");
156
+ * }
157
+ * const account = session.accounts[0];
158
+ * if (!account) throw new Error("No authorized account");
159
+ * const wallet = createProviderWalletClient({
160
+ * client, provider, account, networkHash,
161
+ * });
162
+ * try {
163
+ * const transaction = await wallet.prepareExecution(request);
164
+ * const signed = await wallet.signTransaction(transaction);
165
+ * await onSigned({ ...signed, account, networkHash });
166
+ * // On submit failure, recover using the saved hash and original network.
167
+ * return await wallet.submitTransaction(signed);
168
+ * } finally {
169
+ * wallet.dispose();
170
+ * }
171
+ * }
172
+ * ```
173
+ *
174
+ * @see https://docs.thruput.network/tools/wallet-integration/
175
+ * @see https://docs.thruput.network/tools/wallet-provider/
176
+ */
177
+ declare function createProviderWalletClient(options: CreateProviderWalletClientOptions): ProviderWalletClient;
178
+ //#endregion
179
+ //#region src/wallet/client.d.ts
180
+ /** Wallet airdrop options with the bound account as the default recipient. */
181
+ type WalletRequestAirdropOptions = Omit<RequestAirdropOptions, "recipient"> & {
182
+ readonly recipient?: ContractAddress;
183
+ };
184
+ /** Signer-bound transaction and account actions. */
185
+ interface WalletActions<TAccount extends WalletAccount = WalletAccount> {
186
+ readonly account: TAccount;
187
+ getBalance(request?: {
188
+ address?: Uint8Array;
189
+ }, options?: TransportRequestOptions): Promise<BalanceResponse>;
190
+ prepareTransaction(request: PrepareTransactionRequest): Promise<Transaction>;
191
+ signTransaction(transaction: Transaction): Promise<SignedTransaction>;
192
+ sendInvocation(request: PrepareTransactionRequest): Promise<SHA256Hash>;
193
+ /** Prepare explicit funding, deployment and optional initialization in one root. */
194
+ prepareDeployment(deployment: ContractDeployment, options: DeploymentOptions): Promise<Transaction>;
195
+ /** Submit deployment and return its predicted address before commitment. */
196
+ deployContract(deployment: ContractDeployment, options: DeploymentOptions): Promise<{
197
+ transactionHash: SHA256Hash;
198
+ address: ContractAddress;
199
+ }>;
200
+ /** Deploy, wait for success and verify the returned address. */
201
+ deployContractAndWait(deployment: ContractDeployment, options: DeploymentOptions, wait?: WaitForTransactionReceiptOptions): Promise<ExecutionResult & {
202
+ address: ContractAddress;
203
+ }>;
204
+ }
205
+ /** Transaction options accepted when wrapping an inner wallet invocation. */
206
+ type PrepareExecutionRequest<TRequest extends WalletExecutionRequest = WalletExecutionRequest> = TRequest & Omit<PrepareTransactionRequest, "invocation">;
207
+ /** Wallet-contract wrapping actions available when an adapter is configured. */
208
+ interface WalletExecutionActions<TRequest extends WalletExecutionRequest = WalletExecutionRequest> {
209
+ prepareExecution(request: PrepareExecutionRequest<TRequest>): Promise<Transaction>;
210
+ execute(request: PrepareExecutionRequest<TRequest>): Promise<SHA256Hash>;
211
+ /** Submit and require a successful committed receipt. */
212
+ executeAndWait(request: PrepareExecutionRequest<TRequest>, options?: WaitForTransactionReceiptOptions): Promise<ExecutionResult>;
213
+ /** Execute typed calls atomically and decode their ordered return values. */
214
+ executeCallsAndWait<T extends readonly ContractCall[]>(request: ExecuteCallsRequest<T>, options?: WaitForTransactionReceiptOptions): Promise<ExecutionResult & {
215
+ values: CallResults<T>;
216
+ }>;
217
+ }
218
+ /** Account-defaulted funding available when the underlying client supports it. */
219
+ interface WalletAirdropActions {
220
+ requestAirdrop(options?: WalletRequestAirdropOptions): Promise<AirdropSucceeded>;
221
+ }
222
+ /** 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);
224
+ /** 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>;
226
+ /** Signing-network input inferred from whether a client has validated identity. */
227
+ type WalletNetworkOptions<TClient extends CoreThruputClient> = TClient extends {
228
+ readonly network: {
229
+ readonly networkHash: Uint8Array;
230
+ };
231
+ } ? {
232
+ readonly networkHash?: never;
233
+ } : {
234
+ /** Signing network required when the client has no validated identity. */readonly networkHash: NetworkHash;
235
+ };
236
+ /** Decorate an existing client with signer-bound wallet behavior. */
237
+ declare function createWalletClient<TClient extends CoreThruputClient, TAccount extends WalletAccount, TRequest extends WalletExecutionRequest>(options: {
238
+ readonly client: TClient;
239
+ readonly account: TAccount;
240
+ readonly onSigned?: (submission: SubmissionEvidence) => void | Promise<void>;
241
+ readonly invocationAdapter: WalletInvocationAdapter<TRequest>;
242
+ } & WalletNetworkOptions<TClient>): ExecutableWalletClient<TClient, TAccount, TRequest>;
243
+ declare function createWalletClient<TClient extends CoreThruputClient, TAccount extends PubkeyAccount>(options: {
244
+ readonly client: TClient;
245
+ readonly account: TAccount;
246
+ readonly onSigned?: (submission: SubmissionEvidence) => void | Promise<void>;
247
+ readonly invocationAdapter?: undefined;
248
+ } & WalletNetworkOptions<TClient>): ExecutableWalletClient<TClient, TAccount>;
249
+ declare function createWalletClient<TClient extends CoreThruputClient, TAccount extends SourceAddressAccount>(options: {
250
+ readonly client: TClient;
251
+ readonly account: TAccount;
252
+ readonly onSigned?: (submission: SubmissionEvidence) => void | Promise<void>;
253
+ readonly invocationAdapter?: undefined;
254
+ } & WalletNetworkOptions<TClient>): WalletClient<TClient, TAccount>;
255
+ declare function createWalletClient<TClient extends CoreThruputClient, TAccount extends WalletAccount>(options: {
256
+ readonly client: TClient;
257
+ readonly account: TAccount;
258
+ readonly onSigned?: (submission: SubmissionEvidence) => void | Promise<void>;
259
+ readonly invocationAdapter?: undefined;
260
+ } & WalletNetworkOptions<TClient>): WalletClient<TClient, TAccount>;
261
+ //#endregion
262
+ 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-CXuO2Zjx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CXuO2Zjx.d.ts","names":[],"sources":["../src/wallet/providerClient.ts","../src/wallet/client.ts"],"mappings":";;;;;;;;KA+DY,4BAAA,GAA+B,2BAAA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AA;EAAA,SACH,iBAAA,EAAmB,uBAAA,CAAwB,QAAA;AAAA,IAClD,oBAAA,CAAqB,OAAA,IACxB,sBAAA,CAAuB,OAAA,EAAS,QAAA,EAAU,QAAA;AAAA,iBAC7B,kBAAA,iBACE,iBAAA,mBACC,aAAA,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,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,aAAA,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,137 @@
1
+ import { A as ThruputClient, Mt as ContractTypeDef, Tt as ContractSpec, jt as ContractType, l as ContractMethod, y as ContractViewOptions } from "./readViews-BKJtE5J3.cjs";
2
+ import { Calldata, Contract, ContractAddress, SHA256Hash } from "@thruputchain/protocol";
3
+ import { FixedArray, FixedBytes as FixedBytes$1, XdrCodec, fixedArray, fixedBytes } from "@thruputchain/xdr";
4
+
5
+ //#region src/contract/encode.d.ts
6
+ /**
7
+ * Resolve a contract-spec type into the XDR/CXS codec used to encode values.
8
+ *
9
+ * Pass `namedCodecs` when resolving named structs, enums, or unions from a
10
+ * contract spec. Build that map with {@link buildNamedCodecs}.
11
+ */
12
+ declare function resolveCodec(ty: ContractType, namedCodecs?: Record<string, XdrCodec<unknown>>): XdrCodec<unknown>;
13
+ /**
14
+ * Encode method arguments into contract calldata using a contract spec.
15
+ *
16
+ * Use this when constructing invocations from a spec without generated
17
+ * TypeScript bindings. Generated descriptors use their own resolved codecs.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * const namedCodecs = buildNamedCodecs(spec.type_defs);
22
+ * const calldata = encodeCalldata(
23
+ * spec,
24
+ * "Counter",
25
+ * "increment",
26
+ * [1n],
27
+ * namedCodecs,
28
+ * );
29
+ * ```
30
+ */
31
+ declare function encodeCalldata(spec: ContractSpec, interfaceName: string, methodName: string, args: unknown[], namedCodecs: Record<string, XdrCodec<unknown>>): Calldata;
32
+ /**
33
+ * Decode contract calldata into an object keyed by argument name.
34
+ *
35
+ * This is primarily useful for tooling, tests, and debugging generated
36
+ * invocations.
37
+ */
38
+ declare function decodeCalldata(spec: ContractSpec, interfaceName: string, methodName: string, data: Uint8Array, namedCodecs: Record<string, XdrCodec<unknown>>): Record<string, unknown>;
39
+ //#endregion
40
+ //#region src/contract/codegen.d.ts
41
+ /**
42
+ * Build codecs for named contract-spec types.
43
+ *
44
+ * The returned map is required by {@link encodeCalldata},
45
+ * {@link decodeCalldata}, and {@link resolveCodec} whenever a method argument
46
+ * references a named struct, enum, or union. It is keyed by
47
+ * {@link specIdKey} of each type's spec id.
48
+ *
49
+ * @throws If two definitions share a spec id.
50
+ */
51
+ declare function buildNamedCodecs(typeDefs: ContractTypeDef[]): Record<string, XdrCodec<unknown>>;
52
+ //#endregion
53
+ //#region src/contract/hash.d.ts
54
+ /**
55
+ * Return the network identity of a protocol contract.
56
+ *
57
+ * The hash covers the canonical encoded `Contract`, including its type and
58
+ * payload framing. Hashing only the raw artifact bytes produces a different
59
+ * value and therefore a different derived address.
60
+ *
61
+ * @example
62
+ * ```ts
63
+ * import {
64
+ * deriveContractAddress,
65
+ * hashContract,
66
+ * } from "@thruputchain/client";
67
+ *
68
+ * const contractHash = hashContract(contract);
69
+ * const address = deriveContractAddress(wallet, deploymentNonce, contractHash);
70
+ * ```
71
+ */
72
+ declare function hashContract(contract: Contract): SHA256Hash;
73
+ //#endregion
74
+ //#region src/derivation/contractAddress.d.ts
75
+ /**
76
+ * The on-chain address a deployment produces:
77
+ * `sha256(txs(ContractDeploymentHashPreimage))` over the deployer, nonce, and
78
+ * contract hash.
79
+ */
80
+ declare function deriveContractAddress(deployer: ContractAddress, nonce: SHA256Hash, contractHash: SHA256Hash): ContractAddress;
81
+ //#endregion
82
+ //#region src/contract/errors.d.ts
83
+ /** Error raised when contract bytes do not match their declared ABI type. */
84
+ declare class ContractDecodeError extends Error {
85
+ constructor(message: string, options?: ErrorOptions);
86
+ }
87
+ //#endregion
88
+ //#region src/contract/signedToken.d.ts
89
+ declare const signedTokenPreimageBrand: unique symbol;
90
+ /**
91
+ * A signed auth token as it appears in contract arguments and return values.
92
+ *
93
+ * On the wire a token occupies no calldata bytes: the runtime passes its
94
+ * handle out of band, and only contracts can mint or consume one. A client
95
+ * therefore only ever sees a placeholder, which this type is. `TPreimage`
96
+ * records the token's declared preimage type for documentation; no preimage
97
+ * is ever available off chain.
98
+ */
99
+ interface SignedToken<TPreimage = unknown> {
100
+ readonly kind: "signedToken";
101
+ readonly [signedTokenPreimageBrand]?: TPreimage;
102
+ }
103
+ /** The placeholder standing in for a signed auth token. */
104
+ declare function signedToken<TPreimage = unknown>(): SignedToken<TPreimage>;
105
+ /** Whether `value` is a signed-token placeholder. */
106
+ declare function isSignedToken(value: unknown): value is SignedToken;
107
+ //#endregion
108
+ //#region src/contract/instance.d.ts
109
+ /** A method descriptor with address/client defaults bound for reads and calls. */
110
+ type BoundContractMethod<A, R, E> = Omit<ContractMethod<A, R, E>, "view" | "viewOutcome" | "viewRequest" | "call"> & {
111
+ viewRequest(options: Omit<Parameters<ContractMethod<A, R, E>["viewRequest"]>[0], "address">): ReturnType<ContractMethod<A, R, E>["viewRequest"]>;
112
+ view(options: Omit<ContractViewOptions<A>, "client" | "address">): ReturnType<ContractMethod<A, R, E>["view"]>;
113
+ viewOutcome(options: Omit<ContractViewOptions<A>, "client" | "address">): ReturnType<ContractMethod<A, R, E>["viewOutcome"]>;
114
+ call(options: Omit<Parameters<ContractMethod<A, R, E>["call"]>[0], "address">): ReturnType<ContractMethod<A, R, E>["call"]>;
115
+ };
116
+ /** Bound methods inferred from a generated interface object. */
117
+ type ContractInstance<T> = { [K in keyof T]: T[K] extends ContractMethod<infer A, infer R, infer E> ? BoundContractMethod<A, R, E> : never };
118
+ /**
119
+ * Bind a generated interface to an address and public client.
120
+ * Views preserve heights and events and accept cancellation and minimum-height
121
+ * constraints. A minimum height is a freshness floor; use readViews when several
122
+ * results must come from the same snapshot.
123
+ *
124
+ * @example
125
+ * ```ts
126
+ * const token = getContract({ binding: ERC20.v0_1, address, client });
127
+ * const balance = await token.getBalanceOf.view({ args: { addr: owner }, signal });
128
+ * ```
129
+ */
130
+ declare function getContract<T extends Record<string, ContractMethod<any, unknown, unknown>>>(options: {
131
+ binding: T;
132
+ address: ContractAddress;
133
+ client: Pick<ThruputClient, "simulateInvocation">;
134
+ }): ContractInstance<T>;
135
+ //#endregion
136
+ export { resolveCodec as _, BoundContractMethod as a, SignedToken as c, ContractDecodeError as d, deriveContractAddress as f, encodeCalldata as g, decodeCalldata as h, fixedBytes as i, isSignedToken as l, buildNamedCodecs as m, FixedBytes$1 as n, ContractInstance as o, hashContract as p, fixedArray as r, getContract as s, FixedArray as t, signedToken as u };
137
+ //# sourceMappingURL=index-DOEBWXY2.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-DOEBWXY2.d.cts","names":[],"sources":["../src/contract/encode.ts","../src/contract/codegen.ts","../src/contract/hash.ts","../src/derivation/contractAddress.ts","../src/contract/errors.ts","../src/contract/signedToken.ts","../src/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S,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;;;;;;;;ANyKrB;AAiKX;;;;iBM1TgB,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"}
@@ -0,0 +1,82 @@
1
+ import { AuthClaim, Calldata, Contract, ContractAddress, ContractEntrypointID, CryptographicScheme, GasAmount, Invocation, NetworkHash, SignedTransaction, Transaction, Uniquifier } from "@thruputchain/protocol";
2
+
3
+ //#region src/transaction/build.d.ts
4
+ /**
5
+ * Build an invocation object from already-typed protocol values.
6
+ *
7
+ * Generated contract bindings usually call this helper for you. Use it directly
8
+ * when constructing a low-level invocation without generated bindings.
9
+ */
10
+ declare function createInvocation(params: {
11
+ invoked_address: ContractAddress;
12
+ entrypoint: ContractEntrypointID;
13
+ gas_limit: GasAmount;
14
+ calldata: Calldata;
15
+ }): Invocation;
16
+ /**
17
+ * Build an unsigned transaction from an invocation and authorization metadata.
18
+ *
19
+ * The returned transaction must be signed with {@link signTransaction} before it
20
+ * can be submitted to a Thruput JSON-RPC gateway.
21
+ */
22
+ declare function createTransaction(params: {
23
+ invocation: Invocation;
24
+ uniquifier: Uniquifier;
25
+ contracts_to_deploy: Contract[];
26
+ auth_claim: AuthClaim;
27
+ }): Transaction;
28
+ //#endregion
29
+ //#region src/transaction/serialize.d.ts
30
+ /** Serialize an unsigned transaction to its canonical protocol bytes. */
31
+ declare function serializeTransaction(tx: Transaction): Uint8Array;
32
+ /** Decode an unsigned transaction from canonical protocol bytes. */
33
+ declare function deserializeTransaction(data: Uint8Array): Transaction;
34
+ /** Serialize a signed transaction to the bytes accepted by the JSON-RPC API. */
35
+ declare function serializeSignedTransaction(stx: SignedTransaction): Uint8Array;
36
+ /** Decode a signed transaction from canonical protocol bytes. */
37
+ declare function deserializeSignedTransaction(data: Uint8Array): SignedTransaction;
38
+ //#endregion
39
+ //#region src/transaction/preimage.d.ts
40
+ /**
41
+ * The message every transaction signature covers:
42
+ *
43
+ * ```text
44
+ * cxs(DomainSeparator("Transaction")) || networkHash || txs(tx)
45
+ * ```
46
+ *
47
+ * The domain separator keeps a transaction signature from being reinterpreted
48
+ * as a signature over some other object whose encoding a transaction could be
49
+ * made to imitate. The network hash binds the signature to a single network, so
50
+ * a transaction signed for one chain cannot be replayed on another that happens
51
+ * to carry the same address with the same auth data.
52
+ *
53
+ * Note the two encodings: the prefix is CXS, which is how a `DomainSeparator`
54
+ * is encoded everywhere, while the transaction itself is classic XDR. The
55
+ * network hash is a fixed 32-byte opaque, whose CXS and XDR encodings are
56
+ * identical, so it is written verbatim.
57
+ *
58
+ * The result is signed directly — Ed25519 does its own hashing, so there is no
59
+ * pre-hash here. It must match the C++ validator's
60
+ * `hogd::transaction_signature_preimage` and the Rust
61
+ * `thruput_domain_separator::transaction_signature_preimage` byte for byte,
62
+ * or every signature is rejected.
63
+ *
64
+ * {@link signTransaction} calls this; reach for it directly only when handing
65
+ * bytes to a signer this package does not drive.
66
+ */
67
+ declare function transactionSignaturePreimage(networkHash: NetworkHash, tx: Transaction): Uint8Array;
68
+ //#endregion
69
+ //#region src/transaction/size.d.ts
70
+ /**
71
+ * Bytes a `kPubkeySignature` signed envelope adds to the unsigned transaction:
72
+ * the one-entry signature vector (count, key ID, signature) and the present
73
+ * `pubkey_claim_key` option holding the key.
74
+ *
75
+ * Reserve this much when bounding an unsigned transaction against a
76
+ * signed-transaction size limit: 116 bytes for Ed25519 and 5,284 bytes for
77
+ * ML-DSA-65 (a 3,309-byte signature and a 1,952-byte key).
78
+ */
79
+ declare function pubkeySignatureEnvelopeBytes(scheme: CryptographicScheme): number;
80
+ //#endregion
81
+ export { serializeSignedTransaction as a, createTransaction as c, deserializeTransaction as i, transactionSignaturePreimage as n, serializeTransaction as o, deserializeSignedTransaction as r, createInvocation as s, pubkeySignatureEnvelopeBytes as t };
82
+ //# sourceMappingURL=index-DzrLv3EA.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-DzrLv3EA.d.cts","names":[],"sources":["../src/transaction/build.ts","../src/transaction/serialize.ts","../src/transaction/preimage.ts","../src/transaction/size.ts"],"mappings":";;;;;;AAkBA;;;iBAAgB,gBAAA,CAAiB,MAAA;EAC/B,eAAA,EAAiB,eAAA;EACjB,UAAA,EAAY,oBAAA;EACZ,SAAA,EAAW,SAAA;EACX,QAAA,EAAU,QAAA;AAAA,IACR,UAAA;;;;;;;iBAeY,iBAAA,CAAkB,MAAA;EAChC,UAAA,EAAY,UAAA;EACZ,UAAA,EAAY,UAAA;EACZ,mBAAA,EAAqB,QAAA;EACrB,UAAA,EAAY,SAAA;AAAA,IACV,WAAA;;;;iBCvCY,oBAAA,CAAqB,EAAA,EAAI,WAAA,GAAc,UAAU;;iBAKjD,sBAAA,CAAuB,IAAA,EAAM,UAAA,GAAa,WAAW;;iBAKrD,0BAAA,CAA2B,GAAA,EAAK,iBAAA,GAAoB,UAAU;;iBAK9D,4BAAA,CACd,IAAA,EAAM,UAAA,GACL,iBAAiB;;;;;;ADHpB;;;;;;;;;;;;;;;;;;;;;AAKc;AAed;;iBEPgB,4BAAA,CACd,WAAA,EAAa,WAAA,EACb,EAAA,EAAI,WAAA,GACH,UAAA;;;;;;AFhBH;;;;;;iBGMgB,4BAAA,CACd,MAA2B,EAAnB,mBAAmB"}
@@ -0,0 +1,82 @@
1
+ import { AuthClaim, Calldata, Contract, ContractAddress, ContractEntrypointID, CryptographicScheme, GasAmount, Invocation, NetworkHash, SignedTransaction, Transaction, Uniquifier } from "@thruputchain/protocol";
2
+
3
+ //#region src/transaction/build.d.ts
4
+ /**
5
+ * Build an invocation object from already-typed protocol values.
6
+ *
7
+ * Generated contract bindings usually call this helper for you. Use it directly
8
+ * when constructing a low-level invocation without generated bindings.
9
+ */
10
+ declare function createInvocation(params: {
11
+ invoked_address: ContractAddress;
12
+ entrypoint: ContractEntrypointID;
13
+ gas_limit: GasAmount;
14
+ calldata: Calldata;
15
+ }): Invocation;
16
+ /**
17
+ * Build an unsigned transaction from an invocation and authorization metadata.
18
+ *
19
+ * The returned transaction must be signed with {@link signTransaction} before it
20
+ * can be submitted to a Thruput JSON-RPC gateway.
21
+ */
22
+ declare function createTransaction(params: {
23
+ invocation: Invocation;
24
+ uniquifier: Uniquifier;
25
+ contracts_to_deploy: Contract[];
26
+ auth_claim: AuthClaim;
27
+ }): Transaction;
28
+ //#endregion
29
+ //#region src/transaction/serialize.d.ts
30
+ /** Serialize an unsigned transaction to its canonical protocol bytes. */
31
+ declare function serializeTransaction(tx: Transaction): Uint8Array;
32
+ /** Decode an unsigned transaction from canonical protocol bytes. */
33
+ declare function deserializeTransaction(data: Uint8Array): Transaction;
34
+ /** Serialize a signed transaction to the bytes accepted by the JSON-RPC API. */
35
+ declare function serializeSignedTransaction(stx: SignedTransaction): Uint8Array;
36
+ /** Decode a signed transaction from canonical protocol bytes. */
37
+ declare function deserializeSignedTransaction(data: Uint8Array): SignedTransaction;
38
+ //#endregion
39
+ //#region src/transaction/preimage.d.ts
40
+ /**
41
+ * The message every transaction signature covers:
42
+ *
43
+ * ```text
44
+ * cxs(DomainSeparator("Transaction")) || networkHash || txs(tx)
45
+ * ```
46
+ *
47
+ * The domain separator keeps a transaction signature from being reinterpreted
48
+ * as a signature over some other object whose encoding a transaction could be
49
+ * made to imitate. The network hash binds the signature to a single network, so
50
+ * a transaction signed for one chain cannot be replayed on another that happens
51
+ * to carry the same address with the same auth data.
52
+ *
53
+ * Note the two encodings: the prefix is CXS, which is how a `DomainSeparator`
54
+ * is encoded everywhere, while the transaction itself is classic XDR. The
55
+ * network hash is a fixed 32-byte opaque, whose CXS and XDR encodings are
56
+ * identical, so it is written verbatim.
57
+ *
58
+ * The result is signed directly — Ed25519 does its own hashing, so there is no
59
+ * pre-hash here. It must match the C++ validator's
60
+ * `hogd::transaction_signature_preimage` and the Rust
61
+ * `thruput_domain_separator::transaction_signature_preimage` byte for byte,
62
+ * or every signature is rejected.
63
+ *
64
+ * {@link signTransaction} calls this; reach for it directly only when handing
65
+ * bytes to a signer this package does not drive.
66
+ */
67
+ declare function transactionSignaturePreimage(networkHash: NetworkHash, tx: Transaction): Uint8Array;
68
+ //#endregion
69
+ //#region src/transaction/size.d.ts
70
+ /**
71
+ * Bytes a `kPubkeySignature` signed envelope adds to the unsigned transaction:
72
+ * the one-entry signature vector (count, key ID, signature) and the present
73
+ * `pubkey_claim_key` option holding the key.
74
+ *
75
+ * Reserve this much when bounding an unsigned transaction against a
76
+ * signed-transaction size limit: 116 bytes for Ed25519 and 5,284 bytes for
77
+ * ML-DSA-65 (a 3,309-byte signature and a 1,952-byte key).
78
+ */
79
+ declare function pubkeySignatureEnvelopeBytes(scheme: CryptographicScheme): number;
80
+ //#endregion
81
+ export { serializeSignedTransaction as a, createTransaction as c, deserializeTransaction as i, transactionSignaturePreimage as n, serializeTransaction as o, deserializeSignedTransaction as r, createInvocation as s, pubkeySignatureEnvelopeBytes as t };
82
+ //# sourceMappingURL=index-DzrLv3EA.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-DzrLv3EA.d.ts","names":[],"sources":["../src/transaction/build.ts","../src/transaction/serialize.ts","../src/transaction/preimage.ts","../src/transaction/size.ts"],"mappings":";;;;;;AAkBA;;;iBAAgB,gBAAA,CAAiB,MAAA;EAC/B,eAAA,EAAiB,eAAA;EACjB,UAAA,EAAY,oBAAA;EACZ,SAAA,EAAW,SAAA;EACX,QAAA,EAAU,QAAA;AAAA,IACR,UAAA;;;;;;;iBAeY,iBAAA,CAAkB,MAAA;EAChC,UAAA,EAAY,UAAA;EACZ,UAAA,EAAY,UAAA;EACZ,mBAAA,EAAqB,QAAA;EACrB,UAAA,EAAY,SAAA;AAAA,IACV,WAAA;;;;iBCvCY,oBAAA,CAAqB,EAAA,EAAI,WAAA,GAAc,UAAU;;iBAKjD,sBAAA,CAAuB,IAAA,EAAM,UAAA,GAAa,WAAW;;iBAKrD,0BAAA,CAA2B,GAAA,EAAK,iBAAA,GAAoB,UAAU;;iBAK9D,4BAAA,CACd,IAAA,EAAM,UAAA,GACL,iBAAiB;;;;;;ADHpB;;;;;;;;;;;;;;;;;;;;;AAKc;AAed;;iBEPgB,4BAAA,CACd,WAAA,EAAa,WAAA,EACb,EAAA,EAAI,WAAA,GACH,UAAA;;;;;;AFhBH;;;;;;iBGMgB,4BAAA,CACd,MAA2B,EAAnB,mBAAmB"}