@arkade-os/sdk 0.5.0-rc.11 → 0.5.0-rc.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -12
- package/dist/adapters/expo.cjs +5 -5
- package/dist/adapters/expo.d.cts +2 -2
- package/dist/adapters/expo.d.ts +2 -2
- package/dist/adapters/expo.js +3 -3
- package/dist/{asyncStorageTaskQueue-DBaZsltv.d.cts → asyncStorageTaskQueue-0EeSeCAt.d.cts} +1 -1
- package/dist/{asyncStorageTaskQueue-uAG3XLyg.d.ts → asyncStorageTaskQueue-DV94jhwq.d.ts} +1 -1
- package/dist/{chunk-WSQAWSEH.js → chunk-3JLYJ5KZ.js} +75 -237
- package/dist/chunk-3JLYJ5KZ.js.map +1 -0
- package/dist/{chunk-VMLLYEYM.js → chunk-4EU2Q6YT.js} +12 -14
- package/dist/chunk-4EU2Q6YT.js.map +1 -0
- package/dist/{chunk-IA32YGLH.cjs → chunk-7BACS4XK.cjs} +10 -10
- package/dist/chunk-7BACS4XK.cjs.map +1 -0
- package/dist/{chunk-5OBGYL6U.cjs → chunk-7NK6XFC3.cjs} +120 -194
- package/dist/chunk-7NK6XFC3.cjs.map +1 -0
- package/dist/{chunk-CQPQ7D4U.cjs → chunk-BFQX2KS3.cjs} +87 -248
- package/dist/chunk-BFQX2KS3.cjs.map +1 -0
- package/dist/{chunk-DD6MTNAS.js → chunk-D7JLTHSZ.js} +5 -5
- package/dist/chunk-D7JLTHSZ.js.map +1 -0
- package/dist/{chunk-CMLSTGOC.js → chunk-EJYWGTZ7.js} +119 -194
- package/dist/chunk-EJYWGTZ7.js.map +1 -0
- package/dist/{chunk-T2ILYGWE.cjs → chunk-FDQQOF3F.cjs} +327 -1080
- package/dist/chunk-FDQQOF3F.cjs.map +1 -0
- package/dist/{chunk-MGDXN74N.cjs → chunk-I4YBVHAK.cjs} +2357 -3374
- package/dist/chunk-I4YBVHAK.cjs.map +1 -0
- package/dist/{chunk-M2ZUPLKQ.js → chunk-IV2252XM.js} +1946 -2977
- package/dist/chunk-IV2252XM.js.map +1 -0
- package/dist/{chunk-OMJRW2D5.js → chunk-JOUPIZ32.js} +263 -1036
- package/dist/chunk-JOUPIZ32.js.map +1 -0
- package/dist/{chunk-PWEBQNIE.cjs → chunk-RDQSVIXD.cjs} +22 -24
- package/dist/chunk-RDQSVIXD.cjs.map +1 -0
- package/dist/contracts/handlers/index.cjs +9 -9
- package/dist/contracts/handlers/index.d.cts +3 -3
- package/dist/contracts/handlers/index.d.ts +3 -3
- package/dist/contracts/handlers/index.js +2 -2
- package/dist/{delegate-DFwlkVYR.d.cts → delegate-BgpUJW5B.d.cts} +1 -1
- package/dist/{delegate-D3YHDERL.d.ts → delegate-BuagcGnG.d.ts} +1 -1
- package/dist/{index-DTvUv5lD.d.cts → index-CKmB14Yu.d.cts} +1145 -2263
- package/dist/{index-DTvUv5lD.d.ts → index-CKmB14Yu.d.ts} +1145 -2263
- package/dist/index-D0BuYwhF.d.cts +637 -0
- package/dist/index-DbzyrqK7.d.ts +637 -0
- package/dist/index.cjs +341 -297
- package/dist/index.d.cts +379 -788
- package/dist/index.d.ts +379 -788
- package/dist/index.js +4 -4
- package/dist/repositories/realm/index.cjs +142 -101
- package/dist/repositories/realm/index.cjs.map +1 -1
- package/dist/repositories/realm/index.d.cts +13 -11
- package/dist/repositories/realm/index.d.ts +13 -11
- package/dist/repositories/realm/index.js +130 -89
- package/dist/repositories/realm/index.js.map +1 -1
- package/dist/repositories/sqlite/index.cjs +158 -118
- package/dist/repositories/sqlite/index.cjs.map +1 -1
- package/dist/repositories/sqlite/index.d.cts +14 -13
- package/dist/repositories/sqlite/index.d.ts +14 -13
- package/dist/repositories/sqlite/index.js +147 -107
- package/dist/repositories/sqlite/index.js.map +1 -1
- package/dist/{taskRunner-B5bl0YRt.d.ts → taskRunner-BX-pB0sv.d.ts} +1 -1
- package/dist/{taskRunner--sKy9Inv.d.cts → taskRunner-DJrFFyus.d.cts} +1 -1
- package/dist/wallet/expo/background.cjs +14 -14
- package/dist/wallet/expo/background.cjs.map +1 -1
- package/dist/wallet/expo/background.d.cts +8 -14
- package/dist/wallet/expo/background.d.ts +8 -14
- package/dist/wallet/expo/background.js +6 -6
- package/dist/wallet/expo/background.js.map +1 -1
- package/dist/wallet/expo/index.cjs +14 -14
- package/dist/wallet/expo/index.cjs.map +1 -1
- package/dist/wallet/expo/index.d.cts +5 -5
- package/dist/wallet/expo/index.d.ts +5 -5
- package/dist/wallet/expo/index.js +5 -5
- package/dist/wallet/expo/index.js.map +1 -1
- package/dist/wallet-BsL2G3Qb.d.cts +1542 -0
- package/dist/wallet-DXNiCmq8.d.ts +1542 -0
- package/dist/worker/expo/index.cjs +9 -9
- package/dist/worker/expo/index.d.cts +4 -4
- package/dist/worker/expo/index.d.ts +4 -4
- package/dist/worker/expo/index.js +5 -5
- package/package.json +3 -2
- package/dist/chunk-5OBGYL6U.cjs.map +0 -1
- package/dist/chunk-CMLSTGOC.js.map +0 -1
- package/dist/chunk-CQPQ7D4U.cjs.map +0 -1
- package/dist/chunk-DD6MTNAS.js.map +0 -1
- package/dist/chunk-IA32YGLH.cjs.map +0 -1
- package/dist/chunk-M2ZUPLKQ.js.map +0 -1
- package/dist/chunk-MGDXN74N.cjs.map +0 -1
- package/dist/chunk-OMJRW2D5.js.map +0 -1
- package/dist/chunk-PWEBQNIE.cjs.map +0 -1
- package/dist/chunk-T2ILYGWE.cjs.map +0 -1
- package/dist/chunk-VMLLYEYM.js.map +0 -1
- package/dist/chunk-WSQAWSEH.js.map +0 -1
- package/dist/hdWalletCapable-C350s3bP.d.ts +0 -2206
- package/dist/hdWalletCapable-rrOmXcbT.d.cts +0 -2206
- package/dist/index-C0ZyGoyP.d.cts +0 -850
- package/dist/index-DASN1cVk.d.ts +0 -850
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { ARKADE_MAGIC, ARKADE_SALTED_PREIMAGE_TAG, ARKADE_SWAP_PREIMAGE_TAG, ASSET_CARRIER_SATS, AbortError, ActivityRegistry, AmbiguousRouteError, ArkNote, ArkadeCash, ArkadeCashCreateError, AssetManager, BIP21, BIP21Error, BIP322, BLOCKED_UPGRADE_TIMEOUT_MS, Batch, CachingArkProvider, ChainedTxType, ConnectionDisposedError, ContractManager, ContractWatcher, DEFAULT_MESSAGE_TIMEOUTS, DEFAULT_MIN_BATCH_EXPIRY_SECONDS, DEFAULT_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, DatabaseUpgradeBlockedError, DelegateManagerImpl, DelegateNotConfiguredError, DescriptorIdentity, DescriptorSigningProviderMissingError, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, ESPLORA_URL, ElectrumOnchainProvider, EmulatorPacket, EsploraProvider, Estimator, Extension, ExtensionNotFoundError, ForeignDescriptorError, HDDescriptorProvider, INTENT_TERMINAL_STATES, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexedDBWalletRepository, MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD, MESSAGE_BUS_INITIALIZING, MESSAGE_BUS_NOT_INITIALIZED, MUTINYNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, MissingSigningDescriptorError, MnemonicIdentity, OnchainWallet, OversizedChangeError, P2A, PaymentRouter, PrevTxUnavailableError, REGTEST_MIN_BATCH_EXPIRY_SECONDS, REGTEST_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, RestDelegateProvider, RestEmulatorProvider, SIGNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, SeedIdentity, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, SingleKey, TxTree, TxType, TxWeightEstimator, UnannotatableInputError, UnilateralExit, UnknownPacket, Unroll, VtxoManager, Wallet, WalletCannotAllocateAddressError, WalletCannotSignError, WalletMessageHandler, WalletNotInitializedError, WsElectrumChainSource, adoptContractDescriptor, arkAssetRail, arkRail, arkTarget, arkade_exports as arkade, assertFinalCommitmentMatchesValidated, assertNoAssets, assertNoSelection, assertRecipientArkadeAddress, assertSendableAmount, assertSubmittedArkTxid, assertValidBatchExpiry, assertValidServerUnrollScript, assetMintResolver, assetsOf, attachPrevArkTxs, attachPrevoutTxs, awaitTransaction, boardingResolver, btcTarget, buildForfeitTx, buildOffchainTx, buildPreimageMessage, buildSaltedPreimageMessage, claimWithPreimageIdentity, classifyAgainstSignerSet, classifyContractSigner, closeDatabase, collabExitResolver, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, contractPreimage, contractSigner, createAssetPacket, createDefaultActivityRegistry, createDefaultPaymentRouter, createExitChainResolver, createManagedConnection, decodeArkContract, defaultBatchExpiryPolicy, defaultCheckpointExitDelayPolicy, deleteByIndex, deserializeExitPackage, encodeArkContract, exitObserverFor, gateExclusion, gatedContracts, getAllByIndexValues, getRandomId, hasBoardingTxExpired, hasCandidates, invoiceTarget, isAddressAllocationCapable, isArkContract, isBatchSignable, isBtcAddress, isContractGenericallySpendable, isContractVtxoEvent, isCooperativelyMigratable, isDeterministicSigner, isDiscoverable, isHDAllocationCapable, isHDDeterministicSignCapable, isHDWalletCapable, isLightningInvoice, isLnurl, isMessageBusInitializingError, isMessageBusNotInitializedError, isPerArtifactDescriptor, isSigningIdentity, isSubdust, isTerminalIntentState, isValidArkAddress, isVtxoExpiringSoon, logExcludedVtxos, makeHandle, matchServerCheckpoints, notifyExitObserved, onchainRail, openDatabase, outpointExclusion, outpointReasons, promisifyRequest, provisionClaimSecret, provisionRefundKey, registerWalletRestoreHook, resolveAssetAmount, resolveBatchExpiryPolicy, resolveCheckpointExitDelayPolicy, resolveDescriptorSigner, resolvePrevTxs, resolveSendAmount, selectCoinsWithAsset, selectVirtualCoins, selectionOf, serializeExitPackage, setupServiceWorker, signAndSubmitOffchainTx, signerSetFromInfo, signingDescriptorIndex, strictSigningDescriptorIndex, toXOnlySignerHex, tryResolveSendAmount, validateBatchRecipients, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, waitForIncomingFunds, walletFeeSource, withPrevTxs } from './chunk-
|
|
2
|
-
export { ChainTxType, DEFAULT_VTXO_PAGE_SIZE, IndexerTxType, RestIndexerProvider, asset_exports as asset } from './chunk-
|
|
3
|
-
export { ArkadeContractHandler, BoardingContractHandler, DefaultContractHandler, DefaultVtxo, DelegateContractHandler, DelegateVtxo, VHTLC, VHTLCContractHandler, VHTLCV2ContractHandler, contractHandlers, deriveDescriptorLeafCompressedPubKey, deriveDescriptorLeafPubKey, identityDescriptor, isCltvSatisfied, isCsvSpendable, normalizeToDescriptor, parseHDDescriptor, toXOnly } from './chunk-
|
|
4
|
-
export { ArkAddress, ArkError, ArkErrorName, ArkPsbtFieldKey, ArkPsbtFieldKeyType, BITCOIN_EMULATOR_PUBKEY, CLTVMultisigTapscript, CSVMultisigTapscript, ConditionCSVMultisigTapscript, ConditionMultisigTapscript, ConditionWitness, CosignerPublicKey, DigestMismatchError, EventSourceUnavailableError, FetchError, Intent, MUTINYNET_EMULATOR_PUBKEY, MultisigTapscript, PrevArkTxField, PrevoutTxField, ProviderUnavailableError, READ_TIMEOUT_MS, REGTEST_EMULATOR_PUBKEY, RestArkProvider, ServerResponseMismatchError, SettlementEventType, TapTreeCoder, Transaction, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, assembleBtcdTaprootTree, assertAllowedSighashTypes, buildVersion, canRecoverOnchain, canSpendOffchain, canSweepOnchain, configureEventSource, decodeTapscript, defaultEmulatorPubkey, getAllNormalizedVtxos, getArkPsbtFields, getConfiguredEventSource, getNetwork, getNormalizedVtxos, getSequence,
|
|
1
|
+
export { ARKADE_MAGIC, ARKADE_SALTED_PREIMAGE_TAG, ARKADE_SWAP_PREIMAGE_TAG, ASSET_CARRIER_SATS, AbortError, ActivityRegistry, AmbiguousRouteError, ArkNote, ArkadeCash, ArkadeCashCreateError, AssetManager, BIP21, BIP21Error, BIP322, BLOCKED_UPGRADE_TIMEOUT_MS, Batch, CachingArkProvider, ChainedTxType, ConnectionDisposedError, ContractManager, ContractWatcher, DEFAULT_MESSAGE_TIMEOUTS, DEFAULT_MIN_BATCH_EXPIRY_SECONDS, DEFAULT_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, DatabaseUpgradeBlockedError, DelegateManagerImpl, DelegateNotConfiguredError, DescriptorIdentity, DescriptorSigningProviderMissingError, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, ESPLORA_URL, ElectrumOnchainProvider, EmulatorPacket, EsploraProvider, Estimator, Extension, ExtensionNotFoundError, ForeignDescriptorError, HDDescriptorProvider, INTENT_TERMINAL_STATES, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexedDBWalletRepository, MAX_PAGE_SIZE, MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD, MESSAGE_BUS_INITIALIZING, MESSAGE_BUS_NOT_INITIALIZED, MUTINYNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, MissingSigningDescriptorError, MnemonicIdentity, OnchainWallet, OversizedChangeError, P2A, PaymentRouter, PrevTxUnavailableError, REGTEST_MIN_BATCH_EXPIRY_SECONDS, REGTEST_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, RestDelegateProvider, RestEmulatorProvider, SIGNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, SeedIdentity, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, SingleKey, TxTree, TxType, TxWeightEstimator, UnannotatableInputError, UnilateralExit, UnknownPacket, Unroll, VtxoManager, Wallet, WalletCannotAllocateAddressError, WalletCannotSignError, WalletMessageHandler, WalletNotInitializedError, WsElectrumChainSource, adoptContractDescriptor, arkAssetRail, arkRail, arkTarget, arkade_exports as arkade, assertFinalCommitmentMatchesValidated, assertNoAssets, assertNoSelection, assertPageRequest, assertRecipientArkadeAddress, assertSendableAmount, assertSubmittedArkTxid, assertValidBatchExpiry, assertValidServerUnrollScript, assetMintResolver, assetsOf, attachPrevArkTxs, attachPrevoutTxs, awaitTransaction, boardingResolver, btcTarget, buildForfeitTx, buildOffchainTx, buildPreimageMessage, buildSaltedPreimageMessage, claimWithPreimageIdentity, classifyAgainstSignerSet, classifyContractSigner, closeDatabase, collabExitResolver, collectContracts, collectIntents, collectPages, collectScriptVtxos, collectTransactionHistory, collectUtxos, collectVtxos, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, contractPreimage, contractSigner, createAssetPacket, createDefaultActivityRegistry, createDefaultPaymentRouter, createExitChainResolver, createManagedConnection, decodeArkContract, defaultBatchExpiryPolicy, defaultCheckpointExitDelayPolicy, deleteByIndex, deserializeExitPackage, encodeArkContract, exitObserverFor, gateExclusion, gatedContracts, getAllByIndexValues, getRandomId, hasBoardingTxExpired, hasCandidates, invoiceTarget, isAddressAllocationCapable, isArkContract, isBatchSignable, isBtcAddress, isContractGenericallySpendable, isContractVtxoEvent, isCooperativelyMigratable, isDeterministicSigner, isDiscoverable, isHDAllocationCapable, isHDDeterministicSignCapable, isHDWalletCapable, isLightningInvoice, isLnurl, isMessageBusInitializingError, isMessageBusNotInitializedError, isPerArtifactDescriptor, isSigningIdentity, isSubdust, isTerminalIntentState, isValidArkAddress, isVtxoExpiringSoon, iteratePages, logExcludedVtxos, makeHandle, matchServerCheckpoints, notifyExitObserved, onchainRail, openDatabase, outpointExclusion, outpointReasons, pageResult, promisifyRequest, provisionClaimSecret, provisionRefundKey, registerWalletRestoreHook, resolveAssetAmount, resolveBatchExpiryPolicy, resolveCheckpointExitDelayPolicy, resolveDescriptorSigner, resolvePrevTxs, resolveSendAmount, selectCoinsWithAsset, selectVirtualCoins, selectionOf, serializeExitPackage, setupServiceWorker, signAndSubmitOffchainTx, signerSetFromInfo, signingDescriptorIndex, strictSigningDescriptorIndex, toXOnlySignerHex, tryResolveSendAmount, validateBatchRecipients, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, waitForIncomingFunds, walletFeeSource, withPrevTxs } from './chunk-IV2252XM.js';
|
|
2
|
+
export { ChainTxType, DEFAULT_VTXO_PAGE_SIZE, IndexerTxType, RestIndexerProvider, asset_exports as asset } from './chunk-3JLYJ5KZ.js';
|
|
3
|
+
export { ArkadeContractHandler, BoardingContractHandler, DefaultContractHandler, DefaultVtxo, DelegateContractHandler, DelegateVtxo, VHTLC, VHTLCContractHandler, VHTLCV2ContractHandler, contractHandlers, deriveDescriptorLeafCompressedPubKey, deriveDescriptorLeafPubKey, identityDescriptor, isCltvSatisfied, isCsvSpendable, normalizeToDescriptor, parseHDDescriptor, toXOnly } from './chunk-JOUPIZ32.js';
|
|
4
|
+
export { ArkAddress, ArkError, ArkErrorName, ArkPsbtFieldKey, ArkPsbtFieldKeyType, BITCOIN_EMULATOR_PUBKEY, CLTVMultisigTapscript, CSVMultisigTapscript, ConditionCSVMultisigTapscript, ConditionMultisigTapscript, ConditionWitness, CosignerPublicKey, DigestMismatchError, EventSourceUnavailableError, FetchError, Intent, MUTINYNET_EMULATOR_PUBKEY, MultisigTapscript, PrevArkTxField, PrevoutTxField, ProviderUnavailableError, READ_TIMEOUT_MS, REGTEST_EMULATOR_PUBKEY, RestArkProvider, ServerResponseMismatchError, SettlementEventType, TapTreeCoder, Transaction, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, assembleBtcdTaprootTree, assertAllowedSighashTypes, buildVersion, canRecoverOnchain, canSpendOffchain, canSweepOnchain, configureEventSource, decodeTapscript, defaultEmulatorPubkey, getAllNormalizedVtxos, getArkPsbtFields, getConfiguredEventSource, getNetwork, getNormalizedVtxos, getSequence, isArkError, isEventSourceUnavailableError, isPastExpiry, isRetryableProviderError, isVirtualCoin, isVtxoSpent, maybeArkError, networkFromArkadeInfo, networks, resolveEmulatorPubkey, resolveEventSource, scriptFromTapLeafScript, sdkVersion, sequenceToTimelock, setArkPsbtField, timelockToSequence } from './chunk-EJYWGTZ7.js';
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
5
|
-
require('../../chunk-
|
|
6
|
-
require('../../chunk-
|
|
3
|
+
var chunkI4YBVHAK_cjs = require('../../chunk-I4YBVHAK.cjs');
|
|
4
|
+
require('../../chunk-BFQX2KS3.cjs');
|
|
5
|
+
require('../../chunk-FDQQOF3F.cjs');
|
|
6
|
+
var chunk7NK6XFC3_cjs = require('../../chunk-7NK6XFC3.cjs');
|
|
7
7
|
|
|
8
8
|
// src/repositories/realm/walletRepository.ts
|
|
9
9
|
var RealmWalletRepository = class {
|
|
@@ -11,7 +11,7 @@ var RealmWalletRepository = class {
|
|
|
11
11
|
this.realm = realm;
|
|
12
12
|
}
|
|
13
13
|
realm;
|
|
14
|
-
version =
|
|
14
|
+
version = 2;
|
|
15
15
|
// ── Lifecycle ──────────────────────────────────────────────────────
|
|
16
16
|
async ensureInit() {
|
|
17
17
|
}
|
|
@@ -28,16 +28,14 @@ var RealmWalletRepository = class {
|
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
// ── VTXO management ────────────────────────────────────────────────
|
|
31
|
-
async
|
|
32
|
-
|
|
33
|
-
const results = this.realm.objects("ArkVtxo").filtered("address == $0", address);
|
|
34
|
-
return [...results].map(vtxoObjectToDomain);
|
|
31
|
+
async getVtxosPage(address, page) {
|
|
32
|
+
return this.pageByAddress("ArkVtxo", address, page, vtxoObjectToDomain);
|
|
35
33
|
}
|
|
36
34
|
async saveVtxos(address, vtxos) {
|
|
37
35
|
await this.ensureInit();
|
|
38
36
|
this.realm.write(() => {
|
|
39
37
|
for (const vtxo of vtxos) {
|
|
40
|
-
const s =
|
|
38
|
+
const s = chunkI4YBVHAK_cjs.serializeVtxo(vtxo);
|
|
41
39
|
this.realm.create(
|
|
42
40
|
"ArkVtxo",
|
|
43
41
|
{
|
|
@@ -52,13 +50,13 @@ var RealmWalletRepository = class {
|
|
|
52
50
|
intentCb: s.intentTapLeafScript.cb,
|
|
53
51
|
intentS: s.intentTapLeafScript.s,
|
|
54
52
|
statusJson: JSON.stringify(s.status),
|
|
55
|
-
createdAt:
|
|
53
|
+
createdAt: chunkI4YBVHAK_cjs.createdAtToIso(s.createdAt),
|
|
56
54
|
isUnrolled: s.isUnrolled ?? false,
|
|
57
55
|
isSpent: s.isSpent === void 0 ? null : s.isSpent,
|
|
58
56
|
isSwept: s.isSwept === void 0 ? null : s.isSwept,
|
|
59
57
|
isPreconfirmed: s.isPreconfirmed === void 0 ? null : s.isPreconfirmed,
|
|
60
58
|
commitmentTxIdsJson: s.commitmentTxIds ? JSON.stringify(s.commitmentTxIds) : null,
|
|
61
|
-
expiresAt: s.expiresAt === void 0 ? null :
|
|
59
|
+
expiresAt: s.expiresAt === void 0 ? null : new Date(s.expiresAt).toISOString(),
|
|
62
60
|
expiresAtHeight: s.expiresAtHeight ?? null,
|
|
63
61
|
spentBy: s.spentBy ?? null,
|
|
64
62
|
settledBy: s.settledBy ?? null,
|
|
@@ -73,48 +71,80 @@ var RealmWalletRepository = class {
|
|
|
73
71
|
});
|
|
74
72
|
}
|
|
75
73
|
async deleteVtxos(address) {
|
|
76
|
-
|
|
77
|
-
this.realm.write(() => {
|
|
78
|
-
const toDelete = this.realm.objects("ArkVtxo").filtered("address == $0", address);
|
|
79
|
-
this.realm.delete(toDelete);
|
|
80
|
-
});
|
|
74
|
+
return this.deleteWhere("ArkVtxo", "address", address);
|
|
81
75
|
}
|
|
82
|
-
async
|
|
76
|
+
async getVtxosForScriptPage(script, page, options) {
|
|
77
|
+
chunkI4YBVHAK_cjs.assertPageRequest(page);
|
|
83
78
|
await this.ensureInit();
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
79
|
+
let results = this.realm.objects("ArkVtxo").filtered("script == $0", script);
|
|
80
|
+
if (options?.unspentOnly) {
|
|
81
|
+
results = results.filtered(
|
|
82
|
+
"(isSpent == null OR isSpent == $0) AND (spentBy == null OR spentBy == $1) AND (settledBy == null OR settledBy == $1)",
|
|
83
|
+
false,
|
|
84
|
+
""
|
|
85
|
+
);
|
|
90
86
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
87
|
+
if (page.after) {
|
|
88
|
+
results = results.filtered(
|
|
89
|
+
"address > $0 OR (address == $0 AND (txid > $1 OR (txid == $1 AND vout > $2)))",
|
|
90
|
+
page.after.address,
|
|
91
|
+
page.after.txid,
|
|
92
|
+
page.after.vout
|
|
93
|
+
);
|
|
97
94
|
}
|
|
98
|
-
|
|
95
|
+
const rows = [];
|
|
96
|
+
for (const row of results.sorted([
|
|
97
|
+
["address", false],
|
|
98
|
+
["txid", false],
|
|
99
|
+
["vout", false]
|
|
100
|
+
])) {
|
|
101
|
+
rows.push({ address: row.address, vtxo: vtxoObjectToDomain(row) });
|
|
102
|
+
if (rows.length > page.limit) break;
|
|
103
|
+
}
|
|
104
|
+
const result = chunkI4YBVHAK_cjs.pageResult(rows, page.limit, (row) => ({
|
|
105
|
+
address: row.address,
|
|
106
|
+
txid: row.vtxo.txid,
|
|
107
|
+
vout: row.vtxo.vout
|
|
108
|
+
}));
|
|
109
|
+
return options?.unspentOnly ? { ...result, items: result.items.filter((row) => !chunk7NK6XFC3_cjs.isVtxoSpent(row.vtxo)) } : result;
|
|
110
|
+
}
|
|
111
|
+
async saveVtxosForScript(key, vtxos) {
|
|
112
|
+
return this.saveVtxos(chunkI4YBVHAK_cjs.checkSaveVtxosForScript("RealmWalletRepository", key, vtxos), vtxos);
|
|
99
113
|
}
|
|
100
114
|
async deleteVtxosForScript(script) {
|
|
101
|
-
|
|
102
|
-
this.realm.write(() => {
|
|
103
|
-
const toDelete = this.realm.objects("ArkVtxo").filtered("script == $0", script);
|
|
104
|
-
this.realm.delete(toDelete);
|
|
105
|
-
});
|
|
115
|
+
return this.deleteWhere("ArkVtxo", "script", script);
|
|
106
116
|
}
|
|
107
117
|
// ── UTXO management ────────────────────────────────────────────────
|
|
108
|
-
async
|
|
118
|
+
async getUtxosPage(address, page) {
|
|
119
|
+
return this.pageByAddress("ArkUtxo", address, page, utxoObjectToDomain);
|
|
120
|
+
}
|
|
121
|
+
async pageByAddress(schema, address, page, deserialize) {
|
|
122
|
+
chunkI4YBVHAK_cjs.assertPageRequest(page);
|
|
109
123
|
await this.ensureInit();
|
|
110
|
-
|
|
111
|
-
|
|
124
|
+
let results = this.realm.objects(schema).filtered("address == $0", address);
|
|
125
|
+
if (page.after) {
|
|
126
|
+
results = results.filtered(
|
|
127
|
+
"txid > $0 OR (txid == $0 AND vout > $1)",
|
|
128
|
+
page.after.txid,
|
|
129
|
+
page.after.vout
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
const rows = [];
|
|
133
|
+
for (const row of results.sorted([
|
|
134
|
+
["txid", false],
|
|
135
|
+
["vout", false]
|
|
136
|
+
])) {
|
|
137
|
+
rows.push({ key: { txid: row.txid, vout: row.vout }, item: deserialize(row) });
|
|
138
|
+
if (rows.length > page.limit) break;
|
|
139
|
+
}
|
|
140
|
+
const result = chunkI4YBVHAK_cjs.pageResult(rows, page.limit, (row) => row.key);
|
|
141
|
+
return { items: result.items.map((row) => row.item), nextCursor: result.nextCursor };
|
|
112
142
|
}
|
|
113
143
|
async saveUtxos(address, utxos) {
|
|
114
144
|
await this.ensureInit();
|
|
115
145
|
this.realm.write(() => {
|
|
116
146
|
for (const utxo of utxos) {
|
|
117
|
-
const s =
|
|
147
|
+
const s = chunkI4YBVHAK_cjs.serializeUtxo(utxo);
|
|
118
148
|
this.realm.create(
|
|
119
149
|
"ArkUtxo",
|
|
120
150
|
{
|
|
@@ -137,19 +167,31 @@ var RealmWalletRepository = class {
|
|
|
137
167
|
});
|
|
138
168
|
}
|
|
139
169
|
async deleteUtxos(address) {
|
|
140
|
-
|
|
141
|
-
this.realm.write(() => {
|
|
142
|
-
const toDelete = this.realm.objects("ArkUtxo").filtered("address == $0", address);
|
|
143
|
-
this.realm.delete(toDelete);
|
|
144
|
-
});
|
|
170
|
+
return this.deleteWhere("ArkUtxo", "address", address);
|
|
145
171
|
}
|
|
146
172
|
// ── Transaction history ────────────────────────────────────────────
|
|
147
|
-
async
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
173
|
+
async getTransactionHistoryPage(filter, page) {
|
|
174
|
+
chunkI4YBVHAK_cjs.assertPageRequest(page);
|
|
175
|
+
chunkI4YBVHAK_cjs.assertHistoryPageFilter(filter);
|
|
176
|
+
let results = this.realm.objects("ArkTransaction").filtered("address == $0", filter.address);
|
|
177
|
+
results = results.filtered(
|
|
178
|
+
"createdAt >= $0",
|
|
179
|
+
Math.max(filter.since ?? 0, page.after?.createdAt ?? 0)
|
|
180
|
+
);
|
|
181
|
+
const rows = [];
|
|
182
|
+
for (const row of results.sorted([
|
|
183
|
+
["createdAt", false],
|
|
184
|
+
["boardingTxid", false],
|
|
185
|
+
["commitmentTxid", false],
|
|
186
|
+
["arkTxid", false]
|
|
187
|
+
])) {
|
|
188
|
+
const tx = txObjectToDomain(row);
|
|
189
|
+
if (page.after !== void 0 && chunkI4YBVHAK_cjs.compareHistoryCursors({ createdAt: tx.createdAt, key: tx.key }, page.after) <= 0)
|
|
190
|
+
continue;
|
|
191
|
+
rows.push(tx);
|
|
192
|
+
if (rows.length > page.limit) break;
|
|
193
|
+
}
|
|
194
|
+
return chunkI4YBVHAK_cjs.pageResult(rows, page.limit, (tx) => ({ createdAt: tx.createdAt, key: tx.key }));
|
|
153
195
|
}
|
|
154
196
|
async saveTransactions(address, txs) {
|
|
155
197
|
await this.ensureInit();
|
|
@@ -167,7 +209,7 @@ var RealmWalletRepository = class {
|
|
|
167
209
|
amount: tx.amount,
|
|
168
210
|
settled: tx.settled,
|
|
169
211
|
createdAt: tx.createdAt,
|
|
170
|
-
assetsJson: tx.assets ? JSON.stringify(
|
|
212
|
+
assetsJson: tx.assets ? JSON.stringify(chunkI4YBVHAK_cjs.serializeAssets(tx.assets)) : null
|
|
171
213
|
},
|
|
172
214
|
"modified"
|
|
173
215
|
);
|
|
@@ -175,9 +217,12 @@ var RealmWalletRepository = class {
|
|
|
175
217
|
});
|
|
176
218
|
}
|
|
177
219
|
async deleteTransactions(address) {
|
|
220
|
+
return this.deleteWhere("ArkTransaction", "address", address);
|
|
221
|
+
}
|
|
222
|
+
async deleteWhere(objectType, field, value) {
|
|
178
223
|
await this.ensureInit();
|
|
179
224
|
this.realm.write(() => {
|
|
180
|
-
const toDelete = this.realm.objects(
|
|
225
|
+
const toDelete = this.realm.objects(objectType).filtered(`${field} == $0`, value);
|
|
181
226
|
this.realm.delete(toDelete);
|
|
182
227
|
});
|
|
183
228
|
}
|
|
@@ -241,9 +286,9 @@ function vtxoObjectToDomain(obj) {
|
|
|
241
286
|
// Post-migration every row has `script`, but the backfill is
|
|
242
287
|
// idempotent: derive from `address` if the legacy column is still
|
|
243
288
|
// null (e.g. the migration hasn't run yet on this handle).
|
|
244
|
-
script: obj.script ??
|
|
289
|
+
script: obj.script ?? chunkI4YBVHAK_cjs.scriptFromArkAddress(obj.address)
|
|
245
290
|
};
|
|
246
|
-
return
|
|
291
|
+
return chunkI4YBVHAK_cjs.deserializeVtxo(serialized);
|
|
247
292
|
}
|
|
248
293
|
function utxoObjectToDomain(obj) {
|
|
249
294
|
const serialized = {
|
|
@@ -262,7 +307,7 @@ function utxoObjectToDomain(obj) {
|
|
|
262
307
|
status: JSON.parse(obj.statusJson),
|
|
263
308
|
extraWitness: obj.extraWitnessJson ? JSON.parse(obj.extraWitnessJson) : void 0
|
|
264
309
|
};
|
|
265
|
-
return
|
|
310
|
+
return chunkI4YBVHAK_cjs.deserializeUtxo(serialized);
|
|
266
311
|
}
|
|
267
312
|
function txObjectToDomain(obj) {
|
|
268
313
|
const tx = {
|
|
@@ -277,7 +322,7 @@ function txObjectToDomain(obj) {
|
|
|
277
322
|
createdAt: obj.createdAt
|
|
278
323
|
};
|
|
279
324
|
if (obj.assetsJson) {
|
|
280
|
-
tx.assets =
|
|
325
|
+
tx.assets = chunkI4YBVHAK_cjs.deserializeAssets(JSON.parse(obj.assetsJson));
|
|
281
326
|
}
|
|
282
327
|
return tx;
|
|
283
328
|
}
|
|
@@ -288,7 +333,7 @@ var RealmContractRepository = class {
|
|
|
288
333
|
this.realm = realm;
|
|
289
334
|
}
|
|
290
335
|
realm;
|
|
291
|
-
version =
|
|
336
|
+
version = 3;
|
|
292
337
|
// ── Lifecycle ──────────────────────────────────────────────────────
|
|
293
338
|
async ensureInit() {
|
|
294
339
|
}
|
|
@@ -302,41 +347,30 @@ var RealmContractRepository = class {
|
|
|
302
347
|
});
|
|
303
348
|
}
|
|
304
349
|
// ── Contract management ────────────────────────────────────────────
|
|
305
|
-
async
|
|
306
|
-
|
|
350
|
+
async getContractsPage(filter, page) {
|
|
351
|
+
chunkI4YBVHAK_cjs.assertPageRequest(page);
|
|
352
|
+
if (chunkI4YBVHAK_cjs.contractFilterMatchesNothing(filter)) return { items: [] };
|
|
307
353
|
let results = this.realm.objects("ArkContract");
|
|
354
|
+
const parts = [];
|
|
355
|
+
const args = [];
|
|
356
|
+
let argIndex = 0;
|
|
308
357
|
if (filter) {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
argIndex = this.
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
argIndex
|
|
318
|
-
);
|
|
319
|
-
argIndex = this.addFilterCondition(
|
|
320
|
-
filterParts,
|
|
321
|
-
filterArgs,
|
|
322
|
-
"state",
|
|
323
|
-
filter.state,
|
|
324
|
-
argIndex
|
|
325
|
-
);
|
|
326
|
-
argIndex = this.addFilterCondition(
|
|
327
|
-
filterParts,
|
|
328
|
-
filterArgs,
|
|
329
|
-
"type",
|
|
330
|
-
filter.type,
|
|
331
|
-
argIndex
|
|
332
|
-
);
|
|
333
|
-
argIndex = this.addWatchCondition(filterParts, filterArgs, filter.watch, argIndex);
|
|
334
|
-
if (filterParts.length > 0) {
|
|
335
|
-
const query = filterParts.join(" AND ");
|
|
336
|
-
results = results.filtered(query, ...filterArgs);
|
|
337
|
-
}
|
|
358
|
+
argIndex = this.addFilterCondition(parts, args, "script", filter.script, argIndex);
|
|
359
|
+
argIndex = this.addFilterCondition(parts, args, "state", filter.state, argIndex);
|
|
360
|
+
argIndex = this.addFilterCondition(parts, args, "type", filter.type, argIndex);
|
|
361
|
+
argIndex = this.addWatchCondition(parts, args, filter.watch, argIndex);
|
|
362
|
+
}
|
|
363
|
+
if (page.after !== void 0) {
|
|
364
|
+
parts.push(`script > $${argIndex}`);
|
|
365
|
+
args.push(page.after);
|
|
338
366
|
}
|
|
339
|
-
|
|
367
|
+
if (parts.length) results = results.filtered(parts.join(" AND "), ...args);
|
|
368
|
+
const rows = [];
|
|
369
|
+
for (const row of results.sorted("script")) {
|
|
370
|
+
rows.push(contractObjectToDomain(row));
|
|
371
|
+
if (rows.length > page.limit) break;
|
|
372
|
+
}
|
|
373
|
+
return chunkI4YBVHAK_cjs.pageResult(rows, page.limit, (contract) => contract.script);
|
|
340
374
|
}
|
|
341
375
|
async saveContract(contract) {
|
|
342
376
|
await this.ensureInit();
|
|
@@ -457,7 +491,7 @@ var RealmIntentRepository = class {
|
|
|
457
491
|
const clashes = [
|
|
458
492
|
...this.realm.objects("ArkIntent").filtered("intentId == $0", intent.intentId)
|
|
459
493
|
].map(toIntent);
|
|
460
|
-
|
|
494
|
+
chunkI4YBVHAK_cjs.assertIntentIdUnique(intent, clashes);
|
|
461
495
|
}
|
|
462
496
|
this.realm.create(
|
|
463
497
|
"ArkIntent",
|
|
@@ -484,16 +518,23 @@ var RealmIntentRepository = class {
|
|
|
484
518
|
);
|
|
485
519
|
});
|
|
486
520
|
}
|
|
487
|
-
async
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
521
|
+
async getIntentsPage(filter, page) {
|
|
522
|
+
chunkI4YBVHAK_cjs.assertPageRequest(page);
|
|
523
|
+
let results = this.realm.objects("ArkIntent");
|
|
524
|
+
if (page.after !== void 0) results = results.filtered("intentTxId > $0", page.after);
|
|
525
|
+
const rows = [];
|
|
526
|
+
for (const row of results.sorted("intentTxId")) {
|
|
527
|
+
const intent = toIntent(row);
|
|
528
|
+
if (filter && !chunkI4YBVHAK_cjs.intentMatchesFilter(intent, filter)) continue;
|
|
529
|
+
rows.push(intent);
|
|
530
|
+
if (rows.length > page.limit) break;
|
|
531
|
+
}
|
|
532
|
+
return chunkI4YBVHAK_cjs.pageResult(rows, page.limit, (intent) => intent.intentTxId);
|
|
492
533
|
}
|
|
493
534
|
async getLockedVtxoOutpoints() {
|
|
494
535
|
const out = [];
|
|
495
536
|
for (const o of [...this.realm.objects("ArkIntent")].map(toIntent))
|
|
496
|
-
if (!
|
|
537
|
+
if (!chunkI4YBVHAK_cjs.isTerminalIntentState(o.state)) out.push(...o.intentVtxos);
|
|
497
538
|
return out;
|
|
498
539
|
}
|
|
499
540
|
async [Symbol.asyncDispose]() {
|
|
@@ -535,7 +576,7 @@ var RealmVirtualTxRepository = class {
|
|
|
535
576
|
txid: t.txid,
|
|
536
577
|
psbt: t.psbt ?? prev?.psbt ?? null,
|
|
537
578
|
expiresAt: t.expiresAt ?? prev?.expiresAt ?? null,
|
|
538
|
-
type:
|
|
579
|
+
type: chunkI4YBVHAK_cjs.mergeChainedTxType(t.type, prev?.type)
|
|
539
580
|
},
|
|
540
581
|
"modified"
|
|
541
582
|
);
|
|
@@ -780,9 +821,9 @@ function runArkRealmMigrations(oldRealm, newRealm) {
|
|
|
780
821
|
for (let i = 0; i < newVtxos.length; i++) {
|
|
781
822
|
const newVtxo = newVtxos[i];
|
|
782
823
|
if (!newVtxo.script) {
|
|
783
|
-
newVtxo.script =
|
|
824
|
+
newVtxo.script = chunkI4YBVHAK_cjs.scriptFromArkAddress(newVtxo.address);
|
|
784
825
|
}
|
|
785
|
-
const facts =
|
|
826
|
+
const facts = chunkI4YBVHAK_cjs.legacyVtxoFacts(legacyByPk.get(newVtxo.pk));
|
|
786
827
|
if (facts) {
|
|
787
828
|
if (newVtxo.isSpent == null) newVtxo.isSpent = facts.isSpent;
|
|
788
829
|
if (newVtxo.isSwept == null) newVtxo.isSwept = facts.isSwept;
|
|
@@ -812,7 +853,7 @@ function runArkRealmMigrations(oldRealm, newRealm) {
|
|
|
812
853
|
|
|
813
854
|
Object.defineProperty(exports, "ChainedTxType", {
|
|
814
855
|
enumerable: true,
|
|
815
|
-
get: function () { return
|
|
856
|
+
get: function () { return chunkI4YBVHAK_cjs.ChainedTxType; }
|
|
816
857
|
});
|
|
817
858
|
exports.ARK_REALM_SCHEMA_VERSION = ARK_REALM_SCHEMA_VERSION;
|
|
818
859
|
exports.ArkExperimentalRealmSchemas = ArkExperimentalRealmSchemas;
|