@t3foundry/tasra-sdk 0.3.1 → 0.4.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/CHANGELOG.md +1067 -28
- package/README.md +15 -0
- package/dist/app/approvals.d.ts +66 -4
- package/dist/app/approvals.js +153 -16
- package/dist/app/authorization.d.ts +1 -1
- package/dist/app/authorization.js +1 -1
- package/dist/app/browser.d.ts +63 -0
- package/dist/app/browser.js +242 -0
- package/dist/app/client.d.ts +114 -13
- package/dist/app/client.js +302 -76
- package/dist/app/identity.js +21 -9
- package/dist/app/index.d.ts +28 -3
- package/dist/app/index.js +16 -1
- package/dist/app/memory-store.d.ts +7 -0
- package/dist/app/memory-store.js +55 -0
- package/dist/app/node.d.ts +34 -6
- package/dist/app/node.js +387 -64
- package/dist/app/paid-allowance.d.ts +325 -0
- package/dist/app/paid-allowance.js +1290 -0
- package/dist/app/paid-approval.d.ts +122 -0
- package/dist/app/paid-approval.js +379 -0
- package/dist/app/paid-journal.d.ts +51 -0
- package/dist/app/paid-journal.js +117 -0
- package/dist/app/paid-keys.d.ts +12 -0
- package/dist/app/paid-keys.js +20 -0
- package/dist/app/paid-operation.d.ts +821 -0
- package/dist/app/paid-operation.js +1720 -0
- package/dist/app/paid-reservation.d.ts +157 -0
- package/dist/app/paid-reservation.js +323 -0
- package/dist/app/paid-session.d.ts +147 -0
- package/dist/app/paid-session.js +578 -0
- package/dist/app/payer-queue.d.ts +11 -0
- package/dist/app/payer-queue.js +27 -0
- package/dist/app/policy-bootstrap.d.ts +342 -0
- package/dist/app/policy-bootstrap.js +365 -0
- package/dist/app/policy-operation.d.ts +47 -0
- package/dist/app/policy-operation.js +101 -0
- package/dist/app/ready-slot.d.ts +12 -0
- package/dist/app/ready-slot.js +5 -2
- package/dist/app/rotation-lock.d.ts +38 -0
- package/dist/app/rotation-lock.js +42 -0
- package/dist/app/session-decrypt.d.ts +135 -0
- package/dist/app/session-decrypt.js +335 -0
- package/dist/app/session-grants.d.ts +349 -0
- package/dist/app/session-grants.js +811 -0
- package/dist/app/signing-intents.d.ts +78 -0
- package/dist/app/signing-intents.js +95 -0
- package/dist/app/store-commit.d.ts +63 -0
- package/dist/app/store-commit.js +126 -0
- package/dist/app/store-errors.d.ts +8 -0
- package/dist/app/store-errors.js +11 -0
- package/dist/app/tasra-client.d.ts +2 -0
- package/dist/app/tasra-client.js +1 -1
- package/dist/app/wallet.js +4 -1
- package/dist/auth/holderProof.d.ts +3 -0
- package/dist/auth/holderProof.js +8 -7
- package/dist/auth/verifier.d.ts +4 -2
- package/dist/auth/verifier.js +5 -2
- package/dist/chain/abis/index.d.ts +6178 -4101
- package/dist/chain/abis/index.js +3 -0
- package/dist/chain/abis/keyRegistry.d.ts +256 -0
- package/dist/chain/abis/keyRegistry.js +333 -0
- package/dist/chain/abis/prepaidFaultOracle.d.ts +321 -0
- package/dist/chain/abis/prepaidFaultOracle.js +413 -0
- package/dist/chain/abis/settlement.d.ts +2203 -703
- package/dist/chain/abis/settlement.js +2685 -764
- package/dist/chain/allowance.d.ts +358 -0
- package/dist/chain/allowance.js +800 -0
- package/dist/chain/billing.d.ts +85 -0
- package/dist/chain/billing.js +197 -0
- package/dist/chain/chainId.d.ts +13 -0
- package/dist/chain/chainId.js +26 -0
- package/dist/chain/client.d.ts +15 -1
- package/dist/chain/client.js +57 -1
- package/dist/chain/commitmentRecovery.d.ts +51 -0
- package/dist/chain/commitmentRecovery.js +38 -0
- package/dist/chain/committeeClient.d.ts +17 -10
- package/dist/chain/committeeClient.js +64 -16
- package/dist/chain/committeeDraw.d.ts +12 -0
- package/dist/chain/committeeDraw.js +56 -0
- package/dist/chain/custodyHealth.d.ts +212 -0
- package/dist/chain/custodyHealth.js +365 -0
- package/dist/chain/deployments.js +2 -0
- package/dist/chain/events.js +2 -0
- package/dist/chain/headFollower.d.ts +77 -0
- package/dist/chain/headFollower.js +219 -0
- package/dist/chain/headPrefetch.d.ts +23 -0
- package/dist/chain/headPrefetch.js +67 -0
- package/dist/chain/index.d.ts +50 -8
- package/dist/chain/index.js +28 -3
- package/dist/chain/keeperExecution.d.ts +44 -0
- package/dist/chain/keeperExecution.js +127 -0
- package/dist/chain/keeperRecovery.d.ts +78 -0
- package/dist/chain/keeperRecovery.js +91 -0
- package/dist/chain/node.d.ts +24 -1
- package/dist/chain/node.js +88 -43
- package/dist/chain/offchain.d.ts +2 -0
- package/dist/chain/paidAgentTransport.d.ts +38 -0
- package/dist/chain/paidAgentTransport.js +1 -0
- package/dist/chain/paidEpoch.d.ts +66 -0
- package/dist/chain/paidEpoch.js +139 -0
- package/dist/chain/paidPacing.d.ts +81 -0
- package/dist/chain/paidPacing.js +136 -0
- package/dist/chain/pinnedReads.d.ts +49 -0
- package/dist/chain/pinnedReads.js +218 -0
- package/dist/chain/prepaid.d.ts +383 -0
- package/dist/chain/prepaid.js +1046 -0
- package/dist/chain/prepaidEscape.d.ts +274 -0
- package/dist/chain/prepaidEscape.js +432 -0
- package/dist/chain/prepaidFault.d.ts +94 -0
- package/dist/chain/prepaidFault.js +148 -0
- package/dist/chain/receipt.d.ts +24 -0
- package/dist/chain/receipt.js +82 -0
- package/dist/chain/registeredAgent.d.ts +68 -3
- package/dist/chain/registeredAgent.js +143 -42
- package/dist/chain/registeredOperation.d.ts +10 -1
- package/dist/chain/registeredOperation.js +18 -3
- package/dist/chain/registeredPaidAgent.d.ts +254 -0
- package/dist/chain/registeredPaidAgent.js +889 -0
- package/dist/chain/registeredRelay.d.ts +31 -1
- package/dist/chain/registeredRelay.js +164 -43
- package/dist/chain/relayVoucher.d.ts +64 -0
- package/dist/chain/relayVoucher.js +69 -0
- package/dist/chain/reservation.d.ts +239 -0
- package/dist/chain/reservation.js +746 -0
- package/dist/chain/reshareRoster.d.ts +64 -0
- package/dist/chain/reshareRoster.js +85 -0
- package/dist/chain/revertReason.d.ts +8 -0
- package/dist/chain/revertReason.js +2 -1
- package/dist/chain/rotationLock.d.ts +130 -0
- package/dist/chain/rotationLock.js +168 -0
- package/dist/chain/serviceRequestPolicy.d.ts +47 -0
- package/dist/chain/serviceRequestPolicy.js +86 -0
- package/dist/chain/services.d.ts +7 -0
- package/dist/chain/services.js +44 -4
- package/dist/chain/slotClient.js +11 -2
- package/dist/chain/slotHandoff.d.ts +81 -0
- package/dist/chain/slotHandoff.js +166 -0
- package/dist/chain/slotSeed.d.ts +47 -5
- package/dist/chain/slotSeed.js +173 -42
- package/dist/chain/verifierSnapshot.d.ts +36 -0
- package/dist/chain/verifierSnapshot.js +197 -0
- package/dist/chain/write.d.ts +111 -21
- package/dist/chain/write.js +378 -146
- package/dist/committee/blsSharing.d.ts +53 -0
- package/dist/committee/blsSharing.js +90 -0
- package/dist/committee/client.d.ts +62 -23
- package/dist/committee/client.js +288 -72
- package/dist/committee/dual-operation.d.ts +165 -0
- package/dist/committee/dual-operation.js +229 -0
- package/dist/committee/dual-sign.d.ts +26 -1
- package/dist/committee/dual-sign.js +85 -7
- package/dist/committee/ecdsa.d.ts +38 -0
- package/dist/committee/ecdsa.js +87 -15
- package/dist/committee/evidence.d.ts +30 -0
- package/dist/committee/evidence.js +65 -0
- package/dist/committee/execution.d.ts +414 -0
- package/dist/committee/execution.js +446 -0
- package/dist/committee/extraction.js +33 -26
- package/dist/committee/index.d.ts +30 -7
- package/dist/committee/index.js +18 -6
- package/dist/committee/keeperExecution.d.ts +37 -0
- package/dist/committee/keeperExecution.js +141 -0
- package/dist/committee/oauth.d.ts +14 -4
- package/dist/committee/oauth.js +17 -5
- package/dist/committee/payment.d.ts +369 -0
- package/dist/committee/payment.js +339 -0
- package/dist/committee/recovery.d.ts +136 -0
- package/dist/committee/recovery.js +204 -0
- package/dist/committee/recoveryJson.d.ts +2 -0
- package/dist/committee/recoveryJson.js +87 -0
- package/dist/committee/request.d.ts +63 -27
- package/dist/committee/request.js +77 -66
- package/dist/committee/session-grant.d.ts +320 -0
- package/dist/committee/session-grant.js +397 -0
- package/dist/committee/status-refresh.d.ts +257 -0
- package/dist/committee/status-refresh.js +619 -0
- package/dist/committee/token.d.ts +163 -15
- package/dist/committee/token.js +247 -10
- package/dist/crypto/bn254.d.ts +70 -0
- package/dist/crypto/bn254.js +222 -0
- package/dist/crypto/ibe.d.ts +32 -0
- package/dist/crypto/ibe.js +56 -8
- package/dist/crypto/index.d.ts +1 -1
- package/dist/crypto/index.js +1 -1
- package/dist/crypto/kem.d.ts +31 -0
- package/dist/crypto/kem.js +113 -7
- package/dist/crypto/recipient.d.ts +75 -0
- package/dist/crypto/recipient.js +107 -0
- package/dist/decryption/client.d.ts +10 -16
- package/dist/decryption/client.js +8 -76
- package/dist/decryption/index.d.ts +2 -0
- package/dist/decryption/index.js +2 -0
- package/dist/decryption/sealed.d.ts +72 -0
- package/dist/decryption/sealed.js +147 -0
- package/dist/decryption/session.d.ts +115 -0
- package/dist/decryption/session.js +358 -0
- package/dist/errors.d.ts +406 -1
- package/dist/errors.js +400 -5
- package/dist/index.d.ts +9 -2
- package/dist/index.js +6 -1
- package/dist/internal/bounded.d.ts +66 -0
- package/dist/internal/bounded.js +126 -0
- package/dist/internal/network.d.ts +4 -0
- package/dist/internal/network.js +40 -0
- package/dist/internal/retryAfter.d.ts +8 -0
- package/dist/internal/retryAfter.js +28 -0
- package/dist/internal/sleep.d.ts +6 -0
- package/dist/internal/sleep.js +15 -0
- package/dist/internal/typedData.d.ts +13 -0
- package/dist/internal/typedData.js +77 -0
- package/dist/internal/viemErrors.d.ts +26 -0
- package/dist/internal/viemErrors.js +49 -0
- package/dist/oid4vp/binding.d.ts +27 -1
- package/dist/oid4vp/binding.js +36 -1
- package/dist/oid4vp/jose.d.ts +4 -2
- package/dist/oid4vp/jose.js +39 -7
- package/dist/oid4vp/request-object.d.ts +61 -4
- package/dist/oid4vp/request-object.js +140 -5
- package/dist/oid4vp/verifier-agent.d.ts +18 -8
- package/dist/oid4vp/verifier-agent.js +48 -6
- package/dist/oid4vp/wallet.d.ts +2 -4
- package/dist/oid4vp/wallet.js +1 -0
- package/dist/retry.d.ts +78 -0
- package/dist/retry.js +137 -0
- package/dist/signing/frost.d.ts +1 -1
- package/dist/verifier-agent/index.d.ts +41 -5
- package/dist/verifier-agent/index.js +124 -9
- package/dist/verifier-agent/payment.d.ts +7 -0
- package/dist/verifier-agent/payment.js +17 -0
- package/docs/api.md +8 -2
- package/docs/application-api.md +25 -2
- package/docs/chain.md +155 -9
- package/docs/consumer-migrations.md +61 -0
- package/docs/encrypted-notes.md +3 -2
- package/docs/encryption.md +4 -2
- package/docs/errors.md +14 -1
- package/docs/flows.md +2 -2
- package/docs/funding.md +902 -0
- package/docs/native-approvals.md +63 -0
- package/docs/reference/README.md +9 -8
- package/docs/reference/app-browser.md +232 -0
- package/docs/reference/app-node.md +38 -8
- package/docs/reference/app.md +4621 -805
- package/docs/reference/chain-node.md +74 -16
- package/docs/reference/chain.md +6740 -1592
- package/docs/reference/committee.md +5630 -987
- package/docs/reference/main.md +1439 -140
- package/docs/reference/oid4vp.md +297 -144
- package/docs/reference/verifier-agent.md +77 -35
- package/docs/signing.md +6 -0
- package/examples/encrypted-notes.ts +21 -6
- package/examples/getting-started.ts +2 -7
- package/examples/live-config.ts +24 -17
- package/package.json +17 -5
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { type Account, type Address, type Chain, type Hex, type Log, type PublicClient, type Transport, type WalletClient } from 'viem';
|
|
2
|
+
import { PrepaidEscapeError } from '../errors.js';
|
|
3
|
+
/** Most requests one `escapePrepaid` transaction may name (the contract's `MAX_ESCAPE_PER_CALL`). */
|
|
4
|
+
export declare const MAX_ESCAPE_PER_CALL = 64;
|
|
5
|
+
/** Most requests one client call accepts; they are sent as sequential transactions of at most 64. */
|
|
6
|
+
export declare const MAX_ESCAPE_REQUESTS = 1024;
|
|
7
|
+
/** Chain and Settlement proxy, independently approved by the application. */
|
|
8
|
+
export interface PrepaidEscapeDeployment {
|
|
9
|
+
/** Expected EVM chain ID. */
|
|
10
|
+
chainId: number;
|
|
11
|
+
/** Expected Settlement proxy. */
|
|
12
|
+
settlement: Address;
|
|
13
|
+
}
|
|
14
|
+
/** Escape status of one request, read at one canonical block. */
|
|
15
|
+
export type PrepaidEscapeRequestState = {
|
|
16
|
+
/** Request identifier. */
|
|
17
|
+
requestId: Hex;
|
|
18
|
+
/** No reservation exists (`prepaidCost == 0`). */
|
|
19
|
+
status: 'notReserved';
|
|
20
|
+
} | {
|
|
21
|
+
/** Request identifier. */
|
|
22
|
+
requestId: Hex;
|
|
23
|
+
/** Already complete: reconciled, paid out or escaped. Final. */
|
|
24
|
+
status: 'settled';
|
|
25
|
+
/** When the request was escaped; absent when it was reconciled or paid out instead. */
|
|
26
|
+
escapedAt?: Date;
|
|
27
|
+
} | {
|
|
28
|
+
/** Request identifier. */
|
|
29
|
+
requestId: Hex;
|
|
30
|
+
/** Reserved and open, but the deployment's escape delay is zero (not enabled). */
|
|
31
|
+
status: 'disabled';
|
|
32
|
+
} | {
|
|
33
|
+
/** Request identifier. */
|
|
34
|
+
requestId: Hex;
|
|
35
|
+
/** Reserved and open; the escape opens later. */
|
|
36
|
+
status: 'notOpen';
|
|
37
|
+
/** Chain time at which the escape opens. */
|
|
38
|
+
opensAt: Date;
|
|
39
|
+
} | {
|
|
40
|
+
/** Request identifier. */
|
|
41
|
+
requestId: Hex;
|
|
42
|
+
/** Escapable now (chain time at the observed block is at or past `opensAt`). */
|
|
43
|
+
status: 'open';
|
|
44
|
+
/** Chain time at which the escape opened. */
|
|
45
|
+
opensAt: Date;
|
|
46
|
+
};
|
|
47
|
+
/** One status of `PrepaidEscapeRequestState`. */
|
|
48
|
+
export type PrepaidEscapeStatus = PrepaidEscapeRequestState['status'];
|
|
49
|
+
/** Every requested status, read at one fresh canonical block. */
|
|
50
|
+
export interface PrepaidEscapeObservation {
|
|
51
|
+
/** Canonical block number. */
|
|
52
|
+
blockNumber: bigint;
|
|
53
|
+
/** Block hash every value was read at (EIP-1898, requireCanonical). */
|
|
54
|
+
blockHash: Hex;
|
|
55
|
+
/** Block timestamp in Unix seconds; `open` is judged against it, like the contract. */
|
|
56
|
+
blockTimestamp: bigint;
|
|
57
|
+
/** Governed escape delay in seconds; 0 means the escape is disabled. Read live, never snapshotted. */
|
|
58
|
+
escapeDelaySeconds: bigint;
|
|
59
|
+
/** Slot identifier. */
|
|
60
|
+
slotId: Hex;
|
|
61
|
+
/** Per request, in the caller's order. */
|
|
62
|
+
requests: PrepaidEscapeRequestState[];
|
|
63
|
+
}
|
|
64
|
+
/** Immutable identity of one escape transaction, retained before any broadcast; JSON serializable. */
|
|
65
|
+
export interface PrepaidEscapeRecord {
|
|
66
|
+
/** Record format. */
|
|
67
|
+
schema: 1;
|
|
68
|
+
/** Local journal key derived from chain, Settlement, slot and the exact ordered request list. */
|
|
69
|
+
escapeId: Hex;
|
|
70
|
+
/** Slot identifier. */
|
|
71
|
+
slotId: Hex;
|
|
72
|
+
/** Exact ordered requests of this call (at most 64). */
|
|
73
|
+
requestIds: Hex[];
|
|
74
|
+
/** Exact bounded legacy transaction; decimal strings preserve integer precision in storage. */
|
|
75
|
+
transaction: {
|
|
76
|
+
chainId: number;
|
|
77
|
+
from: Address;
|
|
78
|
+
to: Address;
|
|
79
|
+
data: Hex;
|
|
80
|
+
value: '0';
|
|
81
|
+
nonce: number;
|
|
82
|
+
gas: string;
|
|
83
|
+
gasPrice: string;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/** Durable write checkpoints of one escape call. After `prepared`, only reading reconciles it. */
|
|
87
|
+
export type PrepaidEscapeCheckpoint = {
|
|
88
|
+
/** Persisted before any submission. Create exclusively by `record.escapeId`. */
|
|
89
|
+
phase: 'prepared';
|
|
90
|
+
/** Exact call and transaction identity. */
|
|
91
|
+
record: PrepaidEscapeRecord;
|
|
92
|
+
/** Hash of a locally signed transaction, journaled before broadcast; absent for a JSON-RPC signer. */
|
|
93
|
+
transactionHash?: Hex;
|
|
94
|
+
} | {
|
|
95
|
+
/** A transaction hash was returned; mining is unproven. */
|
|
96
|
+
phase: 'submitted';
|
|
97
|
+
/** Key of the existing durable preparation. */
|
|
98
|
+
escapeId: Hex;
|
|
99
|
+
/** Returned transaction hash. */
|
|
100
|
+
transactionHash: Hex;
|
|
101
|
+
} | {
|
|
102
|
+
/** The transaction mined successfully and its events matched the call. */
|
|
103
|
+
phase: 'confirmed';
|
|
104
|
+
/** Key of the existing durable preparation. */
|
|
105
|
+
escapeId: Hex;
|
|
106
|
+
/** Verified transaction hash. */
|
|
107
|
+
transactionHash: Hex;
|
|
108
|
+
/** Canonical block containing it. */
|
|
109
|
+
blockHash: Hex;
|
|
110
|
+
/** TASRA base units returned to the slot, as a decimal string. */
|
|
111
|
+
refunded: string;
|
|
112
|
+
};
|
|
113
|
+
/** Arguments of {@link PrepaidEscapeClient.escapePrepaid}. */
|
|
114
|
+
export interface EscapePrepaidArgs {
|
|
115
|
+
/** Slot whose reservations are escaped; the refund always returns to this slot's balance. */
|
|
116
|
+
slotId: Hex;
|
|
117
|
+
/** Requests to escape (1..1024, distinct); every one must be `open`. */
|
|
118
|
+
requestIds: readonly Hex[];
|
|
119
|
+
/** Account- and chain-bound gas payer (any account: the escape is permissionless). */
|
|
120
|
+
signer: WalletClient<Transport, Chain, Account>;
|
|
121
|
+
/** Maximum gas units per transaction. */
|
|
122
|
+
maxGas: bigint;
|
|
123
|
+
/** Maximum legacy gas price in wei. */
|
|
124
|
+
maxGasPrice: bigint;
|
|
125
|
+
/**
|
|
126
|
+
* Await durable storage before resolving. `prepared` MUST atomically create a unique record keyed
|
|
127
|
+
* by `escapeId`, refuse an existing one, and survive process loss; later checkpoints update it.
|
|
128
|
+
* A failure before `prepared` completes prevents that call's broadcast.
|
|
129
|
+
*/
|
|
130
|
+
persist: (checkpoint: PrepaidEscapeCheckpoint) => Promise<void>;
|
|
131
|
+
/** Required confirmations, 1..64 (default 1). */
|
|
132
|
+
confirmations?: number;
|
|
133
|
+
/** Receipt wait per transaction, 1..120000 ms (default 60000). */
|
|
134
|
+
receiptTimeoutMs?: number;
|
|
135
|
+
/** Cancellation: before a call's `prepared` checkpoint nothing is sent; after it, only the wait ends (uncertain). */
|
|
136
|
+
signal?: AbortSignal;
|
|
137
|
+
}
|
|
138
|
+
/** One confirmed escape transaction. */
|
|
139
|
+
export interface PrepaidEscapeCallResult {
|
|
140
|
+
/** Local journal key. */
|
|
141
|
+
escapeId: Hex;
|
|
142
|
+
/** Requests escaped by this transaction, in order. */
|
|
143
|
+
requestIds: Hex[];
|
|
144
|
+
/** Transaction hash. */
|
|
145
|
+
transactionHash: Hex;
|
|
146
|
+
/** Inclusion block number. */
|
|
147
|
+
blockNumber: bigint;
|
|
148
|
+
/** Inclusion block hash. */
|
|
149
|
+
blockHash: Hex;
|
|
150
|
+
/** Total TASRA base units returned to the slot (`PrepaidBatchEscaped.refunded`). */
|
|
151
|
+
refunded: bigint;
|
|
152
|
+
/** Per request, from `PrepaidEscaped`. */
|
|
153
|
+
refunds: {
|
|
154
|
+
requestId: Hex;
|
|
155
|
+
refunded: bigint;
|
|
156
|
+
}[];
|
|
157
|
+
}
|
|
158
|
+
/** Result of a fully confirmed escape. */
|
|
159
|
+
export interface PrepaidEscapeResult {
|
|
160
|
+
/** Slot identifier. */
|
|
161
|
+
slotId: Hex;
|
|
162
|
+
/** Total TASRA base units returned to the slot balance (not withdrawn to the payer). */
|
|
163
|
+
refunded: bigint;
|
|
164
|
+
/** One entry per transaction, in order. */
|
|
165
|
+
calls: PrepaidEscapeCallResult[];
|
|
166
|
+
}
|
|
167
|
+
/** Arguments of {@link PrepaidEscapeClient.reconcileEscape}. */
|
|
168
|
+
export interface ReconcileEscapeArgs {
|
|
169
|
+
/** The prepared record, never a rebuilt one. */
|
|
170
|
+
record: PrepaidEscapeRecord;
|
|
171
|
+
/** Journaled or returned hash, when one is known. */
|
|
172
|
+
transactionHash?: Hex;
|
|
173
|
+
/** Required depth for a conclusion, 1..64 (default 1). */
|
|
174
|
+
confirmations?: number;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Outcome of one escape call, read without sending anything.
|
|
178
|
+
* - `escaped`: this transaction mined successfully at the required depth and escaped every request.
|
|
179
|
+
* - `completed`: every request is now complete (escaped by anyone, or reconciled), but this
|
|
180
|
+
* transaction's success is not shown. Nothing is left to do for this call.
|
|
181
|
+
* - `reverted`: this transaction mined and reverted; it refunded nothing.
|
|
182
|
+
* - `not-escaped`: the payer's nonce is consumed by another or failed transaction and some request
|
|
183
|
+
* is still open; this call can no longer mine. A new attempt (after a fresh preflight) is safe.
|
|
184
|
+
* - `uncertain`: the transaction may still mine. Do not resend; read again later.
|
|
185
|
+
*/
|
|
186
|
+
export interface PrepaidEscapeResolution {
|
|
187
|
+
/** Outcome. */
|
|
188
|
+
state: 'escaped' | 'completed' | 'reverted' | 'not-escaped' | 'uncertain';
|
|
189
|
+
/** Local journal key. */
|
|
190
|
+
escapeId: Hex;
|
|
191
|
+
/** Block every value was read at (head minus confirmations - 1). */
|
|
192
|
+
blockNumber: bigint;
|
|
193
|
+
/** Hash of that block. */
|
|
194
|
+
blockHash: Hex;
|
|
195
|
+
/** Per request, in record order. */
|
|
196
|
+
requests: {
|
|
197
|
+
requestId: Hex;
|
|
198
|
+
settled: boolean;
|
|
199
|
+
escapedAt?: Date;
|
|
200
|
+
}[];
|
|
201
|
+
/** The checked transaction, when a hash was supplied. */
|
|
202
|
+
transactionHash?: Hex;
|
|
203
|
+
/** TASRA returned by this transaction (`escaped` only). */
|
|
204
|
+
refunded?: bigint;
|
|
205
|
+
}
|
|
206
|
+
/** Decoded escape events from one receipt or log window. */
|
|
207
|
+
export interface PrepaidEscapeEvents {
|
|
208
|
+
/** `PrepaidEscaped`, one per request. */
|
|
209
|
+
escaped: {
|
|
210
|
+
slotId: Hex;
|
|
211
|
+
requestId: Hex;
|
|
212
|
+
refunded: bigint;
|
|
213
|
+
}[];
|
|
214
|
+
/** `PrepaidBatchEscaped`, one per call. */
|
|
215
|
+
batches: {
|
|
216
|
+
slotId: Hex;
|
|
217
|
+
caller: Address;
|
|
218
|
+
refunded: bigint;
|
|
219
|
+
requestCount: bigint;
|
|
220
|
+
}[];
|
|
221
|
+
}
|
|
222
|
+
/** Payer-side escape client bound to one deployment. */
|
|
223
|
+
export interface PrepaidEscapeClient {
|
|
224
|
+
/**
|
|
225
|
+
* Read each request's escape status at one fresh canonical block. Sends nothing.
|
|
226
|
+
* @param args Slot and requests (1..1024, distinct).
|
|
227
|
+
*/
|
|
228
|
+
escapableAt(args: {
|
|
229
|
+
slotId: Hex;
|
|
230
|
+
requestIds: readonly Hex[];
|
|
231
|
+
}): Promise<PrepaidEscapeObservation>;
|
|
232
|
+
/**
|
|
233
|
+
* Escape reserved requests whose timeout has opened. Refuses locally with
|
|
234
|
+
* {@link PrepaidEscapeError} unless every request is `open`; then for each chunk of at most 64:
|
|
235
|
+
* simulate, journal `prepared`, broadcast once, journal `submitted`, wait, verify the events,
|
|
236
|
+
* journal `confirmed`. A failure after `prepared` is {@link PrepaidEscapeUncertainError}.
|
|
237
|
+
* @param args Requests, signer, gas budget and mandatory durable journal.
|
|
238
|
+
*/
|
|
239
|
+
escapePrepaid(args: EscapePrepaidArgs): Promise<PrepaidEscapeResult>;
|
|
240
|
+
/**
|
|
241
|
+
* Resolve a journaled escape call by reading `prepaidEscapedAt`, `prepaidSettled`, the receipt and
|
|
242
|
+
* the payer nonce. Never sends.
|
|
243
|
+
* @param args The prepared record, a known hash and the confirmation depth.
|
|
244
|
+
*/
|
|
245
|
+
reconcileEscape(args: ReconcileEscapeArgs): Promise<PrepaidEscapeResolution>;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Local journal key of one escape call: keccak256 of a fixed label, chain ID, Settlement, slot and
|
|
249
|
+
* the exact ordered request list. Not a wire or on-chain format.
|
|
250
|
+
* @param deployment Approved chain and Settlement.
|
|
251
|
+
* @param slotId Slot identifier.
|
|
252
|
+
* @param requestIds Exact ordered requests of the call.
|
|
253
|
+
*/
|
|
254
|
+
export declare function prepaidEscapeId(deployment: PrepaidEscapeDeployment, slotId: Hex, requestIds: readonly Hex[]): Hex;
|
|
255
|
+
/**
|
|
256
|
+
* Map a Settlement escape revert anywhere in an error's cause chain to a typed
|
|
257
|
+
* {@link PrepaidEscapeError} (`local: false`); `undefined` for any other failure.
|
|
258
|
+
* @param error RPC or viem error from a simulation, gas estimate or relayed call.
|
|
259
|
+
*/
|
|
260
|
+
export declare function decodePrepaidEscapeRevert(error: unknown): PrepaidEscapeError | undefined;
|
|
261
|
+
/**
|
|
262
|
+
* Decode `PrepaidEscaped` and `PrepaidBatchEscaped` from logs emitted by one Settlement. Logs from
|
|
263
|
+
* any other address, and other events, are skipped; a removed (reorganized) log is refused.
|
|
264
|
+
* @param logs Receipt logs or a bounded `eth_getLogs` window.
|
|
265
|
+
* @param settlement Approved Settlement proxy.
|
|
266
|
+
*/
|
|
267
|
+
export declare function decodePrepaidEscapeLogs(logs: readonly Log[], settlement: Address): PrepaidEscapeEvents;
|
|
268
|
+
/**
|
|
269
|
+
* Bind the payer-side prepaid timeout-escape client to one approved deployment.
|
|
270
|
+
* Exposes no governance action: the escape delay is set only by the Settlement owner (timelock).
|
|
271
|
+
* @param client Trusted bounded public RPC client with canonical EIP-1898 reads; use retryCount: 0.
|
|
272
|
+
* @param deployment Independently approved chain ID and Settlement proxy.
|
|
273
|
+
*/
|
|
274
|
+
export declare function createPrepaidEscapeClient(client: PublicClient, deployment: PrepaidEscapeDeployment): PrepaidEscapeClient;
|