@arkade-os/sdk 0.4.67 → 0.5.0-rc.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 +40 -5
- package/dist/adapters/expo.cjs +5 -5
- package/dist/adapters/expo.d.cts +2 -2
- package/dist/adapters/expo.d.ts +2 -2
- package/dist/adapters/expo.js +3 -3
- package/dist/adapters/indexedDB.cjs +5 -5
- package/dist/adapters/indexedDB.js +4 -4
- package/dist/{asyncStorageTaskQueue-Za-e_zMk.d.ts → asyncStorageTaskQueue-BCzN3Y45.d.ts} +2 -2
- package/dist/{asyncStorageTaskQueue-LTpeXYaD.d.cts → asyncStorageTaskQueue-CdF_ELX8.d.cts} +2 -2
- package/dist/{chunk-MJUTO3PY.cjs → chunk-5MJHZHG7.cjs} +771 -477
- package/dist/chunk-5MJHZHG7.cjs.map +1 -0
- package/dist/{chunk-2JV4VQ7C.cjs → chunk-6AFUNKK7.cjs} +33 -7
- package/dist/chunk-6AFUNKK7.cjs.map +1 -0
- package/dist/{chunk-AEWJU6NZ.js → chunk-6F2Q32KA.js} +352 -59
- package/dist/chunk-6F2Q32KA.js.map +1 -0
- package/dist/{chunk-EALWOVHK.js → chunk-ABJPM4JF.js} +4 -4
- package/dist/{chunk-EALWOVHK.js.map → chunk-ABJPM4JF.js.map} +1 -1
- package/dist/{chunk-CO3KKSWM.cjs → chunk-CZ32XADN.cjs} +17 -17
- package/dist/{chunk-CO3KKSWM.cjs.map → chunk-CZ32XADN.cjs.map} +1 -1
- package/dist/{chunk-X3VEMUVV.js → chunk-FVTJJQNM.js} +3 -3
- package/dist/{chunk-X3VEMUVV.js.map → chunk-FVTJJQNM.js.map} +1 -1
- package/dist/{chunk-OIZ2V2VD.cjs → chunk-HL7EC2Z5.cjs} +121 -170
- package/dist/chunk-HL7EC2Z5.cjs.map +1 -0
- package/dist/{chunk-MZFUZUTQ.js → chunk-JYP7YXT2.js} +4 -4
- package/dist/{chunk-MZFUZUTQ.js.map → chunk-JYP7YXT2.js.map} +1 -1
- package/dist/{chunk-6TAQF6EV.js → chunk-KTU44AEH.js} +75 -124
- package/dist/chunk-KTU44AEH.js.map +1 -0
- package/dist/{chunk-YDRZDZPP.cjs → chunk-PB5KJI4U.cjs} +10 -10
- package/dist/{chunk-YDRZDZPP.cjs.map → chunk-PB5KJI4U.cjs.map} +1 -1
- package/dist/{chunk-3WIWNE4P.js → chunk-PPG6W34P.js} +30 -8
- package/dist/chunk-PPG6W34P.js.map +1 -0
- package/dist/{chunk-R2YAMONM.cjs → chunk-RXWKCEZP.cjs} +17 -17
- package/dist/{chunk-R2YAMONM.cjs.map → chunk-RXWKCEZP.cjs.map} +1 -1
- package/dist/contracts/handlers/index.cjs +9 -9
- package/dist/contracts/handlers/index.d.cts +3 -3
- package/dist/contracts/handlers/index.d.ts +3 -3
- package/dist/contracts/handlers/index.js +2 -2
- package/dist/{delegate-Bz2e2zXY.d.cts → delegate-DLIOBQ5x.d.cts} +1 -1
- package/dist/{delegate-cdmzb2f9.d.ts → delegate-Dyn5L80J.d.ts} +1 -1
- package/dist/{hdWalletCapable-BSjuUYOO.d.cts → hdWalletCapable-D9tooZ6F.d.ts} +102 -27
- package/dist/{hdWalletCapable-Hi12xjCJ.d.ts → hdWalletCapable-Dt3MUiGE.d.cts} +102 -27
- package/dist/{index-BiACuWaf.d.ts → index-D3hmsuKs.d.cts} +100 -123
- package/dist/{index-D2GjZxBr.d.cts → index-D9tXd-tN.d.ts} +100 -123
- package/dist/{index-DU5o_hz7.d.ts → index-Udm5V2xW.d.cts} +184 -19
- package/dist/{index-DU5o_hz7.d.cts → index-Udm5V2xW.d.ts} +184 -19
- package/dist/index.cjs +309 -289
- package/dist/index.d.cts +125 -29
- package/dist/index.d.ts +125 -29
- package/dist/index.js +4 -4
- package/dist/repositories/realm/index.cjs +19 -19
- package/dist/repositories/realm/index.d.cts +2 -2
- package/dist/repositories/realm/index.d.ts +2 -2
- package/dist/repositories/realm/index.js +5 -5
- package/dist/repositories/sqlite/index.cjs +18 -18
- package/dist/repositories/sqlite/index.d.cts +2 -2
- package/dist/repositories/sqlite/index.d.ts +2 -2
- package/dist/repositories/sqlite/index.js +5 -5
- package/dist/{taskRunner-BZJMLQ6g.d.cts → taskRunner-DxZciNaa.d.cts} +2 -2
- package/dist/{taskRunner-DATaRQus.d.ts → taskRunner-ZdS16Ypm.d.ts} +2 -2
- package/dist/wallet/expo/background.cjs +14 -14
- package/dist/wallet/expo/background.d.cts +3 -3
- package/dist/wallet/expo/background.d.ts +3 -3
- package/dist/wallet/expo/background.js +6 -6
- package/dist/wallet/expo/index.cjs +23 -14
- package/dist/wallet/expo/index.cjs.map +1 -1
- package/dist/wallet/expo/index.d.cts +7 -4
- package/dist/wallet/expo/index.d.ts +7 -4
- package/dist/wallet/expo/index.js +14 -5
- package/dist/wallet/expo/index.js.map +1 -1
- package/dist/worker/expo/index.cjs +9 -9
- package/dist/worker/expo/index.d.cts +4 -4
- package/dist/worker/expo/index.d.ts +4 -4
- package/dist/worker/expo/index.js +5 -5
- package/package.json +3 -2
- package/dist/chunk-2JV4VQ7C.cjs.map +0 -1
- package/dist/chunk-3WIWNE4P.js.map +0 -1
- package/dist/chunk-6TAQF6EV.js.map +0 -1
- package/dist/chunk-AEWJU6NZ.js.map +0 -1
- package/dist/chunk-MJUTO3PY.cjs.map +0 -1
- package/dist/chunk-OIZ2V2VD.cjs.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { w as RelativeTimelock, X as Network, Y as CSVMultisigTapscript, Z as BatchStartedEvent, _ as TreeSigningStartedEvent, $ as TxTree, a0 as TreeNoncesEvent, a1 as BatchFinalizationEvent, a2 as BatchFinalizedEvent, a3 as BatchFailedEvent, a4 as TreeTxEvent, a5 as TreeSignatureEvent, o as SettlementEvent, b as WalletConfig, W as WalletRepository, C as ContractRepository, a6 as DescriptorProvider, j as IContractManager, a7 as IReadonlyWallet, a8 as ReadonlyIdentity, a9 as OnchainProvider, u as ArkProvider, v as IndexerProvider, aa as DelegateProvider, ab as ReadonlyWalletConfig, J as IntentRepository, M as VirtualTxRepository, ac as ExitCaptureMode, ad as ExitDataSource, h as ActivityRegistry, ae as IReadonlyAssetManager, af as ContractSyncState, ag as RecipientArkadeAddressContext, G as GetArkadeInfoOptions, A as ArkadeInfo, c as ArkadeReader, ah as NetworkName, ai as ArkAddress, e as WalletBalance, f as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, aj as ContractWithVtxos, ak as selectPendingRecoveryOutpoints, g as ArkTransaction, i as Activity, E as ExtendedCoin, al as Coin, B as ExtendedVirtualCoin, am as ContractManager, an as ContractManagerConfig, I as IWallet, a as Identity, k as GetNewAddressesOptions, l as NewAddress, ao as SettlementConfig, d as ArkadeBroadcaster, q as IAssetManager, ap as VtxoManager, m as IDelegateManager, S as SendBitcoinParams, n as SettleParams, R as Recipient, aq as SignerSession, ar as SignedIntent, as as Intent, p as SendParams, at as TimeHeight } from './index-Udm5V2xW.cjs';
|
|
2
2
|
import { Transaction } from '@scure/btc-signer';
|
|
3
3
|
import { TransactionOutput } from '@scure/btc-signer/psbt.js';
|
|
4
4
|
import { Bytes } from '@scure/btc-signer/utils.js';
|
|
5
|
-
import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-
|
|
5
|
+
import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-DLIOBQ5x.cjs';
|
|
6
6
|
|
|
7
7
|
/** Wall-clock floor for `batchExpiry` outside regtest. */
|
|
8
8
|
declare const DEFAULT_MIN_BATCH_EXPIRY_SECONDS = 86400n;
|
|
@@ -48,10 +48,11 @@ declare const DEFAULT_MIN_CHECKPOINT_EXIT_DELAY_SECONDS = 86400n;
|
|
|
48
48
|
/**
|
|
49
49
|
* Wall-clock floor for the checkpoint exit delay on regtest (~2 blocks nominal).
|
|
50
50
|
*
|
|
51
|
-
* Deliberately lower than {@link REGTEST_MIN_BATCH_EXPIRY_SECONDS "../wallet/batchExpiry"} —
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
51
|
+
* Deliberately lower than {@link REGTEST_MIN_BATCH_EXPIRY_SECONDS "../wallet/batchExpiry"} — it
|
|
52
|
+
* was sized to clear an `ARKD_CHECKPOINT_EXIT_DELAY` of 5 blocks while still rejecting a 1-block
|
|
53
|
+
* attack. No env in this repo goes below 20 any more (the 5-block one shipped with the removed
|
|
54
|
+
* boltz-swap package), so there is room to tighten this; left as-is until someone confirms no
|
|
55
|
+
* external regtest deployment relies on the lower bound.
|
|
55
56
|
*/
|
|
56
57
|
declare const REGTEST_MIN_CHECKPOINT_EXIT_DELAY_SECONDS = 1200n;
|
|
57
58
|
/**
|
|
@@ -75,7 +76,7 @@ declare const MUTINYNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS = 4096n;
|
|
|
75
76
|
* mutinynet does.
|
|
76
77
|
*/
|
|
77
78
|
declare const SIGNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS = 86016n;
|
|
78
|
-
/** Bounds applied to a server-supplied `
|
|
79
|
+
/** Bounds applied to a server-supplied `ArkadeInfo.checkpointTapscript`. */
|
|
79
80
|
type CheckpointExitDelayPolicy = {
|
|
80
81
|
/** Minimum wall-clock delay in seconds, after normalization. */
|
|
81
82
|
minSeconds: bigint;
|
|
@@ -90,7 +91,7 @@ type CheckpointExitDelayPolicy = {
|
|
|
90
91
|
* arkd always builds the checkpoint tapscript from its own `forfeitPubkey`
|
|
91
92
|
* (`internal/core/application/service.go`), so this should be the
|
|
92
93
|
* `forfeitPubkey` the caller already trusts — pinned wallet state where one
|
|
93
|
-
* exists, otherwise the same `
|
|
94
|
+
* exists, otherwise the same `ArkadeInfo` response's own `forfeitPubkey` field
|
|
94
95
|
* as a self-consistency check.
|
|
95
96
|
*/
|
|
96
97
|
advertisedForfeitPubkey?: Bytes;
|
|
@@ -211,7 +212,7 @@ declare class ServerResponseMismatchError extends Error {
|
|
|
211
212
|
*/
|
|
212
213
|
declare function maybeArkError(error: any): ArkError | undefined;
|
|
213
214
|
|
|
214
|
-
/** Where the {@link
|
|
215
|
+
/** Where the {@link ArkadeInfo} used to construct a wallet came from. */
|
|
215
216
|
type ServerInfoSource = "live" | "cache";
|
|
216
217
|
|
|
217
218
|
/**
|
|
@@ -729,6 +730,13 @@ declare class ReadonlyWallet implements IReadonlyWallet {
|
|
|
729
730
|
readonly identity: ReadonlyIdentity;
|
|
730
731
|
readonly network: Network;
|
|
731
732
|
readonly onchainProvider: OnchainProvider;
|
|
733
|
+
/**
|
|
734
|
+
* Narrowed to what a readonly wallet legitimately needs — the only use
|
|
735
|
+
* here is {@link getArkadeInfo}. `protected` stops an outside caller
|
|
736
|
+
* reaching it; the `Pick` stops this class growing a use for
|
|
737
|
+
* `submitTx`. `Wallet` re-widens both below.
|
|
738
|
+
*/
|
|
739
|
+
protected readonly arkProvider: Pick<ArkProvider, "getInfo">;
|
|
732
740
|
readonly indexerProvider: IndexerProvider;
|
|
733
741
|
readonly dustAmount: bigint;
|
|
734
742
|
readonly walletRepository: WalletRepository;
|
|
@@ -793,26 +801,33 @@ declare class ReadonlyWallet implements IReadonlyWallet {
|
|
|
793
801
|
*/
|
|
794
802
|
protected _arkServerPublicKey: Bytes;
|
|
795
803
|
/**
|
|
796
|
-
* Whether
|
|
797
|
-
*
|
|
798
|
-
* (`"cache"`).
|
|
804
|
+
* Whether the LATEST server-info resolution answered live (`"live"`) or
|
|
805
|
+
* from the cached snapshot because the operator was unreachable
|
|
806
|
+
* (`"cache"`). Seeded at construction and updated by every
|
|
807
|
+
* {@link getArkadeInfo} read, so a wallet that booted offline and
|
|
808
|
+
* recovered stops reporting degraded — and one that just fell back stops
|
|
809
|
+
* claiming online. Freshness signal for
|
|
810
|
+
* {@link getProviderConnectionState}.
|
|
799
811
|
*/
|
|
800
812
|
protected _serverInfoSource: ServerInfoSource;
|
|
801
813
|
/**
|
|
802
|
-
* Epoch-ms of the last known live operator contact:
|
|
803
|
-
*
|
|
814
|
+
* Epoch-ms of the last known live operator contact: the most recent live
|
|
815
|
+
* resolution (construction or a later {@link getArkadeInfo}), or the
|
|
816
|
+
* cached snapshot's `savedAt` when the latest resolution fell back.
|
|
804
817
|
*/
|
|
805
818
|
protected _serverInfoLastOnlineAt?: number;
|
|
806
819
|
/** @see {@link _serverInfoSource} */
|
|
807
820
|
get serverInfoSource(): ServerInfoSource;
|
|
808
821
|
/**
|
|
809
|
-
* Composed provider-connection freshness: the
|
|
810
|
-
* (
|
|
811
|
-
* manager
|
|
812
|
-
*
|
|
813
|
-
*
|
|
822
|
+
* Composed provider-connection freshness: the LATEST server-info
|
|
823
|
+
* resolution (boot, or any later {@link getArkadeInfo} read) combined with
|
|
824
|
+
* the contract-manager's indexer-sync health, if the manager has been
|
|
825
|
+
* initialized. Reads no live provider state — it never forces a
|
|
826
|
+
* `ContractManager` to construct — so it is safe for readonly callers
|
|
827
|
+
* that only use address/balance APIs.
|
|
814
828
|
*
|
|
815
|
-
* -
|
|
829
|
+
* - Latest resolution fell back to the cached snapshot → degraded on
|
|
830
|
+
* `arkade` (`cache`).
|
|
816
831
|
* - Otherwise, if the contract manager has degraded to repository data →
|
|
817
832
|
* degraded on `indexer` (`repository`).
|
|
818
833
|
* - Otherwise online.
|
|
@@ -829,10 +844,17 @@ declare class ReadonlyWallet implements IReadonlyWallet {
|
|
|
829
844
|
* (e.g. the service-worker sync-state message).
|
|
830
845
|
*/
|
|
831
846
|
getContractSyncState(): ContractSyncState;
|
|
832
|
-
protected constructor(identity: ReadonlyIdentity, network: Network, onchainProvider: OnchainProvider,
|
|
847
|
+
protected constructor(identity: ReadonlyIdentity, network: Network, onchainProvider: OnchainProvider,
|
|
848
|
+
/**
|
|
849
|
+
* Narrowed to what a readonly wallet legitimately needs — the only use
|
|
850
|
+
* here is {@link getArkadeInfo}. `protected` stops an outside caller
|
|
851
|
+
* reaching it; the `Pick` stops this class growing a use for
|
|
852
|
+
* `submitTx`. `Wallet` re-widens both below.
|
|
853
|
+
*/
|
|
854
|
+
arkProvider: Pick<ArkProvider, "getInfo">, indexerProvider: IndexerProvider, arkServerPublicKey: Bytes, offchainTapscript: DefaultVtxo.Script | DelegateVtxo.Script, boardingTapscript: DefaultVtxo.Script, dustAmount: bigint, walletRepository: WalletRepository, contractRepository: ContractRepository, delegateProvider?: DelegateProvider | undefined, watcherConfig?: ReadonlyWalletConfig["watcherConfig"], walletContractTimelocks?: RelativeTimelock[]);
|
|
833
855
|
/**
|
|
834
856
|
* x-only hex of the operator's deprecated signer keys (from
|
|
835
|
-
* `
|
|
857
|
+
* `ArkadeInfo.deprecatedSigners`), cached for the OFFLINE read/watch paths.
|
|
836
858
|
* The boarding watch/history surfaces ({@link getBoardingAddresses},
|
|
837
859
|
* {@link getBoardingTxs}) fan out over {current} ∪ this set so a deposit at
|
|
838
860
|
* a boarding address minted under a now-rotated operator signer keeps being
|
|
@@ -869,7 +891,7 @@ declare class ReadonlyWallet implements IReadonlyWallet {
|
|
|
869
891
|
* against mid-flight rotation pass their snapshot, so the check reads from
|
|
870
892
|
* one rotation epoch.
|
|
871
893
|
*/
|
|
872
|
-
protected recipientAddressContext(serverPubKey?: Bytes):
|
|
894
|
+
protected recipientAddressContext(serverPubKey?: Bytes): RecipientArkadeAddressContext;
|
|
873
895
|
/**
|
|
874
896
|
* Currently-active receive tapscript. Read-only from the outside;
|
|
875
897
|
* mutated only via {@link Wallet.setOffchainTapscriptForRotation}
|
|
@@ -884,6 +906,45 @@ declare class ReadonlyWallet implements IReadonlyWallet {
|
|
|
884
906
|
* span a rotation.
|
|
885
907
|
*/
|
|
886
908
|
get arkServerPublicKey(): Bytes;
|
|
909
|
+
/**
|
|
910
|
+
* Server info for the Arkade server this wallet is connected to, resolved
|
|
911
|
+
* exactly as construction resolves it: live wins, a retryable failure
|
|
912
|
+
* falls back to the snapshot persisted at boot, a terminal one propagates.
|
|
913
|
+
*
|
|
914
|
+
* Live rather than the pinned boot snapshot because the fields callers
|
|
915
|
+
* come here for — `signerPubkey`, `checkpointTapscript`, `fees` — are the
|
|
916
|
+
* ones a mid-session rotation moves, and a covenant built against a
|
|
917
|
+
* superseded signer is unspendable.
|
|
918
|
+
*
|
|
919
|
+
* One rotation caveat: reading does NOT re-pin the wallet —
|
|
920
|
+
* {@link arkServerPublicKey}, {@link dustAmount} and the tapscripts move
|
|
921
|
+
* only through `handleServerInfoChanged`/`rotateServerSigner` — so inside
|
|
922
|
+
* a rotation window this can report epoch N+1 while the wallet still
|
|
923
|
+
* spends on N. The window closes on its own: a read that observes a moved
|
|
924
|
+
* digest makes the provider emit `onServerInfoChanged`, which is what
|
|
925
|
+
* drives that rotation. A caller about to bind the answer into a covenant
|
|
926
|
+
* passes `{ requireLive: true }` and fails closed instead of receiving
|
|
927
|
+
* the boot snapshot.
|
|
928
|
+
*
|
|
929
|
+
* @returns The Arkade server's info
|
|
930
|
+
* @see ArkadeInfo
|
|
931
|
+
*/
|
|
932
|
+
getArkadeInfo(opts?: GetArkadeInfoOptions): Promise<ArkadeInfo>;
|
|
933
|
+
/**
|
|
934
|
+
* Chain reads against this wallet's server for scripts it does not own.
|
|
935
|
+
*
|
|
936
|
+
* Binds the wallet's own `indexerProvider` — which may be an Expo or
|
|
937
|
+
* injected one that a caller's hand-built `RestIndexerProvider` would
|
|
938
|
+
* silently bypass. `getVtxos` goes through
|
|
939
|
+
* {@link getNormalizedVtxos}, which is what makes every VTXO leaving the
|
|
940
|
+
* seam carry its canonical facts.
|
|
941
|
+
*
|
|
942
|
+
* A bound object rather than the provider itself, so an `IReadonlyWallet`
|
|
943
|
+
* holder gets `getVtxos`/`getVirtualTxs` and nothing else at runtime.
|
|
944
|
+
* (`indexerProvider` is still public on the concrete classes, unlike
|
|
945
|
+
* `arkProvider`, so this narrows the interface rather than the field.)
|
|
946
|
+
*/
|
|
947
|
+
getArkadeReader(): Promise<ArkadeReader>;
|
|
887
948
|
/**
|
|
888
949
|
* The wallet's current boarding tapscript (the on-chain onboarding
|
|
889
950
|
* target). Read-only from the outside; mutated only via
|
|
@@ -931,7 +992,7 @@ declare class ReadonlyWallet implements IReadonlyWallet {
|
|
|
931
992
|
dustAmount: bigint;
|
|
932
993
|
walletRepository: WalletRepository;
|
|
933
994
|
contractRepository: ContractRepository;
|
|
934
|
-
info:
|
|
995
|
+
info: ArkadeInfo;
|
|
935
996
|
serverInfoSource: ServerInfoSource;
|
|
936
997
|
serverInfoLastOnlineAt: number | undefined;
|
|
937
998
|
delegateProvider: DelegateProvider | undefined;
|
|
@@ -1224,7 +1285,6 @@ declare class ReadonlyWallet implements IReadonlyWallet {
|
|
|
1224
1285
|
* ```
|
|
1225
1286
|
*/
|
|
1226
1287
|
declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable, AddressAllocationCapable {
|
|
1227
|
-
readonly arkProvider: ArkProvider;
|
|
1228
1288
|
readonly forfeitOutputScript: Bytes;
|
|
1229
1289
|
readonly forfeitPubkey: Bytes;
|
|
1230
1290
|
/** Overrides for the `batchExpiry` bounds; defaults derive from `network`. */
|
|
@@ -1346,7 +1406,7 @@ declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable,
|
|
|
1346
1406
|
/**
|
|
1347
1407
|
* Output script for checkpoint transactions, decoded from the server's
|
|
1348
1408
|
* `checkpointTapscript`. Server-controlled state: pinned at construction
|
|
1349
|
-
* and re-sourced from a fresh `
|
|
1409
|
+
* and re-sourced from a fresh `ArkadeInfo` on server-signer rotation. Read it
|
|
1350
1410
|
* through {@link serverUnrollScript}; write it only through
|
|
1351
1411
|
* {@link setServerUnrollScriptForRotation}.
|
|
1352
1412
|
*/
|
|
@@ -1355,7 +1415,7 @@ declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable,
|
|
|
1355
1415
|
/**
|
|
1356
1416
|
* @internal Sole write path for `serverUnrollScript` after construction.
|
|
1357
1417
|
* Called by {@link Wallet._doRotateServerSigner} with the checkpoint script
|
|
1358
|
-
* sourced from the fresh `
|
|
1418
|
+
* sourced from the fresh `ArkadeInfo` that triggered the rotation, so the send
|
|
1359
1419
|
* path builds checkpoints against the new server epoch. External code must
|
|
1360
1420
|
* treat `serverUnrollScript` as read-only.
|
|
1361
1421
|
*/
|
|
@@ -1638,6 +1698,21 @@ declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable,
|
|
|
1638
1698
|
thresholdMs: number;
|
|
1639
1699
|
};
|
|
1640
1700
|
readonly settlementConfig: SettlementConfig | false;
|
|
1701
|
+
/**
|
|
1702
|
+
* Re-widened to public: a full wallet's provider is part of its API
|
|
1703
|
+
* (`ExpoWallet` and the delegate manager read it), while `ReadonlyWallet`
|
|
1704
|
+
* keeps it protected so a readonly view cannot hand out `submitTx`.
|
|
1705
|
+
*/
|
|
1706
|
+
readonly arkProvider: ArkProvider;
|
|
1707
|
+
/**
|
|
1708
|
+
* Broadcast access bound to this wallet's server, so a plugin needs only
|
|
1709
|
+
* the wallet.
|
|
1710
|
+
*
|
|
1711
|
+
* Defined here and not on {@link ReadonlyWallet} for the same reason
|
|
1712
|
+
* `arkProvider` is protected there: a readonly wallet, and every
|
|
1713
|
+
* `toReadonly()` view, must not be able to submit.
|
|
1714
|
+
*/
|
|
1715
|
+
getArkadeBroadcaster(): Promise<ArkadeBroadcaster>;
|
|
1641
1716
|
protected constructor(identity: Identity, network: Network, onchainProvider: OnchainProvider, arkProvider: ArkProvider, indexerProvider: IndexerProvider, arkServerPublicKey: Bytes, offchainTapscript: DefaultVtxo.Script | DelegateVtxo.Script, boardingTapscript: DefaultVtxo.Script, serverUnrollScript: CSVMultisigTapscript.Type, forfeitOutputScript: Bytes, forfeitPubkey: Bytes, dustAmount: bigint, walletRepository: WalletRepository, contractRepository: ContractRepository,
|
|
1642
1717
|
/** @deprecated Use settlementConfig */
|
|
1643
1718
|
renewalConfig?: WalletConfig["renewalConfig"], delegateProvider?: DelegateProvider, watcherConfig?: WalletConfig["watcherConfig"], settlementConfig?: WalletConfig["settlementConfig"], walletContractTimelocks?: RelativeTimelock[], receiveRotator?: WalletReceiveRotator, descriptorProvider?: DescriptorProvider, lookAheadWindow?: number,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-
|
|
1
|
+
import { bn as ContractHandler, w as RelativeTimelock, bz as Discoverable, V as VtxoScript, x as TapLeafScript, df as TapscriptDeriving } from './index-Udm5V2xW.cjs';
|
|
2
|
+
import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-DLIOBQ5x.cjs';
|
|
3
3
|
import { Bytes } from '@scure/btc-signer/utils.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -114,96 +114,79 @@ declare namespace VHTLC {
|
|
|
114
114
|
unilateralRefundDelay: RelativeTimelock;
|
|
115
115
|
unilateralRefundWithoutReceiverDelay: RelativeTimelock;
|
|
116
116
|
/**
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
117
|
+
* The emulator covenant leaves, ALL OR NOTHING. Present, this adds the
|
|
118
|
+
* three non-interactive leaves the emulator co-signs under a covenant
|
|
119
|
+
* pinning the payout to a pre-committed destination:
|
|
120
|
+
*
|
|
121
|
+
* - `nonInteractiveClaim`: `server` + a covenant-tweaked emulator
|
|
122
|
+
* co-signer, paying `receiverPkScript` — the receiver's claim can
|
|
123
|
+
* be pushed without the receiver being online.
|
|
124
|
+
* - `nonInteractiveRefund`: `server` + `receiver` + a covenant-tweaked
|
|
125
|
+
* emulator co-signer, paying `senderPkScript`, no timelock — lets
|
|
126
|
+
* server and receiver release the refund the moment they agree the
|
|
127
|
+
* swap has failed, and recoverable even if the sender's own key is
|
|
128
|
+
* lost, since no OTHER refund-side leaf survives that.
|
|
129
|
+
* - `nonInteractiveRefundWithoutReceiver`: `server` + the SAME
|
|
130
|
+
* covenant-tweaked co-signer as `nonInteractiveRefund`, paying
|
|
131
|
+
* `senderPkScript` after `refundLocktime` — the only refund tier
|
|
132
|
+
* needing no participant signature at all, so a sender who funded
|
|
133
|
+
* a lockup and vanished is refundable through it alone.
|
|
134
|
+
*
|
|
135
|
+
* WHY ONE FLAG AND NOT A SWITCH PER LEAF. The three are one mechanism
|
|
136
|
+
* — the same emulator key, the same `enforcePayTo` covenant pointed
|
|
137
|
+
* at a per-role destination — and they protect opposite directions of
|
|
138
|
+
* the same swap, so no real configuration wants a subset. A subset
|
|
139
|
+
* would cost, not buy: every optional leaf multiplies the tree shapes
|
|
140
|
+
* a counterparty must derive to verify an address (nothing on the
|
|
141
|
+
* wire says which leaves a quote carries), so per-leaf toggling turns
|
|
142
|
+
* one address comparison into a combinatorial guess. All-or-nothing
|
|
143
|
+
* keeps the shape count at two: suite, or no suite.
|
|
144
|
+
*
|
|
145
|
+
* Leaf order fixes the taproot merkle root, so the suite is appended
|
|
146
|
+
* after the six signature leaves in a fixed order (claim, refund,
|
|
147
|
+
* timelocked refund) and a script built with this option NEVER
|
|
148
|
+
* collides with one built without it — which is what makes "did this
|
|
149
|
+
* quote opt in" a question an address comparison answers.
|
|
150
|
+
*
|
|
151
|
+
* STABLE PER RELEASE: what this option builds does not change within
|
|
152
|
+
* a published SDK version. A future covenant leaf joins the suite
|
|
153
|
+
* only behind a NEW option, so re-deriving a lockup with the SDK
|
|
154
|
+
* that quoted it reproduces its address byte-for-byte.
|
|
120
155
|
*/
|
|
121
|
-
|
|
122
|
-
|
|
156
|
+
nonInteractiveParameters?: {
|
|
157
|
+
/**
|
|
158
|
+
* The emulator service's public key, 32-byte x-only or 33-byte
|
|
159
|
+
* compressed. ONE key, tweaked per covenant destination, becomes
|
|
160
|
+
* the co-signer of every leaf in the suite — the leaves share it
|
|
161
|
+
* structurally, and BIP-341 tapscript sighashes committing to the
|
|
162
|
+
* tapleaf hash are what keep a signature for one leaf from
|
|
163
|
+
* replaying against another.
|
|
164
|
+
*/
|
|
123
165
|
emulatorPubkey: Bytes;
|
|
124
166
|
/**
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
* ADDITIVE, NEVER A REPLACEMENT. The conservation bound stays. On
|
|
134
|
-
* its own, `out >= quoted` leaves everything ABOVE the quote
|
|
135
|
-
* unconstrained, so an overfunded lockup's surplus could be routed
|
|
136
|
-
* anywhere by whoever assembles the spend — trading an underfunding
|
|
137
|
-
* hole for a skimming one. Both bounds together admit neither.
|
|
138
|
-
*
|
|
139
|
-
* WHAT IT COSTS, and it is not only opcodes:
|
|
140
|
-
*
|
|
141
|
-
* - THE ADDRESS BECOMES A FUNCTION OF THE QUOTE. These amounts
|
|
142
|
-
* compile into the leaf, hence the emulator key, hence the
|
|
143
|
-
* pkScript. A re-quote is a different address, and cannot be
|
|
144
|
-
* applied to a lockup already funded.
|
|
145
|
-
* - AN UNDERFUNDED LOCKUP BECOMES UNCLAIMABLE. Its only exit is the
|
|
146
|
-
* refund path, which waits out the CLTV. That is the intended
|
|
147
|
-
* incentive and it lands on whoever misfunded — but it converts
|
|
148
|
-
* "claim the short amount now and settle up" into "wait for the
|
|
149
|
-
* timelock".
|
|
150
|
-
*
|
|
151
|
-
* Omit for the default. Omitting leaves every script byte unchanged,
|
|
152
|
-
* so contracts already funded keep their addresses.
|
|
167
|
+
* Where the claim covenant pays: the receiver's own P2TR
|
|
168
|
+
* pkScript, 34 bytes.
|
|
169
|
+
*/
|
|
170
|
+
receiverPkScript: Bytes;
|
|
171
|
+
/**
|
|
172
|
+
* Where BOTH refund covenants pay: the sender's own P2TR
|
|
173
|
+
* pkScript, 34 bytes. One destination shared by both refund
|
|
174
|
+
* leaves, so they cannot diverge on where a refund goes.
|
|
153
175
|
*/
|
|
154
|
-
strict?: {
|
|
155
|
-
/** Sats the claim must pay. Positive. */
|
|
156
|
-
amount: bigint;
|
|
157
|
-
/**
|
|
158
|
-
* Asset base units the claim must pay.
|
|
159
|
-
*
|
|
160
|
-
* Required iff {@link VHTLC.Options.asset} is set, and refused
|
|
161
|
-
* otherwise. Strict-on-sats-only against an asset-denominated
|
|
162
|
-
* contract would pin the sat CARRIER and say nothing about the
|
|
163
|
-
* asset that is the actual amount — half-enforcement that reads
|
|
164
|
-
* like enforcement, which is the failure this option exists to
|
|
165
|
-
* avoid rather than introduce.
|
|
166
|
-
*/
|
|
167
|
-
assetAmount?: bigint;
|
|
168
|
-
};
|
|
169
|
-
};
|
|
170
|
-
/**
|
|
171
|
-
* Optional non-interactive refund leaf: `server` + `receiver` + a
|
|
172
|
-
* covenant-tweaked emulator co-signer, pinned to `senderPkScript`, no
|
|
173
|
-
* timelock. Every OTHER refund-side leaf in this contract requires
|
|
174
|
-
* the sender's own signature — if the sender permanently loses that
|
|
175
|
-
* key, none of them are reachable. This leaf is the one exception:
|
|
176
|
-
* it needs neither the sender's presence nor their key, so funds
|
|
177
|
-
* remain recoverable to the sender's pre-committed address even
|
|
178
|
-
* then. It still needs the receiver (unlike `nonInteractiveClaim`,
|
|
179
|
-
* which needs only server + emulator) — deliberately: this is what
|
|
180
|
-
* lets server + receiver release the refund immediately, the moment
|
|
181
|
-
* they agree the swap has failed, rather than making the sender wait
|
|
182
|
-
* out `refundLocktime` the way {@link Script.refundWithoutReceiver}
|
|
183
|
-
* does.
|
|
184
|
-
*/
|
|
185
|
-
nonInteractiveRefund?: {
|
|
186
176
|
senderPkScript: Bytes;
|
|
187
|
-
emulatorPubkey: Bytes;
|
|
188
177
|
/**
|
|
189
|
-
*
|
|
190
|
-
* covenant-tweaked co-signer, spendable after `refundLocktime`
|
|
191
|
-
* with no receiver signature and no sender signature.
|
|
178
|
+
* LEGACY REBUILD ONLY — never for a new lockup.
|
|
192
179
|
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
* address. `nonInteractiveClaim` and `nonInteractiveRefund` are
|
|
202
|
-
* independently optional, so this is the NINTH leaf only in the
|
|
203
|
-
* full swap-corridor configuration where both are set — on its
|
|
204
|
-
* own, it is the eighth.
|
|
180
|
+
* `"preTimelockedRefund"` builds the suite WITHOUT its timelocked
|
|
181
|
+
* refund leaf: the shape every emulator-covenant lockup funded
|
|
182
|
+
* before that leaf shipped carries. Lockups already funded in that
|
|
183
|
+
* shape keep it permanently — a leaf cannot be retrofitted onto an
|
|
184
|
+
* address already committed — so re-deriving such a lockup (to
|
|
185
|
+
* spend it, or to verify an old quote's address) needs this. A new
|
|
186
|
+
* lockup that omits the leaf gives up the one refund tier needing
|
|
187
|
+
* nobody, for nothing.
|
|
205
188
|
*/
|
|
206
|
-
|
|
189
|
+
legacy?: "preTimelockedRefund";
|
|
207
190
|
};
|
|
208
191
|
/**
|
|
209
192
|
* Optional: denominate this contract in an Arkade ASSET rather than in
|
|
@@ -360,35 +343,33 @@ declare namespace VHTLC {
|
|
|
360
343
|
* - **unilateralClaim**: Receiver can claim unilaterally after delay
|
|
361
344
|
* - **unilateralRefund**: Sender and receiver can refund unilaterally after delay
|
|
362
345
|
* - **unilateralRefundWithoutReceiver**: Sender can refund unilaterally after delay
|
|
363
|
-
* - **nonInteractiveClaim** (
|
|
364
|
-
* receiver's claim, pinned to a pre-committed destination
|
|
365
|
-
* - **nonInteractiveRefund** (
|
|
366
|
-
* can push the sender's refund immediately, no timelock,
|
|
367
|
-
* pre-committed destination — recoverable even if the
|
|
368
|
-
* is lost
|
|
369
|
-
* - **nonInteractiveRefundWithoutReceiver** (
|
|
370
|
-
* can push the sender's refund after `refundLocktime`,
|
|
371
|
-
* pre-committed destination — the only refund tier needing
|
|
372
|
-
* participant signature at all
|
|
346
|
+
* - **nonInteractiveClaim** (with `nonInteractiveParameters`): server + emulator
|
|
347
|
+
* can push the receiver's claim, pinned to a pre-committed destination
|
|
348
|
+
* - **nonInteractiveRefund** (with `nonInteractiveParameters`): server + receiver
|
|
349
|
+
* + emulator can push the sender's refund immediately, no timelock,
|
|
350
|
+
* pinned to a pre-committed destination — recoverable even if the
|
|
351
|
+
* sender's own key is lost
|
|
352
|
+
* - **nonInteractiveRefundWithoutReceiver** (with `nonInteractiveParameters`):
|
|
353
|
+
* server + emulator can push the sender's refund after `refundLocktime`,
|
|
354
|
+
* pinned to a pre-committed destination — the only refund tier needing
|
|
355
|
+
* no participant signature at all
|
|
373
356
|
*
|
|
374
357
|
* See {@link ScriptV2} for the current recommended construction — same
|
|
375
358
|
* leaf ladder, same options shape, an added length check on the claim
|
|
376
359
|
* preimage. This class is unchanged and stays available as-is.
|
|
377
360
|
*
|
|
378
|
-
* **Pre-existing limitation
|
|
379
|
-
*
|
|
380
|
-
*
|
|
381
|
-
*
|
|
382
|
-
* same `BaseScript` where these leaves are constructed. But the `vhtlc`
|
|
361
|
+
* **Pre-existing limitation: the `vhtlc` contract handler registers none
|
|
362
|
+
* of the covenant leaves.** `nonInteractiveParameters` builds on this class
|
|
363
|
+
* exactly as it does on {@link ScriptV2} — both extend the same
|
|
364
|
+
* `BaseScript` where those leaves are constructed. But the `vhtlc`
|
|
383
365
|
* contract handler (`src/contracts/handlers/vhtlc.ts`) round-trips none
|
|
384
366
|
* of them: its params type carries no covenant fields, and
|
|
385
367
|
* `createScript` only ever builds the six signature-only leaves. A V1
|
|
386
|
-
* script built with
|
|
368
|
+
* script built with the covenant suite therefore compiles and can
|
|
387
369
|
* be funded, but cannot be registered as a `vhtlc` contract — the
|
|
388
370
|
* handler would derive a different (six-leaf) script for the same
|
|
389
|
-
* params and `ContractManager` refuses the mismatch.
|
|
390
|
-
*
|
|
391
|
-
* option than before, not to a newly-exposed one.
|
|
371
|
+
* params and `ContractManager` refuses the mismatch. Register through
|
|
372
|
+
* the `vhtlc-v2` handler instead, which round-trips the suite.
|
|
392
373
|
*
|
|
393
374
|
* @example
|
|
394
375
|
* ```typescript
|
|
@@ -460,9 +441,9 @@ declare const VHTLCContractHandler: ContractHandler<VHTLCContractParams, VHTLC.S
|
|
|
460
441
|
* The eight mandatory fields are `VHTLCContractParams` verbatim — the two
|
|
461
442
|
* script versions take the same {@link VHTLC.Options}, so a divergent shape
|
|
462
443
|
* here would be a difference with no cause. What V1's handler has no field for
|
|
463
|
-
* is the
|
|
464
|
-
*
|
|
465
|
-
*
|
|
444
|
+
* is the emulator covenant suite, and that is exactly what the swap corridor's
|
|
445
|
+
* lockup carries, so leaving it out would make this handler unable to
|
|
446
|
+
* round-trip the contract it exists to serve.
|
|
466
447
|
*/
|
|
467
448
|
interface VHTLCV2ContractParams {
|
|
468
449
|
sender: Uint8Array;
|
|
@@ -484,28 +465,24 @@ interface VHTLCV2ContractParams {
|
|
|
484
465
|
/** The asset group index within that genesis transaction. */
|
|
485
466
|
groupIndex: number;
|
|
486
467
|
};
|
|
487
|
-
/**
|
|
488
|
-
|
|
468
|
+
/**
|
|
469
|
+
* The emulator covenant suite, all or nothing — mirrors {@link
|
|
470
|
+
* VHTLC.Options.nonInteractiveParameters} exactly, including the legacy selector:
|
|
471
|
+
* a row funded before the timelocked refund leaf shipped round-trips with
|
|
472
|
+
* `legacy: "preTimelockedRefund"` and re-derives its eight-leaf shape.
|
|
473
|
+
*/
|
|
474
|
+
nonInteractiveParameters?: {
|
|
489
475
|
receiverPkScript: Uint8Array;
|
|
490
476
|
emulatorPubkey: Uint8Array;
|
|
491
|
-
/** @see VHTLC.Options.nonInteractiveClaim.strict */
|
|
492
|
-
strict?: {
|
|
493
|
-
amount: bigint;
|
|
494
|
-
assetAmount?: bigint;
|
|
495
|
-
};
|
|
496
|
-
};
|
|
497
|
-
/** @see VHTLC.Options.nonInteractiveRefund */
|
|
498
|
-
nonInteractiveRefund?: {
|
|
499
477
|
senderPkScript: Uint8Array;
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
withoutReceiver?: boolean;
|
|
478
|
+
/** @see VHTLC.Options.nonInteractiveParameters.legacy */
|
|
479
|
+
legacy?: "preTimelockedRefund";
|
|
503
480
|
};
|
|
504
481
|
}
|
|
505
482
|
/**
|
|
506
483
|
* Handler for {@link VHTLC.ScriptV2} — the VHTLC whose preimage leaves carry an
|
|
507
484
|
* explicit `OP_SIZE 32 OP_EQUALVERIFY` before the hash check, and which the RFQ
|
|
508
|
-
* swap corridor builds (`@arkade-os/swap`'s `
|
|
485
|
+
* swap corridor builds (`@arkade-os/swap`'s `lightningSendContract`).
|
|
509
486
|
*
|
|
510
487
|
* **Why a separate type string rather than a flag on `vhtlc`.** A handler's
|
|
511
488
|
* `type` names the script class it derives, the way every other registered type
|
|
@@ -564,7 +541,7 @@ declare const VHTLCV2ContractHandler: ContractHandler<VHTLCV2ContractParams, VHT
|
|
|
564
541
|
* (`pubKey` / `serverPubKey` / `csvTimelock`) rather than inventing
|
|
565
542
|
* boarding-specific names — the boarding semantics come from the
|
|
566
543
|
* contract type and from populating `csvTimelock` with the server's
|
|
567
|
-
* boarding-exit delay (`
|
|
544
|
+
* boarding-exit delay (`ArkadeInfo.boardingExitDelay`) instead of the
|
|
568
545
|
* offchain unilateral-exit delay.
|
|
569
546
|
*/
|
|
570
547
|
type BoardingContractParams = DefaultContractParams;
|
|
@@ -580,8 +557,8 @@ type BoardingContractParams = DefaultContractParams;
|
|
|
580
557
|
*
|
|
581
558
|
* Boarding semantics come entirely from the contract type and from
|
|
582
559
|
* sourcing the CSV timelock from the server's boarding-exit delay
|
|
583
|
-
* (`
|
|
584
|
-
* offchain `default` contract is built from `
|
|
560
|
+
* (`ArkadeInfo.boardingExitDelay`), not from renamed parameters. The
|
|
561
|
+
* offchain `default` contract is built from `ArkadeInfo.unilateralExitDelay`
|
|
585
562
|
* instead, so the two share a script shape but differ in their CSV
|
|
586
563
|
* timelock value. Parameters round-trip through the same
|
|
587
564
|
* `timelockToSequence` / `sequenceToTimelock` helpers and BIP68 sequence
|