@arkade-os/sdk 0.5.6 → 0.5.8
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 +2 -2
- package/dist/adapters/expo.cjs +6 -6
- 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/{asyncStorageTaskQueue-Bh2n0msM.d.cts → asyncStorageTaskQueue-B5NPtkXo.d.cts} +1 -1
- package/dist/{asyncStorageTaskQueue-CpkstKZ5.d.ts → asyncStorageTaskQueue-YPwiJyVA.d.ts} +1 -1
- package/dist/{chunk-47Z4LEIW.js → chunk-3F5AJ235.js} +4 -4
- package/dist/{chunk-47Z4LEIW.js.map → chunk-3F5AJ235.js.map} +1 -1
- package/dist/{chunk-HKEPJBTY.cjs → chunk-4IDCSOP2.cjs} +22 -16
- package/dist/chunk-4IDCSOP2.cjs.map +1 -0
- package/dist/{chunk-JFJNB7ZH.cjs → chunk-5PWL7WOT.cjs} +7 -5
- package/dist/chunk-5PWL7WOT.cjs.map +1 -0
- package/dist/{chunk-C7NY6WSA.js → chunk-E7LKKEVR.js} +10 -4
- package/dist/chunk-E7LKKEVR.js.map +1 -0
- package/dist/{chunk-Y3CDDPWI.cjs → chunk-EQ3JVVUR.cjs} +932 -558
- package/dist/chunk-EQ3JVVUR.cjs.map +1 -0
- package/dist/{chunk-DJYX73W2.js → chunk-F5O6JI2H.js} +8 -6
- package/dist/chunk-F5O6JI2H.js.map +1 -0
- package/dist/{chunk-VWW2ZBPI.js → chunk-H7GT3QC4.js} +4 -4
- package/dist/{chunk-VWW2ZBPI.js.map → chunk-H7GT3QC4.js.map} +1 -1
- package/dist/{chunk-4X67IB2V.cjs → chunk-JQSHFSME.cjs} +19 -17
- package/dist/chunk-JQSHFSME.cjs.map +1 -0
- package/dist/{chunk-NDQ4LB4X.cjs → chunk-JYQXB7OH.cjs} +19 -19
- package/dist/{chunk-NDQ4LB4X.cjs.map → chunk-JYQXB7OH.cjs.map} +1 -1
- package/dist/{chunk-YS76JSGP.cjs → chunk-KWR37J6L.cjs} +10 -10
- package/dist/{chunk-YS76JSGP.cjs.map → chunk-KWR37J6L.cjs.map} +1 -1
- package/dist/{chunk-X6ZI53DZ.cjs → chunk-L7OOPAUG.cjs} +14 -26
- package/dist/chunk-L7OOPAUG.cjs.map +1 -0
- package/dist/{chunk-YKT4NAQG.js → chunk-OLKZUJIN.js} +463 -95
- package/dist/chunk-OLKZUJIN.js.map +1 -0
- package/dist/{chunk-LZAINCGU.cjs → chunk-SOJDUKY6.cjs} +271 -225
- package/dist/chunk-SOJDUKY6.cjs.map +1 -0
- package/dist/{chunk-V3ZLL5VY.js → chunk-U34GU5RM.js} +9 -21
- package/dist/chunk-U34GU5RM.js.map +1 -0
- package/dist/{chunk-DNFTHG73.js → chunk-XXNPX4MK.js} +7 -5
- package/dist/chunk-XXNPX4MK.js.map +1 -0
- package/dist/{chunk-QTMK34TP.js → chunk-YTOABP6J.js} +268 -226
- package/dist/chunk-YTOABP6J.js.map +1 -0
- package/dist/compiler.cjs +3 -3
- package/dist/compiler.d.cts +1 -1
- package/dist/compiler.d.ts +1 -1
- package/dist/compiler.js +2 -2
- package/dist/contracts/handlers/index.cjs +10 -10
- package/dist/contracts/handlers/index.d.cts +3 -3
- package/dist/contracts/handlers/index.d.ts +3 -3
- package/dist/contracts/handlers/index.js +3 -3
- package/dist/{index-46g577Ka.d.cts → index-CKzBYoDa.d.cts} +2 -2
- package/dist/{index-2wKMrT0a.d.ts → index-COs69e8T.d.ts} +2 -2
- package/dist/{index-C66rjxz2.d.ts → index-Pk3i_MMU.d.ts} +13 -3
- package/dist/{index-Dqk07NwJ.d.cts → index-czozpKPT.d.cts} +13 -3
- package/dist/index.cjs +343 -315
- package/dist/index.d.cts +118 -138
- package/dist/index.d.ts +118 -138
- package/dist/index.js +6 -6
- package/dist/{keyringDescriptorProvider-DiBM4GmB.d.ts → keyringDescriptorProvider-CbNzWwbS.d.ts} +163 -2
- package/dist/{keyringDescriptorProvider-DnaLUC7v.d.cts → keyringDescriptorProvider-nC8fIjBN.d.cts} +163 -2
- package/dist/{program-BARSNg3X.d.ts → program-38A2Twvj.d.ts} +4 -2
- package/dist/{program-znrWkxE4.d.cts → program-DPzf5qsk.d.cts} +4 -2
- package/dist/repositories/realm/index.cjs +39 -39
- package/dist/repositories/realm/index.d.cts +2 -2
- package/dist/repositories/realm/index.d.ts +2 -2
- package/dist/repositories/realm/index.js +7 -7
- package/dist/repositories/sqlite/index.cjs +37 -37
- package/dist/repositories/sqlite/index.d.cts +2 -2
- package/dist/repositories/sqlite/index.d.ts +2 -2
- package/dist/repositories/sqlite/index.js +7 -7
- package/dist/{taskRunner-BM6IAKlS.d.ts → taskRunner-DBOqvP33.d.ts} +1 -1
- package/dist/{taskRunner-BmDIZiSl.d.cts → taskRunner-DXivOJHc.d.cts} +1 -1
- package/dist/wallet/expo/background.cjs +16 -16
- package/dist/wallet/expo/background.d.cts +3 -3
- package/dist/wallet/expo/background.d.ts +3 -3
- package/dist/wallet/expo/background.js +8 -8
- package/dist/wallet/expo/index.cjs +17 -17
- package/dist/wallet/expo/index.d.cts +3 -3
- package/dist/wallet/expo/index.d.ts +3 -3
- package/dist/wallet/expo/index.js +7 -7
- package/dist/worker/expo/index.cjs +11 -11
- package/dist/worker/expo/index.d.cts +4 -4
- package/dist/worker/expo/index.d.ts +4 -4
- package/dist/worker/expo/index.js +7 -7
- package/package.json +2 -2
- package/dist/chunk-4X67IB2V.cjs.map +0 -1
- package/dist/chunk-C7NY6WSA.js.map +0 -1
- package/dist/chunk-DJYX73W2.js.map +0 -1
- package/dist/chunk-DNFTHG73.js.map +0 -1
- package/dist/chunk-HKEPJBTY.cjs.map +0 -1
- package/dist/chunk-JFJNB7ZH.cjs.map +0 -1
- package/dist/chunk-LZAINCGU.cjs.map +0 -1
- package/dist/chunk-QTMK34TP.js.map +0 -1
- package/dist/chunk-V3ZLL5VY.js.map +0 -1
- package/dist/chunk-X6ZI53DZ.cjs.map +0 -1
- package/dist/chunk-Y3CDDPWI.cjs.map +0 -1
- package/dist/chunk-YKT4NAQG.js.map +0 -1
package/dist/{keyringDescriptorProvider-DiBM4GmB.d.ts → keyringDescriptorProvider-CbNzWwbS.d.ts}
RENAMED
|
@@ -1,9 +1,79 @@
|
|
|
1
|
-
import { a3 as
|
|
1
|
+
import { a as Identity, a3 as Transaction, a4 as SignerSession, a5 as ReadonlyIdentity, a6 as Network, a7 as ActivityResolver, a8 as BatchStartedEvent, a9 as TreeSigningStartedEvent, aa as TxTree, ab as TreeNoncesEvent, ac as BatchFinalizationEvent, ad as BatchFinalizedEvent, ae as BatchFailedEvent, af as TreeTxEvent, ag as TreeSignatureEvent, n as SettlementEvent, b as WalletConfig, W as WalletRepository, C as ContractRepository, ah as DescriptorProvider, j as IContractManager, k as GetNewAddressesOptions, l as NewAddress, ai as IReadonlyWallet, aj as OnchainProvider, x as OperatorProvider, w as IndexerProvider, ak as DelegateProvider, al as ReadonlyWalletConfig, Y as BatchRegistrationRepository, $ as VirtualTxRepository, am as ExitCaptureMode, an as ExitDataSource, h as ActivityRegistry, ao as IReadonlyAssetManager, ap as ContractSyncState, aq as RecipientArkadeAddressContext, G as GetOperatorInfoOptions, O as OperatorInfo, A as ArkadeReader, ar as EsploraProvider, as as NetworkName, d as WalletBalance, e as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, f as GetSpendableVtxosFilter, at as ContractWithVtxos, au as selectPendingRecoveryOutpoints, g as ArkTransaction, i as Activity, E as ExtendedCoin, av as Coin, z as ExtendedVirtualCoin, aw as ContractManager, ax as ContractManagerConfig, I as IWallet, B as Outpoint, ay as SettlementConfig, c as ArkadeBroadcaster, q as IAssetManager, az as VtxoManager, m as IDelegateManager, S as SettleParams, R as Recipient, p as SendOnchainParams, aA as SignedIntent, aB as Intent, aC as SignedProof, aD as Proof, o as SendParams, aE as TimeHeight, P as PageRequest, D as PageResult, F as ScriptVtxoCursor, H as ScriptVtxoPageOptions, J as StoredVtxo, K as VtxoRepositoryKey, L as TransactionHistoryPageFilter, M as TransactionHistoryPageCursor, Q as AtomicWalletState, U as WalletState, aF as DescriptorSigningRequest } from './index-Pk3i_MMU.js';
|
|
2
2
|
import { TransactionOutput } from '@scure/btc-signer/psbt.js';
|
|
3
3
|
import { Bytes } from '@scure/btc-signer/utils.js';
|
|
4
4
|
import { R as RelativeTimelock, A as ArkAddress, C as CSVMultisigTapscript } from './base-C-Y5t_0F.js';
|
|
5
5
|
import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-iyDum4fw.js';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* In-memory single key implementation for Bitcoin transaction signing.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* // Create from hex string
|
|
13
|
+
* const key = SingleKey.fromHex('your_private_key_hex');
|
|
14
|
+
*
|
|
15
|
+
* // Create from raw bytes
|
|
16
|
+
* const key = SingleKey.fromPrivateKey(privateKeyBytes);
|
|
17
|
+
*
|
|
18
|
+
* // Create random key
|
|
19
|
+
* const randomKey = SingleKey.fromRandomBytes();
|
|
20
|
+
*
|
|
21
|
+
* // Sign a transaction
|
|
22
|
+
* const signedTx = await key.sign(transaction);
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare class SingleKey implements Identity {
|
|
26
|
+
private key;
|
|
27
|
+
private constructor();
|
|
28
|
+
/** Create a signing identity from raw private key bytes. */
|
|
29
|
+
static fromPrivateKey(privateKey: Uint8Array): SingleKey;
|
|
30
|
+
/** Create a signing identity from a hex-encoded private key. */
|
|
31
|
+
static fromHex(privateKeyHex: string): SingleKey;
|
|
32
|
+
/** Create a signing identity with a freshly generated random private key. */
|
|
33
|
+
static fromRandomBytes(): SingleKey;
|
|
34
|
+
/**
|
|
35
|
+
* Export the private key as a hex string.
|
|
36
|
+
*
|
|
37
|
+
* @returns The private key as a hex string
|
|
38
|
+
*/
|
|
39
|
+
toHex(): string;
|
|
40
|
+
sign(tx: Transaction, inputIndexes?: number[]): Promise<Transaction>;
|
|
41
|
+
compressedPublicKey(): Promise<Uint8Array>;
|
|
42
|
+
xOnlyPublicKey(): Promise<Uint8Array>;
|
|
43
|
+
signerSession(): SignerSession;
|
|
44
|
+
signMessage(message: Uint8Array, signatureType?: "schnorr" | "ecdsa"): Promise<Uint8Array>;
|
|
45
|
+
/**
|
|
46
|
+
* BIP-340 sign `messageHash` with aux_rand = 0, so the signature — and
|
|
47
|
+
* anything derived from it — is reproducible from the key alone.
|
|
48
|
+
*
|
|
49
|
+
* What lets a static wallet derive a swap preimage instead of storing one
|
|
50
|
+
* (see `wallet/contractSecrets.ts`). Deliberately NOT `signMessage`, whose
|
|
51
|
+
* schnorr branch draws a random aux_rand: a preimage derived from that is
|
|
52
|
+
* unrecoverable, and the loss would only surface at claim time.
|
|
53
|
+
*/
|
|
54
|
+
signSchnorrDeterministic(messageHash: Uint8Array): Promise<Uint8Array>;
|
|
55
|
+
toReadonly(): Promise<ReadonlySingleKey>;
|
|
56
|
+
}
|
|
57
|
+
declare class ReadonlySingleKey implements ReadonlyIdentity {
|
|
58
|
+
private readonly publicKey;
|
|
59
|
+
/** Create a readonly identity from a compressed public key. */
|
|
60
|
+
constructor(publicKey: Uint8Array);
|
|
61
|
+
/**
|
|
62
|
+
* Create a ReadonlySingleKey from a compressed public key.
|
|
63
|
+
*
|
|
64
|
+
* @param publicKey - 33-byte compressed public key (02/03 prefix + 32-byte x coordinate)
|
|
65
|
+
* @returns A new ReadonlySingleKey instance
|
|
66
|
+
* @example
|
|
67
|
+
* ```typescript
|
|
68
|
+
* const pubkey = new Uint8Array(33); // your compressed public key
|
|
69
|
+
* const readonlyKey = ReadonlySingleKey.fromPublicKey(pubkey);
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
static fromPublicKey(publicKey: Uint8Array): ReadonlySingleKey;
|
|
73
|
+
xOnlyPublicKey(): Promise<Uint8Array>;
|
|
74
|
+
compressedPublicKey(): Promise<Uint8Array>;
|
|
75
|
+
}
|
|
76
|
+
|
|
7
77
|
/** Wall-clock floor for `batchExpiry` outside regtest. */
|
|
8
78
|
declare const DEFAULT_MIN_BATCH_EXPIRY_SECONDS = 86400n;
|
|
9
79
|
/** Wall-clock floor for `batchExpiry` on regtest (~10 blocks). */
|
|
@@ -43,6 +113,71 @@ declare function resolveBatchExpiryPolicy(network: Network, overrides?: Partial<
|
|
|
43
113
|
*/
|
|
44
114
|
declare function assertValidBatchExpiry(batchExpiry: bigint, policy: BatchExpiryPolicy): RelativeTimelock;
|
|
45
115
|
|
|
116
|
+
/**
|
|
117
|
+
* ArkadeCash is a bearer instrument for the Arkade.
|
|
118
|
+
* It encodes a private key and contract parameters as a bech32m string,
|
|
119
|
+
* enabling wallet-to-wallet transfers without address exchange.
|
|
120
|
+
*
|
|
121
|
+
* Format: arkadecash1... / tarkadecash1... (bech32m encoded)
|
|
122
|
+
* Payload: version (1 byte) + private key (32 bytes) + server pubkey (32 bytes) + csv timelock sequence (4 bytes)
|
|
123
|
+
*/
|
|
124
|
+
declare class ArkadeCash {
|
|
125
|
+
readonly csvTimelock: RelativeTimelock;
|
|
126
|
+
readonly hrp: string;
|
|
127
|
+
static readonly DefaultHRP = "arkadecash";
|
|
128
|
+
/** The only prefixes minted or accepted: mainnet and test networks. */
|
|
129
|
+
static readonly HRPs: readonly string[];
|
|
130
|
+
static readonly Version = 0;
|
|
131
|
+
static readonly PayloadLength: number;
|
|
132
|
+
private readonly _privateKey;
|
|
133
|
+
private readonly _serverPubKey;
|
|
134
|
+
private readonly _publicKey;
|
|
135
|
+
constructor(privateKey: Uint8Array, serverPubKey: Uint8Array, csvTimelock: RelativeTimelock, hrp?: string);
|
|
136
|
+
/** The note's private key. Returns a fresh copy; mutating it is a no-op. */
|
|
137
|
+
get privateKey(): Uint8Array;
|
|
138
|
+
/** The server's public key. Returns a fresh copy; mutating it is a no-op. */
|
|
139
|
+
get serverPubKey(): Uint8Array;
|
|
140
|
+
/** The note's public key. Returns a fresh copy; mutating it is a no-op. */
|
|
141
|
+
get publicKey(): Uint8Array;
|
|
142
|
+
static generate(serverPubKey: Uint8Array, csvTimelock: RelativeTimelock, hrp?: string): ArkadeCash;
|
|
143
|
+
static fromString(encoded: string): ArkadeCash;
|
|
144
|
+
toString(): string;
|
|
145
|
+
get identity(): SingleKey;
|
|
146
|
+
get vtxoScript(): DefaultVtxo.Script;
|
|
147
|
+
address(addressHrp: string): ArkAddress;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
type ArkadeCashAction = "issued" | "claimed";
|
|
151
|
+
/** One transaction of a voucher and the voucher's share of it, in sats. */
|
|
152
|
+
interface ArkadeCashTx {
|
|
153
|
+
txid: string;
|
|
154
|
+
amount: number;
|
|
155
|
+
}
|
|
156
|
+
interface ArkadeCashRecord {
|
|
157
|
+
id: string;
|
|
158
|
+
action: ArkadeCashAction;
|
|
159
|
+
createdAt: number;
|
|
160
|
+
outcome: string;
|
|
161
|
+
issues: ArkadeCashTx[];
|
|
162
|
+
claims: ArkadeCashTx[];
|
|
163
|
+
}
|
|
164
|
+
declare class ArkadeCashTracker {
|
|
165
|
+
readonly records: Map<string, ArkadeCashRecord>;
|
|
166
|
+
get(id: string): ArkadeCashRecord | undefined;
|
|
167
|
+
list(): ArkadeCashRecord[];
|
|
168
|
+
}
|
|
169
|
+
declare function createArkadeCashTracker(): ArkadeCashTracker;
|
|
170
|
+
/**
|
|
171
|
+
* Combine two records of one voucher. Transactions are unioned by txid and the earliest
|
|
172
|
+
* `createdAt` is kept. A claim outranks an issue for `action` and `outcome`; between records
|
|
173
|
+
* with the same action, `next` wins.
|
|
174
|
+
*/
|
|
175
|
+
declare function mergeArkadeCashRecord(prev: ArkadeCashRecord | undefined, next: ArkadeCashRecord): ArkadeCashRecord;
|
|
176
|
+
/** Inject a public record, merging it into any record already held for the voucher. */
|
|
177
|
+
declare function addArkadeCashRecord(records: ArkadeCashTracker, record: ArkadeCashRecord): void;
|
|
178
|
+
declare function arkadeCashId(cash: ArkadeCash): string;
|
|
179
|
+
declare function arkadeCashResolver(records: ArkadeCashTracker): ActivityResolver;
|
|
180
|
+
|
|
46
181
|
declare class ArkError extends Error {
|
|
47
182
|
readonly code: number;
|
|
48
183
|
readonly message: string;
|
|
@@ -100,6 +235,19 @@ declare class ProviderUnavailableError extends Error {
|
|
|
100
235
|
cause?: unknown;
|
|
101
236
|
});
|
|
102
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* A non-2xx response from a plain HTTP provider (Esplora, an SSE stream), carrying what a caller
|
|
240
|
+
* needs to back off: the numeric `status` and any `Retry-After` in milliseconds. The status is in
|
|
241
|
+
* the message too — `statusText` is empty over HTTP/2, and own-properties do not survive the
|
|
242
|
+
* service-worker boundary (see {@link ProviderKind}) — as `<prefix>: <detail> (<status>)`, so a
|
|
243
|
+
* caller matching on the prefix still matches.
|
|
244
|
+
*/
|
|
245
|
+
declare class HttpResponseError extends Error {
|
|
246
|
+
readonly status: number;
|
|
247
|
+
readonly retryAfterMs?: number;
|
|
248
|
+
/** @param detail - Replaces `statusText`, for a route that reads the body instead. */
|
|
249
|
+
constructor(prefix: string, response: Response, detail?: string);
|
|
250
|
+
}
|
|
103
251
|
/**
|
|
104
252
|
* A response doesn't reconcile with what the SDK submitted or validated (a checkpoint txid not
|
|
105
253
|
* among those submitted, a commitment tx differing from the one validated at tree signing).
|
|
@@ -590,6 +738,11 @@ interface ArkadeCashUnclaimedVtxo extends ArkadeCashVtxoRef {
|
|
|
590
738
|
* non-sweepable states become claimable.
|
|
591
739
|
*/
|
|
592
740
|
interface ArkadeCashClaimResult {
|
|
741
|
+
/**
|
|
742
|
+
* The Arkade transactions registered by successful sweeps, each with the sats it paid this
|
|
743
|
+
* wallet.
|
|
744
|
+
*/
|
|
745
|
+
claims?: ArkadeCashTx[];
|
|
593
746
|
/** Satoshis swept to this wallet instantly (the thin single-key sweep). */
|
|
594
747
|
swept: number;
|
|
595
748
|
/**
|
|
@@ -1590,6 +1743,14 @@ declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable,
|
|
|
1590
1743
|
* purge-on-completion bound that justifies storing it in the clear.
|
|
1591
1744
|
*/
|
|
1592
1745
|
removeRecoveryContract(script: string): Promise<void>;
|
|
1746
|
+
/**
|
|
1747
|
+
* Correlate an imported voucher's settlement with the voucher record. This
|
|
1748
|
+
* is deliberately kept on wallet state rather than being inferred from the
|
|
1749
|
+
* generic recovery row, which has no safe public correlation key. The
|
|
1750
|
+
* imported contract carries no cash id, so its script is the join key:
|
|
1751
|
+
* the script is the voucher id.
|
|
1752
|
+
*/
|
|
1753
|
+
correlateArkadeCashRecovery(cashId: string, txid: string, amount: number, outcome?: string): Promise<void>;
|
|
1593
1754
|
/**
|
|
1594
1755
|
* Split the VTXOs at an arkadeCash address into three buckets: the ones the
|
|
1595
1756
|
* thin sweep can move (`spendable`), the operator-swept ones that must go
|
|
@@ -1931,4 +2092,4 @@ declare class KeyringDescriptorProvider implements DescriptorProvider {
|
|
|
1931
2092
|
private mutate;
|
|
1932
2093
|
}
|
|
1933
2094
|
|
|
1934
|
-
export { type AddressAllocationCapable as A, type BatchExpiryPolicy as B,
|
|
2095
|
+
export { isHDWalletCapable as $, type AddressAllocationCapable as A, type BatchExpiryPolicy as B, SingleKey as C, DEFAULT_MIN_BATCH_EXPIRY_SECONDS as D, VtxoReservedError as E, ForeignDescriptorError as F, type WaitForIncomingFundsOptions as G, type HDWalletCapable as H, type IncomingFunds as I, WalletCannotAllocateAddressError as J, KeyringDescriptorProvider as K, addArkadeCashRecord as L, MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD as M, type NotifiesIncomingFunds as N, arkadeCashId as O, type ProviderConnectionState as P, arkadeCashResolver as Q, ReadonlyWallet as R, type ServerInfoSource as S, assertValidBatchExpiry as T, createArkadeCashTracker as U, type VtxoReservation as V, Wallet as W, defaultBatchExpiryPolicy as X, isAddressAllocationCapable as Y, isArkError as Z, isHDAllocationCapable as _, type HDAllocationCapable as a, maybeArkError as a0, mergeArkadeCashRecord as a1, resolveBatchExpiryPolicy as a2, resolveDescriptorSigner as a3, selectVirtualCoins as a4, signingDescriptorIndex as a5, strictSigningDescriptorIndex as a6, waitForIncomingFunds as a7, type ArkadeCashTx as b, type ArkadeCashRecord as c, type ArkadeCashClaimResult as d, type ReceiveRotatorFactory as e, type ReceiveRotatorBootOpts as f, type ReceiveRotatorBoot as g, Batch as h, AbortError as i, ArkError as j, ArkErrorName as k, ArkadeCash as l, type ArkadeCashAction as m, ArkadeCashCreateError as n, ArkadeCashOperatorMismatchError as o, type ArkadeCashUnclaimedReason as p, type ArkadeCashUnclaimedVtxo as q, type ArkadeCashVtxoRef as r, type BoardingUtxoGroup as s, HttpResponseError as t, IndexedDBWalletRepository as u, type ProviderKind as v, ProviderUnavailableError as w, REGTEST_MIN_BATCH_EXPIRY_SECONDS as x, ReadonlySingleKey as y, ServerResponseMismatchError as z };
|
package/dist/{keyringDescriptorProvider-DnaLUC7v.d.cts → keyringDescriptorProvider-nC8fIjBN.d.cts}
RENAMED
|
@@ -1,9 +1,79 @@
|
|
|
1
|
-
import { a3 as
|
|
1
|
+
import { a as Identity, a3 as Transaction, a4 as SignerSession, a5 as ReadonlyIdentity, a6 as Network, a7 as ActivityResolver, a8 as BatchStartedEvent, a9 as TreeSigningStartedEvent, aa as TxTree, ab as TreeNoncesEvent, ac as BatchFinalizationEvent, ad as BatchFinalizedEvent, ae as BatchFailedEvent, af as TreeTxEvent, ag as TreeSignatureEvent, n as SettlementEvent, b as WalletConfig, W as WalletRepository, C as ContractRepository, ah as DescriptorProvider, j as IContractManager, k as GetNewAddressesOptions, l as NewAddress, ai as IReadonlyWallet, aj as OnchainProvider, x as OperatorProvider, w as IndexerProvider, ak as DelegateProvider, al as ReadonlyWalletConfig, Y as BatchRegistrationRepository, $ as VirtualTxRepository, am as ExitCaptureMode, an as ExitDataSource, h as ActivityRegistry, ao as IReadonlyAssetManager, ap as ContractSyncState, aq as RecipientArkadeAddressContext, G as GetOperatorInfoOptions, O as OperatorInfo, A as ArkadeReader, ar as EsploraProvider, as as NetworkName, d as WalletBalance, e as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, f as GetSpendableVtxosFilter, at as ContractWithVtxos, au as selectPendingRecoveryOutpoints, g as ArkTransaction, i as Activity, E as ExtendedCoin, av as Coin, z as ExtendedVirtualCoin, aw as ContractManager, ax as ContractManagerConfig, I as IWallet, B as Outpoint, ay as SettlementConfig, c as ArkadeBroadcaster, q as IAssetManager, az as VtxoManager, m as IDelegateManager, S as SettleParams, R as Recipient, p as SendOnchainParams, aA as SignedIntent, aB as Intent, aC as SignedProof, aD as Proof, o as SendParams, aE as TimeHeight, P as PageRequest, D as PageResult, F as ScriptVtxoCursor, H as ScriptVtxoPageOptions, J as StoredVtxo, K as VtxoRepositoryKey, L as TransactionHistoryPageFilter, M as TransactionHistoryPageCursor, Q as AtomicWalletState, U as WalletState, aF as DescriptorSigningRequest } from './index-czozpKPT.cjs';
|
|
2
2
|
import { TransactionOutput } from '@scure/btc-signer/psbt.js';
|
|
3
3
|
import { Bytes } from '@scure/btc-signer/utils.js';
|
|
4
4
|
import { R as RelativeTimelock, A as ArkAddress, C as CSVMultisigTapscript } from './base-C-Y5t_0F.cjs';
|
|
5
5
|
import { D as DefaultVtxo, a as DelegateVtxo } from './delegate-gGkUnYpi.cjs';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* In-memory single key implementation for Bitcoin transaction signing.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* // Create from hex string
|
|
13
|
+
* const key = SingleKey.fromHex('your_private_key_hex');
|
|
14
|
+
*
|
|
15
|
+
* // Create from raw bytes
|
|
16
|
+
* const key = SingleKey.fromPrivateKey(privateKeyBytes);
|
|
17
|
+
*
|
|
18
|
+
* // Create random key
|
|
19
|
+
* const randomKey = SingleKey.fromRandomBytes();
|
|
20
|
+
*
|
|
21
|
+
* // Sign a transaction
|
|
22
|
+
* const signedTx = await key.sign(transaction);
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare class SingleKey implements Identity {
|
|
26
|
+
private key;
|
|
27
|
+
private constructor();
|
|
28
|
+
/** Create a signing identity from raw private key bytes. */
|
|
29
|
+
static fromPrivateKey(privateKey: Uint8Array): SingleKey;
|
|
30
|
+
/** Create a signing identity from a hex-encoded private key. */
|
|
31
|
+
static fromHex(privateKeyHex: string): SingleKey;
|
|
32
|
+
/** Create a signing identity with a freshly generated random private key. */
|
|
33
|
+
static fromRandomBytes(): SingleKey;
|
|
34
|
+
/**
|
|
35
|
+
* Export the private key as a hex string.
|
|
36
|
+
*
|
|
37
|
+
* @returns The private key as a hex string
|
|
38
|
+
*/
|
|
39
|
+
toHex(): string;
|
|
40
|
+
sign(tx: Transaction, inputIndexes?: number[]): Promise<Transaction>;
|
|
41
|
+
compressedPublicKey(): Promise<Uint8Array>;
|
|
42
|
+
xOnlyPublicKey(): Promise<Uint8Array>;
|
|
43
|
+
signerSession(): SignerSession;
|
|
44
|
+
signMessage(message: Uint8Array, signatureType?: "schnorr" | "ecdsa"): Promise<Uint8Array>;
|
|
45
|
+
/**
|
|
46
|
+
* BIP-340 sign `messageHash` with aux_rand = 0, so the signature — and
|
|
47
|
+
* anything derived from it — is reproducible from the key alone.
|
|
48
|
+
*
|
|
49
|
+
* What lets a static wallet derive a swap preimage instead of storing one
|
|
50
|
+
* (see `wallet/contractSecrets.ts`). Deliberately NOT `signMessage`, whose
|
|
51
|
+
* schnorr branch draws a random aux_rand: a preimage derived from that is
|
|
52
|
+
* unrecoverable, and the loss would only surface at claim time.
|
|
53
|
+
*/
|
|
54
|
+
signSchnorrDeterministic(messageHash: Uint8Array): Promise<Uint8Array>;
|
|
55
|
+
toReadonly(): Promise<ReadonlySingleKey>;
|
|
56
|
+
}
|
|
57
|
+
declare class ReadonlySingleKey implements ReadonlyIdentity {
|
|
58
|
+
private readonly publicKey;
|
|
59
|
+
/** Create a readonly identity from a compressed public key. */
|
|
60
|
+
constructor(publicKey: Uint8Array);
|
|
61
|
+
/**
|
|
62
|
+
* Create a ReadonlySingleKey from a compressed public key.
|
|
63
|
+
*
|
|
64
|
+
* @param publicKey - 33-byte compressed public key (02/03 prefix + 32-byte x coordinate)
|
|
65
|
+
* @returns A new ReadonlySingleKey instance
|
|
66
|
+
* @example
|
|
67
|
+
* ```typescript
|
|
68
|
+
* const pubkey = new Uint8Array(33); // your compressed public key
|
|
69
|
+
* const readonlyKey = ReadonlySingleKey.fromPublicKey(pubkey);
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
static fromPublicKey(publicKey: Uint8Array): ReadonlySingleKey;
|
|
73
|
+
xOnlyPublicKey(): Promise<Uint8Array>;
|
|
74
|
+
compressedPublicKey(): Promise<Uint8Array>;
|
|
75
|
+
}
|
|
76
|
+
|
|
7
77
|
/** Wall-clock floor for `batchExpiry` outside regtest. */
|
|
8
78
|
declare const DEFAULT_MIN_BATCH_EXPIRY_SECONDS = 86400n;
|
|
9
79
|
/** Wall-clock floor for `batchExpiry` on regtest (~10 blocks). */
|
|
@@ -43,6 +113,71 @@ declare function resolveBatchExpiryPolicy(network: Network, overrides?: Partial<
|
|
|
43
113
|
*/
|
|
44
114
|
declare function assertValidBatchExpiry(batchExpiry: bigint, policy: BatchExpiryPolicy): RelativeTimelock;
|
|
45
115
|
|
|
116
|
+
/**
|
|
117
|
+
* ArkadeCash is a bearer instrument for the Arkade.
|
|
118
|
+
* It encodes a private key and contract parameters as a bech32m string,
|
|
119
|
+
* enabling wallet-to-wallet transfers without address exchange.
|
|
120
|
+
*
|
|
121
|
+
* Format: arkadecash1... / tarkadecash1... (bech32m encoded)
|
|
122
|
+
* Payload: version (1 byte) + private key (32 bytes) + server pubkey (32 bytes) + csv timelock sequence (4 bytes)
|
|
123
|
+
*/
|
|
124
|
+
declare class ArkadeCash {
|
|
125
|
+
readonly csvTimelock: RelativeTimelock;
|
|
126
|
+
readonly hrp: string;
|
|
127
|
+
static readonly DefaultHRP = "arkadecash";
|
|
128
|
+
/** The only prefixes minted or accepted: mainnet and test networks. */
|
|
129
|
+
static readonly HRPs: readonly string[];
|
|
130
|
+
static readonly Version = 0;
|
|
131
|
+
static readonly PayloadLength: number;
|
|
132
|
+
private readonly _privateKey;
|
|
133
|
+
private readonly _serverPubKey;
|
|
134
|
+
private readonly _publicKey;
|
|
135
|
+
constructor(privateKey: Uint8Array, serverPubKey: Uint8Array, csvTimelock: RelativeTimelock, hrp?: string);
|
|
136
|
+
/** The note's private key. Returns a fresh copy; mutating it is a no-op. */
|
|
137
|
+
get privateKey(): Uint8Array;
|
|
138
|
+
/** The server's public key. Returns a fresh copy; mutating it is a no-op. */
|
|
139
|
+
get serverPubKey(): Uint8Array;
|
|
140
|
+
/** The note's public key. Returns a fresh copy; mutating it is a no-op. */
|
|
141
|
+
get publicKey(): Uint8Array;
|
|
142
|
+
static generate(serverPubKey: Uint8Array, csvTimelock: RelativeTimelock, hrp?: string): ArkadeCash;
|
|
143
|
+
static fromString(encoded: string): ArkadeCash;
|
|
144
|
+
toString(): string;
|
|
145
|
+
get identity(): SingleKey;
|
|
146
|
+
get vtxoScript(): DefaultVtxo.Script;
|
|
147
|
+
address(addressHrp: string): ArkAddress;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
type ArkadeCashAction = "issued" | "claimed";
|
|
151
|
+
/** One transaction of a voucher and the voucher's share of it, in sats. */
|
|
152
|
+
interface ArkadeCashTx {
|
|
153
|
+
txid: string;
|
|
154
|
+
amount: number;
|
|
155
|
+
}
|
|
156
|
+
interface ArkadeCashRecord {
|
|
157
|
+
id: string;
|
|
158
|
+
action: ArkadeCashAction;
|
|
159
|
+
createdAt: number;
|
|
160
|
+
outcome: string;
|
|
161
|
+
issues: ArkadeCashTx[];
|
|
162
|
+
claims: ArkadeCashTx[];
|
|
163
|
+
}
|
|
164
|
+
declare class ArkadeCashTracker {
|
|
165
|
+
readonly records: Map<string, ArkadeCashRecord>;
|
|
166
|
+
get(id: string): ArkadeCashRecord | undefined;
|
|
167
|
+
list(): ArkadeCashRecord[];
|
|
168
|
+
}
|
|
169
|
+
declare function createArkadeCashTracker(): ArkadeCashTracker;
|
|
170
|
+
/**
|
|
171
|
+
* Combine two records of one voucher. Transactions are unioned by txid and the earliest
|
|
172
|
+
* `createdAt` is kept. A claim outranks an issue for `action` and `outcome`; between records
|
|
173
|
+
* with the same action, `next` wins.
|
|
174
|
+
*/
|
|
175
|
+
declare function mergeArkadeCashRecord(prev: ArkadeCashRecord | undefined, next: ArkadeCashRecord): ArkadeCashRecord;
|
|
176
|
+
/** Inject a public record, merging it into any record already held for the voucher. */
|
|
177
|
+
declare function addArkadeCashRecord(records: ArkadeCashTracker, record: ArkadeCashRecord): void;
|
|
178
|
+
declare function arkadeCashId(cash: ArkadeCash): string;
|
|
179
|
+
declare function arkadeCashResolver(records: ArkadeCashTracker): ActivityResolver;
|
|
180
|
+
|
|
46
181
|
declare class ArkError extends Error {
|
|
47
182
|
readonly code: number;
|
|
48
183
|
readonly message: string;
|
|
@@ -100,6 +235,19 @@ declare class ProviderUnavailableError extends Error {
|
|
|
100
235
|
cause?: unknown;
|
|
101
236
|
});
|
|
102
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* A non-2xx response from a plain HTTP provider (Esplora, an SSE stream), carrying what a caller
|
|
240
|
+
* needs to back off: the numeric `status` and any `Retry-After` in milliseconds. The status is in
|
|
241
|
+
* the message too — `statusText` is empty over HTTP/2, and own-properties do not survive the
|
|
242
|
+
* service-worker boundary (see {@link ProviderKind}) — as `<prefix>: <detail> (<status>)`, so a
|
|
243
|
+
* caller matching on the prefix still matches.
|
|
244
|
+
*/
|
|
245
|
+
declare class HttpResponseError extends Error {
|
|
246
|
+
readonly status: number;
|
|
247
|
+
readonly retryAfterMs?: number;
|
|
248
|
+
/** @param detail - Replaces `statusText`, for a route that reads the body instead. */
|
|
249
|
+
constructor(prefix: string, response: Response, detail?: string);
|
|
250
|
+
}
|
|
103
251
|
/**
|
|
104
252
|
* A response doesn't reconcile with what the SDK submitted or validated (a checkpoint txid not
|
|
105
253
|
* among those submitted, a commitment tx differing from the one validated at tree signing).
|
|
@@ -590,6 +738,11 @@ interface ArkadeCashUnclaimedVtxo extends ArkadeCashVtxoRef {
|
|
|
590
738
|
* non-sweepable states become claimable.
|
|
591
739
|
*/
|
|
592
740
|
interface ArkadeCashClaimResult {
|
|
741
|
+
/**
|
|
742
|
+
* The Arkade transactions registered by successful sweeps, each with the sats it paid this
|
|
743
|
+
* wallet.
|
|
744
|
+
*/
|
|
745
|
+
claims?: ArkadeCashTx[];
|
|
593
746
|
/** Satoshis swept to this wallet instantly (the thin single-key sweep). */
|
|
594
747
|
swept: number;
|
|
595
748
|
/**
|
|
@@ -1590,6 +1743,14 @@ declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable,
|
|
|
1590
1743
|
* purge-on-completion bound that justifies storing it in the clear.
|
|
1591
1744
|
*/
|
|
1592
1745
|
removeRecoveryContract(script: string): Promise<void>;
|
|
1746
|
+
/**
|
|
1747
|
+
* Correlate an imported voucher's settlement with the voucher record. This
|
|
1748
|
+
* is deliberately kept on wallet state rather than being inferred from the
|
|
1749
|
+
* generic recovery row, which has no safe public correlation key. The
|
|
1750
|
+
* imported contract carries no cash id, so its script is the join key:
|
|
1751
|
+
* the script is the voucher id.
|
|
1752
|
+
*/
|
|
1753
|
+
correlateArkadeCashRecovery(cashId: string, txid: string, amount: number, outcome?: string): Promise<void>;
|
|
1593
1754
|
/**
|
|
1594
1755
|
* Split the VTXOs at an arkadeCash address into three buckets: the ones the
|
|
1595
1756
|
* thin sweep can move (`spendable`), the operator-swept ones that must go
|
|
@@ -1931,4 +2092,4 @@ declare class KeyringDescriptorProvider implements DescriptorProvider {
|
|
|
1931
2092
|
private mutate;
|
|
1932
2093
|
}
|
|
1933
2094
|
|
|
1934
|
-
export { type AddressAllocationCapable as A, type BatchExpiryPolicy as B,
|
|
2095
|
+
export { isHDWalletCapable as $, type AddressAllocationCapable as A, type BatchExpiryPolicy as B, SingleKey as C, DEFAULT_MIN_BATCH_EXPIRY_SECONDS as D, VtxoReservedError as E, ForeignDescriptorError as F, type WaitForIncomingFundsOptions as G, type HDWalletCapable as H, type IncomingFunds as I, WalletCannotAllocateAddressError as J, KeyringDescriptorProvider as K, addArkadeCashRecord as L, MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD as M, type NotifiesIncomingFunds as N, arkadeCashId as O, type ProviderConnectionState as P, arkadeCashResolver as Q, ReadonlyWallet as R, type ServerInfoSource as S, assertValidBatchExpiry as T, createArkadeCashTracker as U, type VtxoReservation as V, Wallet as W, defaultBatchExpiryPolicy as X, isAddressAllocationCapable as Y, isArkError as Z, isHDAllocationCapable as _, type HDAllocationCapable as a, maybeArkError as a0, mergeArkadeCashRecord as a1, resolveBatchExpiryPolicy as a2, resolveDescriptorSigner as a3, selectVirtualCoins as a4, signingDescriptorIndex as a5, strictSigningDescriptorIndex as a6, waitForIncomingFunds as a7, type ArkadeCashTx as b, type ArkadeCashRecord as c, type ArkadeCashClaimResult as d, type ReceiveRotatorFactory as e, type ReceiveRotatorBootOpts as f, type ReceiveRotatorBoot as g, Batch as h, AbortError as i, ArkError as j, ArkErrorName as k, ArkadeCash as l, type ArkadeCashAction as m, ArkadeCashCreateError as n, ArkadeCashOperatorMismatchError as o, type ArkadeCashUnclaimedReason as p, type ArkadeCashUnclaimedVtxo as q, type ArkadeCashVtxoRef as r, type BoardingUtxoGroup as s, HttpResponseError as t, IndexedDBWalletRepository as u, type ProviderKind as v, ProviderUnavailableError as w, REGTEST_MIN_BATCH_EXPIRY_SECONDS as x, ReadonlySingleKey as y, ServerResponseMismatchError as z };
|
|
@@ -114,6 +114,8 @@ interface TapscriptSegment {
|
|
|
114
114
|
* Mutually exclusive with `csv`/`asm`.
|
|
115
115
|
*/
|
|
116
116
|
cltv?: bigint | string;
|
|
117
|
+
/** Call inputs `witness` may name, passed as `{ tapscript: [...] }`. */
|
|
118
|
+
inputs?: readonly InputDef[];
|
|
117
119
|
/** Items satisfying the condition (e.g. an HTLC preimage); set via the ConditionWitness PSBT field. */
|
|
118
120
|
witness?: WitnessRef[];
|
|
119
121
|
}
|
|
@@ -121,6 +123,8 @@ interface TapscriptSegment {
|
|
|
121
123
|
interface ArkadeSegment {
|
|
122
124
|
/** Raw Arkade opcodes with `$param` placeholders. */
|
|
123
125
|
asm: AsmToken[];
|
|
126
|
+
/** Call inputs `witness` may name, passed as `{ arkadeScript: [...] }`. */
|
|
127
|
+
inputs?: readonly InputDef[];
|
|
124
128
|
/** The arkade-script witness stack (e.g. an output index). */
|
|
125
129
|
witness?: WitnessRef[];
|
|
126
130
|
/**
|
|
@@ -144,8 +148,6 @@ interface SourceRange {
|
|
|
144
148
|
interface ArkadeFunction {
|
|
145
149
|
/** Compiler spend group, used to resolve named covenant commitments. */
|
|
146
150
|
group?: string;
|
|
147
|
-
/** Ordered typed call arguments; absent for nullary paths. */
|
|
148
|
-
inputs?: readonly InputDef[];
|
|
149
151
|
tapscript: TapscriptSegment;
|
|
150
152
|
/** Present for covenant paths; absent for pure-tapscript paths (cancel/exit). */
|
|
151
153
|
arkadeScript?: ArkadeSegment;
|
|
@@ -114,6 +114,8 @@ interface TapscriptSegment {
|
|
|
114
114
|
* Mutually exclusive with `csv`/`asm`.
|
|
115
115
|
*/
|
|
116
116
|
cltv?: bigint | string;
|
|
117
|
+
/** Call inputs `witness` may name, passed as `{ tapscript: [...] }`. */
|
|
118
|
+
inputs?: readonly InputDef[];
|
|
117
119
|
/** Items satisfying the condition (e.g. an HTLC preimage); set via the ConditionWitness PSBT field. */
|
|
118
120
|
witness?: WitnessRef[];
|
|
119
121
|
}
|
|
@@ -121,6 +123,8 @@ interface TapscriptSegment {
|
|
|
121
123
|
interface ArkadeSegment {
|
|
122
124
|
/** Raw Arkade opcodes with `$param` placeholders. */
|
|
123
125
|
asm: AsmToken[];
|
|
126
|
+
/** Call inputs `witness` may name, passed as `{ arkadeScript: [...] }`. */
|
|
127
|
+
inputs?: readonly InputDef[];
|
|
124
128
|
/** The arkade-script witness stack (e.g. an output index). */
|
|
125
129
|
witness?: WitnessRef[];
|
|
126
130
|
/**
|
|
@@ -144,8 +148,6 @@ interface SourceRange {
|
|
|
144
148
|
interface ArkadeFunction {
|
|
145
149
|
/** Compiler spend group, used to resolve named covenant commitments. */
|
|
146
150
|
group?: string;
|
|
147
|
-
/** Ordered typed call arguments; absent for nullary paths. */
|
|
148
|
-
inputs?: readonly InputDef[];
|
|
149
151
|
tapscript: TapscriptSegment;
|
|
150
152
|
/** Present for covenant paths; absent for pure-tapscript paths (cancel/exit). */
|
|
151
153
|
arkadeScript?: ArkadeSegment;
|