@thruputchain/client 0.28.0 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +113 -18
- package/dist/actions-B7htk5FS.js +698 -0
- package/dist/actions-B7htk5FS.js.map +1 -0
- package/dist/actions-CIaI049y.cjs +788 -0
- package/dist/actions-CIaI049y.cjs.map +1 -0
- package/dist/actions.cjs +5 -8
- package/dist/actions.d.cts +4 -4
- package/dist/actions.d.ts +4 -4
- package/dist/actions.js +3 -3
- package/dist/{contract-D77iA2iY.js → contract-BOlNskwd.js} +235 -87
- package/dist/contract-BOlNskwd.js.map +1 -0
- package/dist/{contract-DSu2UPPm.cjs → contract-D_vxUudr.cjs} +281 -109
- package/dist/contract-D_vxUudr.cjs.map +1 -0
- package/dist/contract.cjs +1 -5
- package/dist/contract.d.cts +3 -4
- package/dist/contract.d.ts +3 -4
- package/dist/contract.js +2 -2
- package/dist/contracts.cjs +5 -5
- package/dist/contracts.d.cts +6 -74
- package/dist/contracts.d.cts.map +1 -1
- package/dist/contracts.d.ts +6 -74
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +4 -4
- package/dist/decimal-BX7abv5J.cjs +171 -0
- package/dist/decimal-BX7abv5J.cjs.map +1 -0
- package/dist/decimal-CoHOISys.js +124 -0
- package/dist/decimal-CoHOISys.js.map +1 -0
- package/dist/default_wallet-DkqsCa5C.d.ts +90 -0
- package/dist/default_wallet-DkqsCa5C.d.ts.map +1 -0
- package/dist/default_wallet-Dqs4_iTD.d.cts +90 -0
- package/dist/default_wallet-Dqs4_iTD.d.cts.map +1 -0
- package/dist/{dev_wallet-CAbOSrak.cjs → dev_wallet-BVChhV6j.cjs} +85 -6
- package/dist/dev_wallet-BVChhV6j.cjs.map +1 -0
- package/dist/{dev_wallet-CU3RpQLm.js → dev_wallet-D9LuPZ-h.js} +84 -5
- package/dist/dev_wallet-D9LuPZ-h.js.map +1 -0
- package/dist/{execution-J5jkXhV1.d.cts → execution-pSt6k620.d.cts} +23 -50
- package/dist/execution-pSt6k620.d.cts.map +1 -0
- package/dist/{execution-XJ0iwFaX.d.ts → execution-uiuFPV0d.d.ts} +23 -50
- package/dist/execution-uiuFPV0d.d.ts.map +1 -0
- package/dist/{hex-DIcaALXL.js → hex-B8D-jBgz.js} +2 -2
- package/dist/{hex-DIcaALXL.js.map → hex-B8D-jBgz.js.map} +1 -1
- package/dist/{hex-DkGpiZ5e.cjs → hex-CSDZ9d6z.cjs} +2 -2
- package/dist/{hex-DkGpiZ5e.cjs.map → hex-CSDZ9d6z.cjs.map} +1 -1
- package/dist/{index-soFVQX9j.d.cts → index-B1efA-Y_.d.ts} +24 -21
- package/dist/index-B1efA-Y_.d.ts.map +1 -0
- package/dist/{index-C3HVRvQd.d.ts → index-BGmH_Sm7.d.cts} +12 -62
- package/dist/index-BGmH_Sm7.d.cts.map +1 -0
- package/dist/{index-DeS1S0m-.d.ts → index-BmOG68Hd.d.ts} +39 -17
- package/dist/index-BmOG68Hd.d.ts.map +1 -0
- package/dist/{index-B5KqSHeL.d.cts → index-BsvYcU_Y.d.cts} +2 -2
- package/dist/{index-B5KqSHeL.d.cts.map → index-BsvYcU_Y.d.cts.map} +1 -1
- package/dist/{index-CtjZ61tl.d.cts → index-CG-q0j9w.d.ts} +12 -62
- package/dist/index-CG-q0j9w.d.ts.map +1 -0
- package/dist/index-CPtBvHE8.d.ts +145 -0
- package/dist/index-CPtBvHE8.d.ts.map +1 -0
- package/dist/{index-DfmDUk5Y.d.ts → index-DBKsOzCN.d.cts} +24 -21
- package/dist/index-DBKsOzCN.d.cts.map +1 -0
- package/dist/{index-Bb01ytjJ.d.ts → index-Dtv_GV6M.d.ts} +40 -11
- package/dist/index-Dtv_GV6M.d.ts.map +1 -0
- package/dist/{index-CtjWsAXV.d.cts → index-JKm4TBlY.d.cts} +40 -11
- package/dist/index-JKm4TBlY.d.cts.map +1 -0
- package/dist/index-Xre-0Jka.d.cts +145 -0
- package/dist/index-Xre-0Jka.d.cts.map +1 -0
- package/dist/{index-CedOvhGY.d.cts → index-ozfbEuYI.d.cts} +39 -17
- package/dist/index-ozfbEuYI.d.cts.map +1 -0
- package/dist/index.cjs +40 -68
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -17
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +11 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -38
- package/dist/index.js.map +1 -1
- package/dist/provider.cjs +3 -3
- package/dist/provider.cjs.map +1 -1
- package/dist/provider.d.cts +2 -1
- package/dist/provider.d.ts +2 -1
- package/dist/provider.js +3 -3
- package/dist/provider.js.map +1 -1
- package/dist/{codec-Bxlt1gKO.js → readError-B3Rz7rgs.js} +359 -56
- package/dist/readError-B3Rz7rgs.js.map +1 -0
- package/dist/{codec-BcK8ASsg.cjs → readError-COcEDNoZ.cjs} +363 -96
- package/dist/readError-COcEDNoZ.cjs.map +1 -0
- package/dist/requestAirdrop-DBCOST2B.d.ts +1818 -0
- package/dist/requestAirdrop-DBCOST2B.d.ts.map +1 -0
- package/dist/requestAirdrop-T1eVn3l5.d.cts +1818 -0
- package/dist/requestAirdrop-T1eVn3l5.d.cts.map +1 -0
- package/dist/sendInvocation-185ZJrta.cjs +583 -0
- package/dist/sendInvocation-185ZJrta.cjs.map +1 -0
- package/dist/sendInvocation-DBaNWhr3.js +439 -0
- package/dist/sendInvocation-DBaNWhr3.js.map +1 -0
- package/dist/signed-op.cjs +2 -2
- package/dist/signed-op.d.cts +2 -2
- package/dist/signed-op.d.ts +1 -1
- package/dist/signed-op.js +2 -2
- package/dist/{signedOp-DAucp6xg.cjs → signedOp-CVyeJ5ig.cjs} +3 -3
- package/dist/{signedOp-DAucp6xg.cjs.map → signedOp-CVyeJ5ig.cjs.map} +1 -1
- package/dist/{signedOp-DpmUpH-e.js → signedOp-D6WYZG9j.js} +3 -3
- package/dist/{signedOp-DpmUpH-e.js.map → signedOp-D6WYZG9j.js.map} +1 -1
- package/dist/{signed_op-_lR85dn2.cjs → signed_op-BBsDKOlD.cjs} +4 -4
- package/dist/{signed_op-_lR85dn2.cjs.map → signed_op-BBsDKOlD.cjs.map} +1 -1
- package/dist/{signed_op-zGq4eBo8.d.ts → signed_op-DHb4n2JO.d.cts} +3 -3
- package/dist/{signed_op-D2usgASc.d.cts.map → signed_op-DHb4n2JO.d.cts.map} +1 -1
- package/dist/{signed_op-D2usgASc.d.cts → signed_op-Dfa8WD0j.d.ts} +3 -3
- package/dist/{signed_op-zGq4eBo8.d.ts.map → signed_op-Dfa8WD0j.d.ts.map} +1 -1
- package/dist/{signed_op-CwN-_CXw.js → signed_op-h9X9-vBL.js} +3 -3
- package/dist/{signed_op-CwN-_CXw.js.map → signed_op-h9X9-vBL.js.map} +1 -1
- package/dist/transport-BhWZxHcz.cjs +528 -0
- package/dist/transport-BhWZxHcz.cjs.map +1 -0
- package/dist/transport-EyDYuibb.js +504 -0
- package/dist/transport-EyDYuibb.js.map +1 -0
- package/dist/transport.cjs +6 -13
- package/dist/transport.d.cts +3 -3
- package/dist/transport.d.ts +3 -3
- package/dist/transport.js +4 -4
- package/dist/types-VYjJcTip.d.cts +161 -0
- package/dist/types-VYjJcTip.d.cts.map +1 -0
- package/dist/types-VYjJcTip.d.ts +161 -0
- package/dist/types-VYjJcTip.d.ts.map +1 -0
- package/dist/{validation-eXATmgO0.js → validation-BLQ64Dfh.js} +3 -3
- package/dist/validation-BLQ64Dfh.js.map +1 -0
- package/dist/{validation-4w-vDGAi.cjs → validation-CZqtmMLJ.cjs} +3 -3
- package/dist/validation-CZqtmMLJ.cjs.map +1 -0
- package/dist/{wallet-BNKgOXrF.js → wallet-NlZiI4-3.js} +161 -77
- package/dist/wallet-NlZiI4-3.js.map +1 -0
- package/dist/{wallet-7R5M_7h4.cjs → wallet-UvyXtxh5.cjs} +161 -77
- package/dist/wallet-UvyXtxh5.cjs.map +1 -0
- package/dist/wallet.cjs +2 -8
- package/dist/wallet.d.cts +4 -3
- package/dist/wallet.d.ts +4 -3
- package/dist/wallet.js +3 -3
- package/package.json +5 -5
- package/dist/actions-B5-CjpEF.cjs +0 -513
- package/dist/actions-B5-CjpEF.cjs.map +0 -1
- package/dist/actions-C1SMLWO5.js +0 -430
- package/dist/actions-C1SMLWO5.js.map +0 -1
- package/dist/artifact-BM_MVzhL.d.cts +0 -35
- package/dist/artifact-BM_MVzhL.d.cts.map +0 -1
- package/dist/artifact-BM_MVzhL.d.ts +0 -35
- package/dist/artifact-BM_MVzhL.d.ts.map +0 -1
- package/dist/client-jOZxB8yW.d.cts +0 -798
- package/dist/client-jOZxB8yW.d.cts.map +0 -1
- package/dist/client-jOZxB8yW.d.ts +0 -798
- package/dist/client-jOZxB8yW.d.ts.map +0 -1
- package/dist/codec-BcK8ASsg.cjs.map +0 -1
- package/dist/codec-Bxlt1gKO.js.map +0 -1
- package/dist/contract-D77iA2iY.js.map +0 -1
- package/dist/contract-DSu2UPPm.cjs.map +0 -1
- package/dist/dev_wallet-CAbOSrak.cjs.map +0 -1
- package/dist/dev_wallet-CU3RpQLm.js.map +0 -1
- package/dist/execution-J5jkXhV1.d.cts.map +0 -1
- package/dist/execution-XJ0iwFaX.d.ts.map +0 -1
- package/dist/index-Bb01ytjJ.d.ts.map +0 -1
- package/dist/index-C3HVRvQd.d.ts.map +0 -1
- package/dist/index-CIHK7Ew9.d.cts +0 -303
- package/dist/index-CIHK7Ew9.d.cts.map +0 -1
- package/dist/index-CIHK7Ew9.d.ts +0 -303
- package/dist/index-CIHK7Ew9.d.ts.map +0 -1
- package/dist/index-CedOvhGY.d.cts.map +0 -1
- package/dist/index-CtjWsAXV.d.cts.map +0 -1
- package/dist/index-CtjZ61tl.d.cts.map +0 -1
- package/dist/index-DeS1S0m-.d.ts.map +0 -1
- package/dist/index-DfmDUk5Y.d.ts.map +0 -1
- package/dist/index-soFVQX9j.d.cts.map +0 -1
- package/dist/readError-CCVlmBhj.cjs +0 -624
- package/dist/readError-CCVlmBhj.cjs.map +0 -1
- package/dist/readError-D1dppovI.js +0 -571
- package/dist/readError-D1dppovI.js.map +0 -1
- package/dist/readViews-DbWELMMq.d.cts +0 -609
- package/dist/readViews-DbWELMMq.d.cts.map +0 -1
- package/dist/readViews-nV3jbpYc.d.ts +0 -609
- package/dist/readViews-nV3jbpYc.d.ts.map +0 -1
- package/dist/sendInvocation-Dsr9ij5P.cjs +0 -661
- package/dist/sendInvocation-Dsr9ij5P.cjs.map +0 -1
- package/dist/sendInvocation-tBmf8haQ.js +0 -505
- package/dist/sendInvocation-tBmf8haQ.js.map +0 -1
- package/dist/transport-5FPeNwuv.cjs +0 -279
- package/dist/transport-5FPeNwuv.cjs.map +0 -1
- package/dist/transport-IrhVlS4w.js +0 -261
- package/dist/transport-IrhVlS4w.js.map +0 -1
- package/dist/validation-4w-vDGAi.cjs.map +0 -1
- package/dist/validation-eXATmgO0.js.map +0 -1
- package/dist/wallet-7R5M_7h4.cjs.map +0 -1
- package/dist/wallet-BNKgOXrF.js.map +0 -1
package/README.md
CHANGED
|
@@ -165,7 +165,9 @@ available for reconciliation. The generated nonce is not persisted. For crash
|
|
|
165
165
|
recovery, generate and persist `clientNonce`, recipient and network hash before
|
|
166
166
|
calling `requestAirdrop({ recipient, clientNonce })`. Use `requestAirdropAttempt`
|
|
167
167
|
to control read-only observation yourself. Faucet errors and pending responses
|
|
168
|
-
without a transaction hash stop immediately
|
|
168
|
+
without a transaction hash stop immediately with code `fundingStopped`. Its
|
|
169
|
+
`context.request.clientNonce` reconciles the attempt; a new nonce can fund twice.
|
|
170
|
+
The SDK never repeats the faucet request.
|
|
169
171
|
|
|
170
172
|
The predefined clusters are `mainnet`, `futurenet`, and `localnet`. Declare a
|
|
171
173
|
deployment-specific cluster inline, or use `defineCluster` when the descriptor
|
|
@@ -236,7 +238,7 @@ console.log(formatUnits(amount, 2)); // "12.05"
|
|
|
236
238
|
|
|
237
239
|
Parsing rejects malformed input and excess precision rather than rounding.
|
|
238
240
|
Applications still check token positivity and size limits. See the
|
|
239
|
-
[amount guide](https://
|
|
241
|
+
[amount guide](https://www.thruput.network/docs/typescript/reference/sdk/#exact-amounts-and-common-types)
|
|
240
242
|
for error handling and supported inputs.
|
|
241
243
|
|
|
242
244
|
### Cancellable reads
|
|
@@ -258,7 +260,7 @@ const balance = await ERC20.v0_1.getBalanceOf.view({
|
|
|
258
260
|
Call `controller.abort()` from the application's cleanup handler. Bound views also
|
|
259
261
|
accept a signal. `classifyReadError(error, { signal })` helps distinguish cancellation
|
|
260
262
|
from infrastructure failures; applications own retry policy. Canceling observation
|
|
261
|
-
does not cancel a transaction. See [read errors](https://
|
|
263
|
+
does not cancel a transaction. See [read errors](https://www.thruput.network/docs/typescript/reference/sdk/#cancellation-and-read-errors).
|
|
262
264
|
|
|
263
265
|
### Inspect arguments
|
|
264
266
|
|
|
@@ -436,6 +438,87 @@ Use `Ed25519Signer` with `createPubkeyAccount`, then request an airdrop or
|
|
|
436
438
|
supply its public key in the node's initial allocations. Stored CLI keys can be
|
|
437
439
|
exported explicitly through `thruput keys export`; never log that output.
|
|
438
440
|
|
|
441
|
+
## Errors
|
|
442
|
+
|
|
443
|
+
The client throws one error class, `ThruputError`. Identify an error by its
|
|
444
|
+
stable `code`, and read typed data from `context`. `isThruputError` checks
|
|
445
|
+
`name` and `code`, not `instanceof`, so it also works across realms and with
|
|
446
|
+
more than one copy of the package.
|
|
447
|
+
|
|
448
|
+
```ts
|
|
449
|
+
import { isThruputError } from "@thruputchain/client";
|
|
450
|
+
|
|
451
|
+
try {
|
|
452
|
+
await ERC20.v0_1.getBalanceOf.view({
|
|
453
|
+
client,
|
|
454
|
+
address: tokenAddress,
|
|
455
|
+
args: { addr: accountAddress },
|
|
456
|
+
minStateBlockHeight: receipt.blockHeight,
|
|
457
|
+
});
|
|
458
|
+
} catch (error) {
|
|
459
|
+
if (
|
|
460
|
+
isThruputError(error, "nativeRpcError") &&
|
|
461
|
+
error.context.kind === "stateHeightUnavailable"
|
|
462
|
+
) {
|
|
463
|
+
// The node is behind the requested height. Try again later.
|
|
464
|
+
}
|
|
465
|
+
throw error;
|
|
466
|
+
}
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
The transaction workflows attach `transaction` facts to every error after
|
|
470
|
+
signing: `hash`, `outcome`, `reason`, and, when known, `receipt` and the signed
|
|
471
|
+
`submission`. These workflows are the wallets' `executeAndWait`,
|
|
472
|
+
`executeCallsAndWait`, `deployContractAndWait`, and `sendInvocation`; a provider
|
|
473
|
+
wallet's `submitTransaction`; the `sendTransaction`, `sendInvocation`, and
|
|
474
|
+
`requestAirdrop` actions; `waitForTransactionReceipt`; and receipt decoding. The
|
|
475
|
+
raw RPC method `client.sendTransaction`, which a wallet also exposes, throws RPC
|
|
476
|
+
and transport errors without facts: you already hold the hash of the bytes you
|
|
477
|
+
sent. After narrowing to a transaction code, such as
|
|
478
|
+
`isThruputError(error, "transactionOutcomeUnknown")`, `error.transaction` is
|
|
479
|
+
always present. Decide what to do from `outcome` only:
|
|
480
|
+
|
|
481
|
+
| Outcome | Meaning |
|
|
482
|
+
| -------------- | ----------------------------------------------------------------------------- |
|
|
483
|
+
| `succeeded` | The receipt shows success. The error is about a later step, such as decoding. |
|
|
484
|
+
| `failed` | The receipt shows failed execution. |
|
|
485
|
+
| `notSubmitted` | This call did not dispatch the transaction. |
|
|
486
|
+
| `unknown` | The client cannot know. Never send it again. Observe `hash` instead. |
|
|
487
|
+
|
|
488
|
+
```ts
|
|
489
|
+
try {
|
|
490
|
+
await wallet.executeAndWait(request);
|
|
491
|
+
} catch (error) {
|
|
492
|
+
if (isThruputError(error) && error.transaction?.outcome === "unknown") {
|
|
493
|
+
saveForLaterObservation(error.transaction.hash);
|
|
494
|
+
}
|
|
495
|
+
throw error;
|
|
496
|
+
}
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
`reason` tells you why the operation stopped, for example `timeout`,
|
|
500
|
+
`cancelled`, `nodeRejected`, or `persistenceFailed`. A node rejection keeps the
|
|
501
|
+
outcome `unknown`, because another node or path can still have the transaction.
|
|
502
|
+
`notSubmitted` covers this call only: if an earlier call sent the same bytes,
|
|
503
|
+
for example with the same explicit nonce and expiry, observe the original hash.
|
|
504
|
+
|
|
505
|
+
The client's messages never include the message of a cause from your callbacks
|
|
506
|
+
or signers; read it from `error.cause`. A provider wallet's error message is
|
|
507
|
+
forwarded as the `message` of its named code, such as `userRejected`, so treat
|
|
508
|
+
it like any other text from the wallet before you log it. Invalid arguments and
|
|
509
|
+
configuration, such as a wrong byte length, throw native errors (`Error`,
|
|
510
|
+
`TypeError`, or `RangeError`) before any network call. A call that you cancel
|
|
511
|
+
rejects with your `signal.reason`, and a request that times out rejects with a
|
|
512
|
+
`DOMException` named `TimeoutError`. Once a transaction is signed, both become a
|
|
513
|
+
`ThruputError` with `transaction` facts, reason `cancelled` or `timeout`.
|
|
514
|
+
|
|
515
|
+
Generated contract methods read their typed failure from an error with
|
|
516
|
+
`method.decodeError(error)`.
|
|
517
|
+
|
|
518
|
+
Custom transports report failures with the same class, for example
|
|
519
|
+
`new ThruputError("httpRequestFailed", message, { context, cause })`. Other
|
|
520
|
+
packages can add codes by augmenting the `ThruputErrorContext` interface.
|
|
521
|
+
|
|
439
522
|
## Native RPC client
|
|
440
523
|
|
|
441
524
|
`createRpcClient` exposes the native wire-14 methods directly. It validates the
|
|
@@ -455,12 +538,13 @@ const balance = await rpc.getBalance({ address: accountAddress });
|
|
|
455
538
|
|
|
456
539
|
Each method makes one RPC call. There are no retries, transaction signing or
|
|
457
540
|
receipt waits in this layer. Unknown response variants retain their original
|
|
458
|
-
payload in `UnsupportedRpcValue`; malformed known results throw
|
|
459
|
-
`
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
541
|
+
payload in `UnsupportedRpcValue`; malformed known results throw code
|
|
542
|
+
`rpcValueInvalid`. Invalid local inputs throw code `rpcRequestInvalid` before
|
|
543
|
+
dispatch. A native error throws code `nativeRpcError`: `context.kind` names a
|
|
544
|
+
known, valid error and narrows `context.data`, or is `unrecognized`. Both keep
|
|
545
|
+
the complete raw error in `context.raw`. Neither authorizes retries. Transaction
|
|
546
|
+
evidence is compared with the requested hash. Malformed HTTP reply envelopes
|
|
547
|
+
throw code `rpcResponseInvalid` with the raw reply.
|
|
464
548
|
`refreshDiscovery()` performs only discovery reads and never replays writes.
|
|
465
549
|
|
|
466
550
|
### Local block and time control
|
|
@@ -489,7 +573,7 @@ After a time change, later blocks continue from the new time.
|
|
|
489
573
|
returns it to the wall clock. From thruput CLI 0.47.0, a contract view runs at
|
|
490
574
|
the time the next block would get, so it sees a time change at once. A timepoint
|
|
491
575
|
earlier than the chain tip's is rejected (`-32602`). A result that contradicts
|
|
492
|
-
its request, such as a different pinned timepoint, throws `
|
|
576
|
+
its request, such as a different pinned timepoint, throws code `rpcValueInvalid`.
|
|
493
577
|
|
|
494
578
|
## Wallet clients
|
|
495
579
|
|
|
@@ -616,6 +700,7 @@ const transaction = await wallet.prepareTransaction({
|
|
|
616
700
|
expiryBlocks: 100n,
|
|
617
701
|
});
|
|
618
702
|
const signed = await wallet.signTransaction(transaction);
|
|
703
|
+
// The raw RPC method: its errors have no `transaction` facts, so keep the hash.
|
|
619
704
|
const { transactionHash: submittedHash } = await wallet.sendTransaction({
|
|
620
705
|
signedTransaction: serializeSignedTransaction(signed),
|
|
621
706
|
});
|
|
@@ -789,11 +874,14 @@ The package exposes focused entry points alongside the root: `./transaction`,
|
|
|
789
874
|
`./transport`, `./contract`, `./contracts`, `./signers`, `./actions`,
|
|
790
875
|
`./signed-op`, `./wallet`, and `./provider`.
|
|
791
876
|
|
|
792
|
-
Browser wallets use the framework-neutral [wallet provider contract](https://
|
|
877
|
+
Browser wallets use the framework-neutral [wallet provider contract](https://www.thruput.network/docs/typescript/reference/wallet-provider/). See [Wallet Integration](https://www.thruput.network/docs/typescript/wallet-integration/) for discovery, connection, and the prepare/sign/persist/submit flow.
|
|
793
878
|
`./provider` exports wire types, strict validation, and multi-wallet discovery.
|
|
794
879
|
`./wallet` exports the existing local-signer wallet API and
|
|
795
880
|
`createProviderWalletClient`, with separate prepare, sign, and submit steps so apps
|
|
796
881
|
can persist the canonical transaction hash before requesting broadcast.
|
|
882
|
+
Wallets report numeric EIP-1193 codes on the wire, and `createProviderWalletClient`
|
|
883
|
+
turns each into a named code with the number in `context.providerCode`: for
|
|
884
|
+
example, 4001 becomes `isThruputError(error, "userRejected")`.
|
|
797
885
|
|
|
798
886
|
### Atomic batches with an external wallet
|
|
799
887
|
|
|
@@ -805,8 +893,8 @@ use legacy single-call behavior without sending an unknown request to the bridge
|
|
|
805
893
|
`getCapabilities` takes `{ account, networkHash }` and returns the same scope
|
|
806
894
|
plus `atomicBatch: { maxCalls }`, or `atomicBatch: null` when unsupported.
|
|
807
895
|
The current DefaultWallet limit is 16 calls. The provider must verify origin,
|
|
808
|
-
account, and network authorization without prompting.
|
|
809
|
-
unsupported; other failures and malformed responses remain errors.
|
|
896
|
+
account, and network authorization without prompting. Provider code 4200 also
|
|
897
|
+
means unsupported; other failures and malformed responses remain errors.
|
|
810
898
|
|
|
811
899
|
An external `ProviderWalletClient` exposes `getCapabilities()` and
|
|
812
900
|
`prepareBatchExecution({ invocations, gasLimit, ...transactionOptions })`.
|
|
@@ -828,10 +916,10 @@ Recover an uncertain submission through its original saved transaction hash.
|
|
|
828
916
|
|
|
829
917
|
## Documentation
|
|
830
918
|
|
|
831
|
-
- [TypeScript SDK guide](https://
|
|
832
|
-
[end-to-end tutorial](https://
|
|
919
|
+
- [TypeScript SDK guide](https://www.thruput.network/docs/typescript/reference/sdk/) and the
|
|
920
|
+
[end-to-end tutorial](https://www.thruput.network/docs/tutorials/work-with-thruput-from-typescript/)
|
|
833
921
|
on the Thruput developer site.
|
|
834
|
-
- [JSON-RPC API reference](https://
|
|
922
|
+
- [JSON-RPC API reference](https://www.thruput.network/docs/reference/json-rpc-api/) for the
|
|
835
923
|
methods behind each action.
|
|
836
924
|
- The TypeDoc API reference is generated from this package's entry points with
|
|
837
925
|
`npm run docs` (see [API docs](#api-docs)).
|
|
@@ -892,12 +980,19 @@ with binary signatures intact.
|
|
|
892
980
|
Run on Linux with Node 24. CI installs the `thruput` CLI crate from crates.io and the public devnode
|
|
893
981
|
artifact pinned in
|
|
894
982
|
[`scripts/integration-versions.json`](scripts/integration-versions.json): CLI
|
|
895
|
-
0.
|
|
983
|
+
0.48.0, devnode 0.1.37 and wire 14.7.0. CI qualification uses the crate-built
|
|
896
984
|
CLI; it does not verify a packaged CLI bundle. Locally, install that CLI version
|
|
897
|
-
with `cargo install thruput@0.
|
|
985
|
+
with `cargo install thruput@0.48.0 --locked` or set `THRUPUT_CLI` to its
|
|
898
986
|
executable. The harness installs the pinned devnode when no runtime override is
|
|
899
987
|
supplied.
|
|
900
988
|
|
|
989
|
+
While that file sets `cliSourceCommit`, no released CLI is qualified: CI builds
|
|
990
|
+
the CLI from that commit of `thruputchain/thruput-tools` instead. To match it
|
|
991
|
+
locally, check that commit out, run
|
|
992
|
+
`GROUNDHOG_SOURCE_COMMIT=<commit> cargo build --release --locked -p thruput`,
|
|
993
|
+
and set `THRUPUT_CLI` to `target/release/thruput` and
|
|
994
|
+
`THRUPUT_CLI_SOURCE_COMMIT` to the commit.
|
|
995
|
+
|
|
901
996
|
```sh
|
|
902
997
|
npm run test:integration
|
|
903
998
|
```
|