@arkade-os/sdk 0.4.43 → 0.4.44
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 +65 -0
- package/dist/adapters/expo.cjs +4 -4
- package/dist/adapters/expo.js +2 -2
- package/dist/adapters/indexedDB.cjs +3 -3
- package/dist/adapters/indexedDB.js +2 -2
- package/dist/{asyncStorageTaskQueue-CjoL-35w.d.ts → asyncStorageTaskQueue-BtSOVZFn.d.ts} +2 -2
- package/dist/{asyncStorageTaskQueue-D1FfHfgK.d.cts → asyncStorageTaskQueue-Dap7qUlF.d.cts} +2 -2
- package/dist/{chunk-B4R36PRN.js → chunk-FMI2GKYO.js} +1088 -181
- package/dist/chunk-FMI2GKYO.js.map +1 -0
- package/dist/{chunk-US274KZO.js → chunk-LCQQPOIT.js} +3 -3
- package/dist/{chunk-US274KZO.js.map → chunk-LCQQPOIT.js.map} +1 -1
- package/dist/{chunk-763XHDAJ.js → chunk-LJ35HPJW.js} +3 -3
- package/dist/{chunk-763XHDAJ.js.map → chunk-LJ35HPJW.js.map} +1 -1
- package/dist/{chunk-JIWCE2IK.cjs → chunk-RJ6XVCX4.cjs} +7 -7
- package/dist/{chunk-JIWCE2IK.cjs.map → chunk-RJ6XVCX4.cjs.map} +1 -1
- package/dist/{chunk-3AQNLQPM.cjs → chunk-UBYY2TPK.cjs} +3 -3
- package/dist/{chunk-3AQNLQPM.cjs.map → chunk-UBYY2TPK.cjs.map} +1 -1
- package/dist/{chunk-VKKLOT2E.js → chunk-V7WIZR2B.js} +3 -3
- package/dist/{chunk-VKKLOT2E.js.map → chunk-V7WIZR2B.js.map} +1 -1
- package/dist/{chunk-PLJZRIFZ.cjs → chunk-X37EKDIH.cjs} +11 -11
- package/dist/{chunk-PLJZRIFZ.cjs.map → chunk-X37EKDIH.cjs.map} +1 -1
- package/dist/{chunk-QGNTDGMN.cjs → chunk-XIVCG6EP.cjs} +1163 -253
- package/dist/chunk-XIVCG6EP.cjs.map +1 -0
- package/dist/index.cjs +138 -126
- package/dist/index.d.cts +232 -1
- package/dist/index.d.ts +232 -1
- package/dist/index.js +2 -2
- package/dist/repositories/realm/index.cjs +17 -17
- package/dist/repositories/realm/index.js +3 -3
- package/dist/repositories/sqlite/index.cjs +16 -16
- package/dist/repositories/sqlite/index.js +3 -3
- package/dist/{taskRunner-Djlhfgi1.d.ts → taskRunner-Bptw9UMa.d.ts} +1 -1
- package/dist/{taskRunner-BSnslNmq.d.cts → taskRunner-CeFxKhSH.d.cts} +1 -1
- package/dist/wallet/expo/background.cjs +12 -12
- package/dist/wallet/expo/background.d.cts +2 -2
- package/dist/wallet/expo/background.d.ts +2 -2
- package/dist/wallet/expo/background.js +4 -4
- package/dist/wallet/expo/index.cjs +12 -12
- package/dist/wallet/expo/index.d.cts +1 -1
- package/dist/wallet/expo/index.d.ts +1 -1
- package/dist/wallet/expo/index.js +3 -3
- package/dist/worker/expo/index.cjs +7 -7
- package/dist/worker/expo/index.d.cts +3 -3
- package/dist/worker/expo/index.d.ts +3 -3
- package/dist/worker/expo/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-B4R36PRN.js.map +0 -1
- package/dist/chunk-QGNTDGMN.cjs.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -2254,6 +2254,27 @@ declare class OnchainWallet implements AnchorBumper {
|
|
|
2254
2254
|
* @see send
|
|
2255
2255
|
*/
|
|
2256
2256
|
bumpP2A(parent: Transaction): Promise<[string, string]>;
|
|
2257
|
+
/**
|
|
2258
|
+
* Build and sign a CPFP fee child for a parent tx (given as raw hex)
|
|
2259
|
+
* carrying a P2A anchor, funding it from this wallet's **confirmed**
|
|
2260
|
+
* coins, and return the 1P1C package hexes WITHOUT broadcasting.
|
|
2261
|
+
*
|
|
2262
|
+
* This is the graph-mode fee source ({@link ExitFeeWallet}): the exit
|
|
2263
|
+
* executor calls it to bump each transported virtual tx at execution
|
|
2264
|
+
* time, so funding can be deferred rather than pre-signed.
|
|
2265
|
+
*
|
|
2266
|
+
* @param parentHex - Finalized parent transaction, raw network hex
|
|
2267
|
+
* @param feeRate - sat/vB floor for the package (raised to MIN_FEE_RATE)
|
|
2268
|
+
* @returns Tuple of parent hex (unchanged) and signed child hex
|
|
2269
|
+
* @throws If the parent has no anchor, or funding cannot be selected/signed
|
|
2270
|
+
*/
|
|
2271
|
+
bumpAnchor(parentHex: string, feeRate: number): Promise<[string, string]>;
|
|
2272
|
+
/**
|
|
2273
|
+
* Shared core of {@link bumpP2A} and {@link bumpAnchor}: probe the package
|
|
2274
|
+
* fee with a single-input child, select coins for it, then build and sign
|
|
2275
|
+
* with the actual selection (the fee grows per extra input).
|
|
2276
|
+
*/
|
|
2277
|
+
private buildBumpPackage;
|
|
2257
2278
|
}
|
|
2258
2279
|
|
|
2259
2280
|
type SetupServiceWorkerOptions = {
|
|
@@ -3013,6 +3034,216 @@ declare namespace Unroll {
|
|
|
3013
3034
|
function completeUnroll(wallet: Wallet, vtxoTxids: string[], outputAddress: string): Promise<string>;
|
|
3014
3035
|
}
|
|
3015
3036
|
|
|
3037
|
+
/** Relative delay before a sweep becomes valid, decoded from BIP-68. */
|
|
3038
|
+
type ExitDelay = {
|
|
3039
|
+
type: "blocks" | "seconds";
|
|
3040
|
+
value: number;
|
|
3041
|
+
};
|
|
3042
|
+
/** Broadcast a single pre-signed transaction (the funding splitter). */
|
|
3043
|
+
type BroadcastStep = {
|
|
3044
|
+
kind: "broadcast";
|
|
3045
|
+
txid: string;
|
|
3046
|
+
hex: string;
|
|
3047
|
+
};
|
|
3048
|
+
/** Broadcast a 1P1C package: virtual tx + its pre-signed CPFP fee child. */
|
|
3049
|
+
type PackageStep = {
|
|
3050
|
+
kind: "package";
|
|
3051
|
+
parentTxid: string;
|
|
3052
|
+
parentHex: string;
|
|
3053
|
+
childTxid: string;
|
|
3054
|
+
childHex: string;
|
|
3055
|
+
/** Outpoints (txid:vout) of the VTXOs this step serves. */
|
|
3056
|
+
forVtxos: string[];
|
|
3057
|
+
};
|
|
3058
|
+
/**
|
|
3059
|
+
* A virtual tx that must go onchain but whose CPFP fee child is NOT
|
|
3060
|
+
* pre-signed (graph mode). The executor builds and signs the child at
|
|
3061
|
+
* execution time using its own fee wallet — this is how "send funds to
|
|
3062
|
+
* this address and we proceed" works: funding is deferred, not baked in.
|
|
3063
|
+
*/
|
|
3064
|
+
type BumpStep = {
|
|
3065
|
+
kind: "bump";
|
|
3066
|
+
parentTxid: string;
|
|
3067
|
+
parentHex: string;
|
|
3068
|
+
/** Outpoints (txid:vout) of the VTXOs this step serves. */
|
|
3069
|
+
forVtxos: string[];
|
|
3070
|
+
};
|
|
3071
|
+
/** Broadcast a pre-signed CSV sweep once its dependency matured. */
|
|
3072
|
+
type SweepStep = {
|
|
3073
|
+
kind: "sweep";
|
|
3074
|
+
vtxo: string;
|
|
3075
|
+
txid: string;
|
|
3076
|
+
hex: string;
|
|
3077
|
+
/** The VTXO-creating leaf tx whose confirmation starts the CSV clock. */
|
|
3078
|
+
dependsOnTxid: string;
|
|
3079
|
+
delay: ExitDelay;
|
|
3080
|
+
};
|
|
3081
|
+
type ExitStep = BroadcastStep | PackageStep | BumpStep | SweepStep;
|
|
3082
|
+
/**
|
|
3083
|
+
* How fee funding is provided:
|
|
3084
|
+
* - `"funded"`: a splitter tx (broadcast at prepare time) pre-funds
|
|
3085
|
+
* pre-signed fee children — execution is fully keyless.
|
|
3086
|
+
* - `"graph"`: only the tx graph + sweeps are transported; the executor
|
|
3087
|
+
* funds and signs the CPFP bumps at execution time from its own fee
|
|
3088
|
+
* wallet ("send funds to this address and we proceed").
|
|
3089
|
+
*/
|
|
3090
|
+
type ExitMode = "funded" | "graph";
|
|
3091
|
+
/** Per-VTXO metadata; skipped VTXOs carry a human-readable reason. */
|
|
3092
|
+
type ExitVtxoInfo = {
|
|
3093
|
+
outpoint: string;
|
|
3094
|
+
value?: number;
|
|
3095
|
+
sweepFee?: number;
|
|
3096
|
+
/** `${contractType}:${pathLabel}` for observability, e.g. "vhtlc:unilateral". */
|
|
3097
|
+
path?: string;
|
|
3098
|
+
delay?: ExitDelay;
|
|
3099
|
+
skipped?: string;
|
|
3100
|
+
};
|
|
3101
|
+
type ExitTotals = {
|
|
3102
|
+
/** Distinct transactions the executor ensures onchain. */
|
|
3103
|
+
txCount: number;
|
|
3104
|
+
totalFeeSats: number;
|
|
3105
|
+
/** Sats consumed from the onchain wallet by the splitter (fees + funding outputs). */
|
|
3106
|
+
fundingRequiredSats: number;
|
|
3107
|
+
/** Sats arriving at the sweep address once all sweeps confirm. */
|
|
3108
|
+
recoveredSats: number;
|
|
3109
|
+
};
|
|
3110
|
+
/**
|
|
3111
|
+
* Versioned, language-agnostic unilateral exit package.
|
|
3112
|
+
* Everything inside is pre-signed; executing it requires no keys and no
|
|
3113
|
+
* Arkade infrastructure — only an Esplora-compatible API.
|
|
3114
|
+
*/
|
|
3115
|
+
type ExitPackage = {
|
|
3116
|
+
version: 1;
|
|
3117
|
+
/** Fee-funding strategy. Absent is treated as "funded" (v1 default). */
|
|
3118
|
+
mode?: ExitMode;
|
|
3119
|
+
network: NetworkName;
|
|
3120
|
+
createdAt: number;
|
|
3121
|
+
/** Min batch expiry (unix seconds) across included txs. Informational. */
|
|
3122
|
+
validUntil?: number;
|
|
3123
|
+
feeRate: number;
|
|
3124
|
+
sweepAddress: string;
|
|
3125
|
+
totals: ExitTotals;
|
|
3126
|
+
vtxos: ExitVtxoInfo[];
|
|
3127
|
+
/** Topologically ordered: a step's txs confirm before dependents proceed. */
|
|
3128
|
+
steps: ExitStep[];
|
|
3129
|
+
};
|
|
3130
|
+
/** Cost/size quote returned by `UnilateralExit.estimate` — no funds needed. */
|
|
3131
|
+
type ExitQuote = {
|
|
3132
|
+
feeRate: number;
|
|
3133
|
+
fundingAddress: string;
|
|
3134
|
+
currentBalanceSats: number;
|
|
3135
|
+
shortfallSats: number;
|
|
3136
|
+
validUntil?: number;
|
|
3137
|
+
totals: ExitTotals;
|
|
3138
|
+
vtxos: ExitVtxoInfo[];
|
|
3139
|
+
};
|
|
3140
|
+
declare function serializeExitPackage(pkg: ExitPackage): string;
|
|
3141
|
+
declare function deserializeExitPackage(json: string): ExitPackage;
|
|
3142
|
+
|
|
3143
|
+
type ExitOptions = {
|
|
3144
|
+
/** Wallet owning the VTXOs: identity (signing) + indexer + onchain provider. */
|
|
3145
|
+
wallet: Wallet;
|
|
3146
|
+
/** Fee funding source and change/funding address. Must share the wallet identity. */
|
|
3147
|
+
onchainWallet: OnchainWallet;
|
|
3148
|
+
/** Destination for the exited funds. */
|
|
3149
|
+
sweepAddress: string;
|
|
3150
|
+
/** sat/vB; defaults to the onchain provider estimate, floored at MIN_FEE_RATE. */
|
|
3151
|
+
feeRate?: number;
|
|
3152
|
+
/** Defaults to all spendable VTXOs. */
|
|
3153
|
+
vtxos?: Outpoint[];
|
|
3154
|
+
/**
|
|
3155
|
+
* Fee-funding strategy (default `"funded"`):
|
|
3156
|
+
* - `"funded"`: broadcast a splitter at prepare time and pre-sign the
|
|
3157
|
+
* fee children — the package executes fully keyless.
|
|
3158
|
+
* - `"graph"`: transport only the tx graph + sweeps; the executor funds
|
|
3159
|
+
* and signs the CPFP bumps at execution time ("send funds to this
|
|
3160
|
+
* address and we proceed"). No splitter, no `onchainWallet` funds used.
|
|
3161
|
+
*/
|
|
3162
|
+
mode?: ExitMode;
|
|
3163
|
+
/**
|
|
3164
|
+
* Network label embedded in the package (executor sanity check).
|
|
3165
|
+
* Resolved from the wallet's network when omitted — exact for
|
|
3166
|
+
* "bitcoin" and "regtest"; the tb-family defaults to "testnet", so
|
|
3167
|
+
* pass this explicitly on signet/mutinynet.
|
|
3168
|
+
*/
|
|
3169
|
+
networkName?: NetworkName;
|
|
3170
|
+
};
|
|
3171
|
+
/**
|
|
3172
|
+
* Quote a unilateral exit: how many transactions, how many sats of fees,
|
|
3173
|
+
* and how much must be deposited to the funding address. Requires no
|
|
3174
|
+
* onchain funds and signs nothing.
|
|
3175
|
+
*/
|
|
3176
|
+
declare function estimate(opts: ExitOptions): Promise<ExitQuote>;
|
|
3177
|
+
|
|
3178
|
+
type ExecutorEvent = {
|
|
3179
|
+
stepIndex: number;
|
|
3180
|
+
kind: ExitStep["kind"];
|
|
3181
|
+
status: "skipped" | "broadcast" | "confirmed" | "waiting_csv" | "failed" | "warning";
|
|
3182
|
+
forVtxos?: string[];
|
|
3183
|
+
txid?: string;
|
|
3184
|
+
reason?: string;
|
|
3185
|
+
/** For waiting_csv with a blocks delay: absolute height at maturity. */
|
|
3186
|
+
maturesAtHeight?: number;
|
|
3187
|
+
/** For waiting_csv with a seconds delay: unix time at maturity. */
|
|
3188
|
+
maturesAtTime?: number;
|
|
3189
|
+
};
|
|
3190
|
+
/**
|
|
3191
|
+
* Fee source for graph-mode `bump` steps. Given a parent tx carrying a P2A
|
|
3192
|
+
* anchor, it builds and signs the CPFP fee child from its own funds and
|
|
3193
|
+
* returns the 1P1C package hexes (parent unchanged, child signed) — WITHOUT
|
|
3194
|
+
* broadcasting; the executor owns broadcast. `OnchainWallet` implements it.
|
|
3195
|
+
*/
|
|
3196
|
+
interface ExitFeeWallet {
|
|
3197
|
+
bumpAnchor(parentHex: string, feeRate: number): Promise<[parentHex: string, childHex: string]>;
|
|
3198
|
+
}
|
|
3199
|
+
/**
|
|
3200
|
+
* Keyless, stateless executor for a pre-signed exit package.
|
|
3201
|
+
*
|
|
3202
|
+
* The blockchain is the only state: every action re-checks tx status first,
|
|
3203
|
+
* so the executor can be killed and re-run anywhere at any time. It never
|
|
3204
|
+
* parses transaction hex — it only relays it.
|
|
3205
|
+
*/
|
|
3206
|
+
declare class Executor implements AsyncIterable<ExecutorEvent> {
|
|
3207
|
+
readonly pkg: ExitPackage;
|
|
3208
|
+
readonly provider: OnchainProvider;
|
|
3209
|
+
private readonly pollIntervalMs;
|
|
3210
|
+
private readonly feeWallet?;
|
|
3211
|
+
constructor(pkg: ExitPackage, provider: OnchainProvider, opts?: {
|
|
3212
|
+
pollIntervalMs?: number;
|
|
3213
|
+
feeWallet?: ExitFeeWallet;
|
|
3214
|
+
});
|
|
3215
|
+
private sleep;
|
|
3216
|
+
private status;
|
|
3217
|
+
private waitConfirmed;
|
|
3218
|
+
[Symbol.asyncIterator](): AsyncIterator<ExecutorEvent>;
|
|
3219
|
+
}
|
|
3220
|
+
|
|
3221
|
+
/**
|
|
3222
|
+
* Build the fully pre-signed unilateral exit package.
|
|
3223
|
+
*
|
|
3224
|
+
* Signs every transaction needed to land the selected VTXOs onchain and
|
|
3225
|
+
* **broadcasts the funding splitter** as a side effect — reserving the fee
|
|
3226
|
+
* budget so later wallet activity cannot invalidate the package. The
|
|
3227
|
+
* returned package is keyless to execute: hand it to
|
|
3228
|
+
* `UnilateralExit.Executor` (or any Esplora-speaking watchtower).
|
|
3229
|
+
*/
|
|
3230
|
+
declare function prepare(opts: ExitOptions): Promise<ExitPackage>;
|
|
3231
|
+
|
|
3232
|
+
/**
|
|
3233
|
+
* Pre-signed unilateral exit.
|
|
3234
|
+
*
|
|
3235
|
+
* `estimate` quotes the cost (tx count, fees, funding required) without
|
|
3236
|
+
* touching funds; `prepare` signs every transaction needed to land the
|
|
3237
|
+
* VTXOs onchain and broadcasts the fee-funding splitter; `Executor` drives
|
|
3238
|
+
* the resulting package to completion with nothing but an
|
|
3239
|
+
* Esplora-compatible endpoint — no keys, no Arkade infrastructure.
|
|
3240
|
+
*/
|
|
3241
|
+
declare const UnilateralExit: {
|
|
3242
|
+
readonly estimate: typeof estimate;
|
|
3243
|
+
readonly prepare: typeof prepare;
|
|
3244
|
+
readonly Executor: typeof Executor;
|
|
3245
|
+
};
|
|
3246
|
+
|
|
3016
3247
|
declare class ArkError extends Error {
|
|
3017
3248
|
readonly code: number;
|
|
3018
3249
|
readonly message: string;
|
|
@@ -3755,4 +3986,4 @@ declare class AssetManager extends ReadonlyAssetManager implements IAssetManager
|
|
|
3755
3986
|
burn(params: BurnParams): Promise<string>;
|
|
3756
3987
|
}
|
|
3757
3988
|
|
|
3758
|
-
export { Activity, ActivityRegistry, type AnchorBumper, ArkError, ArkIntent, ArkNote, ArkProvider, type ArkPsbtFieldCoder, ArkPsbtFieldKey, ArkPsbtFieldKeyType, ArkTransaction, type ArkTxInput, AssetDetails, AssetManager, BIP322, BurnParams, CSVMultisigTapscript, ChainTx, Coin, ConditionWitness, Contract, ContractEvent, ContractRepository, ContractRepositoryImpl, ContractWatcherConfig, ContractWithVtxos, CosignerPublicKey, CreateContractParams, DEFAULT_MESSAGE_TIMEOUTS, DelegateInfo, DelegateNotConfiguredError, DelegatorNotConfiguredError, type DescriptorOptions, DescriptorSigningProviderMissingError, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, type BlockHeader as ElectrumBlockHeader, ElectrumOnchainProvider, type TransactionHistory as ElectrumTransactionHistory, type Unspent as ElectrumUnspent, EncodedVtxoScript, Estimator, ExplorerTransaction, ExtendedCoin, ExtendedVirtualCoin, FeeAmount, FeeInfo, FeeOutput, FetchError, GetVtxosFilter, HDDescriptorProvider, IAssetManager, IContractManager, IDelegateManager, IReadonlyAssetManager, IReadonlyWallet, IVtxoManager, IWallet, Identity, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexedDBWalletRepository, IndexerProvider, IntentFeeConfig, IntentFilter, IntentRepository, IssuanceParams, IssuanceResult, MESSAGE_BUS_INITIALIZING, MESSAGE_BUS_NOT_INITIALIZED, MIGRATION_KEY, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, type MessageHandler, type MessageTimeouts, MigrationGlobalSkipReason, MigrationLegSkipReason, type MigrationStatus, MissingSigningDescriptorError, MnemonicIdentity, type MnemonicOptions, Network, NetworkName, type NetworkOptions, OffchainInput, type OffchainTx, OnchainInput, OnchainProvider, OnchainWallet, Outpoint, P2A, type ParsedArkContract, PathContext, PathSelection, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlyIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, Recipient, ReissuanceParams, RelativeTimelock, RenewVtxosOptions, type RequestEnvelope, type ResponseEnvelope, SeedIdentity, type SeedIdentityOptions, SendBitcoinParams, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, type ServiceWorkerWalletMode, SettleParams, SettlementConfig, SettlementEvent, SignerSession, SignerStatus, SingleKey, Status, StorageConfig, TapLeafScript, Transaction, TxTree, TxWeightEstimator, Unroll, type VSize, VirtualCoin, VirtualTx, VirtualTxRepository, VtxoBranch, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, Wallet, WalletBalance, WalletMessageHandler, WalletNotInitializedError, WalletRepository, WalletRepositoryImpl, WsElectrumChainSource, assembleBtcdTaprootTree, index as asset, buildForfeitTx, buildOffchainTx, buildVersion, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, decodeArkContract, encodeArkContract, getArkPsbtFields, getMigrationStatus, getRandomId, hasBoardingTxExpired, isArkContract, isCltvSatisfied, isCsvSpendable, isValidArkAddress, maybeArkError, migrateWalletRepository, openDatabase, requiresMigration, rollbackMigration, sdkVersion, sequenceToTimelock, setArkPsbtField, setupServiceWorker, timelockToSequence, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures };
|
|
3989
|
+
export { Activity, ActivityRegistry, type AnchorBumper, ArkError, ArkIntent, ArkNote, ArkProvider, type ArkPsbtFieldCoder, ArkPsbtFieldKey, ArkPsbtFieldKeyType, ArkTransaction, type ArkTxInput, AssetDetails, AssetManager, BIP322, BurnParams, CSVMultisigTapscript, ChainTx, Coin, ConditionWitness, Contract, ContractEvent, ContractRepository, ContractRepositoryImpl, ContractWatcherConfig, ContractWithVtxos, CosignerPublicKey, CreateContractParams, DEFAULT_MESSAGE_TIMEOUTS, DelegateInfo, DelegateNotConfiguredError, DelegatorNotConfiguredError, type DescriptorOptions, DescriptorSigningProviderMissingError, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, type BlockHeader as ElectrumBlockHeader, ElectrumOnchainProvider, type TransactionHistory as ElectrumTransactionHistory, type Unspent as ElectrumUnspent, EncodedVtxoScript, Estimator, type ExecutorEvent, type ExitDelay, type ExitFeeWallet, type ExitMode, type ExitOptions, type ExitPackage, type ExitQuote, type ExitStep, type ExitTotals, type ExitVtxoInfo, ExplorerTransaction, ExtendedCoin, ExtendedVirtualCoin, FeeAmount, FeeInfo, FeeOutput, FetchError, GetVtxosFilter, HDDescriptorProvider, IAssetManager, IContractManager, IDelegateManager, IReadonlyAssetManager, IReadonlyWallet, IVtxoManager, IWallet, Identity, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexedDBWalletRepository, IndexerProvider, IntentFeeConfig, IntentFilter, IntentRepository, IssuanceParams, IssuanceResult, MESSAGE_BUS_INITIALIZING, MESSAGE_BUS_NOT_INITIALIZED, MIGRATION_KEY, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, type MessageHandler, type MessageTimeouts, MigrationGlobalSkipReason, MigrationLegSkipReason, type MigrationStatus, MissingSigningDescriptorError, MnemonicIdentity, type MnemonicOptions, Network, NetworkName, type NetworkOptions, OffchainInput, type OffchainTx, OnchainInput, OnchainProvider, OnchainWallet, Outpoint, P2A, type ParsedArkContract, PathContext, PathSelection, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlyIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, Recipient, ReissuanceParams, RelativeTimelock, RenewVtxosOptions, type RequestEnvelope, type ResponseEnvelope, SeedIdentity, type SeedIdentityOptions, SendBitcoinParams, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, type ServiceWorkerWalletMode, SettleParams, SettlementConfig, SettlementEvent, SignerSession, SignerStatus, SingleKey, Status, StorageConfig, TapLeafScript, Transaction, TxTree, TxWeightEstimator, UnilateralExit, Unroll, type VSize, VirtualCoin, VirtualTx, VirtualTxRepository, VtxoBranch, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, Wallet, WalletBalance, WalletMessageHandler, WalletNotInitializedError, WalletRepository, WalletRepositoryImpl, WsElectrumChainSource, assembleBtcdTaprootTree, index as asset, buildForfeitTx, buildOffchainTx, buildVersion, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, decodeArkContract, deserializeExitPackage, encodeArkContract, getArkPsbtFields, getMigrationStatus, getRandomId, hasBoardingTxExpired, isArkContract, isCltvSatisfied, isCsvSpendable, isValidArkAddress, maybeArkError, migrateWalletRepository, openDatabase, requiresMigration, rollbackMigration, sdkVersion, sequenceToTimelock, serializeExitPackage, setArkPsbtField, setupServiceWorker, timelockToSequence, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures };
|
package/dist/index.d.ts
CHANGED
|
@@ -2254,6 +2254,27 @@ declare class OnchainWallet implements AnchorBumper {
|
|
|
2254
2254
|
* @see send
|
|
2255
2255
|
*/
|
|
2256
2256
|
bumpP2A(parent: Transaction): Promise<[string, string]>;
|
|
2257
|
+
/**
|
|
2258
|
+
* Build and sign a CPFP fee child for a parent tx (given as raw hex)
|
|
2259
|
+
* carrying a P2A anchor, funding it from this wallet's **confirmed**
|
|
2260
|
+
* coins, and return the 1P1C package hexes WITHOUT broadcasting.
|
|
2261
|
+
*
|
|
2262
|
+
* This is the graph-mode fee source ({@link ExitFeeWallet}): the exit
|
|
2263
|
+
* executor calls it to bump each transported virtual tx at execution
|
|
2264
|
+
* time, so funding can be deferred rather than pre-signed.
|
|
2265
|
+
*
|
|
2266
|
+
* @param parentHex - Finalized parent transaction, raw network hex
|
|
2267
|
+
* @param feeRate - sat/vB floor for the package (raised to MIN_FEE_RATE)
|
|
2268
|
+
* @returns Tuple of parent hex (unchanged) and signed child hex
|
|
2269
|
+
* @throws If the parent has no anchor, or funding cannot be selected/signed
|
|
2270
|
+
*/
|
|
2271
|
+
bumpAnchor(parentHex: string, feeRate: number): Promise<[string, string]>;
|
|
2272
|
+
/**
|
|
2273
|
+
* Shared core of {@link bumpP2A} and {@link bumpAnchor}: probe the package
|
|
2274
|
+
* fee with a single-input child, select coins for it, then build and sign
|
|
2275
|
+
* with the actual selection (the fee grows per extra input).
|
|
2276
|
+
*/
|
|
2277
|
+
private buildBumpPackage;
|
|
2257
2278
|
}
|
|
2258
2279
|
|
|
2259
2280
|
type SetupServiceWorkerOptions = {
|
|
@@ -3013,6 +3034,216 @@ declare namespace Unroll {
|
|
|
3013
3034
|
function completeUnroll(wallet: Wallet, vtxoTxids: string[], outputAddress: string): Promise<string>;
|
|
3014
3035
|
}
|
|
3015
3036
|
|
|
3037
|
+
/** Relative delay before a sweep becomes valid, decoded from BIP-68. */
|
|
3038
|
+
type ExitDelay = {
|
|
3039
|
+
type: "blocks" | "seconds";
|
|
3040
|
+
value: number;
|
|
3041
|
+
};
|
|
3042
|
+
/** Broadcast a single pre-signed transaction (the funding splitter). */
|
|
3043
|
+
type BroadcastStep = {
|
|
3044
|
+
kind: "broadcast";
|
|
3045
|
+
txid: string;
|
|
3046
|
+
hex: string;
|
|
3047
|
+
};
|
|
3048
|
+
/** Broadcast a 1P1C package: virtual tx + its pre-signed CPFP fee child. */
|
|
3049
|
+
type PackageStep = {
|
|
3050
|
+
kind: "package";
|
|
3051
|
+
parentTxid: string;
|
|
3052
|
+
parentHex: string;
|
|
3053
|
+
childTxid: string;
|
|
3054
|
+
childHex: string;
|
|
3055
|
+
/** Outpoints (txid:vout) of the VTXOs this step serves. */
|
|
3056
|
+
forVtxos: string[];
|
|
3057
|
+
};
|
|
3058
|
+
/**
|
|
3059
|
+
* A virtual tx that must go onchain but whose CPFP fee child is NOT
|
|
3060
|
+
* pre-signed (graph mode). The executor builds and signs the child at
|
|
3061
|
+
* execution time using its own fee wallet — this is how "send funds to
|
|
3062
|
+
* this address and we proceed" works: funding is deferred, not baked in.
|
|
3063
|
+
*/
|
|
3064
|
+
type BumpStep = {
|
|
3065
|
+
kind: "bump";
|
|
3066
|
+
parentTxid: string;
|
|
3067
|
+
parentHex: string;
|
|
3068
|
+
/** Outpoints (txid:vout) of the VTXOs this step serves. */
|
|
3069
|
+
forVtxos: string[];
|
|
3070
|
+
};
|
|
3071
|
+
/** Broadcast a pre-signed CSV sweep once its dependency matured. */
|
|
3072
|
+
type SweepStep = {
|
|
3073
|
+
kind: "sweep";
|
|
3074
|
+
vtxo: string;
|
|
3075
|
+
txid: string;
|
|
3076
|
+
hex: string;
|
|
3077
|
+
/** The VTXO-creating leaf tx whose confirmation starts the CSV clock. */
|
|
3078
|
+
dependsOnTxid: string;
|
|
3079
|
+
delay: ExitDelay;
|
|
3080
|
+
};
|
|
3081
|
+
type ExitStep = BroadcastStep | PackageStep | BumpStep | SweepStep;
|
|
3082
|
+
/**
|
|
3083
|
+
* How fee funding is provided:
|
|
3084
|
+
* - `"funded"`: a splitter tx (broadcast at prepare time) pre-funds
|
|
3085
|
+
* pre-signed fee children — execution is fully keyless.
|
|
3086
|
+
* - `"graph"`: only the tx graph + sweeps are transported; the executor
|
|
3087
|
+
* funds and signs the CPFP bumps at execution time from its own fee
|
|
3088
|
+
* wallet ("send funds to this address and we proceed").
|
|
3089
|
+
*/
|
|
3090
|
+
type ExitMode = "funded" | "graph";
|
|
3091
|
+
/** Per-VTXO metadata; skipped VTXOs carry a human-readable reason. */
|
|
3092
|
+
type ExitVtxoInfo = {
|
|
3093
|
+
outpoint: string;
|
|
3094
|
+
value?: number;
|
|
3095
|
+
sweepFee?: number;
|
|
3096
|
+
/** `${contractType}:${pathLabel}` for observability, e.g. "vhtlc:unilateral". */
|
|
3097
|
+
path?: string;
|
|
3098
|
+
delay?: ExitDelay;
|
|
3099
|
+
skipped?: string;
|
|
3100
|
+
};
|
|
3101
|
+
type ExitTotals = {
|
|
3102
|
+
/** Distinct transactions the executor ensures onchain. */
|
|
3103
|
+
txCount: number;
|
|
3104
|
+
totalFeeSats: number;
|
|
3105
|
+
/** Sats consumed from the onchain wallet by the splitter (fees + funding outputs). */
|
|
3106
|
+
fundingRequiredSats: number;
|
|
3107
|
+
/** Sats arriving at the sweep address once all sweeps confirm. */
|
|
3108
|
+
recoveredSats: number;
|
|
3109
|
+
};
|
|
3110
|
+
/**
|
|
3111
|
+
* Versioned, language-agnostic unilateral exit package.
|
|
3112
|
+
* Everything inside is pre-signed; executing it requires no keys and no
|
|
3113
|
+
* Arkade infrastructure — only an Esplora-compatible API.
|
|
3114
|
+
*/
|
|
3115
|
+
type ExitPackage = {
|
|
3116
|
+
version: 1;
|
|
3117
|
+
/** Fee-funding strategy. Absent is treated as "funded" (v1 default). */
|
|
3118
|
+
mode?: ExitMode;
|
|
3119
|
+
network: NetworkName;
|
|
3120
|
+
createdAt: number;
|
|
3121
|
+
/** Min batch expiry (unix seconds) across included txs. Informational. */
|
|
3122
|
+
validUntil?: number;
|
|
3123
|
+
feeRate: number;
|
|
3124
|
+
sweepAddress: string;
|
|
3125
|
+
totals: ExitTotals;
|
|
3126
|
+
vtxos: ExitVtxoInfo[];
|
|
3127
|
+
/** Topologically ordered: a step's txs confirm before dependents proceed. */
|
|
3128
|
+
steps: ExitStep[];
|
|
3129
|
+
};
|
|
3130
|
+
/** Cost/size quote returned by `UnilateralExit.estimate` — no funds needed. */
|
|
3131
|
+
type ExitQuote = {
|
|
3132
|
+
feeRate: number;
|
|
3133
|
+
fundingAddress: string;
|
|
3134
|
+
currentBalanceSats: number;
|
|
3135
|
+
shortfallSats: number;
|
|
3136
|
+
validUntil?: number;
|
|
3137
|
+
totals: ExitTotals;
|
|
3138
|
+
vtxos: ExitVtxoInfo[];
|
|
3139
|
+
};
|
|
3140
|
+
declare function serializeExitPackage(pkg: ExitPackage): string;
|
|
3141
|
+
declare function deserializeExitPackage(json: string): ExitPackage;
|
|
3142
|
+
|
|
3143
|
+
type ExitOptions = {
|
|
3144
|
+
/** Wallet owning the VTXOs: identity (signing) + indexer + onchain provider. */
|
|
3145
|
+
wallet: Wallet;
|
|
3146
|
+
/** Fee funding source and change/funding address. Must share the wallet identity. */
|
|
3147
|
+
onchainWallet: OnchainWallet;
|
|
3148
|
+
/** Destination for the exited funds. */
|
|
3149
|
+
sweepAddress: string;
|
|
3150
|
+
/** sat/vB; defaults to the onchain provider estimate, floored at MIN_FEE_RATE. */
|
|
3151
|
+
feeRate?: number;
|
|
3152
|
+
/** Defaults to all spendable VTXOs. */
|
|
3153
|
+
vtxos?: Outpoint[];
|
|
3154
|
+
/**
|
|
3155
|
+
* Fee-funding strategy (default `"funded"`):
|
|
3156
|
+
* - `"funded"`: broadcast a splitter at prepare time and pre-sign the
|
|
3157
|
+
* fee children — the package executes fully keyless.
|
|
3158
|
+
* - `"graph"`: transport only the tx graph + sweeps; the executor funds
|
|
3159
|
+
* and signs the CPFP bumps at execution time ("send funds to this
|
|
3160
|
+
* address and we proceed"). No splitter, no `onchainWallet` funds used.
|
|
3161
|
+
*/
|
|
3162
|
+
mode?: ExitMode;
|
|
3163
|
+
/**
|
|
3164
|
+
* Network label embedded in the package (executor sanity check).
|
|
3165
|
+
* Resolved from the wallet's network when omitted — exact for
|
|
3166
|
+
* "bitcoin" and "regtest"; the tb-family defaults to "testnet", so
|
|
3167
|
+
* pass this explicitly on signet/mutinynet.
|
|
3168
|
+
*/
|
|
3169
|
+
networkName?: NetworkName;
|
|
3170
|
+
};
|
|
3171
|
+
/**
|
|
3172
|
+
* Quote a unilateral exit: how many transactions, how many sats of fees,
|
|
3173
|
+
* and how much must be deposited to the funding address. Requires no
|
|
3174
|
+
* onchain funds and signs nothing.
|
|
3175
|
+
*/
|
|
3176
|
+
declare function estimate(opts: ExitOptions): Promise<ExitQuote>;
|
|
3177
|
+
|
|
3178
|
+
type ExecutorEvent = {
|
|
3179
|
+
stepIndex: number;
|
|
3180
|
+
kind: ExitStep["kind"];
|
|
3181
|
+
status: "skipped" | "broadcast" | "confirmed" | "waiting_csv" | "failed" | "warning";
|
|
3182
|
+
forVtxos?: string[];
|
|
3183
|
+
txid?: string;
|
|
3184
|
+
reason?: string;
|
|
3185
|
+
/** For waiting_csv with a blocks delay: absolute height at maturity. */
|
|
3186
|
+
maturesAtHeight?: number;
|
|
3187
|
+
/** For waiting_csv with a seconds delay: unix time at maturity. */
|
|
3188
|
+
maturesAtTime?: number;
|
|
3189
|
+
};
|
|
3190
|
+
/**
|
|
3191
|
+
* Fee source for graph-mode `bump` steps. Given a parent tx carrying a P2A
|
|
3192
|
+
* anchor, it builds and signs the CPFP fee child from its own funds and
|
|
3193
|
+
* returns the 1P1C package hexes (parent unchanged, child signed) — WITHOUT
|
|
3194
|
+
* broadcasting; the executor owns broadcast. `OnchainWallet` implements it.
|
|
3195
|
+
*/
|
|
3196
|
+
interface ExitFeeWallet {
|
|
3197
|
+
bumpAnchor(parentHex: string, feeRate: number): Promise<[parentHex: string, childHex: string]>;
|
|
3198
|
+
}
|
|
3199
|
+
/**
|
|
3200
|
+
* Keyless, stateless executor for a pre-signed exit package.
|
|
3201
|
+
*
|
|
3202
|
+
* The blockchain is the only state: every action re-checks tx status first,
|
|
3203
|
+
* so the executor can be killed and re-run anywhere at any time. It never
|
|
3204
|
+
* parses transaction hex — it only relays it.
|
|
3205
|
+
*/
|
|
3206
|
+
declare class Executor implements AsyncIterable<ExecutorEvent> {
|
|
3207
|
+
readonly pkg: ExitPackage;
|
|
3208
|
+
readonly provider: OnchainProvider;
|
|
3209
|
+
private readonly pollIntervalMs;
|
|
3210
|
+
private readonly feeWallet?;
|
|
3211
|
+
constructor(pkg: ExitPackage, provider: OnchainProvider, opts?: {
|
|
3212
|
+
pollIntervalMs?: number;
|
|
3213
|
+
feeWallet?: ExitFeeWallet;
|
|
3214
|
+
});
|
|
3215
|
+
private sleep;
|
|
3216
|
+
private status;
|
|
3217
|
+
private waitConfirmed;
|
|
3218
|
+
[Symbol.asyncIterator](): AsyncIterator<ExecutorEvent>;
|
|
3219
|
+
}
|
|
3220
|
+
|
|
3221
|
+
/**
|
|
3222
|
+
* Build the fully pre-signed unilateral exit package.
|
|
3223
|
+
*
|
|
3224
|
+
* Signs every transaction needed to land the selected VTXOs onchain and
|
|
3225
|
+
* **broadcasts the funding splitter** as a side effect — reserving the fee
|
|
3226
|
+
* budget so later wallet activity cannot invalidate the package. The
|
|
3227
|
+
* returned package is keyless to execute: hand it to
|
|
3228
|
+
* `UnilateralExit.Executor` (or any Esplora-speaking watchtower).
|
|
3229
|
+
*/
|
|
3230
|
+
declare function prepare(opts: ExitOptions): Promise<ExitPackage>;
|
|
3231
|
+
|
|
3232
|
+
/**
|
|
3233
|
+
* Pre-signed unilateral exit.
|
|
3234
|
+
*
|
|
3235
|
+
* `estimate` quotes the cost (tx count, fees, funding required) without
|
|
3236
|
+
* touching funds; `prepare` signs every transaction needed to land the
|
|
3237
|
+
* VTXOs onchain and broadcasts the fee-funding splitter; `Executor` drives
|
|
3238
|
+
* the resulting package to completion with nothing but an
|
|
3239
|
+
* Esplora-compatible endpoint — no keys, no Arkade infrastructure.
|
|
3240
|
+
*/
|
|
3241
|
+
declare const UnilateralExit: {
|
|
3242
|
+
readonly estimate: typeof estimate;
|
|
3243
|
+
readonly prepare: typeof prepare;
|
|
3244
|
+
readonly Executor: typeof Executor;
|
|
3245
|
+
};
|
|
3246
|
+
|
|
3016
3247
|
declare class ArkError extends Error {
|
|
3017
3248
|
readonly code: number;
|
|
3018
3249
|
readonly message: string;
|
|
@@ -3755,4 +3986,4 @@ declare class AssetManager extends ReadonlyAssetManager implements IAssetManager
|
|
|
3755
3986
|
burn(params: BurnParams): Promise<string>;
|
|
3756
3987
|
}
|
|
3757
3988
|
|
|
3758
|
-
export { Activity, ActivityRegistry, type AnchorBumper, ArkError, ArkIntent, ArkNote, ArkProvider, type ArkPsbtFieldCoder, ArkPsbtFieldKey, ArkPsbtFieldKeyType, ArkTransaction, type ArkTxInput, AssetDetails, AssetManager, BIP322, BurnParams, CSVMultisigTapscript, ChainTx, Coin, ConditionWitness, Contract, ContractEvent, ContractRepository, ContractRepositoryImpl, ContractWatcherConfig, ContractWithVtxos, CosignerPublicKey, CreateContractParams, DEFAULT_MESSAGE_TIMEOUTS, DelegateInfo, DelegateNotConfiguredError, DelegatorNotConfiguredError, type DescriptorOptions, DescriptorSigningProviderMissingError, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, type BlockHeader as ElectrumBlockHeader, ElectrumOnchainProvider, type TransactionHistory as ElectrumTransactionHistory, type Unspent as ElectrumUnspent, EncodedVtxoScript, Estimator, ExplorerTransaction, ExtendedCoin, ExtendedVirtualCoin, FeeAmount, FeeInfo, FeeOutput, FetchError, GetVtxosFilter, HDDescriptorProvider, IAssetManager, IContractManager, IDelegateManager, IReadonlyAssetManager, IReadonlyWallet, IVtxoManager, IWallet, Identity, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexedDBWalletRepository, IndexerProvider, IntentFeeConfig, IntentFilter, IntentRepository, IssuanceParams, IssuanceResult, MESSAGE_BUS_INITIALIZING, MESSAGE_BUS_NOT_INITIALIZED, MIGRATION_KEY, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, type MessageHandler, type MessageTimeouts, MigrationGlobalSkipReason, MigrationLegSkipReason, type MigrationStatus, MissingSigningDescriptorError, MnemonicIdentity, type MnemonicOptions, Network, NetworkName, type NetworkOptions, OffchainInput, type OffchainTx, OnchainInput, OnchainProvider, OnchainWallet, Outpoint, P2A, type ParsedArkContract, PathContext, PathSelection, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlyIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, Recipient, ReissuanceParams, RelativeTimelock, RenewVtxosOptions, type RequestEnvelope, type ResponseEnvelope, SeedIdentity, type SeedIdentityOptions, SendBitcoinParams, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, type ServiceWorkerWalletMode, SettleParams, SettlementConfig, SettlementEvent, SignerSession, SignerStatus, SingleKey, Status, StorageConfig, TapLeafScript, Transaction, TxTree, TxWeightEstimator, Unroll, type VSize, VirtualCoin, VirtualTx, VirtualTxRepository, VtxoBranch, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, Wallet, WalletBalance, WalletMessageHandler, WalletNotInitializedError, WalletRepository, WalletRepositoryImpl, WsElectrumChainSource, assembleBtcdTaprootTree, index as asset, buildForfeitTx, buildOffchainTx, buildVersion, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, decodeArkContract, encodeArkContract, getArkPsbtFields, getMigrationStatus, getRandomId, hasBoardingTxExpired, isArkContract, isCltvSatisfied, isCsvSpendable, isValidArkAddress, maybeArkError, migrateWalletRepository, openDatabase, requiresMigration, rollbackMigration, sdkVersion, sequenceToTimelock, setArkPsbtField, setupServiceWorker, timelockToSequence, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures };
|
|
3989
|
+
export { Activity, ActivityRegistry, type AnchorBumper, ArkError, ArkIntent, ArkNote, ArkProvider, type ArkPsbtFieldCoder, ArkPsbtFieldKey, ArkPsbtFieldKeyType, ArkTransaction, type ArkTxInput, AssetDetails, AssetManager, BIP322, BurnParams, CSVMultisigTapscript, ChainTx, Coin, ConditionWitness, Contract, ContractEvent, ContractRepository, ContractRepositoryImpl, ContractWatcherConfig, ContractWithVtxos, CosignerPublicKey, CreateContractParams, DEFAULT_MESSAGE_TIMEOUTS, DelegateInfo, DelegateNotConfiguredError, DelegatorNotConfiguredError, type DescriptorOptions, DescriptorSigningProviderMissingError, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, type BlockHeader as ElectrumBlockHeader, ElectrumOnchainProvider, type TransactionHistory as ElectrumTransactionHistory, type Unspent as ElectrumUnspent, EncodedVtxoScript, Estimator, type ExecutorEvent, type ExitDelay, type ExitFeeWallet, type ExitMode, type ExitOptions, type ExitPackage, type ExitQuote, type ExitStep, type ExitTotals, type ExitVtxoInfo, ExplorerTransaction, ExtendedCoin, ExtendedVirtualCoin, FeeAmount, FeeInfo, FeeOutput, FetchError, GetVtxosFilter, HDDescriptorProvider, IAssetManager, IContractManager, IDelegateManager, IReadonlyAssetManager, IReadonlyWallet, IVtxoManager, IWallet, Identity, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexedDBWalletRepository, IndexerProvider, IntentFeeConfig, IntentFilter, IntentRepository, IssuanceParams, IssuanceResult, MESSAGE_BUS_INITIALIZING, MESSAGE_BUS_NOT_INITIALIZED, MIGRATION_KEY, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, type MessageHandler, type MessageTimeouts, MigrationGlobalSkipReason, MigrationLegSkipReason, type MigrationStatus, MissingSigningDescriptorError, MnemonicIdentity, type MnemonicOptions, Network, NetworkName, type NetworkOptions, OffchainInput, type OffchainTx, OnchainInput, OnchainProvider, OnchainWallet, Outpoint, P2A, type ParsedArkContract, PathContext, PathSelection, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlyIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, Recipient, ReissuanceParams, RelativeTimelock, RenewVtxosOptions, type RequestEnvelope, type ResponseEnvelope, SeedIdentity, type SeedIdentityOptions, SendBitcoinParams, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, type ServiceWorkerWalletMode, SettleParams, SettlementConfig, SettlementEvent, SignerSession, SignerStatus, SingleKey, Status, StorageConfig, TapLeafScript, Transaction, TxTree, TxWeightEstimator, UnilateralExit, Unroll, type VSize, VirtualCoin, VirtualTx, VirtualTxRepository, VtxoBranch, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, Wallet, WalletBalance, WalletMessageHandler, WalletNotInitializedError, WalletRepository, WalletRepositoryImpl, WsElectrumChainSource, assembleBtcdTaprootTree, index as asset, buildForfeitTx, buildOffchainTx, buildVersion, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, decodeArkContract, deserializeExitPackage, encodeArkContract, getArkPsbtFields, getMigrationStatus, getRandomId, hasBoardingTxExpired, isArkContract, isCltvSatisfied, isCsvSpendable, isValidArkAddress, maybeArkError, migrateWalletRepository, openDatabase, requiresMigration, rollbackMigration, sdkVersion, sequenceToTimelock, serializeExitPackage, setArkPsbtField, setupServiceWorker, timelockToSequence, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { ActivityRegistry, ArkNote, AssetManager, BIP322, Batch, ChainedTxType, ContractManager, ContractRepositoryImpl, ContractWatcher, DEFAULT_MESSAGE_TIMEOUTS, DelegateManagerImpl, DelegateNotConfiguredError, DelegatorManagerImpl, DelegatorNotConfiguredError, DescriptorSigningProviderMissingError, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, ESPLORA_URL, ElectrumOnchainProvider, EsploraProvider, Estimator, HDDescriptorProvider, INTENT_TERMINAL_STATES, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexedDBWalletRepository, MESSAGE_BUS_INITIALIZING, MESSAGE_BUS_NOT_INITIALIZED, MIGRATION_KEY, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, MissingSigningDescriptorError, MnemonicIdentity, OnchainWallet, P2A, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, RestDelegateProvider, RestDelegatorProvider, SeedIdentity, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, SingleKey, TxTree, TxType, TxWeightEstimator, Unroll, VtxoManager, Wallet, WalletMessageHandler, WalletNotInitializedError, WalletRepositoryImpl, WsElectrumChainSource, boardingResolver, buildForfeitTx, buildOffchainTx, classifyAgainstSignerSet, classifyContractSigner, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, createDefaultActivityRegistry, decodeArkContract, encodeArkContract, getMigrationStatus, getRandomId, hasBoardingTxExpired, isArkContract, isBatchSignable, isCooperativelyMigratable, isDiscoverable, isExpired, isRecoverable, isSpendable, isSubdust, isTerminalIntentState, isValidArkAddress, isVtxoExpiringSoon, migrateWalletRepository, openDatabase, requiresMigration, rollbackMigration, setupServiceWorker, signerSetFromInfo, toXOnlySignerHex, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, waitForIncomingFunds } from './chunk-
|
|
2
|
-
export { ArkError, ArkPsbtFieldKey, ArkPsbtFieldKeyType, ChainTxType, ConditionWitness, CosignerPublicKey, DigestMismatchError, FetchError, IndexerTxType, Intent, RestArkProvider, RestIndexerProvider, SettlementEventType, Transaction, VtxoTaprootTree, VtxoTreeExpiry, asset_exports as asset, buildVersion, getArkPsbtFields, maybeArkError, sdkVersion, setArkPsbtField } from './chunk-
|
|
1
|
+
export { ActivityRegistry, ArkNote, AssetManager, BIP322, Batch, ChainedTxType, ContractManager, ContractRepositoryImpl, ContractWatcher, DEFAULT_MESSAGE_TIMEOUTS, DelegateManagerImpl, DelegateNotConfiguredError, DelegatorManagerImpl, DelegatorNotConfiguredError, DescriptorSigningProviderMissingError, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, ESPLORA_URL, ElectrumOnchainProvider, EsploraProvider, Estimator, HDDescriptorProvider, INTENT_TERMINAL_STATES, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexedDBWalletRepository, MESSAGE_BUS_INITIALIZING, MESSAGE_BUS_NOT_INITIALIZED, MIGRATION_KEY, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, MissingSigningDescriptorError, MnemonicIdentity, OnchainWallet, P2A, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, RestDelegateProvider, RestDelegatorProvider, SeedIdentity, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, SingleKey, TxTree, TxType, TxWeightEstimator, UnilateralExit, Unroll, VtxoManager, Wallet, WalletMessageHandler, WalletNotInitializedError, WalletRepositoryImpl, WsElectrumChainSource, boardingResolver, buildForfeitTx, buildOffchainTx, classifyAgainstSignerSet, classifyContractSigner, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, createDefaultActivityRegistry, decodeArkContract, deserializeExitPackage, encodeArkContract, getMigrationStatus, getRandomId, hasBoardingTxExpired, isArkContract, isBatchSignable, isCooperativelyMigratable, isDiscoverable, isExpired, isRecoverable, isSpendable, isSubdust, isTerminalIntentState, isValidArkAddress, isVtxoExpiringSoon, migrateWalletRepository, openDatabase, requiresMigration, rollbackMigration, serializeExitPackage, setupServiceWorker, signerSetFromInfo, toXOnlySignerHex, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, waitForIncomingFunds } from './chunk-FMI2GKYO.js';
|
|
2
|
+
export { ArkError, ArkPsbtFieldKey, ArkPsbtFieldKeyType, ChainTxType, ConditionWitness, CosignerPublicKey, DigestMismatchError, FetchError, IndexerTxType, Intent, RestArkProvider, RestIndexerProvider, SettlementEventType, Transaction, VtxoTaprootTree, VtxoTreeExpiry, asset_exports as asset, buildVersion, getArkPsbtFields, maybeArkError, sdkVersion, setArkPsbtField } from './chunk-LJ35HPJW.js';
|
|
3
3
|
export { BoardingContractHandler, DefaultContractHandler, DefaultVtxo, DelegateContractHandler, DelegateVtxo, VHTLC, VHTLCContractHandler, contractHandlers, isCltvSatisfied, isCsvSpendable } from './chunk-YNEDJTX2.js';
|
|
4
4
|
export { ArkAddress, CLTVMultisigTapscript, CSVMultisigTapscript, ConditionCSVMultisigTapscript, ConditionMultisigTapscript, MultisigTapscript, TapTreeCoder, VtxoScript, assembleBtcdTaprootTree, decodeTapscript, getNetwork, getSequence, networks, sequenceToTimelock, timelockToSequence } from './chunk-BE5MUB7T.js';
|
|
5
5
|
import './chunk-NSBPE2FW.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
3
|
+
var chunkXIVCG6EP_cjs = require('../../chunk-XIVCG6EP.cjs');
|
|
4
|
+
require('../../chunk-UBYY2TPK.cjs');
|
|
5
5
|
require('../../chunk-32YKLQPS.cjs');
|
|
6
6
|
require('../../chunk-HXDZ2QTW.cjs');
|
|
7
7
|
require('../../chunk-5BLDMQED.cjs');
|
|
@@ -37,7 +37,7 @@ var RealmWalletRepository = class {
|
|
|
37
37
|
await this.ensureInit();
|
|
38
38
|
this.realm.write(() => {
|
|
39
39
|
for (const vtxo of vtxos) {
|
|
40
|
-
const s =
|
|
40
|
+
const s = chunkXIVCG6EP_cjs.serializeVtxo(vtxo);
|
|
41
41
|
this.realm.create(
|
|
42
42
|
"ArkVtxo",
|
|
43
43
|
{
|
|
@@ -85,7 +85,7 @@ var RealmWalletRepository = class {
|
|
|
85
85
|
throw new Error("RealmWalletRepository requires an address");
|
|
86
86
|
}
|
|
87
87
|
for (const vtxo of vtxos) {
|
|
88
|
-
if (!
|
|
88
|
+
if (!chunkXIVCG6EP_cjs.isVtxoForScript(vtxo, key.script)) {
|
|
89
89
|
throw new Error(
|
|
90
90
|
`VTXO ${vtxo.txid}:${vtxo.vout} script mismatch: expected ${key.script}, got ${vtxo.script}`
|
|
91
91
|
);
|
|
@@ -110,7 +110,7 @@ var RealmWalletRepository = class {
|
|
|
110
110
|
await this.ensureInit();
|
|
111
111
|
this.realm.write(() => {
|
|
112
112
|
for (const utxo of utxos) {
|
|
113
|
-
const s =
|
|
113
|
+
const s = chunkXIVCG6EP_cjs.serializeUtxo(utxo);
|
|
114
114
|
this.realm.create(
|
|
115
115
|
"ArkUtxo",
|
|
116
116
|
{
|
|
@@ -163,7 +163,7 @@ var RealmWalletRepository = class {
|
|
|
163
163
|
amount: tx.amount,
|
|
164
164
|
settled: tx.settled,
|
|
165
165
|
createdAt: tx.createdAt,
|
|
166
|
-
assetsJson: tx.assets ? JSON.stringify(
|
|
166
|
+
assetsJson: tx.assets ? JSON.stringify(chunkXIVCG6EP_cjs.serializeAssets(tx.assets)) : null
|
|
167
167
|
},
|
|
168
168
|
"modified"
|
|
169
169
|
);
|
|
@@ -233,9 +233,9 @@ function vtxoObjectToDomain(obj) {
|
|
|
233
233
|
// Post-migration every row has `script`, but the backfill is
|
|
234
234
|
// idempotent: derive from `address` if the legacy column is still
|
|
235
235
|
// null (e.g. the migration hasn't run yet on this handle).
|
|
236
|
-
script: obj.script ??
|
|
236
|
+
script: obj.script ?? chunkXIVCG6EP_cjs.scriptFromArkAddress(obj.address)
|
|
237
237
|
};
|
|
238
|
-
return
|
|
238
|
+
return chunkXIVCG6EP_cjs.deserializeVtxo(serialized);
|
|
239
239
|
}
|
|
240
240
|
function utxoObjectToDomain(obj) {
|
|
241
241
|
const serialized = {
|
|
@@ -254,7 +254,7 @@ function utxoObjectToDomain(obj) {
|
|
|
254
254
|
status: JSON.parse(obj.statusJson),
|
|
255
255
|
extraWitness: obj.extraWitnessJson ? JSON.parse(obj.extraWitnessJson) : void 0
|
|
256
256
|
};
|
|
257
|
-
return
|
|
257
|
+
return chunkXIVCG6EP_cjs.deserializeUtxo(serialized);
|
|
258
258
|
}
|
|
259
259
|
function txObjectToDomain(obj) {
|
|
260
260
|
const tx = {
|
|
@@ -269,7 +269,7 @@ function txObjectToDomain(obj) {
|
|
|
269
269
|
createdAt: obj.createdAt
|
|
270
270
|
};
|
|
271
271
|
if (obj.assetsJson) {
|
|
272
|
-
tx.assets =
|
|
272
|
+
tx.assets = chunkXIVCG6EP_cjs.deserializeAssets(JSON.parse(obj.assetsJson));
|
|
273
273
|
}
|
|
274
274
|
return tx;
|
|
275
275
|
}
|
|
@@ -428,7 +428,7 @@ var RealmIntentRepository = class {
|
|
|
428
428
|
const clashes = [
|
|
429
429
|
...this.realm.objects("ArkIntent").filtered("intentId == $0", intent.intentId)
|
|
430
430
|
].map(toIntent);
|
|
431
|
-
|
|
431
|
+
chunkXIVCG6EP_cjs.assertIntentIdUnique(intent, clashes);
|
|
432
432
|
}
|
|
433
433
|
this.realm.create(
|
|
434
434
|
"ArkIntent",
|
|
@@ -457,14 +457,14 @@ var RealmIntentRepository = class {
|
|
|
457
457
|
}
|
|
458
458
|
async getIntents(filter) {
|
|
459
459
|
const all = [...this.realm.objects("ArkIntent")].map(toIntent).sort((a, b) => a.createdAt - b.createdAt || a.intentTxId.localeCompare(b.intentTxId));
|
|
460
|
-
const out = filter ? all.filter((i) =>
|
|
461
|
-
const { skip, end } =
|
|
460
|
+
const out = filter ? all.filter((i) => chunkXIVCG6EP_cjs.intentMatchesFilter(i, filter)) : all;
|
|
461
|
+
const { skip, end } = chunkXIVCG6EP_cjs.intentPageBounds(filter, out.length);
|
|
462
462
|
return out.slice(skip, end);
|
|
463
463
|
}
|
|
464
464
|
async getLockedVtxoOutpoints() {
|
|
465
465
|
const out = [];
|
|
466
466
|
for (const o of [...this.realm.objects("ArkIntent")].map(toIntent))
|
|
467
|
-
if (!
|
|
467
|
+
if (!chunkXIVCG6EP_cjs.isTerminalIntentState(o.state)) out.push(...o.intentVtxos);
|
|
468
468
|
return out;
|
|
469
469
|
}
|
|
470
470
|
async [Symbol.asyncDispose]() {
|
|
@@ -505,7 +505,7 @@ var RealmVirtualTxRepository = class {
|
|
|
505
505
|
txid: t.txid,
|
|
506
506
|
psbt: t.psbt ?? prev?.psbt ?? null,
|
|
507
507
|
expiresAt: t.expiresAt ?? prev?.expiresAt ?? null,
|
|
508
|
-
type:
|
|
508
|
+
type: chunkXIVCG6EP_cjs.mergeChainedTxType(t.type, prev?.type)
|
|
509
509
|
},
|
|
510
510
|
"modified"
|
|
511
511
|
);
|
|
@@ -738,7 +738,7 @@ function runArkRealmMigrations(oldRealm, newRealm) {
|
|
|
738
738
|
for (let i = 0; i < newVtxos.length; i++) {
|
|
739
739
|
const newVtxo = newVtxos[i];
|
|
740
740
|
if (!newVtxo.script) {
|
|
741
|
-
newVtxo.script =
|
|
741
|
+
newVtxo.script = chunkXIVCG6EP_cjs.scriptFromArkAddress(newVtxo.address);
|
|
742
742
|
}
|
|
743
743
|
}
|
|
744
744
|
const oldHasVirtualTx = Array.isArray(oldRealm?.schema) && oldRealm.schema.some((s) => s.name === "ArkVirtualTx");
|
|
@@ -755,7 +755,7 @@ function runArkRealmMigrations(oldRealm, newRealm) {
|
|
|
755
755
|
|
|
756
756
|
Object.defineProperty(exports, "ChainedTxType", {
|
|
757
757
|
enumerable: true,
|
|
758
|
-
get: function () { return
|
|
758
|
+
get: function () { return chunkXIVCG6EP_cjs.ChainedTxType; }
|
|
759
759
|
});
|
|
760
760
|
exports.ARK_REALM_SCHEMA_VERSION = ARK_REALM_SCHEMA_VERSION;
|
|
761
761
|
exports.ArkExperimentalRealmSchemas = ArkExperimentalRealmSchemas;
|