@arkade-os/sdk 0.5.5 → 0.5.7

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.
Files changed (77) hide show
  1. package/dist/adapters/expo.cjs +6 -6
  2. package/dist/adapters/expo.d.cts +2 -2
  3. package/dist/adapters/expo.d.ts +2 -2
  4. package/dist/adapters/expo.js +3 -3
  5. package/dist/{asyncStorageTaskQueue-BbH-THYJ.d.cts → asyncStorageTaskQueue-B9byr6ij.d.cts} +1 -1
  6. package/dist/{asyncStorageTaskQueue-BlvkJyTa.d.ts → asyncStorageTaskQueue-XP4CCdRY.d.ts} +1 -1
  7. package/dist/{chunk-XWUCNMPN.cjs → chunk-3NALVGMJ.cjs} +16 -16
  8. package/dist/{chunk-XWUCNMPN.cjs.map → chunk-3NALVGMJ.cjs.map} +1 -1
  9. package/dist/{chunk-FVVXCDNE.js → chunk-4AJRIM44.js} +4 -4
  10. package/dist/{chunk-FVVXCDNE.js.map → chunk-4AJRIM44.js.map} +1 -1
  11. package/dist/{chunk-AMH7Q3DF.cjs → chunk-MQUATTIM.cjs} +8 -8
  12. package/dist/{chunk-AMH7Q3DF.cjs.map → chunk-MQUATTIM.cjs.map} +1 -1
  13. package/dist/{chunk-CE46RS6L.js → chunk-MWEDDWFU.js} +4 -4
  14. package/dist/{chunk-CE46RS6L.js.map → chunk-MWEDDWFU.js.map} +1 -1
  15. package/dist/{chunk-7GIKLFHC.js → chunk-MWMO2ZQP.js} +3 -3
  16. package/dist/{chunk-7GIKLFHC.js.map → chunk-MWMO2ZQP.js.map} +1 -1
  17. package/dist/{chunk-HQQ4NRXI.cjs → chunk-MXCB6EVM.cjs} +15 -15
  18. package/dist/{chunk-HQQ4NRXI.cjs.map → chunk-MXCB6EVM.cjs.map} +1 -1
  19. package/dist/{chunk-KCL5AVML.cjs → chunk-OMPDPBT5.cjs} +3 -3
  20. package/dist/chunk-OMPDPBT5.cjs.map +1 -0
  21. package/dist/{chunk-OO2KEK64.js → chunk-RLD7DRSZ.js} +381 -54
  22. package/dist/chunk-RLD7DRSZ.js.map +1 -0
  23. package/dist/{chunk-T254PXSN.cjs → chunk-URGVQ5TQ.cjs} +795 -462
  24. package/dist/chunk-URGVQ5TQ.cjs.map +1 -0
  25. package/dist/{chunk-BCA6D255.js → chunk-V2DDN4MV.js} +3 -3
  26. package/dist/{chunk-BCA6D255.js.map → chunk-V2DDN4MV.js.map} +1 -1
  27. package/dist/{chunk-5SYUEVJH.cjs → chunk-V5WRO3P6.cjs} +10 -10
  28. package/dist/{chunk-5SYUEVJH.cjs.map → chunk-V5WRO3P6.cjs.map} +1 -1
  29. package/dist/{chunk-4I53THL6.js → chunk-VMVFRTF4.js} +3 -3
  30. package/dist/chunk-VMVFRTF4.js.map +1 -0
  31. package/dist/contracts/handlers/index.cjs +9 -9
  32. package/dist/contracts/handlers/index.d.cts +2 -2
  33. package/dist/contracts/handlers/index.d.ts +2 -2
  34. package/dist/contracts/handlers/index.js +2 -2
  35. package/dist/{index-DCml4QJn.d.ts → index-18cDMayF.d.ts} +25 -25
  36. package/dist/{index-Bx-iArDs.d.ts → index-B_kcptF8.d.ts} +1 -1
  37. package/dist/{index-BWwVnJhU.d.cts → index-Ccfhdfvj.d.cts} +1 -1
  38. package/dist/{index-DkyzIzKL.d.cts → index-DDJFHfba.d.cts} +25 -25
  39. package/dist/index.cjs +335 -311
  40. package/dist/index.d.cts +89 -138
  41. package/dist/index.d.ts +89 -138
  42. package/dist/index.js +4 -4
  43. package/dist/{keyringDescriptorProvider-CS4w4PWd.d.ts → keyringDescriptorProvider-DL-jAiRO.d.ts} +158 -10
  44. package/dist/{keyringDescriptorProvider-CmHXrIXd.d.cts → keyringDescriptorProvider-Dtv0JWrT.d.cts} +158 -10
  45. package/dist/repositories/realm/index.cjs +37 -37
  46. package/dist/repositories/realm/index.cjs.map +1 -1
  47. package/dist/repositories/realm/index.d.cts +6 -6
  48. package/dist/repositories/realm/index.d.ts +6 -6
  49. package/dist/repositories/realm/index.js +6 -6
  50. package/dist/repositories/realm/index.js.map +1 -1
  51. package/dist/repositories/sqlite/index.cjs +35 -35
  52. package/dist/repositories/sqlite/index.cjs.map +1 -1
  53. package/dist/repositories/sqlite/index.d.cts +6 -6
  54. package/dist/repositories/sqlite/index.d.ts +6 -6
  55. package/dist/repositories/sqlite/index.js +5 -5
  56. package/dist/repositories/sqlite/index.js.map +1 -1
  57. package/dist/{taskRunner-DgMLSk_O.d.ts → taskRunner-DUafWu0o.d.ts} +1 -1
  58. package/dist/{taskRunner-buh6aFpG.d.cts → taskRunner-JYHaLPne.d.cts} +1 -1
  59. package/dist/wallet/expo/background.cjs +14 -14
  60. package/dist/wallet/expo/background.d.cts +3 -3
  61. package/dist/wallet/expo/background.d.ts +3 -3
  62. package/dist/wallet/expo/background.js +6 -6
  63. package/dist/wallet/expo/index.cjs +15 -15
  64. package/dist/wallet/expo/index.cjs.map +1 -1
  65. package/dist/wallet/expo/index.d.cts +6 -6
  66. package/dist/wallet/expo/index.d.ts +6 -6
  67. package/dist/wallet/expo/index.js +5 -5
  68. package/dist/wallet/expo/index.js.map +1 -1
  69. package/dist/worker/expo/index.cjs +9 -9
  70. package/dist/worker/expo/index.d.cts +4 -4
  71. package/dist/worker/expo/index.d.ts +4 -4
  72. package/dist/worker/expo/index.js +5 -5
  73. package/package.json +2 -2
  74. package/dist/chunk-4I53THL6.js.map +0 -1
  75. package/dist/chunk-KCL5AVML.cjs.map +0 -1
  76. package/dist/chunk-OO2KEK64.js.map +0 -1
  77. package/dist/chunk-T254PXSN.cjs.map +0 -1
@@ -1,9 +1,79 @@
1
- import { a4 as Network, a5 as BatchStartedEvent, a6 as TreeSigningStartedEvent, a7 as TxTree, a8 as TreeNoncesEvent, a9 as BatchFinalizationEvent, aa as BatchFinalizedEvent, ab as BatchFailedEvent, ac as TreeTxEvent, ad as TreeSignatureEvent, o as SettlementEvent, b as WalletConfig, W as WalletRepository, C as ContractRepository, ae as DescriptorProvider, k as IContractManager, l as GetNewAddressesOptions, m as NewAddress, a as Identity, af as IReadonlyWallet, ag as ReadonlyIdentity, ah as OnchainProvider, O as OperatorProvider, x as IndexerProvider, ai as DelegateProvider, aj as ReadonlyWalletConfig, ak as IntentRepository, a0 as VirtualTxRepository, al as ExitCaptureMode, am as ExitDataSource, i as ActivityRegistry, an as IReadonlyAssetManager, ao as ContractSyncState, ap as RecipientArkadeAddressContext, G as GetOperatorInfoOptions, A as ArkadeInfo, c as ArkadeReader, aq as EsploraProvider, ar as NetworkName, as as OperatorInfo, e as WalletBalance, f as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, g as GetSpendableVtxosFilter, at as ContractWithVtxos, au as selectPendingRecoveryOutpoints, h as ArkTransaction, j 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, d as ArkadeBroadcaster, r as IAssetManager, az as VtxoManager, n as IDelegateManager, S as SettleParams, R as Recipient, aA as SignerSession, aB as Transaction, q as SendOnchainParams, aC as SignedIntent, aD as Intent, aE as SignedProof, aF as Proof, p as SendParams, aG 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, aH as DescriptorSigningRequest } from './index-DCml4QJn.js';
2
- import { R as RelativeTimelock, A as ArkAddress, C as CSVMultisigTapscript } from './base-C-Y5t_0F.js';
3
- import { Bytes } from '@scure/btc-signer/utils.js';
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-18cDMayF.js';
4
2
  import { TransactionOutput } from '@scure/btc-signer/psbt.js';
3
+ import { Bytes } from '@scure/btc-signer/utils.js';
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;
@@ -120,7 +255,7 @@ declare class ServerResponseMismatchError extends Error {
120
255
  */
121
256
  declare function maybeArkError(error: any): ArkError | undefined;
122
257
 
123
- /** Where the {@link ArkadeInfo} used to construct a wallet came from. */
258
+ /** Where the {@link OperatorInfo} used to construct a wallet came from. */
124
259
  type ServerInfoSource = "live" | "cache";
125
260
 
126
261
  /**
@@ -590,6 +725,11 @@ interface ArkadeCashUnclaimedVtxo extends ArkadeCashVtxoRef {
590
725
  * non-sweepable states become claimable.
591
726
  */
592
727
  interface ArkadeCashClaimResult {
728
+ /**
729
+ * The Arkade transactions registered by successful sweeps, each with the sats it paid this
730
+ * wallet.
731
+ */
732
+ claims?: ArkadeCashTx[];
593
733
  /** Satoshis swept to this wallet instantly (the thin single-key sweep). */
594
734
  swept: number;
595
735
  /**
@@ -681,7 +821,7 @@ declare class ReadonlyWallet implements IReadonlyWallet {
681
821
  protected vtxoSyncOverlapMs?: number;
682
822
  protected copySyncOverlapTo(wallet: ReadonlyWallet): void;
683
823
  /** Opt-in intent-lifecycle repository; `undefined` ⇒ intent persistence is a no-op. */
684
- intentRepository?: IntentRepository;
824
+ intentRepository?: BatchRegistrationRepository;
685
825
  /**
686
826
  * **Experimental / inert.** Opt-in virtual-tx repository, exposed so callers can pass it to
687
827
  * {@link Unroll.Session.create} as a best-effort raw-tx cache. Normal sync never writes it.
@@ -784,11 +924,11 @@ declare class ReadonlyWallet implements IReadonlyWallet {
784
924
  * before binding the answer into a covenant to fail closed instead of getting the snapshot.
785
925
  *
786
926
  * @returns The operator's info
787
- * @see ArkadeInfo
927
+ * @see OperatorInfo
788
928
  */
789
- getOperatorInfo(opts?: GetOperatorInfoOptions): Promise<ArkadeInfo>;
929
+ getOperatorInfo(opts?: GetOperatorInfoOptions): Promise<OperatorInfo>;
790
930
  /** @deprecated Use {@link getOperatorInfo}. */
791
- getArkadeInfo(opts?: GetOperatorInfoOptions): Promise<ArkadeInfo>;
931
+ getArkadeInfo(opts?: GetOperatorInfoOptions): Promise<OperatorInfo>;
792
932
  /**
793
933
  * Chain reads against this wallet's operator for scripts it does not own, bound to the wallet's
794
934
  * own (possibly Expo/injected) `indexerProvider`. `getVtxos` normalizes via
@@ -1207,7 +1347,7 @@ declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable,
1207
1347
  get serverUnrollScript(): CSVMultisigTapscript.Type;
1208
1348
  /**
1209
1349
  * @internal Sole write path for `serverUnrollScript`; called by
1210
- * {@link Wallet._doRotateServerSigner} with the rotating `ArkadeInfo`'s checkpoint script.
1350
+ * {@link Wallet._doRotateServerSigner} with the rotating `OperatorInfo`'s checkpoint script.
1211
1351
  */
1212
1352
  setServerUnrollScriptForRotation(script: CSVMultisigTapscript.Type): void;
1213
1353
  /**
@@ -1590,6 +1730,14 @@ declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable,
1590
1730
  * purge-on-completion bound that justifies storing it in the clear.
1591
1731
  */
1592
1732
  removeRecoveryContract(script: string): Promise<void>;
1733
+ /**
1734
+ * Correlate an imported voucher's settlement with the voucher record. This
1735
+ * is deliberately kept on wallet state rather than being inferred from the
1736
+ * generic recovery row, which has no safe public correlation key. The
1737
+ * imported contract carries no cash id, so its script is the join key:
1738
+ * the script is the voucher id.
1739
+ */
1740
+ correlateArkadeCashRecovery(cashId: string, txid: string, amount: number, outcome?: string): Promise<void>;
1593
1741
  /**
1594
1742
  * Split the VTXOs at an arkadeCash address into three buckets: the ones the
1595
1743
  * thin sweep can move (`spendable`), the operator-swept ones that must go
@@ -1931,4 +2079,4 @@ declare class KeyringDescriptorProvider implements DescriptorProvider {
1931
2079
  private mutate;
1932
2080
  }
1933
2081
 
1934
- export { type AddressAllocationCapable as A, type BatchExpiryPolicy as B, isArkError as C, DEFAULT_MIN_BATCH_EXPIRY_SECONDS as D, isHDAllocationCapable as E, ForeignDescriptorError as F, isHDWalletCapable as G, type HDWalletCapable as H, type IncomingFunds as I, maybeArkError as J, KeyringDescriptorProvider as K, resolveBatchExpiryPolicy as L, MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD as M, type NotifiesIncomingFunds as N, resolveDescriptorSigner as O, type ProviderConnectionState as P, selectVirtualCoins as Q, ReadonlyWallet as R, type ServerInfoSource as S, signingDescriptorIndex as T, strictSigningDescriptorIndex as U, type VtxoReservation as V, Wallet as W, waitForIncomingFunds as X, type HDAllocationCapable as a, type ReceiveRotatorFactory as b, type ReceiveRotatorBootOpts as c, type ReceiveRotatorBoot as d, Batch as e, AbortError as f, ArkError as g, ArkErrorName as h, type ArkadeCashClaimResult as i, ArkadeCashCreateError as j, ArkadeCashOperatorMismatchError as k, type ArkadeCashUnclaimedReason as l, type ArkadeCashUnclaimedVtxo as m, type ArkadeCashVtxoRef as n, type BoardingUtxoGroup as o, IndexedDBWalletRepository as p, type ProviderKind as q, ProviderUnavailableError as r, REGTEST_MIN_BATCH_EXPIRY_SECONDS as s, ServerResponseMismatchError as t, VtxoReservedError as u, type WaitForIncomingFundsOptions as v, WalletCannotAllocateAddressError as w, assertValidBatchExpiry as x, defaultBatchExpiryPolicy as y, isAddressAllocationCapable as z };
2082
+ export { maybeArkError as $, type AddressAllocationCapable as A, type BatchExpiryPolicy as B, VtxoReservedError as C, DEFAULT_MIN_BATCH_EXPIRY_SECONDS as D, type WaitForIncomingFundsOptions as E, ForeignDescriptorError as F, WalletCannotAllocateAddressError as G, type HDWalletCapable as H, type IncomingFunds as I, addArkadeCashRecord as J, KeyringDescriptorProvider as K, arkadeCashId as L, MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD as M, type NotifiesIncomingFunds as N, arkadeCashResolver as O, type ProviderConnectionState as P, assertValidBatchExpiry as Q, ReadonlyWallet as R, type ServerInfoSource as S, createArkadeCashTracker as T, defaultBatchExpiryPolicy as U, type VtxoReservation as V, Wallet as W, isAddressAllocationCapable as X, isArkError as Y, isHDAllocationCapable as Z, isHDWalletCapable as _, type HDAllocationCapable as a, mergeArkadeCashRecord as a0, resolveBatchExpiryPolicy as a1, resolveDescriptorSigner as a2, selectVirtualCoins as a3, signingDescriptorIndex as a4, strictSigningDescriptorIndex as a5, waitForIncomingFunds as a6, 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, IndexedDBWalletRepository as t, type ProviderKind as u, ProviderUnavailableError as v, REGTEST_MIN_BATCH_EXPIRY_SECONDS as w, ReadonlySingleKey as x, ServerResponseMismatchError as y, SingleKey as z };
@@ -1,9 +1,79 @@
1
- import { a4 as Network, a5 as BatchStartedEvent, a6 as TreeSigningStartedEvent, a7 as TxTree, a8 as TreeNoncesEvent, a9 as BatchFinalizationEvent, aa as BatchFinalizedEvent, ab as BatchFailedEvent, ac as TreeTxEvent, ad as TreeSignatureEvent, o as SettlementEvent, b as WalletConfig, W as WalletRepository, C as ContractRepository, ae as DescriptorProvider, k as IContractManager, l as GetNewAddressesOptions, m as NewAddress, a as Identity, af as IReadonlyWallet, ag as ReadonlyIdentity, ah as OnchainProvider, O as OperatorProvider, x as IndexerProvider, ai as DelegateProvider, aj as ReadonlyWalletConfig, ak as IntentRepository, a0 as VirtualTxRepository, al as ExitCaptureMode, am as ExitDataSource, i as ActivityRegistry, an as IReadonlyAssetManager, ao as ContractSyncState, ap as RecipientArkadeAddressContext, G as GetOperatorInfoOptions, A as ArkadeInfo, c as ArkadeReader, aq as EsploraProvider, ar as NetworkName, as as OperatorInfo, e as WalletBalance, f as GetVtxosFilter, N as NormalizedExtendedVirtualCoin, g as GetSpendableVtxosFilter, at as ContractWithVtxos, au as selectPendingRecoveryOutpoints, h as ArkTransaction, j 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, d as ArkadeBroadcaster, r as IAssetManager, az as VtxoManager, n as IDelegateManager, S as SettleParams, R as Recipient, aA as SignerSession, aB as Transaction, q as SendOnchainParams, aC as SignedIntent, aD as Intent, aE as SignedProof, aF as Proof, p as SendParams, aG 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, aH as DescriptorSigningRequest } from './index-DkyzIzKL.cjs';
2
- import { R as RelativeTimelock, A as ArkAddress, C as CSVMultisigTapscript } from './base-C-Y5t_0F.cjs';
3
- import { Bytes } from '@scure/btc-signer/utils.js';
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-DDJFHfba.cjs';
4
2
  import { TransactionOutput } from '@scure/btc-signer/psbt.js';
3
+ import { Bytes } from '@scure/btc-signer/utils.js';
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;
@@ -120,7 +255,7 @@ declare class ServerResponseMismatchError extends Error {
120
255
  */
121
256
  declare function maybeArkError(error: any): ArkError | undefined;
122
257
 
123
- /** Where the {@link ArkadeInfo} used to construct a wallet came from. */
258
+ /** Where the {@link OperatorInfo} used to construct a wallet came from. */
124
259
  type ServerInfoSource = "live" | "cache";
125
260
 
126
261
  /**
@@ -590,6 +725,11 @@ interface ArkadeCashUnclaimedVtxo extends ArkadeCashVtxoRef {
590
725
  * non-sweepable states become claimable.
591
726
  */
592
727
  interface ArkadeCashClaimResult {
728
+ /**
729
+ * The Arkade transactions registered by successful sweeps, each with the sats it paid this
730
+ * wallet.
731
+ */
732
+ claims?: ArkadeCashTx[];
593
733
  /** Satoshis swept to this wallet instantly (the thin single-key sweep). */
594
734
  swept: number;
595
735
  /**
@@ -681,7 +821,7 @@ declare class ReadonlyWallet implements IReadonlyWallet {
681
821
  protected vtxoSyncOverlapMs?: number;
682
822
  protected copySyncOverlapTo(wallet: ReadonlyWallet): void;
683
823
  /** Opt-in intent-lifecycle repository; `undefined` ⇒ intent persistence is a no-op. */
684
- intentRepository?: IntentRepository;
824
+ intentRepository?: BatchRegistrationRepository;
685
825
  /**
686
826
  * **Experimental / inert.** Opt-in virtual-tx repository, exposed so callers can pass it to
687
827
  * {@link Unroll.Session.create} as a best-effort raw-tx cache. Normal sync never writes it.
@@ -784,11 +924,11 @@ declare class ReadonlyWallet implements IReadonlyWallet {
784
924
  * before binding the answer into a covenant to fail closed instead of getting the snapshot.
785
925
  *
786
926
  * @returns The operator's info
787
- * @see ArkadeInfo
927
+ * @see OperatorInfo
788
928
  */
789
- getOperatorInfo(opts?: GetOperatorInfoOptions): Promise<ArkadeInfo>;
929
+ getOperatorInfo(opts?: GetOperatorInfoOptions): Promise<OperatorInfo>;
790
930
  /** @deprecated Use {@link getOperatorInfo}. */
791
- getArkadeInfo(opts?: GetOperatorInfoOptions): Promise<ArkadeInfo>;
931
+ getArkadeInfo(opts?: GetOperatorInfoOptions): Promise<OperatorInfo>;
792
932
  /**
793
933
  * Chain reads against this wallet's operator for scripts it does not own, bound to the wallet's
794
934
  * own (possibly Expo/injected) `indexerProvider`. `getVtxos` normalizes via
@@ -1207,7 +1347,7 @@ declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable,
1207
1347
  get serverUnrollScript(): CSVMultisigTapscript.Type;
1208
1348
  /**
1209
1349
  * @internal Sole write path for `serverUnrollScript`; called by
1210
- * {@link Wallet._doRotateServerSigner} with the rotating `ArkadeInfo`'s checkpoint script.
1350
+ * {@link Wallet._doRotateServerSigner} with the rotating `OperatorInfo`'s checkpoint script.
1211
1351
  */
1212
1352
  setServerUnrollScriptForRotation(script: CSVMultisigTapscript.Type): void;
1213
1353
  /**
@@ -1590,6 +1730,14 @@ declare class Wallet extends ReadonlyWallet implements IWallet, HDWalletCapable,
1590
1730
  * purge-on-completion bound that justifies storing it in the clear.
1591
1731
  */
1592
1732
  removeRecoveryContract(script: string): Promise<void>;
1733
+ /**
1734
+ * Correlate an imported voucher's settlement with the voucher record. This
1735
+ * is deliberately kept on wallet state rather than being inferred from the
1736
+ * generic recovery row, which has no safe public correlation key. The
1737
+ * imported contract carries no cash id, so its script is the join key:
1738
+ * the script is the voucher id.
1739
+ */
1740
+ correlateArkadeCashRecovery(cashId: string, txid: string, amount: number, outcome?: string): Promise<void>;
1593
1741
  /**
1594
1742
  * Split the VTXOs at an arkadeCash address into three buckets: the ones the
1595
1743
  * thin sweep can move (`spendable`), the operator-swept ones that must go
@@ -1931,4 +2079,4 @@ declare class KeyringDescriptorProvider implements DescriptorProvider {
1931
2079
  private mutate;
1932
2080
  }
1933
2081
 
1934
- export { type AddressAllocationCapable as A, type BatchExpiryPolicy as B, isArkError as C, DEFAULT_MIN_BATCH_EXPIRY_SECONDS as D, isHDAllocationCapable as E, ForeignDescriptorError as F, isHDWalletCapable as G, type HDWalletCapable as H, type IncomingFunds as I, maybeArkError as J, KeyringDescriptorProvider as K, resolveBatchExpiryPolicy as L, MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD as M, type NotifiesIncomingFunds as N, resolveDescriptorSigner as O, type ProviderConnectionState as P, selectVirtualCoins as Q, ReadonlyWallet as R, type ServerInfoSource as S, signingDescriptorIndex as T, strictSigningDescriptorIndex as U, type VtxoReservation as V, Wallet as W, waitForIncomingFunds as X, type HDAllocationCapable as a, type ReceiveRotatorFactory as b, type ReceiveRotatorBootOpts as c, type ReceiveRotatorBoot as d, Batch as e, AbortError as f, ArkError as g, ArkErrorName as h, type ArkadeCashClaimResult as i, ArkadeCashCreateError as j, ArkadeCashOperatorMismatchError as k, type ArkadeCashUnclaimedReason as l, type ArkadeCashUnclaimedVtxo as m, type ArkadeCashVtxoRef as n, type BoardingUtxoGroup as o, IndexedDBWalletRepository as p, type ProviderKind as q, ProviderUnavailableError as r, REGTEST_MIN_BATCH_EXPIRY_SECONDS as s, ServerResponseMismatchError as t, VtxoReservedError as u, type WaitForIncomingFundsOptions as v, WalletCannotAllocateAddressError as w, assertValidBatchExpiry as x, defaultBatchExpiryPolicy as y, isAddressAllocationCapable as z };
2082
+ export { maybeArkError as $, type AddressAllocationCapable as A, type BatchExpiryPolicy as B, VtxoReservedError as C, DEFAULT_MIN_BATCH_EXPIRY_SECONDS as D, type WaitForIncomingFundsOptions as E, ForeignDescriptorError as F, WalletCannotAllocateAddressError as G, type HDWalletCapable as H, type IncomingFunds as I, addArkadeCashRecord as J, KeyringDescriptorProvider as K, arkadeCashId as L, MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD as M, type NotifiesIncomingFunds as N, arkadeCashResolver as O, type ProviderConnectionState as P, assertValidBatchExpiry as Q, ReadonlyWallet as R, type ServerInfoSource as S, createArkadeCashTracker as T, defaultBatchExpiryPolicy as U, type VtxoReservation as V, Wallet as W, isAddressAllocationCapable as X, isArkError as Y, isHDAllocationCapable as Z, isHDWalletCapable as _, type HDAllocationCapable as a, mergeArkadeCashRecord as a0, resolveBatchExpiryPolicy as a1, resolveDescriptorSigner as a2, selectVirtualCoins as a3, signingDescriptorIndex as a4, strictSigningDescriptorIndex as a5, waitForIncomingFunds as a6, 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, IndexedDBWalletRepository as t, type ProviderKind as u, ProviderUnavailableError as v, REGTEST_MIN_BATCH_EXPIRY_SECONDS as w, ReadonlySingleKey as x, ServerResponseMismatchError as y, SingleKey as z };