@arkade-os/sdk 0.5.2 → 0.5.4
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 +36 -34
- package/dist/adapters/expo.cjs +9 -5
- package/dist/adapters/expo.d.cts +11 -7
- package/dist/adapters/expo.d.ts +11 -7
- package/dist/adapters/expo.js +3 -3
- package/dist/{asyncStorageTaskQueue-DIn7bTqN.d.ts → asyncStorageTaskQueue-DHMIxY04.d.ts} +2 -2
- package/dist/{asyncStorageTaskQueue-BtEc3Qca.d.cts → asyncStorageTaskQueue-DTBa8EH7.d.cts} +2 -2
- package/dist/{chunk-LWRMSC4M.js → chunk-6CUP6ZIF.js} +4 -4
- package/dist/{chunk-LWRMSC4M.js.map → chunk-6CUP6ZIF.js.map} +1 -1
- package/dist/{chunk-HKG26NUT.js → chunk-AG4TFD6F.js} +140 -59
- package/dist/chunk-AG4TFD6F.js.map +1 -0
- package/dist/{chunk-PVFQFQBY.cjs → chunk-B6VNKGIH.cjs} +10 -10
- package/dist/chunk-B6VNKGIH.cjs.map +1 -0
- package/dist/{chunk-U5XG7SWA.js → chunk-BTRCN4JJ.js} +22 -19
- package/dist/chunk-BTRCN4JJ.js.map +1 -0
- package/dist/{chunk-TAIWH3HG.cjs → chunk-DNITZVNG.cjs} +28 -47
- package/dist/chunk-DNITZVNG.cjs.map +1 -0
- package/dist/{chunk-OM6FJ76H.cjs → chunk-E6OOJEHL.cjs} +49 -49
- package/dist/{chunk-OM6FJ76H.cjs.map → chunk-E6OOJEHL.cjs.map} +1 -1
- package/dist/{chunk-2OCYL6BJ.cjs → chunk-F3FAE7VJ.cjs} +850 -652
- package/dist/chunk-F3FAE7VJ.cjs.map +1 -0
- package/dist/{chunk-GGKR4O5X.cjs → chunk-GHUUT54D.cjs} +143 -58
- package/dist/chunk-GHUUT54D.cjs.map +1 -0
- package/dist/{chunk-MOBDJ7U2.js → chunk-MWVAWFX6.js} +4 -4
- package/dist/chunk-MWVAWFX6.js.map +1 -0
- package/dist/{chunk-2QRUQXLS.js → chunk-TUOLZBNC.js} +19 -39
- package/dist/chunk-TUOLZBNC.js.map +1 -0
- package/dist/{chunk-64R7CRKN.cjs → chunk-WXNSISXK.cjs} +37 -34
- package/dist/chunk-WXNSISXK.cjs.map +1 -0
- package/dist/{chunk-AJWXVQYG.js → chunk-ZJHLLDBP.js} +372 -177
- package/dist/chunk-ZJHLLDBP.js.map +1 -0
- package/dist/contracts/handlers/index.cjs +9 -9
- package/dist/contracts/handlers/index.d.cts +3 -3
- package/dist/contracts/handlers/index.d.ts +3 -3
- package/dist/contracts/handlers/index.js +2 -2
- package/dist/{delegate-CaL8EN4Q.d.cts → delegate-f4_t864Z.d.cts} +1 -1
- package/dist/{delegate-Jd4zs88Q.d.ts → delegate-xrSBNybC.d.ts} +1 -1
- package/dist/{index-D-xqVzf8.d.ts → index-BJDz15ms.d.ts} +5 -5
- package/dist/{index-BwdGzNSn.d.cts → index-BjiVGtp8.d.cts} +5 -5
- package/dist/{index-DdKxfC29.d.cts → index-DRwe0UDN.d.cts} +194 -114
- package/dist/{index-DdKxfC29.d.ts → index-DRwe0UDN.d.ts} +194 -114
- package/dist/index.cjs +333 -313
- package/dist/index.d.cts +80 -45
- package/dist/index.d.ts +80 -45
- package/dist/index.js +4 -4
- package/dist/repositories/realm/index.cjs +65 -36
- package/dist/repositories/realm/index.cjs.map +1 -1
- package/dist/repositories/realm/index.d.cts +7 -3
- package/dist/repositories/realm/index.d.ts +7 -3
- package/dist/repositories/realm/index.js +35 -6
- package/dist/repositories/realm/index.js.map +1 -1
- package/dist/repositories/sqlite/index.cjs +176 -110
- package/dist/repositories/sqlite/index.cjs.map +1 -1
- package/dist/repositories/sqlite/index.d.cts +23 -13
- package/dist/repositories/sqlite/index.d.ts +23 -13
- package/dist/repositories/sqlite/index.js +148 -83
- package/dist/repositories/sqlite/index.js.map +1 -1
- package/dist/{taskRunner-ZyGGjtIq.d.ts → taskRunner-BPPU-YHG.d.cts} +4 -4
- package/dist/{taskRunner-67YSEpsz.d.cts → taskRunner-CDlNeth0.d.ts} +4 -4
- package/dist/wallet/expo/background.cjs +14 -14
- package/dist/wallet/expo/background.cjs.map +1 -1
- package/dist/wallet/expo/background.d.cts +3 -3
- package/dist/wallet/expo/background.d.ts +3 -3
- package/dist/wallet/expo/background.js +7 -7
- package/dist/wallet/expo/background.js.map +1 -1
- package/dist/wallet/expo/index.cjs +18 -15
- package/dist/wallet/expo/index.cjs.map +1 -1
- package/dist/wallet/expo/index.d.cts +7 -6
- package/dist/wallet/expo/index.d.ts +7 -6
- package/dist/wallet/expo/index.js +9 -6
- package/dist/wallet/expo/index.js.map +1 -1
- package/dist/{wallet-bFS7VybL.d.ts → wallet-Oc3Wd5gv.d.ts} +27 -19
- package/dist/{wallet-B8LW7cV1.d.cts → wallet-jVBDQl6R.d.cts} +27 -19
- 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 +1 -1
- package/dist/chunk-2OCYL6BJ.cjs.map +0 -1
- package/dist/chunk-2QRUQXLS.js.map +0 -1
- package/dist/chunk-64R7CRKN.cjs.map +0 -1
- package/dist/chunk-AJWXVQYG.js.map +0 -1
- package/dist/chunk-GGKR4O5X.cjs.map +0 -1
- package/dist/chunk-HKG26NUT.js.map +0 -1
- package/dist/chunk-MOBDJ7U2.js.map +0 -1
- package/dist/chunk-PVFQFQBY.cjs.map +0 -1
- package/dist/chunk-TAIWH3HG.cjs.map +0 -1
- package/dist/chunk-U5XG7SWA.js.map +0 -1
|
@@ -91,6 +91,31 @@ interface SignerSession {
|
|
|
91
91
|
}>;
|
|
92
92
|
sign(): Promise<TreePartialSigs>;
|
|
93
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Custom `Identity.signerSession()` methods can return `TreeSignerSession.random()`
|
|
96
|
+
* to keep the local ephemeral key separate from the wallet's signing key.
|
|
97
|
+
*/
|
|
98
|
+
declare class TreeSignerSession implements SignerSession {
|
|
99
|
+
private secretKey;
|
|
100
|
+
static NOT_INITIALIZED: Error;
|
|
101
|
+
private myNonces;
|
|
102
|
+
private aggregateNonces;
|
|
103
|
+
private graph;
|
|
104
|
+
private scriptRoot;
|
|
105
|
+
private rootSharedOutputAmount;
|
|
106
|
+
constructor(secretKey: Uint8Array);
|
|
107
|
+
/** Use a fresh key/session per signing attempt; never reuse sessions or their nonces. */
|
|
108
|
+
static random(): TreeSignerSession;
|
|
109
|
+
init(tree: TxTree, scriptRoot: Uint8Array, rootInputAmount: bigint): Promise<void>;
|
|
110
|
+
getPublicKey(): Promise<Uint8Array>;
|
|
111
|
+
getNonces(): Promise<TreeNonces>;
|
|
112
|
+
aggregatedNonces(txid: string, noncesByPubkey: TreeNonces): Promise<{
|
|
113
|
+
hasAllNonces: boolean;
|
|
114
|
+
}>;
|
|
115
|
+
sign(): Promise<TreePartialSigs>;
|
|
116
|
+
private generateNonces;
|
|
117
|
+
private signPartial;
|
|
118
|
+
}
|
|
94
119
|
|
|
95
120
|
/** A signing request that pairs a descriptor with a transaction. */
|
|
96
121
|
interface DescriptorSigningRequest {
|
|
@@ -138,9 +163,10 @@ interface DescriptorProvider {
|
|
|
138
163
|
* Where the SDK gets its `EventSource`. Node exposes the global only behind
|
|
139
164
|
* `--experimental-eventsource` (24.x), so it must be injectable.
|
|
140
165
|
*
|
|
141
|
-
* Resolution order, per call: per-provider factory, then {@link configureEventSource}, then
|
|
142
|
-
* global. When none answers,
|
|
143
|
-
*
|
|
166
|
+
* Resolution order, per call: per-provider factory, then {@link configureEventSource}, then
|
|
167
|
+
* {@link FetchEventSource} where `fetch` can stream, then the global. When none answers,
|
|
168
|
+
* {@link resolveEventSource} throws {@link EventSourceUnavailableError} so callers can tell
|
|
169
|
+
* "no SSE in this environment" (don't reconnect) from "connection dropped".
|
|
144
170
|
*/
|
|
145
171
|
/**
|
|
146
172
|
* The slice of `EventSource` this SDK actually uses. Structural rather than the DOM type because
|
|
@@ -152,7 +178,7 @@ interface EventSourceLike {
|
|
|
152
178
|
close(): void;
|
|
153
179
|
}
|
|
154
180
|
/** Opens an SSE connection to `url`. `new EventSource(url)`, as a value. */
|
|
155
|
-
type EventSourceFactory = (url: string) => EventSourceLike;
|
|
181
|
+
type EventSourceFactory = (url: string, headers?: Record<string, string>) => EventSourceLike;
|
|
156
182
|
/** Options shared by every provider that opens an SSE stream. */
|
|
157
183
|
interface EventSourceCapable {
|
|
158
184
|
/**
|
|
@@ -175,7 +201,7 @@ declare class EventSourceUnavailableError extends Error {
|
|
|
175
201
|
declare function isEventSourceUnavailableError(error: unknown): error is Error;
|
|
176
202
|
/**
|
|
177
203
|
* Set the `EventSource` every provider uses by default. Call once at startup,
|
|
178
|
-
* before opening a wallet; pass `undefined` to go back to the
|
|
204
|
+
* before opening a wallet; pass `undefined` to go back to the default.
|
|
179
205
|
*
|
|
180
206
|
* @example
|
|
181
207
|
* ```typescript
|
|
@@ -611,7 +637,7 @@ declare class PrevTxUnavailableError extends Error {
|
|
|
611
637
|
* Resolve raw wire-format bytes for each txid, batched and de-duplicated.
|
|
612
638
|
*
|
|
613
639
|
* Emulator v0.0.7+ requires the raw tx behind every input of a submitted ark tx
|
|
614
|
-
* or
|
|
640
|
+
* or proof (`PrevArkTxField`) and of an onchain tx (`PrevoutTxField`).
|
|
615
641
|
* The value is a serialized `wire.MsgTx`, *not* a PSBT — `Transaction.toBytes()`
|
|
616
642
|
* with the default `(withScriptSig=false, withWitness=false)` is exactly the
|
|
617
643
|
* preimage the emulator hashes to check the tx against the outpoint.
|
|
@@ -638,14 +664,14 @@ declare function attachPrevArkTxs(tx: Transaction, txids: string[], source: Prev
|
|
|
638
664
|
*/
|
|
639
665
|
declare function attachPrevoutTxs(tx: Transaction, source: RawTxSource): Promise<void>;
|
|
640
666
|
/**
|
|
641
|
-
* A coin
|
|
667
|
+
* A coin a proof spends, carrying the raw previous tx the emulator needs
|
|
642
668
|
* to resolve its prevout pkScript.
|
|
643
669
|
*/
|
|
644
670
|
type WithPrevTx<T> = T & {
|
|
645
671
|
prevTx?: Uint8Array;
|
|
646
672
|
};
|
|
647
673
|
/**
|
|
648
|
-
* Fill in `prevTx` on every coin
|
|
674
|
+
* Fill in `prevTx` on every coin a proof will spend, in one batched
|
|
649
675
|
* lookup. The proof's synthetic input 0 needs nothing — the emulator synthesises
|
|
650
676
|
* a one-output tx for it — so this covers exactly the coins, which land on proof
|
|
651
677
|
* inputs `1..n`.
|
|
@@ -656,27 +682,30 @@ declare function withPrevTxs<T extends {
|
|
|
656
682
|
}>(coins: T[], source: PrevTxSource, onchain?: RawTxSource): Promise<T[]>;
|
|
657
683
|
|
|
658
684
|
/**
|
|
659
|
-
*
|
|
685
|
+
* An input of a {@link Proof}: an output it proves ownership of. `prevTx` carries the raw wire
|
|
660
686
|
* bytes of the transaction that created it — required by emulator v0.0.7+ on
|
|
661
|
-
* every real input of a submitted proof. {@link
|
|
687
|
+
* every real input of a submitted proof. {@link Proof.create} is synchronous,
|
|
662
688
|
* so the bytes are supplied rather than fetched; `withPrevTxs` fills them in.
|
|
663
689
|
*/
|
|
664
|
-
type
|
|
690
|
+
type ProofInput = WithPrevTx<ExtendedCoin>;
|
|
665
691
|
/**
|
|
666
|
-
*
|
|
667
|
-
*
|
|
668
|
-
*
|
|
669
|
-
* ownership of outputs.
|
|
692
|
+
* A signed BIP322-style PSBT carrying a message. Its inputs are Bitcoin outputs,
|
|
693
|
+
* its signature proves the user controls them, and its message says what to do
|
|
694
|
+
* with them.
|
|
670
695
|
*
|
|
671
|
-
*
|
|
696
|
+
* A proof is a deliberately invalid PSBT, so it can never be broadcast. Signing
|
|
697
|
+
* a proof means signing the PSBT as a regular transaction.
|
|
698
|
+
*/
|
|
699
|
+
type Proof = Transaction;
|
|
700
|
+
/**
|
|
701
|
+
* Utilities for creating and inspecting {@link Proof}s.
|
|
672
702
|
*
|
|
673
|
-
* It is greatly inspired by BIP322.
|
|
674
703
|
* @see https://github.com/bitcoin/bips/blob/master/bip-0322.mediawiki
|
|
675
704
|
*
|
|
676
705
|
* @example
|
|
677
706
|
* ```typescript
|
|
678
|
-
* // Create
|
|
679
|
-
* const proof =
|
|
707
|
+
* // Create an unsigned proof
|
|
708
|
+
* const proof = Proof.create(
|
|
680
709
|
* "Hello Bitcoin!",
|
|
681
710
|
* [input],
|
|
682
711
|
* [output]
|
|
@@ -684,27 +713,26 @@ type IntentCoin = WithPrevTx<ExtendedCoin>;
|
|
|
684
713
|
*
|
|
685
714
|
* // Sign the proof
|
|
686
715
|
* const signedProof = await identity.sign(proof);
|
|
687
|
-
*
|
|
716
|
+
* ```
|
|
688
717
|
*/
|
|
689
|
-
declare namespace
|
|
690
|
-
type Proof = Transaction;
|
|
718
|
+
declare namespace Proof {
|
|
691
719
|
/**
|
|
692
|
-
* Creates
|
|
720
|
+
* Creates an unsigned {@link Proof}.
|
|
693
721
|
*
|
|
694
722
|
* This function constructs a special transaction that can be signed to prove
|
|
695
723
|
* ownership of onchain and virtual outputs. The proof includes the message to be
|
|
696
724
|
* signed and the inputs/outputs that demonstrate ownership.
|
|
697
725
|
*
|
|
698
|
-
* @param message - The
|
|
726
|
+
* @param message - The message to be signed, either a raw string or a Message object
|
|
699
727
|
* @param ins - Array of transaction inputs to prove ownership of
|
|
700
728
|
* @param outputs - Optional array of transaction outputs
|
|
701
|
-
* @returns An unsigned
|
|
729
|
+
* @returns An unsigned proof
|
|
702
730
|
*/
|
|
703
|
-
function create(message: string | Message, ins: (TransactionInput |
|
|
731
|
+
function create(message: string | Message, ins: (TransactionInput | ProofInput)[], outputs?: TransactionOutput[]): Proof;
|
|
704
732
|
/**
|
|
705
|
-
* Compute the fee paid by
|
|
733
|
+
* Compute the fee paid by a proof.
|
|
706
734
|
*
|
|
707
|
-
* @param proof -
|
|
735
|
+
* @param proof - The proof
|
|
708
736
|
* @returns The fee in satoshis
|
|
709
737
|
*/
|
|
710
738
|
function fee(proof: Proof): number;
|
|
@@ -725,20 +753,32 @@ declare namespace Intent {
|
|
|
725
753
|
};
|
|
726
754
|
type Message = RegisterMessage | DeleteMessage | GetPendingTxMessage;
|
|
727
755
|
/**
|
|
728
|
-
* Serialize
|
|
756
|
+
* Serialize a proof message to the canonical JSON string used for signing.
|
|
729
757
|
*
|
|
730
|
-
* @param message -
|
|
758
|
+
* @param message - Proof message payload
|
|
731
759
|
* @returns Canonical string form of the message
|
|
732
760
|
*/
|
|
733
761
|
function encodeMessage(message: Message): string;
|
|
734
762
|
}
|
|
763
|
+
/** @deprecated Use {@link ProofInput}. */
|
|
764
|
+
type IntentCoin = ProofInput;
|
|
765
|
+
/** @deprecated Use {@link Proof}. */
|
|
766
|
+
declare const Intent: typeof Proof;
|
|
767
|
+
/** @deprecated Use {@link Proof}. */
|
|
768
|
+
declare namespace Intent {
|
|
769
|
+
type Proof = Transaction;
|
|
770
|
+
type RegisterMessage = Proof.RegisterMessage;
|
|
771
|
+
type DeleteMessage = Proof.DeleteMessage;
|
|
772
|
+
type GetPendingTxMessage = Proof.GetPendingTxMessage;
|
|
773
|
+
type Message = Proof.Message;
|
|
774
|
+
}
|
|
735
775
|
|
|
736
776
|
/**
|
|
737
|
-
* Thrown by {@link
|
|
738
|
-
* `DIGEST_MISMATCH` — the client's cached
|
|
777
|
+
* Thrown by {@link RestOperatorProvider} when arkd rejects a request with
|
|
778
|
+
* `DIGEST_MISMATCH` — the client's cached operator info was stale (e.g. an
|
|
739
779
|
* operator signer rotation). By the time this surfaces the provider has already
|
|
740
780
|
* refreshed its info and fired `onServerInfoChanged`; the caller should rebuild
|
|
741
|
-
* the request under the fresh
|
|
781
|
+
* the request under the fresh operator info and retry. Mirrors NArk's
|
|
742
782
|
* `DigestMismatchException` (dotnet-sdk #131): the SDK never silently retries.
|
|
743
783
|
*/
|
|
744
784
|
declare class DigestMismatchError extends Error {
|
|
@@ -835,7 +875,7 @@ interface PendingTx {
|
|
|
835
875
|
}
|
|
836
876
|
interface DeprecatedSigner {
|
|
837
877
|
/**
|
|
838
|
-
* Unix timestamp (seconds) after which the
|
|
878
|
+
* Unix timestamp (seconds) after which the operator no longer accepts this
|
|
839
879
|
* signer's VTXOs as cooperative-migration inputs. arkd advertises this as a
|
|
840
880
|
* non-nullable field, so it is always present: `0n` is the sentinel for "no
|
|
841
881
|
* cutoff advertised" — the deprecated signer is due for migration
|
|
@@ -847,20 +887,22 @@ interface DeprecatedSigner {
|
|
|
847
887
|
pubkey: string;
|
|
848
888
|
}
|
|
849
889
|
type ServiceStatus = Record<string, string>;
|
|
890
|
+
/** @deprecated Use {@link OperatorInfo}. */
|
|
891
|
+
type ArkadeInfo = OperatorInfo;
|
|
850
892
|
/**
|
|
851
|
-
* The
|
|
893
|
+
* The operator's advertised configuration, the `/v1/info` response.
|
|
852
894
|
*
|
|
853
895
|
* Naming/placement vs the NArk reference (AGENTS.md asks divergences to be
|
|
854
896
|
* noted): NArk calls this `ArkServerInfo`, reads it via `GetServerInfoAsync`
|
|
855
897
|
* on the *transport*, and caches it in a dedicated `CachingClientTransport`.
|
|
856
|
-
* This SDK names it for the
|
|
857
|
-
* read off the wallet
|
|
898
|
+
* This SDK names it for the operator and hangs the
|
|
899
|
+
* read off the wallet, because here the wallet is the one
|
|
858
900
|
* object every consumer already holds and — in the service-worker model — the
|
|
859
901
|
* only side that has a transport at all; the page has no provider to hang it
|
|
860
902
|
* on. The `CachingClientTransport`-style memo lives at this layer instead, as
|
|
861
|
-
* `
|
|
903
|
+
* `CachingOperatorProvider`.
|
|
862
904
|
*/
|
|
863
|
-
interface
|
|
905
|
+
interface OperatorInfo {
|
|
864
906
|
boardingExitDelay: bigint;
|
|
865
907
|
checkpointTapscript: string;
|
|
866
908
|
deprecatedSigners: DeprecatedSigner[];
|
|
@@ -882,20 +924,20 @@ interface ArkadeInfo {
|
|
|
882
924
|
*/
|
|
883
925
|
vtxoTreeExpiry?: bigint;
|
|
884
926
|
/**
|
|
885
|
-
* Weight budget
|
|
927
|
+
* Weight budget a transaction must stay under; the operator answers
|
|
886
928
|
* `TX_TOO_LARGE` past it.
|
|
887
929
|
*
|
|
888
|
-
* `undefined` when not advertised
|
|
889
|
-
*
|
|
890
|
-
*
|
|
930
|
+
* `undefined` when not advertised. Omitting the field and sending `0` both
|
|
931
|
+
* mean "no limit stated". Never `0n`, which would say the operator accepts
|
|
932
|
+
* no transaction at all.
|
|
891
933
|
*/
|
|
892
934
|
maxTxWeight?: bigint;
|
|
893
935
|
/**
|
|
894
|
-
* Maximum OP_RETURN outputs the
|
|
936
|
+
* Maximum OP_RETURN outputs the operator accepts per transaction.
|
|
895
937
|
*
|
|
896
|
-
* `undefined` when not advertised
|
|
897
|
-
*
|
|
898
|
-
*
|
|
938
|
+
* `undefined` when not advertised. Omitting the field and sending `0` both
|
|
939
|
+
* mean "no limit stated". Never `0n`, which would say the operator forbids
|
|
940
|
+
* them outright.
|
|
899
941
|
*/
|
|
900
942
|
maxOpReturnOutputs?: bigint;
|
|
901
943
|
/**
|
|
@@ -916,14 +958,16 @@ interface ArkadeInfo {
|
|
|
916
958
|
vtxoMaxAmount: bigint;
|
|
917
959
|
vtxoMinAmount: bigint;
|
|
918
960
|
}
|
|
919
|
-
/**
|
|
920
|
-
interface
|
|
961
|
+
/** A signed {@link Proof} and its message, as sent to the operator. */
|
|
962
|
+
interface SignedProof<T extends Proof.Message> {
|
|
921
963
|
/** Base64-encoded signed proof transaction. */
|
|
922
964
|
proof: string;
|
|
923
|
-
/**
|
|
965
|
+
/** Message the proof commits to. */
|
|
924
966
|
message: T;
|
|
925
967
|
}
|
|
926
|
-
/**
|
|
968
|
+
/** @deprecated Use {@link SignedProof}. */
|
|
969
|
+
type SignedIntent<T extends Proof.Message> = SignedProof<T>;
|
|
970
|
+
/** Transaction notification emitted by the operator's stream. */
|
|
927
971
|
interface TxNotification {
|
|
928
972
|
/** Transaction id. */
|
|
929
973
|
txid: string;
|
|
@@ -947,13 +991,13 @@ interface TxNotification {
|
|
|
947
991
|
interface SweepTxNotification extends TxNotification {
|
|
948
992
|
/**
|
|
949
993
|
* Outpoints the transaction swept — outpoints rather than virtual outputs,
|
|
950
|
-
* because a swept output is gone: the
|
|
994
|
+
* because a swept output is gone: the operator has nothing left to describe
|
|
951
995
|
* beyond where it was. Empty when the sweep touched none of them.
|
|
952
996
|
*/
|
|
953
997
|
sweptVtxos: Outpoint[];
|
|
954
998
|
}
|
|
955
999
|
/**
|
|
956
|
-
* One frame of {@link
|
|
1000
|
+
* One frame of {@link OperatorProvider.getTransactionsStream}. Exactly one arm is
|
|
957
1001
|
* set; an unrecognized frame is dropped rather than yielded.
|
|
958
1002
|
*/
|
|
959
1003
|
interface TxNotificationEvent {
|
|
@@ -961,9 +1005,9 @@ interface TxNotificationEvent {
|
|
|
961
1005
|
arkTx?: TxNotification;
|
|
962
1006
|
sweepTx?: SweepTxNotification;
|
|
963
1007
|
}
|
|
964
|
-
interface
|
|
965
|
-
/** Fetch
|
|
966
|
-
getInfo(): Promise<
|
|
1008
|
+
interface OperatorProvider {
|
|
1009
|
+
/** Fetch the operator's configuration and fee settings. */
|
|
1010
|
+
getInfo(): Promise<OperatorInfo>;
|
|
967
1011
|
/** Submit a signed Arkade transaction and its checkpoint transactions. */
|
|
968
1012
|
submitTx(signedArkTx: string, checkpointTxs: string[]): Promise<{
|
|
969
1013
|
arkTxid: string;
|
|
@@ -972,7 +1016,7 @@ interface ArkProvider {
|
|
|
972
1016
|
}>;
|
|
973
1017
|
/** Finalize a previously submitted Arkade transaction. */
|
|
974
1018
|
finalizeTx(arkTxid: string, finalCheckpointTxs: string[]): Promise<void>;
|
|
975
|
-
/** Register a signed intent with the
|
|
1019
|
+
/** Register a signed intent with the operator. */
|
|
976
1020
|
registerIntent(intent: SignedIntent<Intent.RegisterMessage>): Promise<string>;
|
|
977
1021
|
/** Delete a previously registered intent. */
|
|
978
1022
|
deleteIntent(intent: SignedIntent<Intent.DeleteMessage>): Promise<void>;
|
|
@@ -986,28 +1030,28 @@ interface ArkProvider {
|
|
|
986
1030
|
submitSignedForfeitTxs(signedForfeitTxs: string[], signedCommitmentTx?: string): Promise<void>;
|
|
987
1031
|
/** Open the settlement event stream for the given topics. */
|
|
988
1032
|
getEventStream(signal: AbortSignal, topics: string[]): AsyncIterableIterator<SettlementEvent>;
|
|
989
|
-
/** Stream transaction notifications emitted by the
|
|
1033
|
+
/** Stream transaction notifications emitted by the operator. */
|
|
990
1034
|
getTransactionsStream(signal: AbortSignal): AsyncIterableIterator<TxNotificationEvent>;
|
|
991
1035
|
/** Fetch pending transactions for a signed get-pending-tx intent. */
|
|
992
|
-
getPendingTxs(intent:
|
|
1036
|
+
getPendingTxs(intent: SignedProof<Proof.GetPendingTxMessage>): Promise<PendingTx[]>;
|
|
993
1037
|
}
|
|
994
1038
|
/**
|
|
995
|
-
* REST-based
|
|
1039
|
+
* REST-based operator provider implementation.
|
|
996
1040
|
*
|
|
997
1041
|
* @see https://buf.build/arkade-os/arkd/docs/main:ark.v1#ark.v1.ArkService
|
|
998
1042
|
* @example
|
|
999
1043
|
* ```typescript
|
|
1000
|
-
* const provider = new
|
|
1044
|
+
* const provider = new RestOperatorProvider('https://arkade.computer');
|
|
1001
1045
|
* const info = await provider.getInfo();
|
|
1002
1046
|
* ```
|
|
1003
1047
|
*/
|
|
1004
|
-
declare class
|
|
1048
|
+
declare class RestOperatorProvider implements OperatorProvider {
|
|
1005
1049
|
serverUrl: string;
|
|
1006
1050
|
/** Overrides {@link configureEventSource} for this provider's streams. */
|
|
1007
1051
|
protected readonly eventSource?: EventSourceFactory;
|
|
1008
1052
|
constructor(serverUrl?: string, options?: EventSourceCapable);
|
|
1009
1053
|
/**
|
|
1010
|
-
* Last
|
|
1054
|
+
* Last operator info digest seen (from {@link getInfo}). Sent as `X-Digest`
|
|
1011
1055
|
* on outgoing requests so arkd can reject a client whose cached info is
|
|
1012
1056
|
* stale. Empty until the first {@link getInfo}.
|
|
1013
1057
|
*/
|
|
@@ -1016,14 +1060,14 @@ declare class RestArkProvider implements ArkProvider {
|
|
|
1016
1060
|
private _suppressNextGetInfoChangeEmit;
|
|
1017
1061
|
private _serverInfoListeners;
|
|
1018
1062
|
/**
|
|
1019
|
-
* Subscribe to
|
|
1063
|
+
* Subscribe to operator info changes. Fired after a stale-info
|
|
1020
1064
|
* `DIGEST_MISMATCH` refresh or when {@link getInfo} observes a changed digest.
|
|
1021
1065
|
* Returns an unsubscribe function.
|
|
1022
1066
|
*/
|
|
1023
1067
|
onServerInfoChanged(listener: (info: ArkadeInfo) => void): () => void;
|
|
1024
1068
|
private emitServerInfoChanged;
|
|
1025
1069
|
/**
|
|
1026
|
-
* `fetch` wrapper for arkd requests that participates in
|
|
1070
|
+
* `fetch` wrapper for arkd requests that participates in operator info digest
|
|
1027
1071
|
* negotiation. Sends the cached `X-Digest`; when arkd rejects a request with
|
|
1028
1072
|
* `DIGEST_MISMATCH`, refreshes {@link getInfo} (updating the digest), fires
|
|
1029
1073
|
* {@link onServerInfoChanged}, and THROWS {@link DigestMismatchError} — it
|
|
@@ -1034,7 +1078,7 @@ declare class RestArkProvider implements ArkProvider {
|
|
|
1034
1078
|
*/
|
|
1035
1079
|
private authedFetch;
|
|
1036
1080
|
private postJson;
|
|
1037
|
-
getInfo(): Promise<
|
|
1081
|
+
getInfo(): Promise<OperatorInfo>;
|
|
1038
1082
|
submitTx(signedArkTx: string, checkpointTxs: string[]): Promise<{
|
|
1039
1083
|
arkTxid: string;
|
|
1040
1084
|
finalArkTx: string;
|
|
@@ -1049,7 +1093,7 @@ declare class RestArkProvider implements ArkProvider {
|
|
|
1049
1093
|
submitSignedForfeitTxs(signedForfeitTxs: string[], signedCommitmentTx?: string): Promise<void>;
|
|
1050
1094
|
getEventStream(signal: AbortSignal, topics: string[]): AsyncIterableIterator<SettlementEvent>;
|
|
1051
1095
|
getTransactionsStream(signal: AbortSignal): AsyncIterableIterator<TxNotificationEvent>;
|
|
1052
|
-
getPendingTxs(intent:
|
|
1096
|
+
getPendingTxs(intent: SignedProof<Proof.GetPendingTxMessage>): Promise<PendingTx[]>;
|
|
1053
1097
|
protected parseSettlementEvent(data: ProtoTypes.GetEventStreamResponse): SettlementEvent | null;
|
|
1054
1098
|
protected parseTransactionNotification(data: ProtoTypes.GetTransactionsStreamResponse): TxNotificationEvent | null;
|
|
1055
1099
|
}
|
|
@@ -1159,6 +1203,12 @@ declare namespace ProtoTypes {
|
|
|
1159
1203
|
}
|
|
1160
1204
|
export { };
|
|
1161
1205
|
}
|
|
1206
|
+
/** @deprecated Use {@link OperatorProvider}. */
|
|
1207
|
+
type ArkProvider = OperatorProvider;
|
|
1208
|
+
/** @deprecated Use {@link RestOperatorProvider}. */
|
|
1209
|
+
declare const RestArkProvider: typeof RestOperatorProvider;
|
|
1210
|
+
/** @deprecated Use {@link RestOperatorProvider}. */
|
|
1211
|
+
type RestArkProvider = RestOperatorProvider;
|
|
1162
1212
|
|
|
1163
1213
|
/**
|
|
1164
1214
|
* RelativeTimelock lets to create timelocked with CHECKSEQUENCEVERIFY script.
|
|
@@ -1530,10 +1580,14 @@ interface Network {
|
|
|
1530
1580
|
}
|
|
1531
1581
|
declare const getNetwork: (network: NetworkName) => Network;
|
|
1532
1582
|
/**
|
|
1533
|
-
* The {@link Network}
|
|
1534
|
-
* unrecognized
|
|
1583
|
+
* The {@link Network} the operator's info names. {@link getNetwork} fails closed, so an
|
|
1584
|
+
* unrecognized network throws here rather than resolving to mainnet parameters downstream.
|
|
1535
1585
|
* Structurally typed so the network table doesn't depend on the provider layer.
|
|
1536
1586
|
*/
|
|
1587
|
+
declare const networkFromOperatorInfo: (info: {
|
|
1588
|
+
network: string;
|
|
1589
|
+
}) => Network;
|
|
1590
|
+
/** @deprecated Use {@link networkFromOperatorInfo}. */
|
|
1537
1591
|
declare const networkFromArkadeInfo: (info: {
|
|
1538
1592
|
network: string;
|
|
1539
1593
|
}) => Network;
|
|
@@ -1545,17 +1599,17 @@ declare const networks: {
|
|
|
1545
1599
|
regtest: Network;
|
|
1546
1600
|
};
|
|
1547
1601
|
/**
|
|
1548
|
-
*
|
|
1602
|
+
* The operator's cosigner that emulates Arkade Script on mainnet, resolved by the
|
|
1549
1603
|
* `{ network: "bitcoin" }` service. No trailing slash: `RestEmulatorProvider` appends its paths
|
|
1550
1604
|
* verbatim. The URL only selects where to ask for a signature; the key covenants commit to is
|
|
1551
1605
|
* {@link BITCOIN_EMULATOR_PUBKEY}.
|
|
1552
1606
|
*/
|
|
1553
1607
|
declare const DEFAULT_ARKADE_EMULATOR_URL: "https://emulator.arkade.computer";
|
|
1554
|
-
/**
|
|
1608
|
+
/** Key of the operator's cosigner that emulates Arkade Script on mainnet. */
|
|
1555
1609
|
declare const BITCOIN_EMULATOR_PUBKEY: "0239c196415da47b26456a101daaa12ba9e445bfe153197f1e2b750bf40e52092e";
|
|
1556
|
-
/**
|
|
1610
|
+
/** Key of the operator's cosigner that emulates Arkade Script on mutinynet. */
|
|
1557
1611
|
declare const MUTINYNET_EMULATOR_PUBKEY: "03f823b9b2febc81f4af967e77aed2f541cbd3397c6d8f5a72e32eb7b471af889a";
|
|
1558
|
-
/**
|
|
1612
|
+
/** Key of the operator's cosigner that emulates Arkade Script in the `arkade-regtest` stack. */
|
|
1559
1613
|
declare const REGTEST_EMULATOR_PUBKEY: "02999413c46fa10ada5cbc4bcc79a1d09160c2ba3cfc812705d7a13e5e545fb2a9";
|
|
1560
1614
|
/**
|
|
1561
1615
|
* The pinned co-signer key for `network`, as 33-byte compressed lowercase hex.
|
|
@@ -1905,7 +1959,7 @@ declare function toOffchainInputFeeParams(vtxo: NormalizedVirtualCoin): {
|
|
|
1905
1959
|
declare function isVirtualCoin<T>(input: T): input is T & VirtualCoin;
|
|
1906
1960
|
|
|
1907
1961
|
/**
|
|
1908
|
-
* Classification of a contract's
|
|
1962
|
+
* Classification of a contract's operator signer against a fresh {@link OperatorInfo} snapshot.
|
|
1909
1963
|
* Always derived at read time from `params.serverPubKey` and the advertised signer set; no
|
|
1910
1964
|
* stale-key metadata is persisted.
|
|
1911
1965
|
*
|
|
@@ -1913,15 +1967,15 @@ declare function isVirtualCoin<T>(input: T): input is T & VirtualCoin;
|
|
|
1913
1967
|
* - `MIGRATABLE`: signer deprecated, cutoff not passed; cooperative migration still possible.
|
|
1914
1968
|
* - `DUE_NOW`: signer deprecated with no cutoff (arkd advertises `0n`); migrate immediately.
|
|
1915
1969
|
* - `EXPIRED`: signer deprecated, cutoff passed; cooperative migration closed. NOT stranded:
|
|
1916
|
-
* the
|
|
1917
|
-
* the normal recovery settle. Unilateral exit stays an opt-in escape hatch.
|
|
1970
|
+
* the operator sweeps the batch at expiry and the swept output recovers into the active
|
|
1971
|
+
* signer via the normal recovery settle. Unilateral exit stays an opt-in escape hatch.
|
|
1918
1972
|
* - `UNKNOWN_SIGNER`: neither active nor advertised deprecated; the SDK does not migrate these.
|
|
1919
1973
|
*/
|
|
1920
1974
|
type SignerStatus = "CURRENT" | "MIGRATABLE" | "DUE_NOW" | "EXPIRED" | "UNKNOWN_SIGNER";
|
|
1921
|
-
/** Result of classifying one contract's
|
|
1975
|
+
/** Result of classifying one contract's operator signer. */
|
|
1922
1976
|
interface SignerClassification {
|
|
1923
1977
|
status: SignerStatus;
|
|
1924
|
-
/** The contract's
|
|
1978
|
+
/** The contract's operator signer, normalized to x-only (32-byte) hex. */
|
|
1925
1979
|
signerPubKey: string;
|
|
1926
1980
|
/** Absolute cutoff (Unix seconds), present only when advertised for this deprecated signer. */
|
|
1927
1981
|
cutoffDate?: bigint;
|
|
@@ -1932,7 +1986,7 @@ interface SignerClassification {
|
|
|
1932
1986
|
secondsUntilCutoff?: number;
|
|
1933
1987
|
}
|
|
1934
1988
|
/**
|
|
1935
|
-
* The
|
|
1989
|
+
* The operator's signer set, pre-normalized to x-only hex, built once per pass via
|
|
1936
1990
|
* {@link signerSetFromInfo}.
|
|
1937
1991
|
*/
|
|
1938
1992
|
interface SignerSet {
|
|
@@ -1947,24 +2001,24 @@ interface SignerSet {
|
|
|
1947
2001
|
deprecated: ReadonlyMap<string, bigint>;
|
|
1948
2002
|
}
|
|
1949
2003
|
/**
|
|
1950
|
-
* Normalize a
|
|
2004
|
+
* Normalize a signer pubkey hex to the lowercase x-only (32-byte) form of
|
|
1951
2005
|
* `params.serverPubKey`; arkd may advertise signers compressed (33 bytes).
|
|
1952
2006
|
*/
|
|
1953
2007
|
declare function toXOnlySignerHex(pubkeyHex: string): string;
|
|
1954
|
-
/** Build the {@link SignerSet} from
|
|
1955
|
-
declare function signerSetFromInfo(info:
|
|
2008
|
+
/** Build the {@link SignerSet} from the operator's info, skipping empty deprecated pubkeys. */
|
|
2009
|
+
declare function signerSetFromInfo(info: OperatorInfo): SignerSet;
|
|
1956
2010
|
/**
|
|
1957
|
-
* Classify a contract's
|
|
2011
|
+
* Classify a contract's operator signer against a pre-built {@link SignerSet}.
|
|
1958
2012
|
*
|
|
1959
2013
|
* @param contractServerPubKeyHex - the contract's `params.serverPubKey`
|
|
1960
2014
|
* @param nowSeconds - current Unix time in seconds, compared against the cutoff
|
|
1961
2015
|
*/
|
|
1962
2016
|
declare function classifyAgainstSignerSet(contractServerPubKeyHex: string, signerSet: SignerSet, nowSeconds?: number): SignerClassification;
|
|
1963
2017
|
/**
|
|
1964
|
-
* Classify one contract signer against {@link
|
|
2018
|
+
* Classify one contract signer against {@link OperatorInfo}. For many contracts, prefer
|
|
1965
2019
|
* {@link classifyAgainstSignerSet} with a shared signer set.
|
|
1966
2020
|
*/
|
|
1967
|
-
declare function classifyContractSigner(contractServerPubKeyHex: string, info:
|
|
2021
|
+
declare function classifyContractSigner(contractServerPubKeyHex: string, info: OperatorInfo, nowSeconds?: number): SignerClassification;
|
|
1968
2022
|
/** Whether a `settle()` migration intent should be built for VTXOs under this signer status. */
|
|
1969
2023
|
declare function isCooperativelyMigratable(status: SignerStatus): boolean;
|
|
1970
2024
|
|
|
@@ -1999,13 +2053,13 @@ declare function selectPendingRecoveryOutpoints(contractsWithVtxos: ReadonlyArra
|
|
|
1999
2053
|
* // Default behavior: virtual output renewal at 3 days, boarding sweep enabled, polling every minute
|
|
2000
2054
|
* const wallet = await Wallet.create({
|
|
2001
2055
|
* identity: MnemonicIdentity.fromMnemonic('abandon abandon...'),
|
|
2002
|
-
*
|
|
2056
|
+
* operatorProvider: new RestOperatorProvider(),
|
|
2003
2057
|
* });
|
|
2004
2058
|
*
|
|
2005
2059
|
* // Custom expiry threshold of 24 hours
|
|
2006
2060
|
* const wallet = await Wallet.create({
|
|
2007
2061
|
* identity: MnemonicIdentity.fromMnemonic('abandon abandon...'),
|
|
2008
|
-
*
|
|
2062
|
+
* operatorProvider: new RestOperatorProvider(),
|
|
2009
2063
|
* settlementConfig: {
|
|
2010
2064
|
* vtxoThreshold: 60 * 60 * 24, // 24 hours in seconds
|
|
2011
2065
|
* },
|
|
@@ -2014,7 +2068,7 @@ declare function selectPendingRecoveryOutpoints(contractsWithVtxos: ReadonlyArra
|
|
|
2014
2068
|
* // Explicitly disable
|
|
2015
2069
|
* const wallet = await Wallet.create({
|
|
2016
2070
|
* identity: MnemonicIdentity.fromMnemonic('abandon abandon...'),
|
|
2017
|
-
*
|
|
2071
|
+
* operatorProvider: new RestOperatorProvider(),
|
|
2018
2072
|
* settlementConfig: false,
|
|
2019
2073
|
* });
|
|
2020
2074
|
* ```
|
|
@@ -2256,7 +2310,7 @@ interface DeprecatedSignerMigrationReport {
|
|
|
2256
2310
|
* ```typescript
|
|
2257
2311
|
* const wallet = await Wallet.create({
|
|
2258
2312
|
* identity,
|
|
2259
|
-
*
|
|
2313
|
+
* operatorProvider: new RestOperatorProvider(),
|
|
2260
2314
|
* settlementConfig: {
|
|
2261
2315
|
* // Seconds before virtual output expiry to trigger renewal
|
|
2262
2316
|
* vtxoThreshold: 259_200, // 3 days
|
|
@@ -2455,7 +2509,7 @@ declare class VtxoManager implements AsyncDisposable, IVtxoManager {
|
|
|
2455
2509
|
* ```typescript
|
|
2456
2510
|
* const wallet = await Wallet.create({
|
|
2457
2511
|
* identity,
|
|
2458
|
-
*
|
|
2512
|
+
* operatorProvider: new RestOperatorProvider(),
|
|
2459
2513
|
* settlementConfig: {
|
|
2460
2514
|
* vtxoThreshold: 86_400 // 24 hours
|
|
2461
2515
|
* },
|
|
@@ -2541,7 +2595,7 @@ declare class VtxoManager implements AsyncDisposable, IVtxoManager {
|
|
|
2541
2595
|
* ```typescript
|
|
2542
2596
|
* const wallet = await Wallet.create({
|
|
2543
2597
|
* identity,
|
|
2544
|
-
*
|
|
2598
|
+
* operatorProvider: new RestOperatorProvider(),
|
|
2545
2599
|
* settlementConfig: {
|
|
2546
2600
|
* boardingUtxoSweep: true,
|
|
2547
2601
|
* },
|
|
@@ -2628,9 +2682,9 @@ declare class VtxoManager implements AsyncDisposable, IVtxoManager {
|
|
|
2628
2682
|
private getSweepWallet;
|
|
2629
2683
|
private getBoardingTimelock;
|
|
2630
2684
|
private getOnchainProvider;
|
|
2631
|
-
private
|
|
2685
|
+
private getOperatorProvider;
|
|
2632
2686
|
/**
|
|
2633
|
-
* Unlike {@link
|
|
2687
|
+
* Unlike {@link getOperatorProvider}, doesn't require boarding-sweep capability. Undefined when no
|
|
2634
2688
|
* provider is wired, which callers treat as "no limit".
|
|
2635
2689
|
*/
|
|
2636
2690
|
private getInfoProvider;
|
|
@@ -3949,7 +4003,7 @@ declare function isDiscoverable(handler: ContractHandler<unknown> | undefined):
|
|
|
3949
4003
|
/**
|
|
3950
4004
|
* The per-contract tapscript annotation stamped onto every VTXO locked to a
|
|
3951
4005
|
* contract (see `extendVirtualCoinForContract`): the leaf used to co-sign
|
|
3952
|
-
* forfeits, the leaf committed in
|
|
4006
|
+
* forfeits, the leaf committed in proofs, and the encoded taproot tree.
|
|
3953
4007
|
*/
|
|
3954
4008
|
interface DerivedContractTapscripts {
|
|
3955
4009
|
forfeitTapLeafScript: TapLeafScript;
|
|
@@ -4265,7 +4319,7 @@ interface DelegateProvider {
|
|
|
4265
4319
|
*
|
|
4266
4320
|
* @param forfeitTxs - Forfeit transactions associated with the delegation request
|
|
4267
4321
|
*/
|
|
4268
|
-
delegate(intent:
|
|
4322
|
+
delegate(intent: SignedProof<Proof.RegisterMessage>, forfeitTxs: string[], options?: DelegateOptions): Promise<void>;
|
|
4269
4323
|
/** Fetch delegate metadata: pubkey, fee, and delegate address. */
|
|
4270
4324
|
getDelegateInfo(): Promise<DelegateInfo>;
|
|
4271
4325
|
}
|
|
@@ -4287,7 +4341,7 @@ declare class RestDelegateProvider implements DelegateProvider {
|
|
|
4287
4341
|
*
|
|
4288
4342
|
* @throws Error if the remote service rejects the request
|
|
4289
4343
|
*/
|
|
4290
|
-
delegate(intent:
|
|
4344
|
+
delegate(intent: SignedProof<Proof.RegisterMessage>, forfeitTxs: string[], options?: DelegateOptions): Promise<void>;
|
|
4291
4345
|
/**
|
|
4292
4346
|
* Fetch delegate metadata exposed by the remote delegation service.
|
|
4293
4347
|
*
|
|
@@ -4321,10 +4375,10 @@ interface IDelegateManager {
|
|
|
4321
4375
|
}
|
|
4322
4376
|
declare class DelegateManagerImpl implements IDelegateManager {
|
|
4323
4377
|
readonly delegateProvider: DelegateProvider;
|
|
4324
|
-
readonly arkInfoProvider: Pick<
|
|
4378
|
+
readonly arkInfoProvider: Pick<OperatorProvider, "getInfo">;
|
|
4325
4379
|
readonly identity: Identity;
|
|
4326
4380
|
/** Create a delegate manager from the configured provider, Arkade info source, and wallet identity. */
|
|
4327
|
-
constructor(delegateProvider: DelegateProvider, arkInfoProvider: Pick<
|
|
4381
|
+
constructor(delegateProvider: DelegateProvider, arkInfoProvider: Pick<OperatorProvider, "getInfo">, identity: Identity);
|
|
4328
4382
|
getDelegateInfo(): Promise<DelegateInfo>;
|
|
4329
4383
|
delegate(vtxos: ContractVtxo[], destination: string, delegateAt?: Date): Promise<{
|
|
4330
4384
|
delegated: Outpoint[];
|
|
@@ -4508,7 +4562,7 @@ interface EmulatorProvider {
|
|
|
4508
4562
|
}): Promise<string>;
|
|
4509
4563
|
submitFinalization(intent: {
|
|
4510
4564
|
proof: string;
|
|
4511
|
-
message:
|
|
4565
|
+
message: Proof.RegisterMessage;
|
|
4512
4566
|
}, forfeits: string[], connectorTree: ConnectorTreeNode[] | null, commitmentTx: string): Promise<{
|
|
4513
4567
|
signedForfeits: string[];
|
|
4514
4568
|
signedCommitmentTx?: string;
|
|
@@ -4546,7 +4600,7 @@ declare class RestEmulatorProvider implements EmulatorProvider {
|
|
|
4546
4600
|
}): Promise<string>;
|
|
4547
4601
|
submitFinalization(intent: {
|
|
4548
4602
|
proof: string;
|
|
4549
|
-
message:
|
|
4603
|
+
message: Proof.RegisterMessage;
|
|
4550
4604
|
}, forfeits: string[], connectorTree: ConnectorTreeNode[] | null, commitmentTx: string): Promise<{
|
|
4551
4605
|
signedForfeits: string[];
|
|
4552
4606
|
signedCommitmentTx?: string;
|
|
@@ -4566,9 +4620,10 @@ declare class RestEmulatorProvider implements EmulatorProvider {
|
|
|
4566
4620
|
/**
|
|
4567
4621
|
* The Arkade deployment to talk to.
|
|
4568
4622
|
*
|
|
4569
|
-
* - `{ network: "bitcoin" }
|
|
4570
|
-
* ({@link DEFAULT_ARKADE_EMULATOR_URL}). Mainnet is the only network
|
|
4571
|
-
*
|
|
4623
|
+
* - `{ network: "bitcoin" }`: the hosted mainnet deployment, including the operator's cosigner
|
|
4624
|
+
* that emulates Arkade Script ({@link DEFAULT_ARKADE_EMULATOR_URL}). Mainnet is the only network
|
|
4625
|
+
* with a one-liner.
|
|
4626
|
+
* - `{ operatorUrl, emulatorUrl? }`: a specific operator. A custom operator does not imply the default
|
|
4572
4627
|
* emulator: without `emulatorUrl`, covenant (`arkadeScript`) paths stay disabled.
|
|
4573
4628
|
*/
|
|
4574
4629
|
type ArkadeService = {
|
|
@@ -4579,10 +4634,11 @@ type ArkadeService = {
|
|
|
4579
4634
|
};
|
|
4580
4635
|
/** The providers and operator info an {@link ArkadeService} resolves to. */
|
|
4581
4636
|
interface ResolvedArkadeService {
|
|
4582
|
-
arkProvider:
|
|
4637
|
+
arkProvider: OperatorProvider;
|
|
4583
4638
|
indexerProvider: IndexerProvider;
|
|
4584
4639
|
onchainProvider: OnchainProvider;
|
|
4585
|
-
/** The
|
|
4640
|
+
/** The operator's cosigner that emulates Arkade Script; absent for an `operatorUrl` service
|
|
4641
|
+
* without `emulatorUrl`. */
|
|
4586
4642
|
emulator?: EmulatorProvider;
|
|
4587
4643
|
info: ArkadeInfo;
|
|
4588
4644
|
}
|
|
@@ -4594,7 +4650,7 @@ interface ResolvedArkadeService {
|
|
|
4594
4650
|
* the deployment, and silently using another one is the expensive failure.
|
|
4595
4651
|
*/
|
|
4596
4652
|
declare function resolveArkadeService(service: ArkadeService, opts?: {
|
|
4597
|
-
arkProvider?:
|
|
4653
|
+
arkProvider?: OperatorProvider;
|
|
4598
4654
|
info?: ArkadeInfo;
|
|
4599
4655
|
}): Promise<ResolvedArkadeService>;
|
|
4600
4656
|
|
|
@@ -4675,15 +4731,17 @@ interface BaseWalletConfig {
|
|
|
4675
4731
|
/** Repository-backed storage configuration overrides. Defaults to IndexedDB if unset. */
|
|
4676
4732
|
storage?: StorageConfig;
|
|
4677
4733
|
/**
|
|
4678
|
-
* The Arkade deployment, in place of `
|
|
4734
|
+
* The Arkade deployment, in place of `operatorProvider`/`indexerProvider`/`onchainProvider`
|
|
4679
4735
|
* (combining them throws): `{ network: "bitcoin" }` or `{ operatorUrl }`. With
|
|
4680
4736
|
* `{ network }`, an operator reporting another network throws.
|
|
4681
4737
|
*
|
|
4682
4738
|
* @see ArkadeService
|
|
4683
4739
|
*/
|
|
4684
4740
|
service?: ArkadeService;
|
|
4685
|
-
/** Optional
|
|
4686
|
-
|
|
4741
|
+
/** Optional operator provider instance. */
|
|
4742
|
+
operatorProvider?: OperatorProvider;
|
|
4743
|
+
/** @deprecated Use {@link operatorProvider}. */
|
|
4744
|
+
arkProvider?: OperatorProvider;
|
|
4687
4745
|
/** Optional indexer provider instance. */
|
|
4688
4746
|
indexerProvider?: IndexerProvider;
|
|
4689
4747
|
/** Optional onchain provider, or a factory given the operator's network once it is known. */
|
|
@@ -4703,7 +4761,7 @@ interface BaseWalletConfig {
|
|
|
4703
4761
|
* // Provider-based configuration (e.g., for Expo/React Native)
|
|
4704
4762
|
* const wallet = await ReadonlyWallet.create({
|
|
4705
4763
|
* identity: ReadonlySingleKey.fromPublicKey(pubkey),
|
|
4706
|
-
*
|
|
4764
|
+
* operatorProvider: new ExpoOperatorProvider(),
|
|
4707
4765
|
* indexerProvider: new ExpoIndexerProvider(),
|
|
4708
4766
|
* onchainProvider: new EsploraProvider()
|
|
4709
4767
|
* });
|
|
@@ -4734,7 +4792,7 @@ interface ReadonlyWalletConfig extends BaseWalletConfig {
|
|
|
4734
4792
|
* // Provider-based configuration
|
|
4735
4793
|
* const wallet = await Wallet.create({
|
|
4736
4794
|
* identity: MnemonicIdentity.fromMnemonic('abandon abandon...'),
|
|
4737
|
-
*
|
|
4795
|
+
* operatorProvider: new ExpoOperatorProvider(),
|
|
4738
4796
|
* indexerProvider: new ExpoIndexerProvider(),
|
|
4739
4797
|
* onchainProvider: new EsploraProvider()
|
|
4740
4798
|
* });
|
|
@@ -4742,7 +4800,7 @@ interface ReadonlyWalletConfig extends BaseWalletConfig {
|
|
|
4742
4800
|
* // With settlement configuration
|
|
4743
4801
|
* const wallet = await Wallet.create({
|
|
4744
4802
|
* identity: MnemonicIdentity.fromMnemonic('abandon abandon...'),
|
|
4745
|
-
*
|
|
4803
|
+
* operatorProvider: new RestOperatorProvider(),
|
|
4746
4804
|
* settlementConfig: {
|
|
4747
4805
|
* vtxoThreshold: 60 * 60 * 24, // 24 hours in seconds
|
|
4748
4806
|
* boardingUtxoSweep: true,
|
|
@@ -4781,6 +4839,16 @@ interface WalletConfig extends ReadonlyWalletConfig {
|
|
|
4781
4839
|
* @defaultValue `20`
|
|
4782
4840
|
*/
|
|
4783
4841
|
lookAheadWindow?: number;
|
|
4842
|
+
/**
|
|
4843
|
+
* Submit offchain transactions with signed checkpoints, so a supporting
|
|
4844
|
+
* arkd finalizes them in one call (older arkd falls back to finalizeTx).
|
|
4845
|
+
* Set `false` to keep the two-step flow for this wallet's sends and
|
|
4846
|
+
* ArkadeCash sweeps, and for swap claims, refunds and cancels driven
|
|
4847
|
+
* through it; an `Arkade` client takes its own `oneShotSubmit`.
|
|
4848
|
+
*
|
|
4849
|
+
* @defaultValue `true`
|
|
4850
|
+
*/
|
|
4851
|
+
oneShotSubmit?: boolean;
|
|
4784
4852
|
/**
|
|
4785
4853
|
* Let spends run concurrently on disjoint VTXOs: the wallet lock covers only picking and
|
|
4786
4854
|
* reserving inputs, amount-bearing `Ramps` exits spend only the VTXOs they need, and naming a
|
|
@@ -5416,7 +5484,7 @@ type ArkadeReader = Pick<IndexerProvider, "getVirtualTxs"> & {
|
|
|
5416
5484
|
* Submit and finalize a signed Arkade transaction. Only on {@link IWallet}: broadcasting is the
|
|
5417
5485
|
* one thing a readonly wallet must not do (hence `ReadonlyWallet.arkProvider` is protected).
|
|
5418
5486
|
*/
|
|
5419
|
-
type ArkadeBroadcaster = Pick<
|
|
5487
|
+
type ArkadeBroadcaster = Pick<OperatorProvider, "submitTx" | "finalizeTx">;
|
|
5420
5488
|
/**
|
|
5421
5489
|
* Signing wallet interface: {@link IReadonlyWallet} plus sending, settling and asset operations.
|
|
5422
5490
|
*
|
|
@@ -5430,6 +5498,8 @@ interface IWallet extends IReadonlyWallet {
|
|
|
5430
5498
|
* @see ArkadeBroadcaster
|
|
5431
5499
|
*/
|
|
5432
5500
|
getArkadeBroadcaster(): Promise<ArkadeBroadcaster>;
|
|
5501
|
+
/** @see WalletConfig.oneShotSubmit — read by plugins that sign checkpoints for this wallet. */
|
|
5502
|
+
readonly oneShotSubmit?: boolean;
|
|
5433
5503
|
/**
|
|
5434
5504
|
* Signing identity associated with the wallet. Must be a real signer (`isSigningIdentity`):
|
|
5435
5505
|
* contract corridors need `signerSession`, which a watch-only identity lacks, and refuse such
|
|
@@ -5566,6 +5636,15 @@ interface WalletState {
|
|
|
5566
5636
|
*/
|
|
5567
5637
|
lastSyncTime?: number;
|
|
5568
5638
|
}
|
|
5639
|
+
/** Backend transaction over fresh state. Updaters run once, synchronously, with no I/O,
|
|
5640
|
+
* re-entry or external side effects. Failures are propagated without automatic retries.
|
|
5641
|
+
*/
|
|
5642
|
+
interface AtomicWalletState {
|
|
5643
|
+
readonly version: 1;
|
|
5644
|
+
/** Caller assertion of persistence beyond this process, not physical storage detection. */
|
|
5645
|
+
readonly persistent?: true;
|
|
5646
|
+
update(updater: (state: WalletState) => WalletState): Promise<void>;
|
|
5647
|
+
}
|
|
5569
5648
|
interface VtxoRepositoryKey {
|
|
5570
5649
|
/** Authoritative ownership key. */
|
|
5571
5650
|
script: string;
|
|
@@ -5590,6 +5669,7 @@ interface WalletRepository extends AsyncDisposable {
|
|
|
5590
5669
|
* `getVtxosForScript(s)`) are gone; implement the `*Page` reads instead.
|
|
5591
5670
|
*/
|
|
5592
5671
|
readonly version: 2;
|
|
5672
|
+
readonly atomicWalletState?: AtomicWalletState;
|
|
5593
5673
|
/**
|
|
5594
5674
|
* Clear all data from storage.
|
|
5595
5675
|
*/
|
|
@@ -5692,4 +5772,4 @@ declare function isBatchSignable(identity: Identity): identity is BatchSignableI
|
|
|
5692
5772
|
*/
|
|
5693
5773
|
declare function isSigningIdentity(value: unknown): value is Identity;
|
|
5694
5774
|
|
|
5695
|
-
export { type
|
|
5775
|
+
export { type ArkIntent as $, type ArkadeInfo as A, type Contract as B, type ContractRepository as C, type ExtendedVirtualCoin as D, type ExtendedCoin as E, type Outpoint as F, type GetArkadeInfoOptions as G, type PageResult as H, type IWallet as I, type ScriptVtxoCursor as J, type ScriptVtxoPageOptions as K, type StoredVtxo as L, type VtxoRepositoryKey as M, type NormalizedExtendedVirtualCoin as N, type OperatorProvider as O, type PageRequest as P, type TransactionHistoryPageFilter as Q, type Recipient as R, type SettleParams as S, type TxNotificationEvent as T, type TransactionHistoryPageCursor as U, VtxoScript as V, type WalletRepository as W, type AtomicWalletState as X, type WalletState as Y, type ContractFilter as Z, type IntentRepository as _, type Identity as a, type BurnParams as a$, type IntentPageFilter as a0, type VirtualTxRepository as a1, type VirtualTx as a2, type VtxoBranch as a3, ChainedTxType as a4, type DescriptorProvider as a5, type DescriptorSigningRequest as a6, Transaction as a7, type Network as a8, type BatchStartedEvent as a9, type ContractManagerConfig as aA, CSVMultisigTapscript as aB, type SettlementConfig as aC, VtxoManager as aD, type SignerSession as aE, type SignedIntent as aF, Intent as aG, type SignedProof as aH, Proof as aI, type TimeHeight as aJ, type IntentFeeConfig as aK, type OffchainInput as aL, FeeAmount as aM, type OnchainInput as aN, type FeeOutput as aO, type ContractWatcherConfig as aP, type Asset as aQ, type FeeInfo as aR, type GetVtxosOptions as aS, type PaginationOptions as aT, type CreateContractParams as aU, type GetContractsFilter as aV, type GetSpendablePathsOptions as aW, type GetAllSpendingPathsOptions as aX, type InputExpiryFloor as aY, type IssuanceParams as aZ, type ReissuanceParams as a_, type TreeSigningStartedEvent as aa, TxTree as ab, type TreeNoncesEvent as ac, type BatchFinalizationEvent as ad, type BatchFinalizedEvent as ae, type BatchFailedEvent as af, type TreeTxEvent as ag, type TreeSignatureEvent as ah, type IReadonlyWallet as ai, type ReadonlyIdentity as aj, type OnchainProvider as ak, type DelegateProvider as al, type ReadonlyWalletConfig as am, type ExitCaptureMode as an, type ExitDataSource as ao, type IReadonlyAssetManager as ap, type ContractSyncState as aq, type RecipientArkadeAddressContext as ar, EsploraProvider as as, type NetworkName as at, type OperatorInfo as au, ArkAddress as av, type ContractWithVtxos as aw, selectPendingRecoveryOutpoints as ax, type Coin as ay, ContractManager as az, type WalletConfig as b, type EventSourceCapable as b$, type RenewVtxosOptions as b0, type NormalizedVtxoPage as b1, type WatchedScript as b2, type PathSelection as b3, type ContractEvent as b4, type AssetDetails as b5, type IssuanceResult as b6, type DelegateInfo as b7, type MigrationGlobalSkipReason as b8, type MigrationLegSkipReason as b9, type BatchSignableIdentity as bA, CLTVMultisigTapscript as bB, type CandidateDeps as bC, ChainTxType as bD, type CommitmentTx as bE, ConditionCSVMultisigTapscript as bF, ConditionMultisigTapscript as bG, type ConnectorTreeNode as bH, type ContractBalance as bI, type ContractEventCallback as bJ, type ContractHandler as bK, type ContractState as bL, type ContractVtxo as bM, ContractWatcher as bN, type ContractWatcherEventCallback as bO, DEFAULT_ARKADE_EMULATOR_URL as bP, DEFAULT_VTXO_PAGE_SIZE as bQ, DelegateManagerImpl as bR, type DelegateOptions as bS, type DeprecatedSignerMigrationReport as bT, type DeprecatedSignerReport as bU, DigestMismatchError as bV, type Discoverable as bW, type DiscoveredContract as bX, type DiscoveryDeps as bY, ESPLORA_URL as bZ, type EmulatorInfo as b_, type SignerStatus as ba, type StorageConfig as bb, type IVtxoManager as bc, type SendBitcoinParams as bd, type ExplorerTransaction as be, type TreeNonces as bf, type TreePartialSigs as bg, type PendingTx as bh, type EncodedVtxoScript as bi, type EmulatorProvider as bj, type Status as bk, type ChainTx as bl, type ArkadeService as bm, type ContractVtxoEvent as bn, type ExtendedContractVtxo as bo, type ResolvedArkadeService as bp, resolveArkadeService as bq, type PathContext as br, type ActivityIntent as bs, type ActivityResolver as bt, type ArkIntentState as bu, type ArkTapscript as bv, type AssetMetadata as bw, BITCOIN_EMULATOR_PUBKEY as bx, type BaseWalletConfig as by, type BatchInfo as bz, type ArkadeReader as c, attachPrevArkTxs as c$, type EventSourceFactory as c0, type EventSourceLike as c1, EventSourceUnavailableError as c2, type ExitChainResolver as c3, type GroupMembership as c4, type HandlerError as c5, INTENT_TERMINAL_STATES as c6, IndexerTxType as c7, type IntentCoin as c8, type IntentFilter as c9, SettlementEventType as cA, type SignRequest as cB, type SignerClassification as cC, type SignerSet as cD, type SubscriptionFilter as cE, type SubscriptionResponse as cF, type SweepTxNotification as cG, type TapLeaves as cH, TapTreeCoder as cI, TapscriptType as cJ, TreeSignerSession as cK, type Tx as cL, type TxHistoryRecord as cM, type TxKey as cN, type TxNotification as cO, type TxTag as cP, type TxTreeNode as cQ, TxType as cR, type Vtxo as cS, type VtxoChain as cT, type VtxoType as cU, type WalletMode as cV, type WithPrevTx as cW, assertAllowedSighashTypes as cX, assertPageRequest as cY, assertRecipientArkadeAddress as cZ, assetMintResolver as c_, type KnownMetadata as ca, MAX_PAGE_SIZE as cb, MUTINYNET_EMULATOR_PUBKEY as cc, type MigrateDeprecatedSignerOptions as cd, type MigrationLegReport as ce, type MigrationVtxoRef as cf, MultisigTapscript as cg, type NewAddressType as ch, type Nonces as ci, type Output as cj, type PageResponse as ck, PartialSig as cl, type PrevTxSource as cm, PrevTxUnavailableError as cn, type ProofInput as co, type ProviderClass as cp, REGTEST_EMULATOR_PUBKEY as cq, type RawTxSource as cr, type RenewalSplit as cs, type RenewalSplitContext as ct, RestArkProvider as cu, RestDelegateProvider as cv, RestEmulatorProvider as cw, type ScanContractsOptions as cx, type ScanResult as cy, type ScheduledSession as cz, type ArkadeBroadcaster as d, attachPrevoutTxs as d0, boardingResolver as d1, canRecoverOnchain as d2, canSpendOffchain as d3, canSweepOnchain as d4, classifyAgainstSignerSet as d5, classifyContractSigner as d6, collabExitResolver as d7, collectContracts as d8, collectIntents as d9, isTerminalIntentState as dA, isVirtualCoin as dB, isVtxoExpiringSoon as dC, isVtxoSpent as dD, iteratePages as dE, networkFromArkadeInfo as dF, networkFromOperatorInfo as dG, networks as dH, pageResult as dI, resolveEmulatorPubkey as dJ, resolveEventSource as dK, resolvePrevTxs as dL, scriptFromTapLeafScript as dM, signerSetFromInfo as dN, toOffchainInputFeeParams as dO, toXOnlySignerHex as dP, withPrevTxs as dQ, type TapscriptDeriving as dR, collectPages as da, collectScriptVtxos as db, collectTransactionHistory as dc, collectUtxos as dd, collectVtxos as de, configureEventSource as df, createDefaultActivityRegistry as dg, createExitChainResolver as dh, decodeTapscript as di, defaultEmulatorPubkey as dj, getAllNormalizedVtxos as dk, getConfiguredEventSource as dl, getNetwork as dm, getNormalizedVtxos as dn, getRandomId as dp, getSequence as dq, hasCandidates as dr, isBatchSignable as ds, isContractVtxoEvent as dt, isCooperativelyMigratable as du, isDiscoverable as dv, isEventSourceUnavailableError as dw, isPastExpiry as dx, isSigningIdentity as dy, isSubdust as dz, type WalletBalance as e, type GetVtxosFilter as f, type GetSpendableVtxosFilter as g, type ArkTransaction as h, ActivityRegistry as i, type Activity as j, type IContractManager as k, type GetNewAddressesOptions as l, type NewAddress as m, type IDelegateManager as n, type SettlementEvent as o, type SendParams as p, type IAssetManager as q, RestOperatorProvider as r, RestIndexerProvider as s, type SubscriptionEvent as t, type SubscriptionHeartbeat as u, type ArkProvider as v, type IndexerProvider as w, type RelativeTimelock as x, type TapLeafScript as y, type VirtualCoin as z };
|