@outpost-protocol/core 0.1.0 → 0.2.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 CHANGED
@@ -14,7 +14,9 @@ npm install @outpost-protocol/core
14
14
 
15
15
  - **Wire Codecs (`SREQ1`, `SMESHI1`, `SMESHC1`, `SMESHD1`, `SMESHF1`, BC-UR)** — strict `BigInt` asset-agnostic encoding/decoding with CRC-32C framing, canonical Base32, and cross-language golden-vector parity with Soroban & Rust (`outpost-wire`).
16
16
  - **Cryptographic Digests & Vault Derivation** — cofactorless RFC 8032 Ed25519 helpers, canonical `UserVault` deterministic ID derivation, and domain-separated `GENESIS` / `INTENT` / `WITNESS_LOCK` / `WITNESS_CERT` preimages.
17
- - **Non-Custodial `OfflineWallet`** — per-pocket async mutex, burn-before-display monotonic `localSeq`, asset-agnostic untrusted `SREQ1.tip` caps, duplicate `(recipient, orderId)` retry protection, and authenticated `SEQ_TOO_LOW` resync.
17
+ - **Soroban Contract Call Builders (`0.2.0+`)** — browser/WebView-safe `buildCreateVaultOp`, `buildDepositOp`, `buildSettleDelegatedOp`, `buildClosePocketCooperativeOp`, `buildRequestExitOp`, `buildFinalizeExitOp`, `buildClaimCreditOp`, plus view builders and `decodePocketStateScVal`.
18
+ - **Multi-Witness Coordinators (`0.2.0+`)** — `coordinateInitGenesis` (`cert_0` assembly + propagation), `coordinateRefreshFreshness` (`fresh_cert` assembly + propagation), and `coordinateCloseCooperative` (verified close signatures).
19
+ - **Non-Custodial `OfflineWallet` & `JsonWalletStorage`** — per-pocket async mutex, burn-before-display monotonic `localSeq`, running pocket budget enforcement (`getPocketBudget`), portable JSON state persistence (`JsonWalletStorage` / `serializeWalletState`), asset-agnostic untrusted `SREQ1.tip` caps, duplicate `(recipient, orderId)` retry protection, and authenticated `SEQ_TOO_LOW` resync.
18
20
  - **Direct & Classic Settlement Builders** — `order_id`-bound CAP-0046-11 `relay_direct` (`SMESHD1`) and hardened CAP-0015 `FeeBumpTransaction` (`SMESHF1`).
19
21
  - **Station Transports** — `WitnessClient` (LAN/WAN HTTP) and `BleWitnessClient` (`OUTPOST_BLE_V1` GATT framing for internet-free mobile/POS witnessing).
20
22
 
package/dist/base32.d.ts CHANGED
@@ -3,6 +3,11 @@
3
3
  * Valid in QR Alphanumeric Mode with zero whitespace or Markdown characters.
4
4
  */
5
5
  export declare const BASE32_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
6
+ /**
7
+ * Hard cap on framed/raw Base32 wire input length in characters (exact parity with Rust `outpost-wire`, `AUD6-M11`).
8
+ * Rejects multi-megabyte inputs in O(1) before trimming, slicing, or allocating decode buffers.
9
+ */
10
+ export declare const MAX_FRAMED_BASE32_LEN = 32768;
6
11
  /**
7
12
  * Encode arbitrary bytes to unpadded uppercase RFC 4648 Base32 (`A-Z`, `2-7`).
8
13
  */
package/dist/base32.js CHANGED
@@ -4,6 +4,11 @@ import { appendCrc32c, verifyAndStripCrc32c } from "./crc32c.js";
4
4
  * Valid in QR Alphanumeric Mode with zero whitespace or Markdown characters.
5
5
  */
6
6
  export const BASE32_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
7
+ /**
8
+ * Hard cap on framed/raw Base32 wire input length in characters (exact parity with Rust `outpost-wire`, `AUD6-M11`).
9
+ * Rejects multi-megabyte inputs in O(1) before trimming, slicing, or allocating decode buffers.
10
+ */
11
+ export const MAX_FRAMED_BASE32_LEN = 32_768;
7
12
  const DECODE_MAP = (() => {
8
13
  const map = new Int8Array(128);
9
14
  map.fill(-1);
@@ -50,6 +55,9 @@ export function decodeBase32(input) {
50
55
  if (input.length === 0) {
51
56
  return new Uint8Array(0);
52
57
  }
58
+ if (input.length > MAX_FRAMED_BASE32_LEN) {
59
+ throw new Error(`Base32 input length (${input.length}) exceeds maximum allowed length (${MAX_FRAMED_BASE32_LEN})`);
60
+ }
53
61
  // Valid unpadded RFC 4648 Base32 lengths mod 8 are 0, 2, 4, 5, 7.
54
62
  const rem = input.length % 8;
55
63
  if (rem === 1 || rem === 3 || rem === 6) {
@@ -105,6 +113,9 @@ export function encodeFramed(hrp, payload) {
105
113
  * returning uppercase `hrp` and verified `payload`.
106
114
  */
107
115
  export function splitFramed(text) {
116
+ if (text.length > MAX_FRAMED_BASE32_LEN) {
117
+ throw new Error(`Framed Base32 input length (${text.length}) exceeds maximum allowed length (${MAX_FRAMED_BASE32_LEN})`);
118
+ }
108
119
  const trimmed = text.trim();
109
120
  const sepIndex = trimmed.indexOf("1");
110
121
  if (sepIndex <= 0) {
package/dist/bcur.js CHANGED
@@ -1,4 +1,4 @@
1
- import { decodeBase32, encodeBase32 } from "./base32.js";
1
+ import { decodeBase32, encodeBase32, MAX_FRAMED_BASE32_LEN } from "./base32.js";
2
2
  import { appendCrc32c, verifyAndStripCrc32c } from "./crc32c.js";
3
3
  import { bytesEqual } from "./xdr.js";
4
4
  /**
@@ -49,6 +49,9 @@ export function encodeUrSmesh(payload, maxChunkBytes = DEFAULT_UR_SMESH_MAX_CHUN
49
49
  * Verifies frame header format, bounds, strict Base32, and per-frame CRC32C.
50
50
  */
51
51
  export function parseUrSmeshFrame(frame) {
52
+ if (frame.length > MAX_FRAMED_BASE32_LEN) {
53
+ throw new Error(`ur:smesh frame length (${frame.length}) exceeds maximum allowed length (${MAX_FRAMED_BASE32_LEN})`);
54
+ }
52
55
  const upper = frame.trim().toUpperCase();
53
56
  const parts = upper.split("/");
54
57
  if (parts.length !== 3 || parts[0] !== UR_SMESH_PREFIX) {
@@ -0,0 +1,12 @@
1
+ import type { EpochGenesisCert } from "./wire.js";
2
+ /**
3
+ * Encode `EpochGenesisCert` (`cert_0`) into the exact binary layout specified by
4
+ * `WIRE-FORMAT-v1.2.md §4.5` (identical to the embedded `cert_0` suffix of `SMESHC1`).
5
+ */
6
+ export declare function encodeCert0Bytes(cert0: EpochGenesisCert): Uint8Array;
7
+ /**
8
+ * Decode binary `EpochGenesisCert` (`cert_0`) bytes (`WIRE-FORMAT-v1.2.md §4.5`).
9
+ */
10
+ export declare function decodeCert0Bytes(raw: Uint8Array): EpochGenesisCert;
11
+ export declare function encodeCert0Hex(cert0: EpochGenesisCert): string;
12
+ export declare function decodeCert0Hex(hex: string): EpochGenesisCert;
package/dist/cert0.js ADDED
@@ -0,0 +1,125 @@
1
+ import { assertBigInt, assertBytesLength, assertSortedUniqueWitnesses, assertU32, assertU8, concatBytes, decodeU32Be, decodeU64Be, encodeU32Be, encodeU64Be, encodeU8, MAX_U64, MAX_WITNESSES, } from "./digest.js";
2
+ import { bytesToHex, hexToBytes } from "./witnessClient.js";
3
+ import { decodeWireToken, encodeWireToken } from "./xdr.js";
4
+ /**
5
+ * Encode `EpochGenesisCert` (`cert_0`) into the exact binary layout specified by
6
+ * `WIRE-FORMAT-v1.2.md §4.5` (identical to the embedded `cert_0` suffix of `SMESHC1`).
7
+ */
8
+ export function encodeCert0Bytes(cert0) {
9
+ assertBytesLength(cert0.devicePubkey, 32, "cert0.devicePubkey");
10
+ assertBigInt(cert0.epochTotalDeposited, "cert0.epochTotalDeposited");
11
+ if (cert0.epochTotalDeposited <= 0n || cert0.epochTotalDeposited > MAX_U64) {
12
+ throw new Error(`cert0.epochTotalDeposited out of u64 (>0) range: ${cert0.epochTotalDeposited}`);
13
+ }
14
+ assertBigInt(cert0.exitDelaySecs, "cert0.exitDelaySecs");
15
+ assertBigInt(cert0.syncedAtTs, "cert0.syncedAtTs");
16
+ assertU32(cert0.syncedLedgerSeq, "cert0.syncedLedgerSeq");
17
+ assertSortedUniqueWitnesses(cert0.witnesses);
18
+ const n = cert0.witnesses.length;
19
+ assertU8(cert0.witnessThreshold, "cert0.witnessThreshold");
20
+ if (cert0.witnessThreshold < 1 || cert0.witnessThreshold > n || cert0.witnessThreshold * 2 <= n) {
21
+ throw new Error(`cert0.witnessThreshold (${cert0.witnessThreshold}) must satisfy 0 < t <= n and 2t > n`);
22
+ }
23
+ if (cert0.genesisSigs.length < 1 || cert0.genesisSigs.length > n) {
24
+ throw new Error(`cert0.genesisSigs count must be in 1..=${n}`);
25
+ }
26
+ let prevIdx = -1;
27
+ const parts = [
28
+ encodeWireToken(cert0.token),
29
+ cert0.devicePubkey,
30
+ encodeU64Be(cert0.epochTotalDeposited, "cert0.epochTotalDeposited"),
31
+ encodeU64Be(cert0.exitDelaySecs, "cert0.exitDelaySecs"),
32
+ encodeU64Be(cert0.syncedAtTs, "cert0.syncedAtTs"),
33
+ encodeU32Be(cert0.syncedLedgerSeq, "cert0.syncedLedgerSeq"),
34
+ encodeU8(cert0.witnessThreshold, "cert0.witnessThreshold"),
35
+ encodeU8(n, "n_witnesses"),
36
+ ...cert0.witnesses,
37
+ encodeU8(cert0.genesisSigs.length, "genesis_sig_count"),
38
+ ];
39
+ for (const sig of cert0.genesisSigs) {
40
+ if (!Number.isInteger(sig.index) || sig.index < 0 || sig.index >= n || sig.index <= prevIdx) {
41
+ throw new Error("cert0.genesisSigs indices must be strictly ascending and in bounds");
42
+ }
43
+ assertBytesLength(sig.signature, 64, "cert0.genesisSig.signature");
44
+ prevIdx = sig.index;
45
+ parts.push(encodeU8(sig.index, "genesisSig.index"), sig.signature);
46
+ }
47
+ return concatBytes(...parts);
48
+ }
49
+ /**
50
+ * Decode binary `EpochGenesisCert` (`cert_0`) bytes (`WIRE-FORMAT-v1.2.md §4.5`).
51
+ */
52
+ export function decodeCert0Bytes(raw) {
53
+ let offset = 0;
54
+ const { token, bytesRead: tokenBytes } = decodeWireToken(raw, offset);
55
+ offset += tokenBytes;
56
+ if (offset + 62 > raw.length) {
57
+ throw new Error("Truncated cert_0 binary payload");
58
+ }
59
+ const devicePubkey = raw.slice(offset, offset + 32);
60
+ offset += 32;
61
+ const epochTotalDeposited = decodeU64Be(raw, offset);
62
+ offset += 8;
63
+ if (epochTotalDeposited <= 0n) {
64
+ throw new Error(`cert_0 epochTotalDeposited must be > 0, got ${epochTotalDeposited}`);
65
+ }
66
+ const exitDelaySecs = decodeU64Be(raw, offset);
67
+ offset += 8;
68
+ const syncedAtTs = decodeU64Be(raw, offset);
69
+ offset += 8;
70
+ const syncedLedgerSeq = decodeU32Be(raw, offset);
71
+ offset += 4;
72
+ const witnessThreshold = raw[offset++];
73
+ const nWitnesses = raw[offset++];
74
+ if (nWitnesses < 1 || nWitnesses > MAX_WITNESSES) {
75
+ throw new Error(`Invalid cert_0 n_witnesses: ${nWitnesses}`);
76
+ }
77
+ if (witnessThreshold < 1 || witnessThreshold > nWitnesses || witnessThreshold * 2 <= nWitnesses) {
78
+ throw new Error(`Invalid cert_0 witnessThreshold=${witnessThreshold} for n=${nWitnesses}`);
79
+ }
80
+ if (offset + nWitnesses * 32 + 1 > raw.length) {
81
+ throw new Error("Truncated cert_0 witnesses list");
82
+ }
83
+ const witnesses = [];
84
+ for (let i = 0; i < nWitnesses; i++) {
85
+ witnesses.push(raw.slice(offset, offset + 32));
86
+ offset += 32;
87
+ }
88
+ assertSortedUniqueWitnesses(witnesses);
89
+ const genesisSigCount = raw[offset++];
90
+ if (genesisSigCount < 1 || genesisSigCount > nWitnesses) {
91
+ throw new Error(`Invalid cert_0 genesis_sig_count: ${genesisSigCount}`);
92
+ }
93
+ if (offset + genesisSigCount * 65 !== raw.length) {
94
+ throw new Error("Truncated or trailing bytes in cert_0 genesis_sigs");
95
+ }
96
+ const genesisSigs = [];
97
+ let prevIdx = -1;
98
+ for (let i = 0; i < genesisSigCount; i++) {
99
+ const index = raw[offset++];
100
+ const signature = raw.slice(offset, offset + 64);
101
+ offset += 64;
102
+ if (index >= nWitnesses || index <= prevIdx) {
103
+ throw new Error("cert_0 genesis_sigs indices must be strictly ascending and in bounds");
104
+ }
105
+ prevIdx = index;
106
+ genesisSigs.push({ index, signature });
107
+ }
108
+ return {
109
+ token,
110
+ devicePubkey,
111
+ epochTotalDeposited,
112
+ exitDelaySecs,
113
+ syncedAtTs,
114
+ syncedLedgerSeq,
115
+ witnessThreshold,
116
+ witnesses,
117
+ genesisSigs,
118
+ };
119
+ }
120
+ export function encodeCert0Hex(cert0) {
121
+ return bytesToHex(encodeCert0Bytes(cert0));
122
+ }
123
+ export function decodeCert0Hex(hex) {
124
+ return decodeCert0Bytes(hexToBytes(hex));
125
+ }
@@ -0,0 +1,178 @@
1
+ /**
2
+ * Soroban Contract Call Operation Builders for Outpost v1.2 (`VaultFactory` & `UserVault`).
3
+ *
4
+ * Pure browser/WebView/Node compatible (uses `Uint8Array`, zero Node `Buffer` dependencies)
5
+ * and 100% asset-agnostic across all Stellar SAC and SEP-41 token contracts.
6
+ */
7
+ import * as StellarSdk from "@stellar/stellar-sdk";
8
+ import { type IndexedWitnessSignature, type Smeshc1Packet } from "./wire.js";
9
+ import { type WireAddress } from "./xdr.js";
10
+ /**
11
+ * Low-level Soroban `InvokeHostFunctionOp` (`HostFunctionType::InvokeContract`) builder.
12
+ */
13
+ export declare function buildContractCallOp(contractId: string | WireAddress | Uint8Array, method: string, args: readonly StellarSdk.xdr.ScVal[], auth?: readonly StellarSdk.xdr.SorobanAuthorizationEntry[]): StellarSdk.xdr.Operation;
14
+ export interface CreateVaultOpParams {
15
+ readonly factoryId: string | WireAddress | Uint8Array;
16
+ readonly owner: WireAddress | string;
17
+ }
18
+ /**
19
+ * Build `VaultFactory.create_vault(owner: Address) -> Address`.
20
+ */
21
+ export declare function buildCreateVaultOp(params: CreateVaultOpParams): StellarSdk.xdr.Operation;
22
+ /**
23
+ * Build read-only view call `VaultFactory.expected_vault(owner: Address) -> Address`.
24
+ */
25
+ export declare function buildExpectedVaultOp(params: CreateVaultOpParams): StellarSdk.xdr.Operation;
26
+ /**
27
+ * Build read-only view call `VaultFactory.user_vault_wasm_hash() -> BytesN<32>`.
28
+ */
29
+ export declare function buildUserVaultWasmHashOp(params: {
30
+ readonly factoryId: string | WireAddress | Uint8Array;
31
+ }): StellarSdk.xdr.Operation;
32
+ /**
33
+ * Decode the `Address` (`C...`) returned by `VaultFactory.create_vault` or `expected_vault`.
34
+ */
35
+ export declare function parseCreateVaultResult(retval: StellarSdk.xdr.ScVal): string;
36
+ export interface DepositOpParams {
37
+ readonly vaultId: string | WireAddress | Uint8Array;
38
+ readonly pocketId: number;
39
+ /** Any Stellar SAC or SEP-41 token contract ID (`C...`, 32B raw, or contract `WireAddress`). */
40
+ readonly token: string | WireAddress | Uint8Array;
41
+ readonly amount: bigint;
42
+ /** 32-byte Ed25519 device public key (or 64-char hex). */
43
+ readonly devicePubkey: Uint8Array | string;
44
+ /**
45
+ * 1..=7 witness Ed25519 public keys (32B `Uint8Array` or 64-char hex) in **strictly ascending
46
+ * lexicographical order** (`sortWitnesses()`).
47
+ */
48
+ readonly witnesses: readonly (Uint8Array | string)[];
49
+ readonly witnessThreshold: number;
50
+ /** Unilateral exit delay in seconds (`259_200..=2_592_000`, i.e., 72h..30d). */
51
+ readonly exitDelaySecs: bigint | number;
52
+ }
53
+ /**
54
+ * Build `UserVault.deposit(pocket_id, token, amount, device_pubkey, witnesses, witness_threshold, exit_delay_secs)`.
55
+ */
56
+ export declare function buildDepositOp(params: DepositOpParams): StellarSdk.xdr.Operation;
57
+ export interface SettleDelegatedFromCertParams {
58
+ readonly vaultId: string | WireAddress | Uint8Array;
59
+ /** Decoded `Smeshc1Packet` or framed `"SMESHC1..."` certificate string. */
60
+ readonly cert: Smeshc1Packet | string;
61
+ /** Gateway / fee-sponsor address receiving `actualTip` (for self-settlement with `actualTip = 0n`, pass recipient or submitter). */
62
+ readonly gateway: WireAddress | string;
63
+ /** Actual tip paid to `gateway` (`0n <= actualTip <= cert.intent.maxTip`, defaults to `0n`). */
64
+ readonly actualTip?: bigint;
65
+ }
66
+ export interface SettleDelegatedExplicitParams {
67
+ readonly vaultId: string | WireAddress | Uint8Array;
68
+ readonly pocketId: number;
69
+ readonly epoch: number;
70
+ readonly seq: number;
71
+ readonly to: WireAddress | string;
72
+ readonly amount: bigint;
73
+ readonly maxTip: bigint;
74
+ readonly actualTip: bigint;
75
+ readonly gateway: WireAddress | string;
76
+ readonly expiryTs: bigint | number;
77
+ readonly expiryLedger: number;
78
+ readonly orderId: bigint;
79
+ readonly cumulativeSpent: bigint;
80
+ readonly deviceSig: Uint8Array | string;
81
+ readonly witnessSigs: readonly (IndexedWitnessSignature | {
82
+ readonly index: number;
83
+ readonly signature: Uint8Array | string;
84
+ })[];
85
+ }
86
+ export type SettleDelegatedOpParams = SettleDelegatedFromCertParams | SettleDelegatedExplicitParams;
87
+ /**
88
+ * Build `UserVault.settle_delegated(...)` either directly from a `SMESHC1` certificate or from
89
+ * explicit fields.
90
+ */
91
+ export declare function buildSettleDelegatedOp(params: SettleDelegatedOpParams): StellarSdk.xdr.Operation;
92
+ export interface ClosePocketCooperativeOpParams {
93
+ readonly vaultId: string | WireAddress | Uint8Array;
94
+ readonly pocketId: number;
95
+ /** Destination address receiving unspent pocket funds (`G...` or `C...`, cannot equal `vaultId`). */
96
+ readonly toAlt: WireAddress | string;
97
+ /** Strictly ascending unique witness signatures over `"SMW1_CLOSE"` (from `coordinateCloseCooperative`). */
98
+ readonly witnessSigs: readonly (IndexedWitnessSignature | {
99
+ readonly index: number;
100
+ readonly signature: Uint8Array | string;
101
+ })[];
102
+ }
103
+ /**
104
+ * Build `UserVault.close_pocket_cooperative(pocket_id, to_alt, witness_sigs)`.
105
+ */
106
+ export declare function buildClosePocketCooperativeOp(params: ClosePocketCooperativeOpParams): StellarSdk.xdr.Operation;
107
+ export interface RequestExitOpParams {
108
+ readonly vaultId: string | WireAddress | Uint8Array;
109
+ readonly pocketId: number;
110
+ }
111
+ /**
112
+ * Build `UserVault.request_exit(pocket_id)` — initiates unilateral timelocked exit (`exit_delay_secs`).
113
+ */
114
+ export declare function buildRequestExitOp(params: RequestExitOpParams): StellarSdk.xdr.Operation;
115
+ export interface FinalizeExitOpParams {
116
+ readonly vaultId: string | WireAddress | Uint8Array;
117
+ readonly pocketId: number;
118
+ /** Destination address receiving remaining pocket funds (`G...` or `C...`, cannot equal `vaultId`). */
119
+ readonly toAlt: WireAddress | string;
120
+ }
121
+ /**
122
+ * Build `UserVault.finalize_exit(pocket_id, to_alt)` — sweeps pocket after `pending_exit_ts` elapses.
123
+ */
124
+ export declare function buildFinalizeExitOp(params: FinalizeExitOpParams): StellarSdk.xdr.Operation;
125
+ export interface ClaimCreditOpParams {
126
+ readonly vaultId: string | WireAddress | Uint8Array;
127
+ /** Original recipient address that holds the parked credit (must authorize the tx). */
128
+ readonly recipient: WireAddress | string;
129
+ /** Parked token contract ID (`C...`, asset-agnostic SAC or SEP-41). */
130
+ readonly token: string | WireAddress | Uint8Array;
131
+ /** Destination address receiving the claimed credit (`G...` or `C...`, cannot equal `vaultId`). */
132
+ readonly toAlt: WireAddress | string;
133
+ }
134
+ /**
135
+ * Build `UserVault.claim_credit(recipient, token, to_alt)` — claims parked credits when a classic
136
+ * trustline or SAC transfer previously bounced during `settle_delegated`.
137
+ */
138
+ export declare function buildClaimCreditOp(params: ClaimCreditOpParams): StellarSdk.xdr.Operation;
139
+ /**
140
+ * Build read-only view call `UserVault.pocket_of(pocket_id: u32) -> Option<PocketState>`.
141
+ */
142
+ export declare function buildPocketOfOp(params: {
143
+ readonly vaultId: string | WireAddress | Uint8Array;
144
+ readonly pocketId: number;
145
+ }): StellarSdk.xdr.Operation;
146
+ /**
147
+ * Build read-only view call `UserVault.credit_of(recipient: Address, token: Address) -> i128`.
148
+ */
149
+ export declare function buildCreditOfOp(params: {
150
+ readonly vaultId: string | WireAddress | Uint8Array;
151
+ readonly recipient: WireAddress | string;
152
+ readonly token: string | WireAddress | Uint8Array;
153
+ }): StellarSdk.xdr.Operation;
154
+ /**
155
+ * Build read-only view call `UserVault.is_settled(pocket_id: u32, epoch: u32, seq: u32) -> bool`.
156
+ */
157
+ export declare function buildIsSettledOp(params: {
158
+ readonly vaultId: string | WireAddress | Uint8Array;
159
+ readonly pocketId: number;
160
+ readonly epoch: number;
161
+ readonly seq: number;
162
+ }): StellarSdk.xdr.Operation;
163
+ export interface OnChainPocketState {
164
+ readonly token: string;
165
+ readonly balance: bigint;
166
+ readonly epochTotalDeposited: bigint;
167
+ readonly devicePubkey: Uint8Array;
168
+ readonly witnesses: readonly Uint8Array[];
169
+ readonly witnessThreshold: number;
170
+ readonly exitDelaySecs: bigint;
171
+ readonly pendingExitTs: bigint;
172
+ readonly epoch: number;
173
+ }
174
+ /**
175
+ * Decode `Option<PocketState>` returned by `UserVault.pocket_of(pocket_id)` simulation.
176
+ * Returns `null` when `ScVal` is `scvVoid` (`None`).
177
+ */
178
+ export declare function decodePocketStateScVal(scVal: StellarSdk.xdr.ScVal): OnChainPocketState | null;