@arkade-os/sdk 0.4.69 → 0.4.70
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 +5 -5
- package/dist/adapters/expo.js +3 -3
- package/dist/adapters/indexedDB.cjs +5 -5
- package/dist/adapters/indexedDB.js +4 -4
- package/dist/{chunk-GVHUHTRH.cjs → chunk-3KW4TWP2.cjs} +17 -17
- package/dist/{chunk-GVHUHTRH.cjs.map → chunk-3KW4TWP2.cjs.map} +1 -1
- package/dist/{chunk-WIFL5QYZ.cjs → chunk-3OKEUDHU.cjs} +49 -49
- package/dist/{chunk-WIFL5QYZ.cjs.map → chunk-3OKEUDHU.cjs.map} +1 -1
- package/dist/{chunk-5MLC2HU3.cjs → chunk-57636V35.cjs} +3 -3
- package/dist/{chunk-5MLC2HU3.cjs.map → chunk-57636V35.cjs.map} +1 -1
- package/dist/{chunk-2PPL3O7Z.js → chunk-6UM55KPZ.js} +3 -3
- package/dist/{chunk-2PPL3O7Z.js.map → chunk-6UM55KPZ.js.map} +1 -1
- package/dist/{chunk-HQ4DMGA4.cjs → chunk-B73Q75IL.cjs} +10 -10
- package/dist/{chunk-HQ4DMGA4.cjs.map → chunk-B73Q75IL.cjs.map} +1 -1
- package/dist/{chunk-YG7T6LI3.js → chunk-F5E7LI6G.js} +3 -3
- package/dist/{chunk-YG7T6LI3.js.map → chunk-F5E7LI6G.js.map} +1 -1
- package/dist/{chunk-XLWDX7QZ.js → chunk-IUFTICRY.js} +4 -4
- package/dist/{chunk-XLWDX7QZ.js.map → chunk-IUFTICRY.js.map} +1 -1
- package/dist/{chunk-XQPN5YP2.cjs → chunk-JJ7AXR4O.cjs} +17 -17
- package/dist/{chunk-XQPN5YP2.cjs.map → chunk-JJ7AXR4O.cjs.map} +1 -1
- package/dist/{chunk-TA7XLEP2.js → chunk-JVHO6XHG.js} +84 -11
- package/dist/chunk-JVHO6XHG.js.map +1 -0
- package/dist/{chunk-L5SCQYHF.js → chunk-TXSF2DKX.js} +3 -3
- package/dist/{chunk-L5SCQYHF.js.map → chunk-TXSF2DKX.js.map} +1 -1
- package/dist/{chunk-MNMPGEK2.js → chunk-UG3EZDLF.js} +4 -4
- package/dist/{chunk-MNMPGEK2.js.map → chunk-UG3EZDLF.js.map} +1 -1
- package/dist/{chunk-EBYCTLET.cjs → chunk-XTCOSZ34.cjs} +519 -440
- package/dist/chunk-XTCOSZ34.cjs.map +1 -0
- package/dist/contracts/handlers/index.cjs +9 -9
- package/dist/contracts/handlers/index.js +2 -2
- package/dist/index.cjs +315 -291
- package/dist/index.d.cts +72 -13
- package/dist/index.d.ts +72 -13
- package/dist/index.js +4 -4
- package/dist/repositories/realm/index.cjs +19 -19
- package/dist/repositories/realm/index.js +5 -5
- package/dist/repositories/sqlite/index.cjs +18 -18
- package/dist/repositories/sqlite/index.js +5 -5
- package/dist/wallet/expo/background.cjs +14 -14
- package/dist/wallet/expo/background.js +6 -6
- package/dist/wallet/expo/index.cjs +14 -14
- package/dist/wallet/expo/index.js +5 -5
- package/dist/worker/expo/index.cjs +9 -9
- package/dist/worker/expo/index.js +5 -5
- package/package.json +2 -1
- package/dist/chunk-EBYCTLET.cjs.map +0 -1
- package/dist/chunk-TA7XLEP2.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -6119,6 +6119,25 @@ interface RouteQuote {
|
|
|
6119
6119
|
fee: number;
|
|
6120
6120
|
/** `amount + fee` — what leaves the wallet. */
|
|
6121
6121
|
total: number;
|
|
6122
|
+
/**
|
|
6123
|
+
* @experimental The asset shape is provisional. The v2 swap client models
|
|
6124
|
+
* assets as `give`/`take`/`amountOn` over `AssetRef`, and the two
|
|
6125
|
+
* vocabularies are expected to converge on v0.5; do not treat this field as
|
|
6126
|
+
* stable 0.4.x API.
|
|
6127
|
+
*
|
|
6128
|
+
* The asset view; absent means BTC only. The sats fields keep their
|
|
6129
|
+
* meaning — an asset rides a sats-carrying output, so `amount` is the
|
|
6130
|
+
* carrier, not zero.
|
|
6131
|
+
*
|
|
6132
|
+
* A pair, not a triple: on a cross-asset route these name DIFFERENT
|
|
6133
|
+
* assets, so `total = amount + fee` cannot hold across the two units —
|
|
6134
|
+
* which forces the purchase price into `fee`. Prefer `assets.spent` for a
|
|
6135
|
+
* cost display.
|
|
6136
|
+
*/
|
|
6137
|
+
assets?: {
|
|
6138
|
+
delivered: Asset;
|
|
6139
|
+
spent: Asset;
|
|
6140
|
+
};
|
|
6122
6141
|
/** Execute. Returns an observable handle, never a bare result. */
|
|
6123
6142
|
send(): Promise<PaymentHandle>;
|
|
6124
6143
|
meta?: Record<string, unknown>;
|
|
@@ -6132,19 +6151,25 @@ interface RouterPreferences {
|
|
|
6132
6151
|
tieBreak?: "first" | "require-choice";
|
|
6133
6152
|
}
|
|
6134
6153
|
interface RouterContext {
|
|
6135
|
-
|
|
6154
|
+
/** A rail needing more than this takes it as a constructor dep, rather than
|
|
6155
|
+
* narrowing the context every other rail shares. */
|
|
6156
|
+
wallet: IWallet;
|
|
6136
6157
|
/** Loosely typed in core to avoid a dependency on boltz-swap; swap rails cast it. */
|
|
6137
6158
|
swaps?: unknown;
|
|
6138
6159
|
prefs: RouterPreferences;
|
|
6139
6160
|
}
|
|
6140
|
-
/**
|
|
6141
|
-
*
|
|
6142
|
-
* `amount` supplements or overrides any amount encoded in `raw`. */
|
|
6161
|
+
/** Mirrors {@link Recipient}: an Arkade address is the same string for BTC and
|
|
6162
|
+
* for an asset, so the AMOUNT names the asset, never the target. */
|
|
6143
6163
|
interface PaymentRequest {
|
|
6144
6164
|
/** Raw target: bare address/invoice, or a BIP21 URI. */
|
|
6145
6165
|
raw: string;
|
|
6146
6166
|
/** Explicit sats; supplements/overrides any amount encoded in `raw`. */
|
|
6147
6167
|
amount?: number;
|
|
6168
|
+
/** @experimental — provisional, see {@link RouteQuote.assets}.
|
|
6169
|
+
*
|
|
6170
|
+
* Additive: an asset transfer also moves sats, so a 500 USDX request
|
|
6171
|
+
* legitimately has both. A rail that cannot deliver assets must REFUSE. */
|
|
6172
|
+
assets?: Asset[];
|
|
6148
6173
|
}
|
|
6149
6174
|
/** A payment rail — registered by id, mirrors the ActivityRegistry resolver shape. */
|
|
6150
6175
|
interface PaymentRail {
|
|
@@ -6212,6 +6237,14 @@ declare function resolveSendAmount(railId: string, raw: string, amount?: number)
|
|
|
6212
6237
|
* distinction is left to `resolveSendAmount` at quote time.
|
|
6213
6238
|
*/
|
|
6214
6239
|
declare function tryResolveSendAmount(raw: string, amount?: number): number | undefined;
|
|
6240
|
+
/** The assets a request asks for — `[]` when it names none. */
|
|
6241
|
+
declare function assetsOf(req: PaymentRequest): Asset[];
|
|
6242
|
+
/** For a BTC-only rail: refusing is what leaves the router free to rank an
|
|
6243
|
+
* asset-capable one, instead of paying the carrier and dropping the asset. */
|
|
6244
|
+
declare function assertNoAssets(railId: string, req: PaymentRequest): void;
|
|
6245
|
+
/** Exactly one: `Wallet.send` takes a list because one output can carry
|
|
6246
|
+
* several, but a routed PAYMENT is one thing being paid. */
|
|
6247
|
+
declare function resolveAssetAmount(railId: string, req: PaymentRequest): Asset;
|
|
6215
6248
|
|
|
6216
6249
|
type Update = {
|
|
6217
6250
|
status: PaymentStatus;
|
|
@@ -6260,9 +6293,27 @@ declare class PaymentRouter {
|
|
|
6260
6293
|
* The only rail that is receiver-exact for free: an off-chain send delivers the
|
|
6261
6294
|
* full amount and carries no counterparty or on-chain fee, so `fee` is 0 and
|
|
6262
6295
|
* `total` equals `amount` (see {@link RouteQuote}).
|
|
6296
|
+
*
|
|
6297
|
+
* BTC only: a request naming an asset drops this rail rather than paying its
|
|
6298
|
+
* sats and dropping the asset, leaving `ark-asset` to rank.
|
|
6263
6299
|
*/
|
|
6264
6300
|
declare function arkRail(): PaymentRail;
|
|
6265
6301
|
|
|
6302
|
+
/** The sats carrier an asset rides on; mirrors `Recipient.amount`'s default. */
|
|
6303
|
+
declare const ASSET_CARRIER_SATS = 330;
|
|
6304
|
+
/**
|
|
6305
|
+
* Off-chain Arkade send of an ASSET — the sibling of `ark`.
|
|
6306
|
+
*
|
|
6307
|
+
* They split on `available()` rather than `match()` because both legitimately
|
|
6308
|
+
* match the address; which one can pay is a question about the amount, so
|
|
6309
|
+
* `options()` returns exactly one and their relative priority is immaterial.
|
|
6310
|
+
*/
|
|
6311
|
+
declare function arkAssetRail(): PaymentRail;
|
|
6312
|
+
|
|
6313
|
+
/** The canonical fee source for {@link onchainRail}: the operator's schedule, as
|
|
6314
|
+
* the wallet already reads it. Keeps the one `arkProvider` reach in one place,
|
|
6315
|
+
* so an app registering the rail itself need not know where fees live. */
|
|
6316
|
+
declare const walletFeeSource: (wallet: Wallet) => () => Promise<FeeInfo>;
|
|
6266
6317
|
/**
|
|
6267
6318
|
* On-chain BTC send via collaborative exit — the Wallet-only on-chain path (no
|
|
6268
6319
|
* swap). Matches a bare BTC address or the on-chain part of a unified BIP21 URI
|
|
@@ -6278,18 +6329,26 @@ declare function arkRail(): PaymentRail;
|
|
|
6278
6329
|
*
|
|
6279
6330
|
* An explicit amount is mandatory. To sweep the full balance, call
|
|
6280
6331
|
* `Ramps.offboard(address, feeInfo)` directly — the router has no amountless path.
|
|
6332
|
+
*
|
|
6333
|
+
* @param deps.feeInfo - Source of the operator's fee schedule. Required: a rail
|
|
6334
|
+
* that cannot price an offboard must not be constructible — a silently dropped
|
|
6335
|
+
* rail on the money path is worse than a wiring error at startup.
|
|
6281
6336
|
*/
|
|
6282
|
-
declare function onchainRail(
|
|
6337
|
+
declare function onchainRail(deps: {
|
|
6338
|
+
feeInfo: () => Promise<FeeInfo>;
|
|
6339
|
+
}): PaymentRail;
|
|
6283
6340
|
|
|
6284
6341
|
/**
|
|
6285
|
-
* Default payment router with the Wallet-only rails: `ark` (off-chain send)
|
|
6286
|
-
* `
|
|
6287
|
-
* `@arkade-os/boltz-swap`, which ships a
|
|
6288
|
-
* swaps)` overload composing the full set
|
|
6342
|
+
* Default payment router with the Wallet-only rails: `ark` (off-chain BTC send),
|
|
6343
|
+
* `ark-asset` (off-chain asset send) and `onchain` (collaborative exit).
|
|
6344
|
+
* Lightning and chain-swap rails live in `@arkade-os/boltz-swap`, which ships a
|
|
6345
|
+
* `createDefaultPaymentRouter(wallet, swaps)` overload composing the full set;
|
|
6346
|
+
* solver-routed rails live in `@arkade-os/swap` and are registered by the app.
|
|
6289
6347
|
*
|
|
6290
|
-
* The default priority is `["ark", "lightning", "onchain"]
|
|
6291
|
-
*
|
|
6292
|
-
*
|
|
6348
|
+
* The default priority is `["ark", "ark-asset", "lightning", "onchain"]`.
|
|
6349
|
+
* `"lightning"` is listed so it ranks correctly once the boltz rail is added.
|
|
6350
|
+
* `ark` and `ark-asset` never compete — the amount decides which is
|
|
6351
|
+
* available — so their order between themselves is immaterial.
|
|
6293
6352
|
*/
|
|
6294
6353
|
declare function createDefaultPaymentRouter(wallet: Wallet): PaymentRouter;
|
|
6295
6354
|
|
|
@@ -6568,4 +6627,4 @@ declare class AssetManager extends ReadonlyAssetManager implements IAssetManager
|
|
|
6568
6627
|
burn(params: BurnParams): Promise<string>;
|
|
6569
6628
|
}
|
|
6570
6629
|
|
|
6571
|
-
export { ARKADE_MAGIC, ARKADE_SALTED_PREIMAGE_TAG, ARKADE_SWAP_PREIMAGE_TAG, Activity, ActivityRegistry, AddressAllocationCapable, AmbiguousRouteError, type AnchorBumper, ArkAddress, ArkInfo, ArkIntent, ArkNote, ArkProvider, type ArkPsbtFieldCoder, ArkPsbtFieldKey, ArkPsbtFieldKeyType, ArkTransaction, type ArkTxInput, type ArkadeBatchInput, ArkadeCash, ArkadeContractParams, type ArkadeExtendedCoin, type ArkadeExtendedVirtualCoin, Asset, AssetDetails, AssetManager, BIP21, BIP21Error, type BIP21Params, type BIP21ParseResult, BIP322, BLOCKED_UPGRADE_TIMEOUT_MS, Batch, BatchExpiryPolicy, BurnParams, CSVMultisigTapscript, CachingArkProvider, ChainTx, Coin, ConditionWitness, ConnectionDisposedError, type ConnectorTreeNode, Contract, ContractEvent, ContractRepository, ContractRepositoryImpl, ContractSyncState, ContractWatcherConfig, ContractWithVtxos, CosignerPublicKey, CreateContractParams, DEFAULT_MESSAGE_TIMEOUTS, DatabaseUpgradeBlockedError, DefaultVtxo, DelegateInfo, DelegateNotConfiguredError, DelegatorNotConfiguredError, DescriptorIdentity, type DescriptorIdentityOptions, type DescriptorOptions, type DescriptorSigner, DescriptorSigningProviderMissingError, type DeterministicSigner, 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 ExcludableVtxo, type ExecutorEvent, type ExecutorOptions, 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, GetNewAddressesOptions, GetVtxosFilter, HDAllocationCapable, HDDescriptorProvider, type HDDeterministicSignCapable, HDWalletCapable, 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, type ManagedConnection, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, type MessageHandler, type MessageTimeouts, MigrationGlobalSkipReason, MigrationLegSkipReason, type MigrationStatus, MissingSigningDescriptorError, MnemonicIdentity, type MnemonicOptions, Network, NetworkName, type NetworkOptions, NewAddress, OffchainInput, type OffchainTx, type OnExitObserved, OnchainInput, OnchainProvider, OnchainWallet, Outpoint, P2A, type ParsedArkContract, PathContext, PathSelection, type PaymentHandle, type PaymentOption, type PaymentRail, type PaymentRequest, PaymentRouter, type PaymentStatus, PrevArkTxField, PrevoutTxField, ProviderConnectionState, type ProvisionedClaimSecret, type ProvisionedKey, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlyIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, Recipient, ReissuanceParams, RelativeTimelock, RenewVtxosOptions, type RequestEnvelope, type ResponseEnvelope, RestEmulatorProvider, type RouteQuote, type RouteResult, type RouterContext, type RouterPreferences, SeedIdentity, type SeedIdentityOptions, SendBitcoinParams, SendParams, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, type ServiceWorkerWalletMode, SettleParams, SettlementConfig, SettlementEvent, SignedIntent, SignerSession, SignerStatus, SingleKey, Status, StorageConfig, TapLeafScript, Transaction, TreeNonces, TreePartialSigs, TxNotificationEvent, TxTree, TxWeightEstimator, UnannotatableInputError, UnilateralExit, UnknownPacket, Unroll, type VSize, type VerifyServerSignatures, VirtualCoin, VirtualTx, VirtualTxRepository, VtxoBranch, type VtxoExclusion, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, Wallet, WalletBalance, WalletCannotSignError, WalletMessageHandler, WalletNotInitializedError, WalletRepository, WalletRepositoryImpl, WsElectrumChainSource, adoptContractDescriptor, arkRail, arkTarget, index as arkade, assembleBtcdTaprootTree, assertFinalCommitmentMatchesValidated, assertSendableAmount, assertSubmittedArkTxid, index$1 as asset, awaitTransaction, btcTarget, buildForfeitTx, buildOffchainTx, buildPreimageMessage, buildSaltedPreimageMessage, buildVersion, claimWithPreimageIdentity, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, contractPreimage, contractSigner, createAssetPacket, createDefaultPaymentRouter, createManagedConnection, decodeArkContract, deleteByIndex, deriveDescriptorLeafCompressedPubKey, deriveDescriptorLeafPubKey, deserializeExitPackage, encodeArkContract, exitObserverFor, gateExclusion, gatedContracts, getAllByIndexValues, getArkPsbtFields, getMigrationStatus, hasBoardingTxExpired, identityDescriptor, invoiceTarget, isArkContract, isBtcAddress, isCltvSatisfied, isContractGenericallySpendable, isCsvSpendable, isDeterministicSigner, isHDDeterministicSignCapable, isLightningInvoice, isLnurl, isMessageBusInitializingError, isMessageBusNotInitializedError, isPerArtifactDescriptor, isRetryableProviderError, isValidArkAddress, logExcludedVtxos, makeHandle, matchServerCheckpoints, migrateWalletRepository, normalizeToDescriptor, notifyExitObserved, onchainRail, openDatabase, outpointExclusion, outpointReasons, parseHDDescriptor, promisifyRequest, provisionClaimSecret, provisionRefundKey, requiresMigration, resolveSendAmount, rollbackMigration, sdkVersion, selectCoinsWithAsset, sequenceToTimelock, serializeExitPackage, setArkPsbtField, setupServiceWorker, signAndSubmitOffchainTx, timelockToSequence, toXOnly, tryResolveSendAmount, validateBatchRecipients, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures };
|
|
6630
|
+
export { ARKADE_MAGIC, ARKADE_SALTED_PREIMAGE_TAG, ARKADE_SWAP_PREIMAGE_TAG, ASSET_CARRIER_SATS, Activity, ActivityRegistry, AddressAllocationCapable, AmbiguousRouteError, type AnchorBumper, ArkAddress, ArkInfo, ArkIntent, ArkNote, ArkProvider, type ArkPsbtFieldCoder, ArkPsbtFieldKey, ArkPsbtFieldKeyType, ArkTransaction, type ArkTxInput, type ArkadeBatchInput, ArkadeCash, ArkadeContractParams, type ArkadeExtendedCoin, type ArkadeExtendedVirtualCoin, Asset, AssetDetails, AssetManager, BIP21, BIP21Error, type BIP21Params, type BIP21ParseResult, BIP322, BLOCKED_UPGRADE_TIMEOUT_MS, Batch, BatchExpiryPolicy, BurnParams, CSVMultisigTapscript, CachingArkProvider, ChainTx, Coin, ConditionWitness, ConnectionDisposedError, type ConnectorTreeNode, Contract, ContractEvent, ContractRepository, ContractRepositoryImpl, ContractSyncState, ContractWatcherConfig, ContractWithVtxos, CosignerPublicKey, CreateContractParams, DEFAULT_MESSAGE_TIMEOUTS, DatabaseUpgradeBlockedError, DefaultVtxo, DelegateInfo, DelegateNotConfiguredError, DelegatorNotConfiguredError, DescriptorIdentity, type DescriptorIdentityOptions, type DescriptorOptions, type DescriptorSigner, DescriptorSigningProviderMissingError, type DeterministicSigner, 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 ExcludableVtxo, type ExecutorEvent, type ExecutorOptions, 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, GetNewAddressesOptions, GetVtxosFilter, HDAllocationCapable, HDDescriptorProvider, type HDDeterministicSignCapable, HDWalletCapable, 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, type ManagedConnection, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, type MessageHandler, type MessageTimeouts, MigrationGlobalSkipReason, MigrationLegSkipReason, type MigrationStatus, MissingSigningDescriptorError, MnemonicIdentity, type MnemonicOptions, Network, NetworkName, type NetworkOptions, NewAddress, OffchainInput, type OffchainTx, type OnExitObserved, OnchainInput, OnchainProvider, OnchainWallet, Outpoint, P2A, type ParsedArkContract, PathContext, PathSelection, type PaymentHandle, type PaymentOption, type PaymentRail, type PaymentRequest, PaymentRouter, type PaymentStatus, PrevArkTxField, PrevoutTxField, ProviderConnectionState, type ProvisionedClaimSecret, type ProvisionedKey, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlyIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, Recipient, ReissuanceParams, RelativeTimelock, RenewVtxosOptions, type RequestEnvelope, type ResponseEnvelope, RestEmulatorProvider, type RouteQuote, type RouteResult, type RouterContext, type RouterPreferences, SeedIdentity, type SeedIdentityOptions, SendBitcoinParams, SendParams, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, type ServiceWorkerWalletMode, SettleParams, SettlementConfig, SettlementEvent, SignedIntent, SignerSession, SignerStatus, SingleKey, Status, StorageConfig, TapLeafScript, Transaction, TreeNonces, TreePartialSigs, TxNotificationEvent, TxTree, TxWeightEstimator, UnannotatableInputError, UnilateralExit, UnknownPacket, Unroll, type VSize, type VerifyServerSignatures, VirtualCoin, VirtualTx, VirtualTxRepository, VtxoBranch, type VtxoExclusion, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, Wallet, WalletBalance, WalletCannotSignError, WalletMessageHandler, WalletNotInitializedError, WalletRepository, WalletRepositoryImpl, WsElectrumChainSource, adoptContractDescriptor, arkAssetRail, arkRail, arkTarget, index as arkade, assembleBtcdTaprootTree, assertFinalCommitmentMatchesValidated, assertNoAssets, assertSendableAmount, assertSubmittedArkTxid, index$1 as asset, assetsOf, awaitTransaction, btcTarget, buildForfeitTx, buildOffchainTx, buildPreimageMessage, buildSaltedPreimageMessage, buildVersion, claimWithPreimageIdentity, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, contractPreimage, contractSigner, createAssetPacket, createDefaultPaymentRouter, createManagedConnection, decodeArkContract, deleteByIndex, deriveDescriptorLeafCompressedPubKey, deriveDescriptorLeafPubKey, deserializeExitPackage, encodeArkContract, exitObserverFor, gateExclusion, gatedContracts, getAllByIndexValues, getArkPsbtFields, getMigrationStatus, hasBoardingTxExpired, identityDescriptor, invoiceTarget, isArkContract, isBtcAddress, isCltvSatisfied, isContractGenericallySpendable, isCsvSpendable, isDeterministicSigner, isHDDeterministicSignCapable, isLightningInvoice, isLnurl, isMessageBusInitializingError, isMessageBusNotInitializedError, isPerArtifactDescriptor, isRetryableProviderError, isValidArkAddress, logExcludedVtxos, makeHandle, matchServerCheckpoints, migrateWalletRepository, normalizeToDescriptor, notifyExitObserved, onchainRail, openDatabase, outpointExclusion, outpointReasons, parseHDDescriptor, promisifyRequest, provisionClaimSecret, provisionRefundKey, requiresMigration, resolveAssetAmount, resolveSendAmount, rollbackMigration, sdkVersion, selectCoinsWithAsset, sequenceToTimelock, serializeExitPackage, setArkPsbtField, setupServiceWorker, signAndSubmitOffchainTx, timelockToSequence, toXOnly, tryResolveSendAmount, validateBatchRecipients, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, walletFeeSource };
|
package/dist/index.d.ts
CHANGED
|
@@ -6119,6 +6119,25 @@ interface RouteQuote {
|
|
|
6119
6119
|
fee: number;
|
|
6120
6120
|
/** `amount + fee` — what leaves the wallet. */
|
|
6121
6121
|
total: number;
|
|
6122
|
+
/**
|
|
6123
|
+
* @experimental The asset shape is provisional. The v2 swap client models
|
|
6124
|
+
* assets as `give`/`take`/`amountOn` over `AssetRef`, and the two
|
|
6125
|
+
* vocabularies are expected to converge on v0.5; do not treat this field as
|
|
6126
|
+
* stable 0.4.x API.
|
|
6127
|
+
*
|
|
6128
|
+
* The asset view; absent means BTC only. The sats fields keep their
|
|
6129
|
+
* meaning — an asset rides a sats-carrying output, so `amount` is the
|
|
6130
|
+
* carrier, not zero.
|
|
6131
|
+
*
|
|
6132
|
+
* A pair, not a triple: on a cross-asset route these name DIFFERENT
|
|
6133
|
+
* assets, so `total = amount + fee` cannot hold across the two units —
|
|
6134
|
+
* which forces the purchase price into `fee`. Prefer `assets.spent` for a
|
|
6135
|
+
* cost display.
|
|
6136
|
+
*/
|
|
6137
|
+
assets?: {
|
|
6138
|
+
delivered: Asset;
|
|
6139
|
+
spent: Asset;
|
|
6140
|
+
};
|
|
6122
6141
|
/** Execute. Returns an observable handle, never a bare result. */
|
|
6123
6142
|
send(): Promise<PaymentHandle>;
|
|
6124
6143
|
meta?: Record<string, unknown>;
|
|
@@ -6132,19 +6151,25 @@ interface RouterPreferences {
|
|
|
6132
6151
|
tieBreak?: "first" | "require-choice";
|
|
6133
6152
|
}
|
|
6134
6153
|
interface RouterContext {
|
|
6135
|
-
|
|
6154
|
+
/** A rail needing more than this takes it as a constructor dep, rather than
|
|
6155
|
+
* narrowing the context every other rail shares. */
|
|
6156
|
+
wallet: IWallet;
|
|
6136
6157
|
/** Loosely typed in core to avoid a dependency on boltz-swap; swap rails cast it. */
|
|
6137
6158
|
swaps?: unknown;
|
|
6138
6159
|
prefs: RouterPreferences;
|
|
6139
6160
|
}
|
|
6140
|
-
/**
|
|
6141
|
-
*
|
|
6142
|
-
* `amount` supplements or overrides any amount encoded in `raw`. */
|
|
6161
|
+
/** Mirrors {@link Recipient}: an Arkade address is the same string for BTC and
|
|
6162
|
+
* for an asset, so the AMOUNT names the asset, never the target. */
|
|
6143
6163
|
interface PaymentRequest {
|
|
6144
6164
|
/** Raw target: bare address/invoice, or a BIP21 URI. */
|
|
6145
6165
|
raw: string;
|
|
6146
6166
|
/** Explicit sats; supplements/overrides any amount encoded in `raw`. */
|
|
6147
6167
|
amount?: number;
|
|
6168
|
+
/** @experimental — provisional, see {@link RouteQuote.assets}.
|
|
6169
|
+
*
|
|
6170
|
+
* Additive: an asset transfer also moves sats, so a 500 USDX request
|
|
6171
|
+
* legitimately has both. A rail that cannot deliver assets must REFUSE. */
|
|
6172
|
+
assets?: Asset[];
|
|
6148
6173
|
}
|
|
6149
6174
|
/** A payment rail — registered by id, mirrors the ActivityRegistry resolver shape. */
|
|
6150
6175
|
interface PaymentRail {
|
|
@@ -6212,6 +6237,14 @@ declare function resolveSendAmount(railId: string, raw: string, amount?: number)
|
|
|
6212
6237
|
* distinction is left to `resolveSendAmount` at quote time.
|
|
6213
6238
|
*/
|
|
6214
6239
|
declare function tryResolveSendAmount(raw: string, amount?: number): number | undefined;
|
|
6240
|
+
/** The assets a request asks for — `[]` when it names none. */
|
|
6241
|
+
declare function assetsOf(req: PaymentRequest): Asset[];
|
|
6242
|
+
/** For a BTC-only rail: refusing is what leaves the router free to rank an
|
|
6243
|
+
* asset-capable one, instead of paying the carrier and dropping the asset. */
|
|
6244
|
+
declare function assertNoAssets(railId: string, req: PaymentRequest): void;
|
|
6245
|
+
/** Exactly one: `Wallet.send` takes a list because one output can carry
|
|
6246
|
+
* several, but a routed PAYMENT is one thing being paid. */
|
|
6247
|
+
declare function resolveAssetAmount(railId: string, req: PaymentRequest): Asset;
|
|
6215
6248
|
|
|
6216
6249
|
type Update = {
|
|
6217
6250
|
status: PaymentStatus;
|
|
@@ -6260,9 +6293,27 @@ declare class PaymentRouter {
|
|
|
6260
6293
|
* The only rail that is receiver-exact for free: an off-chain send delivers the
|
|
6261
6294
|
* full amount and carries no counterparty or on-chain fee, so `fee` is 0 and
|
|
6262
6295
|
* `total` equals `amount` (see {@link RouteQuote}).
|
|
6296
|
+
*
|
|
6297
|
+
* BTC only: a request naming an asset drops this rail rather than paying its
|
|
6298
|
+
* sats and dropping the asset, leaving `ark-asset` to rank.
|
|
6263
6299
|
*/
|
|
6264
6300
|
declare function arkRail(): PaymentRail;
|
|
6265
6301
|
|
|
6302
|
+
/** The sats carrier an asset rides on; mirrors `Recipient.amount`'s default. */
|
|
6303
|
+
declare const ASSET_CARRIER_SATS = 330;
|
|
6304
|
+
/**
|
|
6305
|
+
* Off-chain Arkade send of an ASSET — the sibling of `ark`.
|
|
6306
|
+
*
|
|
6307
|
+
* They split on `available()` rather than `match()` because both legitimately
|
|
6308
|
+
* match the address; which one can pay is a question about the amount, so
|
|
6309
|
+
* `options()` returns exactly one and their relative priority is immaterial.
|
|
6310
|
+
*/
|
|
6311
|
+
declare function arkAssetRail(): PaymentRail;
|
|
6312
|
+
|
|
6313
|
+
/** The canonical fee source for {@link onchainRail}: the operator's schedule, as
|
|
6314
|
+
* the wallet already reads it. Keeps the one `arkProvider` reach in one place,
|
|
6315
|
+
* so an app registering the rail itself need not know where fees live. */
|
|
6316
|
+
declare const walletFeeSource: (wallet: Wallet) => () => Promise<FeeInfo>;
|
|
6266
6317
|
/**
|
|
6267
6318
|
* On-chain BTC send via collaborative exit — the Wallet-only on-chain path (no
|
|
6268
6319
|
* swap). Matches a bare BTC address or the on-chain part of a unified BIP21 URI
|
|
@@ -6278,18 +6329,26 @@ declare function arkRail(): PaymentRail;
|
|
|
6278
6329
|
*
|
|
6279
6330
|
* An explicit amount is mandatory. To sweep the full balance, call
|
|
6280
6331
|
* `Ramps.offboard(address, feeInfo)` directly — the router has no amountless path.
|
|
6332
|
+
*
|
|
6333
|
+
* @param deps.feeInfo - Source of the operator's fee schedule. Required: a rail
|
|
6334
|
+
* that cannot price an offboard must not be constructible — a silently dropped
|
|
6335
|
+
* rail on the money path is worse than a wiring error at startup.
|
|
6281
6336
|
*/
|
|
6282
|
-
declare function onchainRail(
|
|
6337
|
+
declare function onchainRail(deps: {
|
|
6338
|
+
feeInfo: () => Promise<FeeInfo>;
|
|
6339
|
+
}): PaymentRail;
|
|
6283
6340
|
|
|
6284
6341
|
/**
|
|
6285
|
-
* Default payment router with the Wallet-only rails: `ark` (off-chain send)
|
|
6286
|
-
* `
|
|
6287
|
-
* `@arkade-os/boltz-swap`, which ships a
|
|
6288
|
-
* swaps)` overload composing the full set
|
|
6342
|
+
* Default payment router with the Wallet-only rails: `ark` (off-chain BTC send),
|
|
6343
|
+
* `ark-asset` (off-chain asset send) and `onchain` (collaborative exit).
|
|
6344
|
+
* Lightning and chain-swap rails live in `@arkade-os/boltz-swap`, which ships a
|
|
6345
|
+
* `createDefaultPaymentRouter(wallet, swaps)` overload composing the full set;
|
|
6346
|
+
* solver-routed rails live in `@arkade-os/swap` and are registered by the app.
|
|
6289
6347
|
*
|
|
6290
|
-
* The default priority is `["ark", "lightning", "onchain"]
|
|
6291
|
-
*
|
|
6292
|
-
*
|
|
6348
|
+
* The default priority is `["ark", "ark-asset", "lightning", "onchain"]`.
|
|
6349
|
+
* `"lightning"` is listed so it ranks correctly once the boltz rail is added.
|
|
6350
|
+
* `ark` and `ark-asset` never compete — the amount decides which is
|
|
6351
|
+
* available — so their order between themselves is immaterial.
|
|
6293
6352
|
*/
|
|
6294
6353
|
declare function createDefaultPaymentRouter(wallet: Wallet): PaymentRouter;
|
|
6295
6354
|
|
|
@@ -6568,4 +6627,4 @@ declare class AssetManager extends ReadonlyAssetManager implements IAssetManager
|
|
|
6568
6627
|
burn(params: BurnParams): Promise<string>;
|
|
6569
6628
|
}
|
|
6570
6629
|
|
|
6571
|
-
export { ARKADE_MAGIC, ARKADE_SALTED_PREIMAGE_TAG, ARKADE_SWAP_PREIMAGE_TAG, Activity, ActivityRegistry, AddressAllocationCapable, AmbiguousRouteError, type AnchorBumper, ArkAddress, ArkInfo, ArkIntent, ArkNote, ArkProvider, type ArkPsbtFieldCoder, ArkPsbtFieldKey, ArkPsbtFieldKeyType, ArkTransaction, type ArkTxInput, type ArkadeBatchInput, ArkadeCash, ArkadeContractParams, type ArkadeExtendedCoin, type ArkadeExtendedVirtualCoin, Asset, AssetDetails, AssetManager, BIP21, BIP21Error, type BIP21Params, type BIP21ParseResult, BIP322, BLOCKED_UPGRADE_TIMEOUT_MS, Batch, BatchExpiryPolicy, BurnParams, CSVMultisigTapscript, CachingArkProvider, ChainTx, Coin, ConditionWitness, ConnectionDisposedError, type ConnectorTreeNode, Contract, ContractEvent, ContractRepository, ContractRepositoryImpl, ContractSyncState, ContractWatcherConfig, ContractWithVtxos, CosignerPublicKey, CreateContractParams, DEFAULT_MESSAGE_TIMEOUTS, DatabaseUpgradeBlockedError, DefaultVtxo, DelegateInfo, DelegateNotConfiguredError, DelegatorNotConfiguredError, DescriptorIdentity, type DescriptorIdentityOptions, type DescriptorOptions, type DescriptorSigner, DescriptorSigningProviderMissingError, type DeterministicSigner, 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 ExcludableVtxo, type ExecutorEvent, type ExecutorOptions, 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, GetNewAddressesOptions, GetVtxosFilter, HDAllocationCapable, HDDescriptorProvider, type HDDeterministicSignCapable, HDWalletCapable, 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, type ManagedConnection, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, type MessageHandler, type MessageTimeouts, MigrationGlobalSkipReason, MigrationLegSkipReason, type MigrationStatus, MissingSigningDescriptorError, MnemonicIdentity, type MnemonicOptions, Network, NetworkName, type NetworkOptions, NewAddress, OffchainInput, type OffchainTx, type OnExitObserved, OnchainInput, OnchainProvider, OnchainWallet, Outpoint, P2A, type ParsedArkContract, PathContext, PathSelection, type PaymentHandle, type PaymentOption, type PaymentRail, type PaymentRequest, PaymentRouter, type PaymentStatus, PrevArkTxField, PrevoutTxField, ProviderConnectionState, type ProvisionedClaimSecret, type ProvisionedKey, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlyIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, Recipient, ReissuanceParams, RelativeTimelock, RenewVtxosOptions, type RequestEnvelope, type ResponseEnvelope, RestEmulatorProvider, type RouteQuote, type RouteResult, type RouterContext, type RouterPreferences, SeedIdentity, type SeedIdentityOptions, SendBitcoinParams, SendParams, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, type ServiceWorkerWalletMode, SettleParams, SettlementConfig, SettlementEvent, SignedIntent, SignerSession, SignerStatus, SingleKey, Status, StorageConfig, TapLeafScript, Transaction, TreeNonces, TreePartialSigs, TxNotificationEvent, TxTree, TxWeightEstimator, UnannotatableInputError, UnilateralExit, UnknownPacket, Unroll, type VSize, type VerifyServerSignatures, VirtualCoin, VirtualTx, VirtualTxRepository, VtxoBranch, type VtxoExclusion, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, Wallet, WalletBalance, WalletCannotSignError, WalletMessageHandler, WalletNotInitializedError, WalletRepository, WalletRepositoryImpl, WsElectrumChainSource, adoptContractDescriptor, arkRail, arkTarget, index as arkade, assembleBtcdTaprootTree, assertFinalCommitmentMatchesValidated, assertSendableAmount, assertSubmittedArkTxid, index$1 as asset, awaitTransaction, btcTarget, buildForfeitTx, buildOffchainTx, buildPreimageMessage, buildSaltedPreimageMessage, buildVersion, claimWithPreimageIdentity, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, contractPreimage, contractSigner, createAssetPacket, createDefaultPaymentRouter, createManagedConnection, decodeArkContract, deleteByIndex, deriveDescriptorLeafCompressedPubKey, deriveDescriptorLeafPubKey, deserializeExitPackage, encodeArkContract, exitObserverFor, gateExclusion, gatedContracts, getAllByIndexValues, getArkPsbtFields, getMigrationStatus, hasBoardingTxExpired, identityDescriptor, invoiceTarget, isArkContract, isBtcAddress, isCltvSatisfied, isContractGenericallySpendable, isCsvSpendable, isDeterministicSigner, isHDDeterministicSignCapable, isLightningInvoice, isLnurl, isMessageBusInitializingError, isMessageBusNotInitializedError, isPerArtifactDescriptor, isRetryableProviderError, isValidArkAddress, logExcludedVtxos, makeHandle, matchServerCheckpoints, migrateWalletRepository, normalizeToDescriptor, notifyExitObserved, onchainRail, openDatabase, outpointExclusion, outpointReasons, parseHDDescriptor, promisifyRequest, provisionClaimSecret, provisionRefundKey, requiresMigration, resolveSendAmount, rollbackMigration, sdkVersion, selectCoinsWithAsset, sequenceToTimelock, serializeExitPackage, setArkPsbtField, setupServiceWorker, signAndSubmitOffchainTx, timelockToSequence, toXOnly, tryResolveSendAmount, validateBatchRecipients, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures };
|
|
6630
|
+
export { ARKADE_MAGIC, ARKADE_SALTED_PREIMAGE_TAG, ARKADE_SWAP_PREIMAGE_TAG, ASSET_CARRIER_SATS, Activity, ActivityRegistry, AddressAllocationCapable, AmbiguousRouteError, type AnchorBumper, ArkAddress, ArkInfo, ArkIntent, ArkNote, ArkProvider, type ArkPsbtFieldCoder, ArkPsbtFieldKey, ArkPsbtFieldKeyType, ArkTransaction, type ArkTxInput, type ArkadeBatchInput, ArkadeCash, ArkadeContractParams, type ArkadeExtendedCoin, type ArkadeExtendedVirtualCoin, Asset, AssetDetails, AssetManager, BIP21, BIP21Error, type BIP21Params, type BIP21ParseResult, BIP322, BLOCKED_UPGRADE_TIMEOUT_MS, Batch, BatchExpiryPolicy, BurnParams, CSVMultisigTapscript, CachingArkProvider, ChainTx, Coin, ConditionWitness, ConnectionDisposedError, type ConnectorTreeNode, Contract, ContractEvent, ContractRepository, ContractRepositoryImpl, ContractSyncState, ContractWatcherConfig, ContractWithVtxos, CosignerPublicKey, CreateContractParams, DEFAULT_MESSAGE_TIMEOUTS, DatabaseUpgradeBlockedError, DefaultVtxo, DelegateInfo, DelegateNotConfiguredError, DelegatorNotConfiguredError, DescriptorIdentity, type DescriptorIdentityOptions, type DescriptorOptions, type DescriptorSigner, DescriptorSigningProviderMissingError, type DeterministicSigner, 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 ExcludableVtxo, type ExecutorEvent, type ExecutorOptions, 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, GetNewAddressesOptions, GetVtxosFilter, HDAllocationCapable, HDDescriptorProvider, type HDDeterministicSignCapable, HDWalletCapable, 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, type ManagedConnection, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, type MessageHandler, type MessageTimeouts, MigrationGlobalSkipReason, MigrationLegSkipReason, type MigrationStatus, MissingSigningDescriptorError, MnemonicIdentity, type MnemonicOptions, Network, NetworkName, type NetworkOptions, NewAddress, OffchainInput, type OffchainTx, type OnExitObserved, OnchainInput, OnchainProvider, OnchainWallet, Outpoint, P2A, type ParsedArkContract, PathContext, PathSelection, type PaymentHandle, type PaymentOption, type PaymentRail, type PaymentRequest, PaymentRouter, type PaymentStatus, PrevArkTxField, PrevoutTxField, ProviderConnectionState, type ProvisionedClaimSecret, type ProvisionedKey, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlyIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, Recipient, ReissuanceParams, RelativeTimelock, RenewVtxosOptions, type RequestEnvelope, type ResponseEnvelope, RestEmulatorProvider, type RouteQuote, type RouteResult, type RouterContext, type RouterPreferences, SeedIdentity, type SeedIdentityOptions, SendBitcoinParams, SendParams, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, type ServiceWorkerWalletMode, SettleParams, SettlementConfig, SettlementEvent, SignedIntent, SignerSession, SignerStatus, SingleKey, Status, StorageConfig, TapLeafScript, Transaction, TreeNonces, TreePartialSigs, TxNotificationEvent, TxTree, TxWeightEstimator, UnannotatableInputError, UnilateralExit, UnknownPacket, Unroll, type VSize, type VerifyServerSignatures, VirtualCoin, VirtualTx, VirtualTxRepository, VtxoBranch, type VtxoExclusion, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, Wallet, WalletBalance, WalletCannotSignError, WalletMessageHandler, WalletNotInitializedError, WalletRepository, WalletRepositoryImpl, WsElectrumChainSource, adoptContractDescriptor, arkAssetRail, arkRail, arkTarget, index as arkade, assembleBtcdTaprootTree, assertFinalCommitmentMatchesValidated, assertNoAssets, assertSendableAmount, assertSubmittedArkTxid, index$1 as asset, assetsOf, awaitTransaction, btcTarget, buildForfeitTx, buildOffchainTx, buildPreimageMessage, buildSaltedPreimageMessage, buildVersion, claimWithPreimageIdentity, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, contractPreimage, contractSigner, createAssetPacket, createDefaultPaymentRouter, createManagedConnection, decodeArkContract, deleteByIndex, deriveDescriptorLeafCompressedPubKey, deriveDescriptorLeafPubKey, deserializeExitPackage, encodeArkContract, exitObserverFor, gateExclusion, gatedContracts, getAllByIndexValues, getArkPsbtFields, getMigrationStatus, hasBoardingTxExpired, identityDescriptor, invoiceTarget, isArkContract, isBtcAddress, isCltvSatisfied, isContractGenericallySpendable, isCsvSpendable, isDeterministicSigner, isHDDeterministicSignCapable, isLightningInvoice, isLnurl, isMessageBusInitializingError, isMessageBusNotInitializedError, isPerArtifactDescriptor, isRetryableProviderError, isValidArkAddress, logExcludedVtxos, makeHandle, matchServerCheckpoints, migrateWalletRepository, normalizeToDescriptor, notifyExitObserved, onchainRail, openDatabase, outpointExclusion, outpointReasons, parseHDDescriptor, promisifyRequest, provisionClaimSecret, provisionRefundKey, requiresMigration, resolveAssetAmount, resolveSendAmount, rollbackMigration, sdkVersion, selectCoinsWithAsset, sequenceToTimelock, serializeExitPackage, setArkPsbtField, setupServiceWorker, signAndSubmitOffchainTx, timelockToSequence, toXOnly, tryResolveSendAmount, validateBatchRecipients, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, walletFeeSource };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { ARKADE_MAGIC, ARKADE_SALTED_PREIMAGE_TAG, ARKADE_SWAP_PREIMAGE_TAG, AbortError, ActivityRegistry, AmbiguousRouteError, ArkNote, ArkadeCash, ArkadeCashCreateError, AssetManager, BIP21, BIP21Error, BIP322, BLOCKED_UPGRADE_TIMEOUT_MS, Batch, CachingArkProvider, ChainedTxType, ConnectionDisposedError, ContractManager, ContractRepositoryImpl, ContractWatcher, DEFAULT_MESSAGE_TIMEOUTS, DEFAULT_MIN_BATCH_EXPIRY_SECONDS, DEFAULT_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, DatabaseUpgradeBlockedError, DelegateManagerImpl, DelegateNotConfiguredError, DelegatorManagerImpl, DelegatorNotConfiguredError, 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, MIGRATION_KEY, MUTINYNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, MissingSigningDescriptorError, MnemonicIdentity, OnchainWallet, P2A, PaymentRouter, PrevTxUnavailableError, REGTEST_MIN_BATCH_EXPIRY_SECONDS, REGTEST_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, RestDelegateProvider, RestDelegatorProvider, 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, WalletRepositoryImpl, WsElectrumChainSource, adoptContractDescriptor, arkRail, arkTarget, arkade_exports as arkade, assertFinalCommitmentMatchesValidated, assertSendableAmount, assertSubmittedArkTxid, assertValidBatchExpiry, assertValidServerUnrollScript, assetMintResolver, 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, getMigrationStatus, getRandomId, hasBoardingTxExpired, hasCandidates, invoiceTarget, isAddressAllocationCapable, isArkContract, isBatchSignable, isBtcAddress, isContractGenericallySpendable, isCooperativelyMigratable, isDeterministicSigner, isDiscoverable, isHDAllocationCapable, isHDDeterministicSignCapable, isHDWalletCapable, isLightningInvoice, isLnurl, isMessageBusInitializingError, isMessageBusNotInitializedError, isPerArtifactDescriptor, isSigningIdentity, isSubdust, isTerminalIntentState, isValidArkAddress, isVtxoExpiringSoon, logExcludedVtxos, makeHandle, matchServerCheckpoints, migrateWalletRepository, notifyExitObserved, onchainRail, openDatabase, outpointExclusion, outpointReasons, promisifyRequest, provisionClaimSecret, provisionRefundKey, requiresMigration, resolveBatchExpiryPolicy, resolveCheckpointExitDelayPolicy, resolveDescriptorSigner, resolvePrevTxs, resolveSendAmount, rollbackMigration, selectCoinsWithAsset, selectVirtualCoins, serializeExitPackage, setupServiceWorker, signAndSubmitOffchainTx, signerSetFromInfo, signingDescriptorIndex, strictSigningDescriptorIndex, toXOnlySignerHex, tryResolveSendAmount, validateBatchRecipients, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, waitForIncomingFunds, 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, REGTEST_EMULATOR_PUBKEY, RestArkProvider, ServerResponseMismatchError, SettlementEventType, TapTreeCoder, Transaction, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, assembleBtcdTaprootTree, assertAllowedSighashTypes, buildVersion, canRecoverOnchain, canSpendOffchain, canSweepOnchain, configureEventSource, decodeTapscript, defaultEmulatorPubkey, getArkPsbtFields, getConfiguredEventSource, getNetwork, getSequence, hasTerminalSpend, isArkError, isEventSourceUnavailableError, isExpired, isPastExpiry, isRecoverable, isRetryableProviderError, isSpendable, isVirtualCoin, maybeArkError, networks, resolveEmulatorPubkey, resolveEventSource, scriptFromTapLeafScript, sdkVersion, sequenceToTimelock, setArkPsbtField, timelockToSequence } from './chunk-
|
|
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, ContractRepositoryImpl, ContractWatcher, DEFAULT_MESSAGE_TIMEOUTS, DEFAULT_MIN_BATCH_EXPIRY_SECONDS, DEFAULT_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, DatabaseUpgradeBlockedError, DelegateManagerImpl, DelegateNotConfiguredError, DelegatorManagerImpl, DelegatorNotConfiguredError, 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, MIGRATION_KEY, MUTINYNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, MissingSigningDescriptorError, MnemonicIdentity, OnchainWallet, P2A, PaymentRouter, PrevTxUnavailableError, REGTEST_MIN_BATCH_EXPIRY_SECONDS, REGTEST_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, RestDelegateProvider, RestDelegatorProvider, 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, WalletRepositoryImpl, WsElectrumChainSource, adoptContractDescriptor, arkAssetRail, arkRail, arkTarget, arkade_exports as arkade, assertFinalCommitmentMatchesValidated, assertNoAssets, 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, getMigrationStatus, getRandomId, hasBoardingTxExpired, hasCandidates, invoiceTarget, isAddressAllocationCapable, isArkContract, isBatchSignable, isBtcAddress, isContractGenericallySpendable, isCooperativelyMigratable, isDeterministicSigner, isDiscoverable, isHDAllocationCapable, isHDDeterministicSignCapable, isHDWalletCapable, isLightningInvoice, isLnurl, isMessageBusInitializingError, isMessageBusNotInitializedError, isPerArtifactDescriptor, isSigningIdentity, isSubdust, isTerminalIntentState, isValidArkAddress, isVtxoExpiringSoon, logExcludedVtxos, makeHandle, matchServerCheckpoints, migrateWalletRepository, notifyExitObserved, onchainRail, openDatabase, outpointExclusion, outpointReasons, promisifyRequest, provisionClaimSecret, provisionRefundKey, requiresMigration, resolveAssetAmount, resolveBatchExpiryPolicy, resolveCheckpointExitDelayPolicy, resolveDescriptorSigner, resolvePrevTxs, resolveSendAmount, rollbackMigration, selectCoinsWithAsset, selectVirtualCoins, serializeExitPackage, setupServiceWorker, signAndSubmitOffchainTx, signerSetFromInfo, signingDescriptorIndex, strictSigningDescriptorIndex, toXOnlySignerHex, tryResolveSendAmount, validateBatchRecipients, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, waitForIncomingFunds, walletFeeSource, withPrevTxs } from './chunk-JVHO6XHG.js';
|
|
2
|
+
export { ChainTxType, DEFAULT_VTXO_PAGE_SIZE, IndexerTxType, RestIndexerProvider, asset_exports as asset } from './chunk-F5E7LI6G.js';
|
|
3
|
+
export { ArkadeContractHandler, BoardingContractHandler, DefaultContractHandler, DefaultVtxo, DelegateContractHandler, DelegateVtxo, VHTLC, VHTLCContractHandler, VHTLCV2ContractHandler, contractHandlers, deriveDescriptorLeafCompressedPubKey, deriveDescriptorLeafPubKey, identityDescriptor, isCltvSatisfied, isCsvSpendable, normalizeToDescriptor, parseHDDescriptor, toXOnly } from './chunk-6UM55KPZ.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, REGTEST_EMULATOR_PUBKEY, RestArkProvider, ServerResponseMismatchError, SettlementEventType, TapTreeCoder, Transaction, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, assembleBtcdTaprootTree, assertAllowedSighashTypes, buildVersion, canRecoverOnchain, canSpendOffchain, canSweepOnchain, configureEventSource, decodeTapscript, defaultEmulatorPubkey, getArkPsbtFields, getConfiguredEventSource, getNetwork, getSequence, hasTerminalSpend, isArkError, isEventSourceUnavailableError, isExpired, isPastExpiry, isRecoverable, isRetryableProviderError, isSpendable, isVirtualCoin, maybeArkError, networks, resolveEmulatorPubkey, resolveEventSource, scriptFromTapLeafScript, sdkVersion, sequenceToTimelock, setArkPsbtField, timelockToSequence } from './chunk-TXSF2DKX.js';
|
|
5
5
|
import './chunk-NSBPE2FW.js';
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
7
7
|
//# 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 chunkXTCOSZ34_cjs = require('../../chunk-XTCOSZ34.cjs');
|
|
4
|
+
require('../../chunk-3KW4TWP2.cjs');
|
|
5
|
+
require('../../chunk-3OKEUDHU.cjs');
|
|
6
|
+
require('../../chunk-57636V35.cjs');
|
|
7
7
|
require('../../chunk-5BLDMQED.cjs');
|
|
8
8
|
|
|
9
9
|
// src/repositories/realm/walletRepository.ts
|
|
@@ -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 = chunkXTCOSZ34_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 (!chunkXTCOSZ34_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 = chunkXTCOSZ34_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(chunkXTCOSZ34_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 ?? chunkXTCOSZ34_cjs.scriptFromArkAddress(obj.address)
|
|
238
238
|
};
|
|
239
|
-
return
|
|
239
|
+
return chunkXTCOSZ34_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 chunkXTCOSZ34_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 = chunkXTCOSZ34_cjs.deserializeAssets(JSON.parse(obj.assetsJson));
|
|
274
274
|
}
|
|
275
275
|
return tx;
|
|
276
276
|
}
|
|
@@ -450,7 +450,7 @@ var RealmIntentRepository = class {
|
|
|
450
450
|
const clashes = [
|
|
451
451
|
...this.realm.objects("ArkIntent").filtered("intentId == $0", intent.intentId)
|
|
452
452
|
].map(toIntent);
|
|
453
|
-
|
|
453
|
+
chunkXTCOSZ34_cjs.assertIntentIdUnique(intent, clashes);
|
|
454
454
|
}
|
|
455
455
|
this.realm.create(
|
|
456
456
|
"ArkIntent",
|
|
@@ -479,14 +479,14 @@ var RealmIntentRepository = class {
|
|
|
479
479
|
}
|
|
480
480
|
async getIntents(filter) {
|
|
481
481
|
const all = [...this.realm.objects("ArkIntent")].map(toIntent).sort((a, b) => a.createdAt - b.createdAt || a.intentTxId.localeCompare(b.intentTxId));
|
|
482
|
-
const out = filter ? all.filter((i) =>
|
|
483
|
-
const { skip, end } =
|
|
482
|
+
const out = filter ? all.filter((i) => chunkXTCOSZ34_cjs.intentMatchesFilter(i, filter)) : all;
|
|
483
|
+
const { skip, end } = chunkXTCOSZ34_cjs.intentPageBounds(filter, out.length);
|
|
484
484
|
return out.slice(skip, end);
|
|
485
485
|
}
|
|
486
486
|
async getLockedVtxoOutpoints() {
|
|
487
487
|
const out = [];
|
|
488
488
|
for (const o of [...this.realm.objects("ArkIntent")].map(toIntent))
|
|
489
|
-
if (!
|
|
489
|
+
if (!chunkXTCOSZ34_cjs.isTerminalIntentState(o.state)) out.push(...o.intentVtxos);
|
|
490
490
|
return out;
|
|
491
491
|
}
|
|
492
492
|
async [Symbol.asyncDispose]() {
|
|
@@ -528,7 +528,7 @@ var RealmVirtualTxRepository = class {
|
|
|
528
528
|
txid: t.txid,
|
|
529
529
|
psbt: t.psbt ?? prev?.psbt ?? null,
|
|
530
530
|
expiresAt: t.expiresAt ?? prev?.expiresAt ?? null,
|
|
531
|
-
type:
|
|
531
|
+
type: chunkXTCOSZ34_cjs.mergeChainedTxType(t.type, prev?.type)
|
|
532
532
|
},
|
|
533
533
|
"modified"
|
|
534
534
|
);
|
|
@@ -762,7 +762,7 @@ function runArkRealmMigrations(oldRealm, newRealm) {
|
|
|
762
762
|
for (let i = 0; i < newVtxos.length; i++) {
|
|
763
763
|
const newVtxo = newVtxos[i];
|
|
764
764
|
if (!newVtxo.script) {
|
|
765
|
-
newVtxo.script =
|
|
765
|
+
newVtxo.script = chunkXTCOSZ34_cjs.scriptFromArkAddress(newVtxo.address);
|
|
766
766
|
}
|
|
767
767
|
}
|
|
768
768
|
const oldHasVirtualTx = Array.isArray(oldRealm?.schema) && oldRealm.schema.some((s) => s.name === "ArkVirtualTx");
|
|
@@ -779,7 +779,7 @@ function runArkRealmMigrations(oldRealm, newRealm) {
|
|
|
779
779
|
|
|
780
780
|
Object.defineProperty(exports, "ChainedTxType", {
|
|
781
781
|
enumerable: true,
|
|
782
|
-
get: function () { return
|
|
782
|
+
get: function () { return chunkXTCOSZ34_cjs.ChainedTxType; }
|
|
783
783
|
});
|
|
784
784
|
exports.ARK_REALM_SCHEMA_VERSION = ARK_REALM_SCHEMA_VERSION;
|
|
785
785
|
exports.ArkExperimentalRealmSchemas = ArkExperimentalRealmSchemas;
|
|
@@ -1,8 +1,8 @@
|
|
|
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-
|
|
4
|
-
import '../../chunk-
|
|
5
|
-
import '../../chunk-
|
|
1
|
+
import { serializeVtxo, isVtxoForScript, serializeUtxo, serializeAssets, scriptFromArkAddress, deserializeVtxo, deserializeUtxo, deserializeAssets, assertIntentIdUnique, intentMatchesFilter, intentPageBounds, isTerminalIntentState, mergeChainedTxType } from '../../chunk-JVHO6XHG.js';
|
|
2
|
+
export { ChainedTxType } from '../../chunk-JVHO6XHG.js';
|
|
3
|
+
import '../../chunk-F5E7LI6G.js';
|
|
4
|
+
import '../../chunk-6UM55KPZ.js';
|
|
5
|
+
import '../../chunk-TXSF2DKX.js';
|
|
6
6
|
import '../../chunk-NSBPE2FW.js';
|
|
7
7
|
|
|
8
8
|
// src/repositories/realm/walletRepository.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
5
|
-
require('../../chunk-
|
|
6
|
-
require('../../chunk-
|
|
3
|
+
var chunkXTCOSZ34_cjs = require('../../chunk-XTCOSZ34.cjs');
|
|
4
|
+
require('../../chunk-3KW4TWP2.cjs');
|
|
5
|
+
require('../../chunk-3OKEUDHU.cjs');
|
|
6
|
+
require('../../chunk-57636V35.cjs');
|
|
7
7
|
require('../../chunk-5BLDMQED.cjs');
|
|
8
8
|
|
|
9
9
|
// src/repositories/sqlite/transaction.ts
|
|
@@ -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
|
+
[chunkXTCOSZ34_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 = chunkXTCOSZ34_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 (!chunkXTCOSZ34_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 = chunkXTCOSZ34_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(chunkXTCOSZ34_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 ?? chunkXTCOSZ34_cjs.scriptFromArkAddress(row.address)
|
|
438
438
|
};
|
|
439
|
-
return
|
|
439
|
+
return chunkXTCOSZ34_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 chunkXTCOSZ34_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 = chunkXTCOSZ34_cjs.deserializeAssets(JSON.parse(row.assets_json));
|
|
474
474
|
}
|
|
475
475
|
return tx;
|
|
476
476
|
}
|
|
@@ -743,8 +743,8 @@ var SQLiteIntentRepository = class {
|
|
|
743
743
|
`SELECT * FROM ${this.t} ORDER BY created_at ASC, intent_tx_id ASC`
|
|
744
744
|
);
|
|
745
745
|
let out = rows.map(rowToIntent);
|
|
746
|
-
if (filter) out = out.filter((i) =>
|
|
747
|
-
const { skip, end } =
|
|
746
|
+
if (filter) out = out.filter((i) => chunkXTCOSZ34_cjs.intentMatchesFilter(i, filter));
|
|
747
|
+
const { skip, end } = chunkXTCOSZ34_cjs.intentPageBounds(filter, out.length);
|
|
748
748
|
return out.slice(skip, end);
|
|
749
749
|
}
|
|
750
750
|
async getLockedVtxoOutpoints() {
|
|
@@ -752,7 +752,7 @@ var SQLiteIntentRepository = class {
|
|
|
752
752
|
const rows = await this.db.all(`SELECT * FROM ${this.t}`);
|
|
753
753
|
const out = [];
|
|
754
754
|
for (const r of rows) {
|
|
755
|
-
if (
|
|
755
|
+
if (chunkXTCOSZ34_cjs.isTerminalIntentState(r.state)) continue;
|
|
756
756
|
for (const o of JSON.parse(r.intent_vtxos_json)) out.push(o);
|
|
757
757
|
}
|
|
758
758
|
return out;
|
|
@@ -847,7 +847,7 @@ var SQLiteVirtualTxRepository = class {
|
|
|
847
847
|
const prev = prevByTxid.get(t.txid);
|
|
848
848
|
const psbt = t.psbt ?? prev?.psbt ?? null;
|
|
849
849
|
const expires = t.expiresAt ?? prev?.expires_at ?? null;
|
|
850
|
-
const type =
|
|
850
|
+
const type = chunkXTCOSZ34_cjs.mergeChainedTxType(t.type, prev?.type);
|
|
851
851
|
await this.db.run(
|
|
852
852
|
`INSERT OR REPLACE INTO ${this.tTx} (txid, psbt, expires_at, type) VALUES (?, ?, ?, ?)`,
|
|
853
853
|
[t.txid, psbt, expires, type]
|
|
@@ -940,7 +940,7 @@ function sanitizeTablePrefix(p) {
|
|
|
940
940
|
|
|
941
941
|
Object.defineProperty(exports, "ChainedTxType", {
|
|
942
942
|
enumerable: true,
|
|
943
|
-
get: function () { return
|
|
943
|
+
get: function () { return chunkXTCOSZ34_cjs.ChainedTxType; }
|
|
944
944
|
});
|
|
945
945
|
exports.SQLiteContractRepository = SQLiteContractRepository;
|
|
946
946
|
exports.SQLiteIntentRepository = SQLiteIntentRepository;
|