@thruputchain/client 0.27.0 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +120 -22
- package/dist/{actions-DK_XBeVy.cjs → actions-B2gV8Vzr.cjs} +297 -73
- package/dist/actions-B2gV8Vzr.cjs.map +1 -0
- package/dist/actions-UEYKD22C.js +653 -0
- package/dist/actions-UEYKD22C.js.map +1 -0
- package/dist/actions.cjs +4 -8
- package/dist/actions.d.cts +4 -4
- package/dist/actions.d.ts +4 -4
- package/dist/actions.js +3 -3
- package/dist/{artifact-BM_MVzhL.d.ts → artifact-RIAPVmVX.d.cts} +4 -3
- package/dist/artifact-RIAPVmVX.d.cts.map +1 -0
- package/dist/{artifact-BM_MVzhL.d.cts → artifact-RIAPVmVX.d.ts} +4 -3
- package/dist/artifact-RIAPVmVX.d.ts.map +1 -0
- package/dist/{contract-Cu8Qv94_.js → contract-BOlNskwd.js} +235 -87
- package/dist/contract-BOlNskwd.js.map +1 -0
- package/dist/{contract-DPm2BJTu.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 +4 -4
- package/dist/contract.d.ts +4 -4
- package/dist/contract.js +2 -2
- package/dist/contracts.cjs +5 -5
- package/dist/contracts.d.cts +19 -4
- package/dist/contracts.d.cts.map +1 -1
- package/dist/contracts.d.ts +19 -4
- 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/{dev_wallet-BcvX_xT4.cjs → dev_wallet-BVChhV6j.cjs} +85 -6
- package/dist/dev_wallet-BVChhV6j.cjs.map +1 -0
- package/dist/{dev_wallet-B5R5JJaw.js → dev_wallet-D9LuPZ-h.js} +84 -5
- package/dist/dev_wallet-D9LuPZ-h.js.map +1 -0
- package/dist/{execution-C8oQgpO3.d.cts → execution-pSt6k620.d.cts} +23 -50
- package/dist/execution-pSt6k620.d.cts.map +1 -0
- package/dist/{execution-DsZzqv_C.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-rrP1HJ2Z.d.cts → index-B1efA-Y_.d.ts} +24 -21
- package/dist/index-B1efA-Y_.d.ts.map +1 -0
- package/dist/{index-Zaz-e8Sy.d.ts → index-BGmH_Sm7.d.cts} +12 -62
- package/dist/index-BGmH_Sm7.d.cts.map +1 -0
- package/dist/{index-CHnfHuQo.d.ts → index-BZ5j5P5d.d.ts} +11 -9
- package/dist/index-BZ5j5P5d.d.ts.map +1 -0
- package/dist/{index-BmQN3jAS.d.cts → index-BfYEEVHm.d.cts} +3 -13
- package/dist/index-BfYEEVHm.d.cts.map +1 -0
- package/dist/{index-CuzB95QT.d.cts → index-BhOeIyrZ.d.cts} +11 -9
- package/dist/index-BhOeIyrZ.d.cts.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-hqEnT64w.d.ts → index-Btl_jMCT.d.ts} +3 -13
- package/dist/index-Btl_jMCT.d.ts.map +1 -0
- package/dist/{index-C3qDR1J5.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-CKqC9N4o.d.ts → index-DBKsOzCN.d.cts} +24 -21
- package/dist/index-DBKsOzCN.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.cjs +39 -68
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -17
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +12 -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-BOjoJjC5.js → readError-B3Rz7rgs.js} +673 -56
- package/dist/readError-B3Rz7rgs.js.map +1 -0
- package/dist/{codec-C4LJ0g8v.cjs → readError-COcEDNoZ.cjs} +677 -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-BDUZhfJn.cjs → signedOp-CVyeJ5ig.cjs} +3 -3
- package/dist/{signedOp-BDUZhfJn.cjs.map → signedOp-CVyeJ5ig.cjs.map} +1 -1
- package/dist/{signedOp-Kx8u8_3I.js → signedOp-D6WYZG9j.js} +3 -3
- package/dist/{signedOp-Kx8u8_3I.js.map → signedOp-D6WYZG9j.js.map} +1 -1
- package/dist/{signed_op-CAcYYRm6.cjs → signed_op-BBsDKOlD.cjs} +4 -4
- package/dist/{signed_op-CAcYYRm6.cjs.map → signed_op-BBsDKOlD.cjs.map} +1 -1
- package/dist/{signed_op-BrLxDrDb.d.cts → signed_op-BvbOHWKK.d.ts} +3 -3
- package/dist/{signed_op-DbRq3_Hb.d.ts.map → signed_op-BvbOHWKK.d.ts.map} +1 -1
- package/dist/{signed_op-DbRq3_Hb.d.ts → signed_op-DoHFpSH4.d.cts} +3 -3
- package/dist/{signed_op-BrLxDrDb.d.cts.map → signed_op-DoHFpSH4.d.cts.map} +1 -1
- package/dist/{signed_op-Dxn7-lRu.js → signed_op-h9X9-vBL.js} +3 -3
- package/dist/{signed_op-Dxn7-lRu.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-5wt9wLG3.js → wallet-NlZiI4-3.js} +161 -77
- package/dist/wallet-NlZiI4-3.js.map +1 -0
- package/dist/{wallet-Blh7oas7.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 +2 -2
- package/dist/actions-1LmkZcfS.js +0 -430
- package/dist/actions-1LmkZcfS.js.map +0 -1
- package/dist/actions-DK_XBeVy.cjs.map +0 -1
- package/dist/artifact-BM_MVzhL.d.cts.map +0 -1
- package/dist/artifact-BM_MVzhL.d.ts.map +0 -1
- package/dist/client-DocSdzOL.d.cts +0 -790
- package/dist/client-DocSdzOL.d.cts.map +0 -1
- package/dist/client-DocSdzOL.d.ts +0 -790
- package/dist/client-DocSdzOL.d.ts.map +0 -1
- package/dist/codec-BOjoJjC5.js.map +0 -1
- package/dist/codec-C4LJ0g8v.cjs.map +0 -1
- package/dist/contract-Cu8Qv94_.js.map +0 -1
- package/dist/contract-DPm2BJTu.cjs.map +0 -1
- package/dist/dev_wallet-B5R5JJaw.js.map +0 -1
- package/dist/dev_wallet-BcvX_xT4.cjs.map +0 -1
- package/dist/execution-C8oQgpO3.d.cts.map +0 -1
- package/dist/execution-DsZzqv_C.d.ts.map +0 -1
- package/dist/index-BmQN3jAS.d.cts.map +0 -1
- package/dist/index-C3qDR1J5.d.cts.map +0 -1
- package/dist/index-CHnfHuQo.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-CKqC9N4o.d.ts.map +0 -1
- package/dist/index-CuzB95QT.d.cts.map +0 -1
- package/dist/index-Zaz-e8Sy.d.ts.map +0 -1
- package/dist/index-hqEnT64w.d.ts.map +0 -1
- package/dist/index-rrP1HJ2Z.d.cts.map +0 -1
- package/dist/readError-Cz3bveZa.cjs +0 -622
- package/dist/readError-Cz3bveZa.cjs.map +0 -1
- package/dist/readError-Z5zuylri.js +0 -569
- package/dist/readError-Z5zuylri.js.map +0 -1
- package/dist/readViews-BvMHbiaF.d.ts +0 -609
- package/dist/readViews-BvMHbiaF.d.ts.map +0 -1
- package/dist/readViews-CQOY5v4o.d.cts +0 -609
- package/dist/readViews-CQOY5v4o.d.cts.map +0 -1
- package/dist/sendInvocation-8TEMrJ_M.cjs +0 -661
- package/dist/sendInvocation-8TEMrJ_M.cjs.map +0 -1
- package/dist/sendInvocation-CkeMyLk1.js +0 -505
- package/dist/sendInvocation-CkeMyLk1.js.map +0 -1
- package/dist/transport-DqlfAsuH.cjs +0 -279
- package/dist/transport-DqlfAsuH.cjs.map +0 -1
- package/dist/transport-PstrCcBv.js +0 -261
- package/dist/transport-PstrCcBv.js.map +0 -1
- package/dist/validation-4w-vDGAi.cjs.map +0 -1
- package/dist/validation-eXATmgO0.js.map +0 -1
- package/dist/wallet-5wt9wLG3.js.map +0 -1
- package/dist/wallet-Blh7oas7.cjs.map +0 -1
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ Packages, remove that override from your `.npmrc`.
|
|
|
31
31
|
|
|
32
32
|
## Usage
|
|
33
33
|
|
|
34
|
-
This checkout pins RPC wire format **14.
|
|
34
|
+
This checkout pins RPC wire format **14.7.0** and works with any 14.x endpoint. Block queries require a compatible
|
|
35
35
|
RPC server and a node with the block-query index. RPC addresses, public keys,
|
|
36
36
|
validator IDs and hashes use unprefixed, case-sensitive base58. Opaque payloads
|
|
37
37
|
(including signed transactions, calldata, return data, storage keys, raw event
|
|
@@ -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,19 +538,21 @@ 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
|
|
467
551
|
|
|
468
552
|
A local `thruput node` that serves wire 14.6.0 or later advertises
|
|
469
553
|
`dev_produceBlock`, `dev_produceBlocks`, `dev_setNextBlockTimepoint`,
|
|
470
|
-
`dev_increaseTime` and `dev_setBlockDriver
|
|
554
|
+
`dev_increaseTime` and `dev_setBlockDriver`, and from wire 14.7.0
|
|
555
|
+
`dev_setBlockTimeStep`. They produce blocks on request
|
|
471
556
|
(empty blocks included) and move block time forward, so a test of
|
|
472
557
|
time-dependent logic can cover days in seconds. Timepoints are Unix nanoseconds
|
|
473
558
|
as bigints, the value contracts read with `get_block_timepoint()`. Hosted
|
|
@@ -480,13 +565,15 @@ const rpc = await createRpcClient({
|
|
|
480
565
|
});
|
|
481
566
|
const thirtyDays = 30n * 24n * 60n * 60n * 1_000_000_000n;
|
|
482
567
|
await rpc.dev_increaseTime({ nanoseconds: thirtyDays });
|
|
483
|
-
// Views see the new time once a block exists at it.
|
|
484
568
|
const block = await rpc.dev_produceBlock();
|
|
485
569
|
```
|
|
486
570
|
|
|
487
|
-
After a time change, later blocks continue from the new time.
|
|
571
|
+
After a time change, later blocks continue from the new time.
|
|
572
|
+
`dev_setBlockTimeStep({ stepNanoseconds: 0n })` freezes the clock, and `{}`
|
|
573
|
+
returns it to the wall clock. From thruput CLI 0.47.0, a contract view runs at
|
|
574
|
+
the time the next block would get, so it sees a time change at once. A timepoint
|
|
488
575
|
earlier than the chain tip's is rejected (`-32602`). A result that contradicts
|
|
489
|
-
its request, such as a different pinned timepoint, throws `
|
|
576
|
+
its request, such as a different pinned timepoint, throws code `rpcValueInvalid`.
|
|
490
577
|
|
|
491
578
|
## Wallet clients
|
|
492
579
|
|
|
@@ -613,6 +700,7 @@ const transaction = await wallet.prepareTransaction({
|
|
|
613
700
|
expiryBlocks: 100n,
|
|
614
701
|
});
|
|
615
702
|
const signed = await wallet.signTransaction(transaction);
|
|
703
|
+
// The raw RPC method: its errors have no `transaction` facts, so keep the hash.
|
|
616
704
|
const { transactionHash: submittedHash } = await wallet.sendTransaction({
|
|
617
705
|
signedTransaction: serializeSignedTransaction(signed),
|
|
618
706
|
});
|
|
@@ -786,11 +874,14 @@ The package exposes focused entry points alongside the root: `./transaction`,
|
|
|
786
874
|
`./transport`, `./contract`, `./contracts`, `./signers`, `./actions`,
|
|
787
875
|
`./signed-op`, `./wallet`, and `./provider`.
|
|
788
876
|
|
|
789
|
-
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.
|
|
790
878
|
`./provider` exports wire types, strict validation, and multi-wallet discovery.
|
|
791
879
|
`./wallet` exports the existing local-signer wallet API and
|
|
792
880
|
`createProviderWalletClient`, with separate prepare, sign, and submit steps so apps
|
|
793
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")`.
|
|
794
885
|
|
|
795
886
|
### Atomic batches with an external wallet
|
|
796
887
|
|
|
@@ -802,8 +893,8 @@ use legacy single-call behavior without sending an unknown request to the bridge
|
|
|
802
893
|
`getCapabilities` takes `{ account, networkHash }` and returns the same scope
|
|
803
894
|
plus `atomicBatch: { maxCalls }`, or `atomicBatch: null` when unsupported.
|
|
804
895
|
The current DefaultWallet limit is 16 calls. The provider must verify origin,
|
|
805
|
-
account, and network authorization without prompting.
|
|
806
|
-
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.
|
|
807
898
|
|
|
808
899
|
An external `ProviderWalletClient` exposes `getCapabilities()` and
|
|
809
900
|
`prepareBatchExecution({ invocations, gasLimit, ...transactionOptions })`.
|
|
@@ -825,10 +916,10 @@ Recover an uncertain submission through its original saved transaction hash.
|
|
|
825
916
|
|
|
826
917
|
## Documentation
|
|
827
918
|
|
|
828
|
-
- [TypeScript SDK guide](https://
|
|
829
|
-
[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/)
|
|
830
921
|
on the Thruput developer site.
|
|
831
|
-
- [JSON-RPC API reference](https://
|
|
922
|
+
- [JSON-RPC API reference](https://www.thruput.network/docs/reference/json-rpc-api/) for the
|
|
832
923
|
methods behind each action.
|
|
833
924
|
- The TypeDoc API reference is generated from this package's entry points with
|
|
834
925
|
`npm run docs` (see [API docs](#api-docs)).
|
|
@@ -889,12 +980,19 @@ with binary signatures intact.
|
|
|
889
980
|
Run on Linux with Node 24. CI installs the `thruput` CLI crate from crates.io and the public devnode
|
|
890
981
|
artifact pinned in
|
|
891
982
|
[`scripts/integration-versions.json`](scripts/integration-versions.json): CLI
|
|
892
|
-
0.
|
|
983
|
+
0.47.0, devnode 0.1.37 and wire 14.7.0. CI qualification uses the crate-built
|
|
893
984
|
CLI; it does not verify a packaged CLI bundle. Locally, install that CLI version
|
|
894
|
-
with `cargo install thruput@0.
|
|
985
|
+
with `cargo install thruput@0.47.0 --locked` or set `THRUPUT_CLI` to its
|
|
895
986
|
executable. The harness installs the pinned devnode when no runtime override is
|
|
896
987
|
supplied.
|
|
897
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
|
+
|
|
898
996
|
```sh
|
|
899
997
|
npm run test:integration
|
|
900
998
|
```
|