@arkade-os/sdk 0.4.33 → 0.4.35
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 +1 -1
- 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/{ark-DEsDMYGv.d.cts → ark-D6sau_6-.d.cts} +522 -9
- package/dist/{ark-DEsDMYGv.d.ts → ark-D6sau_6-.d.ts} +522 -9
- package/dist/{asyncStorageTaskQueue-D8T1VXEx.d.cts → asyncStorageTaskQueue-CpC027t_.d.cts} +2 -2
- package/dist/{asyncStorageTaskQueue-CMrTYlKG.d.ts → asyncStorageTaskQueue-GT8fmPUG.d.ts} +2 -2
- package/dist/{chunk-E22HEKLN.js → chunk-3JR77WQ4.js} +140 -42
- package/dist/chunk-3JR77WQ4.js.map +1 -0
- package/dist/{chunk-WMIPYZSB.cjs → chunk-CMPJR3HS.cjs} +42 -9
- package/dist/chunk-CMPJR3HS.cjs.map +1 -0
- package/dist/{chunk-AOJUURHM.js → chunk-CUSABEUQ.js} +141 -37
- package/dist/chunk-CUSABEUQ.js.map +1 -0
- package/dist/{chunk-HAVA4XB7.cjs → chunk-FM7T7JVL.cjs} +7 -7
- package/dist/{chunk-HAVA4XB7.cjs.map → chunk-FM7T7JVL.cjs.map} +1 -1
- package/dist/{chunk-GYSK5R57.cjs → chunk-GUTKJMSF.cjs} +164 -59
- package/dist/chunk-GUTKJMSF.cjs.map +1 -0
- package/dist/{chunk-7K3ROJF6.cjs → chunk-H2LX2KKY.cjs} +2161 -466
- package/dist/chunk-H2LX2KKY.cjs.map +1 -0
- package/dist/{chunk-DSS2GQUG.js → chunk-NOR7XOKN.js} +2021 -331
- package/dist/chunk-NOR7XOKN.js.map +1 -0
- package/dist/{chunk-BU3BU6XK.js → chunk-OURFR4UR.js} +3 -3
- package/dist/{chunk-BU3BU6XK.js.map → chunk-OURFR4UR.js.map} +1 -1
- package/dist/{chunk-TU3LVAPX.js → chunk-OUVTG72A.js} +43 -11
- package/dist/chunk-OUVTG72A.js.map +1 -0
- package/dist/{chunk-5CCRRL5S.cjs → chunk-VYS3KGRI.cjs} +19 -13
- package/dist/chunk-VYS3KGRI.cjs.map +1 -0
- package/dist/{chunk-SPDNHPM4.cjs → chunk-X2EQLK4O.cjs} +149 -46
- package/dist/chunk-X2EQLK4O.cjs.map +1 -0
- package/dist/{chunk-L6ZETTX3.js → chunk-XQS2HW4Q.js} +11 -5
- package/dist/chunk-XQS2HW4Q.js.map +1 -0
- package/dist/contracts/handlers/index.cjs +7 -7
- 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-BJeBNP5a.d.cts → delegate-C-L6gSZx.d.cts} +1 -1
- package/dist/{delegate-EXN2mfkb.d.ts → delegate-De5__fpZ.d.ts} +1 -1
- package/dist/{index-BG2ooYKO.d.ts → index-BETdjE_o.d.ts} +22 -16
- package/dist/{index-DHjEeHEp.d.cts → index-jwQfHP6D.d.cts} +22 -16
- package/dist/index.cjs +158 -130
- package/dist/index.d.cts +125 -16
- package/dist/index.d.ts +125 -16
- package/dist/index.js +4 -4
- package/dist/repositories/realm/index.cjs +14 -14
- 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 +5 -5
- package/dist/repositories/realm/index.js.map +1 -1
- package/dist/repositories/sqlite/index.cjs +13 -13
- package/dist/repositories/sqlite/index.d.cts +1 -1
- package/dist/repositories/sqlite/index.d.ts +1 -1
- package/dist/repositories/sqlite/index.js +4 -4
- package/dist/{taskRunner-pIGyarFG.d.cts → taskRunner-DCyp6Gea.d.cts} +2 -2
- package/dist/{taskRunner-B7lBU45X.d.ts → taskRunner-DnxtObeq.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 +13 -13
- package/dist/wallet/expo/index.d.cts +5 -5
- package/dist/wallet/expo/index.d.ts +5 -5
- package/dist/wallet/expo/index.js +5 -5
- package/dist/{wallet-D4Dll5Gu.d.cts → wallet-BWHbd5b1.d.cts} +388 -10
- package/dist/{wallet-C4L_X0i6.d.ts → wallet-Bth5uucA.d.ts} +388 -10
- 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 +5 -5
- package/dist/chunk-5CCRRL5S.cjs.map +0 -1
- package/dist/chunk-7K3ROJF6.cjs.map +0 -1
- package/dist/chunk-AOJUURHM.js.map +0 -1
- package/dist/chunk-DSS2GQUG.js.map +0 -1
- package/dist/chunk-E22HEKLN.js.map +0 -1
- package/dist/chunk-GYSK5R57.cjs.map +0 -1
- package/dist/chunk-L6ZETTX3.js.map +0 -1
- package/dist/chunk-SPDNHPM4.cjs.map +0 -1
- package/dist/chunk-TU3LVAPX.js.map +0 -1
- package/dist/chunk-WMIPYZSB.cjs.map +0 -1
|
@@ -454,6 +454,12 @@ declare class VtxoScript {
|
|
|
454
454
|
/**
|
|
455
455
|
* Create a virtual output script from its tapleaf scripts.
|
|
456
456
|
*
|
|
457
|
+
* The Taproot script tree is assembled using btcd's algorithm
|
|
458
|
+
* (`txscript.AssembleTaprootScriptTree`) so the derived taproot output
|
|
459
|
+
* key agrees with arkd for any leaf count. `@scure/btc-signer`'s
|
|
460
|
+
* default `taprootListToTree` is a Huffman builder that only agrees
|
|
461
|
+
* with arkd for power-of-2 leaf counts.
|
|
462
|
+
*
|
|
457
463
|
* @param scripts - Raw tapscript bytes for each leaf
|
|
458
464
|
* @throws Error if the provided leaves cannot produce a valid Taproot tree
|
|
459
465
|
*/
|
|
@@ -518,6 +524,101 @@ type EncodedVtxoScript = {
|
|
|
518
524
|
*/
|
|
519
525
|
declare function getSequence(tapLeafScript: TapLeafScript): number | undefined;
|
|
520
526
|
|
|
527
|
+
/**
|
|
528
|
+
* Machine-readable classification of a contract's server signer relative to a
|
|
529
|
+
* fresh {@link ArkInfo} snapshot. Drives both the migration selection (Section
|
|
530
|
+
* 3) and the user-facing cutoff reporting (Section 6) without persisting any
|
|
531
|
+
* stale-key metadata: staleness is always derived at read time from the
|
|
532
|
+
* contract's `params.serverPubKey` plus the server's advertised signer set.
|
|
533
|
+
*
|
|
534
|
+
* - `CURRENT`: the contract was minted under the server's active signer; no
|
|
535
|
+
* migration needed.
|
|
536
|
+
* - `MIGRATABLE`: the contract's signer is advertised as deprecated and its
|
|
537
|
+
* cutoff has not passed — cooperative migration is still possible.
|
|
538
|
+
* - `DUE_NOW`: the contract's signer is advertised as deprecated with no cutoff
|
|
539
|
+
* date (arkd advertises this as a `0n` cutoff), so migration should start
|
|
540
|
+
* immediately.
|
|
541
|
+
* - `EXPIRED`: the contract's signer is deprecated and its cutoff has passed —
|
|
542
|
+
* cooperative migration is closed. These funds are NOT stranded: the VTXO
|
|
543
|
+
* keeps its own batch expiry, the server sweeps that batch at expiry, and the
|
|
544
|
+
* swept VTXO then recovers into the active signer through the normal recovery
|
|
545
|
+
* settle (no deprecated key, no forfeit, no on-chain exit). Unilateral exit
|
|
546
|
+
* remains an opt-in escape hatch, not a requirement (Section 6 / post-cutoff).
|
|
547
|
+
* - `UNKNOWN_SIGNER`: the contract's signer is neither the active signer nor an
|
|
548
|
+
* advertised deprecated signer. The SDK does not attempt to migrate these.
|
|
549
|
+
*/
|
|
550
|
+
type SignerStatus = "CURRENT" | "MIGRATABLE" | "DUE_NOW" | "EXPIRED" | "UNKNOWN_SIGNER";
|
|
551
|
+
/**
|
|
552
|
+
* Result of classifying a single contract's server signer against the current
|
|
553
|
+
* {@link ArkInfo} signer set.
|
|
554
|
+
*/
|
|
555
|
+
interface SignerClassification {
|
|
556
|
+
status: SignerStatus;
|
|
557
|
+
/** The contract's server signer, normalized to x-only (32-byte) hex. */
|
|
558
|
+
signerPubKey: string;
|
|
559
|
+
/**
|
|
560
|
+
* Absolute cutoff as a Unix timestamp in seconds, present only when the
|
|
561
|
+
* server advertised one for this deprecated signer.
|
|
562
|
+
*/
|
|
563
|
+
cutoffDate?: bigint;
|
|
564
|
+
/**
|
|
565
|
+
* Derived seconds until the advertised cutoff (`cutoffDate - now`), present
|
|
566
|
+
* only for `MIGRATABLE`/`EXPIRED` (i.e. an advertised cutoff exists).
|
|
567
|
+
* Negative once the cutoff has passed.
|
|
568
|
+
*/
|
|
569
|
+
secondsUntilCutoff?: number;
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* The server's signer set, pre-normalized to x-only hex for cheap repeated
|
|
573
|
+
* lookups. Built once per migration/reporting pass from a fresh
|
|
574
|
+
* {@link ArkInfo} snapshot via {@link signerSetFromInfo}.
|
|
575
|
+
*/
|
|
576
|
+
interface SignerSet {
|
|
577
|
+
/** Active signer, x-only (32-byte) hex. */
|
|
578
|
+
active: string;
|
|
579
|
+
/**
|
|
580
|
+
* Deprecated signers keyed by x-only hex, mapped to their cutoff. The cutoff
|
|
581
|
+
* is always a bigint (arkd advertises it non-nullable); `0n` means "no cutoff
|
|
582
|
+
* advertised" (→ `DUE_NOW`).
|
|
583
|
+
*/
|
|
584
|
+
deprecated: Map<string, bigint>;
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* Normalize a server signer pubkey hex to the x-only (32-byte) form contract
|
|
588
|
+
* scripts and `params.serverPubKey` use. A 33-byte compressed key drops its
|
|
589
|
+
* parity prefix; a 32-byte key is canonicalized to lowercase. Mirrors the
|
|
590
|
+
* wallet's `hex.decode(info.signerPubkey).slice(1)` setup path so the active
|
|
591
|
+
* signer and the deprecated signers (which arkd may advertise compressed)
|
|
592
|
+
* compare equal to the x-only `params.serverPubKey` persisted on contracts.
|
|
593
|
+
*/
|
|
594
|
+
declare function toXOnlySignerHex(pubkeyHex: string): string;
|
|
595
|
+
/**
|
|
596
|
+
* Build the {@link SignerSet} from a server-info snapshot. Deprecated signers
|
|
597
|
+
* with an empty pubkey are skipped.
|
|
598
|
+
*/
|
|
599
|
+
declare function signerSetFromInfo(info: ArkInfo): SignerSet;
|
|
600
|
+
/**
|
|
601
|
+
* Classify a contract's server signer against a pre-built {@link SignerSet}.
|
|
602
|
+
*
|
|
603
|
+
* @param contractServerPubKeyHex - the contract's `params.serverPubKey`
|
|
604
|
+
* @param signerSet - the server's signer set
|
|
605
|
+
* @param nowSeconds - current Unix time in seconds (compared against the
|
|
606
|
+
* advertised cutoff). Defaults to `Math.floor(Date.now() / 1000)`.
|
|
607
|
+
*/
|
|
608
|
+
declare function classifyAgainstSignerSet(contractServerPubKeyHex: string, signerSet: SignerSet, nowSeconds?: number): SignerClassification;
|
|
609
|
+
/**
|
|
610
|
+
* Convenience wrapper that builds the signer set from {@link ArkInfo} and
|
|
611
|
+
* classifies a single contract signer. Prefer {@link classifyAgainstSignerSet}
|
|
612
|
+
* with a shared signer set when classifying many contracts in one pass.
|
|
613
|
+
*/
|
|
614
|
+
declare function classifyContractSigner(contractServerPubKeyHex: string, info: ArkInfo, nowSeconds?: number): SignerClassification;
|
|
615
|
+
/**
|
|
616
|
+
* Whether a signer status admits cooperative migration (i.e. a `settle()`
|
|
617
|
+
* intent should be built for VTXOs under this signer). True for `MIGRATABLE`
|
|
618
|
+
* and `DUE_NOW`; false for `CURRENT`, `EXPIRED`, and `UNKNOWN_SIGNER`.
|
|
619
|
+
*/
|
|
620
|
+
declare function isCooperativelyMigratable(status: SignerStatus): boolean;
|
|
621
|
+
|
|
521
622
|
/**
|
|
522
623
|
* Configuration options for automatic virtual output renewal
|
|
523
624
|
*
|
|
@@ -612,6 +713,24 @@ interface SettlementConfig {
|
|
|
612
713
|
* @defaultValue `60_000` (1 minute)
|
|
613
714
|
*/
|
|
614
715
|
pollIntervalMs?: number;
|
|
716
|
+
/**
|
|
717
|
+
* Automatically migrate VTXOs minted under a now-deprecated server signer
|
|
718
|
+
* back to the wallet's active-signer address before their cutoff window
|
|
719
|
+
* closes (planned arkd key rotation).
|
|
720
|
+
*
|
|
721
|
+
* When enabled, each poll cycle cooperatively migrates stale-signer VTXOs
|
|
722
|
+
* via the normal `settle()` path, applying a mid-session server-signer
|
|
723
|
+
* rotation first when the wallet's own snapshot signer has been deprecated.
|
|
724
|
+
* The explicit {@link IVtxoManager.migrateDeprecatedSignerVtxos} method
|
|
725
|
+
* remains available for manual migration regardless of this flag.
|
|
726
|
+
*
|
|
727
|
+
* Setting `settlementConfig: false` disables all background settlement,
|
|
728
|
+
* including migration. Set this field to `false` to keep renewal/sweep but
|
|
729
|
+
* skip automatic deprecated-signer migration specifically.
|
|
730
|
+
*
|
|
731
|
+
* @defaultValue `true`
|
|
732
|
+
*/
|
|
733
|
+
deprecatedSignerMigration?: boolean;
|
|
615
734
|
}
|
|
616
735
|
/**
|
|
617
736
|
* Check if a virtual output is expiring soon based on threshold
|
|
@@ -634,6 +753,147 @@ interface RenewVtxosOptions {
|
|
|
634
753
|
*/
|
|
635
754
|
thresholdSeconds?: number;
|
|
636
755
|
}
|
|
756
|
+
/**
|
|
757
|
+
* Optional arguments for {@link IVtxoManager.migrateDeprecatedSignerVtxos}.
|
|
758
|
+
*/
|
|
759
|
+
interface MigrateDeprecatedSignerOptions {
|
|
760
|
+
/** Callback to receive settlement events during the migration intent. */
|
|
761
|
+
eventCallback?: (event: SettlementEvent) => void;
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* A single VTXO referenced in a {@link DeprecatedSignerMigrationReport}.
|
|
765
|
+
*/
|
|
766
|
+
interface MigrationVtxoRef {
|
|
767
|
+
txid: string;
|
|
768
|
+
vout: number;
|
|
769
|
+
value: number;
|
|
770
|
+
/** The deprecated signer the VTXO was minted under (x-only hex). */
|
|
771
|
+
signerPubKey: string;
|
|
772
|
+
/** Absolute cutoff (Unix seconds) when the server advertised one. */
|
|
773
|
+
cutoffDate?: bigint;
|
|
774
|
+
}
|
|
775
|
+
/**
|
|
776
|
+
* Machine-readable status for a single deprecated signer the wallet holds
|
|
777
|
+
* funds under (Section 6). Derived at read time from contract params plus a
|
|
778
|
+
* fresh {@link ArkInfo} snapshot — never persisted.
|
|
779
|
+
*/
|
|
780
|
+
interface DeprecatedSignerReport {
|
|
781
|
+
/** Deprecated signer key (x-only hex). */
|
|
782
|
+
signerPubKey: string;
|
|
783
|
+
/** One of `migratable` | `dueNow` | `expired` | `unknownSigner`. */
|
|
784
|
+
status: SignerStatus;
|
|
785
|
+
/** Absolute cutoff (Unix seconds), present only when advertised. */
|
|
786
|
+
cutoffDate?: bigint;
|
|
787
|
+
/** Derived seconds until cutoff; negative once passed. */
|
|
788
|
+
secondsUntilCutoff?: number;
|
|
789
|
+
/** Number of spendable VTXOs the wallet holds under this signer. */
|
|
790
|
+
vtxoCount: number;
|
|
791
|
+
/** Total value of those VTXOs in satoshis. */
|
|
792
|
+
totalValue: number;
|
|
793
|
+
/**
|
|
794
|
+
* Number of spendable boarding UTXOs the wallet holds under this signer
|
|
795
|
+
* (Section 7). Counts every confirmed boarding coin, including those whose
|
|
796
|
+
* own CSV exit window has elapsed (they leave via the unilateral sweep).
|
|
797
|
+
*/
|
|
798
|
+
boardingCount: number;
|
|
799
|
+
/** Total value of those boarding UTXOs in satoshis (Section 7). */
|
|
800
|
+
boardingValue: number;
|
|
801
|
+
/**
|
|
802
|
+
* Expired-signer VTXOs already swept and queued for recovery to the active
|
|
803
|
+
* signer (the recover-on-sweep default — see {@link SignerStatus} `EXPIRED`).
|
|
804
|
+
* Non-zero only on `EXPIRED` rows; these drain on the next recovery pass
|
|
805
|
+
* (Section 6 / post-cutoff).
|
|
806
|
+
*/
|
|
807
|
+
recoverableCount: number;
|
|
808
|
+
recoverableValue: number;
|
|
809
|
+
/**
|
|
810
|
+
* Expired-signer VTXOs not yet swept; awaiting the server batch sweep before
|
|
811
|
+
* they become recoverable. Non-zero only on `EXPIRED` rows — nothing for the
|
|
812
|
+
* user to do but wait (Section 6 / post-cutoff).
|
|
813
|
+
*/
|
|
814
|
+
awaitingSweepCount: number;
|
|
815
|
+
awaitingSweepValue: number;
|
|
816
|
+
/**
|
|
817
|
+
* Soonest batch expiry (ms since epoch) among the awaiting-sweep VTXOs, as a
|
|
818
|
+
* recovery ETA hint. Present only when an `EXPIRED` row has awaiting-sweep
|
|
819
|
+
* VTXOs that carry a batch expiry (Section 6 / post-cutoff).
|
|
820
|
+
*/
|
|
821
|
+
nextSweepEta?: number;
|
|
822
|
+
}
|
|
823
|
+
/**
|
|
824
|
+
* Why a single migration leg (VTXO send or boarding settle) submitted nothing.
|
|
825
|
+
* `oversized-only` means every migratable input in that leg individually
|
|
826
|
+
* exceeds the server's per-output ceiling (`vtxoMaxAmount`) — see
|
|
827
|
+
* {@link MigrationLegReport.oversized}.
|
|
828
|
+
*/
|
|
829
|
+
type MigrationLegSkipReason = "below-dust" | "oversized-only";
|
|
830
|
+
/**
|
|
831
|
+
* Why the whole pass submitted nothing, before either leg was built.
|
|
832
|
+
* `no-deprecated-vtxos` means BOTH migratable sets (VTXO and boarding) were
|
|
833
|
+
* empty; `unknown-wallet-signer` means the wallet's own snapshot signer is
|
|
834
|
+
* neither active nor advertised deprecated, so the pass refuses to rotate.
|
|
835
|
+
*/
|
|
836
|
+
type MigrationGlobalSkipReason = "no-deprecated-vtxos" | "unknown-wallet-signer";
|
|
837
|
+
/**
|
|
838
|
+
* Outcome of one migration leg. The VTXO leg migrates through the Ark send path
|
|
839
|
+
* ({@link Wallet.sendSelectedVtxosToSelf}); the boarding leg keeps its
|
|
840
|
+
* settle-backed migration (boarding coins are on-chain inputs with no send
|
|
841
|
+
* path). Each leg owns its full sizing pipeline (oversized filtering, count +
|
|
842
|
+
* amount caps, its own dust floor) and reports independently — a failure or skip
|
|
843
|
+
* in one leg never suppresses the other.
|
|
844
|
+
*/
|
|
845
|
+
interface MigrationLegReport {
|
|
846
|
+
/** VTXO leg: Ark transaction id from send. Boarding leg: settle commitment txid. */
|
|
847
|
+
txid?: string;
|
|
848
|
+
/** Inputs submitted and accepted in this leg's transaction; empty on error/skip. */
|
|
849
|
+
migrated: MigrationVtxoRef[];
|
|
850
|
+
/** Why this leg submitted nothing (every candidate below dust or oversized). */
|
|
851
|
+
skipped?: MigrationLegSkipReason;
|
|
852
|
+
/**
|
|
853
|
+
* Migratable inputs deferred to a later pass by this leg's own caps (the
|
|
854
|
+
* input count {@link MAX_VTXOS_PER_SETTLEMENT} or the per-output amount
|
|
855
|
+
* ceiling `vtxoMaxAmount`). Present and non-zero only when a cap bound and
|
|
856
|
+
* the leg actually submitted; makes the truncation visible.
|
|
857
|
+
*/
|
|
858
|
+
deferred?: number;
|
|
859
|
+
/**
|
|
860
|
+
* Inputs whose value alone exceeds the per-output ceiling (`vtxoMaxAmount`):
|
|
861
|
+
* a single ≤-ceiling output can never hold them, so they never migrate
|
|
862
|
+
* cooperatively and require a unilateral exit. Present only when non-empty;
|
|
863
|
+
* absent when the server advertises no ceiling (`vtxoMaxAmount < 0`).
|
|
864
|
+
*/
|
|
865
|
+
oversized?: MigrationVtxoRef[];
|
|
866
|
+
/** Error message when this leg's submission failed; the other leg still runs. */
|
|
867
|
+
error?: string;
|
|
868
|
+
}
|
|
869
|
+
/**
|
|
870
|
+
* Result of a {@link IVtxoManager.migrateDeprecatedSignerVtxos} pass, split into
|
|
871
|
+
* two symmetric legs: VTXOs migrate through the send path, boarding UTXOs keep a
|
|
872
|
+
* separate settle-backed migration. They are never combined into one intent.
|
|
873
|
+
*/
|
|
874
|
+
interface DeprecatedSignerMigrationReport {
|
|
875
|
+
/** Whether a mid-session server-signer rotation was applied first. */
|
|
876
|
+
rotated: boolean;
|
|
877
|
+
/** Global skip; when set, neither leg is present. */
|
|
878
|
+
skipped?: MigrationGlobalSkipReason;
|
|
879
|
+
/** Send leg. Present iff ≥1 cooperatively-migratable VTXO existed this pass. */
|
|
880
|
+
vtxos?: MigrationLegReport;
|
|
881
|
+
/** Settle leg. Present iff ≥1 cooperatively-migratable boarding UTXO existed this pass. */
|
|
882
|
+
boarding?: MigrationLegReport;
|
|
883
|
+
/**
|
|
884
|
+
* Cutoff-expired inputs of both kinds (a classification outcome, not a leg
|
|
885
|
+
* outcome). Skipped because their signer cutoff has passed: cooperative
|
|
886
|
+
* migration is closed for them. They are NOT pushed to a unilateral exit —
|
|
887
|
+
* each keeps its own batch expiry, the server sweeps it at expiry, and the
|
|
888
|
+
* recovery path then re-mints it under the active signer. The per-signer
|
|
889
|
+
* sweep/recovery lifecycle is surfaced on {@link signers}
|
|
890
|
+
* ({@link DeprecatedSignerReport.recoverableCount} /
|
|
891
|
+
* {@link DeprecatedSignerReport.awaitingSweepCount}).
|
|
892
|
+
*/
|
|
893
|
+
expired: MigrationVtxoRef[];
|
|
894
|
+
/** Per-deprecated-signer status snapshot (Section 6). */
|
|
895
|
+
signers: DeprecatedSignerReport[];
|
|
896
|
+
}
|
|
637
897
|
/**
|
|
638
898
|
* VtxoManager is a unified class for managing virtual output lifecycle operations including
|
|
639
899
|
* recovery of swept/expired virtual outputs and renewal to prevent expiration.
|
|
@@ -691,6 +951,29 @@ interface IVtxoManager {
|
|
|
691
951
|
renewVtxos(eventCallback?: (event: SettlementEvent) => void, options?: RenewVtxosOptions): Promise<string>;
|
|
692
952
|
getExpiredBoardingUtxos(): Promise<ExtendedCoin[]>;
|
|
693
953
|
sweepExpiredBoardingUtxos(): Promise<string>;
|
|
954
|
+
/**
|
|
955
|
+
* Cooperatively migrate VTXOs minted under a now-deprecated server signer
|
|
956
|
+
* to the wallet's active-signer address (planned arkd key rotation).
|
|
957
|
+
*
|
|
958
|
+
* Applies a mid-session server-signer rotation first when the wallet's own
|
|
959
|
+
* snapshot signer has been deprecated, so the migration output commits to
|
|
960
|
+
* the active signer. Selects spendable VTXOs under deprecated-signer
|
|
961
|
+
* contracts, prioritizing those closest to their cutoff, and settles them
|
|
962
|
+
* back to the (rotated) Ark address. VTXOs whose cutoff has already passed
|
|
963
|
+
* are reported as `expired` rather than migrated.
|
|
964
|
+
*
|
|
965
|
+
* Available regardless of the `deprecatedSignerMigration` config flag (that
|
|
966
|
+
* flag only gates the automatic poll-loop pass).
|
|
967
|
+
*
|
|
968
|
+
* @returns A report of what was migrated, skipped, expired, or failed.
|
|
969
|
+
*/
|
|
970
|
+
migrateDeprecatedSignerVtxos(options?: MigrateDeprecatedSignerOptions): Promise<DeprecatedSignerMigrationReport>;
|
|
971
|
+
/**
|
|
972
|
+
* Machine-readable status of every deprecated server signer the wallet
|
|
973
|
+
* currently holds funds under, without performing any migration. Lets
|
|
974
|
+
* consumers surface cutoff warnings on their own schedule.
|
|
975
|
+
*/
|
|
976
|
+
getDeprecatedSignerStatus(): Promise<DeprecatedSignerReport[]>;
|
|
694
977
|
dispose(): Promise<void>;
|
|
695
978
|
}
|
|
696
979
|
declare class VtxoManager implements AsyncDisposable, IVtxoManager {
|
|
@@ -698,7 +981,6 @@ declare class VtxoManager implements AsyncDisposable, IVtxoManager {
|
|
|
698
981
|
/** @deprecated Use settlementConfig instead */
|
|
699
982
|
readonly renewalConfig?: RenewalConfig | undefined;
|
|
700
983
|
readonly settlementConfig: SettlementConfig | false;
|
|
701
|
-
private contractEventsSubscription?;
|
|
702
984
|
private readonly contractEventsSubscriptionReady;
|
|
703
985
|
private disposePromise?;
|
|
704
986
|
private pollTimeoutId?;
|
|
@@ -720,6 +1002,10 @@ declare class VtxoManager implements AsyncDisposable, IVtxoManager {
|
|
|
720
1002
|
private lastVtxoSpentRefreshTimestamp;
|
|
721
1003
|
private vtxoSpentRefreshPromise?;
|
|
722
1004
|
private static readonly VTXO_SPENT_REFRESH_COOLDOWN_MS;
|
|
1005
|
+
private lastMigrationTimestamp;
|
|
1006
|
+
private consecutiveMigrationFailures;
|
|
1007
|
+
private static readonly MIGRATION_COOLDOWN_MS;
|
|
1008
|
+
private static readonly MIGRATION_MAX_BACKOFF_MS;
|
|
723
1009
|
constructor(wallet: IWallet,
|
|
724
1010
|
/** @deprecated Use settlementConfig instead */
|
|
725
1011
|
renewalConfig?: RenewalConfig | undefined, settlementConfig?: SettlementConfig | false);
|
|
@@ -887,22 +1173,140 @@ declare class VtxoManager implements AsyncDisposable, IVtxoManager {
|
|
|
887
1173
|
* ```
|
|
888
1174
|
*/
|
|
889
1175
|
sweepExpiredBoardingUtxos(prefetchedUtxos?: ExtendedCoin[]): Promise<string>;
|
|
1176
|
+
/**
|
|
1177
|
+
* Cooperatively migrate VTXOs minted under a now-deprecated server signer
|
|
1178
|
+
* to the wallet's active-signer address. See {@link IVtxoManager}.
|
|
1179
|
+
*/
|
|
1180
|
+
migrateDeprecatedSignerVtxos(options?: MigrateDeprecatedSignerOptions): Promise<DeprecatedSignerMigrationReport>;
|
|
1181
|
+
/**
|
|
1182
|
+
* Machine-readable status of every deprecated server signer the wallet
|
|
1183
|
+
* currently holds funds under (Section 6), without migrating. Covers both
|
|
1184
|
+
* VTXO and boarding holdings (Section 7), merged per signer.
|
|
1185
|
+
*
|
|
1186
|
+
* @remarks This is no longer a pure repository/info read: surfacing boarding
|
|
1187
|
+
* holdings fans out per boarding address (`getCoins` round trips) and
|
|
1188
|
+
* refreshes the UTXO cache via `saveUtxos`.
|
|
1189
|
+
*/
|
|
1190
|
+
getDeprecatedSignerStatus(): Promise<DeprecatedSignerReport[]>;
|
|
1191
|
+
/**
|
|
1192
|
+
* Core migration routine shared by the manual API and the automatic poll
|
|
1193
|
+
* pass. Fetches a fresh {@link ArkInfo}, applies a mid-session signer
|
|
1194
|
+
* rotation when the wallet's own snapshot signer has been deprecated,
|
|
1195
|
+
* selects spendable VTXOs under deprecated-signer contracts (cutoff-first),
|
|
1196
|
+
* and settles them to the active-signer Ark address.
|
|
1197
|
+
*/
|
|
1198
|
+
private migrateCore;
|
|
1199
|
+
/**
|
|
1200
|
+
* Size and submit one migration leg. Filters inputs whose value alone
|
|
1201
|
+
* exceeds the per-output ceiling (`vtxoMaxAmount`; `< 0` means no limit) —
|
|
1202
|
+
* those can never form a ≤-ceiling output and must exit unilaterally — then
|
|
1203
|
+
* caps the rest (highest-value first; bounded by {@link MAX_VTXOS_PER_SETTLEMENT}
|
|
1204
|
+
* AND a gross total within `vtxoMaxAmount`), applies the protocol dust floor,
|
|
1205
|
+
* and submits the capped batch through `submit`. A throw from `submit` lands
|
|
1206
|
+
* in `error`; the caller's other leg still runs.
|
|
1207
|
+
*
|
|
1208
|
+
* Migration is mandatory and fee-exempt: every selected input moves at its
|
|
1209
|
+
* full value, so the gross total IS the aggregated output amount (kept under
|
|
1210
|
+
* the server ceiling by the cap). The dust floor guards the degenerate cases
|
|
1211
|
+
* where every input was oversized or the whole holding sums below dust.
|
|
1212
|
+
*/
|
|
1213
|
+
private runMigrationLeg;
|
|
1214
|
+
/**
|
|
1215
|
+
* Enumerate the wallet's `default`/`delegate` contracts, classify each
|
|
1216
|
+
* against the fresh signer set, and split their spendable VTXOs into
|
|
1217
|
+
* cooperatively-migratable and cutoff-expired sets while building the
|
|
1218
|
+
* per-signer status report. Current-signer contracts are skipped; swept
|
|
1219
|
+
* (recoverable) VTXOs are excluded from the settle sets — those follow the
|
|
1220
|
+
* recovery path — but are still counted on EXPIRED report rows
|
|
1221
|
+
* (`recoverableCount`) so post-cutoff funds in flight stay visible.
|
|
1222
|
+
*/
|
|
1223
|
+
private classifyDeprecatedSignerContracts;
|
|
1224
|
+
/**
|
|
1225
|
+
* Boarding sibling of {@link classifyDeprecatedSignerContracts} (Section 7):
|
|
1226
|
+
* fan out over the wallet's boarding addresses (current + historical), group
|
|
1227
|
+
* the on-chain UTXOs per address, classify each address's signer against the
|
|
1228
|
+
* fresh signer set, and split the confirmed boarding coins into cooperatively-
|
|
1229
|
+
* migratable and cutoff-expired sets while building the per-signer report.
|
|
1230
|
+
*
|
|
1231
|
+
* Discovery sees the active signer plus EVERY deprecated key (EXPIRED
|
|
1232
|
+
* included), so expired-signer boarding is still reported; migration
|
|
1233
|
+
* eligibility is gated afterwards by {@link isCooperativelyMigratable} and a
|
|
1234
|
+
* per-row boarding-output CSV check — never by the fetch. Current-signer
|
|
1235
|
+
* coins are classified `CURRENT` and ignored; foreign-ASP rows are excluded
|
|
1236
|
+
* because their keys are not in the signer set.
|
|
1237
|
+
*/
|
|
1238
|
+
private classifyDeprecatedSignerBoarding;
|
|
1239
|
+
/**
|
|
1240
|
+
* Automatic migration pass invoked from the poll loop. Self-contained:
|
|
1241
|
+
* respects an exponential cooldown and logs failures rather than throwing,
|
|
1242
|
+
* so a persistently failing migration backs off instead of re-submitting
|
|
1243
|
+
* an identical intent every cycle.
|
|
1244
|
+
*/
|
|
1245
|
+
private runMigrationPass;
|
|
1246
|
+
/** Asserts migration capability and returns the typed wallet. */
|
|
1247
|
+
private requireMigrationCapableWallet;
|
|
1248
|
+
/**
|
|
1249
|
+
* If the wallet's own construction-time signer snapshot has been deprecated,
|
|
1250
|
+
* re-derive its receive/boarding state under the active signer so any output
|
|
1251
|
+
* built afterwards commits to the active key. No-op when the snapshot is
|
|
1252
|
+
* already current. Returns whether a rotation was applied. Treats an
|
|
1253
|
+
* unknown-signer snapshot as "do not rotate" (caller decides).
|
|
1254
|
+
*
|
|
1255
|
+
* Shared by the migration pass (where the wallet's own snapshot is the thing
|
|
1256
|
+
* being migrated) and the recovery/renewal/periodic-settle paths (via
|
|
1257
|
+
* {@link rotateForRecoverableInputs}), so a swept old-signer VTXO recovered
|
|
1258
|
+
* after cutoff re-mints under the active signer rather than re-committing to
|
|
1259
|
+
* the deprecated key (Section 6 / post-cutoff). `rotateServerSigner` is
|
|
1260
|
+
* idempotent and serializes itself against HD receive rotation, so repeated
|
|
1261
|
+
* calls across passes are safe.
|
|
1262
|
+
*/
|
|
1263
|
+
private ensureReceiveOnActiveSigner;
|
|
1264
|
+
/**
|
|
1265
|
+
* Rotation guard for the recovery-bearing settle paths (recover / renew /
|
|
1266
|
+
* periodic settle). Pins the wallet's receive snapshot to the active signer
|
|
1267
|
+
* before they build their output, but ONLY when this pass actually carries
|
|
1268
|
+
* an input minted under a deprecated signer — so a routine current-signer
|
|
1269
|
+
* settle on a long-lived pre-rotation instance does not eagerly rotate.
|
|
1270
|
+
*
|
|
1271
|
+
* Cheap in the common case: a watch-only/proxy wallet (not migration-capable)
|
|
1272
|
+
* and a current/unknown wallet snapshot both short-circuit before the
|
|
1273
|
+
* contract round-trip, so the only instance that pays for the input scan is
|
|
1274
|
+
* the long-lived deprecated-snapshot one that genuinely needs rotating.
|
|
1275
|
+
*
|
|
1276
|
+
* Runs OUTSIDE any `renewalInProgress` window the caller sets, and
|
|
1277
|
+
* `rotateServerSigner` does not depend on that flag, so it cannot deadlock
|
|
1278
|
+
* against the receive rotator. Returns whether a rotation was applied.
|
|
1279
|
+
*/
|
|
1280
|
+
private rotateForRecoverableInputs;
|
|
1281
|
+
/**
|
|
1282
|
+
* Whether any of the given input outpoints belongs to a contract whose
|
|
1283
|
+
* server signer classifies as non-`CURRENT` against the fresh signer set —
|
|
1284
|
+
* i.e. a deprecated-signer (incl. EXPIRED) input. Maps outpoints to their
|
|
1285
|
+
* owning contract via the ContractManager so it works on the typed
|
|
1286
|
+
* {@link ExtendedVirtualCoin}/{@link ExtendedCoin} inputs the recovery paths
|
|
1287
|
+
* carry (which don't expose `contractScript`).
|
|
1288
|
+
*/
|
|
1289
|
+
private anyInputUnderDeprecatedSigner;
|
|
890
1290
|
/** Asserts sweep capability and returns the typed wallet. */
|
|
891
1291
|
private getSweepWallet;
|
|
892
1292
|
/** Decodes the boarding tapscript exit path to extract the CSV timelock. */
|
|
893
1293
|
private getBoardingTimelock;
|
|
894
1294
|
/** Returns the TapLeafScript for the boarding tapscript's exit (CSV) path. */
|
|
895
1295
|
private getBoardingExitLeaf;
|
|
896
|
-
/** Returns the pkScript (output script) of the boarding tapscript. */
|
|
897
|
-
private getBoardingOutputScript;
|
|
898
1296
|
/** Returns the onchain provider for fee estimation and broadcasting. */
|
|
899
1297
|
private getOnchainProvider;
|
|
900
1298
|
/** Returns the Ark provider for intent fee and server info lookups. */
|
|
901
1299
|
private getArkProvider;
|
|
1300
|
+
/**
|
|
1301
|
+
* Read-only access to the ark provider for fetching server limits. Unlike
|
|
1302
|
+
* {@link getArkProvider}, this does not require full boarding-sweep
|
|
1303
|
+
* capability — recovery and renewal only need it to read `vtxoMaxAmount`.
|
|
1304
|
+
* Returns undefined when no provider is wired, which callers treat as
|
|
1305
|
+
* "no limit".
|
|
1306
|
+
*/
|
|
1307
|
+
private getInfoProvider;
|
|
902
1308
|
/** Returns the Bitcoin network configuration from the wallet. */
|
|
903
1309
|
private getNetwork;
|
|
904
|
-
/** Returns the wallet's identity for transaction signing. */
|
|
905
|
-
private getIdentity;
|
|
906
1310
|
private initializeSubscription;
|
|
907
1311
|
/**
|
|
908
1312
|
* VTXO_ALREADY_SPENT means the server's authoritative view of VTXO state
|
|
@@ -994,8 +1398,8 @@ declare const networks: {
|
|
|
994
1398
|
* Mainnet, mutinynet, and signet point at Ark Labs–operated
|
|
995
1399
|
* mempool deployments (mempool.space-compatible esplora API).
|
|
996
1400
|
* Testnet falls back to the public mempool.space deployment
|
|
997
|
-
* because Ark doesn't host it. Regtest assumes a local
|
|
998
|
-
* stack on the standard port.
|
|
1401
|
+
* because Ark doesn't host it. Regtest assumes a local arkade-regtest
|
|
1402
|
+
* stack exposing mempool's esplora API on the standard port.
|
|
999
1403
|
*/
|
|
1000
1404
|
declare const ESPLORA_URL: Record<NetworkName, string>;
|
|
1001
1405
|
type ExplorerTransaction = {
|
|
@@ -1281,6 +1685,14 @@ interface ScanResult {
|
|
|
1281
1685
|
interface ScanContractsOptions {
|
|
1282
1686
|
/** Default 20. A non-positive / non-integer value throws. */
|
|
1283
1687
|
gapLimit?: number;
|
|
1688
|
+
/**
|
|
1689
|
+
* Number of HD indices probed concurrently per window (default
|
|
1690
|
+
* {@link DEFAULT_SCAN_BATCH}). Pure latency knob: the gap loop stays
|
|
1691
|
+
* gap-limit bounded and the discovered set is identical regardless of
|
|
1692
|
+
* batch size. A non-positive / non-integer value throws. Ignored when
|
|
1693
|
+
* `hd` is false (the static pass probes only index 0).
|
|
1694
|
+
*/
|
|
1695
|
+
batchSize?: number;
|
|
1284
1696
|
/** HD mode → unbounded gap loop guided by the gap counter; false → probe only index 0 (single static pass). */
|
|
1285
1697
|
hd: boolean;
|
|
1286
1698
|
/**
|
|
@@ -1581,6 +1993,19 @@ declare class ContractManager implements IContractManager {
|
|
|
1581
1993
|
* other handler hit it).
|
|
1582
1994
|
* - `persistAndWatchContract` rejecting is operational/fatal and
|
|
1583
1995
|
* propagates (only `discoverAt` is guarded).
|
|
1996
|
+
* - Within an index the handler probes run concurrently (independent
|
|
1997
|
+
* network reads); their hits are persisted sequentially in
|
|
1998
|
+
* `discoverables` order to preserve the first-wins collision tie-break.
|
|
1999
|
+
* - Indices are probed `batchSize` at a time (a second concurrency layer
|
|
2000
|
+
* over the per-index probes), but each window is CAPPED to
|
|
2001
|
+
* `gapLimit - unused` indices — the most a serial scan could still reach
|
|
2002
|
+
* before the gap window is guaranteed to close. So every index probed in
|
|
2003
|
+
* a window is one a one-index-at-a-time scan would also reach: nothing is
|
|
2004
|
+
* over-scanned, nothing is discarded, and `materialize`/`discoverAt` are
|
|
2005
|
+
* invoked on exactly the same index set. The window's hits are still
|
|
2006
|
+
* processed strictly in ascending index order, so the discovered set,
|
|
2007
|
+
* persisted rows, `lastIndexUsed`, and `handlerErrors` are byte-for-byte
|
|
2008
|
+
* identical to the serial path — only the wall-clock differs.
|
|
1584
2009
|
*/
|
|
1585
2010
|
scanContracts(opts: ScanContractsOptions): Promise<ScanResult>;
|
|
1586
2011
|
/**
|
|
@@ -1958,12 +2383,47 @@ interface DiscoveredContract {
|
|
|
1958
2383
|
interface DiscoveryDeps {
|
|
1959
2384
|
indexerProvider: IndexerProvider;
|
|
1960
2385
|
onchainProvider: OnchainProvider;
|
|
2386
|
+
/**
|
|
2387
|
+
* Ark-address network data. The `{ hrp }` shape is all the L2
|
|
2388
|
+
* (`default`/`delegate`) discovery path needs to render an Ark address.
|
|
2389
|
+
*/
|
|
1961
2390
|
network: {
|
|
1962
2391
|
hrp: string;
|
|
1963
2392
|
};
|
|
2393
|
+
/**
|
|
2394
|
+
* Full Bitcoin network descriptor for on-chain (P2TR) address
|
|
2395
|
+
* rendering. Required by the boarding discovery probe, which derives an
|
|
2396
|
+
* on-chain Taproot address via {@link VtxoScript.onchainAddress} — the
|
|
2397
|
+
* `{ hrp }`-only {@link DiscoveryDeps.network} lacks the `bech32` data
|
|
2398
|
+
* that needs. Absent only when no boarding discovery is plumbed (e.g.
|
|
2399
|
+
* the scanner unit harness), in which case boarding `discoverAt` no-ops.
|
|
2400
|
+
*/
|
|
2401
|
+
onchainNetwork?: Network;
|
|
2402
|
+
/**
|
|
2403
|
+
* The server's **current** signer key (x-only, 32 bytes), taken from a
|
|
2404
|
+
* fresh server-info snapshot at restore time. L2 (`default`/`delegate`)
|
|
2405
|
+
* discovery probes this key first.
|
|
2406
|
+
*/
|
|
1964
2407
|
serverPubKey: Uint8Array;
|
|
2408
|
+
/**
|
|
2409
|
+
* The server's **deprecated** signer keys (x-only, 32 bytes) from the same
|
|
2410
|
+
* snapshot. A VTXO minted under a now-rotated signer is anchored to a
|
|
2411
|
+
* different script; L2 discovery scans these keys alongside
|
|
2412
|
+
* {@link DiscoveryDeps.serverPubKey} so signer rotation does not strand
|
|
2413
|
+
* funds. Empty/absent when the server advertises no deprecated signers.
|
|
2414
|
+
* Boarding discovery does not consult this set (current UTXO set only).
|
|
2415
|
+
*/
|
|
2416
|
+
deprecatedSignerPubKeys?: Uint8Array[];
|
|
1965
2417
|
/** Relative timelocks the wallet treats as its baseline matrix. */
|
|
1966
2418
|
csvTimelocks: RelativeTimelock[];
|
|
2419
|
+
/**
|
|
2420
|
+
* Boarding-exit CSV timelock. Distinct from {@link DiscoveryDeps.csvTimelocks}
|
|
2421
|
+
* (the unilateral-exit matrix): boarding scripts source their CSV from the
|
|
2422
|
+
* server's boarding-exit delay. Present only when boarding discovery is
|
|
2423
|
+
* plumbed; when absent, boarding `discoverAt` no-ops (so the scanner unit
|
|
2424
|
+
* harness, which never sets it, is unaffected).
|
|
2425
|
+
*/
|
|
2426
|
+
boardingTimelock?: RelativeTimelock;
|
|
1967
2427
|
/** Present only for delegate wallets. */
|
|
1968
2428
|
delegatePubKey?: Uint8Array;
|
|
1969
2429
|
}
|
|
@@ -2679,7 +3139,14 @@ interface WalletBalance {
|
|
|
2679
3139
|
available: number;
|
|
2680
3140
|
/** Recoverable balance from subdust or expired (swept) virtual outputs. */
|
|
2681
3141
|
recoverable: number;
|
|
2682
|
-
/**
|
|
3142
|
+
/**
|
|
3143
|
+
* Funds under a now-deprecated signer past its cutoff (EXPIRED) that have not
|
|
3144
|
+
* yet been swept by the server. NOT spendable until they recover, so excluded
|
|
3145
|
+
* from `available`/`settled`/`preconfirmed` and from coin selection — but
|
|
3146
|
+
* still the wallet's funds, so counted in `total`.
|
|
3147
|
+
*/
|
|
3148
|
+
pendingRecovery: number;
|
|
3149
|
+
/** Total balance across offchain, recoverable, pending-recovery, and boarding funds. */
|
|
2683
3150
|
total: number;
|
|
2684
3151
|
/** Asset balance entries (`assetId` & `amount`) */
|
|
2685
3152
|
assets: Asset[];
|
|
@@ -3556,6 +4023,17 @@ interface FeeOutput {
|
|
|
3556
4023
|
script: string;
|
|
3557
4024
|
}
|
|
3558
4025
|
|
|
4026
|
+
/**
|
|
4027
|
+
* Thrown by {@link RestArkProvider} when arkd rejects a request with
|
|
4028
|
+
* `DIGEST_MISMATCH` — the client's cached server info was stale (e.g. an
|
|
4029
|
+
* operator signer rotation). By the time this surfaces the provider has already
|
|
4030
|
+
* refreshed its info and fired `onServerInfoChanged`; the caller should rebuild
|
|
4031
|
+
* the request under the fresh server info and retry. Mirrors NArk's
|
|
4032
|
+
* `DigestMismatchException` (dotnet-sdk #131): the SDK never silently retries.
|
|
4033
|
+
*/
|
|
4034
|
+
declare class DigestMismatchError extends Error {
|
|
4035
|
+
constructor(message: string);
|
|
4036
|
+
}
|
|
3559
4037
|
/** Output requested during settlement or transaction submission. */
|
|
3560
4038
|
type Output = {
|
|
3561
4039
|
/** Destination address, either onchain or Arkade (offchain). */
|
|
@@ -3646,6 +4124,15 @@ interface PendingTx {
|
|
|
3646
4124
|
signedCheckpointTxs: string[];
|
|
3647
4125
|
}
|
|
3648
4126
|
interface DeprecatedSigner {
|
|
4127
|
+
/**
|
|
4128
|
+
* Unix timestamp (seconds) after which the server no longer accepts this
|
|
4129
|
+
* signer's VTXOs as cooperative-migration inputs. arkd advertises this as a
|
|
4130
|
+
* non-nullable field, so it is always present: `0n` is the sentinel for "no
|
|
4131
|
+
* cutoff advertised" — the deprecated signer is due for migration
|
|
4132
|
+
* immediately ({@link classifyContractSigner} maps `0n` to `DUE_NOW`). A
|
|
4133
|
+
* positive value is a real deadline (`MIGRATABLE` until it passes, then
|
|
4134
|
+
* `EXPIRED`).
|
|
4135
|
+
*/
|
|
3649
4136
|
cutoffDate: bigint;
|
|
3650
4137
|
pubkey: string;
|
|
3651
4138
|
}
|
|
@@ -3752,6 +4239,32 @@ interface ArkProvider {
|
|
|
3752
4239
|
declare class RestArkProvider implements ArkProvider {
|
|
3753
4240
|
serverUrl: string;
|
|
3754
4241
|
constructor(serverUrl?: string);
|
|
4242
|
+
/**
|
|
4243
|
+
* Last server-info digest seen (from {@link getInfo}). Sent as `X-Digest`
|
|
4244
|
+
* on outgoing requests so arkd can reject a client whose cached info is
|
|
4245
|
+
* stale. Empty until the first {@link getInfo}.
|
|
4246
|
+
*/
|
|
4247
|
+
private _digest;
|
|
4248
|
+
private _serverInfoListeners;
|
|
4249
|
+
/**
|
|
4250
|
+
* Subscribe to server-info changes. Fired when a request is rejected with
|
|
4251
|
+
* `DIGEST_MISMATCH` and fresh info is re-fetched, so consumers (the wallet)
|
|
4252
|
+
* can re-derive signer-dependent state mid-session without polling. Returns
|
|
4253
|
+
* an unsubscribe function.
|
|
4254
|
+
*/
|
|
4255
|
+
onServerInfoChanged(listener: (info: ArkInfo) => void): () => void;
|
|
4256
|
+
private emitServerInfoChanged;
|
|
4257
|
+
/**
|
|
4258
|
+
* `fetch` wrapper for arkd requests that participates in server-info digest
|
|
4259
|
+
* negotiation. Sends the cached `X-Digest`; when arkd rejects a request with
|
|
4260
|
+
* `DIGEST_MISMATCH`, refreshes {@link getInfo} (updating the digest), fires
|
|
4261
|
+
* {@link onServerInfoChanged}, and THROWS {@link DigestMismatchError} — it
|
|
4262
|
+
* never silently retries, since the in-flight request was built against the
|
|
4263
|
+
* now-stale config. Dormant until arkd returns the error — then it is the
|
|
4264
|
+
* instant, event-driven signer-rotation trigger. {@link getInfo} itself never
|
|
4265
|
+
* routes through here: it is the refresh path and must not be digest-gated.
|
|
4266
|
+
*/
|
|
4267
|
+
private authedFetch;
|
|
3755
4268
|
getInfo(): Promise<ArkInfo>;
|
|
3756
4269
|
submitTx(signedArkTx: string, checkpointTxs: string[]): Promise<{
|
|
3757
4270
|
arkTxid: string;
|
|
@@ -3919,4 +4432,4 @@ declare namespace ProtoTypes {
|
|
|
3919
4432
|
export { };
|
|
3920
4433
|
}
|
|
3921
4434
|
|
|
3922
|
-
export { CSVMultisigTapscript as $, type ArkTransaction as A, type BatchStartedEvent as B, type ContractRepository as C, type BatchFailedEvent as D, type ExtendedVirtualCoin as E, type TreeTxEvent as F, type GetVtxosFilter as G, type TreeSignatureEvent as H, type IWallet as I, type DescriptorProvider as J, type IReadonlyWallet as K, type ReadonlyIdentity as L, type DelegateProvider as M, type Network as N, type OnchainProvider as O, type ReadonlyWalletConfig as P, type IReadonlyAssetManager as Q, type Recipient as R, type SendBitcoinParams as S, type TxNotification as T, type NetworkName as U, VtxoScript as V, type WalletRepository as W, type ArkInfo as X, ArkAddress as Y, type Coin as Z, ContractManager as _, type Identity as a,
|
|
4435
|
+
export { CSVMultisigTapscript as $, type ArkTransaction as A, type BatchStartedEvent as B, type ContractRepository as C, type BatchFailedEvent as D, type ExtendedVirtualCoin as E, type TreeTxEvent as F, type GetVtxosFilter as G, type TreeSignatureEvent as H, type IWallet as I, type DescriptorProvider as J, type IReadonlyWallet as K, type ReadonlyIdentity as L, type DelegateProvider as M, type Network as N, type OnchainProvider as O, type ReadonlyWalletConfig as P, type IReadonlyAssetManager as Q, type Recipient as R, type SendBitcoinParams as S, type TxNotification as T, type NetworkName as U, VtxoScript as V, type WalletRepository as W, type ArkInfo as X, ArkAddress as Y, type Coin as Z, ContractManager as _, type Identity as a, DigestMismatchError as a$, type SettlementConfig as a0, VtxoManager as a1, type SignerSession as a2, type SignedIntent as a3, Intent as a4, type DescriptorSigningRequest as a5, Transaction as a6, type IntentFeeConfig as a7, type OffchainInput as a8, FeeAmount as a9, type Outpoint as aA, type ChainTx as aB, type PathContext as aC, type ArkTapscript as aD, type Asset as aE, type AssetMetadata as aF, type BaseWalletConfig as aG, type BatchInfo as aH, type BatchSignableIdentity as aI, CLTVMultisigTapscript as aJ, ChainTxType as aK, type CommitmentTx as aL, ConditionCSVMultisigTapscript as aM, ConditionMultisigTapscript as aN, type ContractBalance as aO, type ContractEventCallback as aP, type ContractHandler as aQ, type ContractManagerConfig as aR, type ContractState as aS, type ContractVtxo as aT, ContractWatcher as aU, DelegateManagerImpl as aV, type DelegateOptions as aW, DelegatorManagerImpl as aX, type DelegatorProvider as aY, type DeprecatedSignerMigrationReport as aZ, type DeprecatedSignerReport as a_, type OnchainInput as aa, type FeeOutput as ab, type ContractWatcherConfig as ac, type FeeInfo as ad, type CreateContractParams as ae, type GetContractsFilter as af, type GetSpendablePathsOptions as ag, type GetAllSpendingPathsOptions as ah, type IssuanceParams as ai, type ReissuanceParams as aj, type BurnParams as ak, type RenewVtxosOptions as al, type ContractWithVtxos as am, type PathSelection as an, type ContractEvent as ao, type AssetDetails as ap, type IssuanceResult as aq, type DelegateInfo as ar, type MigrationGlobalSkipReason as as, type MigrationLegSkipReason as at, type SignerStatus as au, type StorageConfig as av, type IVtxoManager as aw, type ExplorerTransaction as ax, type EncodedVtxoScript as ay, type Status as az, type WalletConfig as b, type Discoverable as b0, type DiscoveredContract as b1, type DiscoveryDeps as b2, ESPLORA_URL as b3, EsploraProvider as b4, type ExtendedContractVtxo as b5, type HandlerError as b6, type IDelegatorManager as b7, IndexerTxType as b8, type KnownMetadata as b9, type Tx as bA, type TxHistoryRecord as bB, type TxKey as bC, type TxTreeNode as bD, TxType as bE, type VirtualStatus as bF, type Vtxo as bG, type VtxoChain as bH, type VtxoType as bI, type WalletMode as bJ, classifyAgainstSignerSet as bK, classifyContractSigner as bL, decodeTapscript as bM, getSequence as bN, isBatchSignable as bO, isCooperativelyMigratable as bP, isDiscoverable as bQ, isExpired as bR, isRecoverable as bS, isSpendable as bT, isSubdust as bU, isVtxoExpiringSoon as bV, networks as bW, signerSetFromInfo as bX, toXOnlySignerHex as bY, type MigrateDeprecatedSignerOptions as ba, type MigrationLegReport as bb, type MigrationVtxoRef as bc, MultisigTapscript as bd, type Nonces as be, type Output as bf, type PageResponse as bg, type PaginationOptions as bh, PartialSig as bi, type ProviderClass as bj, RestDelegateProvider as bk, RestDelegatorProvider as bl, type ScanContractsOptions as bm, type ScanResult as bn, type ScheduledSession as bo, SettlementEventType as bp, type SignRequest as bq, type SignerClassification as br, type SignerSet as bs, type SubscriptionEvent as bt, type SubscriptionHeartbeat as bu, type TapLeaves as bv, TapTreeCoder as bw, TapscriptType as bx, type TreeNonces as by, type TreePartialSigs as bz, type WalletBalance as c, type ExtendedCoin as d, type IContractManager as e, type IDelegateManager as f, type SettleParams as g, type SettlementEvent as h, type IAssetManager as i, RestArkProvider as j, RestIndexerProvider as k, type SubscriptionResponse as l, type ArkProvider as m, type IndexerProvider as n, type RelativeTimelock as o, type TapLeafScript as p, type VirtualCoin as q, type Contract as r, type VtxoRepositoryKey as s, type WalletState as t, type ContractFilter as u, type TreeSigningStartedEvent as v, TxTree as w, type TreeNoncesEvent as x, type BatchFinalizationEvent as y, type BatchFinalizedEvent as z };
|