@arkade-os/sdk 0.5.6 → 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.
- 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-B9byr6ij.d.cts} +2 -2
- package/dist/{asyncStorageTaskQueue-CpkstKZ5.d.ts → asyncStorageTaskQueue-XP4CCdRY.d.ts} +2 -2
- package/dist/{chunk-HKEPJBTY.cjs → chunk-3NALVGMJ.cjs} +16 -16
- package/dist/{chunk-HKEPJBTY.cjs.map → chunk-3NALVGMJ.cjs.map} +1 -1
- package/dist/{chunk-VWW2ZBPI.js → chunk-4AJRIM44.js} +4 -4
- package/dist/{chunk-VWW2ZBPI.js.map → chunk-4AJRIM44.js.map} +1 -1
- package/dist/{chunk-NDQ4LB4X.cjs → chunk-MQUATTIM.cjs} +8 -8
- package/dist/{chunk-NDQ4LB4X.cjs.map → chunk-MQUATTIM.cjs.map} +1 -1
- package/dist/{chunk-DJYX73W2.js → chunk-MWEDDWFU.js} +4 -4
- package/dist/{chunk-DJYX73W2.js.map → chunk-MWEDDWFU.js.map} +1 -1
- package/dist/{chunk-C7NY6WSA.js → chunk-MWMO2ZQP.js} +3 -3
- package/dist/{chunk-C7NY6WSA.js.map → chunk-MWMO2ZQP.js.map} +1 -1
- package/dist/{chunk-4X67IB2V.cjs → chunk-MXCB6EVM.cjs} +15 -15
- package/dist/{chunk-4X67IB2V.cjs.map → chunk-MXCB6EVM.cjs.map} +1 -1
- package/dist/{chunk-LZAINCGU.cjs → chunk-OMPDPBT5.cjs} +3 -3
- package/dist/chunk-OMPDPBT5.cjs.map +1 -0
- package/dist/{chunk-YKT4NAQG.js → chunk-RLD7DRSZ.js} +341 -25
- package/dist/chunk-RLD7DRSZ.js.map +1 -0
- package/dist/{chunk-Y3CDDPWI.cjs → chunk-URGVQ5TQ.cjs} +756 -434
- package/dist/chunk-URGVQ5TQ.cjs.map +1 -0
- package/dist/{chunk-47Z4LEIW.js → chunk-V2DDN4MV.js} +3 -3
- package/dist/{chunk-47Z4LEIW.js.map → chunk-V2DDN4MV.js.map} +1 -1
- package/dist/{chunk-YS76JSGP.cjs → chunk-V5WRO3P6.cjs} +10 -10
- package/dist/{chunk-YS76JSGP.cjs.map → chunk-V5WRO3P6.cjs.map} +1 -1
- package/dist/{chunk-QTMK34TP.js → chunk-VMVFRTF4.js} +3 -3
- package/dist/chunk-VMVFRTF4.js.map +1 -0
- package/dist/contracts/handlers/index.cjs +9 -9
- package/dist/contracts/handlers/index.d.cts +2 -2
- package/dist/contracts/handlers/index.d.ts +2 -2
- package/dist/contracts/handlers/index.js +2 -2
- package/dist/{index-C66rjxz2.d.ts → index-18cDMayF.d.ts} +1 -1
- package/dist/{index-2wKMrT0a.d.ts → index-B_kcptF8.d.ts} +1 -1
- package/dist/{index-46g577Ka.d.cts → index-Ccfhdfvj.d.cts} +1 -1
- package/dist/{index-Dqk07NwJ.d.cts → index-DDJFHfba.d.cts} +1 -1
- package/dist/index.cjs +335 -311
- package/dist/index.d.cts +72 -121
- package/dist/index.d.ts +72 -121
- package/dist/index.js +4 -4
- package/dist/{keyringDescriptorProvider-DiBM4GmB.d.ts → keyringDescriptorProvider-DL-jAiRO.d.ts} +150 -2
- package/dist/{keyringDescriptorProvider-DnaLUC7v.d.cts → keyringDescriptorProvider-Dtv0JWrT.d.cts} +150 -2
- package/dist/repositories/realm/index.cjs +37 -37
- package/dist/repositories/realm/index.d.cts +2 -2
- package/dist/repositories/realm/index.d.ts +2 -2
- package/dist/repositories/realm/index.js +5 -5
- package/dist/repositories/sqlite/index.cjs +35 -35
- package/dist/repositories/sqlite/index.d.cts +2 -2
- package/dist/repositories/sqlite/index.d.ts +2 -2
- package/dist/repositories/sqlite/index.js +5 -5
- package/dist/{taskRunner-BM6IAKlS.d.ts → taskRunner-DUafWu0o.d.ts} +2 -2
- package/dist/{taskRunner-BmDIZiSl.d.cts → taskRunner-JYHaLPne.d.cts} +2 -2
- package/dist/wallet/expo/background.cjs +14 -14
- package/dist/wallet/expo/background.d.cts +3 -3
- package/dist/wallet/expo/background.d.ts +3 -3
- package/dist/wallet/expo/background.js +6 -6
- package/dist/wallet/expo/index.cjs +15 -15
- package/dist/wallet/expo/index.d.cts +3 -3
- package/dist/wallet/expo/index.d.ts +3 -3
- package/dist/wallet/expo/index.js +5 -5
- 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 +2 -2
- package/dist/chunk-LZAINCGU.cjs.map +0 -1
- package/dist/chunk-QTMK34TP.js.map +0 -1
- package/dist/chunk-Y3CDDPWI.cjs.map +0 -1
- package/dist/chunk-YKT4NAQG.js.map +0 -1
package/dist/{keyringDescriptorProvider-DnaLUC7v.d.cts → keyringDescriptorProvider-Dtv0JWrT.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-DDJFHfba.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;
|
|
@@ -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
|
/**
|
|
@@ -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,
|
|
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,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkURGVQ5TQ_cjs = require('../../chunk-URGVQ5TQ.cjs');
|
|
4
4
|
require('../../chunk-X6ZI53DZ.cjs');
|
|
5
|
-
require('../../chunk-
|
|
6
|
-
require('../../chunk-
|
|
5
|
+
require('../../chunk-3NALVGMJ.cjs');
|
|
6
|
+
require('../../chunk-MQUATTIM.cjs');
|
|
7
7
|
require('../../chunk-JFJNB7ZH.cjs');
|
|
8
|
-
var
|
|
8
|
+
var chunkOMPDPBT5_cjs = require('../../chunk-OMPDPBT5.cjs');
|
|
9
9
|
require('../../chunk-FLPWNMX3.cjs');
|
|
10
10
|
|
|
11
11
|
// src/repositories/realm/walletRepository.ts
|
|
@@ -42,7 +42,7 @@ var RealmWalletRepository = class {
|
|
|
42
42
|
await this.ensureInit();
|
|
43
43
|
this.realm.write(() => {
|
|
44
44
|
for (const vtxo of vtxos) {
|
|
45
|
-
const s =
|
|
45
|
+
const s = chunkURGVQ5TQ_cjs.serializeVtxo(vtxo);
|
|
46
46
|
this.realm.create(
|
|
47
47
|
"ArkVtxo",
|
|
48
48
|
{
|
|
@@ -57,7 +57,7 @@ var RealmWalletRepository = class {
|
|
|
57
57
|
intentCb: s.intentTapLeafScript.cb,
|
|
58
58
|
intentS: s.intentTapLeafScript.s,
|
|
59
59
|
statusJson: JSON.stringify(s.status),
|
|
60
|
-
createdAt:
|
|
60
|
+
createdAt: chunkURGVQ5TQ_cjs.createdAtToIso(s.createdAt),
|
|
61
61
|
isUnrolled: s.isUnrolled ?? false,
|
|
62
62
|
isSpent: s.isSpent === void 0 ? null : s.isSpent,
|
|
63
63
|
isSwept: s.isSwept === void 0 ? null : s.isSwept,
|
|
@@ -81,7 +81,7 @@ var RealmWalletRepository = class {
|
|
|
81
81
|
return this.deleteWhere("ArkVtxo", "address", address);
|
|
82
82
|
}
|
|
83
83
|
async getVtxosForScriptPage(script, page, options) {
|
|
84
|
-
|
|
84
|
+
chunkURGVQ5TQ_cjs.assertPageRequest(page);
|
|
85
85
|
await this.ensureInit();
|
|
86
86
|
let results = this.realm.objects("ArkVtxo").filtered("script == $0", script);
|
|
87
87
|
if (options?.unspentOnly) {
|
|
@@ -108,15 +108,15 @@ var RealmWalletRepository = class {
|
|
|
108
108
|
rows.push({ address: row.address, vtxo: vtxoObjectToDomain(row) });
|
|
109
109
|
if (rows.length > page.limit) break;
|
|
110
110
|
}
|
|
111
|
-
const result =
|
|
111
|
+
const result = chunkURGVQ5TQ_cjs.pageResult(rows, page.limit, (row) => ({
|
|
112
112
|
address: row.address,
|
|
113
113
|
txid: row.vtxo.txid,
|
|
114
114
|
vout: row.vtxo.vout
|
|
115
115
|
}));
|
|
116
|
-
return options?.unspentOnly ? { ...result, items: result.items.filter((row) => !
|
|
116
|
+
return options?.unspentOnly ? { ...result, items: result.items.filter((row) => !chunkOMPDPBT5_cjs.isVtxoSpent(row.vtxo)) } : result;
|
|
117
117
|
}
|
|
118
118
|
async saveVtxosForScript(key, vtxos) {
|
|
119
|
-
return this.saveVtxos(
|
|
119
|
+
return this.saveVtxos(chunkURGVQ5TQ_cjs.checkSaveVtxosForScript("RealmWalletRepository", key, vtxos), vtxos);
|
|
120
120
|
}
|
|
121
121
|
async deleteVtxosForScript(script) {
|
|
122
122
|
return this.deleteWhere("ArkVtxo", "script", script);
|
|
@@ -126,7 +126,7 @@ var RealmWalletRepository = class {
|
|
|
126
126
|
return this.pageByAddress("ArkUtxo", address, page, utxoObjectToDomain);
|
|
127
127
|
}
|
|
128
128
|
async pageByAddress(schema, address, page, deserialize) {
|
|
129
|
-
|
|
129
|
+
chunkURGVQ5TQ_cjs.assertPageRequest(page);
|
|
130
130
|
await this.ensureInit();
|
|
131
131
|
let results = this.realm.objects(schema).filtered("address == $0", address);
|
|
132
132
|
if (page.after) {
|
|
@@ -144,18 +144,18 @@ var RealmWalletRepository = class {
|
|
|
144
144
|
rows.push({ key: { txid: row.txid, vout: row.vout }, item: deserialize(row) });
|
|
145
145
|
if (rows.length > page.limit) break;
|
|
146
146
|
}
|
|
147
|
-
const result =
|
|
147
|
+
const result = chunkURGVQ5TQ_cjs.pageResult(rows, page.limit, (row) => row.key);
|
|
148
148
|
return { items: result.items.map((row) => row.item), nextCursor: result.nextCursor };
|
|
149
149
|
}
|
|
150
150
|
async saveUtxos(addressOrBatch, utxos) {
|
|
151
151
|
await this.ensureInit();
|
|
152
|
-
const rows =
|
|
152
|
+
const rows = chunkURGVQ5TQ_cjs.utxoEntries(addressOrBatch, utxos).flatMap(
|
|
153
153
|
([address, list]) => list.map((utxo) => ({ address, utxo }))
|
|
154
154
|
);
|
|
155
155
|
if (rows.length === 0) return;
|
|
156
156
|
this.realm.write(() => {
|
|
157
157
|
for (const { address, utxo } of rows) {
|
|
158
|
-
const s =
|
|
158
|
+
const s = chunkURGVQ5TQ_cjs.serializeUtxo(utxo);
|
|
159
159
|
this.realm.create(
|
|
160
160
|
"ArkUtxo",
|
|
161
161
|
{
|
|
@@ -182,8 +182,8 @@ var RealmWalletRepository = class {
|
|
|
182
182
|
}
|
|
183
183
|
// ── Transaction history ────────────────────────────────────────────
|
|
184
184
|
async getTransactionHistoryPage(filter, page) {
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
chunkURGVQ5TQ_cjs.assertPageRequest(page);
|
|
186
|
+
chunkURGVQ5TQ_cjs.assertHistoryPageFilter(filter);
|
|
187
187
|
let results = this.realm.objects("ArkTransaction").filtered("address == $0", filter.address);
|
|
188
188
|
results = results.filtered(
|
|
189
189
|
"createdAt >= $0",
|
|
@@ -197,12 +197,12 @@ var RealmWalletRepository = class {
|
|
|
197
197
|
["arkTxid", false]
|
|
198
198
|
])) {
|
|
199
199
|
const tx = txObjectToDomain(row);
|
|
200
|
-
if (page.after !== void 0 &&
|
|
200
|
+
if (page.after !== void 0 && chunkURGVQ5TQ_cjs.compareHistoryCursors({ createdAt: tx.createdAt, key: tx.key }, page.after) <= 0)
|
|
201
201
|
continue;
|
|
202
202
|
rows.push(tx);
|
|
203
203
|
if (rows.length > page.limit) break;
|
|
204
204
|
}
|
|
205
|
-
return
|
|
205
|
+
return chunkURGVQ5TQ_cjs.pageResult(rows, page.limit, (tx) => ({ createdAt: tx.createdAt, key: tx.key }));
|
|
206
206
|
}
|
|
207
207
|
async saveTransactions(address, txs) {
|
|
208
208
|
await this.ensureInit();
|
|
@@ -220,7 +220,7 @@ var RealmWalletRepository = class {
|
|
|
220
220
|
amount: tx.amount,
|
|
221
221
|
settled: tx.settled,
|
|
222
222
|
createdAt: tx.createdAt,
|
|
223
|
-
assetsJson: tx.assets ? JSON.stringify(
|
|
223
|
+
assetsJson: tx.assets ? JSON.stringify(chunkURGVQ5TQ_cjs.serializeAssets(tx.assets)) : null
|
|
224
224
|
},
|
|
225
225
|
"modified"
|
|
226
226
|
);
|
|
@@ -250,7 +250,7 @@ var RealmWalletRepository = class {
|
|
|
250
250
|
settings: row.settingsJson ? JSON.parse(row.settingsJson) : void 0,
|
|
251
251
|
lastSyncTime: row.lastSyncTime ?? void 0
|
|
252
252
|
} : {};
|
|
253
|
-
const state =
|
|
253
|
+
const state = chunkURGVQ5TQ_cjs.applyWalletStateUpdate(current, updater);
|
|
254
254
|
this.realm.create(
|
|
255
255
|
"ArkWalletState",
|
|
256
256
|
{
|
|
@@ -322,9 +322,9 @@ function vtxoObjectToDomain(obj) {
|
|
|
322
322
|
// Post-migration every row has `script`, but the backfill is
|
|
323
323
|
// idempotent: derive from `address` if the legacy column is still
|
|
324
324
|
// null (e.g. the migration hasn't run yet on this handle).
|
|
325
|
-
script: obj.script ??
|
|
325
|
+
script: obj.script ?? chunkURGVQ5TQ_cjs.scriptFromArkAddress(obj.address)
|
|
326
326
|
};
|
|
327
|
-
return
|
|
327
|
+
return chunkURGVQ5TQ_cjs.deserializeVtxo(serialized);
|
|
328
328
|
}
|
|
329
329
|
function utxoObjectToDomain(obj) {
|
|
330
330
|
const serialized = {
|
|
@@ -343,7 +343,7 @@ function utxoObjectToDomain(obj) {
|
|
|
343
343
|
status: JSON.parse(obj.statusJson),
|
|
344
344
|
extraWitness: obj.extraWitnessJson ? JSON.parse(obj.extraWitnessJson) : void 0
|
|
345
345
|
};
|
|
346
|
-
return
|
|
346
|
+
return chunkURGVQ5TQ_cjs.deserializeUtxo(serialized);
|
|
347
347
|
}
|
|
348
348
|
function txObjectToDomain(obj) {
|
|
349
349
|
const tx = {
|
|
@@ -358,7 +358,7 @@ function txObjectToDomain(obj) {
|
|
|
358
358
|
createdAt: obj.createdAt
|
|
359
359
|
};
|
|
360
360
|
if (obj.assetsJson) {
|
|
361
|
-
tx.assets =
|
|
361
|
+
tx.assets = chunkURGVQ5TQ_cjs.deserializeAssets(JSON.parse(obj.assetsJson));
|
|
362
362
|
}
|
|
363
363
|
return tx;
|
|
364
364
|
}
|
|
@@ -384,9 +384,9 @@ var RealmContractRepository = class {
|
|
|
384
384
|
}
|
|
385
385
|
// ── Contract management ────────────────────────────────────────────
|
|
386
386
|
async getContractsPage(filter, page) {
|
|
387
|
-
|
|
388
|
-
if (
|
|
389
|
-
const toPage = (rows) =>
|
|
387
|
+
chunkURGVQ5TQ_cjs.assertPageRequest(page);
|
|
388
|
+
if (chunkURGVQ5TQ_cjs.contractFilterMatchesNothing(filter)) return { items: [] };
|
|
389
|
+
const toPage = (rows) => chunkURGVQ5TQ_cjs.pageResult(rows.map(contractObjectToDomain), page.limit, (contract) => contract.script);
|
|
390
390
|
if (filter?.watch === void 0 || filter.script !== void 0) {
|
|
391
391
|
return toPage(this.readRows(filter, page));
|
|
392
392
|
}
|
|
@@ -420,7 +420,7 @@ var RealmContractRepository = class {
|
|
|
420
420
|
if (query) results = results.filtered(query, ...args);
|
|
421
421
|
const rows = [];
|
|
422
422
|
for (const row of results.sorted("script")) {
|
|
423
|
-
if (filter?.scope !== void 0 && ![filter.scope].flat().includes(
|
|
423
|
+
if (filter?.scope !== void 0 && ![filter.scope].flat().includes(chunkURGVQ5TQ_cjs.scopeOf(contractObjectToDomain(row))))
|
|
424
424
|
continue;
|
|
425
425
|
rows.push(row);
|
|
426
426
|
if (rows.length > page.limit) break;
|
|
@@ -550,7 +550,7 @@ var RealmBatchRegistrationRepository = class {
|
|
|
550
550
|
const clashes = [
|
|
551
551
|
...this.realm.objects("ArkIntent").filtered("intentId == $0", intent.registrationId)
|
|
552
552
|
].map(toIntent);
|
|
553
|
-
|
|
553
|
+
chunkURGVQ5TQ_cjs.assertIntentIdUnique(intent, clashes);
|
|
554
554
|
}
|
|
555
555
|
this.realm.create(
|
|
556
556
|
"ArkIntent",
|
|
@@ -578,22 +578,22 @@ var RealmBatchRegistrationRepository = class {
|
|
|
578
578
|
});
|
|
579
579
|
}
|
|
580
580
|
async getBatchRegistrationsPage(filter, page) {
|
|
581
|
-
|
|
581
|
+
chunkURGVQ5TQ_cjs.assertPageRequest(page);
|
|
582
582
|
let results = this.realm.objects("ArkIntent");
|
|
583
583
|
if (page.after !== void 0) results = results.filtered("intentTxId > $0", page.after);
|
|
584
584
|
const rows = [];
|
|
585
585
|
for (const row of results.sorted("intentTxId")) {
|
|
586
586
|
const intent = toIntent(row);
|
|
587
|
-
if (filter && !
|
|
587
|
+
if (filter && !chunkURGVQ5TQ_cjs.intentMatchesFilter(intent, filter)) continue;
|
|
588
588
|
rows.push(intent);
|
|
589
589
|
if (rows.length > page.limit) break;
|
|
590
590
|
}
|
|
591
|
-
return
|
|
591
|
+
return chunkURGVQ5TQ_cjs.pageResult(rows, page.limit, (intent) => intent.proofTxId);
|
|
592
592
|
}
|
|
593
593
|
async getLockedVtxoOutpoints() {
|
|
594
594
|
const out = [];
|
|
595
595
|
for (const o of [...this.realm.objects("ArkIntent")].map(toIntent))
|
|
596
|
-
if (!
|
|
596
|
+
if (!chunkURGVQ5TQ_cjs.isTerminalBatchRegistrationState(o.state)) out.push(...o.proofInputs);
|
|
597
597
|
return out;
|
|
598
598
|
}
|
|
599
599
|
/** @deprecated Use {@link saveBatchRegistration}. */
|
|
@@ -644,7 +644,7 @@ var RealmVirtualTxRepository = class {
|
|
|
644
644
|
txid: t.txid,
|
|
645
645
|
psbt: t.psbt ?? prev?.psbt ?? null,
|
|
646
646
|
expiresAt: t.expiresAt ?? prev?.expiresAt ?? null,
|
|
647
|
-
type:
|
|
647
|
+
type: chunkURGVQ5TQ_cjs.mergeChainedTxType(t.type, prev?.type)
|
|
648
648
|
},
|
|
649
649
|
"modified"
|
|
650
650
|
);
|
|
@@ -890,9 +890,9 @@ function runArkRealmMigrations(oldRealm, newRealm) {
|
|
|
890
890
|
for (let i = 0; i < newVtxos.length; i++) {
|
|
891
891
|
const newVtxo = newVtxos[i];
|
|
892
892
|
if (!newVtxo.script) {
|
|
893
|
-
newVtxo.script =
|
|
893
|
+
newVtxo.script = chunkURGVQ5TQ_cjs.scriptFromArkAddress(newVtxo.address);
|
|
894
894
|
}
|
|
895
|
-
const facts =
|
|
895
|
+
const facts = chunkURGVQ5TQ_cjs.legacyVtxoFacts(legacyByPk.get(newVtxo.pk));
|
|
896
896
|
if (facts) {
|
|
897
897
|
if (newVtxo.isSpent == null) newVtxo.isSpent = facts.isSpent;
|
|
898
898
|
if (newVtxo.isSwept == null) newVtxo.isSwept = facts.isSwept;
|
|
@@ -922,7 +922,7 @@ function runArkRealmMigrations(oldRealm, newRealm) {
|
|
|
922
922
|
|
|
923
923
|
Object.defineProperty(exports, "ChainedTxType", {
|
|
924
924
|
enumerable: true,
|
|
925
|
-
get: function () { return
|
|
925
|
+
get: function () { return chunkURGVQ5TQ_cjs.ChainedTxType; }
|
|
926
926
|
});
|
|
927
927
|
exports.ARK_REALM_SCHEMA_VERSION = ARK_REALM_SCHEMA_VERSION;
|
|
928
928
|
exports.ArkExperimentalRealmSchemas = ArkExperimentalRealmSchemas;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { W as WalletRepository, P as PageRequest, B as Outpoint, D as PageResult, z as ExtendedVirtualCoin, F as ScriptVtxoCursor, H as ScriptVtxoPageOptions, J as StoredVtxo, K as VtxoRepositoryKey, E as ExtendedCoin, L as TransactionHistoryPageFilter, M as TransactionHistoryPageCursor, g as ArkTransaction, Q as AtomicWalletState, U as WalletState, C as ContractRepository, X as ContractFilter, y as Contract, Y as BatchRegistrationRepository, Z as BatchRegistration, _ as BatchRegistrationPageFilter, $ as VirtualTxRepository, a0 as VirtualTx, a1 as VtxoBranch } from '../../index-
|
|
2
|
-
export { a2 as ChainedTxType } from '../../index-
|
|
1
|
+
import { W as WalletRepository, P as PageRequest, B as Outpoint, D as PageResult, z as ExtendedVirtualCoin, F as ScriptVtxoCursor, H as ScriptVtxoPageOptions, J as StoredVtxo, K as VtxoRepositoryKey, E as ExtendedCoin, L as TransactionHistoryPageFilter, M as TransactionHistoryPageCursor, g as ArkTransaction, Q as AtomicWalletState, U as WalletState, C as ContractRepository, X as ContractFilter, y as Contract, Y as BatchRegistrationRepository, Z as BatchRegistration, _ as BatchRegistrationPageFilter, $ as VirtualTxRepository, a0 as VirtualTx, a1 as VtxoBranch } from '../../index-DDJFHfba.cjs';
|
|
2
|
+
export { a2 as ChainedTxType } from '../../index-DDJFHfba.cjs';
|
|
3
3
|
import '@scure/btc-signer/utils.js';
|
|
4
4
|
import '@scure/btc-signer';
|
|
5
5
|
import '@scure/btc-signer/psbt.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { W as WalletRepository, P as PageRequest, B as Outpoint, D as PageResult, z as ExtendedVirtualCoin, F as ScriptVtxoCursor, H as ScriptVtxoPageOptions, J as StoredVtxo, K as VtxoRepositoryKey, E as ExtendedCoin, L as TransactionHistoryPageFilter, M as TransactionHistoryPageCursor, g as ArkTransaction, Q as AtomicWalletState, U as WalletState, C as ContractRepository, X as ContractFilter, y as Contract, Y as BatchRegistrationRepository, Z as BatchRegistration, _ as BatchRegistrationPageFilter, $ as VirtualTxRepository, a0 as VirtualTx, a1 as VtxoBranch } from '../../index-
|
|
2
|
-
export { a2 as ChainedTxType } from '../../index-
|
|
1
|
+
import { W as WalletRepository, P as PageRequest, B as Outpoint, D as PageResult, z as ExtendedVirtualCoin, F as ScriptVtxoCursor, H as ScriptVtxoPageOptions, J as StoredVtxo, K as VtxoRepositoryKey, E as ExtendedCoin, L as TransactionHistoryPageFilter, M as TransactionHistoryPageCursor, g as ArkTransaction, Q as AtomicWalletState, U as WalletState, C as ContractRepository, X as ContractFilter, y as Contract, Y as BatchRegistrationRepository, Z as BatchRegistration, _ as BatchRegistrationPageFilter, $ as VirtualTxRepository, a0 as VirtualTx, a1 as VtxoBranch } from '../../index-18cDMayF.js';
|
|
2
|
+
export { a2 as ChainedTxType } from '../../index-18cDMayF.js';
|
|
3
3
|
import '@scure/btc-signer/utils.js';
|
|
4
4
|
import '@scure/btc-signer';
|
|
5
5
|
import '@scure/btc-signer/psbt.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { serializeVtxo, createdAtToIso, assertPageRequest, pageResult, checkSaveVtxosForScript, utxoEntries, serializeUtxo, assertHistoryPageFilter, compareHistoryCursors, serializeAssets, applyWalletStateUpdate, scriptFromArkAddress, deserializeVtxo, deserializeUtxo, deserializeAssets, contractFilterMatchesNothing, scopeOf, assertIntentIdUnique, intentMatchesFilter, isTerminalBatchRegistrationState, mergeChainedTxType, legacyVtxoFacts } from '../../chunk-
|
|
2
|
-
export { ChainedTxType } from '../../chunk-
|
|
1
|
+
import { serializeVtxo, createdAtToIso, assertPageRequest, pageResult, checkSaveVtxosForScript, utxoEntries, serializeUtxo, assertHistoryPageFilter, compareHistoryCursors, serializeAssets, applyWalletStateUpdate, scriptFromArkAddress, deserializeVtxo, deserializeUtxo, deserializeAssets, contractFilterMatchesNothing, scopeOf, assertIntentIdUnique, intentMatchesFilter, isTerminalBatchRegistrationState, mergeChainedTxType, legacyVtxoFacts } from '../../chunk-RLD7DRSZ.js';
|
|
2
|
+
export { ChainedTxType } from '../../chunk-RLD7DRSZ.js';
|
|
3
3
|
import '../../chunk-V3ZLL5VY.js';
|
|
4
|
-
import '../../chunk-
|
|
5
|
-
import '../../chunk-
|
|
4
|
+
import '../../chunk-MWMO2ZQP.js';
|
|
5
|
+
import '../../chunk-V2DDN4MV.js';
|
|
6
6
|
import '../../chunk-DNFTHG73.js';
|
|
7
|
-
import { isVtxoSpent } from '../../chunk-
|
|
7
|
+
import { isVtxoSpent } from '../../chunk-VMVFRTF4.js';
|
|
8
8
|
import '../../chunk-FDJ734CH.js';
|
|
9
9
|
|
|
10
10
|
// src/repositories/realm/walletRepository.ts
|