@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,192 @@
1
+ import { t as Signer } from "./types-BE40oD_Q.cjs";
2
+ import { BlockHeight, ContractAddress, NetworkHash } from "@thruputchain/protocol";
3
+ import { FixedBytes } from "@thruputchain/xdr";
4
+ import { ContractTypeDef } from "@thruputchain/contract-spec";
5
+
6
+ //#region src/signedOp/operation.d.ts
7
+ /**
8
+ * Wire form of a signed operation: the `Operation` struct of the
9
+ * `thruput-signed-op-if` interface, in the shape generated bindings give it.
10
+ *
11
+ * The network hash, the verifying contract, and the signing key are covered
12
+ * by the signature but deliberately absent here. The verifying contract
13
+ * supplies the first two from its own syscalls and checks the signature
14
+ * against the key it holds, so a submitter can name neither the network or
15
+ * contract a signature was meant for nor the key it is checked against.
16
+ *
17
+ * `block_expiry_height` and `nonce` are the chain's `Uniquifier`, in its
18
+ * field order, so their encoding is byte for byte a transaction's.
19
+ */
20
+ interface Operation {
21
+ /** Last block height (inclusive) at which the operation may execute. */
22
+ block_expiry_height: bigint;
23
+ /**
24
+ * Chosen by the signer: any value, as long as the pair
25
+ * `(nonce, block_expiry_height)` has not been consumed at the verifying
26
+ * contract. There is no ordering. Consumed pairs are the contract's, not
27
+ * the key's, so where several keys sign for one contract, draw nonces at
28
+ * random ({@link randomNonce}) rather than counting; a lone key may do
29
+ * either.
30
+ */
31
+ nonce: bigint;
32
+ /** CXS encoding of the payload value. */
33
+ body: Uint8Array;
34
+ }
35
+ /** An {@link Operation} and the Ed25519 signature over its preimage. */
36
+ interface SignedOperation {
37
+ readonly op: Operation;
38
+ readonly signature: FixedBytes<64>;
39
+ }
40
+ /** What a signer supplies to produce one operation. */
41
+ interface SignedOperationRequest<TBody> {
42
+ /** Hash of the network the operation is valid on. */
43
+ readonly network: NetworkHash;
44
+ /** Address of the contract that will verify and act on the operation. */
45
+ readonly verifyingContract: ContractAddress;
46
+ /** Last block height (inclusive) at which the operation may execute. */
47
+ readonly blockExpiryHeight: bigint;
48
+ /**
49
+ * Signer-chosen replay guard; see {@link Operation.nonce}. Nothing on
50
+ * chain needs reading to pick one: {@link randomNonce} is always safe.
51
+ */
52
+ readonly nonce: bigint;
53
+ /** The payload value, in the field shape generated bindings use. */
54
+ readonly body: TBody;
55
+ }
56
+ /** Signing helpers bound to one payload type. */
57
+ interface SignedOperationType<TBody> {
58
+ /**
59
+ * Declared name of the payload type: the `declared` segment of its spec id.
60
+ * {@link SignedOperationType.typeDef} carries the full id.
61
+ */
62
+ readonly typeName: string;
63
+ /** The payload type's spec definition, as bound into every preimage. */
64
+ readonly typeDef: ContractTypeDef;
65
+ /** CXS-encode a payload value the way the contract decodes it. */
66
+ encodeBody(body: TBody): Uint8Array;
67
+ /** The bytes a signature over `request` covers. */
68
+ preimage(request: SignedOperationRequest<TBody>): Uint8Array;
69
+ /** Encode, sign, and package `request` for the verifying contract. */
70
+ sign(signer: Signer, request: SignedOperationRequest<TBody>): Promise<SignedOperation>;
71
+ }
72
+ /** Options for {@link defineSignedOperation}. */
73
+ interface DefineSignedOperationOptions {
74
+ /**
75
+ * Type definitions the payload type is resolved against: a generated
76
+ * binding's `spec.type_defs`, which carries the payload type and every type
77
+ * it references.
78
+ */
79
+ readonly typeDefs: readonly ContractTypeDef[];
80
+ /**
81
+ * The payload type: either its name as declared with `#[contract_type]`
82
+ * (the `declared` segment of its spec id), which must name exactly one of
83
+ * `typeDefs`, or its full spec id, which selects one type even when another
84
+ * crate or module declares the same name.
85
+ */
86
+ readonly typeName: string | ContractTypeSelector;
87
+ }
88
+ /**
89
+ * Every segment of a payload type's spec id, as plain strings. A
90
+ * `ContractSpecId` taken from a generated spec is assignable to it.
91
+ */
92
+ interface ContractTypeSelector {
93
+ readonly crate_name: string;
94
+ readonly major: string;
95
+ readonly module_path: string;
96
+ readonly declared: string;
97
+ }
98
+ /**
99
+ * A uniformly random `u64` for {@link Operation.nonce}.
100
+ *
101
+ * Consumed `(nonce, block_expiry_height)` pairs are scoped to the verifying
102
+ * contract, not to the signing key, so a random nonce is the choice that
103
+ * stays safe when several keys sign for one contract; a lone key may count
104
+ * instead. Draws from the platform's `crypto.getRandomValues`.
105
+ */
106
+ declare function randomNonce(): bigint;
107
+ /**
108
+ * Bind signing helpers to a `#[contract_type]` payload.
109
+ *
110
+ * A signed operation authorizes an on-chain action off-chain, so the signer
111
+ * need not submit the transaction: the pattern behind permits, session keys,
112
+ * and delegated wallet actions. The verifying contract embeds
113
+ * `thruput_signed_op::SignedOpReplayCache` and checks the operation with
114
+ * `consume::<Payload>` against the key it holds; this is the client half,
115
+ * producing the `Operation` and signature that contract expects.
116
+ *
117
+ * @example
118
+ * ```ts
119
+ * import {
120
+ * defineSignedOperation,
121
+ * randomNonce,
122
+ * } from "@thruputchain/client/signed-op";
123
+ * import { spec, MyWallet, type my_wallet } from "./generated/my_wallet.js";
124
+ *
125
+ * const transfer = defineSignedOperation<my_wallet.v0_1.Transfer>({
126
+ * typeDefs: spec.type_defs,
127
+ * typeName: "Transfer",
128
+ * });
129
+ * const { op, signature } = await transfer.sign(signer, {
130
+ * network: networkHash,
131
+ * verifyingContract: walletAddress,
132
+ * blockExpiryHeight: currentHeight + 100n,
133
+ * nonce: randomNonce(),
134
+ * body: { to: recipient, amount: 42n },
135
+ * });
136
+ * // `op` and `signature` are the arguments of the contract's submit entrypoint.
137
+ * const invocation = MyWallet.v0_1.submit.invocation(walletAddress, gasLimit, {
138
+ * op,
139
+ * signature,
140
+ * });
141
+ * ```
142
+ *
143
+ * @throws If `typeName` selects none, or more than one, of `typeDefs`.
144
+ */
145
+ declare function defineSignedOperation<TBody>(options: DefineSignedOperationOptions): SignedOperationType<TBody>;
146
+ //#endregion
147
+ //#region src/signedOp/preimage.d.ts
148
+ /** Everything a signed-operation signature commits to. */
149
+ interface SignedOperationPreimage {
150
+ /** Hash of the network the operation is valid on. */
151
+ readonly network: NetworkHash;
152
+ /** Address of the contract entitled to act on the operation. */
153
+ readonly verifyingContract: ContractAddress;
154
+ /**
155
+ * Spec definition of the payload type, as a generated binding ships it in
156
+ * `spec.type_defs`. Part of the signed bytes, so a signature over one
157
+ * payload type is never a signature over another with the same encoding.
158
+ */
159
+ readonly typeDef: ContractTypeDef;
160
+ /** Last block height (inclusive) at which the operation may execute. */
161
+ readonly blockExpiryHeight: BlockHeight;
162
+ /**
163
+ * Signer-chosen value that, with `blockExpiryHeight`, the verifying
164
+ * contract consumes exactly once.
165
+ */
166
+ readonly nonce: bigint;
167
+ /** CXS encoding of the payload value. */
168
+ readonly body: Uint8Array;
169
+ }
170
+ /**
171
+ * The message a signed-operation signature covers:
172
+ *
173
+ * ```text
174
+ * cxs(DomainSeparator("SignedOp")) || network || verifyingContract
175
+ * || cxs(typeDef) || cxs(uniquifier) || body
176
+ * ```
177
+ *
178
+ * where `cxs(uniquifier)` is `cxs(blockExpiryHeight) || cxs(nonce)`: the
179
+ * chain's own `Uniquifier` encoding, so the replay pair is spelled the way a
180
+ * transaction spells its own. The result is signed directly, like
181
+ * {@link transactionSignaturePreimage}; Ed25519 does its own hashing. It must
182
+ * match the Rust `thruput_domain_separator::SignedOp::preimage` byte for
183
+ * byte, or the verifying contract rejects the signature. Only the first 74
184
+ * bytes are fixed-width: the uniquifier's two fields are CXS varints.
185
+ *
186
+ * {@link defineSignedOperation} calls this after encoding the payload; reach
187
+ * for it directly only when the payload is already CXS bytes.
188
+ */
189
+ declare function signedOperationPreimage(preimage: SignedOperationPreimage): Uint8Array;
190
+ //#endregion
191
+ export { Operation as a, SignedOperationType as c, DefineSignedOperationOptions as i, defineSignedOperation as l, signedOperationPreimage as n, SignedOperation as o, ContractTypeSelector as r, SignedOperationRequest as s, SignedOperationPreimage as t, randomNonce as u };
192
+ //# sourceMappingURL=index-B5KqSHeL.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-B5KqSHeL.d.cts","names":[],"sources":["../src/signedOp/operation.ts","../src/signedOp/preimage.ts"],"mappings":";;;;;;;;;AAmCA;;;;;;;;;AAakB;UAbD,SAAA;EAiBe;EAf9B,mBAAA;EAiB8B;;;;;;AAAA;AAIhC;EAZE,KAAA;EAYqC;EAVrC,IAAA,EAAM,UAAU;AAAA;;UAID,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C;;;;;;;;;;;;;;;;iBCJgB,uBAAA,CACd,QAAA,EAAU,uBAAA,GACT,UAAU"}
@@ -0,0 +1,163 @@
1
+ import { N as RpcErrorData, bt as Transport, vt as UnsupportedRpcValue, xt as TransportRequestOptions, yt as RpcParams } from "./client-BxB6ktQd.cjs";
2
+
3
+ //#region src/transport/http.d.ts
4
+ /**
5
+ * Error thrown when a JSON-RPC response contains an `error` object.
6
+ *
7
+ * Malformed envelopes throw `RpcResponseError`, preserving the raw reply.
8
+ */
9
+ declare class JsonRpcError extends Error {
10
+ /** JSON-RPC numeric error code. */
11
+ code: number;
12
+ /** Optional JSON-RPC error data returned by the gateway. */
13
+ data?: unknown;
14
+ /** JSON-RPC method associated with the failed request, when known. */
15
+ method?: string;
16
+ /** Complete original JSON-RPC error object, including additive fields. */
17
+ readonly raw: unknown;
18
+ readonly rpcMessage: string;
19
+ constructor(code: number, message: string, data?: unknown, method?: string, raw?: unknown);
20
+ }
21
+ /** Error thrown when an HTTP response has a non-successful status. */
22
+ declare class HttpResponseError extends Error {
23
+ readonly endpoint?: string | undefined;
24
+ readonly method?: string | undefined;
25
+ readonly status: number;
26
+ readonly statusText: string;
27
+ constructor(status: number, statusText: string, endpoint?: string | undefined, method?: string | undefined);
28
+ }
29
+ /** Network failure with sanitized endpoint and method context. */
30
+ declare class HttpRequestError extends TypeError {
31
+ readonly endpoint: string;
32
+ readonly method: string;
33
+ constructor(endpoint: string, method: string, cause: unknown);
34
+ }
35
+ /** Limits for opt-in HTTP JSON-RPC batching. */
36
+ interface HttpBatchOptions {
37
+ /** Maximum calls per HTTP request (1–1,000). Defaults to 100. Full batches send immediately. */
38
+ maxSize?: number;
39
+ /** Scheduling window in milliseconds (0–2,147,483,647). Defaults to a zero-delay timer. */
40
+ waitMs?: number;
41
+ }
42
+ /** Options for {@link HttpTransport}. */
43
+ interface HttpTransportOptions {
44
+ /** Additional HTTP headers to include with each JSON-RPC request. */
45
+ headers?: Record<string, string>;
46
+ /** Custom `fetch` implementation, useful for tests or non-standard runtimes. */
47
+ fetch?: typeof fetch;
48
+ /** Abort the request, including response-body reading, with a TimeoutError after this many milliseconds. */
49
+ timeoutMs?: number;
50
+ /**
51
+ * Group concurrent calls into JSON-RPC arrays. Disabled by default.
52
+ * `true` uses 100 calls and a zero-delay scheduling window.
53
+ *
54
+ * Requires an endpoint that accepts JSON-RPC arrays. Even one queued call
55
+ * is sent as an array. Responses are matched by ID, not response order.
56
+ * RPC errors reject their own calls; HTTP failures affect the whole batch.
57
+ * No retries or fallback requests are made, including for submissions.
58
+ *
59
+ * Batching provides no shared snapshot, execution order, or atomicity.
60
+ * Await dependent calls separately. Slow calls can delay other results.
61
+ * Cancelling one call rejects it without cancelling its peers; cancelling
62
+ * every call aborts the HTTP request. Cancellation cannot undo submitted work.
63
+ * `timeoutMs` starts at dispatch and covers reading the response body;
64
+ * the scheduling window is additional to that timeout.
65
+ */
66
+ batch?: boolean | HttpBatchOptions;
67
+ }
68
+ /**
69
+ * JSON-RPC 2.0 transport over HTTP POST.
70
+ *
71
+ * `HttpTransport` handles request IDs, JSON-RPC envelopes, optional custom
72
+ * headers, optional timeout cancellation, and conversion of JSON-RPC error
73
+ * responses into {@link JsonRpcError}.
74
+ *
75
+ * @example
76
+ * ```ts
77
+ * import { HttpTransport } from "@thruputchain/client/transport";
78
+ *
79
+ * const transport = new HttpTransport("http://127.0.0.1:9545", {
80
+ * timeoutMs: 10_000,
81
+ * });
82
+ *
83
+ * const tip = await transport.request("getChainTip");
84
+ * ```
85
+ */
86
+ declare class HttpTransport implements Transport {
87
+ #private;
88
+ /** Create an HTTP transport for a Thruput JSON-RPC endpoint URL. */
89
+ constructor(url: string, options?: HttpTransportOptions);
90
+ /** Send one JSON-RPC request and return the decoded `result` value. */
91
+ request<T = unknown>(method: string, params?: RpcParams, options?: TransportRequestOptions): Promise<T>;
92
+ }
93
+ //#endregion
94
+ //#region src/transport/mock.d.ts
95
+ /** Deterministic native RPC transport for examples; it does not execute contract code. */
96
+ declare class MockTransport implements Transport {
97
+ #private;
98
+ request<T = unknown>(method: string, params?: RpcParams, options?: TransportRequestOptions): Promise<T>;
99
+ }
100
+ //#endregion
101
+ //#region src/transport/readError.d.ts
102
+ /** Infrastructure failure classification; retry budgets remain with the caller. */
103
+ type ReadErrorKind = "transient" | "permanent" | "cancelled" | "unknown";
104
+ /**
105
+ * Classify an infrastructure read failure without replacing the original error.
106
+ *
107
+ * Pass the caller's signal to distinguish explicit cancellation from a transport
108
+ * timeout. Plain Error wrappers are inspected through their causes; domain errors
109
+ * and unrecognized failures remain unknown. A bare TypeError is not evidence of
110
+ * a network failure. Custom transports should use HttpRequestError for that case.
111
+ * Transaction-not-found remains operation-specific rather than a general retry.
112
+ * This classification never authorizes transaction resubmission.
113
+ */
114
+ declare function classifyReadError(error: unknown, options?: TransportRequestOptions): ReadErrorKind;
115
+ //#endregion
116
+ //#region src/transport/txInvalidDetail.d.ts
117
+ /** A validated native admission bound violation. Unknown details remain on the raw error. */
118
+ type TxInvalidDetail = Exclude<NonNullable<Extract<RpcErrorData, {
119
+ kind: "transactionInvalid";
120
+ }>["detail"]>, UnsupportedRpcValue>;
121
+ /** Read known transaction-bound evidence without inferring retry permission. */
122
+ declare function txInvalidDetail(error: unknown): TxInvalidDetail | null;
123
+ //#endregion
124
+ //#region src/rpc/errors.d.ts
125
+ /** Native causes. Codes alone never grant write retry permission. */
126
+ declare const NativeRpcErrorCode: {
127
+ readonly BackendDataInvalid: -32054;
128
+ readonly BackendTimeout: -32051;
129
+ readonly BackendUnavailable: -32050;
130
+ readonly FundingAttemptStopped: -32030;
131
+ readonly HistoryUnavailable: -32013;
132
+ readonly InvalidParams: -32602;
133
+ readonly LocalFundingUnresolved: -32031;
134
+ readonly Overloaded: -32053;
135
+ readonly StateHeightUnavailable: -32012;
136
+ readonly TransactionInvalid: -32000;
137
+ readonly TransactionRejected: -32001;
138
+ };
139
+ //#endregion
140
+ //#region src/rpc/errorReader.d.ts
141
+ type DecodedRpcError = {
142
+ classification: "known";
143
+ data: RpcErrorData;
144
+ raw: unknown;
145
+ } | {
146
+ classification: "unclassified";
147
+ raw: unknown;
148
+ };
149
+ /** A native RPC failure retains the transport error and a conservative typed interpretation. */
150
+ declare class NativeRpcError extends JsonRpcError {
151
+ readonly decoded: DecodedRpcError;
152
+ constructor(error: JsonRpcError, method: string, expectedTransactionHash?: Uint8Array);
153
+ }
154
+ //#endregion
155
+ //#region src/transport/responseError.d.ts
156
+ /** Malformed JSON-RPC reply after dispatch. Raw data is retained; write outcome is unknown. */
157
+ declare class RpcResponseError extends Error {
158
+ readonly raw: unknown;
159
+ constructor(message: string, raw: unknown);
160
+ }
161
+ //#endregion
162
+ export { TxInvalidDetail as a, classifyReadError as c, HttpRequestError as d, HttpResponseError as f, JsonRpcError as h, NativeRpcErrorCode as i, MockTransport as l, HttpTransportOptions as m, DecodedRpcError as n, txInvalidDetail as o, HttpTransport as p, NativeRpcError as r, ReadErrorKind as s, RpcResponseError as t, HttpBatchOptions as u };
163
+ //# sourceMappingURL=index-BZ0O5jZG.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-BZ0O5jZG.d.cts","names":[],"sources":["../src/transport/http.ts","../src/transport/mock.ts","../src/transport/readError.ts","../src/transport/txInvalidDetail.ts","../src/rpc/errors.ts","../src/rpc/errorReader.ts","../src/transport/responseError.ts"],"mappings":";;;;;AASA;;;cAAa,YAAA,SAAqB,KAAK;EAAL;EAEhC,IAAA;EAGA;EAAA,IAAA;EAMS;EAHT,MAAA;;WAGS,GAAA;EAAA,SACA,UAAA;cAGP,IAAA,UACA,OAAA,UACA,IAAA,YACA,MAAA,WACA,GAAA;AAAA;;cAiBS,iBAAA,SAA0B,KAAK;EAAA,SAO/B,QAAA;EAAA,SACA,MAAA;EAAA,SAPF,MAAA;EAAA,SACA,UAAA;cAGP,MAAA,UACA,UAAA,UACS,QAAA,uBACA,MAAA;AAAA;;cAYA,gBAAA,SAAyB,SAAS;EAAA,SAElC,QAAA;EAAA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;AAAA"}
@@ -0,0 +1,23 @@
1
+ import { t as RpcClient, xt as TransportRequestOptions } from "./client-BxB6ktQd.js";
2
+ import { k as CoreThruputClient } from "./readViews-C_FX8wby.js";
3
+ import { F as WalletAccount, a as SubmissionEvidence, k as PrepareTransactionRequest } from "./execution-CRDyKu45.js";
4
+ import { NetworkHash, SHA256Hash, SignedTransaction, Transaction } from "@thruputchain/protocol";
5
+
6
+ //#region src/actions/wallet/sendTransaction.d.ts
7
+ /**
8
+ * Serialize and submit once through the native RPC boundary.
9
+ * Unknown admission throws TransactionObservationError with the signed bytes and
10
+ * destination discovery network; that network does not prove the signing network
11
+ * of an already-signed envelope. RPC and transport failures propagate unchanged.
12
+ */
13
+ declare function sendTransaction(client: Pick<RpcClient, "sendTransaction" | "discovery">, signedTx: SignedTransaction, options?: TransportRequestOptions): Promise<SHA256Hash>;
14
+ //#endregion
15
+ //#region src/actions/wallet/sendInvocation.d.ts
16
+ /** Prepare, sign, and submit one explicit root invocation. */
17
+ declare function sendInvocation(client: Pick<CoreThruputClient, "getChainTip" | "sendTransaction" | "requireMethods" | "discovery">, account: WalletAccount, networkHash: NetworkHash, request: PrepareTransactionRequest, controls?: {
18
+ signal?: AbortSignal;
19
+ onSigned?: (evidence: SubmissionEvidence) => void | Promise<void>;
20
+ }): Promise<SHA256Hash>;
21
+ //#endregion
22
+ export { sendTransaction as n, sendInvocation as t };
23
+ //# sourceMappingURL=index-BuPQcAK2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-BuPQcAK2.d.ts","names":[],"sources":["../src/actions/wallet/sendTransaction.ts","../src/actions/wallet/sendInvocation.ts"],"mappings":";;;;;;;;;AAqBA;;;iBAAsB,eAAA,CACpB,MAAA,EAAQ,IAAA,CAAK,SAAA,oCACb,QAAA,EAAU,iBAAA,EACV,OAAA,GAAU,uBAAA,GACT,OAAA,CAAQ,UAAA;;;;iBCQW,cAAA,CACpB,MAAA,EAAQ,IAAA,CACN,iBAAA,uEAGF,OAAA,EAAS,aAAA,EACT,WAAA,EAAa,WAAA,EACb,OAAA,EAAS,yBAAA,EACT,QAAA;EACE,MAAA,GAAS,WAAA;EACT,QAAA,IAAY,QAAA,EAAU,kBAAA,YAA8B,OAAA;AAAA,IAErD,OAAA,CAAQ,UAAA"}
@@ -0,0 +1,83 @@
1
+ import { t as Signer } from "./types-BE40oD_Q.cjs";
2
+ import { CryptographicScheme, MlDsa65PublicKey, MlDsa65Signature, PublicKey, Signature } from "@thruputchain/protocol";
3
+
4
+ //#region src/signers/ed25519.d.ts
5
+ /**
6
+ * Ed25519 signer backed by an in-memory private key.
7
+ *
8
+ * This is convenient for scripts and tests. Browser wallets or production key
9
+ * management systems should usually provide their own {@link Signer}
10
+ * implementation instead of exposing raw private keys to application code.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { Ed25519Signer } from "@thruputchain/client/signers";
15
+ *
16
+ * const signer = Ed25519Signer.fromSeed(seed); // 32 bytes
17
+ * const signature = await signer.sign(message);
18
+ * ```
19
+ */
20
+ declare class Ed25519Signer implements Signer {
21
+ #private;
22
+ /** Ed25519 public key derived from the constructor's private key. */
23
+ publicKey: Extract<PublicKey, {
24
+ scheme: CryptographicScheme.Ed25519;
25
+ }>;
26
+ /**
27
+ * Create an Ed25519 signer from a 32-byte private key.
28
+ *
29
+ * Prefer {@link Ed25519Signer.fromSeed}, which validates the key length and
30
+ * matches `MlDsa65Signer.fromSeed`.
31
+ */
32
+ constructor(secretKey: Uint8Array);
33
+ /** Create an Ed25519 signer from a 32-byte RFC 8032 private key seed. */
34
+ static fromSeed(seed: Uint8Array): Ed25519Signer;
35
+ /** Sign a message with the in-memory Ed25519 private key. */
36
+ sign(message: Uint8Array): Promise<Extract<Signature, {
37
+ scheme: CryptographicScheme.Ed25519;
38
+ }>>;
39
+ }
40
+ //#endregion
41
+ //#region src/signers/mlDsa65.d.ts
42
+ /**
43
+ * ML-DSA-65 (FIPS 204) signer backed by an in-memory key derived from a seed.
44
+ *
45
+ * Signatures are pure ML-DSA (not HashML-DSA) with an empty context string,
46
+ * over the same transaction signature preimage an Ed25519 signer signs. Keys
47
+ * are scheme-tagged `PublicKey` values; there is no StrKey form for them.
48
+ *
49
+ * Signing is hedged by default (fresh randomness mixed into each signature).
50
+ * Pass `{ deterministic: true }` for the FIPS 204 deterministic variant, which
51
+ * reproduces the same signature for the same key and message.
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * import { MlDsa65Signer } from "@thruputchain/client/signers";
56
+ *
57
+ * const signer = MlDsa65Signer.fromSeed(seed); // 32 bytes
58
+ * const signature = await signer.sign(message);
59
+ * ```
60
+ */
61
+ declare class MlDsa65Signer implements Signer {
62
+ #private;
63
+ /** Scheme-tagged ML-DSA-65 public key derived from the seed. */
64
+ readonly publicKey: Extract<PublicKey, {
65
+ scheme: CryptographicScheme.MlDsa65;
66
+ }>;
67
+ private constructor();
68
+ /** Derive an ML-DSA-65 key pair from a 32-byte FIPS 204 `ξ` seed. */
69
+ static fromSeed(seed: Uint8Array, options?: {
70
+ readonly deterministic?: boolean;
71
+ }): MlDsa65Signer;
72
+ /** Sign a message with pure ML-DSA-65 and an empty context. */
73
+ sign(message: Uint8Array): Promise<Signature>;
74
+ }
75
+ /**
76
+ * Verify a pure ML-DSA-65 signature with an empty context string.
77
+ *
78
+ * Returns `false` for a malformed or invalid signature rather than throwing.
79
+ */
80
+ declare function verifyMlDsa65(publicKey: MlDsa65PublicKey, message: Uint8Array, signature: MlDsa65Signature): boolean;
81
+ //#endregion
82
+ export { verifyMlDsa65 as n, Ed25519Signer as r, MlDsa65Signer as t };
83
+ //# sourceMappingURL=index-ByNNqY7S.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-ByNNqY7S.d.cts","names":[],"sources":["../src/signers/ed25519.ts","../src/signers/mlDsa65.ts"],"mappings":";;;;;AAgCA;;;;;;;;;;;;;;cAAa,aAAA,YAAyB,MAAA;EAAA;EAAM;EAE1C,SAAA,EAAW,OAAA,CAAQ,SAAA;IAAa,MAAA,EAAQ,mBAAA,CAAoB,OAAA;EAAA;EAAjD;;;;;;cASC,SAAA,EAAW,UAAA;EAAX;EAAA,OASL,QAAA,CAAS,IAAA,EAAM,UAAA,GAAa,aAAA;EAAb;EAQhB,IAAA,CACJ,OAAA,EAAS,UAAA,GACR,OAAA,CAAQ,OAAA,CAAQ,SAAA;IAAa,MAAA,EAAQ,mBAAA,CAAoB,OAAA;EAAA;AAAA;;;;AA9B9D;;;;;;;;;;;;;;;;;;cCIa,aAAA,YAAyB,MAAA;EAAA;EDFzB;EAAA,SCIF,SAAA,EAAW,OAAA,CAClB,SAAA;IACE,MAAA,EAAQ,mBAAA,CAAoB,OAAA;EAAA;EAAA,QAKzB,WAAA;;SAcA,QAAA,CACL,IAAA,EAAM,UAAA,EACN,OAAA;IAAA,SAAoB,aAAA;EAAA,IACnB,aAAA;EDVmB;ECuBhB,IAAA,CAAK,OAAA,EAAS,UAAA,GAAa,OAAA,CAAQ,SAAA;AAAA;;;;;;iBAkB3B,aAAA,CACd,SAAA,EAAW,gBAAA,EACX,OAAA,EAAS,UAAA,EACT,SAAA,EAAW,gBAAA"}