@arkade-os/sdk 0.4.52 → 0.4.53
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.js +2 -2
- package/dist/adapters/indexedDB.cjs +3 -3
- package/dist/adapters/indexedDB.js +2 -2
- package/dist/{asyncStorageTaskQueue-DScPdQAy.d.cts → asyncStorageTaskQueue-B0SUQMXw.d.cts} +2 -2
- package/dist/{asyncStorageTaskQueue-BImF14sj.d.ts → asyncStorageTaskQueue-DWqxuIAs.d.ts} +2 -2
- package/dist/{chunk-AXCKRS2D.js → chunk-3MMUKLCI.js} +10 -10
- package/dist/{chunk-AXCKRS2D.js.map → chunk-3MMUKLCI.js.map} +1 -1
- package/dist/{chunk-WIVQWYPZ.js → chunk-3XWDMLOI.js} +3 -3
- package/dist/{chunk-WIVQWYPZ.js.map → chunk-3XWDMLOI.js.map} +1 -1
- package/dist/{chunk-ML33GFCH.cjs → chunk-3YC3LQ2E.cjs} +116 -114
- package/dist/{chunk-ML33GFCH.cjs.map → chunk-3YC3LQ2E.cjs.map} +1 -1
- package/dist/{chunk-E6RT5XYB.cjs → chunk-4GB73TRR.cjs} +11 -11
- package/dist/{chunk-E6RT5XYB.cjs.map → chunk-4GB73TRR.cjs.map} +1 -1
- package/dist/{chunk-3ZGANANS.js → chunk-B4WZOJAI.js} +3 -3
- package/dist/{chunk-3ZGANANS.js.map → chunk-B4WZOJAI.js.map} +1 -1
- package/dist/{chunk-3Z5HK35D.cjs → chunk-CZTQLA55.cjs} +7 -7
- package/dist/{chunk-3Z5HK35D.cjs.map → chunk-CZTQLA55.cjs.map} +1 -1
- package/dist/{chunk-ZK3JITHP.js → chunk-LHYNNDY6.js} +3 -3
- package/dist/{chunk-ZK3JITHP.js.map → chunk-LHYNNDY6.js.map} +1 -1
- package/dist/{chunk-FZPYPEWN.cjs → chunk-RNMLFY2V.cjs} +3 -3
- package/dist/{chunk-FZPYPEWN.cjs.map → chunk-RNMLFY2V.cjs.map} +1 -1
- package/dist/index.cjs +154 -146
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -2
- package/dist/repositories/realm/index.cjs +17 -17
- package/dist/repositories/realm/index.js +3 -3
- package/dist/repositories/sqlite/index.cjs +16 -16
- package/dist/repositories/sqlite/index.js +3 -3
- package/dist/{taskRunner-ClwI8jU8.d.cts → taskRunner-B7svzMhT.d.cts} +1 -1
- package/dist/{taskRunner-Cf80BqSy.d.ts → taskRunner-nzJFH8qb.d.ts} +1 -1
- package/dist/wallet/expo/background.cjs +13 -13
- package/dist/wallet/expo/background.cjs.map +1 -1
- package/dist/wallet/expo/background.d.cts +2 -2
- package/dist/wallet/expo/background.d.ts +2 -2
- package/dist/wallet/expo/background.js +5 -5
- package/dist/wallet/expo/background.js.map +1 -1
- package/dist/wallet/expo/index.cjs +12 -12
- package/dist/wallet/expo/index.d.cts +1 -1
- package/dist/wallet/expo/index.d.ts +1 -1
- package/dist/wallet/expo/index.js +3 -3
- package/dist/worker/expo/index.cjs +7 -7
- package/dist/worker/expo/index.d.cts +3 -3
- package/dist/worker/expo/index.d.ts +3 -3
- package/dist/worker/expo/index.js +3 -3
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -5016,6 +5016,8 @@ declare class MessageBusInitializingError extends MessageBusNotInitializedError
|
|
|
5016
5016
|
declare class ServiceWorkerTimeoutError extends Error {
|
|
5017
5017
|
constructor(detail: string);
|
|
5018
5018
|
}
|
|
5019
|
+
declare function isMessageBusNotInitializedError(error: unknown): boolean;
|
|
5020
|
+
declare function isMessageBusInitializingError(error: unknown): boolean;
|
|
5019
5021
|
|
|
5020
5022
|
declare class ReadonlyAssetManager implements IReadonlyAssetManager {
|
|
5021
5023
|
readonly indexer: IndexerProvider;
|
|
@@ -5084,4 +5086,4 @@ declare class AssetManager extends ReadonlyAssetManager implements IAssetManager
|
|
|
5084
5086
|
burn(params: BurnParams): Promise<string>;
|
|
5085
5087
|
}
|
|
5086
5088
|
|
|
5087
|
-
export { ARKADE_MAGIC, Activity, ActivityRegistry, type AnchorBumper, ArkAddress, ArkIntent, ArkNote, ArkProvider, type ArkPsbtFieldCoder, ArkPsbtFieldKey, ArkPsbtFieldKeyType, ArkTransaction, type ArkTxInput, type ArkadeBatchInput, ArkadeCash, ArkadeContractParams, type ArkadeExtendedCoin, type ArkadeExtendedVirtualCoin, Asset, AssetDetails, AssetManager, BIP322, Batch, BurnParams, CSVMultisigTapscript, ChainTx, Coin, ConditionWitness, type ConnectorTreeNode, Contract, ContractEvent, ContractRepository, ContractRepositoryImpl, ContractSyncState, ContractWatcherConfig, ContractWithVtxos, CosignerPublicKey, CreateContractParams, DEFAULT_MESSAGE_TIMEOUTS, DefaultVtxo, 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, type EmulatorEntry, type EmulatorInfo, EmulatorPacket, type EmulatorProvider, EncodedVtxoScript, Estimator, type ExecutorEvent, type ExitDelay, type ExitFeeWallet, type ExitMode, type ExitOptions, type ExitPackage, type ExitQuote, type ExitStep, type ExitTotals, type ExitVtxoInfo, ExplorerTransaction, ExtendedCoin, ExtendedVirtualCoin, Extension, ExtensionNotFoundError, type ExtensionPacket, FeeAmount, FeeInfo, FeeOutput, FetchError, GetVtxosFilter, HDDescriptorProvider, IAssetManager, IContractManager, IDelegateManager, IReadonlyAssetManager, IReadonlyWallet, IVtxoManager, IWallet, Identity, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexedDBWalletRepository, IndexerProvider, Intent, IntentFeeConfig, IntentFilter, IntentRepository, IssuanceParams, IssuanceResult, MESSAGE_BUS_INITIALIZING, MESSAGE_BUS_NOT_INITIALIZED, MIGRATION_KEY, MessageBus, MessageBusInitializingError, 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, PrevArkTxField, PrevoutTxField, ProviderConnectionState, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlyIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, Recipient, ReissuanceParams, RelativeTimelock, RenewVtxosOptions, type RequestEnvelope, type ResponseEnvelope, RestEmulatorProvider, SeedIdentity, type SeedIdentityOptions, SendBitcoinParams, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, type ServiceWorkerWalletMode, SettleParams, SettlementConfig, SettlementEvent, SignerSession, SignerStatus, SingleKey, Status, StorageConfig, TapLeafScript, Transaction, TxTree, TxWeightEstimator, UnilateralExit, UnknownPacket, Unroll, type VSize, VirtualCoin, VirtualTx, VirtualTxRepository, VtxoBranch, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, Wallet, WalletBalance, WalletMessageHandler, WalletNotInitializedError, WalletRepository, WalletRepositoryImpl, WsElectrumChainSource, index as arkade, assembleBtcdTaprootTree, index$1 as asset, buildForfeitTx, buildOffchainTx, buildVersion, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, createAssetPacket, decodeArkContract, deserializeExitPackage, encodeArkContract, getArkPsbtFields, getMigrationStatus, getRandomId, hasBoardingTxExpired, isArkContract, isCltvSatisfied, isCsvSpendable, isRetryableProviderError, isValidArkAddress, migrateWalletRepository, openDatabase, requiresMigration, rollbackMigration, sdkVersion, selectCoinsWithAsset, sequenceToTimelock, serializeExitPackage, setArkPsbtField, setupServiceWorker, timelockToSequence, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures };
|
|
5089
|
+
export { ARKADE_MAGIC, Activity, ActivityRegistry, type AnchorBumper, ArkAddress, ArkIntent, ArkNote, ArkProvider, type ArkPsbtFieldCoder, ArkPsbtFieldKey, ArkPsbtFieldKeyType, ArkTransaction, type ArkTxInput, type ArkadeBatchInput, ArkadeCash, ArkadeContractParams, type ArkadeExtendedCoin, type ArkadeExtendedVirtualCoin, Asset, AssetDetails, AssetManager, BIP322, Batch, BurnParams, CSVMultisigTapscript, ChainTx, Coin, ConditionWitness, type ConnectorTreeNode, Contract, ContractEvent, ContractRepository, ContractRepositoryImpl, ContractSyncState, ContractWatcherConfig, ContractWithVtxos, CosignerPublicKey, CreateContractParams, DEFAULT_MESSAGE_TIMEOUTS, DefaultVtxo, 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, type EmulatorEntry, type EmulatorInfo, EmulatorPacket, type EmulatorProvider, EncodedVtxoScript, Estimator, type ExecutorEvent, type ExitDelay, type ExitFeeWallet, type ExitMode, type ExitOptions, type ExitPackage, type ExitQuote, type ExitStep, type ExitTotals, type ExitVtxoInfo, ExplorerTransaction, ExtendedCoin, ExtendedVirtualCoin, Extension, ExtensionNotFoundError, type ExtensionPacket, FeeAmount, FeeInfo, FeeOutput, FetchError, GetVtxosFilter, HDDescriptorProvider, IAssetManager, IContractManager, IDelegateManager, IReadonlyAssetManager, IReadonlyWallet, IVtxoManager, IWallet, Identity, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexedDBWalletRepository, IndexerProvider, Intent, IntentFeeConfig, IntentFilter, IntentRepository, IssuanceParams, IssuanceResult, MESSAGE_BUS_INITIALIZING, MESSAGE_BUS_NOT_INITIALIZED, MIGRATION_KEY, MessageBus, MessageBusInitializingError, 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, PrevArkTxField, PrevoutTxField, ProviderConnectionState, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlyIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, Recipient, ReissuanceParams, RelativeTimelock, RenewVtxosOptions, type RequestEnvelope, type ResponseEnvelope, RestEmulatorProvider, SeedIdentity, type SeedIdentityOptions, SendBitcoinParams, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, type ServiceWorkerWalletMode, SettleParams, SettlementConfig, SettlementEvent, SignerSession, SignerStatus, SingleKey, Status, StorageConfig, TapLeafScript, Transaction, TxTree, TxWeightEstimator, UnilateralExit, UnknownPacket, Unroll, type VSize, VirtualCoin, VirtualTx, VirtualTxRepository, VtxoBranch, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, Wallet, WalletBalance, WalletMessageHandler, WalletNotInitializedError, WalletRepository, WalletRepositoryImpl, WsElectrumChainSource, index as arkade, assembleBtcdTaprootTree, index$1 as asset, buildForfeitTx, buildOffchainTx, buildVersion, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, createAssetPacket, decodeArkContract, deserializeExitPackage, encodeArkContract, getArkPsbtFields, getMigrationStatus, getRandomId, hasBoardingTxExpired, isArkContract, isCltvSatisfied, isCsvSpendable, isMessageBusInitializingError, isMessageBusNotInitializedError, isRetryableProviderError, isValidArkAddress, migrateWalletRepository, openDatabase, requiresMigration, rollbackMigration, sdkVersion, selectCoinsWithAsset, sequenceToTimelock, serializeExitPackage, setArkPsbtField, setupServiceWorker, timelockToSequence, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures };
|
package/dist/index.d.ts
CHANGED
|
@@ -5016,6 +5016,8 @@ declare class MessageBusInitializingError extends MessageBusNotInitializedError
|
|
|
5016
5016
|
declare class ServiceWorkerTimeoutError extends Error {
|
|
5017
5017
|
constructor(detail: string);
|
|
5018
5018
|
}
|
|
5019
|
+
declare function isMessageBusNotInitializedError(error: unknown): boolean;
|
|
5020
|
+
declare function isMessageBusInitializingError(error: unknown): boolean;
|
|
5019
5021
|
|
|
5020
5022
|
declare class ReadonlyAssetManager implements IReadonlyAssetManager {
|
|
5021
5023
|
readonly indexer: IndexerProvider;
|
|
@@ -5084,4 +5086,4 @@ declare class AssetManager extends ReadonlyAssetManager implements IAssetManager
|
|
|
5084
5086
|
burn(params: BurnParams): Promise<string>;
|
|
5085
5087
|
}
|
|
5086
5088
|
|
|
5087
|
-
export { ARKADE_MAGIC, Activity, ActivityRegistry, type AnchorBumper, ArkAddress, ArkIntent, ArkNote, ArkProvider, type ArkPsbtFieldCoder, ArkPsbtFieldKey, ArkPsbtFieldKeyType, ArkTransaction, type ArkTxInput, type ArkadeBatchInput, ArkadeCash, ArkadeContractParams, type ArkadeExtendedCoin, type ArkadeExtendedVirtualCoin, Asset, AssetDetails, AssetManager, BIP322, Batch, BurnParams, CSVMultisigTapscript, ChainTx, Coin, ConditionWitness, type ConnectorTreeNode, Contract, ContractEvent, ContractRepository, ContractRepositoryImpl, ContractSyncState, ContractWatcherConfig, ContractWithVtxos, CosignerPublicKey, CreateContractParams, DEFAULT_MESSAGE_TIMEOUTS, DefaultVtxo, 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, type EmulatorEntry, type EmulatorInfo, EmulatorPacket, type EmulatorProvider, EncodedVtxoScript, Estimator, type ExecutorEvent, type ExitDelay, type ExitFeeWallet, type ExitMode, type ExitOptions, type ExitPackage, type ExitQuote, type ExitStep, type ExitTotals, type ExitVtxoInfo, ExplorerTransaction, ExtendedCoin, ExtendedVirtualCoin, Extension, ExtensionNotFoundError, type ExtensionPacket, FeeAmount, FeeInfo, FeeOutput, FetchError, GetVtxosFilter, HDDescriptorProvider, IAssetManager, IContractManager, IDelegateManager, IReadonlyAssetManager, IReadonlyWallet, IVtxoManager, IWallet, Identity, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexedDBWalletRepository, IndexerProvider, Intent, IntentFeeConfig, IntentFilter, IntentRepository, IssuanceParams, IssuanceResult, MESSAGE_BUS_INITIALIZING, MESSAGE_BUS_NOT_INITIALIZED, MIGRATION_KEY, MessageBus, MessageBusInitializingError, 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, PrevArkTxField, PrevoutTxField, ProviderConnectionState, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlyIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, Recipient, ReissuanceParams, RelativeTimelock, RenewVtxosOptions, type RequestEnvelope, type ResponseEnvelope, RestEmulatorProvider, SeedIdentity, type SeedIdentityOptions, SendBitcoinParams, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, type ServiceWorkerWalletMode, SettleParams, SettlementConfig, SettlementEvent, SignerSession, SignerStatus, SingleKey, Status, StorageConfig, TapLeafScript, Transaction, TxTree, TxWeightEstimator, UnilateralExit, UnknownPacket, Unroll, type VSize, VirtualCoin, VirtualTx, VirtualTxRepository, VtxoBranch, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, Wallet, WalletBalance, WalletMessageHandler, WalletNotInitializedError, WalletRepository, WalletRepositoryImpl, WsElectrumChainSource, index as arkade, assembleBtcdTaprootTree, index$1 as asset, buildForfeitTx, buildOffchainTx, buildVersion, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, createAssetPacket, decodeArkContract, deserializeExitPackage, encodeArkContract, getArkPsbtFields, getMigrationStatus, getRandomId, hasBoardingTxExpired, isArkContract, isCltvSatisfied, isCsvSpendable, isRetryableProviderError, isValidArkAddress, migrateWalletRepository, openDatabase, requiresMigration, rollbackMigration, sdkVersion, selectCoinsWithAsset, sequenceToTimelock, serializeExitPackage, setArkPsbtField, setupServiceWorker, timelockToSequence, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures };
|
|
5089
|
+
export { ARKADE_MAGIC, Activity, ActivityRegistry, type AnchorBumper, ArkAddress, ArkIntent, ArkNote, ArkProvider, type ArkPsbtFieldCoder, ArkPsbtFieldKey, ArkPsbtFieldKeyType, ArkTransaction, type ArkTxInput, type ArkadeBatchInput, ArkadeCash, ArkadeContractParams, type ArkadeExtendedCoin, type ArkadeExtendedVirtualCoin, Asset, AssetDetails, AssetManager, BIP322, Batch, BurnParams, CSVMultisigTapscript, ChainTx, Coin, ConditionWitness, type ConnectorTreeNode, Contract, ContractEvent, ContractRepository, ContractRepositoryImpl, ContractSyncState, ContractWatcherConfig, ContractWithVtxos, CosignerPublicKey, CreateContractParams, DEFAULT_MESSAGE_TIMEOUTS, DefaultVtxo, 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, type EmulatorEntry, type EmulatorInfo, EmulatorPacket, type EmulatorProvider, EncodedVtxoScript, Estimator, type ExecutorEvent, type ExitDelay, type ExitFeeWallet, type ExitMode, type ExitOptions, type ExitPackage, type ExitQuote, type ExitStep, type ExitTotals, type ExitVtxoInfo, ExplorerTransaction, ExtendedCoin, ExtendedVirtualCoin, Extension, ExtensionNotFoundError, type ExtensionPacket, FeeAmount, FeeInfo, FeeOutput, FetchError, GetVtxosFilter, HDDescriptorProvider, IAssetManager, IContractManager, IDelegateManager, IReadonlyAssetManager, IReadonlyWallet, IVtxoManager, IWallet, Identity, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexedDBWalletRepository, IndexerProvider, Intent, IntentFeeConfig, IntentFilter, IntentRepository, IssuanceParams, IssuanceResult, MESSAGE_BUS_INITIALIZING, MESSAGE_BUS_NOT_INITIALIZED, MIGRATION_KEY, MessageBus, MessageBusInitializingError, 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, PrevArkTxField, PrevoutTxField, ProviderConnectionState, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlyIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, Recipient, ReissuanceParams, RelativeTimelock, RenewVtxosOptions, type RequestEnvelope, type ResponseEnvelope, RestEmulatorProvider, SeedIdentity, type SeedIdentityOptions, SendBitcoinParams, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, type ServiceWorkerWalletMode, SettleParams, SettlementConfig, SettlementEvent, SignerSession, SignerStatus, SingleKey, Status, StorageConfig, TapLeafScript, Transaction, TxTree, TxWeightEstimator, UnilateralExit, UnknownPacket, Unroll, type VSize, VirtualCoin, VirtualTx, VirtualTxRepository, VtxoBranch, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, Wallet, WalletBalance, WalletMessageHandler, WalletNotInitializedError, WalletRepository, WalletRepositoryImpl, WsElectrumChainSource, index as arkade, assembleBtcdTaprootTree, index$1 as asset, buildForfeitTx, buildOffchainTx, buildVersion, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, createAssetPacket, decodeArkContract, deserializeExitPackage, encodeArkContract, getArkPsbtFields, getMigrationStatus, getRandomId, hasBoardingTxExpired, isArkContract, isCltvSatisfied, isCsvSpendable, isMessageBusInitializingError, isMessageBusNotInitializedError, isRetryableProviderError, isValidArkAddress, migrateWalletRepository, openDatabase, requiresMigration, rollbackMigration, sdkVersion, selectCoinsWithAsset, sequenceToTimelock, serializeExitPackage, setArkPsbtField, setupServiceWorker, timelockToSequence, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { ARKADE_MAGIC, ActivityRegistry, ArkNote, ArkadeCash, ArkadeCashCreateError, AssetManager, BIP322, Batch, ChainedTxType, ContractManager, ContractRepositoryImpl, ContractWatcher, DEFAULT_MESSAGE_TIMEOUTS, DelegateManagerImpl, DelegateNotConfiguredError, DelegatorManagerImpl, DelegatorNotConfiguredError, DescriptorSigningProviderMissingError, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, ESPLORA_URL, ElectrumOnchainProvider, EmulatorPacket, EsploraProvider, Estimator, Extension, ExtensionNotFoundError, HDDescriptorProvider, INTENT_TERMINAL_STATES, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexedDBWalletRepository, MESSAGE_BUS_INITIALIZING, MESSAGE_BUS_NOT_INITIALIZED, MIGRATION_KEY, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, MissingSigningDescriptorError, MnemonicIdentity, OnchainWallet, P2A, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, RestDelegateProvider, RestDelegatorProvider, RestEmulatorProvider, SeedIdentity, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, SingleKey, TxTree, TxType, TxWeightEstimator, UnilateralExit, UnknownPacket, Unroll, VtxoManager, Wallet, WalletMessageHandler, WalletNotInitializedError, WalletRepositoryImpl, WsElectrumChainSource, arkade_exports as arkade, boardingResolver, buildForfeitTx, buildOffchainTx, classifyAgainstSignerSet, classifyContractSigner, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, createAssetPacket, createDefaultActivityRegistry, createExitChainResolver, decodeArkContract, deserializeExitPackage, encodeArkContract, getMigrationStatus, getRandomId, hasBoardingTxExpired, hasCandidates, isArkContract, isBatchSignable, isCooperativelyMigratable, isDiscoverable, isRetryableProviderError, isSubdust, isTerminalIntentState, isValidArkAddress, isVtxoExpiringSoon, migrateWalletRepository, openDatabase, requiresMigration, rollbackMigration, selectCoinsWithAsset, selectVirtualCoins, serializeExitPackage, setupServiceWorker, signerSetFromInfo, toXOnlySignerHex, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, waitForIncomingFunds } from './chunk-
|
|
2
|
-
export { ArkError, ArkErrorName, ArkPsbtFieldKey, ArkPsbtFieldKeyType, ChainTxType, ConditionWitness, CosignerPublicKey, DigestMismatchError, FetchError, IndexerTxType, Intent, PrevArkTxField, PrevoutTxField, ProviderUnavailableError, RestArkProvider, RestIndexerProvider, SettlementEventType, Transaction, VtxoTaprootTree, VtxoTreeExpiry, asset_exports as asset, buildVersion, getArkPsbtFields, isArkError, maybeArkError, sdkVersion, setArkPsbtField } from './chunk-
|
|
1
|
+
export { ARKADE_MAGIC, ActivityRegistry, ArkNote, ArkadeCash, ArkadeCashCreateError, AssetManager, BIP322, Batch, ChainedTxType, ContractManager, ContractRepositoryImpl, ContractWatcher, DEFAULT_MESSAGE_TIMEOUTS, DelegateManagerImpl, DelegateNotConfiguredError, DelegatorManagerImpl, DelegatorNotConfiguredError, DescriptorSigningProviderMissingError, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, ESPLORA_URL, ElectrumOnchainProvider, EmulatorPacket, EsploraProvider, Estimator, Extension, ExtensionNotFoundError, HDDescriptorProvider, INTENT_TERMINAL_STATES, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexedDBWalletRepository, MESSAGE_BUS_INITIALIZING, MESSAGE_BUS_NOT_INITIALIZED, MIGRATION_KEY, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, MissingSigningDescriptorError, MnemonicIdentity, OnchainWallet, P2A, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, RestDelegateProvider, RestDelegatorProvider, RestEmulatorProvider, SeedIdentity, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, SingleKey, TxTree, TxType, TxWeightEstimator, UnilateralExit, UnknownPacket, Unroll, VtxoManager, Wallet, WalletMessageHandler, WalletNotInitializedError, WalletRepositoryImpl, WsElectrumChainSource, arkade_exports as arkade, boardingResolver, buildForfeitTx, buildOffchainTx, classifyAgainstSignerSet, classifyContractSigner, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, createAssetPacket, createDefaultActivityRegistry, createExitChainResolver, decodeArkContract, deserializeExitPackage, encodeArkContract, getMigrationStatus, getRandomId, hasBoardingTxExpired, hasCandidates, isArkContract, isBatchSignable, isCooperativelyMigratable, isDiscoverable, isMessageBusInitializingError, isMessageBusNotInitializedError, isRetryableProviderError, isSubdust, isTerminalIntentState, isValidArkAddress, isVtxoExpiringSoon, migrateWalletRepository, openDatabase, requiresMigration, rollbackMigration, selectCoinsWithAsset, selectVirtualCoins, serializeExitPackage, setupServiceWorker, signerSetFromInfo, toXOnlySignerHex, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, waitForIncomingFunds } from './chunk-3MMUKLCI.js';
|
|
2
|
+
export { ArkError, ArkErrorName, ArkPsbtFieldKey, ArkPsbtFieldKeyType, ChainTxType, ConditionWitness, CosignerPublicKey, DigestMismatchError, FetchError, IndexerTxType, Intent, PrevArkTxField, PrevoutTxField, ProviderUnavailableError, RestArkProvider, RestIndexerProvider, SettlementEventType, Transaction, VtxoTaprootTree, VtxoTreeExpiry, asset_exports as asset, buildVersion, getArkPsbtFields, isArkError, maybeArkError, sdkVersion, setArkPsbtField } from './chunk-LHYNNDY6.js';
|
|
3
3
|
export { ArkadeContractHandler, BoardingContractHandler, DefaultContractHandler, DefaultVtxo, DelegateContractHandler, DelegateVtxo, VHTLC, VHTLCContractHandler, contractHandlers, isCltvSatisfied, isCsvSpendable } from './chunk-UZLQUWYP.js';
|
|
4
4
|
export { ArkAddress, CLTVMultisigTapscript, CSVMultisigTapscript, ConditionCSVMultisigTapscript, ConditionMultisigTapscript, MultisigTapscript, TapTreeCoder, VtxoScript, assembleBtcdTaprootTree, canRecoverOnchain, canSpendOffchain, decodeTapscript, getNetwork, getSequence, hasTerminalSpend, isExpired, isPastExpiry, isRecoverable, isSpendable, isVirtualCoin, networks, sequenceToTimelock, timelockToSequence } from './chunk-EFNLTS6Q.js';
|
|
5
5
|
import './chunk-NSBPE2FW.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
3
|
+
var chunk3YC3LQ2E_cjs = require('../../chunk-3YC3LQ2E.cjs');
|
|
4
|
+
require('../../chunk-RNMLFY2V.cjs');
|
|
5
5
|
require('../../chunk-IEMPH7J6.cjs');
|
|
6
6
|
require('../../chunk-E7HB3GKK.cjs');
|
|
7
7
|
require('../../chunk-5BLDMQED.cjs');
|
|
@@ -38,7 +38,7 @@ var RealmWalletRepository = class {
|
|
|
38
38
|
await this.ensureInit();
|
|
39
39
|
this.realm.write(() => {
|
|
40
40
|
for (const vtxo of vtxos) {
|
|
41
|
-
const s =
|
|
41
|
+
const s = chunk3YC3LQ2E_cjs.serializeVtxo(vtxo);
|
|
42
42
|
this.realm.create(
|
|
43
43
|
"ArkVtxo",
|
|
44
44
|
{
|
|
@@ -86,7 +86,7 @@ var RealmWalletRepository = class {
|
|
|
86
86
|
throw new Error("RealmWalletRepository requires an address");
|
|
87
87
|
}
|
|
88
88
|
for (const vtxo of vtxos) {
|
|
89
|
-
if (!
|
|
89
|
+
if (!chunk3YC3LQ2E_cjs.isVtxoForScript(vtxo, key.script)) {
|
|
90
90
|
throw new Error(
|
|
91
91
|
`VTXO ${vtxo.txid}:${vtxo.vout} script mismatch: expected ${key.script}, got ${vtxo.script}`
|
|
92
92
|
);
|
|
@@ -111,7 +111,7 @@ var RealmWalletRepository = class {
|
|
|
111
111
|
await this.ensureInit();
|
|
112
112
|
this.realm.write(() => {
|
|
113
113
|
for (const utxo of utxos) {
|
|
114
|
-
const s =
|
|
114
|
+
const s = chunk3YC3LQ2E_cjs.serializeUtxo(utxo);
|
|
115
115
|
this.realm.create(
|
|
116
116
|
"ArkUtxo",
|
|
117
117
|
{
|
|
@@ -164,7 +164,7 @@ var RealmWalletRepository = class {
|
|
|
164
164
|
amount: tx.amount,
|
|
165
165
|
settled: tx.settled,
|
|
166
166
|
createdAt: tx.createdAt,
|
|
167
|
-
assetsJson: tx.assets ? JSON.stringify(
|
|
167
|
+
assetsJson: tx.assets ? JSON.stringify(chunk3YC3LQ2E_cjs.serializeAssets(tx.assets)) : null
|
|
168
168
|
},
|
|
169
169
|
"modified"
|
|
170
170
|
);
|
|
@@ -234,9 +234,9 @@ function vtxoObjectToDomain(obj) {
|
|
|
234
234
|
// Post-migration every row has `script`, but the backfill is
|
|
235
235
|
// idempotent: derive from `address` if the legacy column is still
|
|
236
236
|
// null (e.g. the migration hasn't run yet on this handle).
|
|
237
|
-
script: obj.script ??
|
|
237
|
+
script: obj.script ?? chunk3YC3LQ2E_cjs.scriptFromArkAddress(obj.address)
|
|
238
238
|
};
|
|
239
|
-
return
|
|
239
|
+
return chunk3YC3LQ2E_cjs.deserializeVtxo(serialized);
|
|
240
240
|
}
|
|
241
241
|
function utxoObjectToDomain(obj) {
|
|
242
242
|
const serialized = {
|
|
@@ -255,7 +255,7 @@ function utxoObjectToDomain(obj) {
|
|
|
255
255
|
status: JSON.parse(obj.statusJson),
|
|
256
256
|
extraWitness: obj.extraWitnessJson ? JSON.parse(obj.extraWitnessJson) : void 0
|
|
257
257
|
};
|
|
258
|
-
return
|
|
258
|
+
return chunk3YC3LQ2E_cjs.deserializeUtxo(serialized);
|
|
259
259
|
}
|
|
260
260
|
function txObjectToDomain(obj) {
|
|
261
261
|
const tx = {
|
|
@@ -270,7 +270,7 @@ function txObjectToDomain(obj) {
|
|
|
270
270
|
createdAt: obj.createdAt
|
|
271
271
|
};
|
|
272
272
|
if (obj.assetsJson) {
|
|
273
|
-
tx.assets =
|
|
273
|
+
tx.assets = chunk3YC3LQ2E_cjs.deserializeAssets(JSON.parse(obj.assetsJson));
|
|
274
274
|
}
|
|
275
275
|
return tx;
|
|
276
276
|
}
|
|
@@ -431,7 +431,7 @@ var RealmIntentRepository = class {
|
|
|
431
431
|
const clashes = [
|
|
432
432
|
...this.realm.objects("ArkIntent").filtered("intentId == $0", intent.intentId)
|
|
433
433
|
].map(toIntent);
|
|
434
|
-
|
|
434
|
+
chunk3YC3LQ2E_cjs.assertIntentIdUnique(intent, clashes);
|
|
435
435
|
}
|
|
436
436
|
this.realm.create(
|
|
437
437
|
"ArkIntent",
|
|
@@ -460,14 +460,14 @@ var RealmIntentRepository = class {
|
|
|
460
460
|
}
|
|
461
461
|
async getIntents(filter) {
|
|
462
462
|
const all = [...this.realm.objects("ArkIntent")].map(toIntent).sort((a, b) => a.createdAt - b.createdAt || a.intentTxId.localeCompare(b.intentTxId));
|
|
463
|
-
const out = filter ? all.filter((i) =>
|
|
464
|
-
const { skip, end } =
|
|
463
|
+
const out = filter ? all.filter((i) => chunk3YC3LQ2E_cjs.intentMatchesFilter(i, filter)) : all;
|
|
464
|
+
const { skip, end } = chunk3YC3LQ2E_cjs.intentPageBounds(filter, out.length);
|
|
465
465
|
return out.slice(skip, end);
|
|
466
466
|
}
|
|
467
467
|
async getLockedVtxoOutpoints() {
|
|
468
468
|
const out = [];
|
|
469
469
|
for (const o of [...this.realm.objects("ArkIntent")].map(toIntent))
|
|
470
|
-
if (!
|
|
470
|
+
if (!chunk3YC3LQ2E_cjs.isTerminalIntentState(o.state)) out.push(...o.intentVtxos);
|
|
471
471
|
return out;
|
|
472
472
|
}
|
|
473
473
|
async [Symbol.asyncDispose]() {
|
|
@@ -509,7 +509,7 @@ var RealmVirtualTxRepository = class {
|
|
|
509
509
|
txid: t.txid,
|
|
510
510
|
psbt: t.psbt ?? prev?.psbt ?? null,
|
|
511
511
|
expiresAt: t.expiresAt ?? prev?.expiresAt ?? null,
|
|
512
|
-
type:
|
|
512
|
+
type: chunk3YC3LQ2E_cjs.mergeChainedTxType(t.type, prev?.type)
|
|
513
513
|
},
|
|
514
514
|
"modified"
|
|
515
515
|
);
|
|
@@ -742,7 +742,7 @@ function runArkRealmMigrations(oldRealm, newRealm) {
|
|
|
742
742
|
for (let i = 0; i < newVtxos.length; i++) {
|
|
743
743
|
const newVtxo = newVtxos[i];
|
|
744
744
|
if (!newVtxo.script) {
|
|
745
|
-
newVtxo.script =
|
|
745
|
+
newVtxo.script = chunk3YC3LQ2E_cjs.scriptFromArkAddress(newVtxo.address);
|
|
746
746
|
}
|
|
747
747
|
}
|
|
748
748
|
const oldHasVirtualTx = Array.isArray(oldRealm?.schema) && oldRealm.schema.some((s) => s.name === "ArkVirtualTx");
|
|
@@ -759,7 +759,7 @@ function runArkRealmMigrations(oldRealm, newRealm) {
|
|
|
759
759
|
|
|
760
760
|
Object.defineProperty(exports, "ChainedTxType", {
|
|
761
761
|
enumerable: true,
|
|
762
|
-
get: function () { return
|
|
762
|
+
get: function () { return chunk3YC3LQ2E_cjs.ChainedTxType; }
|
|
763
763
|
});
|
|
764
764
|
exports.ARK_REALM_SCHEMA_VERSION = ARK_REALM_SCHEMA_VERSION;
|
|
765
765
|
exports.ArkExperimentalRealmSchemas = ArkExperimentalRealmSchemas;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { serializeVtxo, isVtxoForScript, serializeUtxo, serializeAssets, scriptFromArkAddress, deserializeVtxo, deserializeUtxo, deserializeAssets, assertIntentIdUnique, intentMatchesFilter, intentPageBounds, isTerminalIntentState, mergeChainedTxType } from '../../chunk-
|
|
2
|
-
export { ChainedTxType } from '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
1
|
+
import { serializeVtxo, isVtxoForScript, serializeUtxo, serializeAssets, scriptFromArkAddress, deserializeVtxo, deserializeUtxo, deserializeAssets, assertIntentIdUnique, intentMatchesFilter, intentPageBounds, isTerminalIntentState, mergeChainedTxType } from '../../chunk-3MMUKLCI.js';
|
|
2
|
+
export { ChainedTxType } from '../../chunk-3MMUKLCI.js';
|
|
3
|
+
import '../../chunk-LHYNNDY6.js';
|
|
4
4
|
import '../../chunk-UZLQUWYP.js';
|
|
5
5
|
import '../../chunk-EFNLTS6Q.js';
|
|
6
6
|
import '../../chunk-NSBPE2FW.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
3
|
+
var chunk3YC3LQ2E_cjs = require('../../chunk-3YC3LQ2E.cjs');
|
|
4
|
+
require('../../chunk-RNMLFY2V.cjs');
|
|
5
5
|
require('../../chunk-IEMPH7J6.cjs');
|
|
6
6
|
require('../../chunk-E7HB3GKK.cjs');
|
|
7
7
|
require('../../chunk-5BLDMQED.cjs');
|
|
@@ -154,7 +154,7 @@ var SQLiteWalletRepository = class {
|
|
|
154
154
|
for (const row of nullRows) {
|
|
155
155
|
await this.db.run(
|
|
156
156
|
`UPDATE ${this.tables.vtxos} SET script = ? WHERE txid = ? AND vout = ?`,
|
|
157
|
-
[
|
|
157
|
+
[chunk3YC3LQ2E_cjs.scriptFromArkAddress(row.address), row.txid, row.vout]
|
|
158
158
|
);
|
|
159
159
|
}
|
|
160
160
|
const tempName = `${this.tables.vtxos}__migrate_tmp`;
|
|
@@ -225,7 +225,7 @@ var SQLiteWalletRepository = class {
|
|
|
225
225
|
async saveVtxos(address, vtxos) {
|
|
226
226
|
await this.ensureInit();
|
|
227
227
|
for (const vtxo of vtxos) {
|
|
228
|
-
const s =
|
|
228
|
+
const s = chunk3YC3LQ2E_cjs.serializeVtxo(vtxo);
|
|
229
229
|
await this.db.run(
|
|
230
230
|
`INSERT OR REPLACE INTO ${this.tables.vtxos}
|
|
231
231
|
(txid, vout, value, address,
|
|
@@ -280,7 +280,7 @@ var SQLiteWalletRepository = class {
|
|
|
280
280
|
throw new Error("SQLiteWalletRepository requires an address");
|
|
281
281
|
}
|
|
282
282
|
for (const vtxo of vtxos) {
|
|
283
|
-
if (!
|
|
283
|
+
if (!chunk3YC3LQ2E_cjs.isVtxoForScript(vtxo, key.script)) {
|
|
284
284
|
throw new Error(
|
|
285
285
|
`VTXO ${vtxo.txid}:${vtxo.vout} script mismatch: expected ${key.script}, got ${vtxo.script}`
|
|
286
286
|
);
|
|
@@ -304,7 +304,7 @@ var SQLiteWalletRepository = class {
|
|
|
304
304
|
async saveUtxos(address, utxos) {
|
|
305
305
|
await this.ensureInit();
|
|
306
306
|
for (const utxo of utxos) {
|
|
307
|
-
const s =
|
|
307
|
+
const s = chunk3YC3LQ2E_cjs.serializeUtxo(utxo);
|
|
308
308
|
await this.db.run(
|
|
309
309
|
`INSERT OR REPLACE INTO ${this.tables.utxos}
|
|
310
310
|
(txid, vout, value, address,
|
|
@@ -360,7 +360,7 @@ var SQLiteWalletRepository = class {
|
|
|
360
360
|
tx.amount,
|
|
361
361
|
tx.settled ? 1 : 0,
|
|
362
362
|
tx.createdAt,
|
|
363
|
-
tx.assets ? JSON.stringify(
|
|
363
|
+
tx.assets ? JSON.stringify(chunk3YC3LQ2E_cjs.serializeAssets(tx.assets)) : null
|
|
364
364
|
]
|
|
365
365
|
);
|
|
366
366
|
}
|
|
@@ -434,9 +434,9 @@ function vtxoRowToDomain(row) {
|
|
|
434
434
|
// Post-migration every row has `script`, but the backfill is
|
|
435
435
|
// idempotent: derive from `address` if the legacy column is still
|
|
436
436
|
// null (e.g. the migration hasn't run yet on this handle).
|
|
437
|
-
script: row.script ??
|
|
437
|
+
script: row.script ?? chunk3YC3LQ2E_cjs.scriptFromArkAddress(row.address)
|
|
438
438
|
};
|
|
439
|
-
return
|
|
439
|
+
return chunk3YC3LQ2E_cjs.deserializeVtxo(serialized);
|
|
440
440
|
}
|
|
441
441
|
function utxoRowToDomain(row) {
|
|
442
442
|
const serialized = {
|
|
@@ -455,7 +455,7 @@ function utxoRowToDomain(row) {
|
|
|
455
455
|
status: JSON.parse(row.status_json),
|
|
456
456
|
extraWitness: row.extra_witness_json ? JSON.parse(row.extra_witness_json) : void 0
|
|
457
457
|
};
|
|
458
|
-
return
|
|
458
|
+
return chunk3YC3LQ2E_cjs.deserializeUtxo(serialized);
|
|
459
459
|
}
|
|
460
460
|
function txRowToDomain(row) {
|
|
461
461
|
const tx = {
|
|
@@ -470,7 +470,7 @@ function txRowToDomain(row) {
|
|
|
470
470
|
createdAt: row.created_at
|
|
471
471
|
};
|
|
472
472
|
if (row.assets_json) {
|
|
473
|
-
tx.assets =
|
|
473
|
+
tx.assets = chunk3YC3LQ2E_cjs.deserializeAssets(JSON.parse(row.assets_json));
|
|
474
474
|
}
|
|
475
475
|
return tx;
|
|
476
476
|
}
|
|
@@ -718,8 +718,8 @@ var SQLiteIntentRepository = class {
|
|
|
718
718
|
`SELECT * FROM ${this.t} ORDER BY created_at ASC, intent_tx_id ASC`
|
|
719
719
|
);
|
|
720
720
|
let out = rows.map(rowToIntent);
|
|
721
|
-
if (filter) out = out.filter((i) =>
|
|
722
|
-
const { skip, end } =
|
|
721
|
+
if (filter) out = out.filter((i) => chunk3YC3LQ2E_cjs.intentMatchesFilter(i, filter));
|
|
722
|
+
const { skip, end } = chunk3YC3LQ2E_cjs.intentPageBounds(filter, out.length);
|
|
723
723
|
return out.slice(skip, end);
|
|
724
724
|
}
|
|
725
725
|
async getLockedVtxoOutpoints() {
|
|
@@ -727,7 +727,7 @@ var SQLiteIntentRepository = class {
|
|
|
727
727
|
const rows = await this.db.all(`SELECT * FROM ${this.t}`);
|
|
728
728
|
const out = [];
|
|
729
729
|
for (const r of rows) {
|
|
730
|
-
if (
|
|
730
|
+
if (chunk3YC3LQ2E_cjs.isTerminalIntentState(r.state)) continue;
|
|
731
731
|
for (const o of JSON.parse(r.intent_vtxos_json)) out.push(o);
|
|
732
732
|
}
|
|
733
733
|
return out;
|
|
@@ -822,7 +822,7 @@ var SQLiteVirtualTxRepository = class {
|
|
|
822
822
|
const prev = prevByTxid.get(t.txid);
|
|
823
823
|
const psbt = t.psbt ?? prev?.psbt ?? null;
|
|
824
824
|
const expires = t.expiresAt ?? prev?.expires_at ?? null;
|
|
825
|
-
const type =
|
|
825
|
+
const type = chunk3YC3LQ2E_cjs.mergeChainedTxType(t.type, prev?.type);
|
|
826
826
|
await this.db.run(
|
|
827
827
|
`INSERT OR REPLACE INTO ${this.tTx} (txid, psbt, expires_at, type) VALUES (?, ?, ?, ?)`,
|
|
828
828
|
[t.txid, psbt, expires, type]
|
|
@@ -908,7 +908,7 @@ function rowToTx(r) {
|
|
|
908
908
|
|
|
909
909
|
Object.defineProperty(exports, "ChainedTxType", {
|
|
910
910
|
enumerable: true,
|
|
911
|
-
get: function () { return
|
|
911
|
+
get: function () { return chunk3YC3LQ2E_cjs.ChainedTxType; }
|
|
912
912
|
});
|
|
913
913
|
exports.SQLiteContractRepository = SQLiteContractRepository;
|
|
914
914
|
exports.SQLiteIntentRepository = SQLiteIntentRepository;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { serializeVtxo, isVtxoForScript, serializeUtxo, serializeAssets, scriptFromArkAddress, deserializeVtxo, deserializeUtxo, deserializeAssets, intentMatchesFilter, intentPageBounds, isTerminalIntentState, mergeChainedTxType } from '../../chunk-
|
|
2
|
-
export { ChainedTxType } from '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
1
|
+
import { serializeVtxo, isVtxoForScript, serializeUtxo, serializeAssets, scriptFromArkAddress, deserializeVtxo, deserializeUtxo, deserializeAssets, intentMatchesFilter, intentPageBounds, isTerminalIntentState, mergeChainedTxType } from '../../chunk-3MMUKLCI.js';
|
|
2
|
+
export { ChainedTxType } from '../../chunk-3MMUKLCI.js';
|
|
3
|
+
import '../../chunk-LHYNNDY6.js';
|
|
4
4
|
import '../../chunk-UZLQUWYP.js';
|
|
5
5
|
import '../../chunk-EFNLTS6Q.js';
|
|
6
6
|
import '../../chunk-NSBPE2FW.js';
|
|
@@ -111,4 +111,4 @@ interface CreateTaskDependenciesOptions {
|
|
|
111
111
|
*/
|
|
112
112
|
declare function createTaskDependencies(options: CreateTaskDependenciesOptions): TaskDependencies;
|
|
113
113
|
|
|
114
|
-
export { type CreateTaskDependenciesOptions as C, InMemoryTaskQueue as I, type TaskProcessor as T, type
|
|
114
|
+
export { type CreateTaskDependenciesOptions as C, InMemoryTaskQueue as I, type TaskProcessor as T, type TaskQueue as a, type TaskDependencies as b, type TaskItem as c, type TaskResult as d, createTaskDependencies as e, runTasks as r };
|
|
@@ -111,4 +111,4 @@ interface CreateTaskDependenciesOptions {
|
|
|
111
111
|
*/
|
|
112
112
|
declare function createTaskDependencies(options: CreateTaskDependenciesOptions): TaskDependencies;
|
|
113
113
|
|
|
114
|
-
export { type CreateTaskDependenciesOptions as C, InMemoryTaskQueue as I, type TaskProcessor as T, type
|
|
114
|
+
export { type CreateTaskDependenciesOptions as C, InMemoryTaskQueue as I, type TaskProcessor as T, type TaskQueue as a, type TaskDependencies as b, type TaskItem as c, type TaskResult as d, createTaskDependencies as e, runTasks as r };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
require('../../chunk-
|
|
3
|
+
var chunkCZTQLA55_cjs = require('../../chunk-CZTQLA55.cjs');
|
|
4
|
+
var chunk4GB73TRR_cjs = require('../../chunk-4GB73TRR.cjs');
|
|
5
|
+
var chunk3YC3LQ2E_cjs = require('../../chunk-3YC3LQ2E.cjs');
|
|
6
|
+
require('../../chunk-RNMLFY2V.cjs');
|
|
7
7
|
require('../../chunk-IEMPH7J6.cjs');
|
|
8
8
|
require('../../chunk-E7HB3GKK.cjs');
|
|
9
9
|
require('../../chunk-5BLDMQED.cjs');
|
|
@@ -36,7 +36,7 @@ function defineExpoBackgroundTask(taskName, options) {
|
|
|
36
36
|
taskQueue,
|
|
37
37
|
walletRepository,
|
|
38
38
|
contractRepository,
|
|
39
|
-
processors = [
|
|
39
|
+
processors = [chunkCZTQLA55_cjs.contractPollProcessor]
|
|
40
40
|
} = options;
|
|
41
41
|
TaskManager__namespace.defineTask(taskName, async () => {
|
|
42
42
|
try {
|
|
@@ -44,24 +44,24 @@ function defineExpoBackgroundTask(taskName, options) {
|
|
|
44
44
|
if (!config) {
|
|
45
45
|
return BackgroundTask__namespace.BackgroundTaskResult.Success;
|
|
46
46
|
}
|
|
47
|
-
const indexerProvider = new
|
|
48
|
-
const arkProvider = new
|
|
49
|
-
const deps =
|
|
47
|
+
const indexerProvider = new chunk4GB73TRR_cjs.ExpoIndexerProvider(config.arkServerUrl);
|
|
48
|
+
const arkProvider = new chunk4GB73TRR_cjs.ExpoArkProvider(config.arkServerUrl);
|
|
49
|
+
const deps = chunkCZTQLA55_cjs.createTaskDependencies({
|
|
50
50
|
walletRepository,
|
|
51
51
|
contractRepository,
|
|
52
52
|
indexerProvider,
|
|
53
53
|
arkProvider
|
|
54
54
|
});
|
|
55
|
-
await
|
|
55
|
+
await chunkCZTQLA55_cjs.runTasks(taskQueue, processors, deps);
|
|
56
56
|
const results = await taskQueue.getResults();
|
|
57
57
|
if (results.length > 0) {
|
|
58
58
|
await taskQueue.acknowledgeResults(results.map((r) => r.id));
|
|
59
59
|
}
|
|
60
|
-
const existing = await taskQueue.getTasks(
|
|
60
|
+
const existing = await taskQueue.getTasks(chunkCZTQLA55_cjs.CONTRACT_POLL_TASK_TYPE);
|
|
61
61
|
if (existing.length === 0) {
|
|
62
62
|
const task = {
|
|
63
|
-
id:
|
|
64
|
-
type:
|
|
63
|
+
id: chunk3YC3LQ2E_cjs.getRandomId(),
|
|
64
|
+
type: chunkCZTQLA55_cjs.CONTRACT_POLL_TASK_TYPE,
|
|
65
65
|
data: {},
|
|
66
66
|
createdAt: Date.now()
|
|
67
67
|
};
|
|
@@ -79,7 +79,7 @@ function defineExpoBackgroundTask(taskName, options) {
|
|
|
79
79
|
}
|
|
80
80
|
async function registerExpoBackgroundTask(taskName, options) {
|
|
81
81
|
await BackgroundTask__namespace.registerTaskAsync(taskName, {
|
|
82
|
-
minimumInterval:
|
|
82
|
+
minimumInterval: options?.minimumInterval ?? 15
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
async function unregisterExpoBackgroundTask(taskName) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/wallet/expo/background.ts"],"names":["contractPollProcessor","TaskManager","Background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AAG;AACvB,QAAA,MAAM,IAAA,GAAiB;AAAA,UACnB,IAAIC,6BAAA,EAAY;AAAA,UAChB,IAAA,EAAMD,yCAAA;AAAA,UACN,MAAM,EAAC;AAAA,UACP,SAAA,EAAW,KAAK,GAAA;AAAI,SACxB;AACA,QAAA,MAAM,SAAA,CAAU,QAAQ,IAAI,CAAA;AAAA,MAChC;AAEA,MAAA,OAAsBL,yBAAA,CAAA,oBAAA,CAAqB,OAAA;AAAA,IAC/C,SAAS,KAAA,EAAO;AACZ,MAAA,OAAA,CAAQ,KAAA;AAAA,QACJ,mCAAA;AAAA,QACA,KAAA,YAAiB,KAAA,GAAQ,KAAA,CAAM,OAAA,GAAU;AAAA,OAC7C;AACA,MAAA,OAAsBA,yBAAA,CAAA,oBAAA,CAAqB,MAAA;AAAA,IAC/C;AAAA,EACJ,CAAC,CAAA;AACL;AAcA,eAAsB,0BAAA,CAClB,UACA,OAAA,EACa;AACb,EAAA,MAAqBA,4CAAkB,QAAA,EAAU;AAAA,IAC7C,eAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/wallet/expo/background.ts"],"names":["contractPollProcessor","TaskManager","BackgroundTask","ExpoIndexerProvider","ExpoArkProvider","createTaskDependencies","runTasks","CONTRACT_POLL_TASK_TYPE","getRandomId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyFO,SAAS,wBAAA,CACZ,UACA,OAAA,EACI;AACJ,EAAA,MAAM;AAAA,IACF,SAAA;AAAA,IACA,gBAAA;AAAA,IACA,kBAAA;AAAA,IACA,UAAA,GAAa,CAACA,uCAAqB;AAAA,GACvC,GAAI,OAAA;AAEJ,EAAYC,sBAAA,CAAA,UAAA,CAAW,UAAU,YAAY;AACzC,IAAA,IAAI;AACA,MAAA,MAAM,MAAA,GAAS,MAAM,SAAA,CAAU,UAAA,EAAsC;AACrE,MAAA,IAAI,CAAC,MAAA,EAAQ;AAGT,QAAA,OAAsBC,yBAAA,CAAA,oBAAA,CAAqB,OA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,CAAC,CAAA;AACL;AAcA,eAAsB,0BAAA,CAClB,UACA,OAAA,EACa;AACb,EAAA,MAAqBA,4CAAkB,QAAA,EAAU;AAAA,IAC7C,eAAA,EAAiB,SAAS,eAAA,IAAmB;AAAA,GAChD,CAAA;AACL;AASA,eAAsB,6BAA6B,QAAA,EAAiC;AAChF,EAAA,MAAqBA,8CAAoB,QAAQ,CAAA;AACrD","file":"background.cjs","sourcesContent":["/**\n * Expo background task entrypoint — `@arkade-os/sdk/wallet/expo/background`.\n *\n * This subpath is the **only** module in the package that touches\n * `expo-task-manager` / `expo-background-task`. It is split out from\n * `/wallet/expo` on purpose: those packages have no web platform and\n * are declared as optional peer dependencies, so importing them from\n * `/wallet/expo` would regress react-native-web / Node consumers who\n * only need the foreground APIs.\n *\n * The imports are static (not lazy `require()`) because Metro's static\n * dependency collector cannot see modules hidden behind `__require()`\n * in the ESM build — without static imports the packages never enter\n * the bundle graph and resolution fails at runtime. See\n * https://github.com/arkade-os/ts-sdk/issues/486 for details.\n *\n * Consumers install the peers in their Expo app:\n * npx expo install expo-task-manager expo-background-task\n */\nimport * as TaskManager from \"expo-task-manager\";\nimport * as BackgroundTask from \"expo-background-task\";\n\nimport type { WalletRepository } from \"../../repositories/walletRepository\";\nimport type { ContractRepository } from \"../../repositories/contractRepository\";\nimport type { AsyncStorageTaskQueue } from \"../../worker/expo/asyncStorageTaskQueue\";\nimport type { TaskProcessor } from \"../../worker/expo/taskRunner\";\nimport type { TaskItem } from \"../../worker/expo/taskQueue\";\nimport { runTasks, createTaskDependencies } from \"../../worker/expo/taskRunner\";\nimport { contractPollProcessor, CONTRACT_POLL_TASK_TYPE } from \"../../worker/expo/processors\";\nimport { ExpoArkProvider } from \"../../providers/expoArk\";\nimport { ExpoIndexerProvider } from \"../../providers/expoIndexer\";\nimport { getRandomId } from \"../utils\";\n\n// ── Persisted config ─────────────────────────────────────────────\n\n/**\n * Wallet parameters persisted by @see ExpoWallet.setup and read\n * by the background handler to reconstruct providers and `extendVtxo`\n * without a network call.\n */\nexport interface PersistedBackgroundConfig {\n arkServerUrl: string;\n pubkeyHex: string;\n serverPubKeyHex: string;\n exitTimelockValue: string;\n exitTimelockType: \"blocks\" | \"seconds\";\n}\n\n// ── Public API ───────────────────────────────────────────────────\n\n/**\n * Options for @see defineExpoBackgroundTask.\n */\nexport interface DefineBackgroundTaskOptions {\n /** AsyncStorage-backed queue (must match the one passed to ExpoWallet.setup). */\n taskQueue: AsyncStorageTaskQueue;\n /** Wallet repository (fresh instance is fine — connects to the same DB). */\n walletRepository: WalletRepository;\n /** Contract repository (fresh instance is fine — connects to the same DB). */\n contractRepository: ContractRepository;\n /** Processors to run. Defaults to `[contractPollProcessor]`. */\n processors?: TaskProcessor[];\n}\n\n/**\n * Define the Expo background task handler.\n *\n * **Must be called at module/global scope** (before React mounts) so\n * Expo's TaskManager can resume the task on cold start.\n *\n * Pair with @see registerExpoBackgroundTask to activate the OS\n * scheduler — `ExpoWallet.setup()` no longer registers the task for\n * you.\n *\n * @example\n * ```ts\n * // App entry (e.g. _layout.tsx) — module scope\n * import { defineExpoBackgroundTask } from \"@arkade-os/sdk/wallet/expo/background\";\n * import { AsyncStorageTaskQueue } from \"@arkade-os/sdk/worker/expo\";\n * import AsyncStorage from \"@react-native-async-storage/async-storage\";\n *\n * const taskQueue = new AsyncStorageTaskQueue(AsyncStorage);\n * defineExpoBackgroundTask(\"ark-background-poll\", {\n * taskQueue,\n * walletRepository: new IndexedDBWalletRepository(),\n * contractRepository: new IndexedDBContractRepository(),\n * });\n * ```\n */\nexport function defineExpoBackgroundTask(\n taskName: string,\n options: DefineBackgroundTaskOptions,\n): void {\n const {\n taskQueue,\n walletRepository,\n contractRepository,\n processors = [contractPollProcessor],\n } = options;\n\n TaskManager.defineTask(taskName, async () => {\n try {\n const config = await taskQueue.loadConfig<PersistedBackgroundConfig>();\n if (!config) {\n // No config persisted yet — ExpoWallet.setup() hasn't run.\n // Nothing to do.\n return BackgroundTask.BackgroundTaskResult.Success;\n }\n\n const indexerProvider = new ExpoIndexerProvider(config.arkServerUrl);\n const arkProvider = new ExpoArkProvider(config.arkServerUrl);\n\n const deps = createTaskDependencies({\n walletRepository,\n contractRepository,\n indexerProvider,\n arkProvider,\n });\n\n await runTasks(taskQueue, processors, deps);\n\n // Acknowledge outbox results (no foreground to consume them)\n const results = await taskQueue.getResults();\n if (results.length > 0) {\n await taskQueue.acknowledgeResults(results.map((r) => r.id));\n }\n\n // Re-seed the contract-poll task for the next OS wake\n const existing = await taskQueue.getTasks(CONTRACT_POLL_TASK_TYPE);\n if (existing.length === 0) {\n const task: TaskItem = {\n id: getRandomId(),\n type: CONTRACT_POLL_TASK_TYPE,\n data: {},\n createdAt: Date.now(),\n };\n await taskQueue.addTask(task);\n }\n\n return BackgroundTask.BackgroundTaskResult.Success;\n } catch (error) {\n console.error(\n \"[ark-sdk] Background task failed:\",\n error instanceof Error ? error.message : error,\n );\n return BackgroundTask.BackgroundTaskResult.Failed;\n }\n });\n}\n\n/**\n * Activate the OS-level background task scheduler.\n *\n * Call once after @see defineExpoBackgroundTask — typically right after\n * `ExpoWallet.setup()`. Safe to call again to update the interval.\n *\n * @param taskName - The task name passed to {@link defineExpoBackgroundTask}.\n * @param options.minimumInterval - Minimum interval in **minutes** (default\n * 15, the floor enforced by `expo-background-task`).\n *\n * @see https://docs.expo.dev/versions/latest/sdk/background-task/#backgroundtaskoptions\n */\nexport async function registerExpoBackgroundTask(\n taskName: string,\n options?: { minimumInterval?: number },\n): Promise<void> {\n await BackgroundTask.registerTaskAsync(taskName, {\n minimumInterval: options?.minimumInterval ?? 15,\n });\n}\n\n/**\n * Unregister the background task from the OS scheduler.\n *\n * `ExpoWallet.dispose()` does **not** call this — the OS-level task\n * lifecycle is the consumer's responsibility, matching the explicit\n * `register` step.\n */\nexport async function unregisterExpoBackgroundTask(taskName: string): Promise<void> {\n await BackgroundTask.unregisterTaskAsync(taskName);\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { W as WalletRepository, C as ContractRepository } from '../../ark-B69ugeJw.cjs';
|
|
2
|
-
import {
|
|
3
|
-
import { T as TaskProcessor } from '../../taskRunner-
|
|
2
|
+
import { A as AsyncStorageTaskQueue } from '../../asyncStorageTaskQueue-B0SUQMXw.cjs';
|
|
3
|
+
import { T as TaskProcessor } from '../../taskRunner-B7svzMhT.cjs';
|
|
4
4
|
import '@scure/btc-signer/transaction.js';
|
|
5
5
|
import '@scure/btc-signer/utils.js';
|
|
6
6
|
import '@scure/btc-signer/psbt.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { W as WalletRepository, C as ContractRepository } from '../../ark-B69ugeJw.js';
|
|
2
|
-
import {
|
|
3
|
-
import { T as TaskProcessor } from '../../taskRunner-
|
|
2
|
+
import { A as AsyncStorageTaskQueue } from '../../asyncStorageTaskQueue-DWqxuIAs.js';
|
|
3
|
+
import { T as TaskProcessor } from '../../taskRunner-nzJFH8qb.js';
|
|
4
4
|
import '@scure/btc-signer/transaction.js';
|
|
5
5
|
import '@scure/btc-signer/utils.js';
|
|
6
6
|
import '@scure/btc-signer/psbt.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { getRandomId } from '../../chunk-
|
|
4
|
-
import '../../chunk-
|
|
1
|
+
import { contractPollProcessor, createTaskDependencies, runTasks, CONTRACT_POLL_TASK_TYPE } from '../../chunk-B4WZOJAI.js';
|
|
2
|
+
import { ExpoIndexerProvider, ExpoArkProvider } from '../../chunk-3XWDMLOI.js';
|
|
3
|
+
import { getRandomId } from '../../chunk-3MMUKLCI.js';
|
|
4
|
+
import '../../chunk-LHYNNDY6.js';
|
|
5
5
|
import '../../chunk-UZLQUWYP.js';
|
|
6
6
|
import '../../chunk-EFNLTS6Q.js';
|
|
7
7
|
import '../../chunk-NSBPE2FW.js';
|
|
@@ -56,7 +56,7 @@ function defineExpoBackgroundTask(taskName, options) {
|
|
|
56
56
|
}
|
|
57
57
|
async function registerExpoBackgroundTask(taskName, options) {
|
|
58
58
|
await BackgroundTask.registerTaskAsync(taskName, {
|
|
59
|
-
minimumInterval:
|
|
59
|
+
minimumInterval: options?.minimumInterval ?? 15
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
async function unregisterExpoBackgroundTask(taskName) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/wallet/expo/background.ts"],"names":[],"mappings":";;;;;;;;;;AAyFO,SAAS,wBAAA,CACZ,UACA,OAAA,EACI;AACJ,EAAA,MAAM;AAAA,IACF,SAAA;AAAA,IACA,gBAAA;AAAA,IACA,kBAAA;AAAA,IACA,UAAA,GAAa,CAAC,qBAAqB;AAAA,GACvC,GAAI,OAAA;AAEJ,EAAY,WAAA,CAAA,UAAA,CAAW,UAAU,YAAY;AACzC,IAAA,IAAI;AACA,MAAA,MAAM,MAAA,GAAS,MAAM,SAAA,CAAU,UAAA,EAAsC;AACrE,MAAA,IAAI,CAAC,MAAA,EAAQ;AAGT,QAAA,OAAsB,cAAA,CAAA,oBAAA,CAAqB,OAAA;AAAA,MAC/C;AAEA,MAAA,MAAM,eAAA,GAAkB,IAAI,mBAAA,CAAoB,MAAA,CAAO,YAAY,CAAA;AACnE,MAAA,MAAM,WAAA,GAAc,IAAI,eAAA,CAAgB,MAAA,CAAO,YAAY,CAAA;AAE3D,MAAA,MAAM,OAAO,sBAAA,CAAuB;AAAA,QAChC,gBAAA;AAAA,QACA,kBAAA;AAAA,QACA,eAAA;AAAA,QACA;AAAA,OACH,CAAA;AAED,MAAA,MAAM,QAAA,CAAS,SAAA,EAAW,UAAA,EAAY,IAAI,CAAA;AAG1C,MAAA,MAAM,OAAA,GAAU,MAAM,SAAA,CAAU,UAAA,EAAW;AAC3C,MAAA,IAAI,OAAA,CAAQ,SAAS,CAAA,EAAG;AACpB,QAAA,MAAM,SAAA,CAAU,mBAAmB,OAAA,CAAQ,GAAA,CAAI,CAAC,CAAA,KAAM,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J,CAAC,CAAA;AACL;AAcA,eAAsB,0BAAA,CAClB,UACA,OAAA,EACa;AACb,EAAA,MAAqB,iCAAkB,QAAA,EAAU;AAAA,IAC7C,eAAA,EAAiB,SAAS,eAAA,IAAmB;AAAA,GAChD,CAAA;AACL;AASA,eAAsB,6BAA6B,QAAA,EAAiC;AAChF,EAAA,MAAqB,mCAAoB,QAAQ,CAAA;AACrD","file":"background.js","sourcesContent":["/**\n * Expo background task entrypoint — `@arkade-os/sdk/wallet/expo/background`.\n *\n * This subpath is the **only** module in the package that touches\n * `expo-task-manager` / `expo-background-task`. It is split out from\n * `/wallet/expo` on purpose: those packages have no web platform and\n * are declared as optional peer dependencies, so importing them from\n * `/wallet/expo` would regress react-native-web / Node consumers who\n * only need the foreground APIs.\n *\n * The imports are static (not lazy `require()`) because Metro's static\n * dependency collector cannot see modules hidden behind `__require()`\n * in the ESM build — without static imports the packages never enter\n * the bundle graph and resolution fails at runtime. See\n * https://github.com/arkade-os/ts-sdk/issues/486 for details.\n *\n * Consumers install the peers in their Expo app:\n * npx expo install expo-task-manager expo-background-task\n */\nimport * as TaskManager from \"expo-task-manager\";\nimport * as BackgroundTask from \"expo-background-task\";\n\nimport type { WalletRepository } from \"../../repositories/walletRepository\";\nimport type { ContractRepository } from \"../../repositories/contractRepository\";\nimport type { AsyncStorageTaskQueue } from \"../../worker/expo/asyncStorageTaskQueue\";\nimport type { TaskProcessor } from \"../../worker/expo/taskRunner\";\nimport type { TaskItem } from \"../../worker/expo/taskQueue\";\nimport { runTasks, createTaskDependencies } from \"../../worker/expo/taskRunner\";\nimport { contractPollProcessor, CONTRACT_POLL_TASK_TYPE } from \"../../worker/expo/processors\";\nimport { ExpoArkProvider } from \"../../providers/expoArk\";\nimport { ExpoIndexerProvider } from \"../../providers/expoIndexer\";\nimport { getRandomId } from \"../utils\";\n\n// ── Persisted config ─────────────────────────────────────────────\n\n/**\n * Wallet parameters persisted by @see ExpoWallet.setup and read\n * by the background handler to reconstruct providers and `extendVtxo`\n * without a network call.\n */\nexport interface PersistedBackgroundConfig {\n arkServerUrl: string;\n pubkeyHex: string;\n serverPubKeyHex: string;\n exitTimelockValue: string;\n exitTimelockType: \"blocks\" | \"seconds\";\n}\n\n// ── Public API ───────────────────────────────────────────────────\n\n/**\n * Options for @see defineExpoBackgroundTask.\n */\nexport interface DefineBackgroundTaskOptions {\n /** AsyncStorage-backed queue (must match the one passed to ExpoWallet.setup). */\n taskQueue: AsyncStorageTaskQueue;\n /** Wallet repository (fresh instance is fine — connects to the same DB). */\n walletRepository: WalletRepository;\n /** Contract repository (fresh instance is fine — connects to the same DB). */\n contractRepository: ContractRepository;\n /** Processors to run. Defaults to `[contractPollProcessor]`. */\n processors?: TaskProcessor[];\n}\n\n/**\n * Define the Expo background task handler.\n *\n * **Must be called at module/global scope** (before React mounts) so\n * Expo's TaskManager can resume the task on cold start.\n *\n * Pair with @see registerExpoBackgroundTask to activate the OS\n * scheduler — `ExpoWallet.setup()` no longer registers the task for\n * you.\n *\n * @example\n * ```ts\n * // App entry (e.g. _layout.tsx) — module scope\n * import { defineExpoBackgroundTask } from \"@arkade-os/sdk/wallet/expo/background\";\n * import { AsyncStorageTaskQueue } from \"@arkade-os/sdk/worker/expo\";\n * import AsyncStorage from \"@react-native-async-storage/async-storage\";\n *\n * const taskQueue = new AsyncStorageTaskQueue(AsyncStorage);\n * defineExpoBackgroundTask(\"ark-background-poll\", {\n * taskQueue,\n * walletRepository: new IndexedDBWalletRepository(),\n * contractRepository: new IndexedDBContractRepository(),\n * });\n * ```\n */\nexport function defineExpoBackgroundTask(\n taskName: string,\n options: DefineBackgroundTaskOptions,\n): void {\n const {\n taskQueue,\n walletRepository,\n contractRepository,\n processors = [contractPollProcessor],\n } = options;\n\n TaskManager.defineTask(taskName, async () => {\n try {\n const config = await taskQueue.loadConfig<PersistedBackgroundConfig>();\n if (!config) {\n // No config persisted yet — ExpoWallet.setup() hasn't run.\n // Nothing to do.\n return BackgroundTask.BackgroundTaskResult.Success;\n }\n\n const indexerProvider = new ExpoIndexerProvider(config.arkServerUrl);\n const arkProvider = new ExpoArkProvider(config.arkServerUrl);\n\n const deps = createTaskDependencies({\n walletRepository,\n contractRepository,\n indexerProvider,\n arkProvider,\n });\n\n await runTasks(taskQueue, processors, deps);\n\n // Acknowledge outbox results (no foreground to consume them)\n const results = await taskQueue.getResults();\n if (results.length > 0) {\n await taskQueue.acknowledgeResults(results.map((r) => r.id));\n }\n\n // Re-seed the contract-poll task for the next OS wake\n const existing = await taskQueue.getTasks(CONTRACT_POLL_TASK_TYPE);\n if (existing.length === 0) {\n const task: TaskItem = {\n id: getRandomId(),\n type: CONTRACT_POLL_TASK_TYPE,\n data: {},\n createdAt: Date.now(),\n };\n await taskQueue.addTask(task);\n }\n\n return BackgroundTask.BackgroundTaskResult.Success;\n } catch (error) {\n console.error(\n \"[ark-sdk] Background task failed:\",\n error instanceof Error ? error.message : error,\n );\n return BackgroundTask.BackgroundTaskResult.Failed;\n }\n });\n}\n\n/**\n * Activate the OS-level background task scheduler.\n *\n * Call once after @see defineExpoBackgroundTask — typically right after\n * `ExpoWallet.setup()`. Safe to call again to update the interval.\n *\n * @param taskName - The task name passed to {@link defineExpoBackgroundTask}.\n * @param options.minimumInterval - Minimum interval in **minutes** (default\n * 15, the floor enforced by `expo-background-task`).\n *\n * @see https://docs.expo.dev/versions/latest/sdk/background-task/#backgroundtaskoptions\n */\nexport async function registerExpoBackgroundTask(\n taskName: string,\n options?: { minimumInterval?: number },\n): Promise<void> {\n await BackgroundTask.registerTaskAsync(taskName, {\n minimumInterval: options?.minimumInterval ?? 15,\n });\n}\n\n/**\n * Unregister the background task from the OS scheduler.\n *\n * `ExpoWallet.dispose()` does **not** call this — the OS-level task\n * lifecycle is the consumer's responsibility, matching the explicit\n * `register` step.\n */\nexport async function unregisterExpoBackgroundTask(taskName: string): Promise<void> {\n await BackgroundTask.unregisterTaskAsync(taskName);\n}\n"]}
|