@arkade-os/sdk 0.4.34 → 0.4.35
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 +4 -4
- package/dist/adapters/expo.d.cts +2 -2
- package/dist/adapters/expo.d.ts +2 -2
- package/dist/adapters/expo.js +2 -2
- package/dist/adapters/indexedDB.cjs +3 -3
- package/dist/adapters/indexedDB.js +2 -2
- package/dist/{ark-Dsv5Jq4E.d.cts → ark-D6sau_6-.d.cts} +458 -3
- package/dist/{ark-Dsv5Jq4E.d.ts → ark-D6sau_6-.d.ts} +458 -3
- package/dist/{asyncStorageTaskQueue-D92ch8yI.d.cts → asyncStorageTaskQueue-CpC027t_.d.cts} +2 -2
- package/dist/{asyncStorageTaskQueue-BH-zuth5.d.ts → asyncStorageTaskQueue-GT8fmPUG.d.ts} +2 -2
- package/dist/{chunk-FXFBPXV3.js → chunk-3JR77WQ4.js} +139 -41
- package/dist/chunk-3JR77WQ4.js.map +1 -0
- package/dist/{chunk-ZS3OZHC7.cjs → chunk-FM7T7JVL.cjs} +7 -7
- package/dist/{chunk-ZS3OZHC7.cjs.map → chunk-FM7T7JVL.cjs.map} +1 -1
- package/dist/{chunk-XCHBQVMK.cjs → chunk-H2LX2KKY.cjs} +1540 -265
- package/dist/chunk-H2LX2KKY.cjs.map +1 -0
- package/dist/{chunk-HFXEUW55.js → chunk-NOR7XOKN.js} +1472 -202
- package/dist/chunk-NOR7XOKN.js.map +1 -0
- package/dist/{chunk-VVGD3JIP.js → chunk-OURFR4UR.js} +3 -3
- package/dist/{chunk-VVGD3JIP.js.map → chunk-OURFR4UR.js.map} +1 -1
- package/dist/{chunk-CCLNFHJ5.cjs → chunk-VYS3KGRI.cjs} +16 -10
- package/dist/chunk-VYS3KGRI.cjs.map +1 -0
- package/dist/{chunk-FSAXPBGP.cjs → chunk-X2EQLK4O.cjs} +143 -40
- package/dist/chunk-X2EQLK4O.cjs.map +1 -0
- package/dist/{chunk-5WDBHWX3.js → chunk-XQS2HW4Q.js} +10 -4
- package/dist/chunk-XQS2HW4Q.js.map +1 -0
- package/dist/contracts/handlers/index.d.cts +3 -3
- package/dist/contracts/handlers/index.d.ts +3 -3
- package/dist/{delegate-BaS5SCIW.d.cts → delegate-C-L6gSZx.d.cts} +1 -1
- package/dist/{delegate-Baz_hb83.d.ts → delegate-De5__fpZ.d.ts} +1 -1
- package/dist/{index-FwXZveaX.d.ts → index-BETdjE_o.d.ts} +2 -2
- package/dist/{index-lNZ6qaO3.d.cts → index-jwQfHP6D.d.cts} +2 -2
- package/dist/index.cjs +129 -105
- package/dist/index.d.cts +69 -9
- package/dist/index.d.ts +69 -9
- package/dist/index.js +2 -2
- package/dist/repositories/realm/index.cjs +12 -12
- package/dist/repositories/realm/index.cjs.map +1 -1
- package/dist/repositories/realm/index.d.cts +2 -2
- package/dist/repositories/realm/index.d.ts +2 -2
- package/dist/repositories/realm/index.js +3 -3
- package/dist/repositories/realm/index.js.map +1 -1
- package/dist/repositories/sqlite/index.cjs +11 -11
- package/dist/repositories/sqlite/index.d.cts +1 -1
- package/dist/repositories/sqlite/index.d.ts +1 -1
- package/dist/repositories/sqlite/index.js +2 -2
- package/dist/{taskRunner-vFRA3F9b.d.cts → taskRunner-DCyp6Gea.d.cts} +2 -2
- package/dist/{taskRunner-B1NUWyWR.d.ts → taskRunner-DnxtObeq.d.ts} +2 -2
- package/dist/wallet/expo/background.cjs +12 -12
- package/dist/wallet/expo/background.d.cts +3 -3
- package/dist/wallet/expo/background.d.ts +3 -3
- package/dist/wallet/expo/background.js +4 -4
- package/dist/wallet/expo/index.cjs +11 -11
- package/dist/wallet/expo/index.d.cts +4 -4
- package/dist/wallet/expo/index.d.ts +4 -4
- package/dist/wallet/expo/index.js +3 -3
- package/dist/{wallet-D6uoBLmS.d.ts → wallet-BWHbd5b1.d.cts} +231 -8
- package/dist/{wallet-By9HIo0Q.d.cts → wallet-Bth5uucA.d.ts} +231 -8
- package/dist/worker/expo/index.cjs +7 -7
- package/dist/worker/expo/index.d.cts +4 -4
- package/dist/worker/expo/index.d.ts +4 -4
- package/dist/worker/expo/index.js +3 -3
- package/package.json +2 -2
- package/dist/chunk-5WDBHWX3.js.map +0 -1
- package/dist/chunk-CCLNFHJ5.cjs.map +0 -1
- package/dist/chunk-FSAXPBGP.cjs.map +0 -1
- package/dist/chunk-FXFBPXV3.js.map +0 -1
- package/dist/chunk-HFXEUW55.js.map +0 -1
- package/dist/chunk-XCHBQVMK.cjs.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
export { B as BoardingContractHandler, a as BoardingContractParams, D as DefaultContractHandler, b as DefaultContractParams, c as DelegateContractHandler, d as DelegateContractParams, V as VHTLC, e as VHTLCContractHandler, f as VHTLCContractParams, g as contractHandlers } from './index-
|
|
4
|
-
export { D as DefaultVtxo, a as DelegateVtxo } from './delegate-
|
|
5
|
-
import { W as Wallet, R as ReadonlyWallet, a as ReceiveRotatorFactory, b as ReceiveRotatorBootOpts, c as ReceiveRotatorBoot } from './wallet-
|
|
6
|
-
export { B as Batch, I as IncomingFunds, w as waitForIncomingFunds } from './wallet-
|
|
1
|
+
import { L as ReadonlyIdentity, a as Identity, a5 as DescriptorSigningRequest, a6 as Transaction, a2 as SignerSession, W as WalletRepository, E as ExtendedVirtualCoin, s as VtxoRepositoryKey, d as ExtendedCoin, A as ArkTransaction, t as WalletState, r as Contract, C as ContractRepository, u as ContractFilter, a7 as IntentFeeConfig, a8 as OffchainInput, a9 as FeeAmount, aa as OnchainInput, ab as FeeOutput, m as ArkProvider, a0 as SettlementConfig, ac as ContractWatcherConfig, I as IWallet, ad as FeeInfo, h as SettlementEvent, J as DescriptorProvider, g as SettleParams, S as SendBitcoinParams, G as GetVtxosFilter, ae as CreateContractParams, af as GetContractsFilter, q as VirtualCoin, ag as GetSpendablePathsOptions, ah as GetAllSpendingPathsOptions, R as Recipient, ai as IssuanceParams, aj as ReissuanceParams, ak as BurnParams, al as RenewVtxosOptions, c as WalletBalance, am as ContractWithVtxos, an as PathSelection, ao as ContractEvent, ap as AssetDetails, aq as IssuanceResult, ar as DelegateInfo, as as MigrationGlobalSkipReason, at as MigrationLegSkipReason, au as SignerStatus, K as IReadonlyWallet, Q as IReadonlyAssetManager, av as StorageConfig, e as IContractManager, i as IAssetManager, f as IDelegateManager, aw as IVtxoManager, O as OnchainProvider, N as Network, U as NetworkName, Z as Coin, ax as ExplorerTransaction, p as TapLeafScript, ay as EncodedVtxoScript, $ as CSVMultisigTapscript, o as RelativeTimelock, V as VtxoScript, az as Status, aA as Outpoint, aB as ChainTx, n as IndexerProvider, w as TxTree, aC as PathContext } from './ark-D6sau_6-.cjs';
|
|
2
|
+
export { Y as ArkAddress, X as ArkInfo, aD as ArkTapscript, aE as Asset, aF as AssetMetadata, aG as BaseWalletConfig, D as BatchFailedEvent, y as BatchFinalizationEvent, z as BatchFinalizedEvent, aH as BatchInfo, aI as BatchSignableIdentity, B as BatchStartedEvent, aJ as CLTVMultisigTapscript, aK as ChainTxType, aL as CommitmentTx, aM as ConditionCSVMultisigTapscript, aN as ConditionMultisigTapscript, aO as ContractBalance, aP as ContractEventCallback, aQ as ContractHandler, _ as ContractManager, aR as ContractManagerConfig, aS as ContractState, aT as ContractVtxo, aU as ContractWatcher, aV as DelegateManagerImpl, aW as DelegateOptions, M as DelegateProvider, aX as DelegatorManagerImpl, aY as DelegatorProvider, aZ as DeprecatedSignerMigrationReport, a_ as DeprecatedSignerReport, a$ as DigestMismatchError, b0 as Discoverable, b1 as DiscoveredContract, b2 as DiscoveryDeps, b3 as ESPLORA_URL, b4 as EsploraProvider, b5 as ExtendedContractVtxo, b6 as HandlerError, b7 as IDelegatorManager, b8 as IndexerTxType, a4 as Intent, b9 as KnownMetadata, ba as MigrateDeprecatedSignerOptions, bb as MigrationLegReport, bc as MigrationVtxoRef, bd as MultisigTapscript, be as Nonces, bf as Output, bg as PageResponse, bh as PaginationOptions, bi as PartialSig, bj as ProviderClass, P as ReadonlyWalletConfig, j as RestArkProvider, bk as RestDelegateProvider, bl as RestDelegatorProvider, k as RestIndexerProvider, bm as ScanContractsOptions, bn as ScanResult, bo as ScheduledSession, bp as SettlementEventType, bq as SignRequest, a3 as SignedIntent, br as SignerClassification, bs as SignerSet, bt as SubscriptionEvent, bu as SubscriptionHeartbeat, l as SubscriptionResponse, bv as TapLeaves, bw as TapTreeCoder, bx as TapscriptType, by as TreeNonces, x as TreeNoncesEvent, bz as TreePartialSigs, H as TreeSignatureEvent, v as TreeSigningStartedEvent, F as TreeTxEvent, bA as Tx, bB as TxHistoryRecord, bC as TxKey, T as TxNotification, bD as TxTreeNode, bE as TxType, bF as VirtualStatus, bG as Vtxo, bH as VtxoChain, a1 as VtxoManager, bI as VtxoType, b as WalletConfig, bJ as WalletMode, bK as classifyAgainstSignerSet, bL as classifyContractSigner, bM as decodeTapscript, bN as getSequence, bO as isBatchSignable, bP as isCooperativelyMigratable, bQ as isDiscoverable, bR as isExpired, bS as isRecoverable, bT as isSpendable, bU as isSubdust, bV as isVtxoExpiringSoon, bW as networks, bX as signerSetFromInfo, bY as toXOnlySignerHex } from './ark-D6sau_6-.cjs';
|
|
3
|
+
export { B as BoardingContractHandler, a as BoardingContractParams, D as DefaultContractHandler, b as DefaultContractParams, c as DelegateContractHandler, d as DelegateContractParams, V as VHTLC, e as VHTLCContractHandler, f as VHTLCContractParams, g as contractHandlers } from './index-jwQfHP6D.cjs';
|
|
4
|
+
export { D as DefaultVtxo, a as DelegateVtxo } from './delegate-C-L6gSZx.cjs';
|
|
5
|
+
import { W as Wallet, R as ReadonlyWallet, a as ReceiveRotatorFactory, b as ReceiveRotatorBootOpts, c as ReceiveRotatorBoot } from './wallet-BWHbd5b1.cjs';
|
|
6
|
+
export { B as Batch, d as BoardingUtxoGroup, I as IncomingFunds, w as waitForIncomingFunds } from './wallet-BWHbd5b1.cjs';
|
|
7
7
|
import { Bytes, BTC_NETWORK } from '@scure/btc-signer/utils.js';
|
|
8
8
|
import { P2TR } from '@scure/btc-signer/payment.js';
|
|
9
9
|
import { Transaction as Transaction$1 } from '@scure/btc-signer';
|
|
@@ -1462,6 +1462,10 @@ type ResponseRenewVtxosEvent = ResponseEnvelope & {
|
|
|
1462
1462
|
type: "RENEW_VTXOS_EVENT";
|
|
1463
1463
|
payload: SettlementEvent;
|
|
1464
1464
|
};
|
|
1465
|
+
type ResponseMigrateDeprecatedSignerVtxosEvent = ResponseEnvelope & {
|
|
1466
|
+
type: "MIGRATE_DEPRECATED_SIGNER_VTXOS_EVENT";
|
|
1467
|
+
payload: SettlementEvent;
|
|
1468
|
+
};
|
|
1465
1469
|
type ResponseUtxoUpdate = ResponseEnvelope & {
|
|
1466
1470
|
broadcast: true;
|
|
1467
1471
|
type: "UTXO_UPDATE";
|
|
@@ -1642,6 +1646,62 @@ type ResponseSweepExpiredBoardingUtxos = ResponseEnvelope & {
|
|
|
1642
1646
|
txid: string;
|
|
1643
1647
|
};
|
|
1644
1648
|
};
|
|
1649
|
+
type WireMigrationVtxoRef = {
|
|
1650
|
+
txid: string;
|
|
1651
|
+
vout: number;
|
|
1652
|
+
value: number;
|
|
1653
|
+
signerPubKey: string;
|
|
1654
|
+
cutoffDate?: string;
|
|
1655
|
+
};
|
|
1656
|
+
type WireDeprecatedSignerReport = {
|
|
1657
|
+
signerPubKey: string;
|
|
1658
|
+
status: SignerStatus;
|
|
1659
|
+
cutoffDate?: string;
|
|
1660
|
+
secondsUntilCutoff?: number;
|
|
1661
|
+
vtxoCount: number;
|
|
1662
|
+
totalValue: number;
|
|
1663
|
+
boardingCount: number;
|
|
1664
|
+
boardingValue: number;
|
|
1665
|
+
recoverableCount: number;
|
|
1666
|
+
recoverableValue: number;
|
|
1667
|
+
awaitingSweepCount: number;
|
|
1668
|
+
awaitingSweepValue: number;
|
|
1669
|
+
nextSweepEta?: number;
|
|
1670
|
+
};
|
|
1671
|
+
type WireMigrationLegReport = {
|
|
1672
|
+
txid?: string;
|
|
1673
|
+
migrated: WireMigrationVtxoRef[];
|
|
1674
|
+
skipped?: MigrationLegSkipReason;
|
|
1675
|
+
deferred?: number;
|
|
1676
|
+
oversized?: WireMigrationVtxoRef[];
|
|
1677
|
+
error?: string;
|
|
1678
|
+
};
|
|
1679
|
+
type WireDeprecatedSignerMigrationReport = {
|
|
1680
|
+
rotated: boolean;
|
|
1681
|
+
skipped?: MigrationGlobalSkipReason;
|
|
1682
|
+
vtxos?: WireMigrationLegReport;
|
|
1683
|
+
boarding?: WireMigrationLegReport;
|
|
1684
|
+
expired: WireMigrationVtxoRef[];
|
|
1685
|
+
signers: WireDeprecatedSignerReport[];
|
|
1686
|
+
};
|
|
1687
|
+
type RequestMigrateDeprecatedSignerVtxos = RequestEnvelope & {
|
|
1688
|
+
type: "MIGRATE_DEPRECATED_SIGNER_VTXOS";
|
|
1689
|
+
};
|
|
1690
|
+
type ResponseMigrateDeprecatedSignerVtxos = ResponseEnvelope & {
|
|
1691
|
+
type: "MIGRATE_DEPRECATED_SIGNER_VTXOS_SUCCESS";
|
|
1692
|
+
payload: {
|
|
1693
|
+
report: WireDeprecatedSignerMigrationReport;
|
|
1694
|
+
};
|
|
1695
|
+
};
|
|
1696
|
+
type RequestGetDeprecatedSignerStatus = RequestEnvelope & {
|
|
1697
|
+
type: "GET_DEPRECATED_SIGNER_STATUS";
|
|
1698
|
+
};
|
|
1699
|
+
type ResponseGetDeprecatedSignerStatus = ResponseEnvelope & {
|
|
1700
|
+
type: "DEPRECATED_SIGNER_STATUS";
|
|
1701
|
+
payload: {
|
|
1702
|
+
signers: WireDeprecatedSignerReport[];
|
|
1703
|
+
};
|
|
1704
|
+
};
|
|
1645
1705
|
type RequestRestoreWallet = RequestEnvelope & {
|
|
1646
1706
|
type: "RESTORE_WALLET";
|
|
1647
1707
|
payload: {
|
|
@@ -1651,8 +1711,8 @@ type RequestRestoreWallet = RequestEnvelope & {
|
|
|
1651
1711
|
type ResponseRestoreWallet = ResponseEnvelope & {
|
|
1652
1712
|
type: "RESTORE_WALLET_SUCCESS";
|
|
1653
1713
|
};
|
|
1654
|
-
type WalletUpdaterRequest = RequestInitWallet | RequestSettle | RequestSendBitcoin | RequestGetAddress | RequestGetBoardingAddress | RequestGetBalance | RequestGetVtxos | RequestGetBoardingUtxos | RequestGetTransactionHistory | RequestGetStatus | RequestClear | RequestReloadWallet | RequestSignTransaction | RequestCreateContract | RequestGetContracts | RequestGetContractsWithVtxos | RequestAnnotateVtxos | RequestUpdateContract | RequestDeleteContract | RequestGetSpendablePaths | RequestGetAllSpendingPaths | RequestIsContractManagerWatching | RequestRefreshVtxos | RequestRefreshOutpoints | RequestSend | RequestGetAssetDetails | RequestIssue | RequestReissue | RequestBurn | RequestDelegate | RequestGetDelegateInfo | RequestRecoverVtxos | RequestGetRecoverableBalance | RequestGetExpiringVtxos | RequestRenewVtxos | RequestGetExpiredBoardingUtxos | RequestSweepExpiredBoardingUtxos | RequestRestoreWallet;
|
|
1655
|
-
type WalletUpdaterResponse = ResponseEnvelope & (ResponseInitWallet | ResponseSettle | ResponseSettleEvent | ResponseSendBitcoin | ResponseGetAddress | ResponseGetBoardingAddress | ResponseGetBalance | ResponseGetVtxos | ResponseGetBoardingUtxos | ResponseGetTransactionHistory | ResponseGetStatus | ResponseClear | ResponseReloadWallet | ResponseUtxoUpdate | ResponseVtxoUpdate | ResponseSignTransaction | ResponseCreateContract | ResponseGetContracts | ResponseGetContractsWithVtxos | ResponseAnnotateVtxos | ResponseUpdateContract | ResponseDeleteContract | ResponseGetSpendablePaths | ResponseGetAllSpendingPaths | ResponseIsContractManagerWatching | ResponseRefreshVtxos | ResponseRefreshOutpoints | ResponseContractEvent | ResponseSend | ResponseGetAssetDetails | ResponseIssue | ResponseReissue | ResponseBurn | ResponseDelegate | ResponseGetDelegateInfo | ResponseRecoverVtxos | ResponseRecoverVtxosEvent | ResponseGetRecoverableBalance | ResponseGetExpiringVtxos | ResponseRenewVtxos | ResponseRenewVtxosEvent | ResponseGetExpiredBoardingUtxos | ResponseSweepExpiredBoardingUtxos | ResponseRestoreWallet);
|
|
1714
|
+
type WalletUpdaterRequest = RequestInitWallet | RequestSettle | RequestSendBitcoin | RequestGetAddress | RequestGetBoardingAddress | RequestGetBalance | RequestGetVtxos | RequestGetBoardingUtxos | RequestGetTransactionHistory | RequestGetStatus | RequestClear | RequestReloadWallet | RequestSignTransaction | RequestCreateContract | RequestGetContracts | RequestGetContractsWithVtxos | RequestAnnotateVtxos | RequestUpdateContract | RequestDeleteContract | RequestGetSpendablePaths | RequestGetAllSpendingPaths | RequestIsContractManagerWatching | RequestRefreshVtxos | RequestRefreshOutpoints | RequestSend | RequestGetAssetDetails | RequestIssue | RequestReissue | RequestBurn | RequestDelegate | RequestGetDelegateInfo | RequestRecoverVtxos | RequestGetRecoverableBalance | RequestGetExpiringVtxos | RequestRenewVtxos | RequestGetExpiredBoardingUtxos | RequestSweepExpiredBoardingUtxos | RequestMigrateDeprecatedSignerVtxos | RequestGetDeprecatedSignerStatus | RequestRestoreWallet;
|
|
1715
|
+
type WalletUpdaterResponse = ResponseEnvelope & (ResponseInitWallet | ResponseSettle | ResponseSettleEvent | ResponseSendBitcoin | ResponseGetAddress | ResponseGetBoardingAddress | ResponseGetBalance | ResponseGetVtxos | ResponseGetBoardingUtxos | ResponseGetTransactionHistory | ResponseGetStatus | ResponseClear | ResponseReloadWallet | ResponseUtxoUpdate | ResponseVtxoUpdate | ResponseSignTransaction | ResponseCreateContract | ResponseGetContracts | ResponseGetContractsWithVtxos | ResponseAnnotateVtxos | ResponseUpdateContract | ResponseDeleteContract | ResponseGetSpendablePaths | ResponseGetAllSpendingPaths | ResponseIsContractManagerWatching | ResponseRefreshVtxos | ResponseRefreshOutpoints | ResponseContractEvent | ResponseSend | ResponseGetAssetDetails | ResponseIssue | ResponseReissue | ResponseBurn | ResponseDelegate | ResponseGetDelegateInfo | ResponseRecoverVtxos | ResponseRecoverVtxosEvent | ResponseGetRecoverableBalance | ResponseGetExpiringVtxos | ResponseRenewVtxos | ResponseRenewVtxosEvent | ResponseGetExpiredBoardingUtxos | ResponseSweepExpiredBoardingUtxos | ResponseMigrateDeprecatedSignerVtxos | ResponseMigrateDeprecatedSignerVtxosEvent | ResponseGetDeprecatedSignerStatus | ResponseRestoreWallet);
|
|
1656
1716
|
declare class WalletMessageHandler implements MessageHandler<WalletUpdaterRequest, WalletUpdaterResponse> {
|
|
1657
1717
|
readonly messageTag: string;
|
|
1658
1718
|
private wallet;
|
|
@@ -3540,4 +3600,4 @@ declare class AssetManager extends ReadonlyAssetManager implements IAssetManager
|
|
|
3540
3600
|
burn(params: BurnParams): Promise<string>;
|
|
3541
3601
|
}
|
|
3542
3602
|
|
|
3543
|
-
export { type AnchorBumper, ArkError, ArkNote, ArkProvider, type ArkPsbtFieldCoder, ArkPsbtFieldKey, ArkPsbtFieldKeyType, ArkTransaction, type ArkTxInput, AssetDetails, AssetManager, BIP322, BurnParams, CSVMultisigTapscript, ChainTx, Coin, ConditionWitness, Contract, ContractEvent, ContractRepository, ContractRepositoryImpl, ContractWatcherConfig, ContractWithVtxos, CosignerPublicKey, CreateContractParams, DEFAULT_MESSAGE_TIMEOUTS, DelegateInfo, DelegateNotConfiguredError, DelegatorNotConfiguredError, type DescriptorOptions, DescriptorSigningProviderMissingError, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, type BlockHeader as ElectrumBlockHeader, ElectrumOnchainProvider, type TransactionHistory as ElectrumTransactionHistory, type Unspent as ElectrumUnspent, EncodedVtxoScript, Estimator, ExplorerTransaction, ExtendedCoin, ExtendedVirtualCoin, FeeAmount, FeeInfo, FeeOutput, GetVtxosFilter, HDDescriptorProvider, IAssetManager, IContractManager, IDelegateManager, IReadonlyAssetManager, IReadonlyWallet, IVtxoManager, IWallet, Identity, InMemoryContractRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBWalletRepository, IndexerProvider, IntentFeeConfig, IssuanceParams, IssuanceResult, MESSAGE_BUS_NOT_INITIALIZED, MIGRATION_KEY, MessageBus, MessageBusNotInitializedError, type MessageHandler, type MessageTimeouts, type MigrationStatus, MissingSigningDescriptorError, MnemonicIdentity, type MnemonicOptions, Network, NetworkName, type NetworkOptions, OffchainInput, type OffchainTx, OnchainInput, OnchainProvider, OnchainWallet, Outpoint, P2A, type ParsedArkContract, PathContext, PathSelection, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlyIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, Recipient, ReissuanceParams, RelativeTimelock, RenewVtxosOptions, type RequestEnvelope, type ResponseEnvelope, SeedIdentity, type SeedIdentityOptions, SendBitcoinParams, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, type ServiceWorkerWalletMode, SettleParams, SettlementConfig, SettlementEvent, SignerSession, SingleKey, Status, StorageConfig, TapLeafScript, Transaction, TxTree, TxWeightEstimator, Unroll, type VSize, VirtualCoin, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, Wallet, WalletBalance, WalletMessageHandler, WalletNotInitializedError, WalletRepository, WalletRepositoryImpl, WsElectrumChainSource, assembleBtcdTaprootTree, index as asset, buildForfeitTx, buildOffchainTx, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, decodeArkContract, encodeArkContract, getArkPsbtFields, getMigrationStatus, getRandomId, hasBoardingTxExpired, isArkContract, isCltvSatisfied, isCsvSpendable, isValidArkAddress, maybeArkError, migrateWalletRepository, openDatabase, requiresMigration, rollbackMigration, sequenceToTimelock, setArkPsbtField, setupServiceWorker, timelockToSequence, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures };
|
|
3603
|
+
export { type AnchorBumper, ArkError, ArkNote, ArkProvider, type ArkPsbtFieldCoder, ArkPsbtFieldKey, ArkPsbtFieldKeyType, ArkTransaction, type ArkTxInput, AssetDetails, AssetManager, BIP322, BurnParams, CSVMultisigTapscript, ChainTx, Coin, ConditionWitness, Contract, ContractEvent, ContractRepository, ContractRepositoryImpl, ContractWatcherConfig, ContractWithVtxos, CosignerPublicKey, CreateContractParams, DEFAULT_MESSAGE_TIMEOUTS, DelegateInfo, DelegateNotConfiguredError, DelegatorNotConfiguredError, type DescriptorOptions, DescriptorSigningProviderMissingError, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, type BlockHeader as ElectrumBlockHeader, ElectrumOnchainProvider, type TransactionHistory as ElectrumTransactionHistory, type Unspent as ElectrumUnspent, EncodedVtxoScript, Estimator, ExplorerTransaction, ExtendedCoin, ExtendedVirtualCoin, FeeAmount, FeeInfo, FeeOutput, GetVtxosFilter, HDDescriptorProvider, IAssetManager, IContractManager, IDelegateManager, IReadonlyAssetManager, IReadonlyWallet, IVtxoManager, IWallet, Identity, InMemoryContractRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBWalletRepository, IndexerProvider, IntentFeeConfig, IssuanceParams, IssuanceResult, MESSAGE_BUS_NOT_INITIALIZED, MIGRATION_KEY, MessageBus, MessageBusNotInitializedError, type MessageHandler, type MessageTimeouts, MigrationGlobalSkipReason, MigrationLegSkipReason, type MigrationStatus, MissingSigningDescriptorError, MnemonicIdentity, type MnemonicOptions, Network, NetworkName, type NetworkOptions, OffchainInput, type OffchainTx, OnchainInput, OnchainProvider, OnchainWallet, Outpoint, P2A, type ParsedArkContract, PathContext, PathSelection, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlyIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, Recipient, ReissuanceParams, RelativeTimelock, RenewVtxosOptions, type RequestEnvelope, type ResponseEnvelope, SeedIdentity, type SeedIdentityOptions, SendBitcoinParams, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, type ServiceWorkerWalletMode, SettleParams, SettlementConfig, SettlementEvent, SignerSession, SignerStatus, SingleKey, Status, StorageConfig, TapLeafScript, Transaction, TxTree, TxWeightEstimator, Unroll, type VSize, VirtualCoin, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, Wallet, WalletBalance, WalletMessageHandler, WalletNotInitializedError, WalletRepository, WalletRepositoryImpl, WsElectrumChainSource, assembleBtcdTaprootTree, index as asset, buildForfeitTx, buildOffchainTx, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, decodeArkContract, encodeArkContract, getArkPsbtFields, getMigrationStatus, getRandomId, hasBoardingTxExpired, isArkContract, isCltvSatisfied, isCsvSpendable, isValidArkAddress, maybeArkError, migrateWalletRepository, openDatabase, requiresMigration, rollbackMigration, sequenceToTimelock, setArkPsbtField, setupServiceWorker, timelockToSequence, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
export { B as BoardingContractHandler, a as BoardingContractParams, D as DefaultContractHandler, b as DefaultContractParams, c as DelegateContractHandler, d as DelegateContractParams, V as VHTLC, e as VHTLCContractHandler, f as VHTLCContractParams, g as contractHandlers } from './index-
|
|
4
|
-
export { D as DefaultVtxo, a as DelegateVtxo } from './delegate-
|
|
5
|
-
import { W as Wallet, R as ReadonlyWallet, a as ReceiveRotatorFactory, b as ReceiveRotatorBootOpts, c as ReceiveRotatorBoot } from './wallet-
|
|
6
|
-
export { B as Batch, I as IncomingFunds, w as waitForIncomingFunds } from './wallet-
|
|
1
|
+
import { L as ReadonlyIdentity, a as Identity, a5 as DescriptorSigningRequest, a6 as Transaction, a2 as SignerSession, W as WalletRepository, E as ExtendedVirtualCoin, s as VtxoRepositoryKey, d as ExtendedCoin, A as ArkTransaction, t as WalletState, r as Contract, C as ContractRepository, u as ContractFilter, a7 as IntentFeeConfig, a8 as OffchainInput, a9 as FeeAmount, aa as OnchainInput, ab as FeeOutput, m as ArkProvider, a0 as SettlementConfig, ac as ContractWatcherConfig, I as IWallet, ad as FeeInfo, h as SettlementEvent, J as DescriptorProvider, g as SettleParams, S as SendBitcoinParams, G as GetVtxosFilter, ae as CreateContractParams, af as GetContractsFilter, q as VirtualCoin, ag as GetSpendablePathsOptions, ah as GetAllSpendingPathsOptions, R as Recipient, ai as IssuanceParams, aj as ReissuanceParams, ak as BurnParams, al as RenewVtxosOptions, c as WalletBalance, am as ContractWithVtxos, an as PathSelection, ao as ContractEvent, ap as AssetDetails, aq as IssuanceResult, ar as DelegateInfo, as as MigrationGlobalSkipReason, at as MigrationLegSkipReason, au as SignerStatus, K as IReadonlyWallet, Q as IReadonlyAssetManager, av as StorageConfig, e as IContractManager, i as IAssetManager, f as IDelegateManager, aw as IVtxoManager, O as OnchainProvider, N as Network, U as NetworkName, Z as Coin, ax as ExplorerTransaction, p as TapLeafScript, ay as EncodedVtxoScript, $ as CSVMultisigTapscript, o as RelativeTimelock, V as VtxoScript, az as Status, aA as Outpoint, aB as ChainTx, n as IndexerProvider, w as TxTree, aC as PathContext } from './ark-D6sau_6-.js';
|
|
2
|
+
export { Y as ArkAddress, X as ArkInfo, aD as ArkTapscript, aE as Asset, aF as AssetMetadata, aG as BaseWalletConfig, D as BatchFailedEvent, y as BatchFinalizationEvent, z as BatchFinalizedEvent, aH as BatchInfo, aI as BatchSignableIdentity, B as BatchStartedEvent, aJ as CLTVMultisigTapscript, aK as ChainTxType, aL as CommitmentTx, aM as ConditionCSVMultisigTapscript, aN as ConditionMultisigTapscript, aO as ContractBalance, aP as ContractEventCallback, aQ as ContractHandler, _ as ContractManager, aR as ContractManagerConfig, aS as ContractState, aT as ContractVtxo, aU as ContractWatcher, aV as DelegateManagerImpl, aW as DelegateOptions, M as DelegateProvider, aX as DelegatorManagerImpl, aY as DelegatorProvider, aZ as DeprecatedSignerMigrationReport, a_ as DeprecatedSignerReport, a$ as DigestMismatchError, b0 as Discoverable, b1 as DiscoveredContract, b2 as DiscoveryDeps, b3 as ESPLORA_URL, b4 as EsploraProvider, b5 as ExtendedContractVtxo, b6 as HandlerError, b7 as IDelegatorManager, b8 as IndexerTxType, a4 as Intent, b9 as KnownMetadata, ba as MigrateDeprecatedSignerOptions, bb as MigrationLegReport, bc as MigrationVtxoRef, bd as MultisigTapscript, be as Nonces, bf as Output, bg as PageResponse, bh as PaginationOptions, bi as PartialSig, bj as ProviderClass, P as ReadonlyWalletConfig, j as RestArkProvider, bk as RestDelegateProvider, bl as RestDelegatorProvider, k as RestIndexerProvider, bm as ScanContractsOptions, bn as ScanResult, bo as ScheduledSession, bp as SettlementEventType, bq as SignRequest, a3 as SignedIntent, br as SignerClassification, bs as SignerSet, bt as SubscriptionEvent, bu as SubscriptionHeartbeat, l as SubscriptionResponse, bv as TapLeaves, bw as TapTreeCoder, bx as TapscriptType, by as TreeNonces, x as TreeNoncesEvent, bz as TreePartialSigs, H as TreeSignatureEvent, v as TreeSigningStartedEvent, F as TreeTxEvent, bA as Tx, bB as TxHistoryRecord, bC as TxKey, T as TxNotification, bD as TxTreeNode, bE as TxType, bF as VirtualStatus, bG as Vtxo, bH as VtxoChain, a1 as VtxoManager, bI as VtxoType, b as WalletConfig, bJ as WalletMode, bK as classifyAgainstSignerSet, bL as classifyContractSigner, bM as decodeTapscript, bN as getSequence, bO as isBatchSignable, bP as isCooperativelyMigratable, bQ as isDiscoverable, bR as isExpired, bS as isRecoverable, bT as isSpendable, bU as isSubdust, bV as isVtxoExpiringSoon, bW as networks, bX as signerSetFromInfo, bY as toXOnlySignerHex } from './ark-D6sau_6-.js';
|
|
3
|
+
export { B as BoardingContractHandler, a as BoardingContractParams, D as DefaultContractHandler, b as DefaultContractParams, c as DelegateContractHandler, d as DelegateContractParams, V as VHTLC, e as VHTLCContractHandler, f as VHTLCContractParams, g as contractHandlers } from './index-BETdjE_o.js';
|
|
4
|
+
export { D as DefaultVtxo, a as DelegateVtxo } from './delegate-De5__fpZ.js';
|
|
5
|
+
import { W as Wallet, R as ReadonlyWallet, a as ReceiveRotatorFactory, b as ReceiveRotatorBootOpts, c as ReceiveRotatorBoot } from './wallet-Bth5uucA.js';
|
|
6
|
+
export { B as Batch, d as BoardingUtxoGroup, I as IncomingFunds, w as waitForIncomingFunds } from './wallet-Bth5uucA.js';
|
|
7
7
|
import { Bytes, BTC_NETWORK } from '@scure/btc-signer/utils.js';
|
|
8
8
|
import { P2TR } from '@scure/btc-signer/payment.js';
|
|
9
9
|
import { Transaction as Transaction$1 } from '@scure/btc-signer';
|
|
@@ -1462,6 +1462,10 @@ type ResponseRenewVtxosEvent = ResponseEnvelope & {
|
|
|
1462
1462
|
type: "RENEW_VTXOS_EVENT";
|
|
1463
1463
|
payload: SettlementEvent;
|
|
1464
1464
|
};
|
|
1465
|
+
type ResponseMigrateDeprecatedSignerVtxosEvent = ResponseEnvelope & {
|
|
1466
|
+
type: "MIGRATE_DEPRECATED_SIGNER_VTXOS_EVENT";
|
|
1467
|
+
payload: SettlementEvent;
|
|
1468
|
+
};
|
|
1465
1469
|
type ResponseUtxoUpdate = ResponseEnvelope & {
|
|
1466
1470
|
broadcast: true;
|
|
1467
1471
|
type: "UTXO_UPDATE";
|
|
@@ -1642,6 +1646,62 @@ type ResponseSweepExpiredBoardingUtxos = ResponseEnvelope & {
|
|
|
1642
1646
|
txid: string;
|
|
1643
1647
|
};
|
|
1644
1648
|
};
|
|
1649
|
+
type WireMigrationVtxoRef = {
|
|
1650
|
+
txid: string;
|
|
1651
|
+
vout: number;
|
|
1652
|
+
value: number;
|
|
1653
|
+
signerPubKey: string;
|
|
1654
|
+
cutoffDate?: string;
|
|
1655
|
+
};
|
|
1656
|
+
type WireDeprecatedSignerReport = {
|
|
1657
|
+
signerPubKey: string;
|
|
1658
|
+
status: SignerStatus;
|
|
1659
|
+
cutoffDate?: string;
|
|
1660
|
+
secondsUntilCutoff?: number;
|
|
1661
|
+
vtxoCount: number;
|
|
1662
|
+
totalValue: number;
|
|
1663
|
+
boardingCount: number;
|
|
1664
|
+
boardingValue: number;
|
|
1665
|
+
recoverableCount: number;
|
|
1666
|
+
recoverableValue: number;
|
|
1667
|
+
awaitingSweepCount: number;
|
|
1668
|
+
awaitingSweepValue: number;
|
|
1669
|
+
nextSweepEta?: number;
|
|
1670
|
+
};
|
|
1671
|
+
type WireMigrationLegReport = {
|
|
1672
|
+
txid?: string;
|
|
1673
|
+
migrated: WireMigrationVtxoRef[];
|
|
1674
|
+
skipped?: MigrationLegSkipReason;
|
|
1675
|
+
deferred?: number;
|
|
1676
|
+
oversized?: WireMigrationVtxoRef[];
|
|
1677
|
+
error?: string;
|
|
1678
|
+
};
|
|
1679
|
+
type WireDeprecatedSignerMigrationReport = {
|
|
1680
|
+
rotated: boolean;
|
|
1681
|
+
skipped?: MigrationGlobalSkipReason;
|
|
1682
|
+
vtxos?: WireMigrationLegReport;
|
|
1683
|
+
boarding?: WireMigrationLegReport;
|
|
1684
|
+
expired: WireMigrationVtxoRef[];
|
|
1685
|
+
signers: WireDeprecatedSignerReport[];
|
|
1686
|
+
};
|
|
1687
|
+
type RequestMigrateDeprecatedSignerVtxos = RequestEnvelope & {
|
|
1688
|
+
type: "MIGRATE_DEPRECATED_SIGNER_VTXOS";
|
|
1689
|
+
};
|
|
1690
|
+
type ResponseMigrateDeprecatedSignerVtxos = ResponseEnvelope & {
|
|
1691
|
+
type: "MIGRATE_DEPRECATED_SIGNER_VTXOS_SUCCESS";
|
|
1692
|
+
payload: {
|
|
1693
|
+
report: WireDeprecatedSignerMigrationReport;
|
|
1694
|
+
};
|
|
1695
|
+
};
|
|
1696
|
+
type RequestGetDeprecatedSignerStatus = RequestEnvelope & {
|
|
1697
|
+
type: "GET_DEPRECATED_SIGNER_STATUS";
|
|
1698
|
+
};
|
|
1699
|
+
type ResponseGetDeprecatedSignerStatus = ResponseEnvelope & {
|
|
1700
|
+
type: "DEPRECATED_SIGNER_STATUS";
|
|
1701
|
+
payload: {
|
|
1702
|
+
signers: WireDeprecatedSignerReport[];
|
|
1703
|
+
};
|
|
1704
|
+
};
|
|
1645
1705
|
type RequestRestoreWallet = RequestEnvelope & {
|
|
1646
1706
|
type: "RESTORE_WALLET";
|
|
1647
1707
|
payload: {
|
|
@@ -1651,8 +1711,8 @@ type RequestRestoreWallet = RequestEnvelope & {
|
|
|
1651
1711
|
type ResponseRestoreWallet = ResponseEnvelope & {
|
|
1652
1712
|
type: "RESTORE_WALLET_SUCCESS";
|
|
1653
1713
|
};
|
|
1654
|
-
type WalletUpdaterRequest = RequestInitWallet | RequestSettle | RequestSendBitcoin | RequestGetAddress | RequestGetBoardingAddress | RequestGetBalance | RequestGetVtxos | RequestGetBoardingUtxos | RequestGetTransactionHistory | RequestGetStatus | RequestClear | RequestReloadWallet | RequestSignTransaction | RequestCreateContract | RequestGetContracts | RequestGetContractsWithVtxos | RequestAnnotateVtxos | RequestUpdateContract | RequestDeleteContract | RequestGetSpendablePaths | RequestGetAllSpendingPaths | RequestIsContractManagerWatching | RequestRefreshVtxos | RequestRefreshOutpoints | RequestSend | RequestGetAssetDetails | RequestIssue | RequestReissue | RequestBurn | RequestDelegate | RequestGetDelegateInfo | RequestRecoverVtxos | RequestGetRecoverableBalance | RequestGetExpiringVtxos | RequestRenewVtxos | RequestGetExpiredBoardingUtxos | RequestSweepExpiredBoardingUtxos | RequestRestoreWallet;
|
|
1655
|
-
type WalletUpdaterResponse = ResponseEnvelope & (ResponseInitWallet | ResponseSettle | ResponseSettleEvent | ResponseSendBitcoin | ResponseGetAddress | ResponseGetBoardingAddress | ResponseGetBalance | ResponseGetVtxos | ResponseGetBoardingUtxos | ResponseGetTransactionHistory | ResponseGetStatus | ResponseClear | ResponseReloadWallet | ResponseUtxoUpdate | ResponseVtxoUpdate | ResponseSignTransaction | ResponseCreateContract | ResponseGetContracts | ResponseGetContractsWithVtxos | ResponseAnnotateVtxos | ResponseUpdateContract | ResponseDeleteContract | ResponseGetSpendablePaths | ResponseGetAllSpendingPaths | ResponseIsContractManagerWatching | ResponseRefreshVtxos | ResponseRefreshOutpoints | ResponseContractEvent | ResponseSend | ResponseGetAssetDetails | ResponseIssue | ResponseReissue | ResponseBurn | ResponseDelegate | ResponseGetDelegateInfo | ResponseRecoverVtxos | ResponseRecoverVtxosEvent | ResponseGetRecoverableBalance | ResponseGetExpiringVtxos | ResponseRenewVtxos | ResponseRenewVtxosEvent | ResponseGetExpiredBoardingUtxos | ResponseSweepExpiredBoardingUtxos | ResponseRestoreWallet);
|
|
1714
|
+
type WalletUpdaterRequest = RequestInitWallet | RequestSettle | RequestSendBitcoin | RequestGetAddress | RequestGetBoardingAddress | RequestGetBalance | RequestGetVtxos | RequestGetBoardingUtxos | RequestGetTransactionHistory | RequestGetStatus | RequestClear | RequestReloadWallet | RequestSignTransaction | RequestCreateContract | RequestGetContracts | RequestGetContractsWithVtxos | RequestAnnotateVtxos | RequestUpdateContract | RequestDeleteContract | RequestGetSpendablePaths | RequestGetAllSpendingPaths | RequestIsContractManagerWatching | RequestRefreshVtxos | RequestRefreshOutpoints | RequestSend | RequestGetAssetDetails | RequestIssue | RequestReissue | RequestBurn | RequestDelegate | RequestGetDelegateInfo | RequestRecoverVtxos | RequestGetRecoverableBalance | RequestGetExpiringVtxos | RequestRenewVtxos | RequestGetExpiredBoardingUtxos | RequestSweepExpiredBoardingUtxos | RequestMigrateDeprecatedSignerVtxos | RequestGetDeprecatedSignerStatus | RequestRestoreWallet;
|
|
1715
|
+
type WalletUpdaterResponse = ResponseEnvelope & (ResponseInitWallet | ResponseSettle | ResponseSettleEvent | ResponseSendBitcoin | ResponseGetAddress | ResponseGetBoardingAddress | ResponseGetBalance | ResponseGetVtxos | ResponseGetBoardingUtxos | ResponseGetTransactionHistory | ResponseGetStatus | ResponseClear | ResponseReloadWallet | ResponseUtxoUpdate | ResponseVtxoUpdate | ResponseSignTransaction | ResponseCreateContract | ResponseGetContracts | ResponseGetContractsWithVtxos | ResponseAnnotateVtxos | ResponseUpdateContract | ResponseDeleteContract | ResponseGetSpendablePaths | ResponseGetAllSpendingPaths | ResponseIsContractManagerWatching | ResponseRefreshVtxos | ResponseRefreshOutpoints | ResponseContractEvent | ResponseSend | ResponseGetAssetDetails | ResponseIssue | ResponseReissue | ResponseBurn | ResponseDelegate | ResponseGetDelegateInfo | ResponseRecoverVtxos | ResponseRecoverVtxosEvent | ResponseGetRecoverableBalance | ResponseGetExpiringVtxos | ResponseRenewVtxos | ResponseRenewVtxosEvent | ResponseGetExpiredBoardingUtxos | ResponseSweepExpiredBoardingUtxos | ResponseMigrateDeprecatedSignerVtxos | ResponseMigrateDeprecatedSignerVtxosEvent | ResponseGetDeprecatedSignerStatus | ResponseRestoreWallet);
|
|
1656
1716
|
declare class WalletMessageHandler implements MessageHandler<WalletUpdaterRequest, WalletUpdaterResponse> {
|
|
1657
1717
|
readonly messageTag: string;
|
|
1658
1718
|
private wallet;
|
|
@@ -3540,4 +3600,4 @@ declare class AssetManager extends ReadonlyAssetManager implements IAssetManager
|
|
|
3540
3600
|
burn(params: BurnParams): Promise<string>;
|
|
3541
3601
|
}
|
|
3542
3602
|
|
|
3543
|
-
export { type AnchorBumper, ArkError, ArkNote, ArkProvider, type ArkPsbtFieldCoder, ArkPsbtFieldKey, ArkPsbtFieldKeyType, ArkTransaction, type ArkTxInput, AssetDetails, AssetManager, BIP322, BurnParams, CSVMultisigTapscript, ChainTx, Coin, ConditionWitness, Contract, ContractEvent, ContractRepository, ContractRepositoryImpl, ContractWatcherConfig, ContractWithVtxos, CosignerPublicKey, CreateContractParams, DEFAULT_MESSAGE_TIMEOUTS, DelegateInfo, DelegateNotConfiguredError, DelegatorNotConfiguredError, type DescriptorOptions, DescriptorSigningProviderMissingError, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, type BlockHeader as ElectrumBlockHeader, ElectrumOnchainProvider, type TransactionHistory as ElectrumTransactionHistory, type Unspent as ElectrumUnspent, EncodedVtxoScript, Estimator, ExplorerTransaction, ExtendedCoin, ExtendedVirtualCoin, FeeAmount, FeeInfo, FeeOutput, GetVtxosFilter, HDDescriptorProvider, IAssetManager, IContractManager, IDelegateManager, IReadonlyAssetManager, IReadonlyWallet, IVtxoManager, IWallet, Identity, InMemoryContractRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBWalletRepository, IndexerProvider, IntentFeeConfig, IssuanceParams, IssuanceResult, MESSAGE_BUS_NOT_INITIALIZED, MIGRATION_KEY, MessageBus, MessageBusNotInitializedError, type MessageHandler, type MessageTimeouts, type MigrationStatus, MissingSigningDescriptorError, MnemonicIdentity, type MnemonicOptions, Network, NetworkName, type NetworkOptions, OffchainInput, type OffchainTx, OnchainInput, OnchainProvider, OnchainWallet, Outpoint, P2A, type ParsedArkContract, PathContext, PathSelection, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlyIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, Recipient, ReissuanceParams, RelativeTimelock, RenewVtxosOptions, type RequestEnvelope, type ResponseEnvelope, SeedIdentity, type SeedIdentityOptions, SendBitcoinParams, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, type ServiceWorkerWalletMode, SettleParams, SettlementConfig, SettlementEvent, SignerSession, SingleKey, Status, StorageConfig, TapLeafScript, Transaction, TxTree, TxWeightEstimator, Unroll, type VSize, VirtualCoin, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, Wallet, WalletBalance, WalletMessageHandler, WalletNotInitializedError, WalletRepository, WalletRepositoryImpl, WsElectrumChainSource, assembleBtcdTaprootTree, index as asset, buildForfeitTx, buildOffchainTx, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, decodeArkContract, encodeArkContract, getArkPsbtFields, getMigrationStatus, getRandomId, hasBoardingTxExpired, isArkContract, isCltvSatisfied, isCsvSpendable, isValidArkAddress, maybeArkError, migrateWalletRepository, openDatabase, requiresMigration, rollbackMigration, sequenceToTimelock, setArkPsbtField, setupServiceWorker, timelockToSequence, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures };
|
|
3603
|
+
export { type AnchorBumper, ArkError, ArkNote, ArkProvider, type ArkPsbtFieldCoder, ArkPsbtFieldKey, ArkPsbtFieldKeyType, ArkTransaction, type ArkTxInput, AssetDetails, AssetManager, BIP322, BurnParams, CSVMultisigTapscript, ChainTx, Coin, ConditionWitness, Contract, ContractEvent, ContractRepository, ContractRepositoryImpl, ContractWatcherConfig, ContractWithVtxos, CosignerPublicKey, CreateContractParams, DEFAULT_MESSAGE_TIMEOUTS, DelegateInfo, DelegateNotConfiguredError, DelegatorNotConfiguredError, type DescriptorOptions, DescriptorSigningProviderMissingError, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, type BlockHeader as ElectrumBlockHeader, ElectrumOnchainProvider, type TransactionHistory as ElectrumTransactionHistory, type Unspent as ElectrumUnspent, EncodedVtxoScript, Estimator, ExplorerTransaction, ExtendedCoin, ExtendedVirtualCoin, FeeAmount, FeeInfo, FeeOutput, GetVtxosFilter, HDDescriptorProvider, IAssetManager, IContractManager, IDelegateManager, IReadonlyAssetManager, IReadonlyWallet, IVtxoManager, IWallet, Identity, InMemoryContractRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBWalletRepository, IndexerProvider, IntentFeeConfig, IssuanceParams, IssuanceResult, MESSAGE_BUS_NOT_INITIALIZED, MIGRATION_KEY, MessageBus, MessageBusNotInitializedError, type MessageHandler, type MessageTimeouts, MigrationGlobalSkipReason, MigrationLegSkipReason, type MigrationStatus, MissingSigningDescriptorError, MnemonicIdentity, type MnemonicOptions, Network, NetworkName, type NetworkOptions, OffchainInput, type OffchainTx, OnchainInput, OnchainProvider, OnchainWallet, Outpoint, P2A, type ParsedArkContract, PathContext, PathSelection, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlyIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, Recipient, ReissuanceParams, RelativeTimelock, RenewVtxosOptions, type RequestEnvelope, type ResponseEnvelope, SeedIdentity, type SeedIdentityOptions, SendBitcoinParams, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, type ServiceWorkerWalletMode, SettleParams, SettlementConfig, SettlementEvent, SignerSession, SignerStatus, SingleKey, Status, StorageConfig, TapLeafScript, Transaction, TxTree, TxWeightEstimator, Unroll, type VSize, VirtualCoin, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, Wallet, WalletBalance, WalletMessageHandler, WalletNotInitializedError, WalletRepository, WalletRepositoryImpl, WsElectrumChainSource, assembleBtcdTaprootTree, index as asset, buildForfeitTx, buildOffchainTx, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, decodeArkContract, encodeArkContract, getArkPsbtFields, getMigrationStatus, getRandomId, hasBoardingTxExpired, isArkContract, isCltvSatisfied, isCsvSpendable, isValidArkAddress, maybeArkError, migrateWalletRepository, openDatabase, requiresMigration, rollbackMigration, sequenceToTimelock, setArkPsbtField, setupServiceWorker, timelockToSequence, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { ArkNote, AssetManager, BIP322, Batch, ContractManager, ContractRepositoryImpl, ContractWatcher, DEFAULT_MESSAGE_TIMEOUTS, DelegateManagerImpl, DelegateNotConfiguredError, DelegatorManagerImpl, DelegatorNotConfiguredError, DescriptorSigningProviderMissingError, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, ESPLORA_URL, ElectrumOnchainProvider, EsploraProvider, Estimator, HDDescriptorProvider, InMemoryContractRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBWalletRepository, MESSAGE_BUS_NOT_INITIALIZED, MIGRATION_KEY, MessageBus, MessageBusNotInitializedError, MissingSigningDescriptorError, MnemonicIdentity, OnchainWallet, P2A, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, RestDelegateProvider, RestDelegatorProvider, SeedIdentity, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, SingleKey, TxTree, TxType, TxWeightEstimator, Unroll, VtxoManager, Wallet, WalletMessageHandler, WalletNotInitializedError, WalletRepositoryImpl, WsElectrumChainSource, buildForfeitTx, buildOffchainTx, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, decodeArkContract, encodeArkContract, getMigrationStatus, getRandomId, hasBoardingTxExpired, isArkContract, isBatchSignable, isDiscoverable, isExpired, isRecoverable, isSpendable, isSubdust, isValidArkAddress, isVtxoExpiringSoon, migrateWalletRepository, openDatabase, requiresMigration, rollbackMigration, setupServiceWorker, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, waitForIncomingFunds } from './chunk-
|
|
2
|
-
export { ArkError, ArkPsbtFieldKey, ArkPsbtFieldKeyType, ChainTxType, ConditionWitness, CosignerPublicKey, IndexerTxType, Intent, RestArkProvider, RestIndexerProvider, SettlementEventType, Transaction, VtxoTaprootTree, VtxoTreeExpiry, asset_exports as asset, getArkPsbtFields, maybeArkError, setArkPsbtField } from './chunk-
|
|
1
|
+
export { ArkNote, AssetManager, BIP322, Batch, ContractManager, ContractRepositoryImpl, ContractWatcher, DEFAULT_MESSAGE_TIMEOUTS, DelegateManagerImpl, DelegateNotConfiguredError, DelegatorManagerImpl, DelegatorNotConfiguredError, DescriptorSigningProviderMissingError, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, ESPLORA_URL, ElectrumOnchainProvider, EsploraProvider, Estimator, HDDescriptorProvider, InMemoryContractRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBWalletRepository, MESSAGE_BUS_NOT_INITIALIZED, MIGRATION_KEY, MessageBus, MessageBusNotInitializedError, MissingSigningDescriptorError, MnemonicIdentity, OnchainWallet, P2A, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, RestDelegateProvider, RestDelegatorProvider, SeedIdentity, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, SingleKey, TxTree, TxType, TxWeightEstimator, Unroll, VtxoManager, Wallet, WalletMessageHandler, WalletNotInitializedError, WalletRepositoryImpl, WsElectrumChainSource, buildForfeitTx, buildOffchainTx, classifyAgainstSignerSet, classifyContractSigner, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, decodeArkContract, encodeArkContract, getMigrationStatus, getRandomId, hasBoardingTxExpired, isArkContract, isBatchSignable, isCooperativelyMigratable, isDiscoverable, isExpired, isRecoverable, isSpendable, isSubdust, isValidArkAddress, isVtxoExpiringSoon, migrateWalletRepository, openDatabase, requiresMigration, rollbackMigration, setupServiceWorker, signerSetFromInfo, toXOnlySignerHex, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, waitForIncomingFunds } from './chunk-NOR7XOKN.js';
|
|
2
|
+
export { ArkError, ArkPsbtFieldKey, ArkPsbtFieldKeyType, ChainTxType, ConditionWitness, CosignerPublicKey, DigestMismatchError, IndexerTxType, Intent, RestArkProvider, RestIndexerProvider, SettlementEventType, Transaction, VtxoTaprootTree, VtxoTreeExpiry, asset_exports as asset, getArkPsbtFields, maybeArkError, setArkPsbtField } from './chunk-3JR77WQ4.js';
|
|
3
3
|
export { BoardingContractHandler, DefaultContractHandler, DefaultVtxo, DelegateContractHandler, DelegateVtxo, VHTLC, VHTLCContractHandler, contractHandlers, isCltvSatisfied, isCsvSpendable } from './chunk-CUSABEUQ.js';
|
|
4
4
|
export { ArkAddress, CLTVMultisigTapscript, CSVMultisigTapscript, ConditionCSVMultisigTapscript, ConditionMultisigTapscript, MultisigTapscript, TapTreeCoder, VtxoScript, assembleBtcdTaprootTree, decodeTapscript, getSequence, networks, sequenceToTimelock, timelockToSequence } from './chunk-OUVTG72A.js';
|
|
5
5
|
import './chunk-NSBPE2FW.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
3
|
+
var chunkH2LX2KKY_cjs = require('../../chunk-H2LX2KKY.cjs');
|
|
4
|
+
require('../../chunk-X2EQLK4O.cjs');
|
|
5
5
|
require('../../chunk-GUTKJMSF.cjs');
|
|
6
6
|
require('../../chunk-CMPJR3HS.cjs');
|
|
7
7
|
require('../../chunk-5BLDMQED.cjs');
|
|
@@ -37,7 +37,7 @@ var RealmWalletRepository = class {
|
|
|
37
37
|
await this.ensureInit();
|
|
38
38
|
this.realm.write(() => {
|
|
39
39
|
for (const vtxo of vtxos) {
|
|
40
|
-
const s =
|
|
40
|
+
const s = chunkH2LX2KKY_cjs.serializeVtxo(vtxo);
|
|
41
41
|
this.realm.create(
|
|
42
42
|
"ArkVtxo",
|
|
43
43
|
{
|
|
@@ -85,7 +85,7 @@ var RealmWalletRepository = class {
|
|
|
85
85
|
throw new Error("RealmWalletRepository requires an address");
|
|
86
86
|
}
|
|
87
87
|
for (const vtxo of vtxos) {
|
|
88
|
-
if (!
|
|
88
|
+
if (!chunkH2LX2KKY_cjs.isVtxoForScript(vtxo, key.script)) {
|
|
89
89
|
throw new Error(
|
|
90
90
|
`VTXO ${vtxo.txid}:${vtxo.vout} script mismatch: expected ${key.script}, got ${vtxo.script}`
|
|
91
91
|
);
|
|
@@ -110,7 +110,7 @@ var RealmWalletRepository = class {
|
|
|
110
110
|
await this.ensureInit();
|
|
111
111
|
this.realm.write(() => {
|
|
112
112
|
for (const utxo of utxos) {
|
|
113
|
-
const s =
|
|
113
|
+
const s = chunkH2LX2KKY_cjs.serializeUtxo(utxo);
|
|
114
114
|
this.realm.create(
|
|
115
115
|
"ArkUtxo",
|
|
116
116
|
{
|
|
@@ -163,7 +163,7 @@ var RealmWalletRepository = class {
|
|
|
163
163
|
amount: tx.amount,
|
|
164
164
|
settled: tx.settled,
|
|
165
165
|
createdAt: tx.createdAt,
|
|
166
|
-
assetsJson: tx.assets ? JSON.stringify(
|
|
166
|
+
assetsJson: tx.assets ? JSON.stringify(chunkH2LX2KKY_cjs.serializeAssets(tx.assets)) : null
|
|
167
167
|
},
|
|
168
168
|
"modified"
|
|
169
169
|
);
|
|
@@ -233,9 +233,9 @@ function vtxoObjectToDomain(obj) {
|
|
|
233
233
|
// Post-migration every row has `script`, but the backfill is
|
|
234
234
|
// idempotent: derive from `address` if the legacy column is still
|
|
235
235
|
// null (e.g. the migration hasn't run yet on this handle).
|
|
236
|
-
script: obj.script ??
|
|
236
|
+
script: obj.script ?? chunkH2LX2KKY_cjs.scriptFromArkAddress(obj.address)
|
|
237
237
|
};
|
|
238
|
-
return
|
|
238
|
+
return chunkH2LX2KKY_cjs.deserializeVtxo(serialized);
|
|
239
239
|
}
|
|
240
240
|
function utxoObjectToDomain(obj) {
|
|
241
241
|
const serialized = {
|
|
@@ -254,7 +254,7 @@ function utxoObjectToDomain(obj) {
|
|
|
254
254
|
status: JSON.parse(obj.statusJson),
|
|
255
255
|
extraWitness: obj.extraWitnessJson ? JSON.parse(obj.extraWitnessJson) : void 0
|
|
256
256
|
};
|
|
257
|
-
return
|
|
257
|
+
return chunkH2LX2KKY_cjs.deserializeUtxo(serialized);
|
|
258
258
|
}
|
|
259
259
|
function txObjectToDomain(obj) {
|
|
260
260
|
const tx = {
|
|
@@ -269,7 +269,7 @@ function txObjectToDomain(obj) {
|
|
|
269
269
|
createdAt: obj.createdAt
|
|
270
270
|
};
|
|
271
271
|
if (obj.assetsJson) {
|
|
272
|
-
tx.assets =
|
|
272
|
+
tx.assets = chunkH2LX2KKY_cjs.deserializeAssets(JSON.parse(obj.assetsJson));
|
|
273
273
|
}
|
|
274
274
|
return tx;
|
|
275
275
|
}
|
|
@@ -494,12 +494,12 @@ var ArkRealmSchemas = [
|
|
|
494
494
|
ArkContractSchema
|
|
495
495
|
];
|
|
496
496
|
var ARK_REALM_SCHEMA_VERSION = 2;
|
|
497
|
-
function runArkRealmMigrations(
|
|
497
|
+
function runArkRealmMigrations(_oldRealm, newRealm) {
|
|
498
498
|
const newVtxos = newRealm.objects("ArkVtxo");
|
|
499
499
|
for (let i = 0; i < newVtxos.length; i++) {
|
|
500
500
|
const newVtxo = newVtxos[i];
|
|
501
501
|
if (!newVtxo.script) {
|
|
502
|
-
newVtxo.script =
|
|
502
|
+
newVtxo.script = chunkH2LX2KKY_cjs.scriptFromArkAddress(newVtxo.address);
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
505
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/repositories/realm/walletRepository.ts","../../../src/repositories/realm/contractRepository.ts","../../../src/repositories/realm/schemas.ts"],"names":["serializeVtxo","isVtxoForScript","serializeUtxo","serializeAssets","scriptFromArkAddress","deserializeVtxo","deserializeUtxo","deserializeAssets"],"mappings":";;;;;;;;;AAwBO,IAAM,wBAAN,MAAwD;AAAA,EAG3D,YAA6B,KAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,KAAA,GAAA,KAAA;AAAA,EAAmB;AAAA,EAFvC,OAAA,GAAU,CAAA;AAAA;AAAA,EAMnB,MAAc,UAAA,GAA4B;AAAA,EAE1C;AAAA,EAEA,OAAO,MAAA,CAAO,YAAY,CAAA,GAAmB;AAAA,EAE7C;AAAA;AAAA,EAIA,MAAM,KAAA,GAAuB;AACzB,IAAA,MAAM,KAAK,UAAA,EAAW;AACtB,IAAA,IAAA,CAAK,KAAA,CAAM,MAAM,MAAM;AACnB,MAAA,IAAA,CAAK,MAAM,MAAA,CAAO,IAAA,CAAK,KAAA,CAAM,OAAA,CAAQ,SAAS,CAAC,CAAA;AAC/C,MAAA,IAAA,CAAK,MAAM,MAAA,CAAO,IAAA,CAAK,KAAA,CAAM,OAAA,CAAQ,SAAS,CAAC,CAAA;AAC/C,MAAA,IAAA,CAAK,MAAM,MAAA,CAAO,IAAA,CAAK,KAAA,CAAM,OAAA,CAAQ,gBAAgB,CAAC,CAAA;AACtD,MAAA,IAAA,CAAK,MAAM,MAAA,CAAO,IAAA,CAAK,KAAA,CAAM,O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AS,QAAQ,CAAA,EAAA,EAAK;AACtC,IAAA,MAAM,OAAA,GAAU,SAAS,CAAC,CAAA;AAC1B,IAAA,IAAI,CAAC,QAAQ,MAAA,EAAQ;AACjB,MAAA,OAAA,CAAQ,MAAA,GAASH,sCAAA,CAAqB,OAAA,CAAQ,OAAO,CAAA;AAAA,IACzD;AAAA,EACJ;AACJ","file":"index.cjs","sourcesContent":["import { ArkTransaction, ExtendedCoin, ExtendedVirtualCoin } from \"../../wallet\";\nimport { WalletRepository, WalletState, VtxoRepositoryKey } from \"../walletRepository\";\nimport {\n serializeVtxo,\n serializeUtxo,\n deserializeVtxo,\n deserializeUtxo,\n serializeAssets,\n deserializeAssets,\n SerializedTapLeaf,\n} from \"../serialization\";\nimport { scriptFromArkAddress } from \"../scriptFromAddress\";\nimport { isVtxoForScript } from \"../../contracts/vtxoOwnership\";\nimport { RealmLike } from \"./types\";\n\n/**\n * Realm-based implementation of WalletRepository.\n *\n * Consumers must open Realm with the schemas from `./schemas.ts` and pass\n * the instance to the constructor.\n *\n * Realm handles schema creation on open, so `ensureInit()` is a no-op.\n * The consumer owns the Realm lifecycle — `[Symbol.asyncDispose]` is a no-op.\n */\nexport class RealmWalletRepository implements WalletRepository {\n readonly version = 1 as const;\n\n constructor(private readonly realm: RealmLike) {}\n\n // ── Lifecycle ──────────────────────────────────────────────────────\n\n private async ensureInit(): Promise<void> {\n // Realm handles schema on open — nothing to initialise.\n }\n\n async [Symbol.asyncDispose](): Promise<void> {\n // no-op — consumer owns the Realm lifecycle\n }\n\n // ── Clear ──────────────────────────────────────────────────────────\n\n async clear(): Promise<void> {\n await this.ensureInit();\n this.realm.write(() => {\n this.realm.delete(this.realm.objects(\"ArkVtxo\"));\n this.realm.delete(this.realm.objects(\"ArkUtxo\"));\n this.realm.delete(this.realm.objects(\"ArkTransaction\"));\n this.realm.delete(this.realm.objects(\"ArkWalletState\"));\n });\n }\n\n // ── VTXO management ────────────────────────────────────────────────\n\n async getVtxos(address: string): Promise<ExtendedVirtualCoin[]> {\n await this.ensureInit();\n const results = this.realm.objects(\"ArkVtxo\").filtered(\"address == $0\", address);\n return [...results].map(vtxoObjectToDomain);\n }\n\n async saveVtxos(address: string, vtxos: ExtendedVirtualCoin[]): Promise<void> {\n await this.ensureInit();\n this.realm.write(() => {\n for (const vtxo of vtxos) {\n const s = serializeVtxo(vtxo);\n this.realm.create(\n \"ArkVtxo\",\n {\n pk: `${s.txid}:${s.vout}`,\n address,\n txid: s.txid,\n vout: s.vout,\n value: s.value,\n tapTree: s.tapTree,\n forfeitCb: s.forfeitTapLeafScript.cb,\n forfeitS: s.forfeitTapLeafScript.s,\n intentCb: s.intentTapLeafScript.cb,\n intentS: s.intentTapLeafScript.s,\n statusJson: JSON.stringify(s.status),\n virtualStatusJson: JSON.stringify(s.virtualStatus),\n createdAt:\n typeof s.createdAt === \"string\"\n ? s.createdAt\n : s.createdAt instanceof Date\n ? s.createdAt.toISOString()\n : new Date(s.createdAt).toISOString(),\n isUnrolled: s.isUnrolled ?? false,\n isSpent: s.isSpent === undefined ? null : s.isSpent,\n spentBy: s.spentBy ?? null,\n settledBy: s.settledBy ?? null,\n arkTxId: s.arkTxId ?? null,\n extraWitnessJson: s.extraWitness ? JSON.stringify(s.extraWitness) : null,\n assetsJson: s.assets ? JSON.stringify(s.assets) : null,\n script: s.script ?? null,\n },\n \"modified\",\n );\n }\n });\n }\n\n async deleteVtxos(address: string): Promise<void> {\n await this.ensureInit();\n this.realm.write(() => {\n const toDelete = this.realm.objects(\"ArkVtxo\").filtered(\"address == $0\", address);\n this.realm.delete(toDelete);\n });\n }\n\n async getVtxosForScript(script: string): Promise<ExtendedVirtualCoin[]> {\n await this.ensureInit();\n const results = this.realm.objects(\"ArkVtxo\").filtered(\"script == $0\", script);\n return [...results].map(vtxoObjectToDomain);\n }\n\n async saveVtxosForScript(key: VtxoRepositoryKey, vtxos: ExtendedVirtualCoin[]): Promise<void> {\n if (!key.address) {\n throw new Error(\"RealmWalletRepository requires an address\");\n }\n for (const vtxo of vtxos) {\n if (!isVtxoForScript(vtxo, key.script)) {\n throw new Error(\n `VTXO ${vtxo.txid}:${vtxo.vout} script mismatch: expected ${key.script}, got ${vtxo.script}`,\n );\n }\n }\n return this.saveVtxos(key.address, vtxos);\n }\n\n async deleteVtxosForScript(script: string): Promise<void> {\n await this.ensureInit();\n this.realm.write(() => {\n const toDelete = this.realm.objects(\"ArkVtxo\").filtered(\"script == $0\", script);\n this.realm.delete(toDelete);\n });\n }\n\n // ── UTXO management ────────────────────────────────────────────────\n\n async getUtxos(address: string): Promise<ExtendedCoin[]> {\n await this.ensureInit();\n const results = this.realm.objects(\"ArkUtxo\").filtered(\"address == $0\", address);\n return [...results].map(utxoObjectToDomain);\n }\n\n async saveUtxos(address: string, utxos: ExtendedCoin[]): Promise<void> {\n await this.ensureInit();\n this.realm.write(() => {\n for (const utxo of utxos) {\n const s = serializeUtxo(utxo);\n this.realm.create(\n \"ArkUtxo\",\n {\n pk: `${s.txid}:${s.vout}`,\n address,\n txid: s.txid,\n vout: s.vout,\n value: s.value,\n tapTree: s.tapTree,\n forfeitCb: s.forfeitTapLeafScript.cb,\n forfeitS: s.forfeitTapLeafScript.s,\n intentCb: s.intentTapLeafScript.cb,\n intentS: s.intentTapLeafScript.s,\n statusJson: JSON.stringify(s.status),\n extraWitnessJson: s.extraWitness ? JSON.stringify(s.extraWitness) : null,\n },\n \"modified\",\n );\n }\n });\n }\n\n async deleteUtxos(address: string): Promise<void> {\n await this.ensureInit();\n this.realm.write(() => {\n const toDelete = this.realm.objects(\"ArkUtxo\").filtered(\"address == $0\", address);\n this.realm.delete(toDelete);\n });\n }\n\n // ── Transaction history ────────────────────────────────────────────\n\n async getTransactionHistory(address: string): Promise<ArkTransaction[]> {\n await this.ensureInit();\n const results = this.realm.objects(\"ArkTransaction\").filtered(\"address == $0\", address);\n const txs = [...results].map(txObjectToDomain);\n txs.sort((a, b) => a.createdAt - b.createdAt);\n return txs;\n }\n\n async saveTransactions(address: string, txs: ArkTransaction[]): Promise<void> {\n await this.ensureInit();\n this.realm.write(() => {\n for (const tx of txs) {\n this.realm.create(\n \"ArkTransaction\",\n {\n pk: `${address}:${tx.key.boardingTxid}:${tx.key.commitmentTxid}:${tx.key.arkTxid}`,\n address,\n boardingTxid: tx.key.boardingTxid,\n commitmentTxid: tx.key.commitmentTxid,\n arkTxid: tx.key.arkTxid,\n type: tx.type,\n amount: tx.amount,\n settled: tx.settled,\n createdAt: tx.createdAt,\n assetsJson: tx.assets ? JSON.stringify(serializeAssets(tx.assets)) : null,\n },\n \"modified\",\n );\n }\n });\n }\n\n async deleteTransactions(address: string): Promise<void> {\n await this.ensureInit();\n this.realm.write(() => {\n const toDelete = this.realm\n .objects(\"ArkTransaction\")\n .filtered(\"address == $0\", address);\n this.realm.delete(toDelete);\n });\n }\n\n // ── Wallet state ───────────────────────────────────────────────────\n\n async getWalletState(): Promise<WalletState | null> {\n await this.ensureInit();\n const results = this.realm\n .objects<WalletStateObject>(\"ArkWalletState\")\n .filtered(\"key == $0\", \"state\");\n const items = [...results];\n if (items.length === 0) return null;\n\n const obj = items[0];\n const state: WalletState = {};\n if (obj.settingsJson) {\n state.settings = JSON.parse(obj.settingsJson);\n }\n state.lastSyncTime = obj.lastSyncTime ?? undefined;\n return state;\n }\n\n async saveWalletState(state: WalletState): Promise<void> {\n await this.ensureInit();\n this.realm.write(() => {\n this.realm.create(\n \"ArkWalletState\",\n {\n key: \"state\",\n lastSyncTime: state.lastSyncTime,\n settingsJson: state.settings ? JSON.stringify(state.settings) : null,\n },\n \"modified\",\n );\n });\n }\n}\n\ninterface WalletStateObject {\n key: string;\n lastSyncTime: number | null;\n settingsJson: string | null;\n}\n\n// ── Realm object → Domain converters ─────────────────────────────────────\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction vtxoObjectToDomain(obj: any): ExtendedVirtualCoin {\n const serialized = {\n txid: obj.txid,\n vout: obj.vout,\n value: obj.value,\n tapTree: obj.tapTree,\n forfeitTapLeafScript: {\n cb: obj.forfeitCb,\n s: obj.forfeitS,\n } as SerializedTapLeaf,\n intentTapLeafScript: {\n cb: obj.intentCb,\n s: obj.intentS,\n } as SerializedTapLeaf,\n status: JSON.parse(obj.statusJson),\n virtualStatus: JSON.parse(obj.virtualStatusJson),\n createdAt: new Date(obj.createdAt),\n isUnrolled: obj.isUnrolled,\n isSpent: obj.isSpent === null ? undefined : obj.isSpent,\n spentBy: obj.spentBy ?? undefined,\n settledBy: obj.settledBy ?? undefined,\n arkTxId: obj.arkTxId ?? undefined,\n extraWitness: obj.extraWitnessJson ? JSON.parse(obj.extraWitnessJson) : undefined,\n assets: obj.assetsJson ? JSON.parse(obj.assetsJson) : undefined,\n // Post-migration every row has `script`, but the backfill is\n // idempotent: derive from `address` if the legacy column is still\n // null (e.g. the migration hasn't run yet on this handle).\n script: obj.script ?? scriptFromArkAddress(obj.address),\n };\n\n return deserializeVtxo(serialized);\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction utxoObjectToDomain(obj: any): ExtendedCoin {\n const serialized = {\n txid: obj.txid,\n vout: obj.vout,\n value: obj.value,\n tapTree: obj.tapTree,\n forfeitTapLeafScript: {\n cb: obj.forfeitCb,\n s: obj.forfeitS,\n } as SerializedTapLeaf,\n intentTapLeafScript: {\n cb: obj.intentCb,\n s: obj.intentS,\n } as SerializedTapLeaf,\n status: JSON.parse(obj.statusJson),\n extraWitness: obj.extraWitnessJson ? JSON.parse(obj.extraWitnessJson) : undefined,\n };\n\n return deserializeUtxo(serialized);\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction txObjectToDomain(obj: any): ArkTransaction {\n const tx: ArkTransaction = {\n key: {\n boardingTxid: obj.boardingTxid,\n commitmentTxid: obj.commitmentTxid,\n arkTxid: obj.arkTxid,\n },\n type: obj.type as ArkTransaction[\"type\"],\n amount: obj.amount,\n settled: obj.settled,\n createdAt: obj.createdAt,\n };\n if (obj.assetsJson) {\n tx.assets = deserializeAssets(JSON.parse(obj.assetsJson));\n }\n return tx;\n}\n","import { Contract, ContractState } from \"../../contracts/types\";\nimport { ContractFilter, ContractRepository } from \"../contractRepository\";\nimport { RealmLike } from \"./types\";\n\n/**\n * Realm-based implementation of ContractRepository.\n *\n * Consumers must open Realm with the schemas from `./schemas.ts` and pass\n * the instance to the constructor.\n *\n * Realm handles schema creation on open, so `ensureInit()` is a no-op.\n * The consumer owns the Realm lifecycle — `[Symbol.asyncDispose]` is a no-op.\n */\nexport class RealmContractRepository implements ContractRepository {\n readonly version = 1 as const;\n\n constructor(private readonly realm: RealmLike) {}\n\n // ── Lifecycle ──────────────────────────────────────────────────────\n\n private async ensureInit(): Promise<void> {\n // Realm handles schema on open — nothing to initialise.\n }\n\n async [Symbol.asyncDispose](): Promise<void> {\n // no-op — consumer owns the Realm lifecycle\n }\n\n // ── Clear ──────────────────────────────────────────────────────────\n\n async clear(): Promise<void> {\n await this.ensureInit();\n this.realm.write(() => {\n this.realm.delete(this.realm.objects(\"ArkContract\"));\n });\n }\n\n // ── Contract management ────────────────────────────────────────────\n\n async getContracts(filter?: ContractFilter): Promise<Contract[]> {\n await this.ensureInit();\n\n let results = this.realm.objects(\"ArkContract\");\n\n if (filter) {\n const filterParts: string[] = [];\n const filterArgs: unknown[] = [];\n\n let argIndex = 0;\n argIndex = this.addFilterCondition(\n filterParts,\n filterArgs,\n \"script\",\n filter.script,\n argIndex,\n );\n argIndex = this.addFilterCondition(\n filterParts,\n filterArgs,\n \"state\",\n filter.state,\n argIndex,\n );\n argIndex = this.addFilterCondition(\n filterParts,\n filterArgs,\n \"type\",\n filter.type,\n argIndex,\n );\n\n if (filterParts.length > 0) {\n const query = filterParts.join(\" AND \");\n results = results.filtered(query, ...filterArgs);\n }\n }\n\n return [...results].map(contractObjectToDomain);\n }\n\n async saveContract(contract: Contract): Promise<void> {\n await this.ensureInit();\n this.realm.write(() => {\n this.realm.create(\n \"ArkContract\",\n {\n script: contract.script,\n address: contract.address,\n type: contract.type,\n state: contract.state,\n paramsJson: JSON.stringify(contract.params),\n createdAt: contract.createdAt,\n label: contract.label ?? null,\n metadataJson: contract.metadata ? JSON.stringify(contract.metadata) : null,\n },\n \"modified\",\n );\n });\n }\n\n async deleteContract(script: string): Promise<void> {\n await this.ensureInit();\n this.realm.write(() => {\n const toDelete = this.realm.objects(\"ArkContract\").filtered(\"script == $0\", script);\n this.realm.delete(toDelete);\n });\n }\n\n // ── Helpers ─────────────────────────────────────────────────────────\n\n private addFilterCondition(\n parts: string[],\n args: unknown[],\n column: string,\n value: string | string[] | undefined,\n argIndex: number,\n ): number {\n if (value === undefined) return argIndex;\n\n if (Array.isArray(value)) {\n if (value.length === 0) return argIndex;\n const conditions = value.map((_, i) => {\n return `${column} == $${argIndex + i}`;\n });\n parts.push(`(${conditions.join(\" OR \")})`);\n args.push(...value);\n return argIndex + value.length;\n } else {\n parts.push(`${column} == $${argIndex}`);\n args.push(value);\n return argIndex + 1;\n }\n }\n}\n\n// ── Realm object → Domain converter ──────────────────────────────────────\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction contractObjectToDomain(obj: any): Contract {\n const contract: Contract = {\n script: obj.script,\n address: obj.address,\n type: obj.type,\n state: obj.state as ContractState,\n params: JSON.parse(obj.paramsJson),\n createdAt: obj.createdAt,\n };\n\n if (obj.label !== null && obj.label !== undefined) {\n contract.label = obj.label;\n }\n if (obj.metadataJson !== null && obj.metadataJson !== undefined) {\n contract.metadata = JSON.parse(obj.metadataJson);\n }\n\n return contract;\n}\n","/**\n * Realm object schemas for the Arkade wallet.\n *\n * All schema names are prefixed with \"Ark\" to avoid collisions with\n * other Realm schemas in the consuming application.\n *\n * Since `realm` is a peer dependency (not installed in this package),\n * schemas are defined as plain JS objects conforming to Realm's\n * ObjectSchema shape.\n */\n\nimport { scriptFromArkAddress } from \"../scriptFromAddress\";\n\nexport const ArkVtxoSchema = {\n name: \"ArkVtxo\",\n primaryKey: \"pk\",\n properties: {\n pk: \"string\", // composite: `${txid}:${vout}`\n address: { type: \"string\", indexed: true },\n txid: \"string\",\n vout: \"int\",\n value: \"int\",\n tapTree: \"string\", // hex-encoded\n forfeitCb: \"string\",\n forfeitS: \"string\",\n intentCb: \"string\",\n intentS: \"string\",\n extraWitnessJson: \"string?\",\n statusJson: \"string\",\n virtualStatusJson: \"string\",\n spentBy: \"string?\",\n settledBy: \"string?\",\n arkTxId: \"string?\",\n createdAt: \"string\", // ISO 8601\n isUnrolled: \"bool\",\n isSpent: \"bool?\",\n assetsJson: \"string?\",\n // scriptPubKey (hex) locking this VTXO, indexed so contract-scoped\n // queries can resolve ownership without touching address mapping.\n // Required as of schema v2; legacy rows are backfilled from `address`\n // during migration (see `runArkRealmMigrations`).\n script: { type: \"string\", indexed: true },\n },\n} as const;\n\nexport const ArkUtxoSchema = {\n name: \"ArkUtxo\",\n primaryKey: \"pk\",\n properties: {\n pk: \"string\", // composite: `${txid}:${vout}`\n address: { type: \"string\", indexed: true },\n txid: \"string\",\n vout: \"int\",\n value: \"int\",\n tapTree: \"string\", // hex-encoded\n forfeitCb: \"string\",\n forfeitS: \"string\",\n intentCb: \"string\",\n intentS: \"string\",\n extraWitnessJson: \"string?\",\n statusJson: \"string\",\n },\n} as const;\n\nexport const ArkTransactionSchema = {\n name: \"ArkTransaction\",\n primaryKey: \"pk\",\n properties: {\n pk: \"string\", // composite: `${address}:${boardingTxid}:${commitmentTxid}:${arkTxid}`\n address: { type: \"string\", indexed: true },\n boardingTxid: \"string\",\n commitmentTxid: \"string\",\n arkTxid: \"string\",\n type: \"string\",\n amount: \"int\",\n settled: \"bool\",\n createdAt: \"int\",\n assetsJson: \"string?\",\n },\n} as const;\n\nexport const ArkWalletStateSchema = {\n name: \"ArkWalletState\",\n primaryKey: \"key\",\n properties: {\n key: \"string\",\n lastSyncTime: \"int?\",\n settingsJson: \"string?\",\n },\n} as const;\n\nexport const ArkContractSchema = {\n name: \"ArkContract\",\n primaryKey: \"script\",\n properties: {\n script: \"string\",\n address: \"string\",\n type: { type: \"string\", indexed: true },\n state: { type: \"string\", indexed: true },\n paramsJson: \"string\",\n createdAt: \"int\",\n expiresAt: \"int?\",\n label: \"string?\",\n metadataJson: \"string?\",\n },\n} as const;\n\n/**\n * All Realm schemas needed by the Arkade wallet repositories.\n * Pass this array to your Realm configuration's `schema` property.\n */\nexport const ArkRealmSchemas = [\n ArkVtxoSchema,\n ArkUtxoSchema,\n ArkTransactionSchema,\n ArkWalletStateSchema,\n ArkContractSchema,\n];\n\n/**\n * Current Realm schema version for the Arkade wallet.\n *\n * Consumers opening Realm must pass a `schemaVersion` at least this high so\n * legacy databases get migrated; merge it with your own app's version:\n *\n * ```ts\n * await Realm.open({\n * schema: [...ArkRealmSchemas, ...yourSchemas],\n * schemaVersion: Math.max(ARK_REALM_SCHEMA_VERSION, yourSchemaVersion),\n * onMigration: (oldRealm, newRealm) => {\n * runArkRealmMigrations(oldRealm, newRealm);\n * // your own migrations\n * },\n * });\n * ```\n *\n * History:\n * - v1: initial ArkVtxo/ArkUtxo/... schemas, `script` nullable.\n * - v2: ArkVtxo.script becomes required; NULL values are backfilled from\n * the owning Ark address during migration.\n */\nexport const ARK_REALM_SCHEMA_VERSION = 2;\n\n/**\n * Run every Arkade schema migration applicable to the open Realm.\n *\n * Designed to be composed with the consumer's own migrations inside a single\n * `onMigration` callback. Each migration step does a per-row check so it\n * remains idempotent and independent of the app's global `schemaVersion` —\n * a consumer whose app is already at version 10 can still trigger the\n * Arkade v1→v2 script backfill when the row has never been populated.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function runArkRealmMigrations(oldRealm: any, newRealm: any): void {\n const newVtxos = newRealm.objects(\"ArkVtxo\");\n for (let i = 0; i < newVtxos.length; i++) {\n const newVtxo = newVtxos[i];\n if (!newVtxo.script) {\n newVtxo.script = scriptFromArkAddress(newVtxo.address);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/repositories/realm/walletRepository.ts","../../../src/repositories/realm/contractRepository.ts","../../../src/repositories/realm/schemas.ts"],"names":["serializeVtxo","isVtxoForScript","serializeUtxo","serializeAssets","scriptFromArkAddress","deserializeVtxo","deserializeUtxo","deserializeAssets"],"mappings":";;;;;;;;;AAwBO,IAAM,wBAAN,MAAwD;AAAA,EAG3D,YAA6B,KAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,KAAA,GAAA,KAAA;AAAA,EAAmB;AAAA,EAFvC,OAAA,GAAU,CAAA;AAAA;AAAA,EAMnB,MAAc,UAAA,GAA4B;AAAA,EAE1C;AAAA,EAEA,OAAO,MAAA,CAAO,YAAY,CAAA,GAAmB;AAAA,EAE7C;AAAA;AAAA,EAIA,MAAM,KAAA,GAAuB;AACzB,IAAA,MAAM,KAAK,UAAA,EAAW;AACtB,IAAA,IAAA,CAAK,KAAA,CAAM,MAAM,MAAM;AACnB,MAAA,IAAA,CAAK,MAAM,MAAA,CAAO,IAAA,CAAK,KAAA,CAAM,OAAA,CAAQ,SAAS,CAAC,CAAA;AAC/C,MAAA,IAAA,CAAK,MAAM,MAAA,CAAO,IAAA,CAAK,KAAA,CAAM,OAAA,CAAQ,SAAS,CAAC,CAAA;AAC/C,MAAA,IAAA,CAAK,MAAM,MAAA,CAAO,IAAA,CAAK,KAAA,CAAM,OAAA,CAAQ,gBAAgB,CAAC,CAAA;AACtD,MAAA,IAAA,CAAK,MAAM,MAAA,CAAO,IAAA,CAAK,KAAA,CAAM,OAAA,CAAQ,gBAAgB,CAAC,CAAA;AAAA,IAC1D,CAAC,CAAA;AAAA,EACL;AAAA;AAAA,EAIA,MAAM,SAAS,OAAA,EAAiD;AAC5D,IAAA,MAAM,KAAK,UAAA,EAAW;AACtB,IAAA,MAAM,OAAA,GAAU,KAAK,KAAA,CAAM,OAAA,CAAQ,SAAS,CAAA,CAAE,QAAA,CAAS,iBAAiB,OAAO,CAAA;AAC/E,IAAA,OAAO,CAAC,GAAG,OAAO,CAAA,CAAE,IAAI,kBAAkB,CAAA;AAAA,EAC9C;AAAA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,EAAK,QAAA;AAAA,IACL,YAAA,EAAc,MAAA;AAAA,IACd,YAAA,EAAc;AAAA;AAEtB,CAAA;AAEO,IAAM,iBAAA,GAAoB;AAAA,EAC7B,IAAA,EAAM,aAAA;AAAA,EACN,UAAA,EAAY,QAAA;AAAA,EACZ,UAAA,EAAY;AAAA,IACR,MAAA,EAAQ,QAAA;AAAA,IACR,OAAA,EAAS,QAAA;AAAA,IACT,IAAA,EAAM,EAAE,IAAA,EAAM,QAAA,EAAU,SAAS,IAAA,EAAK;AAAA,IACtC,KAAA,EAAO,EAAE,IAAA,EAAM,QAAA,EAAU,SAAS,IAAA,EAAK;AAAA,IACvC,UAAA,EAAY,QAAA;AAAA,IACZ,SAAA,EAAW,KAAA;AAAA,IACX,SAAA,EAAW,MAAA;AAAA,IACX,KAAA,EAAO,SAAA;AAAA,IACP,YAAA,EAAc;AAAA;AAEtB,CAAA;AAMO,IAAM,eAAA,GAAkB;AAAA,EAC3B,aAAA;AAAA,EACA,aAAA;AAAA,EACA,oBAAA;AAAA,EACA,oBAAA;AAAA,EACA;AACJ;AAwBO,IAAM,wBAAA,GAA2B;AAYjC,SAAS,qBAAA,CAAsB,WAAgB,QAAA,EAAqB;AACvE,EAAA,MAAM,QAAA,GAAW,QAAA,CAAS,OAAA,CAAQ,SAAS,CAAA;AAC3C,EAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,QAAA,CAAS,QAAQ,CAAA,EAAA,EAAK;AACtC,IAAA,MAAM,OAAA,GAAU,SAAS,CAAC,CAAA;AAC1B,IAAA,IAAI,CAAC,QAAQ,MAAA,EAAQ;AACjB,MAAA,OAAA,CAAQ,MAAA,GAASH,sCAAA,CAAqB,OAAA,CAAQ,OAAO,CAAA;AAAA,IACzD;AAAA,EACJ;AACJ","file":"index.cjs","sourcesContent":["import { ArkTransaction, ExtendedCoin, ExtendedVirtualCoin } from \"../../wallet\";\nimport { WalletRepository, WalletState, VtxoRepositoryKey } from \"../walletRepository\";\nimport {\n serializeVtxo,\n serializeUtxo,\n deserializeVtxo,\n deserializeUtxo,\n serializeAssets,\n deserializeAssets,\n SerializedTapLeaf,\n} from \"../serialization\";\nimport { scriptFromArkAddress } from \"../scriptFromAddress\";\nimport { isVtxoForScript } from \"../../contracts/vtxoOwnership\";\nimport { RealmLike } from \"./types\";\n\n/**\n * Realm-based implementation of WalletRepository.\n *\n * Consumers must open Realm with the schemas from `./schemas.ts` and pass\n * the instance to the constructor.\n *\n * Realm handles schema creation on open, so `ensureInit()` is a no-op.\n * The consumer owns the Realm lifecycle — `[Symbol.asyncDispose]` is a no-op.\n */\nexport class RealmWalletRepository implements WalletRepository {\n readonly version = 1 as const;\n\n constructor(private readonly realm: RealmLike) {}\n\n // ── Lifecycle ──────────────────────────────────────────────────────\n\n private async ensureInit(): Promise<void> {\n // Realm handles schema on open — nothing to initialise.\n }\n\n async [Symbol.asyncDispose](): Promise<void> {\n // no-op — consumer owns the Realm lifecycle\n }\n\n // ── Clear ──────────────────────────────────────────────────────────\n\n async clear(): Promise<void> {\n await this.ensureInit();\n this.realm.write(() => {\n this.realm.delete(this.realm.objects(\"ArkVtxo\"));\n this.realm.delete(this.realm.objects(\"ArkUtxo\"));\n this.realm.delete(this.realm.objects(\"ArkTransaction\"));\n this.realm.delete(this.realm.objects(\"ArkWalletState\"));\n });\n }\n\n // ── VTXO management ────────────────────────────────────────────────\n\n async getVtxos(address: string): Promise<ExtendedVirtualCoin[]> {\n await this.ensureInit();\n const results = this.realm.objects(\"ArkVtxo\").filtered(\"address == $0\", address);\n return [...results].map(vtxoObjectToDomain);\n }\n\n async saveVtxos(address: string, vtxos: ExtendedVirtualCoin[]): Promise<void> {\n await this.ensureInit();\n this.realm.write(() => {\n for (const vtxo of vtxos) {\n const s = serializeVtxo(vtxo);\n this.realm.create(\n \"ArkVtxo\",\n {\n pk: `${s.txid}:${s.vout}`,\n address,\n txid: s.txid,\n vout: s.vout,\n value: s.value,\n tapTree: s.tapTree,\n forfeitCb: s.forfeitTapLeafScript.cb,\n forfeitS: s.forfeitTapLeafScript.s,\n intentCb: s.intentTapLeafScript.cb,\n intentS: s.intentTapLeafScript.s,\n statusJson: JSON.stringify(s.status),\n virtualStatusJson: JSON.stringify(s.virtualStatus),\n createdAt:\n typeof s.createdAt === \"string\"\n ? s.createdAt\n : s.createdAt instanceof Date\n ? s.createdAt.toISOString()\n : new Date(s.createdAt).toISOString(),\n isUnrolled: s.isUnrolled ?? false,\n isSpent: s.isSpent === undefined ? null : s.isSpent,\n spentBy: s.spentBy ?? null,\n settledBy: s.settledBy ?? null,\n arkTxId: s.arkTxId ?? null,\n extraWitnessJson: s.extraWitness ? JSON.stringify(s.extraWitness) : null,\n assetsJson: s.assets ? JSON.stringify(s.assets) : null,\n script: s.script ?? null,\n },\n \"modified\",\n );\n }\n });\n }\n\n async deleteVtxos(address: string): Promise<void> {\n await this.ensureInit();\n this.realm.write(() => {\n const toDelete = this.realm.objects(\"ArkVtxo\").filtered(\"address == $0\", address);\n this.realm.delete(toDelete);\n });\n }\n\n async getVtxosForScript(script: string): Promise<ExtendedVirtualCoin[]> {\n await this.ensureInit();\n const results = this.realm.objects(\"ArkVtxo\").filtered(\"script == $0\", script);\n return [...results].map(vtxoObjectToDomain);\n }\n\n async saveVtxosForScript(key: VtxoRepositoryKey, vtxos: ExtendedVirtualCoin[]): Promise<void> {\n if (!key.address) {\n throw new Error(\"RealmWalletRepository requires an address\");\n }\n for (const vtxo of vtxos) {\n if (!isVtxoForScript(vtxo, key.script)) {\n throw new Error(\n `VTXO ${vtxo.txid}:${vtxo.vout} script mismatch: expected ${key.script}, got ${vtxo.script}`,\n );\n }\n }\n return this.saveVtxos(key.address, vtxos);\n }\n\n async deleteVtxosForScript(script: string): Promise<void> {\n await this.ensureInit();\n this.realm.write(() => {\n const toDelete = this.realm.objects(\"ArkVtxo\").filtered(\"script == $0\", script);\n this.realm.delete(toDelete);\n });\n }\n\n // ── UTXO management ────────────────────────────────────────────────\n\n async getUtxos(address: string): Promise<ExtendedCoin[]> {\n await this.ensureInit();\n const results = this.realm.objects(\"ArkUtxo\").filtered(\"address == $0\", address);\n return [...results].map(utxoObjectToDomain);\n }\n\n async saveUtxos(address: string, utxos: ExtendedCoin[]): Promise<void> {\n await this.ensureInit();\n this.realm.write(() => {\n for (const utxo of utxos) {\n const s = serializeUtxo(utxo);\n this.realm.create(\n \"ArkUtxo\",\n {\n pk: `${s.txid}:${s.vout}`,\n address,\n txid: s.txid,\n vout: s.vout,\n value: s.value,\n tapTree: s.tapTree,\n forfeitCb: s.forfeitTapLeafScript.cb,\n forfeitS: s.forfeitTapLeafScript.s,\n intentCb: s.intentTapLeafScript.cb,\n intentS: s.intentTapLeafScript.s,\n statusJson: JSON.stringify(s.status),\n extraWitnessJson: s.extraWitness ? JSON.stringify(s.extraWitness) : null,\n },\n \"modified\",\n );\n }\n });\n }\n\n async deleteUtxos(address: string): Promise<void> {\n await this.ensureInit();\n this.realm.write(() => {\n const toDelete = this.realm.objects(\"ArkUtxo\").filtered(\"address == $0\", address);\n this.realm.delete(toDelete);\n });\n }\n\n // ── Transaction history ────────────────────────────────────────────\n\n async getTransactionHistory(address: string): Promise<ArkTransaction[]> {\n await this.ensureInit();\n const results = this.realm.objects(\"ArkTransaction\").filtered(\"address == $0\", address);\n const txs = [...results].map(txObjectToDomain);\n txs.sort((a, b) => a.createdAt - b.createdAt);\n return txs;\n }\n\n async saveTransactions(address: string, txs: ArkTransaction[]): Promise<void> {\n await this.ensureInit();\n this.realm.write(() => {\n for (const tx of txs) {\n this.realm.create(\n \"ArkTransaction\",\n {\n pk: `${address}:${tx.key.boardingTxid}:${tx.key.commitmentTxid}:${tx.key.arkTxid}`,\n address,\n boardingTxid: tx.key.boardingTxid,\n commitmentTxid: tx.key.commitmentTxid,\n arkTxid: tx.key.arkTxid,\n type: tx.type,\n amount: tx.amount,\n settled: tx.settled,\n createdAt: tx.createdAt,\n assetsJson: tx.assets ? JSON.stringify(serializeAssets(tx.assets)) : null,\n },\n \"modified\",\n );\n }\n });\n }\n\n async deleteTransactions(address: string): Promise<void> {\n await this.ensureInit();\n this.realm.write(() => {\n const toDelete = this.realm\n .objects(\"ArkTransaction\")\n .filtered(\"address == $0\", address);\n this.realm.delete(toDelete);\n });\n }\n\n // ── Wallet state ───────────────────────────────────────────────────\n\n async getWalletState(): Promise<WalletState | null> {\n await this.ensureInit();\n const results = this.realm\n .objects<WalletStateObject>(\"ArkWalletState\")\n .filtered(\"key == $0\", \"state\");\n const items = [...results];\n if (items.length === 0) return null;\n\n const obj = items[0];\n const state: WalletState = {};\n if (obj.settingsJson) {\n state.settings = JSON.parse(obj.settingsJson);\n }\n state.lastSyncTime = obj.lastSyncTime ?? undefined;\n return state;\n }\n\n async saveWalletState(state: WalletState): Promise<void> {\n await this.ensureInit();\n this.realm.write(() => {\n this.realm.create(\n \"ArkWalletState\",\n {\n key: \"state\",\n lastSyncTime: state.lastSyncTime,\n settingsJson: state.settings ? JSON.stringify(state.settings) : null,\n },\n \"modified\",\n );\n });\n }\n}\n\ninterface WalletStateObject {\n key: string;\n lastSyncTime: number | null;\n settingsJson: string | null;\n}\n\n// ── Realm object → Domain converters ─────────────────────────────────────\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction vtxoObjectToDomain(obj: any): ExtendedVirtualCoin {\n const serialized = {\n txid: obj.txid,\n vout: obj.vout,\n value: obj.value,\n tapTree: obj.tapTree,\n forfeitTapLeafScript: {\n cb: obj.forfeitCb,\n s: obj.forfeitS,\n } as SerializedTapLeaf,\n intentTapLeafScript: {\n cb: obj.intentCb,\n s: obj.intentS,\n } as SerializedTapLeaf,\n status: JSON.parse(obj.statusJson),\n virtualStatus: JSON.parse(obj.virtualStatusJson),\n createdAt: new Date(obj.createdAt),\n isUnrolled: obj.isUnrolled,\n isSpent: obj.isSpent === null ? undefined : obj.isSpent,\n spentBy: obj.spentBy ?? undefined,\n settledBy: obj.settledBy ?? undefined,\n arkTxId: obj.arkTxId ?? undefined,\n extraWitness: obj.extraWitnessJson ? JSON.parse(obj.extraWitnessJson) : undefined,\n assets: obj.assetsJson ? JSON.parse(obj.assetsJson) : undefined,\n // Post-migration every row has `script`, but the backfill is\n // idempotent: derive from `address` if the legacy column is still\n // null (e.g. the migration hasn't run yet on this handle).\n script: obj.script ?? scriptFromArkAddress(obj.address),\n };\n\n return deserializeVtxo(serialized);\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction utxoObjectToDomain(obj: any): ExtendedCoin {\n const serialized = {\n txid: obj.txid,\n vout: obj.vout,\n value: obj.value,\n tapTree: obj.tapTree,\n forfeitTapLeafScript: {\n cb: obj.forfeitCb,\n s: obj.forfeitS,\n } as SerializedTapLeaf,\n intentTapLeafScript: {\n cb: obj.intentCb,\n s: obj.intentS,\n } as SerializedTapLeaf,\n status: JSON.parse(obj.statusJson),\n extraWitness: obj.extraWitnessJson ? JSON.parse(obj.extraWitnessJson) : undefined,\n };\n\n return deserializeUtxo(serialized);\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction txObjectToDomain(obj: any): ArkTransaction {\n const tx: ArkTransaction = {\n key: {\n boardingTxid: obj.boardingTxid,\n commitmentTxid: obj.commitmentTxid,\n arkTxid: obj.arkTxid,\n },\n type: obj.type as ArkTransaction[\"type\"],\n amount: obj.amount,\n settled: obj.settled,\n createdAt: obj.createdAt,\n };\n if (obj.assetsJson) {\n tx.assets = deserializeAssets(JSON.parse(obj.assetsJson));\n }\n return tx;\n}\n","import { Contract, ContractState } from \"../../contracts/types\";\nimport { ContractFilter, ContractRepository } from \"../contractRepository\";\nimport { RealmLike } from \"./types\";\n\n/**\n * Realm-based implementation of ContractRepository.\n *\n * Consumers must open Realm with the schemas from `./schemas.ts` and pass\n * the instance to the constructor.\n *\n * Realm handles schema creation on open, so `ensureInit()` is a no-op.\n * The consumer owns the Realm lifecycle — `[Symbol.asyncDispose]` is a no-op.\n */\nexport class RealmContractRepository implements ContractRepository {\n readonly version = 1 as const;\n\n constructor(private readonly realm: RealmLike) {}\n\n // ── Lifecycle ──────────────────────────────────────────────────────\n\n private async ensureInit(): Promise<void> {\n // Realm handles schema on open — nothing to initialise.\n }\n\n async [Symbol.asyncDispose](): Promise<void> {\n // no-op — consumer owns the Realm lifecycle\n }\n\n // ── Clear ──────────────────────────────────────────────────────────\n\n async clear(): Promise<void> {\n await this.ensureInit();\n this.realm.write(() => {\n this.realm.delete(this.realm.objects(\"ArkContract\"));\n });\n }\n\n // ── Contract management ────────────────────────────────────────────\n\n async getContracts(filter?: ContractFilter): Promise<Contract[]> {\n await this.ensureInit();\n\n let results = this.realm.objects(\"ArkContract\");\n\n if (filter) {\n const filterParts: string[] = [];\n const filterArgs: unknown[] = [];\n\n let argIndex = 0;\n argIndex = this.addFilterCondition(\n filterParts,\n filterArgs,\n \"script\",\n filter.script,\n argIndex,\n );\n argIndex = this.addFilterCondition(\n filterParts,\n filterArgs,\n \"state\",\n filter.state,\n argIndex,\n );\n argIndex = this.addFilterCondition(\n filterParts,\n filterArgs,\n \"type\",\n filter.type,\n argIndex,\n );\n\n if (filterParts.length > 0) {\n const query = filterParts.join(\" AND \");\n results = results.filtered(query, ...filterArgs);\n }\n }\n\n return [...results].map(contractObjectToDomain);\n }\n\n async saveContract(contract: Contract): Promise<void> {\n await this.ensureInit();\n this.realm.write(() => {\n this.realm.create(\n \"ArkContract\",\n {\n script: contract.script,\n address: contract.address,\n type: contract.type,\n state: contract.state,\n paramsJson: JSON.stringify(contract.params),\n createdAt: contract.createdAt,\n label: contract.label ?? null,\n metadataJson: contract.metadata ? JSON.stringify(contract.metadata) : null,\n },\n \"modified\",\n );\n });\n }\n\n async deleteContract(script: string): Promise<void> {\n await this.ensureInit();\n this.realm.write(() => {\n const toDelete = this.realm.objects(\"ArkContract\").filtered(\"script == $0\", script);\n this.realm.delete(toDelete);\n });\n }\n\n // ── Helpers ─────────────────────────────────────────────────────────\n\n private addFilterCondition(\n parts: string[],\n args: unknown[],\n column: string,\n value: string | string[] | undefined,\n argIndex: number,\n ): number {\n if (value === undefined) return argIndex;\n\n if (Array.isArray(value)) {\n if (value.length === 0) return argIndex;\n const conditions = value.map((_, i) => {\n return `${column} == $${argIndex + i}`;\n });\n parts.push(`(${conditions.join(\" OR \")})`);\n args.push(...value);\n return argIndex + value.length;\n } else {\n parts.push(`${column} == $${argIndex}`);\n args.push(value);\n return argIndex + 1;\n }\n }\n}\n\n// ── Realm object → Domain converter ──────────────────────────────────────\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction contractObjectToDomain(obj: any): Contract {\n const contract: Contract = {\n script: obj.script,\n address: obj.address,\n type: obj.type,\n state: obj.state as ContractState,\n params: JSON.parse(obj.paramsJson),\n createdAt: obj.createdAt,\n };\n\n if (obj.label !== null && obj.label !== undefined) {\n contract.label = obj.label;\n }\n if (obj.metadataJson !== null && obj.metadataJson !== undefined) {\n contract.metadata = JSON.parse(obj.metadataJson);\n }\n\n return contract;\n}\n","/**\n * Realm object schemas for the Arkade wallet.\n *\n * All schema names are prefixed with \"Ark\" to avoid collisions with\n * other Realm schemas in the consuming application.\n *\n * Since `realm` is a peer dependency (not installed in this package),\n * schemas are defined as plain JS objects conforming to Realm's\n * ObjectSchema shape.\n */\n\nimport { scriptFromArkAddress } from \"../scriptFromAddress\";\n\nexport const ArkVtxoSchema = {\n name: \"ArkVtxo\",\n primaryKey: \"pk\",\n properties: {\n pk: \"string\", // composite: `${txid}:${vout}`\n address: { type: \"string\", indexed: true },\n txid: \"string\",\n vout: \"int\",\n value: \"int\",\n tapTree: \"string\", // hex-encoded\n forfeitCb: \"string\",\n forfeitS: \"string\",\n intentCb: \"string\",\n intentS: \"string\",\n extraWitnessJson: \"string?\",\n statusJson: \"string\",\n virtualStatusJson: \"string\",\n spentBy: \"string?\",\n settledBy: \"string?\",\n arkTxId: \"string?\",\n createdAt: \"string\", // ISO 8601\n isUnrolled: \"bool\",\n isSpent: \"bool?\",\n assetsJson: \"string?\",\n // scriptPubKey (hex) locking this VTXO, indexed so contract-scoped\n // queries can resolve ownership without touching address mapping.\n // Required as of schema v2; legacy rows are backfilled from `address`\n // during migration (see `runArkRealmMigrations`).\n script: { type: \"string\", indexed: true },\n },\n} as const;\n\nexport const ArkUtxoSchema = {\n name: \"ArkUtxo\",\n primaryKey: \"pk\",\n properties: {\n pk: \"string\", // composite: `${txid}:${vout}`\n address: { type: \"string\", indexed: true },\n txid: \"string\",\n vout: \"int\",\n value: \"int\",\n tapTree: \"string\", // hex-encoded\n forfeitCb: \"string\",\n forfeitS: \"string\",\n intentCb: \"string\",\n intentS: \"string\",\n extraWitnessJson: \"string?\",\n statusJson: \"string\",\n },\n} as const;\n\nexport const ArkTransactionSchema = {\n name: \"ArkTransaction\",\n primaryKey: \"pk\",\n properties: {\n pk: \"string\", // composite: `${address}:${boardingTxid}:${commitmentTxid}:${arkTxid}`\n address: { type: \"string\", indexed: true },\n boardingTxid: \"string\",\n commitmentTxid: \"string\",\n arkTxid: \"string\",\n type: \"string\",\n amount: \"int\",\n settled: \"bool\",\n createdAt: \"int\",\n assetsJson: \"string?\",\n },\n} as const;\n\nexport const ArkWalletStateSchema = {\n name: \"ArkWalletState\",\n primaryKey: \"key\",\n properties: {\n key: \"string\",\n lastSyncTime: \"int?\",\n settingsJson: \"string?\",\n },\n} as const;\n\nexport const ArkContractSchema = {\n name: \"ArkContract\",\n primaryKey: \"script\",\n properties: {\n script: \"string\",\n address: \"string\",\n type: { type: \"string\", indexed: true },\n state: { type: \"string\", indexed: true },\n paramsJson: \"string\",\n createdAt: \"int\",\n expiresAt: \"int?\",\n label: \"string?\",\n metadataJson: \"string?\",\n },\n} as const;\n\n/**\n * All Realm schemas needed by the Arkade wallet repositories.\n * Pass this array to your Realm configuration's `schema` property.\n */\nexport const ArkRealmSchemas = [\n ArkVtxoSchema,\n ArkUtxoSchema,\n ArkTransactionSchema,\n ArkWalletStateSchema,\n ArkContractSchema,\n];\n\n/**\n * Current Realm schema version for the Arkade wallet.\n *\n * Consumers opening Realm must pass a `schemaVersion` at least this high so\n * legacy databases get migrated; merge it with your own app's version:\n *\n * ```ts\n * await Realm.open({\n * schema: [...ArkRealmSchemas, ...yourSchemas],\n * schemaVersion: Math.max(ARK_REALM_SCHEMA_VERSION, yourSchemaVersion),\n * onMigration: (oldRealm, newRealm) => {\n * runArkRealmMigrations(oldRealm, newRealm);\n * // your own migrations\n * },\n * });\n * ```\n *\n * History:\n * - v1: initial ArkVtxo/ArkUtxo/... schemas, `script` nullable.\n * - v2: ArkVtxo.script becomes required; NULL values are backfilled from\n * the owning Ark address during migration.\n */\nexport const ARK_REALM_SCHEMA_VERSION = 2;\n\n/**\n * Run every Arkade schema migration applicable to the open Realm.\n *\n * Designed to be composed with the consumer's own migrations inside a single\n * `onMigration` callback. Each migration step does a per-row check so it\n * remains idempotent and independent of the app's global `schemaVersion` —\n * a consumer whose app is already at version 10 can still trigger the\n * Arkade v1→v2 script backfill when the row has never been populated.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function runArkRealmMigrations(_oldRealm: any, newRealm: any): void {\n const newVtxos = newRealm.objects(\"ArkVtxo\");\n for (let i = 0; i < newVtxos.length; i++) {\n const newVtxo = newVtxos[i];\n if (!newVtxo.script) {\n newVtxo.script = scriptFromArkAddress(newVtxo.address);\n }\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { W as WalletRepository, E as ExtendedVirtualCoin,
|
|
1
|
+
import { W as WalletRepository, E as ExtendedVirtualCoin, s as VtxoRepositoryKey, d as ExtendedCoin, A as ArkTransaction, t as WalletState, C as ContractRepository, u as ContractFilter, r as Contract } from '../../ark-D6sau_6-.cjs';
|
|
2
2
|
import '@scure/btc-signer/transaction.js';
|
|
3
3
|
import '@scure/btc-signer/utils.js';
|
|
4
4
|
import '@scure/btc-signer/psbt.js';
|
|
@@ -212,6 +212,6 @@ declare const ARK_REALM_SCHEMA_VERSION = 2;
|
|
|
212
212
|
* a consumer whose app is already at version 10 can still trigger the
|
|
213
213
|
* Arkade v1→v2 script backfill when the row has never been populated.
|
|
214
214
|
*/
|
|
215
|
-
declare function runArkRealmMigrations(
|
|
215
|
+
declare function runArkRealmMigrations(_oldRealm: any, newRealm: any): void;
|
|
216
216
|
|
|
217
217
|
export { ARK_REALM_SCHEMA_VERSION, ArkRealmSchemas, RealmContractRepository, type RealmLike, type RealmResults, RealmWalletRepository, runArkRealmMigrations };
|