@thruputchain/client 0.25.0 → 0.27.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 (129) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +96 -48
  3. package/dist/{actions-CdFSUTO2.js → actions-1LmkZcfS.js} +139 -7
  4. package/dist/actions-1LmkZcfS.js.map +1 -0
  5. package/dist/{actions-DxJZ3yIv.cjs → actions-DK_XBeVy.cjs} +161 -5
  6. package/dist/actions-DK_XBeVy.cjs.map +1 -0
  7. package/dist/actions.cjs +6 -2
  8. package/dist/actions.d.cts +4 -4
  9. package/dist/actions.d.ts +4 -4
  10. package/dist/actions.js +3 -3
  11. package/dist/artifact-BM_MVzhL.d.cts +35 -0
  12. package/dist/artifact-BM_MVzhL.d.cts.map +1 -0
  13. package/dist/artifact-BM_MVzhL.d.ts +35 -0
  14. package/dist/artifact-BM_MVzhL.d.ts.map +1 -0
  15. package/dist/{client-BxB6ktQd.d.cts → client-DocSdzOL.d.cts} +104 -4
  16. package/dist/client-DocSdzOL.d.cts.map +1 -0
  17. package/dist/{client-BxB6ktQd.d.ts → client-DocSdzOL.d.ts} +104 -4
  18. package/dist/client-DocSdzOL.d.ts.map +1 -0
  19. package/dist/{codec-CX-19jac.js → codec-BOjoJjC5.js} +3516 -658
  20. package/dist/{codec-CX-19jac.js.map → codec-BOjoJjC5.js.map} +1 -1
  21. package/dist/{codec-B7HJjMzI.cjs → codec-C4LJ0g8v.cjs} +3516 -658
  22. package/dist/{codec-B7HJjMzI.cjs.map → codec-C4LJ0g8v.cjs.map} +1 -1
  23. package/dist/{contract-BpxjDMHw.js → contract-Cu8Qv94_.js} +712 -345
  24. package/dist/contract-Cu8Qv94_.js.map +1 -0
  25. package/dist/{contract-D0wCFcAN.cjs → contract-DPm2BJTu.cjs} +742 -333
  26. package/dist/contract-DPm2BJTu.cjs.map +1 -0
  27. package/dist/contract.cjs +6 -1
  28. package/dist/contract.d.cts +4 -3
  29. package/dist/contract.d.ts +4 -3
  30. package/dist/contract.js +2 -2
  31. package/dist/contracts.cjs +3 -3
  32. package/dist/contracts.d.cts +3 -3
  33. package/dist/contracts.d.ts +3 -3
  34. package/dist/contracts.js +3 -3
  35. package/dist/{dev_wallet-C9eMQROk.js → dev_wallet-B5R5JJaw.js} +2 -2
  36. package/dist/{dev_wallet-C9eMQROk.js.map → dev_wallet-B5R5JJaw.js.map} +1 -1
  37. package/dist/{dev_wallet-BXWK5KR6.cjs → dev_wallet-BcvX_xT4.cjs} +2 -2
  38. package/dist/{dev_wallet-BXWK5KR6.cjs.map → dev_wallet-BcvX_xT4.cjs.map} +1 -1
  39. package/dist/{execution-DyxaIG4v.d.cts → execution-C8oQgpO3.d.cts} +3 -3
  40. package/dist/{execution-DyxaIG4v.d.cts.map → execution-C8oQgpO3.d.cts.map} +1 -1
  41. package/dist/{execution-CRDyKu45.d.ts → execution-DsZzqv_C.d.ts} +3 -3
  42. package/dist/{execution-CRDyKu45.d.ts.map → execution-DsZzqv_C.d.ts.map} +1 -1
  43. package/dist/{index-DOEBWXY2.d.cts → index-BmQN3jAS.d.cts} +31 -4
  44. package/dist/index-BmQN3jAS.d.cts.map +1 -0
  45. package/dist/{index-BZ0O5jZG.d.cts → index-C3qDR1J5.d.cts} +3 -2
  46. package/dist/{index-BZ0O5jZG.d.cts.map → index-C3qDR1J5.d.cts.map} +1 -1
  47. package/dist/index-CHnfHuQo.d.ts +90 -0
  48. package/dist/index-CHnfHuQo.d.ts.map +1 -0
  49. package/dist/{index-CXuO2Zjx.d.ts → index-CKqC9N4o.d.ts} +4 -4
  50. package/dist/{index-CXuO2Zjx.d.ts.map → index-CKqC9N4o.d.ts.map} +1 -1
  51. package/dist/index-CuzB95QT.d.cts +90 -0
  52. package/dist/index-CuzB95QT.d.cts.map +1 -0
  53. package/dist/{index-sAzHHayu.d.ts → index-Zaz-e8Sy.d.ts} +3 -2
  54. package/dist/{index-sAzHHayu.d.ts.map → index-Zaz-e8Sy.d.ts.map} +1 -1
  55. package/dist/{index-C97zw2rk.d.ts → index-hqEnT64w.d.ts} +31 -4
  56. package/dist/index-hqEnT64w.d.ts.map +1 -0
  57. package/dist/{index-C-M-4jMR.d.cts → index-rrP1HJ2Z.d.cts} +4 -4
  58. package/dist/{index-C-M-4jMR.d.cts.map → index-rrP1HJ2Z.d.cts.map} +1 -1
  59. package/dist/index.cjs +20 -53
  60. package/dist/index.cjs.map +1 -1
  61. package/dist/index.d.cts +10 -9
  62. package/dist/index.d.cts.map +1 -1
  63. package/dist/index.d.ts +10 -9
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +11 -53
  66. package/dist/index.js.map +1 -1
  67. package/dist/{readError-BVbfTMLv.cjs → readError-Cz3bveZa.cjs} +20 -2
  68. package/dist/readError-Cz3bveZa.cjs.map +1 -0
  69. package/dist/{readError-Dn_XN98x.js → readError-Z5zuylri.js} +20 -2
  70. package/dist/readError-Z5zuylri.js.map +1 -0
  71. package/dist/{readViews-C_FX8wby.d.ts → readViews-BvMHbiaF.d.ts} +20 -5
  72. package/dist/readViews-BvMHbiaF.d.ts.map +1 -0
  73. package/dist/{readViews-BKJtE5J3.d.cts → readViews-CQOY5v4o.d.cts} +20 -5
  74. package/dist/readViews-CQOY5v4o.d.cts.map +1 -0
  75. package/dist/{sendInvocation-2EZanZZr.cjs → sendInvocation-8TEMrJ_M.cjs} +5 -5
  76. package/dist/{sendInvocation-2EZanZZr.cjs.map → sendInvocation-8TEMrJ_M.cjs.map} +1 -1
  77. package/dist/{sendInvocation-C4ruTC-9.js → sendInvocation-CkeMyLk1.js} +5 -5
  78. package/dist/{sendInvocation-C4ruTC-9.js.map → sendInvocation-CkeMyLk1.js.map} +1 -1
  79. package/dist/signed-op.cjs +2 -2
  80. package/dist/signed-op.d.cts +1 -1
  81. package/dist/signed-op.d.ts +1 -1
  82. package/dist/signed-op.js +2 -2
  83. package/dist/{signedOp-Bluo0OAd.cjs → signedOp-BDUZhfJn.cjs} +3 -3
  84. package/dist/{signedOp-Bluo0OAd.cjs.map → signedOp-BDUZhfJn.cjs.map} +1 -1
  85. package/dist/{signedOp-x4fakrr4.js → signedOp-Kx8u8_3I.js} +3 -3
  86. package/dist/{signedOp-x4fakrr4.js.map → signedOp-Kx8u8_3I.js.map} +1 -1
  87. package/dist/{signed_op-LwxrDud8.d.cts → signed_op-BrLxDrDb.d.cts} +3 -3
  88. package/dist/{signed_op-LwxrDud8.d.cts.map → signed_op-BrLxDrDb.d.cts.map} +1 -1
  89. package/dist/{signed_op-z_8fqAi1.cjs → signed_op-CAcYYRm6.cjs} +2 -2
  90. package/dist/{signed_op-z_8fqAi1.cjs.map → signed_op-CAcYYRm6.cjs.map} +1 -1
  91. package/dist/{signed_op-DFgQ2yFj.d.ts → signed_op-DbRq3_Hb.d.ts} +3 -3
  92. package/dist/{signed_op-DFgQ2yFj.d.ts.map → signed_op-DbRq3_Hb.d.ts.map} +1 -1
  93. package/dist/{signed_op-BzVbBgv4.js → signed_op-Dxn7-lRu.js} +2 -2
  94. package/dist/{signed_op-BzVbBgv4.js.map → signed_op-Dxn7-lRu.js.map} +1 -1
  95. package/dist/{transport-B-P16rs6.cjs → transport-DqlfAsuH.cjs} +31 -4
  96. package/dist/transport-DqlfAsuH.cjs.map +1 -0
  97. package/dist/{transport-DqyoNtUy.js → transport-PstrCcBv.js} +31 -4
  98. package/dist/transport-PstrCcBv.js.map +1 -0
  99. package/dist/transport.cjs +3 -3
  100. package/dist/transport.d.cts +3 -3
  101. package/dist/transport.d.ts +3 -3
  102. package/dist/transport.js +3 -3
  103. package/dist/{wallet-CwWPYoHF.js → wallet-5wt9wLG3.js} +3 -3
  104. package/dist/{wallet-CwWPYoHF.js.map → wallet-5wt9wLG3.js.map} +1 -1
  105. package/dist/{wallet-Bthapk8i.cjs → wallet-Blh7oas7.cjs} +3 -3
  106. package/dist/{wallet-Bthapk8i.cjs.map → wallet-Blh7oas7.cjs.map} +1 -1
  107. package/dist/wallet.cjs +2 -2
  108. package/dist/wallet.d.cts +2 -2
  109. package/dist/wallet.d.ts +2 -2
  110. package/dist/wallet.js +2 -2
  111. package/package.json +4 -4
  112. package/dist/actions-CdFSUTO2.js.map +0 -1
  113. package/dist/actions-DxJZ3yIv.cjs.map +0 -1
  114. package/dist/client-BxB6ktQd.d.cts.map +0 -1
  115. package/dist/client-BxB6ktQd.d.ts.map +0 -1
  116. package/dist/contract-BpxjDMHw.js.map +0 -1
  117. package/dist/contract-D0wCFcAN.cjs.map +0 -1
  118. package/dist/index-BuPQcAK2.d.ts +0 -23
  119. package/dist/index-BuPQcAK2.d.ts.map +0 -1
  120. package/dist/index-C97zw2rk.d.ts.map +0 -1
  121. package/dist/index-DOEBWXY2.d.cts.map +0 -1
  122. package/dist/index-uQqRk9Ww.d.cts +0 -23
  123. package/dist/index-uQqRk9Ww.d.cts.map +0 -1
  124. package/dist/readError-BVbfTMLv.cjs.map +0 -1
  125. package/dist/readError-Dn_XN98x.js.map +0 -1
  126. package/dist/readViews-BKJtE5J3.d.cts.map +0 -1
  127. package/dist/readViews-C_FX8wby.d.ts.map +0 -1
  128. package/dist/transport-B-P16rs6.cjs.map +0 -1
  129. package/dist/transport-DqyoNtUy.js.map +0 -1
package/LICENSE CHANGED
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright [yyyy] [name of copyright owner]
189
+ Copyright 2026 Stellar Development Foundation
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
package/README.md CHANGED
@@ -1,6 +1,16 @@
1
1
  # @thruputchain/client
2
2
 
3
- TypeScript client for the [Thruput](https://github.com/thruputchain) blockchain.
3
+ [![npm version](https://img.shields.io/npm/v/@thruputchain/client)](https://www.npmjs.com/package/@thruputchain/client)
4
+ [![CI](https://github.com/thruputchain/thruput-sdk-ts/actions/workflows/ci.yml/badge.svg)](https://github.com/thruputchain/thruput-sdk-ts/actions/workflows/ci.yml)
5
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
6
+
7
+ [Website](https://www.thruput.network/) ·
8
+ [Developer docs](https://www.thruput.network/docs/) ·
9
+ [Community discussions](https://github.com/thruputchain/thruput-docs/discussions) ·
10
+ [Discord: #thruput](https://discord.com/channels/897514728459468821/1564948118162898954)
11
+ ([join server](https://discord.gg/stellardev))
12
+
13
+ TypeScript client for the [Thruput](https://www.thruput.network/) blockchain.
4
14
 
5
15
  It provides typed JSON-RPC actions, transaction construction and signing,
6
16
  HTTP and mock transports, and generated contract bindings. Generated methods
@@ -14,14 +24,14 @@ named topic filters, and receipt extraction.
14
24
  npm install @thruputchain/client
15
25
  ```
16
26
 
17
- Requires Node.js 22.12.0 or newer. Public npm installs need no authentication.
18
- Remove any GitHub Packages registry override for `@thruputchain` when using npm
19
- releases. Repository development still uses [registry auth](#registry-auth-one-time-setup)
20
- during the npm migration.
27
+ Requires Node.js 22.12.0 or newer. The package and its `@thruputchain/*`
28
+ dependencies are published to the public npm registry, so installs need no
29
+ authentication. If you previously pointed the `@thruputchain` scope at GitHub
30
+ Packages, remove that override from your `.npmrc`.
21
31
 
22
32
  ## Usage
23
33
 
24
- This checkout pins RPC wire format **14.1.1**. Block queries require a compatible
34
+ This checkout pins RPC wire format **14.6.1** and works with any 14.x endpoint. Block queries require a compatible
25
35
  RPC server and a node with the block-query index. RPC addresses, public keys,
26
36
  validator IDs and hashes use unprefixed, case-sensitive base58. Opaque payloads
27
37
  (including signed transactions, calldata, return data, storage keys, raw event
@@ -53,6 +63,30 @@ const tip = await client.getChainTip();
53
63
  console.log(tip.blockHeight.toString(), toBase58(tip.blockHash));
54
64
  ```
55
65
 
66
+ ### Discover a wallet or contract
67
+
68
+ ```ts
69
+ import { getEffectiveContractSpec } from "@thruputchain/client/actions";
70
+ import { addressFromBase58 } from "@thruputchain/client";
71
+
72
+ const result = await getEffectiveContractSpec(client, {
73
+ address: addressFromBase58("<base58-address>"),
74
+ context: "root",
75
+ });
76
+ ```
77
+
78
+ `getContractDeployment` reads explicit deployments only. `getEffectiveContract`
79
+ also resolves the configured network default for undeployed root invocations.
80
+ Use `context: "nested"` to exclude that fallback. Selection does not prove
81
+ authorization, execution, or historical code identity. Transaction-local
82
+ deployments are not part of this committed-state reading.
83
+
84
+ The spec helper validates the selected artifact's full hash, type, and size.
85
+ RV32 specs are artifact-bound. A recognized native DefaultWallet returns the
86
+ shared `nativeInterface`, which is a built-in description, not an artifact-bound
87
+ spec or proof of runtime code. Missing artifact data throws instead of reporting
88
+ contract absence.
89
+
56
90
  ### Read a committed block
57
91
 
58
92
  ```ts
@@ -267,10 +301,14 @@ const balance = await ERC20.v0_1.getBalanceOf.view({
267
301
 
268
302
  This requires a matching RPC wire format 14.1.1 endpoint and also works with `.viewOutcome()`, bound
269
303
  views, and raw `client.simulateInvocation()`. The result must come from a committed snapshot at
270
- or above that height. An older snapshot produces `stateHeightUnavailable`
271
- (`NativeRpcErrorCode.StateHeightUnavailable`, `-32012`) with requested and observed heights. It does not undo transaction
272
- confirmation. The SDK does not poll, wait, or retry; your application decides how
273
- to handle a backend that is behind. Omit `minStateBlockHeight` for an unconstrained read.
304
+ or above that height. From wire format 14.6.1, if the floor is at or below the
305
+ committed tip, the server waits up to 2 s for its view to reach the floor. If the
306
+ view is still behind after the wait, or the floor is above the committed tip, the
307
+ read fails with `stateHeightUnavailable` (`NativeRpcErrorCode.StateHeightUnavailable`,
308
+ `-32012`) and the requested and observed heights. Older endpoints fail at once.
309
+ The error does not undo transaction confirmation. The SDK does not poll, wait, or
310
+ retry; your application decides how to handle a backend that is behind. Omit
311
+ `minStateBlockHeight` for an unconstrained read.
274
312
 
275
313
  ### Simulated authorization
276
314
 
@@ -308,10 +346,11 @@ if (supply.kind === "return" && balance.kind === "return") {
308
346
 
309
347
  Each tuple position retains its generated return and exception types. Results are
310
348
  `return`, `abort`, `fault`, or `unsupported`, with events. Simulated writes stay within each call.
311
- Omit `minStateBlockHeight` if no freshness floor is needed. If the selected snapshot is
312
- behind, the server returns `stateHeightUnavailable` with requested and observed
313
- heights. The request neither waits for a block nor forces a refresh; your
314
- application decides whether and when to retry.
349
+ Omit `minStateBlockHeight` if no freshness floor is needed. The floor works as it
350
+ does for a single read: from wire format 14.6.1, the server waits up to 2 s for a
351
+ committed floor, then returns `stateHeightUnavailable` with requested and observed
352
+ heights. A floor above the committed tip fails at once. The request does not wait
353
+ for a new block; your application decides whether and when to retry.
315
354
 
316
355
  This requires `simulateInvocations` (RPC wire format 14.1.1). Existing generated
317
356
  bindings gain `viewRequest` through the runtime. The low-level API is
@@ -424,6 +463,31 @@ authorizes retries. Transaction evidence is compared with the requested hash.
424
463
  Malformed HTTP reply envelopes throw `RpcResponseError` with the raw reply.
425
464
  `refreshDiscovery()` performs only discovery reads and never replays writes.
426
465
 
466
+ ### Local block and time control
467
+
468
+ A local `thruput node` that serves wire 14.6.0 or later advertises
469
+ `dev_produceBlock`, `dev_produceBlocks`, `dev_setNextBlockTimepoint`,
470
+ `dev_increaseTime` and `dev_setBlockDriver`. They produce blocks on request
471
+ (empty blocks included) and move block time forward, so a test of
472
+ time-dependent logic can cover days in seconds. Timepoints are Unix nanoseconds
473
+ as bigints, the value contracts read with `get_block_timepoint()`. Hosted
474
+ networks do not offer these methods.
475
+
476
+ ```ts
477
+ const rpc = await createRpcClient({
478
+ transport: new HttpTransport("http://127.0.0.1:9545"),
479
+ requiredMethods: ["dev_increaseTime", "dev_produceBlock"],
480
+ });
481
+ const thirtyDays = 30n * 24n * 60n * 60n * 1_000_000_000n;
482
+ await rpc.dev_increaseTime({ nanoseconds: thirtyDays });
483
+ // Views see the new time once a block exists at it.
484
+ const block = await rpc.dev_produceBlock();
485
+ ```
486
+
487
+ After a time change, later blocks continue from the new time. A timepoint
488
+ earlier than the chain tip's is rejected (`-32602`). A result that contradicts
489
+ its request, such as a different pinned timepoint, throws `RpcDecodingError`.
490
+
427
491
  ## Wallet clients
428
492
 
429
493
  Human address inputs use `parseAddress(text)`, which accepts base58 or a Thruput
@@ -714,7 +778,7 @@ helpers, generated standard contracts, signers, and standalone actions.
714
778
  - `src/types/rpc.ts` — typed RPC request/response shapes.
715
779
  - `specs/native-openrpc.json` — Rust-owned native OpenRPC snapshot; `scripts/regen-openrpc.sh` refreshes it with recorded provenance. `npm run rpc:check` verifies generated codecs and types; `src/rpc/client.test.ts` checks every method’s named params and results.
716
780
  - `docs/api/` — generated TypeDoc output from `npm run docs` (ignored by git; see [API docs](#api-docs)).
717
- - `Caddyfile` and `Staticfile` — configure the private TypeDoc host that serves `docs/api/`; they are not part of the published package.
781
+ - `Caddyfile` and `Staticfile` — configure the static host that serves the generated `docs/api/`; they are not part of the published package.
718
782
 
719
783
  ## Subpath exports
720
784
 
@@ -789,35 +853,16 @@ The API reference is generated from the package's public entry points, matching
789
853
 
790
854
  ## Developing
791
855
 
792
- ### Registry auth (one-time setup)
793
-
794
- The `@thruputchain/*` dependencies are hosted on GitHub Packages, which
795
- requires a GitHub token even to download — a plain `npm install` on a fresh
796
- machine fails with `401 Unauthorized` from `npm.pkg.github.com`. To set up
797
- auth using the `gh` CLI:
856
+ Use Node.js 24 (see `.nvmrc`) and npm. Every dependency installs anonymously
857
+ from the public npm registry:
798
858
 
799
859
  ```sh
800
- # Add the read:packages scope to your gh login (one-time, opens github.com)
801
- gh auth refresh -h github.com -s read:packages
860
+ npm ci
802
861
  ```
803
862
 
804
- Then add this line to `~/.npmrc` (it holds no secret — npm expands
805
- `${ENV_VARS}` from the environment; it cannot run commands like
806
- `$(gh auth token)` itself):
807
-
808
- ```
809
- @thruputchain:registry=https://npm.pkg.github.com
810
- //npm.pkg.github.com/:_authToken=${GH_NPM_TOKEN}
811
- ```
812
-
813
- And run installs with the token pulled from gh's keychain:
814
-
815
- ```sh
816
- GH_NPM_TOKEN="$(gh auth token)" npm install
817
- ```
818
-
819
- If you forget the prefix, npm fails with `Failed to replace env in config` —
820
- that's your reminder.
863
+ Before opening a pull request, run the checks listed under
864
+ [Scripts](#scripts); CI runs the same set. Report vulnerabilities as described
865
+ in [SECURITY.md](SECURITY.md), not through public issues.
821
866
 
822
867
  ## Scripts
823
868
 
@@ -841,13 +886,14 @@ keys, network hashes and transaction hashes use case-sensitive, unprefixed
841
886
  base58. Transaction and signed-transaction XDR remain canonical `0x` hex,
842
887
  with binary signatures intact.
843
888
 
844
- Run on Linux with Node 24. CI installs the published CLI crate and public devnode
889
+ Run on Linux with Node 24. CI installs the `thruput` CLI crate from crates.io and the public devnode
845
890
  artifact pinned in
846
891
  [`scripts/integration-versions.json`](scripts/integration-versions.json): CLI
847
- 0.39.0, devnode 0.1.31-rc.16 and wire 14.1.1. CI qualification uses the crate-built
848
- CLI; it does not verify a packaged CLI bundle. Locally, install that CLI version on
849
- `PATH` or set `THRUPUT_CLI` to its executable. The harness installs the pinned
850
- devnode when no runtime override is supplied.
892
+ 0.46.0, devnode 0.1.34 and wire 14.6.1. CI qualification uses the crate-built
893
+ CLI; it does not verify a packaged CLI bundle. Locally, install that CLI version
894
+ with `cargo install thruput@0.46.0 --locked` or set `THRUPUT_CLI` to its
895
+ executable. The harness installs the pinned devnode when no runtime override is
896
+ supplied.
851
897
 
852
898
  ```sh
853
899
  npm run test:integration
@@ -928,9 +974,11 @@ replacement transaction or automatic funding repeat.
928
974
 
929
975
  ## Publishing
930
976
 
931
- The manual release workflow targets public npm and defaults to dry-run.
977
+ The manual release workflow publishes to public npm and defaults to dry-run.
932
978
  See [RELEASING.md](RELEASING.md) for authentication, release order, and retries.
933
- Repository installs retain GitHub Packages during the first npm release;
934
- consumer registry settings and lockfiles switch after all seven packages exist.
935
979
 
936
980
  Published versions are immutable. Use a new version for each release.
981
+
982
+ ## License
983
+
984
+ [Apache License 2.0](LICENSE). Copyright 2026 Stellar Development Foundation.
@@ -1,9 +1,11 @@
1
- import { y as ContractDecodeError } from "./contract-BpxjDMHw.js";
2
- import { r as UnsupportedRpcValue } from "./codec-CX-19jac.js";
1
+ import { E as ContractVerificationError, T as ContractDecodeError, a as readContractArtifactSpec, i as deriveContractAddress, o as bytesEqual, u as hashContract } from "./contract-Cu8Qv94_.js";
2
+ import { r as UnsupportedRpcValue } from "./codec-BOjoJjC5.js";
3
3
  import { i as toHex0x } from "./hex-DIcaALXL.js";
4
- import { i as NativeRpcError, n as RpcCompatibilityError } from "./readError-Dn_XN98x.js";
5
- import { E as validateTimer, T as beforeDeadline, d as assertTransactionSuccess, f as createSubmissionEvidence, o as TransactionExecutionError, s as TransactionObservationError, u as assertTransactionAdmission, w as waitForTransactionReceipt, x as TransactionReceiptObservationError } from "./sendInvocation-C4ruTC-9.js";
6
- import { codec, serialize, sha256Hash } from "@thruputchain/protocol";
4
+ import { i as NativeRpcError, n as RpcCompatibilityError } from "./readError-Z5zuylri.js";
5
+ import { E as validateTimer, T as beforeDeadline, d as assertTransactionSuccess, f as createSubmissionEvidence, o as TransactionExecutionError, s as TransactionObservationError, u as assertTransactionAdmission, w as waitForTransactionReceipt, x as TransactionReceiptObservationError } from "./sendInvocation-CkeMyLk1.js";
6
+ import { a as spec, r as DefaultWallet } from "./dev_wallet-B5R5JJaw.js";
7
+ import { ContractType, HogexecPrecompiledNativeContracts, calldata, codec, contractEntrypointID, deserialize, gasAmount, serialize, sha256Hash } from "@thruputchain/protocol";
8
+ import { sha256 } from "@noble/hashes/sha2.js";
7
9
  //#region src/actions/public/requestAirdrop.ts
8
10
  /** Funding stopped without permission to call the faucet again. */
9
11
  var FundingObservationError = class extends Error {
@@ -275,6 +277,136 @@ function iterateTransactionsByBlock(client, query, options = {}) {
275
277
  }, options);
276
278
  }
277
279
  //#endregion
280
+ //#region src/actions/public/getContractSpec.ts
281
+ /**
282
+ * Resolve a current deployment and verify its embedded spec against its hash.
283
+ * Missing artifacts and invalid responses throw; neither means no deployment.
284
+ * The snapshot does not establish which implementation produced historical events.
285
+ */
286
+ async function getContractSpec(client, request, options) {
287
+ client.requireMethods(["getContractDeployment", "getContractArtifact"]);
288
+ const address = new Uint8Array(request.address);
289
+ const result = await client.getContractDeployment({ address }, options);
290
+ if (!bytesEqual(address, result.address)) throw new ContractVerificationError("Contract deployment address mismatch");
291
+ if (result.deployment === null) return {
292
+ ...result,
293
+ artifactSpec: null
294
+ };
295
+ return {
296
+ ...result,
297
+ artifactSpec: await readDeploymentSpec(client, result.deployment, options)
298
+ };
299
+ }
300
+ /** Shared identity validation for explicit deployments and effective contract selection. */
301
+ async function readDeploymentSpec(client, deployment, options) {
302
+ const artifact = await client.getContractArtifact({ hash: deployment.hash }, options);
303
+ if (!bytesEqual(artifact.hash, deployment.hash)) throw new ContractVerificationError("Contract artifact response hash mismatch");
304
+ const artifactSpec = readContractArtifactSpec(artifact.contractXdr, sha256Hash(deployment.hash));
305
+ const contract = deserialize(artifact.contractXdr, codec.Contract);
306
+ const size = contract.contract_type === ContractType.kRv32 ? contract.rv32_contract.data.length : 0;
307
+ if (contract.contract_type !== deployment.contractType || size !== deployment.size) throw new ContractVerificationError("Contract artifact does not match deployment metadata");
308
+ return artifactSpec;
309
+ }
310
+ //#endregion
311
+ //#region src/actions/public/getEffectiveContractSpec.ts
312
+ const nativeWalletHash = hashContract({
313
+ contract_type: ContractType.kNative,
314
+ native_contract_id: HogexecPrecompiledNativeContracts.kNativeContractDefaultWallet
315
+ });
316
+ /**
317
+ * Discover current contract selection without inferring authorization or historical identity.
318
+ * Root context allows the chain-configured fallback; nested excludes that fallback.
319
+ * Transaction-local deployments are outside this committed-state reading.
320
+ */
321
+ async function getEffectiveContractSpec(client, request, options) {
322
+ client.requireMethods(["getEffectiveContract", "getContractArtifact"]);
323
+ const address = new Uint8Array(request.address);
324
+ const context = request.context;
325
+ const result = await client.getEffectiveContract({
326
+ address,
327
+ context
328
+ }, options);
329
+ if (!bytesEqual(address, result.address) || result.context !== context) throw new ContractVerificationError("Effective contract request identity mismatch");
330
+ if (result.selection instanceof UnsupportedRpcValue) throw new RpcCompatibilityError("Unsupported effective contract selection");
331
+ if (result.selection === null) return {
332
+ ...result,
333
+ artifactSpec: null,
334
+ nativeInterface: null
335
+ };
336
+ if (context === "nested" && result.selection.source === "networkDefault") throw new ContractVerificationError("Network default cannot apply to a nested invocation");
337
+ const contract = result.selection.contract;
338
+ const artifactSpec = await readDeploymentSpec(client, contract, options);
339
+ const nativeInterface = artifactSpec.kind === "native" && bytesEqual(contract.hash, nativeWalletHash) ? {
340
+ name: "DefaultWallet",
341
+ spec
342
+ } : null;
343
+ return {
344
+ ...result,
345
+ artifactSpec,
346
+ nativeInterface
347
+ };
348
+ }
349
+ //#endregion
350
+ //#region src/actions/public/decodeWalletRequests.ts
351
+ /**
352
+ * Interpret a known DefaultWallet root using built-in binding descriptors.
353
+ * Call only after identifying the root as DefaultWallet; matching selectors
354
+ * alone do not establish wallet identity. Malformed recognized inputs throw.
355
+ */
356
+ function decodeDefaultWalletRequests(root) {
357
+ if (bytesEqual(root.entrypoint, DefaultWallet.v0_1.execute.entrypoint)) {
358
+ const { calls } = DefaultWallet.v0_1.execute.decodeArgs(root.calldata);
359
+ return {
360
+ wrapper: "DefaultWallet.execute",
361
+ requestedCalls: calls.map((call) => ({
362
+ invoked_address: call.target,
363
+ entrypoint: contractEntrypointID(call.entrypoint),
364
+ gas_limit: gasAmount(call.gas_limit),
365
+ calldata: calldata(call.calldata)
366
+ }))
367
+ };
368
+ }
369
+ if (bytesEqual(root.entrypoint, DefaultWallet.v0_1.deploy.entrypoint)) {
370
+ const args = DefaultWallet.v0_1.deploy.decodeArgs(root.calldata);
371
+ const init = args.initializer;
372
+ return {
373
+ wrapper: "DefaultWallet.deploy",
374
+ requestedCalls: init ? [{
375
+ invoked_address: deriveContractAddress(root.invoked_address, sha256Hash(args.nonce), sha256Hash(args.contractHash)),
376
+ entrypoint: contractEntrypointID(init.entrypoint),
377
+ gas_limit: gasAmount(init.gas_limit),
378
+ calldata: calldata(init.calldata)
379
+ }] : []
380
+ };
381
+ }
382
+ return null;
383
+ }
384
+ //#endregion
385
+ //#region src/actions/public/readTransactionInput.ts
386
+ /**
387
+ * Read and authenticate a retained Transaction, including its root invocation.
388
+ * Unavailable does not prove nonexecution. A matching body hash authenticates
389
+ * neither signatures nor the reported block height, and does not imply success.
390
+ */
391
+ async function readTransactionInput(client, request, options) {
392
+ client.requireMethods(["getTransactionInput"]);
393
+ const hash = new Uint8Array(request.transactionHash);
394
+ const result = await client.getTransactionInput({ transactionHash: hash }, options);
395
+ if (result instanceof UnsupportedRpcValue || result.status === "unavailable") return result;
396
+ try {
397
+ if (result.transactionXdr.length > 4 * 1024 * 1024) throw new Error("Transaction input exceeds 4 MiB");
398
+ if (!bytesEqual(result.transactionHash, hash) || !bytesEqual(sha256(result.transactionXdr), hash)) throw new Error("Retained transaction input hash mismatch");
399
+ const transaction = deserialize(result.transactionXdr, codec.Transaction);
400
+ if (!bytesEqual(serialize(transaction, codec.Transaction), result.transactionXdr)) throw new Error("Noncanonical Transaction XDR");
401
+ return {
402
+ ...result,
403
+ transaction
404
+ };
405
+ } catch (cause) {
406
+ throw new ContractVerificationError(cause instanceof Error ? cause.message : "Invalid transaction input", { cause });
407
+ }
408
+ }
409
+ //#endregion
278
410
  //#region src/actions/wallet/sendTransaction.ts
279
411
  /**
280
412
  * Serialize and submit once through the native RPC boundary.
@@ -293,6 +425,6 @@ async function sendTransaction(client, signedTx, options) {
293
425
  return sha256Hash(result.transactionHash);
294
426
  }
295
427
  //#endregion
296
- export { iterateEventPages as a, FundingObservationError as c, readViews as i, requestAirdrop as l, iterateTransactionsByBlock as n, HistoryWalkError as o, iterateTransactionsByRootAddress as r, getContractEvents as s, sendTransaction as t, requestAirdropAttempt as u };
428
+ export { getContractSpec as a, readViews as c, getContractEvents as d, FundingObservationError as f, getEffectiveContractSpec as i, iterateEventPages as l, requestAirdropAttempt as m, readTransactionInput as n, iterateTransactionsByBlock as o, requestAirdrop as p, decodeDefaultWalletRequests as r, iterateTransactionsByRootAddress as s, sendTransaction as t, HistoryWalkError as u };
297
429
 
298
- //# sourceMappingURL=actions-CdFSUTO2.js.map
430
+ //# sourceMappingURL=actions-1LmkZcfS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions-1LmkZcfS.js","names":["defaultWalletSpec"],"sources":["../src/actions/public/requestAirdrop.ts","../src/actions/public/getContractEvents.ts","../src/actions/public/historyWalk.ts","../src/actions/public/iterateEventPages.ts","../src/actions/public/readViews.ts","../src/actions/public/iterateTransactionPages.ts","../src/actions/public/getContractSpec.ts","../src/actions/public/getEffectiveContractSpec.ts","../src/actions/public/decodeWalletRequests.ts","../src/actions/public/readTransactionInput.ts","../src/actions/wallet/sendTransaction.ts"],"sourcesContent":["import type { RpcClient } from \"../../rpc/client.js\";\nimport { NativeRpcError } from \"../../rpc/errorReader.js\";\nimport { RpcCompatibilityError } from \"../../rpc/client.js\";\nimport { UnsupportedRpcValue } from \"../../rpc/codec.js\";\nimport type { TransportRequestOptions } from \"../../transport/types.js\";\nimport type {\n AirdropAttemptRequest,\n AirdropResponse,\n AirdropSucceeded,\n} from \"../../types/rpc.js\";\nimport {\n waitForTransactionReceipt,\n TransactionReceiptObservationError,\n type KnownCommitment,\n} from \"./waitForTransactionReceipt.js\";\nimport {\n TransactionExecutionError,\n assertTransactionSuccess,\n} from \"../../wallet/execution.js\";\nimport { beforeDeadline, validateTimer } from \"../deadline.js\";\n\nexport interface RequestAirdropOptions {\n readonly recipient: Uint8Array;\n readonly clientNonce?: Uint8Array;\n readonly expectedNetworkHash?: Uint8Array;\n readonly timeoutMs?: number;\n readonly signal?: AbortSignal;\n}\n/** Funding stopped without permission to call the faucet again. */\nexport class FundingObservationError extends Error {\n constructor(\n readonly request: AirdropAttemptRequest & { networkHash: Uint8Array },\n readonly lastResponse: AirdropResponse | undefined,\n cause: unknown,\n readonly knownCommitment?: KnownCommitment,\n ) {\n super(\"Funding observation stopped\", { cause });\n this.name = \"FundingObservationError\";\n }\n}\n/** Perform exactly one faucet call. It neither polls nor repeats an ambiguous attempt. */\nexport async function requestAirdropAttempt(\n client: Pick<RpcClient, \"faucet_requestAirdrop\">,\n request: AirdropAttemptRequest,\n options: TransportRequestOptions = {},\n): Promise<AirdropResponse> {\n return client.faucet_requestAirdrop(request, options);\n}\n/** Call the faucet once, then observe a returned pending hash using read-only calls. */\nexport async function requestAirdrop(\n client: RpcClient,\n options: RequestAirdropOptions,\n): Promise<AirdropSucceeded> {\n const timeoutMs = options.timeoutMs ?? 60000;\n validateTimer(timeoutMs, \"timeoutMs\");\n const request = {\n recipient: new Uint8Array(options.recipient),\n clientNonce: options.clientNonce\n ? new Uint8Array(options.clientNonce)\n : crypto.getRandomValues(new Uint8Array(16)),\n networkHash: new Uint8Array(\n options.expectedNetworkHash ?? client.discovery.network.networkHash,\n ),\n };\n if (\n request.recipient.length !== 32 ||\n request.networkHash.length !== 32 ||\n request.clientNonce.length < 1 ||\n request.clientNonce.length > 32\n )\n throw new RangeError(\n \"Funding requires 32-byte addresses/hashes and a 1–32 byte nonce\",\n );\n client.requireMethods([\n \"faucet_requestAirdrop\",\n \"getNetworkInfo\",\n \"getTransactionReceipt\",\n \"getTransactionStatus\",\n ]);\n const deadline = performance.now() + timeoutMs;\n let lastResponse: AirdropResponse | undefined;\n const timeout = () => new Error(\"Funding observation timed out\");\n const run = <T>(operation: (signal: AbortSignal) => Promise<T>) =>\n beforeDeadline(operation, deadline, options.signal, timeout);\n try {\n const network = await run((signal) =>\n client.getNetworkInfo({}, { signal }),\n );\n if (network.networkHash.some((v, i) => v !== request.networkHash[i]))\n throw new RpcCompatibilityError(\n \"Funding endpoint network does not match\",\n );\n lastResponse = await run((signal) =>\n requestAirdropAttempt(\n client,\n { recipient: request.recipient, clientNonce: request.clientNonce },\n { signal },\n ),\n );\n if (lastResponse instanceof UnsupportedRpcValue) throw lastResponse;\n if (lastResponse.attemptStatus === \"succeeded\") {\n if (lastResponse.execution instanceof UnsupportedRpcValue)\n throw lastResponse.execution;\n return lastResponse;\n }\n if (!lastResponse.transactionHash)\n throw new Error(\"Pending funding did not identify a transaction\");\n const receipt = await waitForTransactionReceipt(\n client,\n lastResponse.transactionHash,\n {\n expectedNetworkHash: request.networkHash,\n timeoutMs: Math.max(0, deadline - performance.now()),\n signal: options.signal,\n },\n );\n assertTransactionSuccess(receipt);\n return {\n attemptStatus: \"succeeded\",\n recipient: lastResponse.recipient,\n rawAmount: lastResponse.rawAmount,\n transactionHash: receipt.transactionHash,\n blockHeight: receipt.blockHeight,\n execution: receipt.execution,\n };\n } catch (cause) {\n const nativeReceipt =\n cause instanceof NativeRpcError &&\n cause.decoded.classification === \"known\" &&\n \"receipt\" in cause.decoded.data\n ? cause.decoded.data.receipt\n : undefined;\n const committedResult =\n cause instanceof TransactionExecutionError\n ? cause.receipt\n : (nativeReceipt ??\n (!(lastResponse instanceof UnsupportedRpcValue) &&\n lastResponse?.attemptStatus === \"succeeded\"\n ? lastResponse\n : undefined));\n throw new FundingObservationError(\n request,\n lastResponse,\n cause,\n cause instanceof TransactionReceiptObservationError\n ? cause.knownCommitment\n : committedResult\n ? {\n networkHash: request.networkHash.slice(),\n transactionHash: new Uint8Array(committedResult.transactionHash),\n blockHeight: committedResult.blockHeight,\n }\n : undefined,\n );\n }\n}\n","import type {\n ContractEvent,\n ContractEventFilterInput,\n DecodedContractEvent,\n} from \"../../contract/event.js\";\nimport { ContractDecodeError } from \"../../contract/errors.js\";\nimport type { TransportRequestOptions } from \"../../transport/types.js\";\nimport type {\n EmittedEvent,\n EventPage,\n EventQuery,\n IdentifiedEvent,\n} from \"../../types/rpc.js\";\nimport type { RpcClient } from \"../../rpc/client.js\";\n\n/** One generated event descriptor with named filters and ordinary page controls. */\nexport type ContractEventQuery<\n TName extends string,\n TTopics,\n TFields,\n TFilter,\n> = (EventQuery extends infer Q\n ? Q extends EventQuery\n ? Omit<Q, \"filters\">\n : never\n : never) &\n ContractEventFilterInput<NoInfer<TFilter>> & {\n event: ContractEvent<TName, TTopics, TFields, TFilter>;\n };\n\n/** A decoded event with its emitter, transaction, and position in history. */\nexport type IdentifiedContractEvent<\n TName extends string,\n TTopics,\n TFields,\n> = DecodedContractEvent<TName, TTopics, TFields> &\n Omit<IdentifiedEvent, \"event\"> &\n Pick<EmittedEvent, \"address\">;\n\n/** One decoded event page, retaining the RPC cursor and indexer bounds. */\nexport type ContractEventPage<TName extends string, TTopics, TFields> = Omit<\n EventPage,\n \"events\"\n> & {\n events: IdentifiedContractEvent<TName, TTopics, TFields>[];\n};\n\n/**\n * Fetch exactly one page using a generated event's filter and decoder.\n *\n * No additional pages are fetched. Pass the returned cursor into the next call\n * with the same filters. Malformed events and unexpected signatures throw\n * ContractDecodeError rather than silently disappearing from the page.\n *\n * @example\n * ```ts\n * const page = await getContractEvents(client, {\n * event: thruput_erc20_if.v0_1.events.TransferEvent,\n * addresses: [tokenAddress],\n * topics: { to: accountAddress },\n * start: { order: \"ascending\", anchor: { kind: \"atBeginning\" } },\n * limit: 20,\n * }, { signal });\n * ```\n */\nexport async function getContractEvents<\n TName extends string,\n TTopics,\n TFields,\n TFilter,\n>(\n client: Pick<RpcClient, \"getEvents\">,\n query: ContractEventQuery<TName, TTopics, TFields, TFilter>,\n options?: TransportRequestOptions,\n): Promise<ContractEventPage<TName, TTopics, TFields>> {\n options?.signal?.throwIfAborted();\n const { event, addresses, topics, ...pageQuery } = query;\n const page = await client.getEvents(\n {\n ...pageQuery,\n filters: [event.filter({ addresses, topics })],\n },\n options,\n );\n return {\n ...page,\n events: page.events.map(({ event: raw, ...identity }) => {\n const decoded = event.decode(raw);\n if (decoded === null) {\n throw new ContractDecodeError(\n \"Event query returned an unexpected event signature\",\n );\n }\n return { ...decoded, ...identity, address: raw.address };\n }),\n };\n}\n","import type { TransportRequestOptions } from \"../../transport/types.js\";\nimport type {\n EventPage,\n TransactionRefPage,\n IterationOrder,\n HistoryStart,\n} from \"../../types/rpc.js\";\nimport { toHex0x } from \"../hex.js\";\n\n/** Returned only after the caller resumes past the terminal page. Persist with processed data. */\nexport interface HistoryCompletion {\n readonly watermarkBlockHeight: bigint;\n /** Ascending range fully consumed; absent for descending or an anchor above the watermark. */\n readonly completedThroughBlockHeight?: bigint;\n}\nexport class HistoryWalkError extends Error {\n constructor(\n message: string,\n readonly page: EventPage | TransactionRefPage,\n ) {\n super(message);\n this.name = \"HistoryWalkError\";\n }\n}\ntype Key = readonly [bigint, string, number];\nconst compare = (a: Key, b: Key) => {\n for (let i = 0; i < 3; i++) {\n if (a[i]! < b[i]!) return -1;\n if (a[i]! > b[i]!) return 1;\n }\n return 0;\n};\n/** Shared cross-page checks; single-page shape, filter and identity checks belong to RpcClient. */\nexport async function* walkHistory<P extends EventPage | TransactionRefPage>(\n fetch: (cursor: string | undefined) => Promise<P>,\n kind: \"events\" | \"transactions\",\n scope:\n | { start: HistoryStart }\n | { blockHeight: bigint; order: IterationOrder },\n options: TransportRequestOptions,\n): AsyncGenerator<P, HistoryCompletion | void, unknown> {\n const order = \"start\" in scope ? scope.start.order : scope.order;\n let cursor: string | undefined,\n watermark: bigint | undefined,\n lowerBound: bigint | undefined,\n upperBound: bigint | undefined,\n last: Key | undefined;\n const cursors = new Set<string>(),\n identities = new Set<string>();\n for (;;) {\n options.signal?.throwIfAborted();\n const page = await fetch(cursor);\n options.signal?.throwIfAborted();\n const fail = (message: string): never => {\n throw new HistoryWalkError(message, page);\n };\n const rows =\n kind === \"events\"\n ? (page as EventPage).events\n : (page as TransactionRefPage).transactions;\n if (watermark === undefined) {\n watermark = page.latestIndexedBlockHeight;\n lowerBound =\n \"start\" in scope &&\n order === \"ascending\" &&\n scope.start.anchor.kind === \"atHeight\"\n ? scope.start.anchor.blockHeight\n : page.oldestIndexedBlockHeight;\n upperBound =\n \"start\" in scope &&\n order === \"descending\" &&\n scope.start.anchor.kind === \"atHeight\" &&\n scope.start.anchor.blockHeight < watermark\n ? scope.start.anchor.blockHeight\n : watermark;\n }\n if (\"blockHeight\" in scope) {\n if (\n scope.blockHeight < page.oldestIndexedBlockHeight ||\n scope.blockHeight > page.latestIndexedBlockHeight\n )\n fail(\"Requested block is outside current indexed coverage\");\n } else {\n if (page.latestIndexedBlockHeight < watermark)\n fail(\"History coverage regressed below the initial watermark\");\n if (page.oldestIndexedBlockHeight > lowerBound!)\n fail(\"History retention no longer covers the requested range\");\n }\n for (const row of rows) {\n if (\n \"blockHeight\" in scope\n ? row.blockHeight !== scope.blockHeight\n : row.blockHeight > upperBound! || row.blockHeight < lowerBound!\n )\n fail(\"History row is outside the fixed walk scope\");\n const hash = toHex0x(row.transactionHash),\n sequence =\n kind === \"events\"\n ? (row as EventPage[\"events\"][number]).sequenceNumber\n : 0;\n const identity = kind === \"events\" ? `${hash}/${sequence}` : hash;\n if (identities.has(identity))\n fail(\"History returned a duplicate identity across pages\");\n const key: Key = [row.blockHeight, hash, sequence];\n if (\n last &&\n (order === \"ascending\"\n ? compare(last, key) >= 0\n : compare(last, key) <= 0)\n )\n fail(\"History order did not advance across pages\");\n identities.add(identity);\n last = key;\n }\n // Capture cursor before the caller can mutate the yielded page.\n const next = page.nextCursor;\n if (next !== null) {\n if (cursors.has(next))\n fail(\"History returned a repeated pagination cursor\");\n cursors.add(next);\n }\n yield page;\n if (next === null) {\n options.signal?.throwIfAborted();\n if (\"blockHeight\" in scope) return;\n return {\n watermarkBlockHeight: watermark,\n ...(order === \"ascending\" && lowerBound! <= watermark\n ? { completedThroughBlockHeight: watermark }\n : {}),\n };\n }\n cursor = next;\n }\n}\n","import type { RpcClient } from \"../../rpc/client.js\";\nimport type { TransportRequestOptions } from \"../../transport/types.js\";\nimport type { EventPage, EventQuery } from \"../../types/rpc.js\";\nimport { walkHistory, type HistoryCompletion } from \"./historyWalk.js\";\nexport type EventWalkQuery = Extract<EventQuery, { start: unknown }>;\n/** Start a fixed event range. Saved opaque cursors remain available through getEvents. */\nexport function iterateEventPages(\n client: Pick<RpcClient, \"getEvents\">,\n query: EventWalkQuery,\n options: TransportRequestOptions = {},\n): AsyncGenerator<EventPage, HistoryCompletion, unknown> {\n const snapshot = structuredClone(query);\n if (!snapshot.start || snapshot.cursor !== undefined)\n throw new TypeError(\"Event walks require an explicit start\");\n return walkHistory(\n (cursor) =>\n client.getEvents(\n cursor === undefined\n ? snapshot\n : { filters: snapshot.filters, limit: snapshot.limit, cursor },\n options,\n ),\n \"events\",\n { start: snapshot.start },\n options,\n ) as AsyncGenerator<EventPage, HistoryCompletion, unknown>;\n}\n","import type { RpcClient } from \"../../rpc/client.js\";\nimport type {\n ContractViewRequest,\n ContractViewOutcome,\n ContractException,\n} from \"../../contract/method.js\";\nimport type { TransportRequestOptions } from \"../../transport/types.js\";\nimport { ContractDecodeError } from \"../../contract/errors.js\";\n\n/** Typed calls and an optional minimum committed height for one snapshot read. */\nexport interface ReadViewsRequest<\n TCalls extends readonly ContractViewRequest[],\n> {\n calls: TCalls;\n minStateBlockHeight?: bigint;\n}\n\n/** Ordered typed outcomes, preserving each tuple position's return and exception types. */\nexport interface ReadViewsResponse<\n TCalls extends readonly ContractViewRequest[],\n> {\n stateBlockHeight: bigint;\n results: {\n [K in keyof TCalls]: TCalls[K] extends ContractViewRequest<infer R, infer E>\n ? ContractViewOutcome<R, ContractException<E>>\n : never;\n };\n}\n\n/**\n * Read generated method requests against one shared committed snapshot.\n * Contract aborts and faults are outcomes. Transport, freshness, and decoding\n * failures reject the group. Calls are never split or emulated with separate views.\n *\n * @example\n * ```ts\n * const result = await client.readViews({ calls: [\n * ERC20.v0_1.totalSupply.viewRequest({ address: token }),\n * ERC20.v0_1.getBalanceOf.viewRequest({ address: token, args: { addr: owner } }),\n * ] });\n * ```\n */\nexport async function readViews<\n const TCalls extends readonly ContractViewRequest[],\n>(\n client: Pick<RpcClient, \"simulateInvocations\">,\n request: ReadViewsRequest<TCalls>,\n options?: TransportRequestOptions,\n): Promise<ReadViewsResponse<TCalls>> {\n options?.signal?.throwIfAborted();\n // Retain the decoder order across the asynchronous request even if the caller\n // later edits its array. simulateInvocations serializes the byte inputs before yielding.\n const calls = request.calls.map((call) => {\n if (\"minStateBlockHeight\" in call) {\n throw new TypeError(\n \"Set minStateBlockHeight on readViews, not on a prepared call\",\n );\n }\n return {\n request: call.request,\n name: call.method.name,\n decode: call.method.decodeViewOutcome,\n };\n });\n const response = await client.simulateInvocations(\n {\n invocations: calls.map((call) => call.request),\n ...(request.minStateBlockHeight === undefined\n ? {}\n : { minStateBlockHeight: request.minStateBlockHeight }),\n },\n options,\n );\n const results = calls.map((call, index) => {\n try {\n return call.decode({\n ...response.results[index]!,\n stateBlockHeight: response.stateBlockHeight,\n });\n } catch (cause) {\n throw new ContractDecodeError(\n `Failed to decode readViews result ${index} (${call.name})`,\n { cause },\n );\n }\n });\n // simulateInvocations validates the exact count; each position uses its retained decoder.\n return {\n stateBlockHeight: response.stateBlockHeight,\n results: results as ReadViewsResponse<TCalls>[\"results\"],\n };\n}\n","import type { RpcClient } from \"../../rpc/client.js\";\nimport type { TransportRequestOptions } from \"../../transport/types.js\";\nimport type {\n RootAddressTransactionQuery,\n BlockTransactionQuery,\n TransactionRefPage,\n} from \"../../types/rpc.js\";\nimport { walkHistory, type HistoryCompletion } from \"./historyWalk.js\";\nexport type RootAddressWalkQuery = Extract<\n RootAddressTransactionQuery,\n { start: unknown }\n>;\nexport type BlockTransactionWalkQuery = Extract<\n BlockTransactionQuery,\n { start: unknown }\n>;\n/** Transactions sent by this root address; incoming transfers use token events. */\nexport function iterateTransactionsByRootAddress(\n client: Pick<RpcClient, \"getTransactionsByRootAddress\">,\n query: RootAddressWalkQuery,\n options: TransportRequestOptions = {},\n): AsyncGenerator<TransactionRefPage, HistoryCompletion, unknown> {\n const snapshot = structuredClone(query);\n if (!snapshot.start || snapshot.cursor !== undefined)\n throw new TypeError(\"Root-address walks require an explicit start\");\n return walkHistory(\n (cursor) =>\n client.getTransactionsByRootAddress(\n cursor === undefined\n ? snapshot\n : { address: snapshot.address, limit: snapshot.limit, cursor },\n options,\n ),\n \"transactions\",\n { start: snapshot.start },\n options,\n ) as AsyncGenerator<TransactionRefPage, HistoryCompletion, unknown>;\n}\n/** Walk one covered block. Completion never establishes a whole-chain checkpoint. */\nexport function iterateTransactionsByBlock(\n client: Pick<RpcClient, \"getTransactionsByBlock\">,\n query: BlockTransactionWalkQuery,\n options: TransportRequestOptions = {},\n): AsyncGenerator<TransactionRefPage, void, unknown> {\n const snapshot = structuredClone(query);\n if (!snapshot.start || snapshot.cursor !== undefined)\n throw new TypeError(\"Block walks require an explicit start\");\n return walkHistory(\n (cursor) =>\n client.getTransactionsByBlock(\n cursor === undefined\n ? snapshot\n : {\n blockHeight: snapshot.blockHeight,\n limit: snapshot.limit,\n cursor,\n },\n options,\n ),\n \"transactions\",\n { blockHeight: snapshot.blockHeight, order: snapshot.start.order },\n options,\n ) as AsyncGenerator<TransactionRefPage, void, unknown>;\n}\n","import {\n codec,\n ContractType,\n deserialize,\n sha256Hash,\n} from \"@thruputchain/protocol\";\nimport {\n readContractArtifactSpec,\n type ContractArtifactSpec,\n} from \"../../contract/artifact.js\";\nimport { bytesEqual } from \"../../contract/event.js\";\nimport { ContractVerificationError } from \"../../contract/errors.js\";\nimport type { RpcClient } from \"../../rpc/client.js\";\nimport type {\n RpcContractDeployment,\n RpcContractDeploymentResult,\n} from \"../../rpc/generated.js\";\nimport type { TransportRequestOptions } from \"../../transport/types.js\";\n\n/** Snapshot deployment evidence and its authenticated metadata, if deployed. */\nexport interface ContractSpecResult extends RpcContractDeploymentResult {\n artifactSpec: ContractArtifactSpec | null;\n}\n\n/**\n * Resolve a current deployment and verify its embedded spec against its hash.\n * Missing artifacts and invalid responses throw; neither means no deployment.\n * The snapshot does not establish which implementation produced historical events.\n */\nexport async function getContractSpec(\n client: RpcClient,\n request: { address: Uint8Array },\n options?: TransportRequestOptions,\n): Promise<ContractSpecResult> {\n client.requireMethods([\"getContractDeployment\", \"getContractArtifact\"]);\n const address = new Uint8Array(request.address);\n const result = await client.getContractDeployment({ address }, options);\n if (!bytesEqual(address, result.address))\n throw new ContractVerificationError(\"Contract deployment address mismatch\");\n if (result.deployment === null) return { ...result, artifactSpec: null };\n return {\n ...result,\n artifactSpec: await readDeploymentSpec(client, result.deployment, options),\n };\n}\n\n/** Shared identity validation for explicit deployments and effective contract selection. */\nexport async function readDeploymentSpec(\n client: RpcClient,\n deployment: RpcContractDeployment,\n options?: TransportRequestOptions,\n): Promise<ContractArtifactSpec> {\n const artifact = await client.getContractArtifact(\n { hash: deployment.hash },\n options,\n );\n if (!bytesEqual(artifact.hash, deployment.hash))\n throw new ContractVerificationError(\n \"Contract artifact response hash mismatch\",\n );\n const artifactSpec = readContractArtifactSpec(\n artifact.contractXdr,\n sha256Hash(deployment.hash),\n );\n const contract = deserialize(artifact.contractXdr, codec.Contract);\n const size =\n contract.contract_type === ContractType.kRv32\n ? contract.rv32_contract.data.length\n : 0;\n if (\n contract.contract_type !== deployment.contractType ||\n size !== deployment.size\n ) {\n throw new ContractVerificationError(\n \"Contract artifact does not match deployment metadata\",\n );\n }\n return artifactSpec;\n}\n","import {\n ContractType,\n HogexecPrecompiledNativeContracts,\n} from \"@thruputchain/protocol\";\nimport { hashContract } from \"../../contract/hash.js\";\nimport { bytesEqual } from \"../../contract/event.js\";\nimport { ContractVerificationError } from \"../../contract/errors.js\";\nimport type { ContractArtifactSpec } from \"../../contract/artifact.js\";\nimport { spec as defaultWalletSpec } from \"../../contracts/default_wallet.js\";\nimport type { ContractSpec } from \"../../contract/spec.js\";\nimport { RpcCompatibilityError, type RpcClient } from \"../../rpc/client.js\";\nimport type { RpcEffectiveContractResult } from \"../../rpc/generated.js\";\nimport { UnsupportedRpcValue } from \"../../rpc/codec.js\";\nimport type { TransportRequestOptions } from \"../../transport/types.js\";\nimport { readDeploymentSpec } from \"./getContractSpec.js\";\n\nconst nativeWalletHash = hashContract({\n contract_type: ContractType.kNative,\n native_contract_id:\n HogexecPrecompiledNativeContracts.kNativeContractDefaultWallet,\n});\n\nexport interface EffectiveContractSpecResult extends RpcEffectiveContractResult {\n artifactSpec: ContractArtifactSpec | null;\n /** Recognized native interface; not artifact-bound or proof of runtime code. */\n nativeInterface: { name: \"DefaultWallet\"; spec: ContractSpec } | null;\n}\n\n/**\n * Discover current contract selection without inferring authorization or historical identity.\n * Root context allows the chain-configured fallback; nested excludes that fallback.\n * Transaction-local deployments are outside this committed-state reading.\n */\nexport async function getEffectiveContractSpec(\n client: RpcClient,\n request: { address: Uint8Array; context: \"root\" | \"nested\" },\n options?: TransportRequestOptions,\n): Promise<EffectiveContractSpecResult> {\n client.requireMethods([\"getEffectiveContract\", \"getContractArtifact\"]);\n const address = new Uint8Array(request.address);\n const context = request.context;\n const result = await client.getEffectiveContract(\n { address, context },\n options,\n );\n if (!bytesEqual(address, result.address) || result.context !== context)\n throw new ContractVerificationError(\n \"Effective contract request identity mismatch\",\n );\n if (result.selection instanceof UnsupportedRpcValue)\n throw new RpcCompatibilityError(\"Unsupported effective contract selection\");\n if (result.selection === null)\n return { ...result, artifactSpec: null, nativeInterface: null };\n if (context === \"nested\" && result.selection.source === \"networkDefault\")\n throw new ContractVerificationError(\n \"Network default cannot apply to a nested invocation\",\n );\n const contract = result.selection.contract;\n const artifactSpec = await readDeploymentSpec(client, contract, options);\n const nativeInterface =\n artifactSpec.kind === \"native\" &&\n bytesEqual(contract.hash, nativeWalletHash)\n ? { name: \"DefaultWallet\" as const, spec: defaultWalletSpec }\n : null;\n return { ...result, artifactSpec, nativeInterface };\n}\n","import {\n contractEntrypointID,\n gasAmount,\n calldata,\n sha256Hash,\n type Invocation,\n} from \"@thruputchain/protocol\";\nimport { DefaultWallet } from \"../../contracts/default_wallet.js\";\nimport { bytesEqual } from \"../../contract/event.js\";\nimport { deriveContractAddress } from \"../../derivation/contractAddress.js\";\n\n/** Requested child invocations, never proof of execution or child outputs. */\nexport interface WalletRequests {\n wrapper: \"DefaultWallet.execute\" | \"DefaultWallet.deploy\";\n requestedCalls: Invocation[];\n}\n\n/**\n * Interpret a known DefaultWallet root using built-in binding descriptors.\n * Call only after identifying the root as DefaultWallet; matching selectors\n * alone do not establish wallet identity. Malformed recognized inputs throw.\n */\nexport function decodeDefaultWalletRequests(\n root: Invocation,\n): WalletRequests | null {\n if (bytesEqual(root.entrypoint, DefaultWallet.v0_1.execute.entrypoint)) {\n const { calls } = DefaultWallet.v0_1.execute.decodeArgs(root.calldata);\n return {\n wrapper: \"DefaultWallet.execute\",\n requestedCalls: calls.map((call) => ({\n invoked_address: call.target,\n entrypoint: contractEntrypointID(call.entrypoint),\n gas_limit: gasAmount(call.gas_limit),\n calldata: calldata(call.calldata),\n })),\n };\n }\n if (bytesEqual(root.entrypoint, DefaultWallet.v0_1.deploy.entrypoint)) {\n const args = DefaultWallet.v0_1.deploy.decodeArgs(root.calldata);\n const init = args.initializer;\n return {\n wrapper: \"DefaultWallet.deploy\",\n requestedCalls: init\n ? [\n {\n invoked_address: deriveContractAddress(\n root.invoked_address,\n sha256Hash(args.nonce),\n sha256Hash(args.contractHash),\n ),\n entrypoint: contractEntrypointID(init.entrypoint),\n gas_limit: gasAmount(init.gas_limit),\n calldata: calldata(init.calldata),\n },\n ]\n : [],\n };\n }\n return null;\n}\n","import { sha256 } from \"@noble/hashes/sha2.js\";\nimport {\n codec,\n deserialize,\n serialize,\n type Transaction,\n} from \"@thruputchain/protocol\";\nimport { bytesEqual } from \"../../contract/event.js\";\nimport { ContractVerificationError } from \"../../contract/errors.js\";\nimport type { RpcClient } from \"../../rpc/client.js\";\nimport { UnsupportedRpcValue } from \"../../rpc/codec.js\";\nimport type { TransportRequestOptions } from \"../../transport/types.js\";\n\n/** Canonical retained input verified against the requested public transaction hash. */\nexport type VerifiedTransactionInput =\n | {\n status: \"available\";\n transactionHash: Uint8Array;\n blockHeight: bigint;\n transactionXdr: Uint8Array;\n transaction: Transaction;\n }\n | { status: \"unavailable\" }\n | UnsupportedRpcValue;\n\n/**\n * Read and authenticate a retained Transaction, including its root invocation.\n * Unavailable does not prove nonexecution. A matching body hash authenticates\n * neither signatures nor the reported block height, and does not imply success.\n */\nexport async function readTransactionInput(\n client: RpcClient,\n request: { transactionHash: Uint8Array },\n options?: TransportRequestOptions,\n): Promise<VerifiedTransactionInput> {\n client.requireMethods([\"getTransactionInput\"]);\n const hash = new Uint8Array(request.transactionHash);\n const result = await client.getTransactionInput(\n { transactionHash: hash },\n options,\n );\n if (result instanceof UnsupportedRpcValue || result.status === \"unavailable\")\n return result;\n try {\n if (result.transactionXdr.length > 4 * 1024 * 1024)\n throw new Error(\"Transaction input exceeds 4 MiB\");\n if (\n !bytesEqual(result.transactionHash, hash) ||\n !bytesEqual(sha256(result.transactionXdr), hash)\n ) {\n throw new Error(\"Retained transaction input hash mismatch\");\n }\n const transaction = deserialize(result.transactionXdr, codec.Transaction);\n if (\n !bytesEqual(\n serialize(transaction, codec.Transaction),\n result.transactionXdr,\n )\n ) {\n throw new Error(\"Noncanonical Transaction XDR\");\n }\n return { ...result, transaction };\n } catch (cause) {\n throw new ContractVerificationError(\n cause instanceof Error ? cause.message : \"Invalid transaction input\",\n { cause },\n );\n }\n}\n","import {\n serialize,\n codec,\n sha256Hash,\n type SignedTransaction,\n type SHA256Hash,\n} from \"@thruputchain/protocol\";\nimport type { RpcClient } from \"../../rpc/client.js\";\nimport type { TransportRequestOptions } from \"../../transport/types.js\";\nimport {\n assertTransactionAdmission,\n createSubmissionEvidence,\n TransactionObservationError,\n} from \"../../wallet/execution.js\";\n\n/**\n * Serialize and submit once through the native RPC boundary.\n * Unknown admission throws TransactionObservationError with the signed bytes and\n * destination discovery network; that network does not prove the signing network\n * of an already-signed envelope. RPC and transport failures propagate unchanged.\n */\nexport async function sendTransaction(\n client: Pick<RpcClient, \"sendTransaction\" | \"discovery\">,\n signedTx: SignedTransaction,\n options?: TransportRequestOptions,\n): Promise<SHA256Hash> {\n const evidence = createSubmissionEvidence(\n serialize(signedTx, codec.SignedTransaction),\n client.discovery.network.networkHash,\n );\n const result = await client.sendTransaction(\n { signedTransaction: evidence.signedTransaction },\n options,\n );\n try {\n assertTransactionAdmission(result);\n } catch (cause) {\n throw new TransactionObservationError(\n evidence,\n cause,\n undefined,\n undefined,\n \"submission\",\n );\n }\n return sha256Hash(result.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