@arkade-os/sdk 0.4.47 → 0.4.48
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 +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-CoJgwTi_.d.cts → ark-CjE0KkGp.d.cts} +405 -250
- package/dist/{ark-CoJgwTi_.d.ts → ark-CjE0KkGp.d.ts} +405 -250
- package/dist/{asyncStorageTaskQueue-Dowyo59a.d.cts → asyncStorageTaskQueue-CeLZhZFU.d.cts} +2 -2
- package/dist/{asyncStorageTaskQueue-Z3aFoXCl.d.ts → asyncStorageTaskQueue-D9SOPMPC.d.ts} +2 -2
- package/dist/{chunk-XN3554FT.js → chunk-4VVTRPH3.js} +4 -4
- package/dist/chunk-4VVTRPH3.js.map +1 -0
- package/dist/{chunk-RQSA7ADZ.cjs → chunk-5XMVTK5S.cjs} +37 -37
- package/dist/chunk-5XMVTK5S.cjs.map +1 -0
- package/dist/{chunk-L5ND2FJJ.cjs → chunk-7TXSPRN5.cjs} +161 -2
- package/dist/chunk-7TXSPRN5.cjs.map +1 -0
- package/dist/{chunk-CDDWXBEM.js → chunk-BHHLRZCS.js} +169 -42
- package/dist/chunk-BHHLRZCS.js.map +1 -0
- package/dist/{chunk-HHV5FPC6.cjs → chunk-EB3ALGTM.cjs} +178 -50
- package/dist/chunk-EB3ALGTM.cjs.map +1 -0
- package/dist/{chunk-JAYOXOLT.cjs → chunk-ENDNQPZA.cjs} +17 -44
- package/dist/chunk-ENDNQPZA.cjs.map +1 -0
- package/dist/{chunk-WTTLIFS7.cjs → chunk-ENZ4YPR2.cjs} +944 -544
- package/dist/chunk-ENZ4YPR2.cjs.map +1 -0
- package/dist/{chunk-3N5I6GT6.js → chunk-G6J6AEMH.js} +5 -4
- package/dist/chunk-G6J6AEMH.js.map +1 -0
- package/dist/{chunk-OCS5S3L3.js → chunk-NYR5H6GR.js} +685 -284
- package/dist/chunk-NYR5H6GR.js.map +1 -0
- package/dist/{chunk-VE67GMGM.cjs → chunk-SYDANBJI.cjs} +9 -8
- package/dist/chunk-SYDANBJI.cjs.map +1 -0
- package/dist/{chunk-AJQ4AOT3.js → chunk-XFMGIFBL.js} +4 -31
- package/dist/chunk-XFMGIFBL.js.map +1 -0
- package/dist/{chunk-C7TXXTMS.js → chunk-ZDDBTFVO.js} +146 -3
- package/dist/chunk-ZDDBTFVO.js.map +1 -0
- package/dist/contracts/handlers/index.cjs +8 -8
- 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-Dl87_zMA.d.cts → delegate-D3dY-2vS.d.cts} +1 -1
- package/dist/{delegate-CuaDqqQi.d.ts → delegate-DhGZk1r2.d.ts} +1 -1
- package/dist/{index-BC_G0VTh.d.cts → index-D6RQROds.d.cts} +2 -2
- package/dist/{index-CKwpZEpw.d.ts → index-DK4_iWYy.d.ts} +2 -2
- package/dist/index.cjs +211 -183
- package/dist/index.d.cts +61 -11
- package/dist/index.d.ts +61 -11
- 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-Dz-TI4Rb.d.ts → taskRunner-B-2MHCYG.d.ts} +2 -2
- package/dist/{taskRunner-Dz47k0lp.d.cts → taskRunner-Brnak0Rc.d.cts} +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 +14 -14
- package/dist/wallet/expo/index.cjs.map +1 -1
- 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/expo/index.js.map +1 -1
- package/dist/{wallet-Oxz_wLxo.d.cts → wallet-B5bwixQa.d.ts} +130 -7
- package/dist/{wallet-x7egmXq6.d.ts → wallet-DiOrtYic.d.cts} +130 -7
- 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-3N5I6GT6.js.map +0 -1
- package/dist/chunk-AJQ4AOT3.js.map +0 -1
- package/dist/chunk-C7TXXTMS.js.map +0 -1
- package/dist/chunk-CDDWXBEM.js.map +0 -1
- package/dist/chunk-HHV5FPC6.cjs.map +0 -1
- package/dist/chunk-JAYOXOLT.cjs.map +0 -1
- package/dist/chunk-L5ND2FJJ.cjs.map +0 -1
- package/dist/chunk-OCS5S3L3.js.map +0 -1
- package/dist/chunk-RQSA7ADZ.cjs.map +0 -1
- package/dist/chunk-VE67GMGM.cjs.map +0 -1
- package/dist/chunk-WTTLIFS7.cjs.map +0 -1
- package/dist/chunk-XN3554FT.js.map +0 -1
|
@@ -524,6 +524,285 @@ type EncodedVtxoScript = {
|
|
|
524
524
|
*/
|
|
525
525
|
declare function getSequence(tapLeafScript: TapLeafScript): number | undefined;
|
|
526
526
|
|
|
527
|
+
type NetworkName = "bitcoin" | "testnet" | "signet" | "mutinynet" | "regtest";
|
|
528
|
+
interface Network {
|
|
529
|
+
hrp: string;
|
|
530
|
+
bech32: string;
|
|
531
|
+
pubKeyHash: number;
|
|
532
|
+
scriptHash: number;
|
|
533
|
+
wif: number;
|
|
534
|
+
}
|
|
535
|
+
declare const getNetwork: (network: NetworkName) => Network;
|
|
536
|
+
declare const networks: {
|
|
537
|
+
bitcoin: Network;
|
|
538
|
+
testnet: Network;
|
|
539
|
+
signet: Network;
|
|
540
|
+
mutinynet: Network;
|
|
541
|
+
regtest: Network;
|
|
542
|
+
};
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* The default base URLs for esplora API providers.
|
|
546
|
+
*
|
|
547
|
+
* Mainnet, mutinynet, and signet point at Ark Labs–operated
|
|
548
|
+
* mempool deployments (mempool.space-compatible esplora API).
|
|
549
|
+
* Testnet falls back to the public mempool.space deployment
|
|
550
|
+
* because Ark doesn't host it. Regtest assumes a local arkade-regtest
|
|
551
|
+
* stack exposing mempool's esplora API on the standard port.
|
|
552
|
+
*/
|
|
553
|
+
declare const ESPLORA_URL: Record<NetworkName, string>;
|
|
554
|
+
type ExplorerTransaction = {
|
|
555
|
+
txid: string;
|
|
556
|
+
/**
|
|
557
|
+
* Inputs as returned by Esplora's `/address/:addr/txs`, each carrying the
|
|
558
|
+
* outpoint it spends (`txid:vout`). Optional: not every provider populates
|
|
559
|
+
* it (the electrum provider omits inputs), so consumers that correlate
|
|
560
|
+
* spenders must tolerate its absence. Used to recover a boarding output's
|
|
561
|
+
* spending (commitment) tx when `/outspends` omits the spender txid.
|
|
562
|
+
*/
|
|
563
|
+
vin?: {
|
|
564
|
+
txid: string;
|
|
565
|
+
vout: number;
|
|
566
|
+
}[];
|
|
567
|
+
vout: {
|
|
568
|
+
scriptpubkey_address: string;
|
|
569
|
+
value: string;
|
|
570
|
+
}[];
|
|
571
|
+
status: {
|
|
572
|
+
confirmed: boolean;
|
|
573
|
+
block_time: number;
|
|
574
|
+
};
|
|
575
|
+
};
|
|
576
|
+
interface OnchainProvider {
|
|
577
|
+
/**
|
|
578
|
+
* Fetch spendable onchain outputs for an address.
|
|
579
|
+
*
|
|
580
|
+
* @param address - Bitcoin address to query
|
|
581
|
+
* @returns Spendable onchain outputs for the address
|
|
582
|
+
* @see Coin
|
|
583
|
+
*/
|
|
584
|
+
getCoins(address: string): Promise<Coin[]>;
|
|
585
|
+
/**
|
|
586
|
+
* Fetch the current fastest fee rate estimate.
|
|
587
|
+
*
|
|
588
|
+
* @returns Fee rate in sats/vB, if available
|
|
589
|
+
* @remarks
|
|
590
|
+
* Implementations may return `undefined` when the backing service does not expose
|
|
591
|
+
* a usable fee estimate.
|
|
592
|
+
*/
|
|
593
|
+
getFeeRate(): Promise<number | undefined>;
|
|
594
|
+
/**
|
|
595
|
+
* Broadcast a single transaction or a 1P1C package.
|
|
596
|
+
*
|
|
597
|
+
* @param txs - One or more raw transaction hex strings
|
|
598
|
+
* @returns Broadcast transaction id
|
|
599
|
+
* @throws Error if the broadcast request fails or the package shape is invalid
|
|
600
|
+
*/
|
|
601
|
+
broadcastTransaction(...txs: string[]): Promise<string>;
|
|
602
|
+
/**
|
|
603
|
+
* Fetch outspend information for every output in a transaction.
|
|
604
|
+
*
|
|
605
|
+
* @param txid - Transaction id to inspect
|
|
606
|
+
* @returns Per-output spend status information. `txid` (the spender) may be
|
|
607
|
+
* absent even when `spent` is true: some Esplora deployments
|
|
608
|
+
* (e.g. mempool.arkade.sh) omit it from `/outspends`.
|
|
609
|
+
* @see getTxStatus
|
|
610
|
+
*/
|
|
611
|
+
getTxOutspends(txid: string): Promise<{
|
|
612
|
+
spent: boolean;
|
|
613
|
+
txid?: string;
|
|
614
|
+
}[]>;
|
|
615
|
+
/**
|
|
616
|
+
* Fetch transactions associated with an address.
|
|
617
|
+
*
|
|
618
|
+
* @param address - Bitcoin address to query
|
|
619
|
+
* @returns Transactions involving the address
|
|
620
|
+
* @see ExplorerTransaction
|
|
621
|
+
*/
|
|
622
|
+
getTransactions(address: string): Promise<ExplorerTransaction[]>;
|
|
623
|
+
/**
|
|
624
|
+
* Fetch confirmation status for a transaction.
|
|
625
|
+
*
|
|
626
|
+
* @param txid - Transaction id to inspect
|
|
627
|
+
* @returns Confirmation status and block metadata when confirmed
|
|
628
|
+
* @see getTxOutspends
|
|
629
|
+
*/
|
|
630
|
+
getTxStatus(txid: string): Promise<{
|
|
631
|
+
confirmed: false;
|
|
632
|
+
} | {
|
|
633
|
+
confirmed: true;
|
|
634
|
+
blockTime: number;
|
|
635
|
+
blockHeight: number;
|
|
636
|
+
}>;
|
|
637
|
+
/**
|
|
638
|
+
* Fetch the current chain tip.
|
|
639
|
+
*
|
|
640
|
+
* @returns Current chain height, block time, and block hash
|
|
641
|
+
*/
|
|
642
|
+
getChainTip(): Promise<{
|
|
643
|
+
height: number;
|
|
644
|
+
time: number;
|
|
645
|
+
hash: string;
|
|
646
|
+
}>;
|
|
647
|
+
/**
|
|
648
|
+
* Watch a set of addresses and invoke the callback when transactions are observed.
|
|
649
|
+
*
|
|
650
|
+
* @param addresses - Addresses to monitor
|
|
651
|
+
* @param eventCallback - Callback invoked when matching transactions are seen
|
|
652
|
+
* @returns Stop function that cancels the watch
|
|
653
|
+
* @remarks
|
|
654
|
+
* Implementations may use websockets, server-sent events, polling, or a hybrid strategy.
|
|
655
|
+
* @see getTransactions
|
|
656
|
+
*/
|
|
657
|
+
watchAddresses(addresses: string[], eventCallback: (txs: ExplorerTransaction[]) => void): Promise<() => void>;
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* Implementation of the onchain provider interface for esplora REST API.
|
|
661
|
+
*
|
|
662
|
+
* @see https://mempool.space/docs/api/rest
|
|
663
|
+
* @example
|
|
664
|
+
* ```typescript
|
|
665
|
+
* const provider = new EsploraProvider("https://mempool.space/api");
|
|
666
|
+
* const outputs = await provider.getCoins("bcrt1q679zsd45msawvr7782r0twvmukns3drlstjt77");
|
|
667
|
+
* ```
|
|
668
|
+
*/
|
|
669
|
+
declare class EsploraProvider implements OnchainProvider {
|
|
670
|
+
private baseUrl;
|
|
671
|
+
readonly pollingInterval: number;
|
|
672
|
+
readonly forcePolling: boolean;
|
|
673
|
+
constructor(baseUrl?: string, opts?: {
|
|
674
|
+
/** Polling interval in milliseconds. */
|
|
675
|
+
pollingInterval?: number;
|
|
676
|
+
/** Force polling even when websocket transport is available. */
|
|
677
|
+
forcePolling?: boolean;
|
|
678
|
+
});
|
|
679
|
+
getCoins(address: string): Promise<Coin[]>;
|
|
680
|
+
getFeeRate(): Promise<number | undefined>;
|
|
681
|
+
broadcastTransaction(...txs: string[]): Promise<string>;
|
|
682
|
+
getTxOutspends(txid: string): Promise<{
|
|
683
|
+
spent: boolean;
|
|
684
|
+
txid?: string;
|
|
685
|
+
}[]>;
|
|
686
|
+
getTransactions(address: string): Promise<ExplorerTransaction[]>;
|
|
687
|
+
getTxStatus(txid: string): Promise<{
|
|
688
|
+
confirmed: false;
|
|
689
|
+
} | {
|
|
690
|
+
confirmed: true;
|
|
691
|
+
blockTime: number;
|
|
692
|
+
blockHeight: number;
|
|
693
|
+
}>;
|
|
694
|
+
watchAddresses(addresses: string[], callback: (txs: ExplorerTransaction[]) => void): Promise<() => void>;
|
|
695
|
+
getChainTip(): Promise<{
|
|
696
|
+
height: number;
|
|
697
|
+
time: number;
|
|
698
|
+
hash: string;
|
|
699
|
+
}>;
|
|
700
|
+
private broadcastPackage;
|
|
701
|
+
private broadcastTx;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
/**
|
|
705
|
+
* The current moment, as the expiry predicates need it.
|
|
706
|
+
*
|
|
707
|
+
* `height` is optional: offline-first paths have no chain tip at hand. When it is absent,
|
|
708
|
+
* height-based expiry cannot be evaluated and reads as not expired.
|
|
709
|
+
*/
|
|
710
|
+
type TimeHeight = {
|
|
711
|
+
timestamp: Date;
|
|
712
|
+
height?: number;
|
|
713
|
+
};
|
|
714
|
+
/**
|
|
715
|
+
* A {@link VirtualCoin} that has passed through {@link normalizeVtxo}: every fact the capability
|
|
716
|
+
* predicates read is present.
|
|
717
|
+
*
|
|
718
|
+
* Internal signatures take this rather than `VirtualCoin` so the compiler rejects un-normalized
|
|
719
|
+
* input — on the public shape these facts are optional, and `undefined` is falsy, so a legacy coin
|
|
720
|
+
* would silently read as "not swept", "not spent", and drop out of the wrong bucket.
|
|
721
|
+
*
|
|
722
|
+
* It is deliberately a *subtype* of `VirtualCoin`, so normalized coins are returned to consumers
|
|
723
|
+
* directly and no egress projection exists.
|
|
724
|
+
*/
|
|
725
|
+
type NormalizedVirtualCoin = Omit<VirtualCoin, "isSwept" | "isPreconfirmed" | "isSpent" | "spentBy" | "commitmentTxIds"> & {
|
|
726
|
+
isSwept: boolean;
|
|
727
|
+
isPreconfirmed: boolean;
|
|
728
|
+
isSpent: boolean;
|
|
729
|
+
spentBy: string;
|
|
730
|
+
commitmentTxIds: string[];
|
|
731
|
+
};
|
|
732
|
+
type NormalizedExtendedVirtualCoin = ExtendedVirtualCoin & NormalizedVirtualCoin;
|
|
733
|
+
/**
|
|
734
|
+
* Whether a virtual output has been consumed and can never be spent again.
|
|
735
|
+
*
|
|
736
|
+
* @remarks
|
|
737
|
+
* Unions all three spend facts rather than trusting any one of them. The wire contract permits
|
|
738
|
+
* `isSpent: true` with an empty `spentBy` (settlement inputs needing no forfeit are written that
|
|
739
|
+
* way), so a `spentBy || settledBy` definition would classify a spent VTXO as spendable — inflating
|
|
740
|
+
* balance and selecting it for a send that must fail.
|
|
741
|
+
*/
|
|
742
|
+
declare function hasTerminalSpend(vtxo: VirtualCoin): boolean;
|
|
743
|
+
/**
|
|
744
|
+
* Whether a virtual output's batch expiry has passed. Pure expiry — swept is a separate fact, ORed
|
|
745
|
+
* in explicitly by {@link canSpendOffchain} / {@link canRecoverOnchain}.
|
|
746
|
+
*
|
|
747
|
+
* @remarks
|
|
748
|
+
* Not named `isExpired`: the deprecated {@link isExpired} also returns `true` for a swept VTXO, and
|
|
749
|
+
* two same-named predicates with different truth conditions is how a call site gets silently
|
|
750
|
+
* rewired.
|
|
751
|
+
*
|
|
752
|
+
* Height-based expiry is only evaluated when `now.height` is supplied.
|
|
753
|
+
*/
|
|
754
|
+
declare function isPastExpiry(vtxo: VirtualCoin, now: TimeHeight): boolean;
|
|
755
|
+
/** Whether a virtual output can be spent in an offchain transaction. The send/coin-selection test. */
|
|
756
|
+
declare function canSpendOffchain(vtxo: VirtualCoin, now: TimeHeight): boolean;
|
|
757
|
+
/**
|
|
758
|
+
* Whether a virtual output must be recovered into a fresh batch rather than spent offchain. The
|
|
759
|
+
* recovery/renewal test and the `recoverable` balance bucket.
|
|
760
|
+
*/
|
|
761
|
+
declare function canRecoverOnchain(vtxo: VirtualCoin, now: TimeHeight): boolean;
|
|
762
|
+
/**
|
|
763
|
+
* Narrow a settle input to a virtual output.
|
|
764
|
+
*
|
|
765
|
+
* @remarks
|
|
766
|
+
* Keyed on `script`: it is required on `VirtualCoin` (so legacy and canonical shapes both have it)
|
|
767
|
+
* and absent from `ExtendedCoin`, which the optional canonical facts cannot claim.
|
|
768
|
+
*
|
|
769
|
+
* The `typeof` guard is load-bearing — `settle` accepts arknote strings, and `in` throws a
|
|
770
|
+
* `TypeError` on a primitive rather than returning false.
|
|
771
|
+
*/
|
|
772
|
+
declare function isVirtualCoin<T>(input: T): input is T & VirtualCoin;
|
|
773
|
+
/**
|
|
774
|
+
* Return whether a virtual output is still spendable.
|
|
775
|
+
*
|
|
776
|
+
* @param vtxo - virtual output to inspect
|
|
777
|
+
* @returns `true` when the virtual output has not been consumed
|
|
778
|
+
*
|
|
779
|
+
* @deprecated Ambiguous: `true` for swept or expired virtual outputs, which cannot in fact be spent
|
|
780
|
+
* offchain. Use {@link canSpendOffchain}.
|
|
781
|
+
*/
|
|
782
|
+
declare function isSpendable(vtxo: VirtualCoin): boolean;
|
|
783
|
+
/**
|
|
784
|
+
* Return whether a virtual output is recoverable.
|
|
785
|
+
*
|
|
786
|
+
* @param vtxo - virtual output to inspect
|
|
787
|
+
* @returns `true` when the virtual output is swept but not yet consumed
|
|
788
|
+
*
|
|
789
|
+
* @deprecated Swept-only: ignores virtual outputs that are past expiry but not yet swept, which are
|
|
790
|
+
* equally recoverable. Use {@link canRecoverOnchain}.
|
|
791
|
+
*/
|
|
792
|
+
declare function isRecoverable(vtxo: VirtualCoin): boolean;
|
|
793
|
+
/**
|
|
794
|
+
* Return whether a virtual output should be treated as expired.
|
|
795
|
+
*
|
|
796
|
+
* @param vtxo - virtual output to inspect
|
|
797
|
+
* @returns `true` when the virtual output is swept or its wall-clock batch expiry has passed
|
|
798
|
+
*
|
|
799
|
+
* @deprecated Conflates swept with expired, and cannot evaluate height-based expiry — being
|
|
800
|
+
* synchronous, it has no source for the current chain tip, so it ignores `expiresAtHeight` exactly
|
|
801
|
+
* as it always has. For the recovery decision use {@link canRecoverOnchain}; to reproduce this
|
|
802
|
+
* truth condition use `v.isSwept || isPastExpiry(v, now)`.
|
|
803
|
+
*/
|
|
804
|
+
declare function isExpired(vtxo: VirtualCoin): boolean;
|
|
805
|
+
|
|
527
806
|
/**
|
|
528
807
|
* Machine-readable classification of a contract's server signer relative to a
|
|
529
808
|
* fresh {@link ArkInfo} snapshot. Drives both the migration selection (Section
|
|
@@ -826,7 +1105,7 @@ interface DeprecatedSignerReport {
|
|
|
826
1105
|
* exceeds the server's per-output ceiling (`vtxoMaxAmount`) — see
|
|
827
1106
|
* {@link MigrationLegReport.oversized}.
|
|
828
1107
|
*/
|
|
829
|
-
type MigrationLegSkipReason = "below-dust" | "oversized-only";
|
|
1108
|
+
type MigrationLegSkipReason = "below-dust" | "oversized-only" | "not-spendable-only";
|
|
830
1109
|
/**
|
|
831
1110
|
* Why the whole pass submitted nothing, before either leg was built.
|
|
832
1111
|
* `no-deprecated-vtxos` means BOTH migratable sets (VTXO and boarding) were
|
|
@@ -863,6 +1142,16 @@ interface MigrationLegReport {
|
|
|
863
1142
|
* absent when the server advertises no ceiling (`vtxoMaxAmount < 0`).
|
|
864
1143
|
*/
|
|
865
1144
|
oversized?: MigrationVtxoRef[];
|
|
1145
|
+
/**
|
|
1146
|
+
* Inputs the leg's submit path would have rejected — for the VTXO leg, no longer
|
|
1147
|
+
* cooperatively spendable at this pass's chain tip (past batch expiry, since swept and spent
|
|
1148
|
+
* inputs are already excluded upstream) or carrying no batch expiry at all.
|
|
1149
|
+
*
|
|
1150
|
+
* Partitioned out rather than submitted, because the send path validates the batch as a
|
|
1151
|
+
* whole: one rejected input would abort the entire leg and strand every other migratable
|
|
1152
|
+
* VTXO until the next pass. Present only when non-empty.
|
|
1153
|
+
*/
|
|
1154
|
+
notSpendableOffchain?: MigrationVtxoRef[];
|
|
866
1155
|
/** Error message when this leg's submission failed; the other leg still runs. */
|
|
867
1156
|
error?: string;
|
|
868
1157
|
}
|
|
@@ -905,7 +1194,7 @@ interface DeprecatedSignerMigrationReport {
|
|
|
905
1194
|
* - **Expiry monitoring**: Check for virtual outputs that are expiring soon
|
|
906
1195
|
*
|
|
907
1196
|
* Virtual outputs become recoverable when:
|
|
908
|
-
* - The Arkade server sweeps them (
|
|
1197
|
+
* - The Arkade server sweeps them (`isSwept`) and they remain spendable
|
|
909
1198
|
* - They are preconfirmed subdust (to consolidate small amounts without locking liquidity on settled virtual outputs)
|
|
910
1199
|
*
|
|
911
1200
|
* @example
|
|
@@ -1092,7 +1381,15 @@ declare class VtxoManager implements AsyncDisposable, IVtxoManager {
|
|
|
1092
1381
|
* }
|
|
1093
1382
|
* ```
|
|
1094
1383
|
*/
|
|
1095
|
-
getExpiringVtxos(thresholdMs?: number): Promise<
|
|
1384
|
+
getExpiringVtxos(thresholdMs?: number): Promise<NormalizedExtendedVirtualCoin[]>;
|
|
1385
|
+
/**
|
|
1386
|
+
* {@link getExpiringVtxos}, against a caller-supplied chain tip.
|
|
1387
|
+
*
|
|
1388
|
+
* The settle paths select, re-select after pre-flight, and sort by expiry within one pass;
|
|
1389
|
+
* each of those judges expiry, so they share one tip rather than fetching (and possibly
|
|
1390
|
+
* disagreeing on) one apiece. Fetches its own when `now` is omitted.
|
|
1391
|
+
*/
|
|
1392
|
+
private selectExpiringVtxos;
|
|
1096
1393
|
/**
|
|
1097
1394
|
* Renew expiring virtual outputs by settling them back to the wallet's address
|
|
1098
1395
|
*
|
|
@@ -1381,183 +1678,6 @@ declare class VtxoManager implements AsyncDisposable, IVtxoManager {
|
|
|
1381
1678
|
[Symbol.asyncDispose](): Promise<void>;
|
|
1382
1679
|
}
|
|
1383
1680
|
|
|
1384
|
-
type NetworkName = "bitcoin" | "testnet" | "signet" | "mutinynet" | "regtest";
|
|
1385
|
-
interface Network {
|
|
1386
|
-
hrp: string;
|
|
1387
|
-
bech32: string;
|
|
1388
|
-
pubKeyHash: number;
|
|
1389
|
-
scriptHash: number;
|
|
1390
|
-
wif: number;
|
|
1391
|
-
}
|
|
1392
|
-
declare const getNetwork: (network: NetworkName) => Network;
|
|
1393
|
-
declare const networks: {
|
|
1394
|
-
bitcoin: Network;
|
|
1395
|
-
testnet: Network;
|
|
1396
|
-
signet: Network;
|
|
1397
|
-
mutinynet: Network;
|
|
1398
|
-
regtest: Network;
|
|
1399
|
-
};
|
|
1400
|
-
|
|
1401
|
-
/**
|
|
1402
|
-
* The default base URLs for esplora API providers.
|
|
1403
|
-
*
|
|
1404
|
-
* Mainnet, mutinynet, and signet point at Ark Labs–operated
|
|
1405
|
-
* mempool deployments (mempool.space-compatible esplora API).
|
|
1406
|
-
* Testnet falls back to the public mempool.space deployment
|
|
1407
|
-
* because Ark doesn't host it. Regtest assumes a local arkade-regtest
|
|
1408
|
-
* stack exposing mempool's esplora API on the standard port.
|
|
1409
|
-
*/
|
|
1410
|
-
declare const ESPLORA_URL: Record<NetworkName, string>;
|
|
1411
|
-
type ExplorerTransaction = {
|
|
1412
|
-
txid: string;
|
|
1413
|
-
/**
|
|
1414
|
-
* Inputs as returned by Esplora's `/address/:addr/txs`, each carrying the
|
|
1415
|
-
* outpoint it spends (`txid:vout`). Optional: not every provider populates
|
|
1416
|
-
* it (the electrum provider omits inputs), so consumers that correlate
|
|
1417
|
-
* spenders must tolerate its absence. Used to recover a boarding output's
|
|
1418
|
-
* spending (commitment) tx when `/outspends` omits the spender txid.
|
|
1419
|
-
*/
|
|
1420
|
-
vin?: {
|
|
1421
|
-
txid: string;
|
|
1422
|
-
vout: number;
|
|
1423
|
-
}[];
|
|
1424
|
-
vout: {
|
|
1425
|
-
scriptpubkey_address: string;
|
|
1426
|
-
value: string;
|
|
1427
|
-
}[];
|
|
1428
|
-
status: {
|
|
1429
|
-
confirmed: boolean;
|
|
1430
|
-
block_time: number;
|
|
1431
|
-
};
|
|
1432
|
-
};
|
|
1433
|
-
interface OnchainProvider {
|
|
1434
|
-
/**
|
|
1435
|
-
* Fetch spendable onchain outputs for an address.
|
|
1436
|
-
*
|
|
1437
|
-
* @param address - Bitcoin address to query
|
|
1438
|
-
* @returns Spendable onchain outputs for the address
|
|
1439
|
-
* @see Coin
|
|
1440
|
-
*/
|
|
1441
|
-
getCoins(address: string): Promise<Coin[]>;
|
|
1442
|
-
/**
|
|
1443
|
-
* Fetch the current fastest fee rate estimate.
|
|
1444
|
-
*
|
|
1445
|
-
* @returns Fee rate in sats/vB, if available
|
|
1446
|
-
* @remarks
|
|
1447
|
-
* Implementations may return `undefined` when the backing service does not expose
|
|
1448
|
-
* a usable fee estimate.
|
|
1449
|
-
*/
|
|
1450
|
-
getFeeRate(): Promise<number | undefined>;
|
|
1451
|
-
/**
|
|
1452
|
-
* Broadcast a single transaction or a 1P1C package.
|
|
1453
|
-
*
|
|
1454
|
-
* @param txs - One or more raw transaction hex strings
|
|
1455
|
-
* @returns Broadcast transaction id
|
|
1456
|
-
* @throws Error if the broadcast request fails or the package shape is invalid
|
|
1457
|
-
*/
|
|
1458
|
-
broadcastTransaction(...txs: string[]): Promise<string>;
|
|
1459
|
-
/**
|
|
1460
|
-
* Fetch outspend information for every output in a transaction.
|
|
1461
|
-
*
|
|
1462
|
-
* @param txid - Transaction id to inspect
|
|
1463
|
-
* @returns Per-output spend status information. `txid` (the spender) may be
|
|
1464
|
-
* absent even when `spent` is true: some Esplora deployments
|
|
1465
|
-
* (e.g. mempool.arkade.sh) omit it from `/outspends`.
|
|
1466
|
-
* @see getTxStatus
|
|
1467
|
-
*/
|
|
1468
|
-
getTxOutspends(txid: string): Promise<{
|
|
1469
|
-
spent: boolean;
|
|
1470
|
-
txid?: string;
|
|
1471
|
-
}[]>;
|
|
1472
|
-
/**
|
|
1473
|
-
* Fetch transactions associated with an address.
|
|
1474
|
-
*
|
|
1475
|
-
* @param address - Bitcoin address to query
|
|
1476
|
-
* @returns Transactions involving the address
|
|
1477
|
-
* @see ExplorerTransaction
|
|
1478
|
-
*/
|
|
1479
|
-
getTransactions(address: string): Promise<ExplorerTransaction[]>;
|
|
1480
|
-
/**
|
|
1481
|
-
* Fetch confirmation status for a transaction.
|
|
1482
|
-
*
|
|
1483
|
-
* @param txid - Transaction id to inspect
|
|
1484
|
-
* @returns Confirmation status and block metadata when confirmed
|
|
1485
|
-
* @see getTxOutspends
|
|
1486
|
-
*/
|
|
1487
|
-
getTxStatus(txid: string): Promise<{
|
|
1488
|
-
confirmed: false;
|
|
1489
|
-
} | {
|
|
1490
|
-
confirmed: true;
|
|
1491
|
-
blockTime: number;
|
|
1492
|
-
blockHeight: number;
|
|
1493
|
-
}>;
|
|
1494
|
-
/**
|
|
1495
|
-
* Fetch the current chain tip.
|
|
1496
|
-
*
|
|
1497
|
-
* @returns Current chain height, block time, and block hash
|
|
1498
|
-
*/
|
|
1499
|
-
getChainTip(): Promise<{
|
|
1500
|
-
height: number;
|
|
1501
|
-
time: number;
|
|
1502
|
-
hash: string;
|
|
1503
|
-
}>;
|
|
1504
|
-
/**
|
|
1505
|
-
* Watch a set of addresses and invoke the callback when transactions are observed.
|
|
1506
|
-
*
|
|
1507
|
-
* @param addresses - Addresses to monitor
|
|
1508
|
-
* @param eventCallback - Callback invoked when matching transactions are seen
|
|
1509
|
-
* @returns Stop function that cancels the watch
|
|
1510
|
-
* @remarks
|
|
1511
|
-
* Implementations may use websockets, server-sent events, polling, or a hybrid strategy.
|
|
1512
|
-
* @see getTransactions
|
|
1513
|
-
*/
|
|
1514
|
-
watchAddresses(addresses: string[], eventCallback: (txs: ExplorerTransaction[]) => void): Promise<() => void>;
|
|
1515
|
-
}
|
|
1516
|
-
/**
|
|
1517
|
-
* Implementation of the onchain provider interface for esplora REST API.
|
|
1518
|
-
*
|
|
1519
|
-
* @see https://mempool.space/docs/api/rest
|
|
1520
|
-
* @example
|
|
1521
|
-
* ```typescript
|
|
1522
|
-
* const provider = new EsploraProvider("https://mempool.space/api");
|
|
1523
|
-
* const outputs = await provider.getCoins("bcrt1q679zsd45msawvr7782r0twvmukns3drlstjt77");
|
|
1524
|
-
* ```
|
|
1525
|
-
*/
|
|
1526
|
-
declare class EsploraProvider implements OnchainProvider {
|
|
1527
|
-
private baseUrl;
|
|
1528
|
-
readonly pollingInterval: number;
|
|
1529
|
-
readonly forcePolling: boolean;
|
|
1530
|
-
constructor(baseUrl?: string, opts?: {
|
|
1531
|
-
/** Polling interval in milliseconds. */
|
|
1532
|
-
pollingInterval?: number;
|
|
1533
|
-
/** Force polling even when websocket transport is available. */
|
|
1534
|
-
forcePolling?: boolean;
|
|
1535
|
-
});
|
|
1536
|
-
getCoins(address: string): Promise<Coin[]>;
|
|
1537
|
-
getFeeRate(): Promise<number | undefined>;
|
|
1538
|
-
broadcastTransaction(...txs: string[]): Promise<string>;
|
|
1539
|
-
getTxOutspends(txid: string): Promise<{
|
|
1540
|
-
spent: boolean;
|
|
1541
|
-
txid?: string;
|
|
1542
|
-
}[]>;
|
|
1543
|
-
getTransactions(address: string): Promise<ExplorerTransaction[]>;
|
|
1544
|
-
getTxStatus(txid: string): Promise<{
|
|
1545
|
-
confirmed: false;
|
|
1546
|
-
} | {
|
|
1547
|
-
confirmed: true;
|
|
1548
|
-
blockTime: number;
|
|
1549
|
-
blockHeight: number;
|
|
1550
|
-
}>;
|
|
1551
|
-
watchAddresses(addresses: string[], callback: (txs: ExplorerTransaction[]) => void): Promise<() => void>;
|
|
1552
|
-
getChainTip(): Promise<{
|
|
1553
|
-
height: number;
|
|
1554
|
-
time: number;
|
|
1555
|
-
hash: string;
|
|
1556
|
-
}>;
|
|
1557
|
-
private broadcastPackage;
|
|
1558
|
-
private broadcastTx;
|
|
1559
|
-
}
|
|
1560
|
-
|
|
1561
1681
|
interface WalletState {
|
|
1562
1682
|
/** Arbitrary stored wallet settings. */
|
|
1563
1683
|
settings?: Record<string, any>;
|
|
@@ -1802,14 +1922,26 @@ interface HandlerError {
|
|
|
1802
1922
|
}
|
|
1803
1923
|
/**
|
|
1804
1924
|
* Outcome of a {@link IContractManager.scanContracts} run.
|
|
1805
|
-
*
|
|
1806
|
-
* `lastIndexUsed` is the highest HD index at which any handler discovered a
|
|
1807
|
-
* contract (`-1` if nothing was found). `handlerErrors` collects per-handler
|
|
1808
|
-
* `discoverAt` failures — non-empty means the gap window may have closed
|
|
1809
|
-
* early and the caller should surface this (the scan itself still resolved).
|
|
1810
1925
|
*/
|
|
1811
1926
|
interface ScanResult {
|
|
1927
|
+
/** @deprecated Alias of {@link ScanResult.highestConfirmedUsedIndex}. */
|
|
1812
1928
|
lastIndexUsed: number;
|
|
1929
|
+
/**
|
|
1930
|
+
* Highest HD index at which any handler confirmed a contract (`-1` if none),
|
|
1931
|
+
* including hits past {@link ScanResult.truncatedAt}. Safe to record
|
|
1932
|
+
* unconditionally: the HD watermark it feeds is a monotonic max over a scan
|
|
1933
|
+
* that always restarts at 0, so it cannot skip an index — while withholding
|
|
1934
|
+
* it risks re-issuing a funded index as a fresh receive address.
|
|
1935
|
+
*/
|
|
1936
|
+
highestConfirmedUsedIndex: number;
|
|
1937
|
+
/**
|
|
1938
|
+
* First index a handler failed at, making it *indeterminate* — neither a hit
|
|
1939
|
+
* nor a confirmed miss. The scan stops there, so indices `>= truncatedAt` are
|
|
1940
|
+
* unverified and the caller must retry (scanning is idempotent). `undefined`
|
|
1941
|
+
* when the scan closed a genuine gap.
|
|
1942
|
+
*/
|
|
1943
|
+
truncatedAt?: number;
|
|
1944
|
+
/** Per-handler `discoverAt` failures. Non-empty implies `truncatedAt` is set. */
|
|
1813
1945
|
handlerErrors: HandlerError[];
|
|
1814
1946
|
}
|
|
1815
1947
|
/**
|
|
@@ -1895,7 +2027,7 @@ interface IContractManager extends Disposable {
|
|
|
1895
2027
|
* in wallet/handler code, and keeps the wallet from silently stamping the
|
|
1896
2028
|
* default tapscript onto a non-default vtxo.
|
|
1897
2029
|
*/
|
|
1898
|
-
annotateVtxos(vtxos: VirtualCoin[]): Promise<
|
|
2030
|
+
annotateVtxos(vtxos: VirtualCoin[]): Promise<NormalizedExtendedVirtualCoin[]>;
|
|
1899
2031
|
/**
|
|
1900
2032
|
* Update mutable contract fields.
|
|
1901
2033
|
*
|
|
@@ -1961,15 +2093,17 @@ interface IContractManager extends Disposable {
|
|
|
1961
2093
|
*
|
|
1962
2094
|
* Error contract (safety-critical — see spec §4):
|
|
1963
2095
|
* - A handler's `discoverAt` rejecting is **collected** into
|
|
1964
|
-
* `handlerErrors` and
|
|
1965
|
-
* scan
|
|
2096
|
+
* `handlerErrors` and makes its index *indeterminate*: it never
|
|
2097
|
+
* advances the gap counter, and the scan **stops verifying** there
|
|
2098
|
+
* rather than closing a window it never observed close. It still
|
|
2099
|
+
* never throws.
|
|
1966
2100
|
* - A fatal operational error — `materialize()` throwing, or
|
|
1967
2101
|
* `createContract` rejecting — **propagates** out of `scanContracts`
|
|
1968
2102
|
* (it invalidates the gap-window signal, so a silent truncation
|
|
1969
2103
|
* would risk hiding user funds).
|
|
1970
2104
|
*
|
|
1971
2105
|
* @param opts See {@link ScanContractsOptions}.
|
|
1972
|
-
* @returns
|
|
2106
|
+
* @returns See {@link ScanResult}. The caller surfaces `truncatedAt` /
|
|
1973
2107
|
* `handlerErrors` *after* the inline VTXO pull.
|
|
1974
2108
|
*/
|
|
1975
2109
|
scanContracts(opts: ScanContractsOptions): Promise<ScanResult>;
|
|
@@ -2182,9 +2316,10 @@ declare class ContractManager implements IContractManager {
|
|
|
2182
2316
|
* Safety-critical invariants (spec §2.C / §4):
|
|
2183
2317
|
* - `opts.materialize(i)` throwing is structural/fatal: it is NOT
|
|
2184
2318
|
* wrapped — it propagates and aborts the scan.
|
|
2185
|
-
* - A `discoverAt` rejection is collected into `handlerErrors` and
|
|
2186
|
-
*
|
|
2187
|
-
*
|
|
2319
|
+
* - A `discoverAt` rejection is collected into `handlerErrors` and makes
|
|
2320
|
+
* its index *indeterminate*: it does NOT advance the gap counter, and
|
|
2321
|
+
* the scan stops verifying there, reporting `truncatedAt`. Only an index
|
|
2322
|
+
* every handler answered for can be a confirmed miss.
|
|
2188
2323
|
* - `persistAndWatchContract` rejecting is operational/fatal and
|
|
2189
2324
|
* propagates (only `discoverAt` is guarded).
|
|
2190
2325
|
* - Within an index the handler probes run concurrently (independent
|
|
@@ -2198,8 +2333,12 @@ declare class ContractManager implements IContractManager {
|
|
|
2198
2333
|
* over-scanned, nothing is discarded, and `materialize`/`discoverAt` are
|
|
2199
2334
|
* invoked on exactly the same index set. The window's hits are still
|
|
2200
2335
|
* processed strictly in ascending index order, so the discovered set,
|
|
2201
|
-
* persisted rows, `
|
|
2202
|
-
* identical to the serial path — only the wall-clock
|
|
2336
|
+
* persisted rows, `highestConfirmedUsedIndex`, and `handlerErrors` are
|
|
2337
|
+
* byte-for-byte identical to the serial path — only the wall-clock
|
|
2338
|
+
* differs. Truncation is the one exception: a window's concurrent probes
|
|
2339
|
+
* can surface hits above the failed index that a serial scan would never
|
|
2340
|
+
* have reached, so a truncated batched scan discovers a superset — never
|
|
2341
|
+
* a subset — of the serial one.
|
|
2203
2342
|
*/
|
|
2204
2343
|
scanContracts(opts: ScanContractsOptions): Promise<ScanResult>;
|
|
2205
2344
|
/**
|
|
@@ -2219,7 +2358,7 @@ declare class ContractManager implements IContractManager {
|
|
|
2219
2358
|
*/
|
|
2220
2359
|
getContracts(filter?: GetContractsFilter): Promise<Contract[]>;
|
|
2221
2360
|
getContractsWithVtxos(filter?: GetContractsFilter, pageSize?: number): Promise<ContractWithVtxos[]>;
|
|
2222
|
-
annotateVtxos(vtxos: VirtualCoin[]): Promise<
|
|
2361
|
+
annotateVtxos(vtxos: VirtualCoin[]): Promise<NormalizedExtendedVirtualCoin[]>;
|
|
2223
2362
|
private buildContractsDbFilter;
|
|
2224
2363
|
/**
|
|
2225
2364
|
* Update a contract.
|
|
@@ -2438,7 +2577,7 @@ type ContractVtxo = VirtualCoin & Partial<TapLeaves & EncodedVtxoScript> & {
|
|
|
2438
2577
|
* should enforce that annotation has happened — e.g. `saveVtxos` and
|
|
2439
2578
|
* forfeit transaction construction.
|
|
2440
2579
|
*/
|
|
2441
|
-
type ExtendedContractVtxo =
|
|
2580
|
+
type ExtendedContractVtxo = NormalizedExtendedVirtualCoin & {
|
|
2442
2581
|
contractScript: string;
|
|
2443
2582
|
};
|
|
2444
2583
|
/**
|
|
@@ -2899,6 +3038,10 @@ declare class ContractWatcher {
|
|
|
2899
3038
|
private listenLoop;
|
|
2900
3039
|
/**
|
|
2901
3040
|
* Handle a subscription update.
|
|
3041
|
+
*
|
|
3042
|
+
* Normalization boundary: `getSubscription` is part of the public `IndexerProvider` interface,
|
|
3043
|
+
* so a consumer implementation may yield legacy-shaped VTXOs. Normalizing on ingest also fixes
|
|
3044
|
+
* the shape of the payloads emitted to external event consumers.
|
|
2902
3045
|
*/
|
|
2903
3046
|
private handleSubscriptionUpdate;
|
|
2904
3047
|
/**
|
|
@@ -3676,7 +3819,13 @@ interface BurnParams {
|
|
|
3676
3819
|
* @see Output
|
|
3677
3820
|
*/
|
|
3678
3821
|
interface SettleParams {
|
|
3679
|
-
/**
|
|
3822
|
+
/**
|
|
3823
|
+
* Offchain virtual outputs and/or onchain boarding inputs to settle.
|
|
3824
|
+
*
|
|
3825
|
+
* @remarks
|
|
3826
|
+
* Arknotes are settled by passing the `ArkNote` itself (it is an `ExtendedCoin`), not its
|
|
3827
|
+
* string form — `ArkNote.fromString(note)`.
|
|
3828
|
+
*/
|
|
3680
3829
|
inputs: ExtendedCoin[];
|
|
3681
3830
|
/** Optional onchain outputs to create (i.e., exit to). */
|
|
3682
3831
|
outputs: Output[];
|
|
@@ -3706,7 +3855,13 @@ interface Status {
|
|
|
3706
3855
|
block_time?: number;
|
|
3707
3856
|
}
|
|
3708
3857
|
/**
|
|
3709
|
-
* Virtual output status
|
|
3858
|
+
* Virtual output status.
|
|
3859
|
+
*
|
|
3860
|
+
* @deprecated Use the canonical facts on {@link VirtualCoin} — `isSwept`, `isPreconfirmed`,
|
|
3861
|
+
* `isSpent`, `expiresAt`, `expiresAtHeight`, `commitmentTxIds`, `spentBy`, `settledBy` — and the
|
|
3862
|
+
* capability predicates {@link canSpendOffchain}, {@link canRecoverOnchain},
|
|
3863
|
+
* {@link hasTerminalSpend}, {@link isPastExpiry}. `state` collapses independent facts into one
|
|
3864
|
+
* lossy label; this object is retained only as a backward-compatible projection.
|
|
3710
3865
|
*/
|
|
3711
3866
|
interface VirtualStatus {
|
|
3712
3867
|
/**
|
|
@@ -3717,25 +3872,24 @@ interface VirtualStatus {
|
|
|
3717
3872
|
* - `swept`: expired/swept and recoverable in a new batch
|
|
3718
3873
|
* - `spent`: destroyed by a later transaction
|
|
3719
3874
|
*
|
|
3720
|
-
* @
|
|
3721
|
-
* `
|
|
3722
|
-
*
|
|
3875
|
+
* @deprecated Lossy: the states are not orthogonal and collapse with precedence
|
|
3876
|
+
* `spent` > `swept` > `preconfirmed` > `settled`, so a spent VTXO that was also swept reports
|
|
3877
|
+
* only `spent`. Read `isSpent`/`isSwept`/`isPreconfirmed` instead, or a capability predicate.
|
|
3723
3878
|
*/
|
|
3724
3879
|
state: "preconfirmed" | "settled" | "swept" | "spent";
|
|
3725
3880
|
/**
|
|
3726
3881
|
* Which batch commitment transaction(s) this virtual output depends on.
|
|
3727
3882
|
*
|
|
3728
|
-
* @
|
|
3729
|
-
* The history builder uses these ids to group received batch transactions and
|
|
3730
|
-
* relate refreshed or forfeited virtual outputs back to the same batch.
|
|
3883
|
+
* @deprecated Use {@link VirtualCoin.commitmentTxIds}.
|
|
3731
3884
|
*/
|
|
3732
3885
|
commitmentTxIds?: string[];
|
|
3733
3886
|
/**
|
|
3734
|
-
* The earliest point at which this virtual output stops being safely preconfirmed
|
|
3887
|
+
* The earliest point at which this virtual output stops being safely preconfirmed,
|
|
3888
|
+
* in milliseconds.
|
|
3735
3889
|
*
|
|
3736
|
-
* @
|
|
3737
|
-
*
|
|
3738
|
-
*
|
|
3890
|
+
* @deprecated Unit-ambiguous: the server returns a single scalar that is either unix seconds or
|
|
3891
|
+
* a block height, and both land here multiplied by 1000. Use {@link VirtualCoin.expiresAt} and
|
|
3892
|
+
* {@link VirtualCoin.expiresAtHeight}, which disambiguate the two.
|
|
3739
3893
|
*/
|
|
3740
3894
|
batchExpiry?: number;
|
|
3741
3895
|
}
|
|
@@ -3760,8 +3914,16 @@ interface Coin extends Outpoint {
|
|
|
3760
3914
|
/**
|
|
3761
3915
|
* Virtual output data.
|
|
3762
3916
|
*
|
|
3917
|
+
* @remarks
|
|
3918
|
+
* The canonical facts (`isSwept`, `isPreconfirmed`, `isSpent`, `expiresAt`, `expiresAtHeight`,
|
|
3919
|
+
* `commitmentTxIds`) are optional because `VirtualCoin` is also a *construction* type: custom
|
|
3920
|
+
* {@link IndexerProvider} and {@link WalletRepository} implementations may hand back coins without
|
|
3921
|
+
* them. The SDK normalizes every incoming coin, so coins it returns always carry the facts that are
|
|
3922
|
+
* determinable; do not read these fields off a coin the SDK has not returned to you — use
|
|
3923
|
+
* {@link canSpendOffchain} / {@link canRecoverOnchain} / {@link hasTerminalSpend} /
|
|
3924
|
+
* {@link isPastExpiry}, which normalize defensively.
|
|
3925
|
+
*
|
|
3763
3926
|
* @see Coin
|
|
3764
|
-
* @see VirtualStatus
|
|
3765
3927
|
*/
|
|
3766
3928
|
interface VirtualCoin extends Coin {
|
|
3767
3929
|
/** Creation time of the virtual output. */
|
|
@@ -3775,13 +3937,40 @@ interface VirtualCoin extends Coin {
|
|
|
3775
3937
|
* This is not set to true if the virtual output is unrolled or swept, only when it's spent offchain.
|
|
3776
3938
|
*/
|
|
3777
3939
|
isSpent?: boolean;
|
|
3940
|
+
/** Whether the server has swept the batch this virtual output belongs to. */
|
|
3941
|
+
isSwept?: boolean;
|
|
3942
|
+
/** Whether this virtual output is not yet finalized in a batch. */
|
|
3943
|
+
isPreconfirmed?: boolean;
|
|
3778
3944
|
/** ID of the onchain commitment transaction that settled this output, if applicable. */
|
|
3779
3945
|
settledBy?: string;
|
|
3780
|
-
/**
|
|
3946
|
+
/**
|
|
3947
|
+
* ID of the offchain checkpoint transaction that spent this output.
|
|
3948
|
+
*
|
|
3949
|
+
* @remarks
|
|
3950
|
+
* The empty string means "not spent by anything" — test truthiness, never presence.
|
|
3951
|
+
*/
|
|
3781
3952
|
spentBy?: string;
|
|
3782
3953
|
/** ID of the offchain Arkade transaction that spent the above checkpoint output, if applicable. */
|
|
3783
3954
|
arkTxId?: string;
|
|
3784
|
-
/**
|
|
3955
|
+
/** Batch commitment transaction(s) this virtual output depends on. */
|
|
3956
|
+
commitmentTxIds?: string[];
|
|
3957
|
+
/**
|
|
3958
|
+
* Wall-clock batch expiry, when the server expressed expiry as a timestamp.
|
|
3959
|
+
*
|
|
3960
|
+
* @remarks
|
|
3961
|
+
* Mutually exclusive with `expiresAtHeight`; both are absent when there is no expiry.
|
|
3962
|
+
*/
|
|
3963
|
+
expiresAt?: Date;
|
|
3964
|
+
/**
|
|
3965
|
+
* Block-height batch expiry, when the server expressed expiry as a height (regtest-like
|
|
3966
|
+
* deployments). Evaluating it needs a chain tip — see {@link isPastExpiry}.
|
|
3967
|
+
*/
|
|
3968
|
+
expiresAtHeight?: number;
|
|
3969
|
+
/**
|
|
3970
|
+
* Virtual output status.
|
|
3971
|
+
*
|
|
3972
|
+
* @deprecated See {@link VirtualStatus}.
|
|
3973
|
+
*/
|
|
3785
3974
|
virtualStatus: VirtualStatus;
|
|
3786
3975
|
/** Assets carried by this virtual output, if any. */
|
|
3787
3976
|
assets?: Asset[];
|
|
@@ -3854,42 +4043,7 @@ type ExtendedCoin = TapLeaves & EncodedVtxoScript & Coin & {
|
|
|
3854
4043
|
type ExtendedVirtualCoin = TapLeaves & EncodedVtxoScript & VirtualCoin & {
|
|
3855
4044
|
extraWitness?: Bytes[];
|
|
3856
4045
|
};
|
|
3857
|
-
|
|
3858
|
-
* Return whether a virtual output is still spendable.
|
|
3859
|
-
*
|
|
3860
|
-
* @param vtxo - virtual output to inspect
|
|
3861
|
-
* @returns `true` when the virtual output is not marked as spent
|
|
3862
|
-
*
|
|
3863
|
-
* @see isRecoverable
|
|
3864
|
-
* @see isExpired
|
|
3865
|
-
*/
|
|
3866
|
-
declare function isSpendable(vtxo: VirtualCoin): boolean;
|
|
3867
|
-
/**
|
|
3868
|
-
* Return whether a virtual output is recoverable.
|
|
3869
|
-
*
|
|
3870
|
-
* @param vtxo - virtual output to inspect
|
|
3871
|
-
* @returns `true` when the virtual output is swept but still spendable
|
|
3872
|
-
*
|
|
3873
|
-
* @remarks
|
|
3874
|
-
* Recoverable virtual outputs are typically re-settled into fresh virtual outputs by the virtual output manager.
|
|
3875
|
-
*
|
|
3876
|
-
* @see isSpendable
|
|
3877
|
-
* @see isExpired
|
|
3878
|
-
*/
|
|
3879
|
-
declare function isRecoverable(vtxo: VirtualCoin): boolean;
|
|
3880
|
-
/**
|
|
3881
|
-
* Return whether a virtual output should be treated as expired.
|
|
3882
|
-
*
|
|
3883
|
-
* @param vtxo - virtual output to inspect
|
|
3884
|
-
* @returns `true` when the virtual output is swept or its batch expiry has passed
|
|
3885
|
-
* @remarks
|
|
3886
|
-
* On regtest-like environments the upstream expiry value may be expressed as a block
|
|
3887
|
-
* height instead of a timestamp. This helper intentionally ignores obviously non-time
|
|
3888
|
-
* values to avoid false positives.
|
|
3889
|
-
*
|
|
3890
|
-
* @see VirtualStatus.batchExpiry
|
|
3891
|
-
*/
|
|
3892
|
-
declare function isExpired(vtxo: VirtualCoin): boolean;
|
|
4046
|
+
|
|
3893
4047
|
/**
|
|
3894
4048
|
* Return whether a virtual output is below the dust threshold.
|
|
3895
4049
|
*
|
|
@@ -4031,10 +4185,11 @@ interface IReadonlyWallet {
|
|
|
4031
4185
|
* Get virtual outputs tracked by the wallet.
|
|
4032
4186
|
*
|
|
4033
4187
|
* @param filter - Optional filtering flags
|
|
4034
|
-
* @returns virtual outputs with tapscript and witness data
|
|
4188
|
+
* @returns virtual outputs with tapscript and witness data, normalized: every canonical fact
|
|
4189
|
+
* the capability predicates read is populated, whatever the underlying repository stored
|
|
4035
4190
|
* @see GetVtxosFilter
|
|
4036
4191
|
*/
|
|
4037
|
-
getVtxos(filter?: GetVtxosFilter): Promise<
|
|
4192
|
+
getVtxos(filter?: GetVtxosFilter): Promise<NormalizedExtendedVirtualCoin[]>;
|
|
4038
4193
|
/** @returns Onchain boarding inputs tracked by the wallet. */
|
|
4039
4194
|
getBoardingUtxos(): Promise<ExtendedCoin[]>;
|
|
4040
4195
|
/** @returns Wallet transaction history derived from boarding and Arkade activity. */
|
|
@@ -4810,4 +4965,4 @@ declare namespace ProtoTypes {
|
|
|
4810
4965
|
export { };
|
|
4811
4966
|
}
|
|
4812
4967
|
|
|
4813
|
-
export { type
|
|
4968
|
+
export { type ReadonlyIdentity as $, type ArkTransaction as A, type VirtualTxRepository as B, type ContractRepository as C, type VirtualTx as D, type ExtendedCoin as E, type VtxoBranch as F, type GetVtxosFilter as G, ChainedTxType as H, type IWallet as I, type BatchStartedEvent as J, type TreeSigningStartedEvent as K, TxTree as L, type TreeNoncesEvent as M, type NormalizedExtendedVirtualCoin as N, type Outpoint as O, type BatchFinalizationEvent as P, type BatchFinalizedEvent as Q, type Recipient as R, type SendBitcoinParams as S, type TxNotification as T, type BatchFailedEvent as U, VtxoScript as V, type WalletRepository as W, type TreeTxEvent as X, type TreeSignatureEvent as Y, type DescriptorProvider as Z, type IReadonlyWallet as _, type Identity as a, ChainTxType as a$, type Network as a0, type OnchainProvider as a1, type DelegateProvider as a2, type ReadonlyWalletConfig as a3, type ExitCaptureMode as a4, type ExitDataSource as a5, type IReadonlyAssetManager as a6, type ContractSyncState as a7, type NetworkName as a8, type ArkInfo as a9, type BurnParams as aA, type RenewVtxosOptions as aB, type ContractWithVtxos as aC, type PathSelection as aD, type ContractEvent as aE, type AssetDetails as aF, type IssuanceResult as aG, type DelegateInfo as aH, type MigrationGlobalSkipReason as aI, type MigrationLegSkipReason as aJ, type SignerStatus as aK, type StorageConfig as aL, type IVtxoManager as aM, type ExplorerTransaction as aN, type EncodedVtxoScript as aO, type Status as aP, type ChainTx as aQ, type PathContext as aR, type ActivityIntent as aS, type ActivityResolver as aT, type ArkIntentState as aU, type ArkTapscript as aV, type AssetMetadata as aW, type BaseWalletConfig as aX, type BatchInfo as aY, type BatchSignableIdentity as aZ, CLTVMultisigTapscript as a_, ArkAddress as aa, type Coin as ab, ContractManager as ac, CSVMultisigTapscript as ad, type SettlementConfig as ae, VtxoManager as af, type SignerSession as ag, type SignedIntent as ah, Intent as ai, type TimeHeight as aj, type DescriptorSigningRequest as ak, Transaction as al, type IntentFeeConfig as am, type OffchainInput as an, FeeAmount as ao, type OnchainInput as ap, type FeeOutput as aq, type ContractWatcherConfig as ar, type Asset as as, type FeeInfo as at, type CreateContractParams as au, type GetContractsFilter as av, type GetSpendablePathsOptions as aw, type GetAllSpendingPathsOptions as ax, type IssuanceParams as ay, type ReissuanceParams as az, type WalletConfig as b, type VtxoChain as b$, type CommitmentTx as b0, ConditionCSVMultisigTapscript as b1, ConditionMultisigTapscript as b2, type ContractBalance as b3, type ContractEventCallback as b4, type ContractHandler as b5, type ContractManagerConfig as b6, type ContractState as b7, type ContractVtxo as b8, ContractWatcher as b9, type PageResponse as bA, type PaginationOptions as bB, PartialSig as bC, type ProviderClass as bD, RestDelegateProvider as bE, RestDelegatorProvider as bF, type ScanContractsOptions as bG, type ScanResult as bH, type ScheduledSession as bI, SettlementEventType as bJ, type SignRequest as bK, type SignerClassification as bL, type SignerSet as bM, type SubscriptionEvent as bN, type SubscriptionHeartbeat as bO, type TapLeaves as bP, TapTreeCoder as bQ, TapscriptType as bR, type TreeNonces as bS, type TreePartialSigs as bT, type Tx as bU, type TxHistoryRecord as bV, type TxKey as bW, type TxTreeNode as bX, TxType as bY, type VirtualStatus as bZ, type Vtxo as b_, DelegateManagerImpl as ba, type DelegateOptions as bb, DelegatorManagerImpl as bc, type DelegatorProvider as bd, type DeprecatedSignerMigrationReport as be, type DeprecatedSignerReport as bf, DigestMismatchError as bg, type Discoverable as bh, type DiscoveredContract as bi, type DiscoveryDeps as bj, ESPLORA_URL as bk, EsploraProvider as bl, type ExitChainResolver as bm, type ExtendedContractVtxo as bn, type GroupMembership as bo, type HandlerError as bp, type IDelegatorManager as bq, INTENT_TERMINAL_STATES as br, IndexerTxType as bs, type KnownMetadata as bt, type MigrateDeprecatedSignerOptions as bu, type MigrationLegReport as bv, type MigrationVtxoRef as bw, MultisigTapscript as bx, type Nonces as by, type Output as bz, type WalletBalance as c, type VtxoType as c0, type WalletMode as c1, boardingResolver as c2, canRecoverOnchain as c3, canSpendOffchain as c4, classifyAgainstSignerSet as c5, classifyContractSigner as c6, createDefaultActivityRegistry as c7, createExitChainResolver as c8, decodeTapscript as c9, getNetwork as ca, getSequence as cb, hasTerminalSpend as cc, isBatchSignable as cd, isCooperativelyMigratable as ce, isDiscoverable as cf, isExpired as cg, isPastExpiry as ch, isRecoverable as ci, isSpendable as cj, isSubdust as ck, isTerminalIntentState as cl, isVirtualCoin as cm, isVtxoExpiringSoon as cn, networks as co, signerSetFromInfo as cp, toXOnlySignerHex as cq, type TapscriptDeriving as cr, ActivityRegistry as d, type Activity as e, type IContractManager as f, type IDelegateManager as g, type SettleParams as h, type SettlementEvent as i, type IAssetManager as j, RestArkProvider as k, RestIndexerProvider as l, type SubscriptionResponse as m, type ArkProvider as n, type IndexerProvider as o, type RelativeTimelock as p, type TapLeafScript as q, type VirtualCoin as r, type Contract as s, type ExtendedVirtualCoin as t, type VtxoRepositoryKey as u, type WalletState as v, type ContractFilter as w, type IntentRepository as x, type ArkIntent as y, type IntentFilter as z };
|