@quaivault/sdk 0.2.0 → 0.2.1
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 +37 -3
- package/dist/index.cjs +107 -59
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +81 -4
- package/dist/index.d.ts +81 -4
- package/dist/index.js +107 -59
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -63,6 +63,34 @@ interface NetworkConfig {
|
|
|
63
63
|
* is removed (approval epochs), so they must never gate a signature.
|
|
64
64
|
*/
|
|
65
65
|
type Consistency = 'auto' | 'indexed' | 'chain';
|
|
66
|
+
/**
|
|
67
|
+
* Source of "now", in Unix **seconds**, for decisions compared against chain time.
|
|
68
|
+
*
|
|
69
|
+
* The contracts decide with `block.timestamp`. Everything the SDK derives locally —
|
|
70
|
+
* a transaction's `ready` vs `timelocked`, what a caller may do next, whether a
|
|
71
|
+
* recovery period has elapsed — is a *prediction* of that, and a machine whose clock is
|
|
72
|
+
* wrong predicts wrongly. Containers, CI runners and VMs resumed from a snapshot drift
|
|
73
|
+
* in ways a desktop usually does not.
|
|
74
|
+
*
|
|
75
|
+
* Supplying a clock lets a consumer that has measured the offset feed it back in:
|
|
76
|
+
*
|
|
77
|
+
* ```ts
|
|
78
|
+
* const skew = localSeconds - blockTimestamp; // positive: local clock is ahead
|
|
79
|
+
* connect({ now: () => Date.now() / 1000 - skew });
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* A function rather than a scalar offset on purpose. An offset needs a sign convention,
|
|
83
|
+
* and getting it backwards doubles the error instead of cancelling it — silently. Here
|
|
84
|
+
* the arithmetic sits in the caller's own code, where it reads as what it means.
|
|
85
|
+
*
|
|
86
|
+
* This never affects elapsed-time measurement (retry backoff, timeouts, poll
|
|
87
|
+
* intervals). Those are durations: if the clock is 12 seconds fast, 30 seconds is still
|
|
88
|
+
* 30 seconds.
|
|
89
|
+
*
|
|
90
|
+
* Detection is deliberately not the SDK's job — it would mean an RPC call on behalf of
|
|
91
|
+
* a consumer who may not want one, and a cached value with no clear invalidation.
|
|
92
|
+
*/
|
|
93
|
+
type Clock = () => number;
|
|
66
94
|
interface ClientOptions {
|
|
67
95
|
network?: NetworkConfig | NetworkName;
|
|
68
96
|
provider?: Provider;
|
|
@@ -77,6 +105,11 @@ interface ClientOptions {
|
|
|
77
105
|
maxIndexerLagBlocks?: number;
|
|
78
106
|
/** Read env vars for anything not passed explicitly. Default true. */
|
|
79
107
|
useEnv?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Source of "now" for time compared against chain timestamps. See {@link Clock}.
|
|
110
|
+
* Defaults to the local clock.
|
|
111
|
+
*/
|
|
112
|
+
now?: Clock;
|
|
80
113
|
/**
|
|
81
114
|
* Retry policy for transient RPC and indexer failures. Applies to reads only —
|
|
82
115
|
* writes are never retried, since a resubmit risks a double broadcast.
|
|
@@ -401,6 +434,11 @@ interface ResolvedConfig {
|
|
|
401
434
|
consistency: Consistency;
|
|
402
435
|
maxIndexerLagBlocks: number;
|
|
403
436
|
retry: RetryOptions;
|
|
437
|
+
/**
|
|
438
|
+
* Resolved source of "now" in Unix seconds. Always set — falls back to the local
|
|
439
|
+
* clock — so consumers never branch on its presence.
|
|
440
|
+
*/
|
|
441
|
+
now: Clock;
|
|
404
442
|
}
|
|
405
443
|
/** A `ResolvedConfig` with the private key removed. Safe to log. */
|
|
406
444
|
type PublicConfig = Omit<ResolvedConfig, 'privateKey'> & {
|
|
@@ -606,7 +644,12 @@ declare class IndexerClient {
|
|
|
606
644
|
private realtime;
|
|
607
645
|
private healthCache;
|
|
608
646
|
private inflightHealth;
|
|
609
|
-
/**
|
|
647
|
+
/**
|
|
648
|
+
* Health results are reused for this long to keep read paths cheap.
|
|
649
|
+
*
|
|
650
|
+
* This and `waitForBlock`'s deadline are elapsed-time arithmetic, so they use the
|
|
651
|
+
* raw local clock rather than `ClientOptions.now` — see the note in `chain/retry.ts`.
|
|
652
|
+
*/
|
|
610
653
|
readonly healthCacheMs: number;
|
|
611
654
|
constructor(config: IndexerConfig, options?: {
|
|
612
655
|
healthCacheMs?: number;
|
|
@@ -1281,6 +1324,8 @@ interface RecoveryModuleContext {
|
|
|
1281
1324
|
queries: IndexerQueries | null;
|
|
1282
1325
|
vaultAddress: Address;
|
|
1283
1326
|
moduleAddress: Address | undefined;
|
|
1327
|
+
/** Source of "now" for comparisons against chain timestamps. See {@link Clock}. */
|
|
1328
|
+
now?: Clock;
|
|
1284
1329
|
}
|
|
1285
1330
|
/**
|
|
1286
1331
|
* Guardian-based recovery for one vault.
|
|
@@ -1304,6 +1349,8 @@ declare class RecoveryModule {
|
|
|
1304
1349
|
* them gates a write, so none of them should be the one read that silently skips
|
|
1305
1350
|
* transient-failure handling.
|
|
1306
1351
|
*/
|
|
1352
|
+
/** Now, in Unix seconds, for anything compared against a chain timestamp. */
|
|
1353
|
+
private now;
|
|
1307
1354
|
private vaultContract;
|
|
1308
1355
|
/** Whether the module is currently enabled on the vault. */
|
|
1309
1356
|
isEnabled(): Promise<boolean>;
|
|
@@ -1374,7 +1421,7 @@ declare class RecoveryModule {
|
|
|
1374
1421
|
chainTxHash: Hex;
|
|
1375
1422
|
}>;
|
|
1376
1423
|
/** What `caller` may do to a recovery right now, and when blocked actions unlock. */
|
|
1377
|
-
affordances(recoveryHash: Bytes32, caller?: Address): Promise<RecoveryAffordance[]>;
|
|
1424
|
+
affordances(recoveryHash: Bytes32, caller?: Address, at?: number): Promise<RecoveryAffordance[]>;
|
|
1378
1425
|
private buildFromChain;
|
|
1379
1426
|
private validateNewOwners;
|
|
1380
1427
|
private assertLive;
|
|
@@ -1626,6 +1673,11 @@ interface VaultContext {
|
|
|
1626
1673
|
contracts: ContractAddresses;
|
|
1627
1674
|
consistency: Consistency;
|
|
1628
1675
|
maxIndexerLagBlocks: number;
|
|
1676
|
+
/**
|
|
1677
|
+
* Source of "now" for comparisons against chain timestamps. See {@link Clock}.
|
|
1678
|
+
* Optional so a hand-built context still works; defaults to the local clock.
|
|
1679
|
+
*/
|
|
1680
|
+
now?: Clock;
|
|
1629
1681
|
/** Set by {@link Vault.pinned}. Never consulted by a write precondition. */
|
|
1630
1682
|
view?: VaultView;
|
|
1631
1683
|
}
|
|
@@ -1678,6 +1730,13 @@ declare class Vault {
|
|
|
1678
1730
|
* genesis" rather than "unknown".
|
|
1679
1731
|
*/
|
|
1680
1732
|
private indexerHead;
|
|
1733
|
+
/**
|
|
1734
|
+
* Now, in Unix seconds, for anything compared against a chain timestamp.
|
|
1735
|
+
*
|
|
1736
|
+
* Never used to measure elapsed time — see the duration sites in
|
|
1737
|
+
* {@link waitForExecutable}, which stay on the raw local clock deliberately.
|
|
1738
|
+
*/
|
|
1739
|
+
private now;
|
|
1681
1740
|
private contract;
|
|
1682
1741
|
/** Owners, threshold, timelock floor, nonce and balance. Always read from chain. */
|
|
1683
1742
|
info(): Promise<VaultInfo>;
|
|
@@ -1717,6 +1776,19 @@ declare class Vault {
|
|
|
1717
1776
|
*/
|
|
1718
1777
|
private chainOwners;
|
|
1719
1778
|
isOwner(address: Address): Promise<boolean>;
|
|
1779
|
+
/**
|
|
1780
|
+
* Whether `owner`'s approval on `txHash` currently counts toward the threshold.
|
|
1781
|
+
*
|
|
1782
|
+
* Reads the chain, and accounts for approval-epoch invalidation: removing an owner
|
|
1783
|
+
* bumps the vault's epoch and voids every approval that address made, so a
|
|
1784
|
+
* confirmation the indexer still lists may already be dead. This is the authoritative
|
|
1785
|
+
* answer.
|
|
1786
|
+
*
|
|
1787
|
+
* Public because it is one of the two inputs {@link computeAffordances} needs. Without
|
|
1788
|
+
* it a consumer wanting affordances at an adjusted time had no way to assemble an
|
|
1789
|
+
* `AffordanceContext` short of reimplementing this method against the raw contract.
|
|
1790
|
+
*/
|
|
1791
|
+
hasApproved(txHash: Bytes32, owner: Address): Promise<boolean>;
|
|
1720
1792
|
/** Approvals required to execute. Prefers a pinned view, then the indexer, then chain. */
|
|
1721
1793
|
threshold(): Promise<number>;
|
|
1722
1794
|
/**
|
|
@@ -1778,7 +1850,7 @@ declare class Vault {
|
|
|
1778
1850
|
* What `caller` may legally do to `txHash` right now, and when blocked actions
|
|
1779
1851
|
* become available. Defaults to the connected signer's address.
|
|
1780
1852
|
*/
|
|
1781
|
-
affordances(txHash: Bytes32, caller?: Address): Promise<Affordance[]>;
|
|
1853
|
+
affordances(txHash: Bytes32, caller?: Address, at?: number): Promise<Affordance[]>;
|
|
1782
1854
|
/**
|
|
1783
1855
|
* Shared body of {@link affordances}, taking the transaction either as a value or as
|
|
1784
1856
|
* an in-flight promise.
|
|
@@ -2008,6 +2080,11 @@ declare class Vault {
|
|
|
2008
2080
|
* called, so building a client is cheap and safe at module scope.
|
|
2009
2081
|
*/
|
|
2010
2082
|
declare class QuaiVaultClient {
|
|
2083
|
+
/**
|
|
2084
|
+
* Source of "now" for time compared against chain timestamps. Resolved once from
|
|
2085
|
+
* {@link ClientOptions.now}, defaulting to the local clock. See {@link Clock}.
|
|
2086
|
+
*/
|
|
2087
|
+
readonly now: Clock;
|
|
2011
2088
|
/**
|
|
2012
2089
|
* Resolved configuration, with the private key stripped and the indexer key
|
|
2013
2090
|
* masked — safe to log. The key itself is consumed once when building the signer.
|
|
@@ -2586,4 +2663,4 @@ declare function knownErrorSelectors(): Array<{
|
|
|
2586
2663
|
signature: string;
|
|
2587
2664
|
}>;
|
|
2588
2665
|
|
|
2589
|
-
export { AbortError, type Address, type AddressCheck, type AddressLedger, type Affordance, type AffordanceBlocker, type AffordanceContext, type ApprovalRecord, type BalanceOptions, type BatchCall, type Bytes32, type ClientOptions, ConfigError, Connection, type Consistency, type ContractAddresses, type CreateProgress, type CreateVaultParams, type CreateVaultResult, DEFAULT_CONCURRENCY, DEFAULT_TEXT_LIMIT, type DecodeContext, type DecodeResult, type DecodedBatchCall, type DecodedCall, type DecodedRevert, type DryRunResult, ENV_VARS, type ExecuteOutcome, type ExecuteResult, Factory, type FactoryContext, FactoryContract, type Hex, IndexerClient, type IndexerConfig, type IndexerHealth, IndexerQueries, IndexerQueryError, MAX_EXECUTION_DELAY, MAX_MODULES, MAX_OWNERS, type MineSaltOptions, type MinedSalt, type MiningStrategy, type NetworkConfig, type NetworkName, NoIndexerError, NoSignerError, NotFoundError, Operation, type Page, type Pagination, PreconditionError, type ProposeOptions, type ProposeResult, QuaiVault, QuaiVaultClient, QuaiVaultError, type QuaiVaultErrorCode, type RawRecovery, type RawRecoveryConfig, type RawRecoveryState, type RawTransactionState, type RawTransactionStruct, type ReceiptLike, type RecoveryAction, type RecoveryAffordance, type RecoveryConfig, RecoveryContract, RecoveryModule, type RecoveryModuleContext, type RecoveryRequest, type RecoveryStatus, type ResolvedConfig, type RetryOptions, RevertError, SENTINEL_MODULES, SaltMiningError, StaleProposalError, type Subscription, type TokenBalance, TokenContract, type TransactionKind, type TransactionStatus, ValidationError, Vault, type VaultAction, type VaultBalances, type VaultContext, VaultContract, type VaultInfo, type VaultTransaction, type VaultView, type WatchEvent, type WatchOptions, type WatchTopic, type WorkerRuntime, ZERO_ADDRESS, allowedActions, assertQuaiAddress, assertQuaiAddresses, classifyExecution, computeAffordances, computeBytecodeHash, computeFullSalt, connect, createWorkerThreadsStrategy, decodeCall, decodeMultiSendPayload, decodeRevert, decodeRevertFromError, defaultStrategy, deriveRecoveryStatus, deriveStatus, encodeInitData, encodeMultiSend, encodeMultiSendPayload, executableAfterOf, extractProposedTxHash, schemas as indexerSchemas, inspectAddress, interfaces, isNetworkName, isTerminal, isTransient, isUsableQuaiAddress, knownErrorSelectors, loadBalances, mainnet, mapPooled, mineSalt, minimumExpiration, networks, nowSeconds, predictVaultAddress, recoveryCall, remediationFor, resolveConfig, sanitizeText, selfCall, shardPrefixOf, syncStrategy, testnet, token as tokenCalls, watchVault, withRetry, workerThreadsStrategy };
|
|
2666
|
+
export { AbortError, type Address, type AddressCheck, type AddressLedger, type Affordance, type AffordanceBlocker, type AffordanceContext, type ApprovalRecord, type BalanceOptions, type BatchCall, type Bytes32, type ClientOptions, type Clock, ConfigError, Connection, type Consistency, type ContractAddresses, type CreateProgress, type CreateVaultParams, type CreateVaultResult, DEFAULT_CONCURRENCY, DEFAULT_TEXT_LIMIT, type DecodeContext, type DecodeResult, type DecodedBatchCall, type DecodedCall, type DecodedRevert, type DryRunResult, ENV_VARS, type ExecuteOutcome, type ExecuteResult, Factory, type FactoryContext, FactoryContract, type Hex, IndexerClient, type IndexerConfig, type IndexerHealth, IndexerQueries, IndexerQueryError, MAX_EXECUTION_DELAY, MAX_MODULES, MAX_OWNERS, type MineSaltOptions, type MinedSalt, type MiningStrategy, type NetworkConfig, type NetworkName, NoIndexerError, NoSignerError, NotFoundError, Operation, type Page, type Pagination, PreconditionError, type ProposeOptions, type ProposeResult, QuaiVault, QuaiVaultClient, QuaiVaultError, type QuaiVaultErrorCode, type RawRecovery, type RawRecoveryConfig, type RawRecoveryState, type RawTransactionState, type RawTransactionStruct, type ReceiptLike, type RecoveryAction, type RecoveryAffordance, type RecoveryConfig, RecoveryContract, RecoveryModule, type RecoveryModuleContext, type RecoveryRequest, type RecoveryStatus, type ResolvedConfig, type RetryOptions, RevertError, SENTINEL_MODULES, SaltMiningError, StaleProposalError, type Subscription, type TokenBalance, TokenContract, type TransactionKind, type TransactionStatus, ValidationError, Vault, type VaultAction, type VaultBalances, type VaultContext, VaultContract, type VaultInfo, type VaultTransaction, type VaultView, type WatchEvent, type WatchOptions, type WatchTopic, type WorkerRuntime, ZERO_ADDRESS, allowedActions, assertQuaiAddress, assertQuaiAddresses, classifyExecution, computeAffordances, computeBytecodeHash, computeFullSalt, connect, createWorkerThreadsStrategy, decodeCall, decodeMultiSendPayload, decodeRevert, decodeRevertFromError, defaultStrategy, deriveRecoveryStatus, deriveStatus, encodeInitData, encodeMultiSend, encodeMultiSendPayload, executableAfterOf, extractProposedTxHash, schemas as indexerSchemas, inspectAddress, interfaces, isNetworkName, isTerminal, isTransient, isUsableQuaiAddress, knownErrorSelectors, loadBalances, mainnet, mapPooled, mineSalt, minimumExpiration, networks, nowSeconds, predictVaultAddress, recoveryCall, remediationFor, resolveConfig, sanitizeText, selfCall, shardPrefixOf, syncStrategy, testnet, token as tokenCalls, watchVault, withRetry, workerThreadsStrategy };
|
package/dist/index.d.ts
CHANGED
|
@@ -63,6 +63,34 @@ interface NetworkConfig {
|
|
|
63
63
|
* is removed (approval epochs), so they must never gate a signature.
|
|
64
64
|
*/
|
|
65
65
|
type Consistency = 'auto' | 'indexed' | 'chain';
|
|
66
|
+
/**
|
|
67
|
+
* Source of "now", in Unix **seconds**, for decisions compared against chain time.
|
|
68
|
+
*
|
|
69
|
+
* The contracts decide with `block.timestamp`. Everything the SDK derives locally —
|
|
70
|
+
* a transaction's `ready` vs `timelocked`, what a caller may do next, whether a
|
|
71
|
+
* recovery period has elapsed — is a *prediction* of that, and a machine whose clock is
|
|
72
|
+
* wrong predicts wrongly. Containers, CI runners and VMs resumed from a snapshot drift
|
|
73
|
+
* in ways a desktop usually does not.
|
|
74
|
+
*
|
|
75
|
+
* Supplying a clock lets a consumer that has measured the offset feed it back in:
|
|
76
|
+
*
|
|
77
|
+
* ```ts
|
|
78
|
+
* const skew = localSeconds - blockTimestamp; // positive: local clock is ahead
|
|
79
|
+
* connect({ now: () => Date.now() / 1000 - skew });
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* A function rather than a scalar offset on purpose. An offset needs a sign convention,
|
|
83
|
+
* and getting it backwards doubles the error instead of cancelling it — silently. Here
|
|
84
|
+
* the arithmetic sits in the caller's own code, where it reads as what it means.
|
|
85
|
+
*
|
|
86
|
+
* This never affects elapsed-time measurement (retry backoff, timeouts, poll
|
|
87
|
+
* intervals). Those are durations: if the clock is 12 seconds fast, 30 seconds is still
|
|
88
|
+
* 30 seconds.
|
|
89
|
+
*
|
|
90
|
+
* Detection is deliberately not the SDK's job — it would mean an RPC call on behalf of
|
|
91
|
+
* a consumer who may not want one, and a cached value with no clear invalidation.
|
|
92
|
+
*/
|
|
93
|
+
type Clock = () => number;
|
|
66
94
|
interface ClientOptions {
|
|
67
95
|
network?: NetworkConfig | NetworkName;
|
|
68
96
|
provider?: Provider;
|
|
@@ -77,6 +105,11 @@ interface ClientOptions {
|
|
|
77
105
|
maxIndexerLagBlocks?: number;
|
|
78
106
|
/** Read env vars for anything not passed explicitly. Default true. */
|
|
79
107
|
useEnv?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Source of "now" for time compared against chain timestamps. See {@link Clock}.
|
|
110
|
+
* Defaults to the local clock.
|
|
111
|
+
*/
|
|
112
|
+
now?: Clock;
|
|
80
113
|
/**
|
|
81
114
|
* Retry policy for transient RPC and indexer failures. Applies to reads only —
|
|
82
115
|
* writes are never retried, since a resubmit risks a double broadcast.
|
|
@@ -401,6 +434,11 @@ interface ResolvedConfig {
|
|
|
401
434
|
consistency: Consistency;
|
|
402
435
|
maxIndexerLagBlocks: number;
|
|
403
436
|
retry: RetryOptions;
|
|
437
|
+
/**
|
|
438
|
+
* Resolved source of "now" in Unix seconds. Always set — falls back to the local
|
|
439
|
+
* clock — so consumers never branch on its presence.
|
|
440
|
+
*/
|
|
441
|
+
now: Clock;
|
|
404
442
|
}
|
|
405
443
|
/** A `ResolvedConfig` with the private key removed. Safe to log. */
|
|
406
444
|
type PublicConfig = Omit<ResolvedConfig, 'privateKey'> & {
|
|
@@ -606,7 +644,12 @@ declare class IndexerClient {
|
|
|
606
644
|
private realtime;
|
|
607
645
|
private healthCache;
|
|
608
646
|
private inflightHealth;
|
|
609
|
-
/**
|
|
647
|
+
/**
|
|
648
|
+
* Health results are reused for this long to keep read paths cheap.
|
|
649
|
+
*
|
|
650
|
+
* This and `waitForBlock`'s deadline are elapsed-time arithmetic, so they use the
|
|
651
|
+
* raw local clock rather than `ClientOptions.now` — see the note in `chain/retry.ts`.
|
|
652
|
+
*/
|
|
610
653
|
readonly healthCacheMs: number;
|
|
611
654
|
constructor(config: IndexerConfig, options?: {
|
|
612
655
|
healthCacheMs?: number;
|
|
@@ -1281,6 +1324,8 @@ interface RecoveryModuleContext {
|
|
|
1281
1324
|
queries: IndexerQueries | null;
|
|
1282
1325
|
vaultAddress: Address;
|
|
1283
1326
|
moduleAddress: Address | undefined;
|
|
1327
|
+
/** Source of "now" for comparisons against chain timestamps. See {@link Clock}. */
|
|
1328
|
+
now?: Clock;
|
|
1284
1329
|
}
|
|
1285
1330
|
/**
|
|
1286
1331
|
* Guardian-based recovery for one vault.
|
|
@@ -1304,6 +1349,8 @@ declare class RecoveryModule {
|
|
|
1304
1349
|
* them gates a write, so none of them should be the one read that silently skips
|
|
1305
1350
|
* transient-failure handling.
|
|
1306
1351
|
*/
|
|
1352
|
+
/** Now, in Unix seconds, for anything compared against a chain timestamp. */
|
|
1353
|
+
private now;
|
|
1307
1354
|
private vaultContract;
|
|
1308
1355
|
/** Whether the module is currently enabled on the vault. */
|
|
1309
1356
|
isEnabled(): Promise<boolean>;
|
|
@@ -1374,7 +1421,7 @@ declare class RecoveryModule {
|
|
|
1374
1421
|
chainTxHash: Hex;
|
|
1375
1422
|
}>;
|
|
1376
1423
|
/** What `caller` may do to a recovery right now, and when blocked actions unlock. */
|
|
1377
|
-
affordances(recoveryHash: Bytes32, caller?: Address): Promise<RecoveryAffordance[]>;
|
|
1424
|
+
affordances(recoveryHash: Bytes32, caller?: Address, at?: number): Promise<RecoveryAffordance[]>;
|
|
1378
1425
|
private buildFromChain;
|
|
1379
1426
|
private validateNewOwners;
|
|
1380
1427
|
private assertLive;
|
|
@@ -1626,6 +1673,11 @@ interface VaultContext {
|
|
|
1626
1673
|
contracts: ContractAddresses;
|
|
1627
1674
|
consistency: Consistency;
|
|
1628
1675
|
maxIndexerLagBlocks: number;
|
|
1676
|
+
/**
|
|
1677
|
+
* Source of "now" for comparisons against chain timestamps. See {@link Clock}.
|
|
1678
|
+
* Optional so a hand-built context still works; defaults to the local clock.
|
|
1679
|
+
*/
|
|
1680
|
+
now?: Clock;
|
|
1629
1681
|
/** Set by {@link Vault.pinned}. Never consulted by a write precondition. */
|
|
1630
1682
|
view?: VaultView;
|
|
1631
1683
|
}
|
|
@@ -1678,6 +1730,13 @@ declare class Vault {
|
|
|
1678
1730
|
* genesis" rather than "unknown".
|
|
1679
1731
|
*/
|
|
1680
1732
|
private indexerHead;
|
|
1733
|
+
/**
|
|
1734
|
+
* Now, in Unix seconds, for anything compared against a chain timestamp.
|
|
1735
|
+
*
|
|
1736
|
+
* Never used to measure elapsed time — see the duration sites in
|
|
1737
|
+
* {@link waitForExecutable}, which stay on the raw local clock deliberately.
|
|
1738
|
+
*/
|
|
1739
|
+
private now;
|
|
1681
1740
|
private contract;
|
|
1682
1741
|
/** Owners, threshold, timelock floor, nonce and balance. Always read from chain. */
|
|
1683
1742
|
info(): Promise<VaultInfo>;
|
|
@@ -1717,6 +1776,19 @@ declare class Vault {
|
|
|
1717
1776
|
*/
|
|
1718
1777
|
private chainOwners;
|
|
1719
1778
|
isOwner(address: Address): Promise<boolean>;
|
|
1779
|
+
/**
|
|
1780
|
+
* Whether `owner`'s approval on `txHash` currently counts toward the threshold.
|
|
1781
|
+
*
|
|
1782
|
+
* Reads the chain, and accounts for approval-epoch invalidation: removing an owner
|
|
1783
|
+
* bumps the vault's epoch and voids every approval that address made, so a
|
|
1784
|
+
* confirmation the indexer still lists may already be dead. This is the authoritative
|
|
1785
|
+
* answer.
|
|
1786
|
+
*
|
|
1787
|
+
* Public because it is one of the two inputs {@link computeAffordances} needs. Without
|
|
1788
|
+
* it a consumer wanting affordances at an adjusted time had no way to assemble an
|
|
1789
|
+
* `AffordanceContext` short of reimplementing this method against the raw contract.
|
|
1790
|
+
*/
|
|
1791
|
+
hasApproved(txHash: Bytes32, owner: Address): Promise<boolean>;
|
|
1720
1792
|
/** Approvals required to execute. Prefers a pinned view, then the indexer, then chain. */
|
|
1721
1793
|
threshold(): Promise<number>;
|
|
1722
1794
|
/**
|
|
@@ -1778,7 +1850,7 @@ declare class Vault {
|
|
|
1778
1850
|
* What `caller` may legally do to `txHash` right now, and when blocked actions
|
|
1779
1851
|
* become available. Defaults to the connected signer's address.
|
|
1780
1852
|
*/
|
|
1781
|
-
affordances(txHash: Bytes32, caller?: Address): Promise<Affordance[]>;
|
|
1853
|
+
affordances(txHash: Bytes32, caller?: Address, at?: number): Promise<Affordance[]>;
|
|
1782
1854
|
/**
|
|
1783
1855
|
* Shared body of {@link affordances}, taking the transaction either as a value or as
|
|
1784
1856
|
* an in-flight promise.
|
|
@@ -2008,6 +2080,11 @@ declare class Vault {
|
|
|
2008
2080
|
* called, so building a client is cheap and safe at module scope.
|
|
2009
2081
|
*/
|
|
2010
2082
|
declare class QuaiVaultClient {
|
|
2083
|
+
/**
|
|
2084
|
+
* Source of "now" for time compared against chain timestamps. Resolved once from
|
|
2085
|
+
* {@link ClientOptions.now}, defaulting to the local clock. See {@link Clock}.
|
|
2086
|
+
*/
|
|
2087
|
+
readonly now: Clock;
|
|
2011
2088
|
/**
|
|
2012
2089
|
* Resolved configuration, with the private key stripped and the indexer key
|
|
2013
2090
|
* masked — safe to log. The key itself is consumed once when building the signer.
|
|
@@ -2586,4 +2663,4 @@ declare function knownErrorSelectors(): Array<{
|
|
|
2586
2663
|
signature: string;
|
|
2587
2664
|
}>;
|
|
2588
2665
|
|
|
2589
|
-
export { AbortError, type Address, type AddressCheck, type AddressLedger, type Affordance, type AffordanceBlocker, type AffordanceContext, type ApprovalRecord, type BalanceOptions, type BatchCall, type Bytes32, type ClientOptions, ConfigError, Connection, type Consistency, type ContractAddresses, type CreateProgress, type CreateVaultParams, type CreateVaultResult, DEFAULT_CONCURRENCY, DEFAULT_TEXT_LIMIT, type DecodeContext, type DecodeResult, type DecodedBatchCall, type DecodedCall, type DecodedRevert, type DryRunResult, ENV_VARS, type ExecuteOutcome, type ExecuteResult, Factory, type FactoryContext, FactoryContract, type Hex, IndexerClient, type IndexerConfig, type IndexerHealth, IndexerQueries, IndexerQueryError, MAX_EXECUTION_DELAY, MAX_MODULES, MAX_OWNERS, type MineSaltOptions, type MinedSalt, type MiningStrategy, type NetworkConfig, type NetworkName, NoIndexerError, NoSignerError, NotFoundError, Operation, type Page, type Pagination, PreconditionError, type ProposeOptions, type ProposeResult, QuaiVault, QuaiVaultClient, QuaiVaultError, type QuaiVaultErrorCode, type RawRecovery, type RawRecoveryConfig, type RawRecoveryState, type RawTransactionState, type RawTransactionStruct, type ReceiptLike, type RecoveryAction, type RecoveryAffordance, type RecoveryConfig, RecoveryContract, RecoveryModule, type RecoveryModuleContext, type RecoveryRequest, type RecoveryStatus, type ResolvedConfig, type RetryOptions, RevertError, SENTINEL_MODULES, SaltMiningError, StaleProposalError, type Subscription, type TokenBalance, TokenContract, type TransactionKind, type TransactionStatus, ValidationError, Vault, type VaultAction, type VaultBalances, type VaultContext, VaultContract, type VaultInfo, type VaultTransaction, type VaultView, type WatchEvent, type WatchOptions, type WatchTopic, type WorkerRuntime, ZERO_ADDRESS, allowedActions, assertQuaiAddress, assertQuaiAddresses, classifyExecution, computeAffordances, computeBytecodeHash, computeFullSalt, connect, createWorkerThreadsStrategy, decodeCall, decodeMultiSendPayload, decodeRevert, decodeRevertFromError, defaultStrategy, deriveRecoveryStatus, deriveStatus, encodeInitData, encodeMultiSend, encodeMultiSendPayload, executableAfterOf, extractProposedTxHash, schemas as indexerSchemas, inspectAddress, interfaces, isNetworkName, isTerminal, isTransient, isUsableQuaiAddress, knownErrorSelectors, loadBalances, mainnet, mapPooled, mineSalt, minimumExpiration, networks, nowSeconds, predictVaultAddress, recoveryCall, remediationFor, resolveConfig, sanitizeText, selfCall, shardPrefixOf, syncStrategy, testnet, token as tokenCalls, watchVault, withRetry, workerThreadsStrategy };
|
|
2666
|
+
export { AbortError, type Address, type AddressCheck, type AddressLedger, type Affordance, type AffordanceBlocker, type AffordanceContext, type ApprovalRecord, type BalanceOptions, type BatchCall, type Bytes32, type ClientOptions, type Clock, ConfigError, Connection, type Consistency, type ContractAddresses, type CreateProgress, type CreateVaultParams, type CreateVaultResult, DEFAULT_CONCURRENCY, DEFAULT_TEXT_LIMIT, type DecodeContext, type DecodeResult, type DecodedBatchCall, type DecodedCall, type DecodedRevert, type DryRunResult, ENV_VARS, type ExecuteOutcome, type ExecuteResult, Factory, type FactoryContext, FactoryContract, type Hex, IndexerClient, type IndexerConfig, type IndexerHealth, IndexerQueries, IndexerQueryError, MAX_EXECUTION_DELAY, MAX_MODULES, MAX_OWNERS, type MineSaltOptions, type MinedSalt, type MiningStrategy, type NetworkConfig, type NetworkName, NoIndexerError, NoSignerError, NotFoundError, Operation, type Page, type Pagination, PreconditionError, type ProposeOptions, type ProposeResult, QuaiVault, QuaiVaultClient, QuaiVaultError, type QuaiVaultErrorCode, type RawRecovery, type RawRecoveryConfig, type RawRecoveryState, type RawTransactionState, type RawTransactionStruct, type ReceiptLike, type RecoveryAction, type RecoveryAffordance, type RecoveryConfig, RecoveryContract, RecoveryModule, type RecoveryModuleContext, type RecoveryRequest, type RecoveryStatus, type ResolvedConfig, type RetryOptions, RevertError, SENTINEL_MODULES, SaltMiningError, StaleProposalError, type Subscription, type TokenBalance, TokenContract, type TransactionKind, type TransactionStatus, ValidationError, Vault, type VaultAction, type VaultBalances, type VaultContext, VaultContract, type VaultInfo, type VaultTransaction, type VaultView, type WatchEvent, type WatchOptions, type WatchTopic, type WorkerRuntime, ZERO_ADDRESS, allowedActions, assertQuaiAddress, assertQuaiAddresses, classifyExecution, computeAffordances, computeBytecodeHash, computeFullSalt, connect, createWorkerThreadsStrategy, decodeCall, decodeMultiSendPayload, decodeRevert, decodeRevertFromError, defaultStrategy, deriveRecoveryStatus, deriveStatus, encodeInitData, encodeMultiSend, encodeMultiSendPayload, executableAfterOf, extractProposedTxHash, schemas as indexerSchemas, inspectAddress, interfaces, isNetworkName, isTerminal, isTransient, isUsableQuaiAddress, knownErrorSelectors, loadBalances, mainnet, mapPooled, mineSalt, minimumExpiration, networks, nowSeconds, predictVaultAddress, recoveryCall, remediationFor, resolveConfig, sanitizeText, selfCall, shardPrefixOf, syncStrategy, testnet, token as tokenCalls, watchVault, withRetry, workerThreadsStrategy };
|