@arkade-os/sdk 0.4.34 → 0.4.36
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/dist/adapters/expo.cjs +4 -4
- package/dist/adapters/expo.d.cts +2 -2
- package/dist/adapters/expo.d.ts +2 -2
- package/dist/adapters/expo.js +2 -2
- package/dist/adapters/indexedDB.cjs +3 -3
- package/dist/adapters/indexedDB.js +2 -2
- package/dist/{ark-Dsv5Jq4E.d.cts → ark-D6sau_6-.d.cts} +458 -3
- package/dist/{ark-Dsv5Jq4E.d.ts → ark-D6sau_6-.d.ts} +458 -3
- package/dist/{asyncStorageTaskQueue-D92ch8yI.d.cts → asyncStorageTaskQueue-CpC027t_.d.cts} +2 -2
- package/dist/{asyncStorageTaskQueue-BH-zuth5.d.ts → asyncStorageTaskQueue-GT8fmPUG.d.ts} +2 -2
- package/dist/{chunk-FXFBPXV3.js → chunk-2JJKX2RK.js} +139 -41
- package/dist/chunk-2JJKX2RK.js.map +1 -0
- package/dist/{chunk-CCLNFHJ5.cjs → chunk-2XE5BSIY.cjs} +16 -10
- package/dist/chunk-2XE5BSIY.cjs.map +1 -0
- package/dist/{chunk-ZS3OZHC7.cjs → chunk-A5PY4NBP.cjs} +7 -7
- package/dist/{chunk-ZS3OZHC7.cjs.map → chunk-A5PY4NBP.cjs.map} +1 -1
- package/dist/{chunk-FSAXPBGP.cjs → chunk-C6OODRWD.cjs} +143 -40
- package/dist/chunk-C6OODRWD.cjs.map +1 -0
- package/dist/{chunk-HFXEUW55.js → chunk-HBPKIIMN.js} +1472 -202
- package/dist/chunk-HBPKIIMN.js.map +1 -0
- package/dist/{chunk-5WDBHWX3.js → chunk-KZV3FJJR.js} +10 -4
- package/dist/chunk-KZV3FJJR.js.map +1 -0
- package/dist/{chunk-XCHBQVMK.cjs → chunk-TUSGEWOX.cjs} +1540 -265
- package/dist/chunk-TUSGEWOX.cjs.map +1 -0
- package/dist/{chunk-VVGD3JIP.js → chunk-Z2VRVZW4.js} +3 -3
- package/dist/{chunk-VVGD3JIP.js.map → chunk-Z2VRVZW4.js.map} +1 -1
- package/dist/contracts/handlers/index.d.cts +3 -3
- package/dist/contracts/handlers/index.d.ts +3 -3
- package/dist/{delegate-BaS5SCIW.d.cts → delegate-C-L6gSZx.d.cts} +1 -1
- package/dist/{delegate-Baz_hb83.d.ts → delegate-De5__fpZ.d.ts} +1 -1
- package/dist/{index-FwXZveaX.d.ts → index-BETdjE_o.d.ts} +2 -2
- package/dist/{index-lNZ6qaO3.d.cts → index-jwQfHP6D.d.cts} +2 -2
- package/dist/index.cjs +129 -105
- package/dist/index.d.cts +69 -9
- package/dist/index.d.ts +69 -9
- package/dist/index.js +2 -2
- package/dist/repositories/realm/index.cjs +12 -12
- package/dist/repositories/realm/index.cjs.map +1 -1
- package/dist/repositories/realm/index.d.cts +2 -2
- package/dist/repositories/realm/index.d.ts +2 -2
- package/dist/repositories/realm/index.js +3 -3
- package/dist/repositories/realm/index.js.map +1 -1
- package/dist/repositories/sqlite/index.cjs +11 -11
- package/dist/repositories/sqlite/index.d.cts +1 -1
- package/dist/repositories/sqlite/index.d.ts +1 -1
- package/dist/repositories/sqlite/index.js +2 -2
- package/dist/{taskRunner-vFRA3F9b.d.cts → taskRunner-DCyp6Gea.d.cts} +2 -2
- package/dist/{taskRunner-B1NUWyWR.d.ts → taskRunner-DnxtObeq.d.ts} +2 -2
- package/dist/wallet/expo/background.cjs +12 -12
- package/dist/wallet/expo/background.d.cts +3 -3
- package/dist/wallet/expo/background.d.ts +3 -3
- package/dist/wallet/expo/background.js +4 -4
- package/dist/wallet/expo/index.cjs +11 -11
- package/dist/wallet/expo/index.d.cts +4 -4
- package/dist/wallet/expo/index.d.ts +4 -4
- package/dist/wallet/expo/index.js +3 -3
- package/dist/{wallet-D6uoBLmS.d.ts → wallet-BWHbd5b1.d.cts} +231 -8
- package/dist/{wallet-By9HIo0Q.d.cts → wallet-Bth5uucA.d.ts} +231 -8
- package/dist/worker/expo/index.cjs +7 -7
- package/dist/worker/expo/index.d.cts +4 -4
- package/dist/worker/expo/index.d.ts +4 -4
- package/dist/worker/expo/index.js +3 -3
- package/package.json +2 -2
- package/dist/chunk-5WDBHWX3.js.map +0 -1
- package/dist/chunk-CCLNFHJ5.cjs.map +0 -1
- package/dist/chunk-FSAXPBGP.cjs.map +0 -1
- package/dist/chunk-FXFBPXV3.js.map +0 -1
- package/dist/chunk-HFXEUW55.js.map +0 -1
- package/dist/chunk-XCHBQVMK.cjs.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Transaction } from '@scure/btc-signer';
|
|
2
2
|
import { Bytes } from '@scure/btc-signer/utils.js';
|
|
3
|
-
import { B as BatchStartedEvent,
|
|
3
|
+
import { B as BatchStartedEvent, v as TreeSigningStartedEvent, w as TxTree, x as TreeNoncesEvent, y as BatchFinalizationEvent, z as BatchFinalizedEvent, D as BatchFailedEvent, F as TreeTxEvent, H as TreeSignatureEvent, h as SettlementEvent, b as WalletConfig, W as WalletRepository, C as ContractRepository, J as DescriptorProvider, e as IContractManager, K as IReadonlyWallet, L as ReadonlyIdentity, N as Network, O as OnchainProvider, n as IndexerProvider, M as DelegateProvider, P as ReadonlyWalletConfig, o as RelativeTimelock, Q as IReadonlyAssetManager, m as ArkProvider, U as NetworkName, X as ArkInfo, Y as ArkAddress, c as WalletBalance, G as GetVtxosFilter, E as ExtendedVirtualCoin, A as ArkTransaction, d as ExtendedCoin, Z as Coin, _ as ContractManager, I as IWallet, a as Identity, $ as CSVMultisigTapscript, a0 as SettlementConfig, i as IAssetManager, a1 as VtxoManager, f as IDelegateManager, S as SendBitcoinParams, g as SettleParams, R as Recipient, a2 as SignerSession, a3 as SignedIntent, a4 as Intent } from './ark-D6sau_6-.cjs';
|
|
4
4
|
import { TransactionOutput } from '@scure/btc-signer/psbt.js';
|
|
5
|
-
import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-
|
|
5
|
+
import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-C-L6gSZx.cjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Batch namespace provides utilities for joining and processing batch session.
|
|
@@ -348,6 +348,15 @@ declare class WalletReceiveRotator {
|
|
|
348
348
|
* needs to call this directly.
|
|
349
349
|
*/
|
|
350
350
|
drain(): Promise<void>;
|
|
351
|
+
/**
|
|
352
|
+
* Run `fn` on the rotator's serialization chain, so it cannot interleave
|
|
353
|
+
* with a receive `rotate()`. Used by {@link Wallet.rotateServerSigner} to
|
|
354
|
+
* serialize server-signer rotation against HD receive rotation: both
|
|
355
|
+
* rebuild and swap `offchainTapscript`, so running them concurrently could
|
|
356
|
+
* tear the wallet's visible receive state. The chain keeps advancing even
|
|
357
|
+
* if `fn` rejects (its own caller still sees the rejection).
|
|
358
|
+
*/
|
|
359
|
+
runExclusive<T>(fn: () => Promise<T>): Promise<T>;
|
|
351
360
|
/**
|
|
352
361
|
* Tear down the subscription first so no late `vtxo_received` event
|
|
353
362
|
* can queue work on a disposing wallet, then drain any in-flight
|
|
@@ -385,12 +394,29 @@ type IncomingFunds = {
|
|
|
385
394
|
spentVtxos: ExtendedVirtualCoin[];
|
|
386
395
|
};
|
|
387
396
|
|
|
397
|
+
/**
|
|
398
|
+
* Boarding UTXOs grouped by the boarding address they sit on, carrying that
|
|
399
|
+
* address's signer association explicitly. Returned by
|
|
400
|
+
* {@link ReadonlyWallet.getBoardingUtxosForSigners} because a flat
|
|
401
|
+
* {@link ExtendedCoin} cannot carry the signer: it retains only the encoded
|
|
402
|
+
* leaves/tapTree the spend needs, not the owning `DefaultVtxo.Script` (and so
|
|
403
|
+
* not its `serverPubKey` or CSV delay). The deprecated-signer boarding
|
|
404
|
+
* classification reads both back from this group (Section 7).
|
|
405
|
+
*/
|
|
406
|
+
interface BoardingUtxoGroup {
|
|
407
|
+
/** Tapscript of the boarding address the coins sit on. */
|
|
408
|
+
tapscript: DefaultVtxo.Script;
|
|
409
|
+
/** Server key of that address, normalized x-only hex. */
|
|
410
|
+
serverPubKey: string;
|
|
411
|
+
/** CSV exit timelock decoded from THIS tapscript's exit leaf. */
|
|
412
|
+
csvTimelock: RelativeTimelock;
|
|
413
|
+
coins: ExtendedCoin[];
|
|
414
|
+
}
|
|
388
415
|
declare class ReadonlyWallet implements IReadonlyWallet {
|
|
389
416
|
readonly identity: ReadonlyIdentity;
|
|
390
417
|
readonly network: Network;
|
|
391
418
|
readonly onchainProvider: OnchainProvider;
|
|
392
419
|
readonly indexerProvider: IndexerProvider;
|
|
393
|
-
readonly arkServerPublicKey: Bytes;
|
|
394
420
|
readonly dustAmount: bigint;
|
|
395
421
|
readonly walletRepository: WalletRepository;
|
|
396
422
|
readonly contractRepository: ContractRepository;
|
|
@@ -399,7 +425,6 @@ declare class ReadonlyWallet implements IReadonlyWallet {
|
|
|
399
425
|
private _contractManagerInitializing?;
|
|
400
426
|
protected readonly watcherConfig?: ReadonlyWalletConfig["watcherConfig"];
|
|
401
427
|
private readonly _assetManager;
|
|
402
|
-
private _syncVtxosInflight?;
|
|
403
428
|
readonly walletContractTimelocks: RelativeTimelock[];
|
|
404
429
|
protected _pendingSpendOutpoints: Set<string>;
|
|
405
430
|
get assetManager(): IReadonlyAssetManager;
|
|
@@ -421,13 +446,63 @@ declare class ReadonlyWallet implements IReadonlyWallet {
|
|
|
421
446
|
* it stays the index-0 baseline for their lifetime.
|
|
422
447
|
*/
|
|
423
448
|
protected _boardingTapscript: DefaultVtxo.Script;
|
|
449
|
+
/**
|
|
450
|
+
* Backing field for the active server signer (x-only, 32 bytes). Read via
|
|
451
|
+
* the public {@link arkServerPublicKey} getter; written only by
|
|
452
|
+
* {@link Wallet.setArkServerPublicKeyForRotation}, the sanctioned
|
|
453
|
+
* server-signer rotation write path (analogue of `_offchainTapscript`). It
|
|
454
|
+
* is a *current value*, not a fixed constructor constant, because
|
|
455
|
+
* mid-session server-signer rotation (plan §4) swaps it when arkd rotates
|
|
456
|
+
* its active signer. Wallets that never span a rotation keep their
|
|
457
|
+
* construction-time snapshot for their lifetime.
|
|
458
|
+
*/
|
|
459
|
+
protected _arkServerPublicKey: Bytes;
|
|
424
460
|
protected constructor(identity: ReadonlyIdentity, network: Network, onchainProvider: OnchainProvider, 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[]);
|
|
461
|
+
/**
|
|
462
|
+
* x-only hex of the operator's deprecated signer keys (from
|
|
463
|
+
* `ArkInfo.deprecatedSigners`), cached for the OFFLINE read/watch paths.
|
|
464
|
+
* The boarding watch/history surfaces ({@link getBoardingAddresses},
|
|
465
|
+
* {@link getBoardingTxs}) fan out over {current} ∪ this set so a deposit at
|
|
466
|
+
* a boarding address minted under a now-rotated operator signer keeps being
|
|
467
|
+
* watched. Refreshed from the server-info snapshot at construction (via the
|
|
468
|
+
* create() factories) and on a detected signer change. Deliberately NOT
|
|
469
|
+
* consulted by the spend path — {@link getBoardingUtxos} stays
|
|
470
|
+
* current-signer-only (a deprecated-signer input in a plain settle() is
|
|
471
|
+
* rejected; old-signer recovery goes through the migration API).
|
|
472
|
+
*/
|
|
473
|
+
protected _deprecatedSigners: Map<string, bigint>;
|
|
474
|
+
/**
|
|
475
|
+
* Refresh the cached deprecated-signer set from a fresh server-info
|
|
476
|
+
* snapshot. Called by the create() factories at construction and by the
|
|
477
|
+
* server-info-change handler mid-session. Lenient: a malformed deprecated
|
|
478
|
+
* entry is skipped, never fatal to wallet creation.
|
|
479
|
+
*/
|
|
480
|
+
refreshDeprecatedSigners(info: {
|
|
481
|
+
deprecatedSigners?: readonly {
|
|
482
|
+
pubkey?: string;
|
|
483
|
+
cutoffDate?: bigint;
|
|
484
|
+
}[];
|
|
485
|
+
}): void;
|
|
486
|
+
/**
|
|
487
|
+
* The signer set the boarding WATCH/HISTORY paths fan out over: the wallet's
|
|
488
|
+
* current signer plus every cached deprecated signer. Distinct from the
|
|
489
|
+
* spend path, which is current-signer-only.
|
|
490
|
+
*/
|
|
491
|
+
protected watchedBoardingSigners(): Set<string>;
|
|
425
492
|
/**
|
|
426
493
|
* Currently-active receive tapscript. Read-only from the outside;
|
|
427
494
|
* mutated only via {@link Wallet.setOffchainTapscriptForRotation}
|
|
428
495
|
* by {@link WalletReceiveRotator.rotate}.
|
|
429
496
|
*/
|
|
430
497
|
get offchainTapscript(): DefaultVtxo.Script | DelegateVtxo.Script;
|
|
498
|
+
/**
|
|
499
|
+
* The wallet's current active server signer (x-only, 32 bytes). Read-only
|
|
500
|
+
* from the outside; mutated only via
|
|
501
|
+
* {@link Wallet.setArkServerPublicKeyForRotation} during mid-session
|
|
502
|
+
* server-signer rotation (plan §4). Single-valued for wallets that never
|
|
503
|
+
* span a rotation.
|
|
504
|
+
*/
|
|
505
|
+
get arkServerPublicKey(): Bytes;
|
|
431
506
|
/**
|
|
432
507
|
* The wallet's current boarding tapscript (the on-chain onboarding
|
|
433
508
|
* target). Read-only from the outside; mutated only via
|
|
@@ -508,6 +583,15 @@ declare class ReadonlyWallet implements IReadonlyWallet {
|
|
|
508
583
|
* @param filter - Optional flags controlling whether recoverable or unrolled VTXOs are included
|
|
509
584
|
*/
|
|
510
585
|
getVtxos(filter?: GetVtxosFilter): Promise<ExtendedVirtualCoin[]>;
|
|
586
|
+
/**
|
|
587
|
+
* Outpoints of VTXOs whose deprecated signer is past its cutoff (EXPIRED) and
|
|
588
|
+
* which have not yet been swept — unspendable until they recover. Offline:
|
|
589
|
+
* classifies the repo's contracts against the cached signer set (active +
|
|
590
|
+
* {@link _deprecatedSigners}, cutoffs included). Empty fast-path when no
|
|
591
|
+
* signer is deprecated. Consumed by {@link getBalance} (the `pendingRecovery`
|
|
592
|
+
* bucket) and the send coin-selection path so neither counts nor spends them.
|
|
593
|
+
*/
|
|
594
|
+
pendingRecoveryOutpoints(): Promise<Set<string>>;
|
|
511
595
|
/**
|
|
512
596
|
* Return wallet transaction history derived from Arkade state and boarding transactions.
|
|
513
597
|
*/
|
|
@@ -544,14 +628,43 @@ declare class ReadonlyWallet implements IReadonlyWallet {
|
|
|
544
628
|
* Always includes the index-0 baseline (identity x-only key), which covers
|
|
545
629
|
* the degenerate equal-delay case where the index-0 boarding row is
|
|
546
630
|
* coalesced onto a `default` row and so isn't a `boarding`-typed contract.
|
|
631
|
+
*
|
|
632
|
+
* @param allowedSigners - Optional set of x-only-hex server keys whose
|
|
633
|
+
* persisted boarding rows are included. Defaults to `{current x-only
|
|
634
|
+
* signer}`, preserving today's current-signer-only discovery (and the
|
|
635
|
+
* foreign-ASP guard). The deprecated-signer migration path widens this to
|
|
636
|
+
* reach old-signer boarding addresses. The index-0 baseline and the
|
|
637
|
+
* current display tapscript are always included regardless of the set.
|
|
547
638
|
*/
|
|
548
|
-
protected getBoardingTapscripts(): Promise<DefaultVtxo.Script[]>;
|
|
639
|
+
protected getBoardingTapscripts(allowedSigners?: Set<string>): Promise<DefaultVtxo.Script[]>;
|
|
640
|
+
/**
|
|
641
|
+
* Fetch and cache onchain inputs (UTXOs) received at the boarding addresses
|
|
642
|
+
* of the given signer set, grouped per boarding address so the caller keeps
|
|
643
|
+
* the address↔signer association that {@link ExtendedCoin} cannot carry
|
|
644
|
+
* (it retains only the encoded leaves/tapTree the spend needs, not the
|
|
645
|
+
* `DefaultVtxo.Script` and its `serverPubKey`/CSV delay).
|
|
646
|
+
*
|
|
647
|
+
* Per group it does exactly what {@link getBoardingUtxos} does per tapscript:
|
|
648
|
+
* `getCoins` → {@link extendCoinWithTapscript} → `saveUtxos`. Offline-first:
|
|
649
|
+
* it does not call `getInfo()`; the caller supplies the allowed signer set,
|
|
650
|
+
* so the only network calls are the per-address `getCoins`.
|
|
651
|
+
*
|
|
652
|
+
* @param allowedSigners - x-only-hex server keys whose boarding addresses to
|
|
653
|
+
* fetch (passed through to {@link getBoardingTapscripts}).
|
|
654
|
+
*/
|
|
655
|
+
getBoardingUtxosForSigners(allowedSigners: Set<string>): Promise<BoardingUtxoGroup[]>;
|
|
549
656
|
/**
|
|
550
657
|
* Fetch and cache onchain inputs (UTXOs) received at the wallet's boarding
|
|
551
658
|
* addresses — the current address plus any historical rotated boarding
|
|
552
659
|
* addresses that still hold unspent UTXOs (plan §6-III.1). Each UTXO is
|
|
553
660
|
* annotated with the tapscript of the address it actually sits on, so the
|
|
554
661
|
* spending path forfeits / exits it with the correct per-index leaves.
|
|
662
|
+
*
|
|
663
|
+
* Current-signer only: a flatten of {@link getBoardingUtxosForSigners} over
|
|
664
|
+
* the wallet's current signer, so the two paths cannot drift. Old-signer
|
|
665
|
+
* boarding recovery goes through the deprecated-signer migration API
|
|
666
|
+
* instead (it would otherwise pull EXPIRED-signer inputs into a plain
|
|
667
|
+
* `settle()` that the server must reject).
|
|
555
668
|
*/
|
|
556
669
|
getBoardingUtxos(): Promise<ExtendedCoin[]>;
|
|
557
670
|
/**
|
|
@@ -651,7 +764,6 @@ declare class ReadonlyWallet implements IReadonlyWallet {
|
|
|
651
764
|
*/
|
|
652
765
|
declare class Wallet extends ReadonlyWallet implements IWallet {
|
|
653
766
|
readonly arkProvider: ArkProvider;
|
|
654
|
-
readonly serverUnrollScript: CSVMultisigTapscript.Type;
|
|
655
767
|
readonly forfeitOutputScript: Bytes;
|
|
656
768
|
readonly forfeitPubkey: Bytes;
|
|
657
769
|
static MIN_FEE_RATE: number;
|
|
@@ -669,6 +781,29 @@ declare class Wallet extends ReadonlyWallet implements IWallet {
|
|
|
669
781
|
* the contract manager is up first.
|
|
670
782
|
*/
|
|
671
783
|
private _receiveRotator?;
|
|
784
|
+
/**
|
|
785
|
+
* Unsubscribe handle for the arkProvider's `onServerInfoChanged` stream
|
|
786
|
+
* (mid-session signer-rotation detection). Torn down in {@link dispose}.
|
|
787
|
+
*/
|
|
788
|
+
private _serverInfoUnsub?;
|
|
789
|
+
/**
|
|
790
|
+
* Tail of the serialized {@link handleServerInfoChanged} chain. Each
|
|
791
|
+
* `onServerInfoChanged` event chains onto it so handlers run one at a time,
|
|
792
|
+
* and {@link dispose} awaits it so an in-flight re-derive/rotation settles
|
|
793
|
+
* before the contract manager is torn down underneath it.
|
|
794
|
+
*/
|
|
795
|
+
private _serverInfoInFlight;
|
|
796
|
+
/**
|
|
797
|
+
* React to a mid-session server-info change (driven by the arkProvider's
|
|
798
|
+
* `DIGEST_MISMATCH` detection). First refresh the cached deprecated-signer
|
|
799
|
+
* set so the boarding WATCH path immediately widens to the just-deprecated
|
|
800
|
+
* signer, then — only if the active signer actually changed — rotate the
|
|
801
|
+
* wallet onto it via {@link rotateServerSigner} (re-deriving the offchain +
|
|
802
|
+
* boarding display tapscripts and registering the current-signer rows).
|
|
803
|
+
* Old-signer rows stay active, so existing funds remain watched. Failures
|
|
804
|
+
* are logged, never thrown back into the provider's emit loop.
|
|
805
|
+
*/
|
|
806
|
+
private handleServerInfoChanged;
|
|
672
807
|
private _receiveRotatorInstalled;
|
|
673
808
|
/**
|
|
674
809
|
* Descriptor-aware signer used by {@link _signerRouter} to sign
|
|
@@ -693,6 +828,38 @@ declare class Wallet extends ReadonlyWallet implements IWallet {
|
|
|
693
828
|
* `boardingTapscript` as read-only.
|
|
694
829
|
*/
|
|
695
830
|
setBoardingTapscriptForRotation(tapscript: DefaultVtxo.Script): void;
|
|
831
|
+
/**
|
|
832
|
+
* @internal Sole write path for `arkServerPublicKey` after construction.
|
|
833
|
+
* Called by {@link Wallet.rotateServerSigner} once the rotated offchain and
|
|
834
|
+
* boarding contract rows have been persisted. External code must treat
|
|
835
|
+
* `arkServerPublicKey` as read-only.
|
|
836
|
+
*/
|
|
837
|
+
setArkServerPublicKeyForRotation(serverPubKey: Bytes): void;
|
|
838
|
+
/**
|
|
839
|
+
* Output script for checkpoint transactions, decoded from the server's
|
|
840
|
+
* `checkpointTapscript`. Server-controlled state: pinned at construction
|
|
841
|
+
* and re-sourced from a fresh `ArkInfo` on server-signer rotation. Read it
|
|
842
|
+
* through {@link serverUnrollScript}; write it only through
|
|
843
|
+
* {@link setServerUnrollScriptForRotation}.
|
|
844
|
+
*/
|
|
845
|
+
protected _serverUnrollScript: CSVMultisigTapscript.Type;
|
|
846
|
+
get serverUnrollScript(): CSVMultisigTapscript.Type;
|
|
847
|
+
/**
|
|
848
|
+
* @internal Sole write path for `serverUnrollScript` after construction.
|
|
849
|
+
* Called by {@link Wallet._doRotateServerSigner} with the checkpoint script
|
|
850
|
+
* sourced from the fresh `ArkInfo` that triggered the rotation, so the send
|
|
851
|
+
* path builds checkpoints against the new server epoch. External code must
|
|
852
|
+
* treat `serverUnrollScript` as read-only.
|
|
853
|
+
*/
|
|
854
|
+
setServerUnrollScriptForRotation(script: CSVMultisigTapscript.Type): void;
|
|
855
|
+
/**
|
|
856
|
+
* Serializes {@link rotateServerSigner} for static / non-HD wallets (which
|
|
857
|
+
* have no {@link WalletReceiveRotator} chain to ride). Coalesces concurrent
|
|
858
|
+
* migration passes so two callers cannot both rebuild and swap the
|
|
859
|
+
* tapscripts. HD wallets serialize on the rotator's chain instead, via
|
|
860
|
+
* {@link WalletReceiveRotator.runExclusive}.
|
|
861
|
+
*/
|
|
862
|
+
private _serverRotationChain;
|
|
696
863
|
/**
|
|
697
864
|
* Allocate and return a *fresh* on-chain boarding address, rotating the
|
|
698
865
|
* wallet's current boarding tapscript to a new HD index.
|
|
@@ -719,6 +886,36 @@ declare class Wallet extends ReadonlyWallet implements IWallet {
|
|
|
719
886
|
* (no rotation, no index burned).
|
|
720
887
|
*/
|
|
721
888
|
getNewBoardingAddress(): Promise<string>;
|
|
889
|
+
/**
|
|
890
|
+
* Mid-session server-signer rotation (plan §4). When arkd rotates its
|
|
891
|
+
* active signer mid-session — the case the long-lived service worker and
|
|
892
|
+
* Expo background processes that own automatic migration must handle — a
|
|
893
|
+
* wallet constructed before the rotation keeps deriving old-signer receive
|
|
894
|
+
* addresses. Building a migration output to such an address would produce a
|
|
895
|
+
* VTXO the server must reject, so the wallet must first re-derive its own
|
|
896
|
+
* receive state under the new active signer.
|
|
897
|
+
*
|
|
898
|
+
* Follows the {@link WalletReceiveRotator.rotate} write-path pattern with
|
|
899
|
+
* the server key swapped instead of the user key: build the new offchain
|
|
900
|
+
* and boarding tapscripts locally (preserving every other option),
|
|
901
|
+
* register the matching `default`/`delegate` and `boarding` contract rows
|
|
902
|
+
* through {@link ContractManager.createContract}, and only then commit the
|
|
903
|
+
* new tapscripts and server key to the wallet's visible state. The signing
|
|
904
|
+
* metadata of the current receive/boarding rows is carried onto the new
|
|
905
|
+
* rows so a rotated (descriptor-backed) receive pubkey can still sign.
|
|
906
|
+
*
|
|
907
|
+
* The old-signer contract rows are intentionally left `active` and watched
|
|
908
|
+
* — they are exactly the deprecated-signer contracts the migration pass
|
|
909
|
+
* drains. Idempotent: a no-op when the wallet already tracks `xonly`.
|
|
910
|
+
*
|
|
911
|
+
* Serialized against HD receive rotation so the two paths (both of which
|
|
912
|
+
* rebuild and swap `offchainTapscript`) cannot interleave.
|
|
913
|
+
*
|
|
914
|
+
* @internal Invoked by the {@link VtxoManager} migration pass; not part of
|
|
915
|
+
* the stable public API.
|
|
916
|
+
*/
|
|
917
|
+
rotateServerSigner(newServerPubKey: Bytes, checkpointTapscript: string): Promise<void>;
|
|
918
|
+
private _doRotateServerSigner;
|
|
722
919
|
/**
|
|
723
920
|
* Async mutex that serializes all operations submitting VTXOs to the Arkade
|
|
724
921
|
* server (`settle`, `send`, `sendBitcoin`). This prevents VtxoManager's
|
|
@@ -911,12 +1108,38 @@ declare class Wallet extends ReadonlyWallet implements IWallet {
|
|
|
911
1108
|
*/
|
|
912
1109
|
send(...args: [Recipient, ...Recipient[]]): Promise<string>;
|
|
913
1110
|
private _sendImpl;
|
|
1111
|
+
/**
|
|
1112
|
+
* Shared tail of every Ark-transaction spend path (`send`, selected-VTXO
|
|
1113
|
+
* `sendBitcoin`, and {@link sendSelectedVtxosToSelf}): hide the inputs from
|
|
1114
|
+
* concurrent `getVtxos()`, build+submit the offchain tx, persist the spent
|
|
1115
|
+
* inputs and any wallet-owned (change / self) output, then release the
|
|
1116
|
+
* pending-spend hold. Callers own coin selection, output construction, and
|
|
1117
|
+
* the synchronous epoch snapshot; this owns the submit/persist sequence.
|
|
1118
|
+
*/
|
|
1119
|
+
private _submitOffchainSpend;
|
|
1120
|
+
/**
|
|
1121
|
+
* @internal Migration primitive (deprecated-signer plan, step 1). Spend an
|
|
1122
|
+
* explicit set of the wallet's own deprecated-signer VTXOs into a single
|
|
1123
|
+
* full-value output on the wallet's *active* signer, through the Ark send
|
|
1124
|
+
* path (not `settle`) so arkd builds checkpoints against the active server
|
|
1125
|
+
* epoch. Consumed in-process by {@link VtxoManager}'s migration pass; not
|
|
1126
|
+
* part of the public `IWallet` API and never accepts boarding `ExtendedCoin`
|
|
1127
|
+
* inputs.
|
|
1128
|
+
*
|
|
1129
|
+
* The caller (`migrateCore`) must have already moved the wallet onto the
|
|
1130
|
+
* active signer (`ensureReceiveOnActiveSigner`) and sized the batch (caps +
|
|
1131
|
+
* dust floor); this method validates the inputs, preserves all input assets
|
|
1132
|
+
* on the self output, and persists the new active-signer VTXO even though
|
|
1133
|
+
* there is no separate change output. It records no `TxSent` history — the
|
|
1134
|
+
* funds never leave the wallet.
|
|
1135
|
+
*/
|
|
1136
|
+
sendSelectedVtxosToSelf(inputs: ExtendedVirtualCoin[]): Promise<string>;
|
|
914
1137
|
/**
|
|
915
1138
|
* Build an offchain transaction from the given inputs and outputs,
|
|
916
1139
|
* sign it, submit to the Arkade provider, and finalize.
|
|
917
1140
|
* @returns The Arkade transaction id and server-signed checkpoint PSBTs (for bookkeeping)
|
|
918
1141
|
*/
|
|
919
|
-
buildAndSubmitOffchainTx(inputs: ExtendedVirtualCoin[], outputs: TransactionOutput[]): Promise<{
|
|
1142
|
+
buildAndSubmitOffchainTx(inputs: ExtendedVirtualCoin[], outputs: TransactionOutput[], serverUnrollScript?: CSVMultisigTapscript.Type): Promise<{
|
|
920
1143
|
arkTxid: string;
|
|
921
1144
|
signedCheckpointTxs: string[];
|
|
922
1145
|
}>;
|
|
@@ -930,4 +1153,4 @@ declare class Wallet extends ReadonlyWallet implements IWallet {
|
|
|
930
1153
|
*/
|
|
931
1154
|
declare function waitForIncomingFunds(wallet: Wallet): Promise<IncomingFunds>;
|
|
932
1155
|
|
|
933
|
-
export { Batch as B, type IncomingFunds as I, ReadonlyWallet as R, Wallet as W, type ReceiveRotatorFactory as a, type ReceiveRotatorBootOpts as b, type ReceiveRotatorBoot as c, waitForIncomingFunds as w };
|
|
1156
|
+
export { Batch as B, type IncomingFunds as I, ReadonlyWallet as R, Wallet as W, type ReceiveRotatorFactory as a, type ReceiveRotatorBootOpts as b, type ReceiveRotatorBoot as c, type BoardingUtxoGroup as d, waitForIncomingFunds as w };
|