@arkade-os/sdk 0.5.0-rc.3 → 0.5.0-rc.30
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 +223 -83
- package/dist/adapters/expo.cjs +5 -6
- package/dist/adapters/expo.d.cts +5 -5
- package/dist/adapters/expo.d.ts +5 -5
- package/dist/adapters/expo.js +3 -4
- package/dist/{asyncStorageTaskQueue-DAs_n1xr.d.ts → asyncStorageTaskQueue-DAVf4Fyy.d.ts} +2 -2
- package/dist/{asyncStorageTaskQueue-DqGRG66E.d.cts → asyncStorageTaskQueue-fkkUPrhz.d.cts} +2 -2
- package/dist/{chunk-FSF2PGTR.cjs → chunk-3SM7BMIE.cjs} +6736 -5189
- package/dist/chunk-3SM7BMIE.cjs.map +1 -0
- package/dist/{chunk-UCSTNXB4.cjs → chunk-4MCQZYH6.cjs} +501 -1153
- package/dist/chunk-4MCQZYH6.cjs.map +1 -0
- package/dist/{chunk-BCT7DT2J.cjs → chunk-6BTZ6KFI.cjs} +12 -10
- package/dist/chunk-6BTZ6KFI.cjs.map +1 -0
- package/dist/{chunk-L4HZK4KK.cjs → chunk-AICUNREA.cjs} +158 -263
- package/dist/chunk-AICUNREA.cjs.map +1 -0
- package/dist/{chunk-UJTYUYY4.cjs → chunk-ASKOHVGX.cjs} +596 -467
- package/dist/chunk-ASKOHVGX.cjs.map +1 -0
- package/dist/{chunk-43XGA362.cjs → chunk-DLHE4RCH.cjs} +40 -43
- package/dist/chunk-DLHE4RCH.cjs.map +1 -0
- package/dist/{chunk-7W6FHWYN.js → chunk-ESEHYZAY.js} +434 -1109
- package/dist/chunk-ESEHYZAY.js.map +1 -0
- package/dist/{chunk-HSG2GQTM.js → chunk-G6ZPX2GL.js} +586 -462
- package/dist/chunk-G6ZPX2GL.js.map +1 -0
- package/dist/{chunk-G4UPMCKW.js → chunk-KK6GXY4L.js} +33 -36
- package/dist/chunk-KK6GXY4L.js.map +1 -0
- package/dist/{chunk-ERUAQGYF.js → chunk-PY3YQNHP.js} +146 -252
- package/dist/chunk-PY3YQNHP.js.map +1 -0
- package/dist/{chunk-VQCDDGRW.js → chunk-XW72DWYO.js} +6350 -4816
- package/dist/chunk-XW72DWYO.js.map +1 -0
- package/dist/{chunk-ROD5H7RX.js → chunk-YML2N4SC.js} +7 -5
- package/dist/chunk-YML2N4SC.js.map +1 -0
- package/dist/contracts/handlers/index.cjs +9 -10
- package/dist/contracts/handlers/index.d.cts +5 -5
- package/dist/contracts/handlers/index.d.ts +5 -5
- package/dist/contracts/handlers/index.js +2 -3
- package/dist/{delegate-CZzIduW4.d.cts → delegate-BYoNu3lf.d.cts} +1 -1
- package/dist/{delegate-B9Bmrns7.d.ts → delegate-DsqzUVId.d.ts} +1 -1
- package/dist/index-CXNTURO_.d.cts +645 -0
- package/dist/{index-DnNIOqHS.d.ts → index-DhP68WBD.d.cts} +1698 -2402
- package/dist/{index-DnNIOqHS.d.cts → index-DhP68WBD.d.ts} +1698 -2402
- package/dist/index-pQr5y77P.d.ts +645 -0
- package/dist/index.cjs +407 -356
- package/dist/index.d.cts +1045 -1302
- package/dist/index.d.ts +1045 -1302
- package/dist/index.js +4 -5
- package/dist/repositories/realm/index.cjs +201 -106
- package/dist/repositories/realm/index.cjs.map +1 -1
- package/dist/repositories/realm/index.d.cts +28 -16
- package/dist/repositories/realm/index.d.ts +28 -16
- package/dist/repositories/realm/index.js +190 -95
- package/dist/repositories/realm/index.js.map +1 -1
- package/dist/repositories/sqlite/index.cjs +301 -189
- package/dist/repositories/sqlite/index.cjs.map +1 -1
- package/dist/repositories/sqlite/index.d.cts +32 -21
- package/dist/repositories/sqlite/index.d.ts +32 -21
- package/dist/repositories/sqlite/index.js +294 -182
- package/dist/repositories/sqlite/index.js.map +1 -1
- package/dist/{taskRunner-BDb5Ee2J.d.cts → taskRunner-C8H3bSsk.d.cts} +2 -2
- package/dist/{taskRunner-F7wNJcF3.d.ts → taskRunner-DKtBy8Yo.d.ts} +2 -2
- package/dist/wallet/expo/background.cjs +14 -15
- package/dist/wallet/expo/background.cjs.map +1 -1
- package/dist/wallet/expo/background.d.cts +10 -16
- package/dist/wallet/expo/background.d.ts +10 -16
- package/dist/wallet/expo/background.js +6 -7
- package/dist/wallet/expo/background.js.map +1 -1
- package/dist/wallet/expo/index.cjs +20 -23
- package/dist/wallet/expo/index.cjs.map +1 -1
- package/dist/wallet/expo/index.d.cts +8 -9
- package/dist/wallet/expo/index.d.ts +8 -9
- package/dist/wallet/expo/index.js +12 -15
- package/dist/wallet/expo/index.js.map +1 -1
- package/dist/wallet-BmAHDzK3.d.cts +1874 -0
- package/dist/wallet-C0W8EOnA.d.ts +1874 -0
- package/dist/worker/expo/index.cjs +9 -10
- package/dist/worker/expo/index.cjs.map +1 -1
- package/dist/worker/expo/index.d.cts +6 -6
- package/dist/worker/expo/index.d.ts +6 -6
- package/dist/worker/expo/index.js +5 -6
- package/dist/worker/expo/index.js.map +1 -1
- package/package.json +12 -51
- package/dist/adapters/asyncStorage.cjs +0 -48
- package/dist/adapters/asyncStorage.cjs.map +0 -1
- package/dist/adapters/asyncStorage.d.cts +0 -16
- package/dist/adapters/asyncStorage.d.ts +0 -16
- package/dist/adapters/asyncStorage.js +0 -46
- package/dist/adapters/asyncStorage.js.map +0 -1
- package/dist/adapters/fileSystem.cjs +0 -116
- package/dist/adapters/fileSystem.cjs.map +0 -1
- package/dist/adapters/fileSystem.d.cts +0 -17
- package/dist/adapters/fileSystem.d.ts +0 -17
- package/dist/adapters/fileSystem.js +0 -93
- package/dist/adapters/fileSystem.js.map +0 -1
- package/dist/adapters/indexedDB.cjs +0 -103
- package/dist/adapters/indexedDB.cjs.map +0 -1
- package/dist/adapters/indexedDB.d.cts +0 -18
- package/dist/adapters/indexedDB.d.ts +0 -18
- package/dist/adapters/indexedDB.js +0 -101
- package/dist/adapters/indexedDB.js.map +0 -1
- package/dist/adapters/localStorage.cjs +0 -50
- package/dist/adapters/localStorage.cjs.map +0 -1
- package/dist/adapters/localStorage.d.cts +0 -14
- package/dist/adapters/localStorage.d.ts +0 -14
- package/dist/adapters/localStorage.js +0 -48
- package/dist/adapters/localStorage.js.map +0 -1
- package/dist/chunk-43XGA362.cjs.map +0 -1
- package/dist/chunk-5BLDMQED.cjs +0 -18
- package/dist/chunk-5BLDMQED.cjs.map +0 -1
- package/dist/chunk-7W6FHWYN.js.map +0 -1
- package/dist/chunk-BCT7DT2J.cjs.map +0 -1
- package/dist/chunk-ERUAQGYF.js.map +0 -1
- package/dist/chunk-FSF2PGTR.cjs.map +0 -1
- package/dist/chunk-G4UPMCKW.js.map +0 -1
- package/dist/chunk-HSG2GQTM.js.map +0 -1
- package/dist/chunk-L4HZK4KK.cjs.map +0 -1
- package/dist/chunk-NSBPE2FW.js +0 -15
- package/dist/chunk-NSBPE2FW.js.map +0 -1
- package/dist/chunk-ROD5H7RX.js.map +0 -1
- package/dist/chunk-UCSTNXB4.cjs.map +0 -1
- package/dist/chunk-UJTYUYY4.cjs.map +0 -1
- package/dist/chunk-VQCDDGRW.js.map +0 -1
- package/dist/hdWalletCapable-BIl3yLVM.d.cts +0 -2232
- package/dist/hdWalletCapable-Cr5nGpK5.d.ts +0 -2232
- package/dist/index-C0IanN1m.d.cts +0 -11
- package/dist/index-C0IanN1m.d.ts +0 -11
- package/dist/index-Ci5MmNnK.d.cts +0 -850
- package/dist/index-DQ1Hb2w_.d.ts +0 -850
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import { W as Wallet, R as ReadonlyWallet, b as ReceiveRotatorFactory, c as ReceiveRotatorBootOpts, d as ReceiveRotatorBoot, P as ProviderConnectionState, H as HDWalletCapable, a as HDAllocationCapable, A as AddressAllocationCapable, B as BatchExpiryPolicy, e as Batch } from './
|
|
4
|
-
export {
|
|
5
|
-
import { P as Program, A as ArkadeParamValue, a as ArkadeProgramScript, b as ProgramKeys, c as ArkadeArgValue, C as CompiledProgramFunction, d as ArkadeFunction, I as
|
|
6
|
-
export {
|
|
7
|
-
import { D as DefaultVtxo } from './delegate-
|
|
8
|
-
export { a as DelegateVtxo } from './delegate-
|
|
1
|
+
import { ah as ReadonlyIdentity, a as Identity, a4 as DescriptorSigningRequest, a5 as Transaction, aA as SignerSession, a3 as DescriptorProvider, aE as IntentFeeConfig, aF as OffchainInput, aG as FeeAmount, aH as OnchainInput, aI as FeeOutput, Y as IntentRepository, Z as ArkIntent, _ as IntentPageFilter, P as PageRequest, F as PageResult, O as Outpoint, $ as VirtualTxRepository, a0 as VirtualTx, a1 as VtxoBranch, W as WalletRepository, D as ExtendedVirtualCoin, H as ScriptVtxoCursor, J as ScriptVtxoPageOptions, K as StoredVtxo, L as VtxoRepositoryKey, E as ExtendedCoin, M as TransactionHistoryPageFilter, Q as TransactionHistoryPageCursor, h as ArkTransaction, U as WalletState, B as Contract, C as ContractRepository, X as ContractFilter, I as IWallet, v as ArkProvider, aq as NetworkName, ai as OnchainProvider, ay as SettlementConfig, aJ as ContractWatcherConfig, aK as Asset, R as Recipient, aL as FeeInfo, o as SettlementEvent, N as NormalizedExtendedVirtualCoin, S as SettleParams, G as GetArkadeInfoOptions, aM as GetVtxosOptions, aN as PaginationOptions, f as GetVtxosFilter, g as GetSpendableVtxosFilter, aO as CreateContractParams, aP as GetContractsFilter, z as VirtualCoin, aQ as GetSpendablePathsOptions, aR as GetAllSpendingPathsOptions, l as GetNewAddressesOptions, aS as InputExpiryFloor, aT as IssuanceParams, aU as ReissuanceParams, aV as BurnParams, aW as RenewVtxosOptions, A as ArkadeInfo, aX as NormalizedVtxoPage, c as ArkadeReader, d as ArkadeBroadcaster, e as WalletBalance, ao as ContractSyncState, as as ContractWithVtxos, aY as WatchedScript, aZ as PathSelection, m as NewAddress, a_ as ContractEvent, a$ as AssetDetails, b0 as IssuanceResult, b1 as DelegateInfo, b2 as MigrationGlobalSkipReason, b3 as MigrationLegSkipReason, b4 as SignerStatus, ag as IReadonlyWallet, i as ActivityRegistry, an as IReadonlyAssetManager, b5 as StorageConfig, j as Activity, k as IContractManager, q as IAssetManager, p as SendParams, n as IDelegateManager, b6 as IVtxoManager, a6 as Network, au as Coin, b7 as SendBitcoinParams, b8 as ExplorerTransaction, aB as SignedIntent, aC as Intent, b9 as TreeNonces, ba as TreePartialSigs, T as TxNotificationEvent, bb as PendingTx, y as TapLeafScript, bc as EncodedVtxoScript, ax as CSVMultisigTapscript, x as RelativeTimelock, bd as EmulatorProvider, V as VtxoScript, be as Status, ar as ArkAddress, bf as ChainTx, w as IndexerProvider, a9 as TxTree, bg as ArkadeService, bh as ContractVtxoEvent, bi as ExtendedContractVtxo, bj as ResolvedArkadeService, bk as resolveArkadeService, bl as PathContext } from './index-DhP68WBD.js';
|
|
2
|
+
export { bm as ActivityIntent, bn as ActivityResolver, bo as ArkIntentState, bp as ArkTapscript, bq as AssetMetadata, br as BITCOIN_EMULATOR_PUBKEY, bs as BaseWalletConfig, ad as BatchFailedEvent, ab as BatchFinalizationEvent, ac as BatchFinalizedEvent, bt as BatchInfo, bu as BatchSignableIdentity, a7 as BatchStartedEvent, bv as CLTVMultisigTapscript, bw as CandidateDeps, bx as ChainTxType, a2 as ChainedTxType, by as CommitmentTx, bz as ConditionCSVMultisigTapscript, bA as ConditionMultisigTapscript, bB as ConnectorTreeNode, bC as ContractBalance, bD as ContractEventCallback, bE as ContractHandler, av as ContractManager, aw as ContractManagerConfig, bF as ContractState, bG as ContractVtxo, bH as ContractWatcher, bI as ContractWatcherEventCallback, bJ as DEFAULT_ARKADE_EMULATOR_URL, bK as DEFAULT_VTXO_PAGE_SIZE, bL as DelegateManagerImpl, bM as DelegateOptions, aj as DelegateProvider, bN as DeprecatedSignerMigrationReport, bO as DeprecatedSignerReport, bP as DigestMismatchError, bQ as Discoverable, bR as DiscoveredContract, bS as DiscoveryDeps, bT as ESPLORA_URL, bU as EmulatorInfo, bV as EsploraProvider, bW as EventSourceCapable, bX as EventSourceFactory, bY as EventSourceLike, bZ as EventSourceUnavailableError, al as ExitCaptureMode, b_ as ExitChainResolver, am as ExitDataSource, b$ as GroupMembership, c0 as HandlerError, c1 as INTENT_TERMINAL_STATES, c2 as IndexerTxType, c3 as IntentCoin, c4 as IntentFilter, c5 as KnownMetadata, c6 as MAX_PAGE_SIZE, c7 as MUTINYNET_EMULATOR_PUBKEY, c8 as MigrateDeprecatedSignerOptions, c9 as MigrationLegReport, ca as MigrationVtxoRef, cb as MultisigTapscript, cc as NewAddressType, cd as Nonces, ce as Output, cf as PageResponse, cg as PartialSig, ch as PrevTxSource, ci as PrevTxUnavailableError, cj as ProviderClass, ck as REGTEST_EMULATOR_PUBKEY, cl as RawTxSource, ak as ReadonlyWalletConfig, ap as RecipientArkadeAddressContext, cm as RenewalSplit, cn as RenewalSplitContext, r as RestArkProvider, co as RestDelegateProvider, cp as RestEmulatorProvider, s as RestIndexerProvider, cq as ScanContractsOptions, cr as ScanResult, cs as ScheduledSession, ct as SettlementEventType, cu as SignRequest, cv as SignerClassification, cw as SignerSet, t as SubscriptionEvent, cx as SubscriptionFilter, u as SubscriptionHeartbeat, cy as SubscriptionResponse, cz as SweepTxNotification, cA as TapLeaves, cB as TapTreeCoder, cC as TapscriptType, aD as TimeHeight, aa as TreeNoncesEvent, af as TreeSignatureEvent, a8 as TreeSigningStartedEvent, ae as TreeTxEvent, cD as Tx, cE as TxHistoryRecord, cF as TxKey, cG as TxNotification, cH as TxTag, cI as TxTreeNode, cJ as TxType, cK as Vtxo, cL as VtxoChain, az as VtxoManager, cM as VtxoType, b as WalletConfig, cN as WalletMode, cO as WithPrevTx, cP as assertAllowedSighashTypes, cQ as assertPageRequest, cR as assertRecipientArkadeAddress, cS as assetMintResolver, cT as attachPrevArkTxs, cU as attachPrevoutTxs, cV as boardingResolver, cW as canRecoverOnchain, cX as canSpendOffchain, cY as canSweepOnchain, cZ as classifyAgainstSignerSet, c_ as classifyContractSigner, c$ as collabExitResolver, d0 as collectContracts, d1 as collectIntents, d2 as collectPages, d3 as collectScriptVtxos, d4 as collectTransactionHistory, d5 as collectUtxos, d6 as collectVtxos, d7 as configureEventSource, d8 as createDefaultActivityRegistry, d9 as createExitChainResolver, da as decodeTapscript, db as defaultEmulatorPubkey, dc as getAllNormalizedVtxos, dd as getConfiguredEventSource, de as getNetwork, df as getNormalizedVtxos, dg as getRandomId, dh as getSequence, di as hasCandidates, dj as isBatchSignable, dk as isContractVtxoEvent, dl as isCooperativelyMigratable, dm as isDiscoverable, dn as isEventSourceUnavailableError, dp as isPastExpiry, dq as isSigningIdentity, dr as isSubdust, ds as isTerminalIntentState, dt as isVirtualCoin, du as isVtxoExpiringSoon, dv as isVtxoSpent, dw as iteratePages, dx as networkFromArkadeInfo, dy as networks, dz as pageResult, dA as resolveEmulatorPubkey, dB as resolveEventSource, dC as resolvePrevTxs, dD as scriptFromTapLeafScript, dE as signerSetFromInfo, dF as toOffchainInputFeeParams, dG as toXOnlySignerHex, dH as withPrevTxs } from './index-DhP68WBD.js';
|
|
3
|
+
import { W as Wallet, R as ReadonlyWallet, b as ReceiveRotatorFactory, c as ReceiveRotatorBootOpts, d as ReceiveRotatorBoot, P as ProviderConnectionState, H as HDWalletCapable, a as HDAllocationCapable, A as AddressAllocationCapable, B as BatchExpiryPolicy, e as Batch } from './wallet-C0W8EOnA.js';
|
|
4
|
+
export { f as AbortError, g as ArkError, h as ArkErrorName, i as ArkadeCashClaimResult, j as ArkadeCashCreateError, k as ArkadeCashOperatorMismatchError, l as ArkadeCashUnclaimedReason, m as ArkadeCashUnclaimedVtxo, n as ArkadeCashVtxoRef, o as BoardingUtxoGroup, D as DEFAULT_MIN_BATCH_EXPIRY_SECONDS, F as ForeignDescriptorError, I as IncomingFunds, p as IndexedDBWalletRepository, K as KeyringDescriptorProvider, M as MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD, q as ProviderKind, r as ProviderUnavailableError, s as REGTEST_MIN_BATCH_EXPIRY_SECONDS, S as ServerInfoSource, t as ServerResponseMismatchError, V as VtxoReservation, u as VtxoReservedError, v as WaitForIncomingFundsOptions, w as WalletCannotAllocateAddressError, x as assertValidBatchExpiry, y as defaultBatchExpiryPolicy, z as isAddressAllocationCapable, C as isArkError, E as isHDAllocationCapable, G as isHDWalletCapable, J as maybeArkError, L as resolveBatchExpiryPolicy, N as resolveDescriptorSigner, O as selectVirtualCoins, Q as signingDescriptorIndex, T as strictSigningDescriptorIndex, U as waitForIncomingFunds } from './wallet-C0W8EOnA.js';
|
|
5
|
+
import { P as Program, A as ArkadeParamValue, a as ArkadeProgramScript, b as ProgramKeys, c as ArkadeArgValue, C as CompiledProgramFunction, d as ArkadeFunction, I as InputDef, e as ArkadeValueType, f as ArkadeArgType, g as ArkadeContractParams, h as ArkadeSegment, i as AsmToken, j as InputRef, S as SUPPORTED_PROGRAM_VERSION, k as SignerRef, T as TapscriptSegment, l as TweakedSigner, U as UnsupportedProgramVersionError, W as WitnessRef, m as deserializeArkadeContractParams, p as parseArtifact, r as resolveAsm, s as serializeArkadeContractParams, n as stringifyArtifact, v as validateProgram, w as witnessRefToBytes } from './index-pQr5y77P.js';
|
|
6
|
+
export { o as ArkadeContractHandler, B as BoardingContractHandler, q as BoardingContractParams, D as DefaultContractHandler, t as DefaultContractParams, u as DelegateContractHandler, x as DelegateContractParams, V as VHTLC, y as VHTLCContractHandler, z as VHTLCContractParams, E as VHTLCV2ContractHandler, F as VHTLCV2ContractParams, G as contractHandlers } from './index-pQr5y77P.js';
|
|
7
|
+
import { D as DefaultVtxo } from './delegate-DsqzUVId.js';
|
|
8
|
+
export { a as DelegateVtxo } from './delegate-DsqzUVId.js';
|
|
9
9
|
import { Bytes, BTC_NETWORK } from '@scure/btc-signer/utils.js';
|
|
10
10
|
import { P2TR } from '@scure/btc-signer/payment.js';
|
|
11
11
|
import { Transaction as Transaction$1, OP, Script, ScriptType } from '@scure/btc-signer';
|
|
12
12
|
import { ElectrumWS } from 'ws-electrumx-client';
|
|
13
13
|
import { TransactionOutput, TransactionInputUpdate } from '@scure/btc-signer/psbt.js';
|
|
14
|
-
import { Transaction as Transaction$2 } from '@scure/btc-signer/transaction.js';
|
|
15
|
-
import { S as StorageAdapter } from './index-C0IanN1m.js';
|
|
16
14
|
import * as P from 'micro-packed';
|
|
15
|
+
import '@scure/btc-signer/transaction.js';
|
|
16
|
+
|
|
17
|
+
/** Validate an optional millisecond duration; zero retains its caller-defined meaning. */
|
|
18
|
+
declare function assertNonNegativeMs(name: string, ms: number | undefined): void;
|
|
19
|
+
/** Validate a timer delay without changing whether zero disables or immediately fires it. */
|
|
20
|
+
declare function assertTimerMs(name: string, ms: number | undefined): void;
|
|
17
21
|
|
|
18
22
|
/**
|
|
19
23
|
* Tagged envelope for a signing identity transported across the
|
|
@@ -55,18 +59,6 @@ type SerializedReadonlyIdentity = {
|
|
|
55
59
|
descriptor: string;
|
|
56
60
|
};
|
|
57
61
|
type SerializedIdentity = SerializedSigningIdentity | SerializedReadonlyIdentity;
|
|
58
|
-
/**
|
|
59
|
-
* Legacy untagged shape emitted by page builds prior to the tagged
|
|
60
|
-
* SerializedIdentity envelope. Retained so newer workers can still accept
|
|
61
|
-
* older pages during a rolling upgrade. Slated for removal in the next major.
|
|
62
|
-
*
|
|
63
|
-
* @deprecated Use {@link SerializedIdentity}.
|
|
64
|
-
*/
|
|
65
|
-
type LegacySerializedIdentity = {
|
|
66
|
-
privateKey: string;
|
|
67
|
-
} | {
|
|
68
|
-
publicKey: string;
|
|
69
|
-
};
|
|
70
62
|
|
|
71
63
|
/**
|
|
72
64
|
* Read-side HD capability marker. Exposes the wildcard-suffixed account
|
|
@@ -86,14 +78,8 @@ interface ReadonlyHDCapableIdentity extends ReadonlyIdentity {
|
|
|
86
78
|
* concrete descriptor by replacing the `*` with a derivation index.
|
|
87
79
|
*/
|
|
88
80
|
readonly descriptor: string;
|
|
89
|
-
/**
|
|
90
|
-
|
|
91
|
-
*
|
|
92
|
-
* @deprecated Prefer `DescriptorProvider.isOurs()` via
|
|
93
|
-
* `HDDescriptorProvider` for rotating HD wallets or
|
|
94
|
-
* `StaticDescriptorProvider` for legacy single-key wallets.
|
|
95
|
-
*/
|
|
96
|
-
isOurs(descriptor: string): boolean;
|
|
81
|
+
/** True iff `descriptor` derives from this identity's xpub/seed. */
|
|
82
|
+
ownsDescriptor(descriptor: string): boolean;
|
|
97
83
|
}
|
|
98
84
|
/**
|
|
99
85
|
* Capability marker for identities that can be rotated through an HD
|
|
@@ -110,22 +96,10 @@ interface ReadonlyHDCapableIdentity extends ReadonlyIdentity {
|
|
|
110
96
|
* explicitly-non-rotating use cases.
|
|
111
97
|
*/
|
|
112
98
|
interface HDCapableIdentity extends ReadonlyHDCapableIdentity, Identity {
|
|
113
|
-
/**
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
* `HDDescriptorProvider` or `StaticDescriptorProvider`. Identities keep
|
|
118
|
-
* this method only as backing implementation for descriptor providers.
|
|
119
|
-
*/
|
|
120
|
-
signWithDescriptor(requests: DescriptorSigningRequest[]): Promise<Transaction[]>;
|
|
121
|
-
/**
|
|
122
|
-
* Signs a message using the key derived from `descriptor`.
|
|
123
|
-
*
|
|
124
|
-
* @deprecated Prefer `DescriptorProvider.signMessageWithDescriptor()` via
|
|
125
|
-
* `HDDescriptorProvider` or `StaticDescriptorProvider`. Identities keep
|
|
126
|
-
* this method only as backing implementation for descriptor providers.
|
|
127
|
-
*/
|
|
128
|
-
signMessageWithDescriptor(descriptor: string, message: Uint8Array, signatureType?: "schnorr" | "ecdsa"): Promise<Uint8Array>;
|
|
99
|
+
/** Signs each request with the key derived from its descriptor. */
|
|
100
|
+
signDescriptorTransactions(requests: DescriptorSigningRequest[]): Promise<Transaction[]>;
|
|
101
|
+
/** Signs a message using the key derived from `descriptor`. */
|
|
102
|
+
signDescriptorMessage(descriptor: string, message: Uint8Array, signatureType?: "schnorr" | "ecdsa"): Promise<Uint8Array>;
|
|
129
103
|
}
|
|
130
104
|
|
|
131
105
|
/** Used for default BIP86 derivation with network selection. */
|
|
@@ -140,9 +114,8 @@ interface NetworkOptions {
|
|
|
140
114
|
/** Used for a caller-supplied account-descriptor template. */
|
|
141
115
|
interface DescriptorOptions {
|
|
142
116
|
/**
|
|
143
|
-
* Account-descriptor *template
|
|
144
|
-
*
|
|
145
|
-
* read by HD providers to rotate through derivation indices.
|
|
117
|
+
* Account-descriptor *template*; must end with the BIP-32 wildcard suffix `/*)`. Stored as-is
|
|
118
|
+
* on {@link SeedIdentity.descriptor} for HD providers to rotate through indices.
|
|
146
119
|
*/
|
|
147
120
|
descriptor: string;
|
|
148
121
|
}
|
|
@@ -154,32 +127,18 @@ type MnemonicOptions = SeedIdentityOptions & {
|
|
|
154
127
|
passphrase?: string;
|
|
155
128
|
};
|
|
156
129
|
/**
|
|
157
|
-
* Seed-based identity derived from a raw seed and an account descriptor
|
|
158
|
-
* *template*.
|
|
159
|
-
*
|
|
160
|
-
* This is the recommended identity type for most applications. It uses
|
|
161
|
-
* standard BIP86 (Taproot) derivation by default; callers that need a
|
|
162
|
-
* different path supply the wildcard template directly.
|
|
163
|
-
*
|
|
164
|
-
* Prefer this (or @see MnemonicIdentity) over `SingleKey` for new
|
|
165
|
-
* integrations — `SingleKey` exists for backward compatibility with
|
|
166
|
-
* raw nsec-style keys.
|
|
130
|
+
* Seed-based identity derived from a raw seed and an account descriptor *template*.
|
|
167
131
|
*
|
|
168
|
-
* The identity
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
* concrete descriptor at a specific index materialize it themselves
|
|
172
|
-
* (see `HDDescriptorProvider` in the wallet layer).
|
|
132
|
+
* The recommended identity type: BIP86 (Taproot) derivation by default, or a caller-supplied
|
|
133
|
+
* wildcard template. Prefer it (or @see MnemonicIdentity) over `SingleKey`, which exists for
|
|
134
|
+
* backward compatibility with raw nsec-style keys.
|
|
173
135
|
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
* to get one:
|
|
177
|
-
* - `HDDescriptorProvider` for rotating receive addresses.
|
|
178
|
-
* - {@link StaticDescriptorProvider} for legacy, single-key behaviour.
|
|
136
|
+
* {@link descriptor} holds the wildcard template (e.g. `tr([fp/86'/0'/0']xpub/0/*)`); consumers
|
|
137
|
+
* materialize concrete indices themselves (see `HDDescriptorProvider`).
|
|
179
138
|
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
139
|
+
* Deliberately NOT a `DescriptorProvider`, so it can't silently be used as a concrete
|
|
140
|
+
* descriptor source and defeat HD rotation. Wrap it in `HDDescriptorProvider` (rotating
|
|
141
|
+
* receive addresses) or {@link StaticDescriptorProvider} (legacy single-key behaviour).
|
|
183
142
|
*
|
|
184
143
|
* @example
|
|
185
144
|
* ```typescript
|
|
@@ -197,34 +156,21 @@ type MnemonicOptions = SeedIdentityOptions & {
|
|
|
197
156
|
*/
|
|
198
157
|
declare class SeedIdentity implements HDCapableIdentity {
|
|
199
158
|
private readonly derivedKey;
|
|
200
|
-
/**
|
|
201
|
-
* Wildcard account-descriptor template (e.g.
|
|
202
|
-
* `tr([fp/86'/0'/0']xpub/0/*)`). The canonical thing to pass
|
|
203
|
-
* through the system; consumers materialize a concrete descriptor
|
|
204
|
-
* at a specific index themselves (see `HDDescriptorProvider` in
|
|
205
|
-
* the wallet layer for the rotating-counter use case).
|
|
206
|
-
*/
|
|
159
|
+
/** Wildcard account-descriptor template (e.g. `tr([fp/86'/0'/0']xpub/0/*)`). */
|
|
207
160
|
readonly descriptor: string;
|
|
208
161
|
/**
|
|
209
|
-
* Constructs a SeedIdentity from a 64-byte seed and either a
|
|
210
|
-
*
|
|
211
|
-
* default BIP86 path at the requested network (`{ isMainnet }`).
|
|
212
|
-
* Prefer the {@link fromSeed} factory for symmetry with
|
|
213
|
-
* {@link MnemonicIdentity.fromMnemonic}.
|
|
162
|
+
* Constructs a SeedIdentity from a 64-byte seed and either a wildcard `{ descriptor }` or the
|
|
163
|
+
* default BIP86 path for `{ isMainnet }`. Prefer {@link fromSeed}.
|
|
214
164
|
*
|
|
215
|
-
* Throws on a non-wildcard descriptor, an xpub mismatch with the
|
|
216
|
-
*
|
|
165
|
+
* Throws on a non-wildcard descriptor, an xpub mismatch with the seed, or a missing
|
|
166
|
+
* derivation path.
|
|
217
167
|
*/
|
|
218
168
|
constructor(seed: Uint8Array, opts?: SeedIdentityOptions);
|
|
219
169
|
/**
|
|
220
|
-
* Creates a SeedIdentity from a raw 64-byte seed
|
|
221
|
-
*
|
|
222
|
-
* Pass `{ isMainnet }` for default BIP86 derivation, or
|
|
223
|
-
* `{ descriptor }` for a caller-supplied account-descriptor
|
|
224
|
-
* template (the option's value must end with `/*)`).
|
|
170
|
+
* Creates a SeedIdentity from a raw 64-byte seed: `{ isMainnet }` for default BIP86
|
|
171
|
+
* derivation, or `{ descriptor }` for a template ending in `/*)`.
|
|
225
172
|
*
|
|
226
173
|
* @param seed - 64-byte seed (typically from mnemonicToSeedSync)
|
|
227
|
-
* @param opts - Network selection or descriptor template.
|
|
228
174
|
*/
|
|
229
175
|
static fromSeed(seed: Uint8Array, opts?: SeedIdentityOptions): SeedIdentity;
|
|
230
176
|
xOnlyPublicKey(): Promise<Uint8Array>;
|
|
@@ -232,50 +178,23 @@ declare class SeedIdentity implements HDCapableIdentity {
|
|
|
232
178
|
sign(tx: Transaction, inputIndexes?: number[]): Promise<Transaction>;
|
|
233
179
|
signMessage(message: Uint8Array, signatureType?: "schnorr" | "ecdsa"): Promise<Uint8Array>;
|
|
234
180
|
/**
|
|
235
|
-
* BIP-340 sign `messageHash` with this identity's own key, aux_rand = 0
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
* {@link signSchnorrDeterministicWithDescriptor}, for an `auto`-mode wallet
|
|
239
|
-
* whose bare `tr(pubkey)` resolves to the identity itself rather than to a
|
|
240
|
-
* {@link DescriptorIdentity}. Deliberately NOT routed through
|
|
241
|
-
* `signMessage`, whose schnorr branch draws a random aux_rand and would
|
|
242
|
-
* make the "deterministic" signature unreproducible.
|
|
181
|
+
* BIP-340 sign `messageHash` with this identity's own key, aux_rand = 0 (for an `auto`-mode
|
|
182
|
+
* wallet whose bare `tr(pubkey)` resolves to the identity itself). NOT via `signMessage`,
|
|
183
|
+
* whose random aux_rand would make the signature unreproducible.
|
|
243
184
|
*/
|
|
244
185
|
signSchnorrDeterministic(messageHash: Uint8Array): Promise<Uint8Array>;
|
|
245
186
|
signerSession(): SignerSession;
|
|
246
|
-
/**
|
|
247
|
-
* Converts to a watch-only identity that cannot sign. Carries the
|
|
248
|
-
* template forward, so the readonly side stays HD-capable (can
|
|
249
|
-
* derive descriptors at any index without seed access).
|
|
250
|
-
*/
|
|
187
|
+
/** Watch-only copy; carries the template forward, so it stays HD-capable without the seed. */
|
|
251
188
|
toReadonly(): Promise<ReadonlyDescriptorIdentity>;
|
|
252
|
-
/**
|
|
253
|
-
|
|
254
|
-
* HD descriptors match by account xpub; bare `tr(pubkey)` descriptors
|
|
255
|
-
* match by raw pubkey. See {@link descriptorIsOurs}.
|
|
256
|
-
*
|
|
257
|
-
* @deprecated Prefer `DescriptorProvider.isOurs()` via
|
|
258
|
-
* `HDDescriptorProvider` for rotating HD wallets or
|
|
259
|
-
* `StaticDescriptorProvider` for legacy single-key wallets.
|
|
260
|
-
*/
|
|
261
|
-
isOurs(descriptor: string): boolean;
|
|
189
|
+
/** Returns true when `descriptor` is derived from this identity's seed. */
|
|
190
|
+
ownsDescriptor(descriptor: string): boolean;
|
|
262
191
|
/**
|
|
263
192
|
* Signs each request with the key derived from its descriptor.
|
|
264
|
-
* Each descriptor must share this identity's seed ({@link
|
|
265
|
-
*
|
|
266
|
-
* @deprecated Prefer `DescriptorProvider.signWithDescriptor()` via
|
|
267
|
-
* `HDDescriptorProvider` or `StaticDescriptorProvider`. Identities keep
|
|
268
|
-
* this method only as backing implementation for descriptor providers.
|
|
193
|
+
* Each descriptor must share this identity's seed ({@link ownsDescriptor}).
|
|
269
194
|
*/
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
|
|
273
|
-
*
|
|
274
|
-
* @deprecated Prefer `DescriptorProvider.signMessageWithDescriptor()` via
|
|
275
|
-
* `HDDescriptorProvider` or `StaticDescriptorProvider`. Identities keep
|
|
276
|
-
* this method only as backing implementation for descriptor providers.
|
|
277
|
-
*/
|
|
278
|
-
signMessageWithDescriptor(descriptor: string, message: Uint8Array, signatureType?: "schnorr" | "ecdsa"): Promise<Uint8Array>;
|
|
195
|
+
signDescriptorTransactions(requests: DescriptorSigningRequest[]): Promise<Transaction[]>;
|
|
196
|
+
/** Signs a message with the key derived from `descriptor`. */
|
|
197
|
+
signDescriptorMessage(descriptor: string, message: Uint8Array, signatureType?: "schnorr" | "ecdsa"): Promise<Uint8Array>;
|
|
279
198
|
/**
|
|
280
199
|
* BIP-340 sign `messageHash` with the key derived from `descriptor`,
|
|
281
200
|
* aux_rand = 0. Backs {@link DescriptorIdentity.signSchnorrDeterministic},
|
|
@@ -287,12 +206,8 @@ declare class SeedIdentity implements HDCapableIdentity {
|
|
|
287
206
|
private signMessageWithKey;
|
|
288
207
|
}
|
|
289
208
|
/**
|
|
290
|
-
* Mnemonic-based identity derived from a BIP39 phrase
|
|
291
|
-
*
|
|
292
|
-
* This is the most user-friendly identity type — recommended for wallet
|
|
293
|
-
* applications where users manage their own backup phrase. Extends
|
|
294
|
-
* @see SeedIdentity with mnemonic validation and optional passphrase
|
|
295
|
-
* support.
|
|
209
|
+
* Mnemonic-based identity derived from a BIP39 phrase; recommended where users manage their own
|
|
210
|
+
* backup phrase. Extends @see SeedIdentity with mnemonic validation and an optional passphrase.
|
|
296
211
|
*
|
|
297
212
|
* @example
|
|
298
213
|
* ```typescript
|
|
@@ -305,27 +220,16 @@ declare class SeedIdentity implements HDCapableIdentity {
|
|
|
305
220
|
declare class MnemonicIdentity extends SeedIdentity {
|
|
306
221
|
private constructor();
|
|
307
222
|
/**
|
|
308
|
-
* Creates a MnemonicIdentity from a BIP39
|
|
309
|
-
*
|
|
310
|
-
* Pass `{ isMainnet }` for default BIP86 derivation, or
|
|
311
|
-
* `{ descriptor }` for a caller-supplied account-descriptor
|
|
312
|
-
* template (the option's value must end with `/*)`).
|
|
223
|
+
* Creates a MnemonicIdentity from a BIP39 phrase: `{ isMainnet }` for default BIP86
|
|
224
|
+
* derivation, or `{ descriptor }` for a template ending in `/*)`, plus optional passphrase.
|
|
313
225
|
*
|
|
314
226
|
* @param phrase - BIP39 mnemonic phrase (12 or 24 words)
|
|
315
|
-
* @param opts - Network selection or descriptor template, plus optional passphrase
|
|
316
227
|
*/
|
|
317
228
|
static fromMnemonic(phrase: string, opts?: MnemonicOptions): MnemonicIdentity;
|
|
318
229
|
}
|
|
319
230
|
/**
|
|
320
|
-
* Watch-only HD identity from a descriptor
|
|
321
|
-
*
|
|
322
|
-
* Can derive public keys but cannot sign transactions. Use this for
|
|
323
|
-
* watch-only wallets — given just an xpub-based template, the readonly
|
|
324
|
-
* side still rotates through HD indices.
|
|
325
|
-
*
|
|
326
|
-
* Constructed from a wildcard template (e.g.
|
|
327
|
-
* `tr([fp/86'/0'/0']xpub.../0/*)`); the {@link descriptor} field
|
|
328
|
-
* holds it for HD providers to consume.
|
|
231
|
+
* Watch-only HD identity from a wildcard descriptor template (e.g.
|
|
232
|
+
* `tr([fp/86'/0'/0']xpub.../0/*)`): derives public keys and rotates HD indices, cannot sign.
|
|
329
233
|
*
|
|
330
234
|
* @example
|
|
331
235
|
* ```typescript
|
|
@@ -338,40 +242,19 @@ declare class MnemonicIdentity extends SeedIdentity {
|
|
|
338
242
|
*/
|
|
339
243
|
declare class ReadonlyDescriptorIdentity implements ReadonlyHDCapableIdentity {
|
|
340
244
|
/**
|
|
341
|
-
* Index-0 expansion of {@link descriptor}
|
|
342
|
-
* (
|
|
343
|
-
* pubkey (derived through the bip32 node when needed) are read off
|
|
344
|
-
* this on demand — no separate caches.
|
|
245
|
+
* Index-0 expansion of {@link descriptor}; the x-only pubkey (32 bytes) and the compressed
|
|
246
|
+
* pubkey (via the bip32 node) are both read off it on demand.
|
|
345
247
|
*/
|
|
346
248
|
private readonly indexZero;
|
|
347
|
-
/**
|
|
348
|
-
* Wildcard account-descriptor template (e.g.
|
|
349
|
-
* `tr([fp/86'/0'/0']xpub/0/*)`). HD rotation consumers materialize
|
|
350
|
-
* a concrete descriptor at a specific index themselves.
|
|
351
|
-
*/
|
|
249
|
+
/** Wildcard account-descriptor template (e.g. `tr([fp/86'/0'/0']xpub/0/*)`). */
|
|
352
250
|
readonly descriptor: string;
|
|
353
251
|
private constructor();
|
|
354
|
-
/**
|
|
355
|
-
* Creates a ReadonlyDescriptorIdentity from an account-descriptor
|
|
356
|
-
* *template* (must end with the BIP-32 wildcard suffix `/*)`).
|
|
357
|
-
*
|
|
358
|
-
* @param descriptor - Wildcard-suffixed Taproot template
|
|
359
|
-
* (`tr([fp/path']xpub.../child/*)`).
|
|
360
|
-
*/
|
|
252
|
+
/** @param descriptor - Wildcard-suffixed Taproot template (`tr([fp/path']xpub.../child/*)`). */
|
|
361
253
|
static fromDescriptor(descriptor: string): ReadonlyDescriptorIdentity;
|
|
362
254
|
xOnlyPublicKey(): Promise<Uint8Array>;
|
|
363
255
|
compressedPublicKey(): Promise<Uint8Array>;
|
|
364
|
-
/**
|
|
365
|
-
|
|
366
|
-
* HD descriptors match by account xpub; bare `tr(pubkey)` descriptors
|
|
367
|
-
* fall back to comparing against the index-0 x-only pubkey. See
|
|
368
|
-
* {@link descriptorIsOurs}.
|
|
369
|
-
*
|
|
370
|
-
* @deprecated Prefer `DescriptorProvider.isOurs()` via
|
|
371
|
-
* `HDDescriptorProvider` for rotating HD wallets or
|
|
372
|
-
* `StaticDescriptorProvider` for legacy single-key wallets.
|
|
373
|
-
*/
|
|
374
|
-
isOurs(descriptor: string): boolean;
|
|
256
|
+
/** Returns true when `descriptor` derives from this identity's xpub. */
|
|
257
|
+
ownsDescriptor(descriptor: string): boolean;
|
|
375
258
|
}
|
|
376
259
|
|
|
377
260
|
/**
|
|
@@ -488,73 +371,19 @@ declare class DescriptorIdentity implements Identity {
|
|
|
488
371
|
}
|
|
489
372
|
|
|
490
373
|
/**
|
|
491
|
-
*
|
|
492
|
-
*
|
|
493
|
-
* @example
|
|
494
|
-
* ```typescript
|
|
495
|
-
* // Create from hex string
|
|
496
|
-
* const key = SingleKey.fromHex('your_private_key_hex');
|
|
497
|
-
*
|
|
498
|
-
* // Create from raw bytes
|
|
499
|
-
* const key = SingleKey.fromPrivateKey(privateKeyBytes);
|
|
500
|
-
*
|
|
501
|
-
* // Create random key
|
|
502
|
-
* const randomKey = SingleKey.fromRandomBytes();
|
|
503
|
-
*
|
|
504
|
-
* // Sign a transaction
|
|
505
|
-
* const signedTx = await key.sign(transaction);
|
|
506
|
-
* ```
|
|
374
|
+
* Wraps a legacy Identity (single-key) as a DescriptorProvider.
|
|
375
|
+
* The descriptor is always a simple tr(pubkey) format.
|
|
507
376
|
*/
|
|
508
|
-
declare class
|
|
509
|
-
private
|
|
510
|
-
private
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
* Export the private key as a hex string.
|
|
519
|
-
*
|
|
520
|
-
* @returns The private key as a hex string
|
|
521
|
-
*/
|
|
522
|
-
toHex(): string;
|
|
523
|
-
sign(tx: Transaction, inputIndexes?: number[]): Promise<Transaction>;
|
|
524
|
-
compressedPublicKey(): Promise<Uint8Array>;
|
|
525
|
-
xOnlyPublicKey(): Promise<Uint8Array>;
|
|
526
|
-
signerSession(): SignerSession;
|
|
527
|
-
signMessage(message: Uint8Array, signatureType?: "schnorr" | "ecdsa"): Promise<Uint8Array>;
|
|
528
|
-
/**
|
|
529
|
-
* BIP-340 sign `messageHash` with aux_rand = 0, so the signature — and
|
|
530
|
-
* anything derived from it — is reproducible from the key alone.
|
|
531
|
-
*
|
|
532
|
-
* What lets a static wallet derive a swap preimage instead of storing one
|
|
533
|
-
* (see `wallet/contractSecrets.ts`). Deliberately NOT `signMessage`, whose
|
|
534
|
-
* schnorr branch draws a random aux_rand: a preimage derived from that is
|
|
535
|
-
* unrecoverable, and the loss would only surface at claim time.
|
|
536
|
-
*/
|
|
537
|
-
signSchnorrDeterministic(messageHash: Uint8Array): Promise<Uint8Array>;
|
|
538
|
-
toReadonly(): Promise<ReadonlySingleKey>;
|
|
539
|
-
}
|
|
540
|
-
declare class ReadonlySingleKey implements ReadonlyIdentity {
|
|
541
|
-
private readonly publicKey;
|
|
542
|
-
/** Create a readonly identity from a compressed public key. */
|
|
543
|
-
constructor(publicKey: Uint8Array);
|
|
544
|
-
/**
|
|
545
|
-
* Create a ReadonlySingleKey from a compressed public key.
|
|
546
|
-
*
|
|
547
|
-
* @param publicKey - 33-byte compressed public key (02/03 prefix + 32-byte x coordinate)
|
|
548
|
-
* @returns A new ReadonlySingleKey instance
|
|
549
|
-
* @example
|
|
550
|
-
* ```typescript
|
|
551
|
-
* const pubkey = new Uint8Array(33); // your compressed public key
|
|
552
|
-
* const readonlyKey = ReadonlySingleKey.fromPublicKey(pubkey);
|
|
553
|
-
* ```
|
|
554
|
-
*/
|
|
555
|
-
static fromPublicKey(publicKey: Uint8Array): ReadonlySingleKey;
|
|
556
|
-
xOnlyPublicKey(): Promise<Uint8Array>;
|
|
557
|
-
compressedPublicKey(): Promise<Uint8Array>;
|
|
377
|
+
declare class StaticDescriptorProvider implements DescriptorProvider {
|
|
378
|
+
private readonly identity;
|
|
379
|
+
private readonly descriptor;
|
|
380
|
+
private readonly pubKeyHex;
|
|
381
|
+
constructor(identity: Identity, pubKeyHex: string);
|
|
382
|
+
static create(identity: Identity): Promise<StaticDescriptorProvider>;
|
|
383
|
+
getNextSigningDescriptor(): Promise<string>;
|
|
384
|
+
isOurs(descriptor: string): boolean;
|
|
385
|
+
signWithDescriptor(requests: DescriptorSigningRequest[]): Promise<Transaction[]>;
|
|
386
|
+
signMessageWithDescriptor(descriptor: string, message: Uint8Array, type?: "schnorr" | "ecdsa"): Promise<Uint8Array>;
|
|
558
387
|
}
|
|
559
388
|
|
|
560
389
|
/**
|
|
@@ -611,7 +440,7 @@ declare class InMemoryIntentRepository implements IntentRepository {
|
|
|
611
440
|
private byId;
|
|
612
441
|
clear(): Promise<void>;
|
|
613
442
|
saveIntent(intent: ArkIntent): Promise<void>;
|
|
614
|
-
|
|
443
|
+
getIntentsPage(filter: IntentPageFilter | undefined, page: PageRequest): Promise<PageResult<ArkIntent>>;
|
|
615
444
|
getLockedVtxoOutpoints(): Promise<Outpoint[]>;
|
|
616
445
|
[Symbol.asyncDispose](): Promise<void>;
|
|
617
446
|
}
|
|
@@ -631,11 +460,8 @@ declare class InMemoryVirtualTxRepository implements VirtualTxRepository {
|
|
|
631
460
|
}
|
|
632
461
|
|
|
633
462
|
/**
|
|
634
|
-
* @experimental Virtual-tx persistence is
|
|
635
|
-
*
|
|
636
|
-
* so it must be given a *dedicated* `dbName` distinct from the wallet/contract
|
|
637
|
-
* DB until this persistence is activated in the shared schema — otherwise the
|
|
638
|
-
* shared DB's version-conflict guard rejects the mismatched open.
|
|
463
|
+
* @experimental Virtual-tx persistence is opt-in. Stored in its own database,
|
|
464
|
+
* {@link BATCHES_DB_NAME} by default, never in the wallet/contract one.
|
|
639
465
|
*/
|
|
640
466
|
declare class IndexedDBVirtualTxRepository implements VirtualTxRepository {
|
|
641
467
|
readonly version: 1;
|
|
@@ -653,11 +479,8 @@ declare class IndexedDBVirtualTxRepository implements VirtualTxRepository {
|
|
|
653
479
|
}
|
|
654
480
|
|
|
655
481
|
/**
|
|
656
|
-
* @experimental Intent persistence is
|
|
657
|
-
*
|
|
658
|
-
* be given a *dedicated* `dbName` distinct from the wallet/contract DB until
|
|
659
|
-
* intent persistence is activated in the shared schema — otherwise the shared
|
|
660
|
-
* DB's version-conflict guard rejects the mismatched open.
|
|
482
|
+
* @experimental Intent persistence is opt-in. Stored in its own database,
|
|
483
|
+
* {@link BATCHES_DB_NAME} by default, never in the wallet/contract one.
|
|
661
484
|
*/
|
|
662
485
|
declare class IndexedDBIntentRepository implements IntentRepository {
|
|
663
486
|
readonly version: 1;
|
|
@@ -666,7 +489,7 @@ declare class IndexedDBIntentRepository implements IntentRepository {
|
|
|
666
489
|
private getDB;
|
|
667
490
|
clear(): Promise<void>;
|
|
668
491
|
saveIntent(intent: ArkIntent): Promise<void>;
|
|
669
|
-
|
|
492
|
+
getIntentsPage(filter: IntentPageFilter | undefined, page: PageRequest): Promise<PageResult<ArkIntent>>;
|
|
670
493
|
getLockedVtxoOutpoints(): Promise<Outpoint[]>;
|
|
671
494
|
[Symbol.asyncDispose](): Promise<void>;
|
|
672
495
|
}
|
|
@@ -676,21 +499,21 @@ declare class IndexedDBIntentRepository implements IntentRepository {
|
|
|
676
499
|
* Data is ephemeral and scoped to the instance.
|
|
677
500
|
*/
|
|
678
501
|
declare class InMemoryWalletRepository implements WalletRepository {
|
|
679
|
-
readonly version:
|
|
502
|
+
readonly version: 2;
|
|
680
503
|
private readonly vtxosByAddress;
|
|
681
504
|
private readonly utxosByAddress;
|
|
682
505
|
private readonly txsByAddress;
|
|
683
506
|
private walletState;
|
|
684
|
-
|
|
507
|
+
getVtxosPage(address: string, page: PageRequest<Outpoint>): Promise<PageResult<ExtendedVirtualCoin, Outpoint>>;
|
|
685
508
|
saveVtxos(address: string, vtxos: ExtendedVirtualCoin[]): Promise<void>;
|
|
686
509
|
deleteVtxos(address: string): Promise<void>;
|
|
687
|
-
|
|
510
|
+
getVtxosForScriptPage(script: string, page: PageRequest<ScriptVtxoCursor>, options?: ScriptVtxoPageOptions): Promise<PageResult<StoredVtxo, ScriptVtxoCursor>>;
|
|
688
511
|
saveVtxosForScript(key: VtxoRepositoryKey, vtxos: ExtendedVirtualCoin[]): Promise<void>;
|
|
689
512
|
deleteVtxosForScript(script: string): Promise<void>;
|
|
690
|
-
|
|
691
|
-
saveUtxos(
|
|
513
|
+
getUtxosPage(address: string, page: PageRequest<Outpoint>): Promise<PageResult<ExtendedCoin, Outpoint>>;
|
|
514
|
+
saveUtxos(addressOrBatch: string | ReadonlyMap<string, ExtendedCoin[]>, utxos?: ExtendedCoin[]): Promise<void>;
|
|
692
515
|
deleteUtxos(address: string): Promise<void>;
|
|
693
|
-
|
|
516
|
+
getTransactionHistoryPage(filter: TransactionHistoryPageFilter, page: PageRequest<TransactionHistoryPageCursor>): Promise<PageResult<ArkTransaction, TransactionHistoryPageCursor>>;
|
|
694
517
|
saveTransactions(address: string, txs: ArkTransaction[]): Promise<void>;
|
|
695
518
|
deleteTransactions(address: string): Promise<void>;
|
|
696
519
|
getWalletState(): Promise<WalletState | null>;
|
|
@@ -700,11 +523,8 @@ declare class InMemoryWalletRepository implements WalletRepository {
|
|
|
700
523
|
}
|
|
701
524
|
|
|
702
525
|
/**
|
|
703
|
-
* Whether generic wallet spending may select this contract's VTXOs.
|
|
704
|
-
*
|
|
705
|
-
* Default closed: a type whose handler declares nothing — a custom type, a
|
|
706
|
-
* plugin type, a row whose handler is not registered in this context — is not
|
|
707
|
-
* spendable. Every shipped handler answers explicitly.
|
|
526
|
+
* Whether generic wallet spending may select this contract's VTXOs. Default closed: a type whose
|
|
527
|
+
* handler declares nothing, or has no handler registered here, is not spendable.
|
|
708
528
|
*
|
|
709
529
|
* @see ContractHandler.isGenericallySpendable
|
|
710
530
|
*/
|
|
@@ -720,69 +540,47 @@ type ExcludableVtxo = {
|
|
|
720
540
|
vout: number;
|
|
721
541
|
script?: string;
|
|
722
542
|
};
|
|
543
|
+
/** {@link gatedContracts}' answer, as callers that only read it should take it. */
|
|
544
|
+
type GatedContracts = ReadonlyMap<string, string>;
|
|
723
545
|
/**
|
|
724
|
-
* Why generic spending skips a VTXO, or `undefined` when it does not
|
|
725
|
-
*
|
|
726
|
-
*
|
|
727
|
-
* Generic spending applies three exclusions (the contract gate, pending
|
|
728
|
-
* recovery, intent locks) that key on different things — script, script,
|
|
729
|
-
* outpoint. Stating each as a reason-or-undefined lets all three report through
|
|
730
|
-
* one path, so no exclusion can drop a coin silently while another logs.
|
|
546
|
+
* Why generic spending skips a VTXO, or `undefined` when it does not; phrased to follow the
|
|
547
|
+
* outpoint in a log line. One shape for all exclusions (contract gate, pending recovery, intent
|
|
548
|
+
* locks) so none can drop a coin silently while another logs.
|
|
731
549
|
*/
|
|
732
550
|
type VtxoExclusion = (vtxo: ExcludableVtxo) => string | undefined;
|
|
733
551
|
/**
|
|
734
|
-
* The contract gate as an exclusion,
|
|
735
|
-
*
|
|
736
|
-
*
|
|
737
|
-
* The two want opposite reactions from whoever reads the log. A decline is
|
|
738
|
-
* the gate working as designed — nothing to do. A missing handler means a
|
|
739
|
-
* contract row this build cannot interpret, e.g. a vendoring or version
|
|
740
|
-
* mismatch, which is worth a reader's attention. `contractHandlers` is
|
|
741
|
-
* already available here, so the message can tell them apart instead of
|
|
742
|
-
* collapsing both into one sentence that reads as the same case either way.
|
|
552
|
+
* The contract gate as an exclusion, distinguishing a handler's decline (working as designed)
|
|
553
|
+
* from a missing handler (a row this build can't interpret, e.g. a version mismatch, worth a
|
|
554
|
+
* reader's attention).
|
|
743
555
|
*/
|
|
744
|
-
declare function gateExclusion(gated:
|
|
556
|
+
declare function gateExclusion(gated: GatedContracts): VtxoExclusion;
|
|
745
557
|
/** Outpoints excluded for a shared reason, e.g. an intent-lock set. */
|
|
746
558
|
declare function outpointExclusion(outpoints: ReadonlySet<string>, reason: string): VtxoExclusion;
|
|
747
559
|
/**
|
|
748
|
-
* Outpoints excluded for
|
|
749
|
-
*
|
|
750
|
-
*
|
|
751
|
-
* Unlike {@link gateExclusion}, the reasons are the handlers' own sentences and
|
|
752
|
-
* are not rephrased to follow the outpoint: that text is what tells the reader
|
|
753
|
-
* when to retry, and a paraphrase here would be a second spelling to keep in
|
|
754
|
-
* step with it.
|
|
560
|
+
* Outpoints excluded for per-input reasons (e.g. a per-input timelock). The handlers' own
|
|
561
|
+
* sentences, unparaphrased: they tell the reader when to retry.
|
|
755
562
|
*
|
|
756
563
|
* @see outpointExclusion for the shared-reason form.
|
|
757
564
|
*/
|
|
758
565
|
declare function outpointReasons(reasons: ReadonlyMap<string, string>): VtxoExclusion;
|
|
759
566
|
/**
|
|
760
|
-
* Report VTXOs an exclusion dropped
|
|
761
|
-
*
|
|
762
|
-
* Debug level, one line per VTXO per reason.
|
|
567
|
+
* Report VTXOs an exclusion dropped, the only field-diagnosable signal for a coin missing from a
|
|
568
|
+
* spend. Debug level, one line per VTXO per reason.
|
|
763
569
|
*/
|
|
764
570
|
declare function logExcludedVtxos(source: string, vtxos: readonly ExcludableVtxo[], exclusions: readonly VtxoExclusion[]): void;
|
|
765
571
|
/**
|
|
766
|
-
* Thrown when a spend names VTXOs whose contract can no longer be annotated
|
|
767
|
-
*
|
|
768
|
-
*
|
|
769
|
-
*
|
|
770
|
-
* Raised before submission on purpose. Spending reads the tapscripts stored on
|
|
771
|
-
* each coin rather than re-deriving them, so such a spend would otherwise build
|
|
772
|
-
* and broadcast normally and only fail in the bookkeeping afterwards, leaving
|
|
773
|
-
* the transaction on the network and the local state behind it.
|
|
572
|
+
* Thrown before submission when a spend names VTXOs whose contract can no longer be annotated
|
|
573
|
+
* (handler unregistered, stored params rejected, or no row). Otherwise the spend would broadcast
|
|
574
|
+
* and fail in the bookkeeping, leaving local state behind the network.
|
|
774
575
|
*/
|
|
775
576
|
declare class UnannotatableInputError extends Error {
|
|
776
577
|
readonly name = "UnannotatableInputError";
|
|
777
578
|
}
|
|
778
579
|
|
|
779
580
|
/**
|
|
780
|
-
* Encode a contract to the arkcontract string format
|
|
781
|
-
*
|
|
782
|
-
*
|
|
783
|
-
*
|
|
784
|
-
* This format is compatible with NArk and allows contracts to be
|
|
785
|
-
* shared/imported across different Arkade SDKs.
|
|
581
|
+
* Encode a contract to the arkcontract string format:
|
|
582
|
+
* `arkcontract={type}&{key1}={value1}&...`. NArk-compatible, so contracts can be shared
|
|
583
|
+
* across Arkade SDKs.
|
|
786
584
|
*
|
|
787
585
|
* @example
|
|
788
586
|
* ```typescript
|
|
@@ -798,27 +596,18 @@ declare class UnannotatableInputError extends Error {
|
|
|
798
596
|
*/
|
|
799
597
|
declare function encodeArkContract(contract: Contract): string;
|
|
800
598
|
/**
|
|
801
|
-
*
|
|
802
|
-
*
|
|
803
|
-
* This is a low-level representation. For type-safe contract creation,
|
|
804
|
-
* use `contractFromArkContract` or `contractFromArkContractWithAddress`
|
|
805
|
-
* which validate params through the handler system.
|
|
599
|
+
* Raw (unvalidated) result of decoding an arkcontract string. For typed contracts use
|
|
600
|
+
* `contractFromArkContract` / `contractFromArkContractWithAddress`, which validate via handlers.
|
|
806
601
|
*/
|
|
807
602
|
interface ParsedArkContract {
|
|
808
603
|
/** Contract type (e.g., "vhtlc", "default") */
|
|
809
604
|
type: string;
|
|
810
|
-
/** All key-value pairs from the string */
|
|
605
|
+
/** All other key-value pairs from the string */
|
|
811
606
|
data: Record<string, string>;
|
|
812
607
|
}
|
|
813
608
|
/**
|
|
814
|
-
* Decode an arkcontract string into raw type and data.
|
|
815
|
-
*
|
|
816
|
-
* This is a low-level function that parses the URL-encoded format.
|
|
817
|
-
* For creating typed Contract objects, use `contractFromArkContract`
|
|
818
|
-
* or `contractFromArkContractWithAddress` instead.
|
|
609
|
+
* Decode an arkcontract string into raw type and data (low-level; see {@link ParsedArkContract}).
|
|
819
610
|
*
|
|
820
|
-
* @param encoded - The arkcontract string
|
|
821
|
-
* @returns Parsed type and key-value data
|
|
822
611
|
* @throws If the string is not a valid arkcontract
|
|
823
612
|
*
|
|
824
613
|
* @example
|
|
@@ -829,14 +618,9 @@ interface ParsedArkContract {
|
|
|
829
618
|
*/
|
|
830
619
|
declare function decodeArkContract(encoded: string): ParsedArkContract;
|
|
831
620
|
/**
|
|
832
|
-
* Create a Contract from an arkcontract string.
|
|
621
|
+
* Create a Contract (without script/address) from an arkcontract string.
|
|
833
622
|
*
|
|
834
|
-
*
|
|
835
|
-
*
|
|
836
|
-
* @param encoded - The arkcontract string
|
|
837
|
-
* @param options - Additional options for the contract
|
|
838
|
-
* @returns A Contract object
|
|
839
|
-
* @throws If the string is invalid or no handler exists for the type
|
|
623
|
+
* @throws If the string is invalid or no handler is registered for the type
|
|
840
624
|
*
|
|
841
625
|
* @example
|
|
842
626
|
* ```typescript
|
|
@@ -859,56 +643,26 @@ declare function contractFromArkContract(encoded: string, options?: {
|
|
|
859
643
|
/**
|
|
860
644
|
* Create a full Contract with derived script and address.
|
|
861
645
|
*
|
|
862
|
-
* @param encoded - The arkcontract string
|
|
863
646
|
* @param serverPubKey - Server public key (for address derivation)
|
|
864
647
|
* @param addressPrefix - Address prefix (e.g., "tark" for testnet)
|
|
865
|
-
* @param options - Additional options
|
|
866
|
-
* @returns A complete Contract object
|
|
867
648
|
*/
|
|
868
649
|
declare function contractFromArkContractWithAddress(encoded: string, serverPubKey: Uint8Array, addressPrefix?: string, options?: {
|
|
869
650
|
label?: string;
|
|
870
651
|
state?: "active" | "inactive";
|
|
871
652
|
metadata?: Record<string, unknown>;
|
|
872
653
|
}): Contract;
|
|
873
|
-
/**
|
|
874
|
-
* Check if a string is an arkcontract.
|
|
875
|
-
*/
|
|
654
|
+
/** Check if a string is an arkcontract. */
|
|
876
655
|
declare function isArkContract(str: string): boolean;
|
|
877
656
|
|
|
878
|
-
/**
|
|
879
|
-
* Thrown when a descriptor-capable contract (default, delegate, or boarding)
|
|
880
|
-
* cannot be routed to any signer: its owner key (`params.pubKey`) is not this
|
|
881
|
-
* wallet's baseline signing key, and the record carries no
|
|
882
|
-
* `metadata.signingDescriptor` to send it to a descriptor-aware signer.
|
|
883
|
-
*
|
|
884
|
-
* Note that this can arise also when a contract belongs to a different identity (storage reuse).
|
|
885
|
-
*/
|
|
886
|
-
declare class MissingSigningDescriptorError extends Error {
|
|
887
|
-
readonly contractScript: string;
|
|
888
|
-
readonly contractType: "default" | "delegate" | "boarding";
|
|
889
|
-
readonly name = "MissingSigningDescriptorError";
|
|
890
|
-
constructor(contractScript: string, contractType: "default" | "delegate" | "boarding");
|
|
891
|
-
}
|
|
892
|
-
/**
|
|
893
|
-
* Thrown when an input needs descriptor-aware signing but no
|
|
894
|
-
* DescriptorProvider was wired into the wallet.
|
|
895
|
-
*/
|
|
896
|
-
declare class DescriptorSigningProviderMissingError extends Error {
|
|
897
|
-
readonly name = "DescriptorSigningProviderMissingError";
|
|
898
|
-
constructor();
|
|
899
|
-
}
|
|
900
|
-
|
|
901
657
|
/**
|
|
902
658
|
* In-memory implementation of ContractRepository.
|
|
903
659
|
* Data is ephemeral and scoped to the instance.
|
|
904
660
|
*/
|
|
905
661
|
declare class InMemoryContractRepository implements ContractRepository {
|
|
906
|
-
readonly version:
|
|
907
|
-
private readonly contractData;
|
|
908
|
-
private readonly collections;
|
|
662
|
+
readonly version: 3;
|
|
909
663
|
private readonly contractsByScript;
|
|
910
664
|
clear(): Promise<void>;
|
|
911
|
-
|
|
665
|
+
getContractsPage(filter: ContractFilter | undefined, page: PageRequest): Promise<PageResult<Contract>>;
|
|
912
666
|
saveContract(contract: Contract): Promise<void>;
|
|
913
667
|
deleteContract(script: string): Promise<void>;
|
|
914
668
|
[Symbol.asyncDispose](): Promise<void>;
|
|
@@ -920,145 +674,119 @@ declare class InMemoryContractRepository implements ContractRepository {
|
|
|
920
674
|
* Data is stored as JSON strings in key/value stores.
|
|
921
675
|
*/
|
|
922
676
|
declare class IndexedDBContractRepository implements ContractRepository {
|
|
923
|
-
readonly version:
|
|
677
|
+
readonly version: 3;
|
|
924
678
|
private readonly connection;
|
|
925
679
|
constructor(dbName?: string);
|
|
926
680
|
clear(): Promise<void>;
|
|
927
|
-
|
|
681
|
+
getContractsPage(filter: ContractFilter | undefined, page: PageRequest): Promise<PageResult<Contract>>;
|
|
928
682
|
saveContract(contract: Contract): Promise<void>;
|
|
929
683
|
deleteContract(script: string): Promise<void>;
|
|
684
|
+
/** Up to `limit + 1` rows of `range` that pass `filter`, in key order. */
|
|
685
|
+
private readMatching;
|
|
930
686
|
private applyContractFilter;
|
|
931
687
|
private getDB;
|
|
932
688
|
[Symbol.asyncDispose](): Promise<void>;
|
|
933
689
|
}
|
|
934
690
|
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
declare class IndexedDBWalletRepository implements WalletRepository {
|
|
939
|
-
readonly version: 1;
|
|
940
|
-
private readonly connection;
|
|
941
|
-
constructor(dbName?: string);
|
|
942
|
-
clear(): Promise<void>;
|
|
943
|
-
[Symbol.asyncDispose](): Promise<void>;
|
|
944
|
-
getVtxos(address: string): Promise<ExtendedVirtualCoin[]>;
|
|
945
|
-
saveVtxos(address: string, vtxos: ExtendedVirtualCoin[]): Promise<void>;
|
|
946
|
-
deleteVtxos(address: string): Promise<void>;
|
|
947
|
-
getVtxosForScript(script: string): Promise<ExtendedVirtualCoin[]>;
|
|
948
|
-
saveVtxosForScript(key: VtxoRepositoryKey, vtxos: ExtendedVirtualCoin[]): Promise<void>;
|
|
949
|
-
deleteVtxosForScript(script: string): Promise<void>;
|
|
950
|
-
getUtxos(address: string): Promise<ExtendedCoin[]>;
|
|
951
|
-
saveUtxos(address: string, utxos: ExtendedCoin[]): Promise<void>;
|
|
952
|
-
deleteUtxos(address: string): Promise<void>;
|
|
953
|
-
getTransactionHistory(address: string): Promise<ArkTransaction[]>;
|
|
954
|
-
saveTransactions(address: string, txs: ArkTransaction[]): Promise<void>;
|
|
955
|
-
deleteTransactions(address: string): Promise<void>;
|
|
956
|
-
getWalletState(): Promise<WalletState | null>;
|
|
957
|
-
saveWalletState(state: WalletState): Promise<void>;
|
|
958
|
-
private getDB;
|
|
691
|
+
interface WalletRestoreHook {
|
|
692
|
+
id: string;
|
|
693
|
+
restore(wallet: IWallet): Promise<void>;
|
|
959
694
|
}
|
|
960
|
-
|
|
961
|
-
declare const MIGRATION_KEY: (repoType: "wallet" | "contract") => string;
|
|
962
|
-
type MigrationStatus = "pending" | "in-progress" | "done" | "not-needed";
|
|
963
|
-
declare function getMigrationStatus(repoType: "wallet" | "contract", storageAdapter: StorageAdapter): Promise<MigrationStatus>;
|
|
964
|
-
declare function requiresMigration(repoType: "wallet" | "contract", storageAdapter: StorageAdapter): Promise<boolean>;
|
|
965
|
-
declare function rollbackMigration(repoType: "wallet" | "contract", storageAdapter: StorageAdapter): Promise<void>;
|
|
966
|
-
/**
|
|
967
|
-
* Migrate wallet data from the legacy storage adapter to the new one.
|
|
968
|
-
* It accepts both onchain and offchain addresses, make sure to pass both.
|
|
969
|
-
*
|
|
970
|
-
* @param storageAdapter
|
|
971
|
-
* @param fresh
|
|
972
|
-
* @param addresses
|
|
973
|
-
*/
|
|
974
|
-
declare function migrateWalletRepository(storageAdapter: StorageAdapter, fresh: WalletRepository, addresses: {
|
|
975
|
-
onchain: string[];
|
|
976
|
-
offchain: string[];
|
|
977
|
-
}): Promise<void>;
|
|
695
|
+
declare function registerWalletRestoreHook(wallet: IWallet, hook: WalletRestoreHook): () => void;
|
|
978
696
|
|
|
979
697
|
/**
|
|
980
|
-
*
|
|
698
|
+
* In-memory single key implementation for Bitcoin transaction signing.
|
|
699
|
+
*
|
|
700
|
+
* @example
|
|
701
|
+
* ```typescript
|
|
702
|
+
* // Create from hex string
|
|
703
|
+
* const key = SingleKey.fromHex('your_private_key_hex');
|
|
704
|
+
*
|
|
705
|
+
* // Create from raw bytes
|
|
706
|
+
* const key = SingleKey.fromPrivateKey(privateKeyBytes);
|
|
707
|
+
*
|
|
708
|
+
* // Create random key
|
|
709
|
+
* const randomKey = SingleKey.fromRandomBytes();
|
|
710
|
+
*
|
|
711
|
+
* // Sign a transaction
|
|
712
|
+
* const signedTx = await key.sign(transaction);
|
|
713
|
+
* ```
|
|
981
714
|
*/
|
|
982
|
-
declare class
|
|
983
|
-
|
|
984
|
-
private
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
715
|
+
declare class SingleKey implements Identity {
|
|
716
|
+
private key;
|
|
717
|
+
private constructor();
|
|
718
|
+
/** Create a signing identity from raw private key bytes. */
|
|
719
|
+
static fromPrivateKey(privateKey: Uint8Array): SingleKey;
|
|
720
|
+
/** Create a signing identity from a hex-encoded private key. */
|
|
721
|
+
static fromHex(privateKeyHex: string): SingleKey;
|
|
722
|
+
/** Create a signing identity with a freshly generated random private key. */
|
|
723
|
+
static fromRandomBytes(): SingleKey;
|
|
724
|
+
/**
|
|
725
|
+
* Export the private key as a hex string.
|
|
726
|
+
*
|
|
727
|
+
* @returns The private key as a hex string
|
|
728
|
+
*/
|
|
729
|
+
toHex(): string;
|
|
730
|
+
sign(tx: Transaction, inputIndexes?: number[]): Promise<Transaction>;
|
|
731
|
+
compressedPublicKey(): Promise<Uint8Array>;
|
|
732
|
+
xOnlyPublicKey(): Promise<Uint8Array>;
|
|
733
|
+
signerSession(): SignerSession;
|
|
734
|
+
signMessage(message: Uint8Array, signatureType?: "schnorr" | "ecdsa"): Promise<Uint8Array>;
|
|
735
|
+
/**
|
|
736
|
+
* BIP-340 sign `messageHash` with aux_rand = 0, so the signature — and
|
|
737
|
+
* anything derived from it — is reproducible from the key alone.
|
|
738
|
+
*
|
|
739
|
+
* What lets a static wallet derive a swap preimage instead of storing one
|
|
740
|
+
* (see `wallet/contractSecrets.ts`). Deliberately NOT `signMessage`, whose
|
|
741
|
+
* schnorr branch draws a random aux_rand: a preimage derived from that is
|
|
742
|
+
* unrecoverable, and the loss would only surface at claim time.
|
|
743
|
+
*/
|
|
744
|
+
signSchnorrDeterministic(messageHash: Uint8Array): Promise<Uint8Array>;
|
|
745
|
+
toReadonly(): Promise<ReadonlySingleKey>;
|
|
1002
746
|
}
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
[Symbol.asyncDispose](): Promise<void>;
|
|
747
|
+
declare class ReadonlySingleKey implements ReadonlyIdentity {
|
|
748
|
+
private readonly publicKey;
|
|
749
|
+
/** Create a readonly identity from a compressed public key. */
|
|
750
|
+
constructor(publicKey: Uint8Array);
|
|
751
|
+
/**
|
|
752
|
+
* Create a ReadonlySingleKey from a compressed public key.
|
|
753
|
+
*
|
|
754
|
+
* @param publicKey - 33-byte compressed public key (02/03 prefix + 32-byte x coordinate)
|
|
755
|
+
* @returns A new ReadonlySingleKey instance
|
|
756
|
+
* @example
|
|
757
|
+
* ```typescript
|
|
758
|
+
* const pubkey = new Uint8Array(33); // your compressed public key
|
|
759
|
+
* const readonlyKey = ReadonlySingleKey.fromPublicKey(pubkey);
|
|
760
|
+
* ```
|
|
761
|
+
*/
|
|
762
|
+
static fromPublicKey(publicKey: Uint8Array): ReadonlySingleKey;
|
|
763
|
+
xOnlyPublicKey(): Promise<Uint8Array>;
|
|
764
|
+
compressedPublicKey(): Promise<Uint8Array>;
|
|
1022
765
|
}
|
|
1023
766
|
|
|
1024
767
|
/**
|
|
1025
|
-
* Domain separator for the preimage derivation.
|
|
1026
|
-
*
|
|
1027
|
-
*
|
|
1028
|
-
*
|
|
1029
|
-
* scheme reproduces the same preimage and can recover an artifact another
|
|
1030
|
-
* SDK created. Deliberately distinct from the Boltz tag: a shared tag would
|
|
1031
|
-
* make one wallet key derive one preimage for both corridors.
|
|
768
|
+
* Domain separator for the preimage derivation. Protocol-scoped and versioned, mirroring NArk's
|
|
769
|
+
* `Arkade-Boltz-Preimage-v1` (`SwapsManagementService.cs:128`), so any Arkade SDK reproduces the
|
|
770
|
+
* same preimage and can recover another SDK's artifact. Deliberately distinct from the Boltz tag:
|
|
771
|
+
* a shared tag would make one wallet key derive one preimage for both corridors.
|
|
1032
772
|
*/
|
|
1033
773
|
declare const ARKADE_SWAP_PREIMAGE_TAG = "Arkade-RFQ-Preimage-v1";
|
|
1034
774
|
/**
|
|
1035
|
-
* Domain separator for the **salted**
|
|
1036
|
-
*
|
|
1037
|
-
*
|
|
1038
|
-
*
|
|
1039
|
-
* asymmetry is deliberate. The v1 tags must be per-corridor
|
|
1040
|
-
* (`Arkade-RFQ-Preimage-v1` here, NArk's `Arkade-Boltz-Preimage-v1` there)
|
|
1041
|
-
* because v1 pins its message index, so the tag is the only thing separating
|
|
1042
|
-
* two corridors that reach the same key. v2 mints a salt per artifact, so no
|
|
1043
|
-
* two artifacts share a message within a corridor, let alone across two — the
|
|
1044
|
-
* salt carries the separation, and the tag names the layer it belongs to.
|
|
775
|
+
* Domain separator for the **salted** derivation, used when the descriptor repeats across
|
|
776
|
+
* artifacts. Corridor-generic, unlike {@link ARKADE_SWAP_PREIMAGE_TAG}, deliberately: v1 pins its
|
|
777
|
+
* message index, so its tag is all that separates two corridors reaching the same key; here the
|
|
778
|
+
* per-artifact salt carries that separation.
|
|
1045
779
|
*/
|
|
1046
780
|
declare const ARKADE_SALTED_PREIMAGE_TAG = "Arkade-Contract-Preimage-Salted-v1";
|
|
1047
781
|
/**
|
|
1048
|
-
* `TAG ‖ xonly(32) ‖ u32le(index)` — the message that gets BIP-340 signed.
|
|
1049
|
-
*
|
|
1050
|
-
*
|
|
1051
|
-
* restore reconstructs a bare descriptor that serialises differently from the
|
|
1052
|
-
* signing descriptor used at creation, and only the key agrees across both.
|
|
782
|
+
* `TAG ‖ xonly(32) ‖ u32le(index)` — the message that gets BIP-340 signed. Anchored on the x-only
|
|
783
|
+
* key, not the descriptor string: a restore rebuilds a descriptor that serialises differently from
|
|
784
|
+
* the one used at creation, and only the key agrees across both.
|
|
1053
785
|
*/
|
|
1054
786
|
declare function buildPreimageMessage(xonly: Uint8Array, index: number): Uint8Array;
|
|
1055
787
|
/**
|
|
1056
|
-
* `TAG ‖ xonly(32) ‖ salt(32)` — the salted message that gets BIP-340 signed.
|
|
1057
|
-
*
|
|
1058
|
-
* The salt replaces v1's pinned index as the source of per-artifact
|
|
1059
|
-
* uniqueness, which is what lets a key that repeats across artifacts still
|
|
1060
|
-
* derive a distinct preimage for each. It is public: knowing it yields nothing
|
|
1061
|
-
* without the seed.
|
|
788
|
+
* `TAG ‖ xonly(32) ‖ salt(32)` — the salted message that gets BIP-340 signed. The salt replaces
|
|
789
|
+
* v1's pinned index as the per-artifact uniqueness source; it is public, useless without the seed.
|
|
1062
790
|
*/
|
|
1063
791
|
declare function buildSaltedPreimageMessage(xonly: Uint8Array, salt: Uint8Array): Uint8Array;
|
|
1064
792
|
/**
|
|
@@ -1077,18 +805,14 @@ interface ProvisionedKey {
|
|
|
1077
805
|
*/
|
|
1078
806
|
descriptor: string;
|
|
1079
807
|
/**
|
|
1080
|
-
* The
|
|
1081
|
-
*
|
|
1082
|
-
* callers building the lockup script do not need a separate
|
|
1083
|
-
* {@link IWallet.getAddress} round-trip or an `ArkAddress.decode` call.
|
|
808
|
+
* The pkScript of the wallet's current receive address, so callers building the lockup need
|
|
809
|
+
* no separate {@link IWallet.getAddress} or `ArkAddress.decode`.
|
|
1084
810
|
*/
|
|
1085
811
|
pkScript: Uint8Array;
|
|
1086
812
|
/**
|
|
1087
|
-
* The receive address {@link pkScript} was decoded from,
|
|
1088
|
-
*
|
|
1089
|
-
*
|
|
1090
|
-
* script, and two independent reads of a wallet that rotates its receive
|
|
1091
|
-
* address would not guarantee that — reuse this, never a second
|
|
813
|
+
* The receive address {@link pkScript} was decoded from, in the same {@link IWallet.getAddress}
|
|
814
|
+
* read. The quote-time refund address and the covenant's `refundPkScript` must name the same
|
|
815
|
+
* script, and two reads of a rotating wallet need not agree — reuse this, never a second
|
|
1092
816
|
* `getAddress()` call.
|
|
1093
817
|
*/
|
|
1094
818
|
address: string;
|
|
@@ -1103,93 +827,61 @@ interface ProvisionedClaimSecret extends Omit<ProvisionedKey, "pkScript" | "addr
|
|
|
1103
827
|
/** `sha256(preimage)` — what the contract commits to. */
|
|
1104
828
|
paymentHash: Uint8Array;
|
|
1105
829
|
/**
|
|
1106
|
-
* The salt {@link preimage} was derived from,
|
|
1107
|
-
*
|
|
1108
|
-
*
|
|
1109
|
-
* still cannot re-derive P.
|
|
1110
|
-
*
|
|
1111
|
-
* Absent on the other two arms: an HD child descriptor already names one
|
|
1112
|
-
* artifact, and a stored preimage needs no derivation input.
|
|
830
|
+
* The salt {@link preimage} was derived from, on the salted arm. **Public**, unlike
|
|
831
|
+
* {@link preimage}: persist it in the clear with the artifact — without it even the seed
|
|
832
|
+
* cannot re-derive P. Absent on the other arms.
|
|
1113
833
|
*/
|
|
1114
834
|
preimageSalt?: Uint8Array;
|
|
1115
835
|
/**
|
|
1116
|
-
* Persist `preimage` with the artifact: this wallet cannot re-derive it
|
|
1117
|
-
*
|
|
1118
|
-
*
|
|
1119
|
-
* given {@link preimageSalt}, where there is one — and nothing secret
|
|
1120
|
-
* needs to be stored.
|
|
836
|
+
* Persist `preimage` with the artifact: this wallet cannot re-derive it (caller-supplied P,
|
|
837
|
+
* or a signer that cannot sign deterministically). When false, P re-derives from the seed
|
|
838
|
+
* (given {@link preimageSalt}, if any) and nothing secret needs storing.
|
|
1121
839
|
*/
|
|
1122
840
|
mustPersistPreimage: boolean;
|
|
1123
841
|
}
|
|
1124
842
|
/**
|
|
1125
|
-
* The key that spends a leg we fund —
|
|
1126
|
-
* of a covenant's cancel path.
|
|
843
|
+
* The key that spends a leg we fund — an HTLC's refund key, a covenant's cancel-path user key.
|
|
1127
844
|
*
|
|
1128
|
-
*
|
|
1129
|
-
*
|
|
1130
|
-
*
|
|
1131
|
-
*
|
|
1132
|
-
* allocated by a worker rebound to another identity, a record restored onto
|
|
1133
|
-
* the wrong seed — and the covenant would bind it, the leg would fund, and
|
|
1134
|
-
* the failure would surface at refund time with the money already committed.
|
|
1135
|
-
* Throws {@link ForeignDescriptorError} instead, before there is a quote.
|
|
845
|
+
* `pubkey` comes from a signer the wallet produced, never the descriptor string alone: parsing
|
|
846
|
+
* succeeds just as well for a key this wallet cannot sign for (a worker rebound to another
|
|
847
|
+
* identity, a record restored onto the wrong seed), and the failure would surface at refund time
|
|
848
|
+
* with the money committed. Throws {@link ForeignDescriptorError} instead, before any quote.
|
|
1136
849
|
*
|
|
1137
|
-
*
|
|
1138
|
-
*
|
|
1139
|
-
* refund path is on the same key as the refund address the caller sends to
|
|
1140
|
-
* at quote time.
|
|
850
|
+
* Reuses the identity key rather than a fresh HD child, so no index is consumed for an artifact
|
|
851
|
+
* never built, and the refund path is on the same key as the quote-time refund address.
|
|
1141
852
|
*/
|
|
1142
853
|
declare function provisionRefundKey(wallet: IWallet): Promise<ProvisionedKey>;
|
|
1143
854
|
/**
|
|
1144
|
-
* The key that spends a leg we claim, plus the preimage that unlocks it.
|
|
1145
|
-
*
|
|
1146
|
-
* Pass `opts.preimage` to bring your own 32-byte P; it comes back verbatim
|
|
1147
|
-
* with `mustPersistPreimage` set, since the wallet cannot re-derive what it
|
|
1148
|
-
* did not choose.
|
|
1149
|
-
*
|
|
1150
|
-
* Three arms, and which one a wallet lands in is the whole of this function:
|
|
855
|
+
* The key that spends a leg we claim, plus the preimage that unlocks it. Three arms:
|
|
1151
856
|
*
|
|
1152
|
-
* 1. **Caller-supplied
|
|
1153
|
-
*
|
|
1154
|
-
*
|
|
1155
|
-
* the signer cannot sign deterministically —
|
|
1156
|
-
*
|
|
1157
|
-
* 3. **Anything else**
|
|
1158
|
-
*
|
|
1159
|
-
*
|
|
1160
|
-
* this arm falls back to a stored random preimage, and only when the signer
|
|
1161
|
-
* refuses — which is discovered by deriving, never by probing.
|
|
857
|
+
* 1. **Caller-supplied `opts.preimage`** (32 bytes). Returned verbatim with
|
|
858
|
+
* `mustPersistPreimage: true`, since the wallet cannot re-derive what it did not choose.
|
|
859
|
+
* 2. **Per-artifact descriptor** (an HD child). Derives from the key alone at the pinned index;
|
|
860
|
+
* nothing at rest. Raises if the signer cannot sign deterministically — that is a broken HD
|
|
861
|
+
* wallet, not a fallback case.
|
|
862
|
+
* 3. **Anything else** (a static `tr(pubkey)`, a custom provider's constant descriptor). Mints a
|
|
863
|
+
* public per-artifact salt and derives from it. Only this arm falls back to a stored random
|
|
864
|
+
* preimage, and only when the signer refuses — discovered by deriving, never by probing.
|
|
1162
865
|
*/
|
|
1163
866
|
declare function provisionClaimSecret(wallet: IWallet, opts?: {
|
|
1164
867
|
preimage?: Uint8Array;
|
|
1165
868
|
}): Promise<ProvisionedClaimSecret>;
|
|
1166
869
|
/**
|
|
1167
|
-
* The signer for a provisioned descriptor, verified
|
|
1168
|
-
* descriptor's key
|
|
870
|
+
* The signer for a provisioned descriptor, verified by public-key equality (never a wallet-type
|
|
871
|
+
* probe) to be that descriptor's key: a wallet answering with another seed's key would sign
|
|
872
|
+
* happily and fail only as a counterparty rejection or a dead script.
|
|
1169
873
|
*
|
|
1170
|
-
*
|
|
1171
|
-
*
|
|
1172
|
-
*
|
|
1173
|
-
*
|
|
1174
|
-
*
|
|
1175
|
-
* Know its limit. It catches a wallet that substitutes its *baseline*
|
|
1176
|
-
* identity, which is the failure this exists for. It cannot catch one that
|
|
1177
|
-
* returns a descriptor-scoped identity built over the same descriptor, since
|
|
1178
|
-
* such an identity reads its pubkey back out of the descriptor string and the
|
|
1179
|
-
* comparison becomes a tautology. What rules that case out is
|
|
1180
|
-
* {@link resolveDescriptorSigner}'s `isOurs` test, which both shipped wallets
|
|
1181
|
-
* resolve through — so this is the backstop for a hand-rolled `IWallet`, not
|
|
1182
|
-
* the primary guarantee.
|
|
874
|
+
* Limit: this catches a wallet substituting its *baseline* identity. A descriptor-scoped identity
|
|
875
|
+
* over the same descriptor reads its pubkey back from the string, making the check a tautology;
|
|
876
|
+
* {@link resolveDescriptorSigner}'s `isOurs` test (used by both shipped wallets) rules that out,
|
|
877
|
+
* so this is the backstop for a hand-rolled `IWallet`, not the primary guarantee.
|
|
1183
878
|
*/
|
|
1184
879
|
declare function contractSigner(wallet: IWallet, descriptor: string): Promise<Identity>;
|
|
1185
880
|
/**
|
|
1186
|
-
* A wallet that holds a contract's key but cannot sign with it
|
|
1187
|
-
*
|
|
1188
|
-
*
|
|
1189
|
-
*
|
|
1190
|
-
* that one says "wrong wallet", this one says "this wallet, without its
|
|
1191
|
-
* signer". Raised at provisioning as well as at signing, so a wallet that
|
|
1192
|
-
* could never spend the leg finds out before it funds one.
|
|
881
|
+
* A wallet that holds a contract's key but cannot sign with it (watch-only, or a remote signer
|
|
882
|
+
* without its transport). Distinct from {@link ForeignDescriptorError} ("wrong wallet") because
|
|
883
|
+
* the remedy differs. Raised at provisioning too, so a wallet that could never spend a leg finds
|
|
884
|
+
* out before funding it.
|
|
1193
885
|
*/
|
|
1194
886
|
declare class WalletCannotSignError extends Error {
|
|
1195
887
|
readonly descriptor: string;
|
|
@@ -1197,18 +889,12 @@ declare class WalletCannotSignError extends Error {
|
|
|
1197
889
|
constructor(descriptor: string);
|
|
1198
890
|
}
|
|
1199
891
|
/**
|
|
1200
|
-
* The preimage for a provisioned descriptor
|
|
1201
|
-
* kept one, otherwise re-derived from the seed.
|
|
1202
|
-
*
|
|
1203
|
-
* Resolves in one precedence order, mirroring the arms
|
|
1204
|
-
* {@link provisionClaimSecret} chose between:
|
|
892
|
+
* The preimage for a provisioned descriptor, in the precedence {@link provisionClaimSecret} chose:
|
|
1205
893
|
*
|
|
1206
|
-
* 1. `opts.stored` — a caller-supplied P, or one
|
|
1207
|
-
* derive. Whatever the wallet can do now, a stored P is the artifact's.
|
|
894
|
+
* 1. `opts.stored` — a caller-supplied P, or one a wallet could not derive; always the artifact's.
|
|
1208
895
|
* 2. a per-artifact descriptor — derive at the pinned index.
|
|
1209
896
|
* 3. `opts.salt` — derive from the salted message.
|
|
1210
|
-
* 4. otherwise throw: a repeating descriptor with neither
|
|
1211
|
-
* nor a salt has nothing to derive from that would not collide.
|
|
897
|
+
* 4. otherwise throw: a repeating descriptor with neither has nothing collision-free to derive.
|
|
1212
898
|
*/
|
|
1213
899
|
declare function contractPreimage(wallet: IWallet, descriptor: string, opts?: {
|
|
1214
900
|
stored?: Uint8Array;
|
|
@@ -1219,33 +905,47 @@ declare function contractPreimage(wallet: IWallet, descriptor: string, opts?: {
|
|
|
1219
905
|
* rather than degrading to a random-aux signer. */
|
|
1220
906
|
interface DeterministicSigner extends ReadonlyIdentity {
|
|
1221
907
|
/**
|
|
1222
|
-
* Implementors wrapping a remote: throw only for a refusal that will
|
|
1223
|
-
*
|
|
1224
|
-
*
|
|
1225
|
-
* back to a stored random preimage for the artifact's whole life. That is
|
|
1226
|
-
* claimable, but it persists a secret the seed would otherwise have
|
|
1227
|
-
* replaced, and nothing surfaces the downgrade to the caller.
|
|
908
|
+
* Implementors wrapping a remote: throw only for a refusal that will repeat.
|
|
909
|
+
* {@link provisionClaimSecret} reads any throw (even a network hiccup) as "cannot derive" and
|
|
910
|
+
* silently falls back to a stored random preimage for the artifact's whole life.
|
|
1228
911
|
*/
|
|
1229
912
|
signSchnorrDeterministic(messageHash: Uint8Array): Promise<Uint8Array>;
|
|
1230
913
|
}
|
|
1231
914
|
declare function isDeterministicSigner(value: unknown): value is DeterministicSigner;
|
|
1232
915
|
/**
|
|
1233
|
-
* Claim a restored artifact's index so a later allocation cannot reissue it
|
|
1234
|
-
*
|
|
1235
|
-
* one.
|
|
916
|
+
* Claim a restored artifact's index so a later allocation cannot reissue it (which would derive
|
|
917
|
+
* that artifact's preimage again, for a different one).
|
|
1236
918
|
*
|
|
1237
|
-
* Monotonic, and a no-op wherever there is no index to reserve
|
|
1238
|
-
*
|
|
1239
|
-
*
|
|
1240
|
-
*
|
|
1241
|
-
* Telling "another seed's" apart from a failure needs
|
|
1242
|
-
* {@link HDWalletCapable.signerForDescriptor}, so an allocation-capable wallet
|
|
1243
|
-
* that does not also implement it gets only the watermark call's own untyped
|
|
1244
|
-
* refusal, and a foreign artifact reaches the caller as an error rather than a
|
|
1245
|
-
* skip. Every wallet shipped here implements both.
|
|
919
|
+
* Monotonic, and a no-op wherever there is no index to reserve (a shared-key descriptor, another
|
|
920
|
+
* seed's artifact), since restores iterate whole histories. Recognising "another seed's" needs
|
|
921
|
+
* {@link HDWalletCapable.signerForDescriptor}; without it a foreign artifact surfaces as the
|
|
922
|
+
* watermark call's untyped error. Every shipped wallet implements both.
|
|
1246
923
|
*/
|
|
1247
924
|
declare function adoptContractDescriptor(wallet: IWallet, descriptor: string): Promise<void>;
|
|
1248
925
|
|
|
926
|
+
/**
|
|
927
|
+
* Thrown when a descriptor-capable contract (default, delegate, or boarding)
|
|
928
|
+
* cannot be routed to any signer: its owner key (`params.pubKey`) is not this
|
|
929
|
+
* wallet's baseline signing key, and the record carries no
|
|
930
|
+
* `metadata.signingDescriptor` to send it to a descriptor-aware signer.
|
|
931
|
+
*
|
|
932
|
+
* Note that this can arise also when a contract belongs to a different identity (storage reuse).
|
|
933
|
+
*/
|
|
934
|
+
declare class MissingSigningDescriptorError extends Error {
|
|
935
|
+
readonly contractScript: string;
|
|
936
|
+
readonly contractType: "default" | "delegate" | "boarding";
|
|
937
|
+
readonly name = "MissingSigningDescriptorError";
|
|
938
|
+
constructor(contractScript: string, contractType: "default" | "delegate" | "boarding");
|
|
939
|
+
}
|
|
940
|
+
/**
|
|
941
|
+
* Thrown when an input needs descriptor-aware signing but no
|
|
942
|
+
* DescriptorProvider was wired into the wallet.
|
|
943
|
+
*/
|
|
944
|
+
declare class DescriptorSigningProviderMissingError extends Error {
|
|
945
|
+
readonly name = "DescriptorSigningProviderMissingError";
|
|
946
|
+
constructor();
|
|
947
|
+
}
|
|
948
|
+
|
|
1249
949
|
type RequestEnvelope = {
|
|
1250
950
|
tag: string;
|
|
1251
951
|
id: string;
|
|
@@ -1267,6 +967,11 @@ type ResponseEnvelope = {
|
|
|
1267
967
|
errorName?: string;
|
|
1268
968
|
broadcast?: boolean;
|
|
1269
969
|
};
|
|
970
|
+
type MessageBusServices = {
|
|
971
|
+
arkProvider: ArkProvider;
|
|
972
|
+
wallet?: Wallet;
|
|
973
|
+
readonlyWallet: ReadonlyWallet;
|
|
974
|
+
};
|
|
1270
975
|
interface MessageHandler<REQ extends RequestEnvelope = RequestEnvelope, RES extends ResponseEnvelope = ResponseEnvelope> {
|
|
1271
976
|
/**
|
|
1272
977
|
* A unique identifier for the updater.
|
|
@@ -1283,11 +988,7 @@ interface MessageHandler<REQ extends RequestEnvelope = RequestEnvelope, RES exte
|
|
|
1283
988
|
* bus re-init or `stop()` it goes inert on its own, so retaining one past
|
|
1284
989
|
* `stop()` cannot post.
|
|
1285
990
|
**/
|
|
1286
|
-
start(services: {
|
|
1287
|
-
arkProvider: ArkProvider;
|
|
1288
|
-
wallet?: Wallet;
|
|
1289
|
-
readonlyWallet: ReadonlyWallet;
|
|
1290
|
-
}, repositories: {
|
|
991
|
+
start(services: MessageBusServices, repositories: {
|
|
1291
992
|
walletRepository: WalletRepository;
|
|
1292
993
|
}, channel?: {
|
|
1293
994
|
broadcast(response: RES): void;
|
|
@@ -1333,41 +1034,40 @@ type Options = {
|
|
|
1333
1034
|
* `storage.intentRepository`. Same opt-in as a main-thread wallet: without
|
|
1334
1035
|
* it the worker persists no settlement intent, reconciles none on restart,
|
|
1335
1036
|
* and counts intent-locked VTXOs as available. Pass the same repository the
|
|
1336
|
-
* main thread uses so both sides read one intent state
|
|
1037
|
+
* main thread uses so both sides read one intent state, but settle from one
|
|
1038
|
+
* side only: reconciliation deletes from the server any pending intent the
|
|
1039
|
+
* worker's wallet is not settling itself.
|
|
1337
1040
|
*
|
|
1338
1041
|
* Ignored when `buildServices` is supplied — that override owns `storage`.
|
|
1339
1042
|
*/
|
|
1340
1043
|
intentRepository?: IntentRepository;
|
|
1044
|
+
/** The worker wallet's onchain provider, per network: an instance cannot cross `postMessage`.
|
|
1045
|
+
* Called on every init and never closed, so return one instance per network. Defaults to
|
|
1046
|
+
* Esplora; ignored when `buildServices` is supplied. */
|
|
1047
|
+
onchainProvider?: (network: NetworkName) => OnchainProvider;
|
|
1341
1048
|
debug?: boolean;
|
|
1342
|
-
buildServices?: (config: Initialize["config"]) => Promise<
|
|
1343
|
-
arkProvider: ArkProvider;
|
|
1344
|
-
wallet?: Wallet;
|
|
1345
|
-
readonlyWallet: ReadonlyWallet;
|
|
1346
|
-
}>;
|
|
1049
|
+
buildServices?: (config: Initialize["config"]) => Promise<MessageBusServices>;
|
|
1347
1050
|
};
|
|
1348
1051
|
type Initialize = {
|
|
1349
1052
|
type: "INITIALIZE_MESSAGE_BUS";
|
|
1350
1053
|
id: string;
|
|
1351
1054
|
config: {
|
|
1352
|
-
wallet: SerializedIdentity
|
|
1055
|
+
wallet: SerializedIdentity;
|
|
1353
1056
|
arkServer: {
|
|
1354
1057
|
url: string;
|
|
1355
1058
|
publicKey?: string;
|
|
1356
1059
|
};
|
|
1357
1060
|
delegateUrl?: string;
|
|
1358
|
-
/** @deprecated alias for @see Initialize.config.delegateUrl */
|
|
1359
|
-
delegatorUrl?: string;
|
|
1360
|
-
indexerUrl?: string;
|
|
1361
|
-
esploraUrl?: string;
|
|
1362
1061
|
settlementConfig?: SettlementConfig | false;
|
|
1062
|
+
/** @see WalletConfig.concurrentSpending */
|
|
1063
|
+
concurrentSpending?: boolean;
|
|
1363
1064
|
walletMode?: "auto" | "static" | "hd";
|
|
1065
|
+
lazyInitialization?: boolean;
|
|
1364
1066
|
watcherConfig?: Partial<Omit<ContractWatcherConfig, "indexerProvider">>;
|
|
1365
1067
|
/** @see WalletConfig.lookAheadWindow */
|
|
1366
1068
|
lookAheadWindow?: number;
|
|
1367
1069
|
/** @see WalletConfig.minBatchExpirySeconds */
|
|
1368
1070
|
minBatchExpirySeconds?: bigint;
|
|
1369
|
-
/** @see WalletConfig.minCheckpointExitDelaySeconds */
|
|
1370
|
-
minCheckpointExitDelaySeconds?: bigint;
|
|
1371
1071
|
/**
|
|
1372
1072
|
* Page-supplied per-operation timeout map. Keys are message types
|
|
1373
1073
|
* (e.g. "SETTLE"). Overrides constructor-supplied
|
|
@@ -1403,13 +1103,14 @@ declare class MessageBus {
|
|
|
1403
1103
|
private readonly buildServicesFn;
|
|
1404
1104
|
private readonly boundOnMessage;
|
|
1405
1105
|
private readonly intentRepository?;
|
|
1106
|
+
private readonly onchainProvider?;
|
|
1406
1107
|
/** Pending broadcasts, drained FIFO by a single {@link drain} loop. */
|
|
1407
1108
|
private broadcastQueue;
|
|
1408
1109
|
private draining;
|
|
1409
1110
|
/** Bumped wherever the generation owning the queued broadcasts ends. */
|
|
1410
1111
|
private broadcastEpoch;
|
|
1411
1112
|
/** Create the service-worker message bus with repositories and handler configuration. */
|
|
1412
|
-
constructor(walletRepository: WalletRepository, contractRepository: ContractRepository, { messageHandlers, tickIntervalMs, messageTimeoutMs, messageTimeoutOverrides, intentRepository, debug, buildServices, }: Options);
|
|
1113
|
+
constructor(walletRepository: WalletRepository, contractRepository: ContractRepository, { messageHandlers, tickIntervalMs, messageTimeoutMs, messageTimeoutOverrides, intentRepository, onchainProvider, debug, buildServices, }: Options);
|
|
1413
1114
|
/** Start the message bus and attach service-worker event listeners. */
|
|
1414
1115
|
start(): Promise<void>;
|
|
1415
1116
|
/** Stop the message bus, cancel ticks, and stop all registered handlers. */
|
|
@@ -1503,52 +1204,23 @@ declare class MessageBus {
|
|
|
1503
1204
|
*/
|
|
1504
1205
|
static setup(path: string): Promise<ServiceWorker>;
|
|
1505
1206
|
}
|
|
1506
|
-
|
|
1507
|
-
/**
|
|
1508
|
-
* A leaf node in the Taproot script tree, as consumed by
|
|
1509
|
-
* `@scure/btc-signer`'s `p2tr(internalKey, tree, ...)`.
|
|
1510
|
-
*/
|
|
1207
|
+
|
|
1208
|
+
/** A leaf node in the Taproot script tree, as consumed by `@scure/btc-signer`'s `p2tr`. */
|
|
1511
1209
|
interface TaprootLeaf {
|
|
1512
1210
|
script: Bytes;
|
|
1513
1211
|
leafVersion: number;
|
|
1514
1212
|
}
|
|
1515
|
-
/**
|
|
1516
|
-
* Internal tree node shape consumed by `@scure/btc-signer`'s `p2tr`:
|
|
1517
|
-
* - A leaf is `{ script, leafVersion }`
|
|
1518
|
-
* - A branch is a 2-element tuple `[leftNode, rightNode]` of nodes
|
|
1519
|
-
*/
|
|
1213
|
+
/** A `p2tr` tree node: a leaf, or a `[left, right]` branch tuple. */
|
|
1520
1214
|
type TaprootTreeNode = TaprootLeaf | [TaprootTreeNode, TaprootTreeNode];
|
|
1521
1215
|
/**
|
|
1522
|
-
* Assemble a Taproot script tree
|
|
1523
|
-
*
|
|
1524
|
-
* (`txscript.AssembleTaprootScriptTree`, see
|
|
1525
|
-
* https://github.com/btcsuite/btcd/blob/master/txscript/taproot.go).
|
|
1526
|
-
*
|
|
1527
|
-
* The algorithm:
|
|
1216
|
+
* Assemble a Taproot script tree with btcd's `txscript.AssembleTaprootScriptTree` algorithm
|
|
1217
|
+
* (the one arkd uses).
|
|
1528
1218
|
*
|
|
1529
|
-
*
|
|
1530
|
-
*
|
|
1531
|
-
*
|
|
1532
|
-
* merge with the LAST branch built so far (do NOT pair as a fresh leaf)
|
|
1533
|
-
* else:
|
|
1534
|
-
* create a new branch from (leaves[i], leaves[i+1])
|
|
1219
|
+
* `@scure/btc-signer`'s `taprootListToTree` builds a Huffman tree instead; the two agree only for
|
|
1220
|
+
* power-of-2 leaf counts. Any other count yields a different merkle root → different output key
|
|
1221
|
+
* → arkd rejects spends with `INVALID_PSBT_INPUT`.
|
|
1535
1222
|
*
|
|
1536
|
-
*
|
|
1537
|
-
* while branches has ≥ 2 items:
|
|
1538
|
-
* take front two, combine into a new branch, push to back of queue
|
|
1539
|
-
*
|
|
1540
|
-
* This matters because `@scure/btc-signer`'s `taprootListToTree` builds a
|
|
1541
|
-
* Huffman tree (weight-1 leaves combine by smallest-weight pairs). For
|
|
1542
|
-
* power-of-2 leaf counts both algorithms happen to produce the same
|
|
1543
|
-
* perfectly-balanced binary tree and agree. For any other count they
|
|
1544
|
-
* produce DIFFERENT shapes → different merkle roots → different taproot
|
|
1545
|
-
* output keys → arkd rejects spends with `INVALID_PSBT_INPUT`.
|
|
1546
|
-
*
|
|
1547
|
-
* Reproducing btcd's algorithm here lets the SDK construct taptrees that
|
|
1548
|
-
* arkd accepts for arbitrary leaf counts.
|
|
1549
|
-
*
|
|
1550
|
-
* @param scripts - Raw tapscript bytes for each leaf, in the order they
|
|
1551
|
-
* should be encoded in the TapTree PSBT field.
|
|
1223
|
+
* @param scripts - Raw tapscript bytes per leaf, in TapTree PSBT field order.
|
|
1552
1224
|
* @returns The nested-tuple form `p2tr` accepts.
|
|
1553
1225
|
*/
|
|
1554
1226
|
declare function assembleBtcdTaprootTree(scripts: Bytes[]): TaprootTreeNode;
|
|
@@ -1609,11 +1281,10 @@ declare class AssetId {
|
|
|
1609
1281
|
readonly groupIndex: number;
|
|
1610
1282
|
private constructor();
|
|
1611
1283
|
/**
|
|
1612
|
-
* Create
|
|
1284
|
+
* Create a validated asset id from a genesis transaction id and group index.
|
|
1613
1285
|
*
|
|
1614
1286
|
* @param txid - Hex-encoded genesis transaction id
|
|
1615
1287
|
* @param groupIndex - Asset group index within the genesis transaction
|
|
1616
|
-
* @returns A validated asset id
|
|
1617
1288
|
* @throws Error if the txid is missing, malformed, or not 32 bytes long
|
|
1618
1289
|
* @see fromString
|
|
1619
1290
|
*/
|
|
@@ -1621,8 +1292,6 @@ declare class AssetId {
|
|
|
1621
1292
|
/**
|
|
1622
1293
|
* Decode an asset id from its hex string representation.
|
|
1623
1294
|
*
|
|
1624
|
-
* @param s - Hex-encoded asset id
|
|
1625
|
-
* @returns Decoded asset id
|
|
1626
1295
|
* @throws Error if the string is not valid hex or does not encode a valid asset id
|
|
1627
1296
|
* @see toString
|
|
1628
1297
|
*/
|
|
@@ -1630,22 +1299,18 @@ declare class AssetId {
|
|
|
1630
1299
|
/**
|
|
1631
1300
|
* Decode an asset id from its serialized bytes.
|
|
1632
1301
|
*
|
|
1633
|
-
* @param buf - Serialized asset id bytes
|
|
1634
|
-
* @returns Decoded asset id
|
|
1635
1302
|
* @throws Error if the buffer length is invalid
|
|
1636
1303
|
*/
|
|
1637
1304
|
static fromBytes(buf: Uint8Array): AssetId;
|
|
1638
1305
|
/**
|
|
1639
1306
|
* Serialize the asset id to raw bytes.
|
|
1640
1307
|
*
|
|
1641
|
-
* @returns Serialized asset id bytes
|
|
1642
1308
|
* @see fromBytes
|
|
1643
1309
|
*/
|
|
1644
1310
|
serialize(): Uint8Array;
|
|
1645
1311
|
/**
|
|
1646
1312
|
* Encode the asset id to a hex string.
|
|
1647
1313
|
*
|
|
1648
|
-
* @returns Hex-encoded asset id
|
|
1649
1314
|
* @see fromString
|
|
1650
1315
|
*/
|
|
1651
1316
|
toString(): string;
|
|
@@ -1656,17 +1321,14 @@ declare class AssetId {
|
|
|
1656
1321
|
*/
|
|
1657
1322
|
validate(): void;
|
|
1658
1323
|
/**
|
|
1659
|
-
* Decode an asset id from a binary reader.
|
|
1324
|
+
* Decode an asset id from a binary reader positioned at one.
|
|
1660
1325
|
*
|
|
1661
|
-
* @param reader - Reader positioned at an asset id
|
|
1662
|
-
* @returns Decoded asset id
|
|
1663
1326
|
* @throws Error if the reader does not contain enough bytes
|
|
1664
1327
|
*/
|
|
1665
1328
|
static fromReader(reader: BufferReader): AssetId;
|
|
1666
1329
|
/**
|
|
1667
1330
|
* Serialize the asset id into an existing binary writer.
|
|
1668
1331
|
*
|
|
1669
|
-
* @param writer - Writer to append the asset id to
|
|
1670
1332
|
* @see serialize
|
|
1671
1333
|
*/
|
|
1672
1334
|
serializeTo(writer: BufferWriter): void;
|
|
@@ -1696,27 +1358,18 @@ declare class AssetRef {
|
|
|
1696
1358
|
private constructor();
|
|
1697
1359
|
/** Reference type discriminator. */
|
|
1698
1360
|
get type(): AssetRefType;
|
|
1699
|
-
/**
|
|
1700
|
-
* Create an asset reference that points to a specific asset id.
|
|
1701
|
-
*
|
|
1702
|
-
* @param assetId - Asset id referenced by this pointer
|
|
1703
|
-
* @returns Asset reference by id
|
|
1704
|
-
* @see fromGroupIndex
|
|
1705
|
-
*/
|
|
1361
|
+
/** Reference a specific asset id. @see fromGroupIndex */
|
|
1706
1362
|
static fromId(assetId: AssetId): AssetRef;
|
|
1707
1363
|
/**
|
|
1708
|
-
*
|
|
1364
|
+
* Reference another asset group in the packet.
|
|
1709
1365
|
*
|
|
1710
1366
|
* @param groupIndex - Zero-based asset group index in the packet
|
|
1711
|
-
* @returns Asset reference by group index
|
|
1712
1367
|
* @see fromId
|
|
1713
1368
|
*/
|
|
1714
1369
|
static fromGroupIndex(groupIndex: number): AssetRef;
|
|
1715
1370
|
/**
|
|
1716
|
-
* Decode an asset reference from
|
|
1371
|
+
* Decode an asset reference from hex.
|
|
1717
1372
|
*
|
|
1718
|
-
* @param s - Hex-encoded asset reference
|
|
1719
|
-
* @returns Decoded asset reference
|
|
1720
1373
|
* @throws Error if the string is not valid hex or does not encode a valid asset reference
|
|
1721
1374
|
* @see toString
|
|
1722
1375
|
*/
|
|
@@ -1724,39 +1377,20 @@ declare class AssetRef {
|
|
|
1724
1377
|
/**
|
|
1725
1378
|
* Decode an asset reference from its serialized bytes.
|
|
1726
1379
|
*
|
|
1727
|
-
* @param buf - Serialized asset reference bytes
|
|
1728
|
-
* @returns Decoded asset reference
|
|
1729
1380
|
* @throws Error if the buffer is empty or malformed
|
|
1730
1381
|
*/
|
|
1731
1382
|
static fromBytes(buf: Uint8Array): AssetRef;
|
|
1732
|
-
/**
|
|
1733
|
-
* Serialize the asset reference to raw bytes.
|
|
1734
|
-
*
|
|
1735
|
-
* @returns Serialized asset reference bytes
|
|
1736
|
-
* @see fromBytes
|
|
1737
|
-
*/
|
|
1383
|
+
/** Serialize to raw bytes. @see fromBytes */
|
|
1738
1384
|
serialize(): Uint8Array;
|
|
1739
|
-
/**
|
|
1740
|
-
* Encode the asset reference to a hex string.
|
|
1741
|
-
*
|
|
1742
|
-
* @returns Hex-encoded asset reference
|
|
1743
|
-
* @see fromString
|
|
1744
|
-
*/
|
|
1385
|
+
/** Encode to hex. @see fromString */
|
|
1745
1386
|
toString(): string;
|
|
1746
1387
|
/**
|
|
1747
|
-
* Decode an asset reference from a
|
|
1388
|
+
* Decode an asset reference from a reader positioned at one.
|
|
1748
1389
|
*
|
|
1749
|
-
* @param reader - Reader positioned at an asset reference
|
|
1750
|
-
* @returns Decoded asset reference
|
|
1751
1390
|
* @throws Error if the type is unknown or the reader does not contain enough bytes
|
|
1752
1391
|
*/
|
|
1753
1392
|
static fromReader(reader: BufferReader): AssetRef;
|
|
1754
|
-
/**
|
|
1755
|
-
* Serialize the asset reference into an existing binary writer.
|
|
1756
|
-
*
|
|
1757
|
-
* @param writer - Writer to append the asset reference to
|
|
1758
|
-
* @see serialize
|
|
1759
|
-
*/
|
|
1393
|
+
/** Append the serialized reference to `writer`. @see serialize */
|
|
1760
1394
|
serializeTo(writer: BufferWriter): void;
|
|
1761
1395
|
}
|
|
1762
1396
|
|
|
@@ -2110,15 +1744,9 @@ declare class Packet implements ExtensionPacket {
|
|
|
2110
1744
|
* Shipped from `src/` rather than `test/` so consumers outside this package can
|
|
2111
1745
|
* pin the same bytes: `lightning-swap-service` imports this value, while NArk
|
|
2112
1746
|
* and go-sdk vendor the backing `assetIdVectors.json` from a pinned revision of
|
|
2113
|
-
* this repository.
|
|
2114
|
-
*
|
|
2115
|
-
*
|
|
2116
|
-
* disagreement between them fails silently — a flipped txid makes a covenant
|
|
2117
|
-
* unsatisfiable, a flipped group index resolves to a different asset, a case
|
|
2118
|
-
* mismatch is a routing miss. None of those name their cause, which is what
|
|
2119
|
-
* these vectors are for.
|
|
2120
|
-
*
|
|
2121
|
-
* @see plans/asset-id-shared-vectors.md
|
|
1747
|
+
* this repository. The encoding is implemented in seven places across three
|
|
1748
|
+
* repos, and every disagreement fails silently (a flipped txid makes a covenant
|
|
1749
|
+
* unsatisfiable, a flipped group index resolves to a different asset).
|
|
2122
1750
|
*/
|
|
2123
1751
|
interface AssetIdVectors {
|
|
2124
1752
|
readonly version: number;
|
|
@@ -2168,9 +1796,8 @@ interface AssetIdVectors {
|
|
|
2168
1796
|
* The asset-id test vectors, deeply frozen.
|
|
2169
1797
|
*
|
|
2170
1798
|
* @remarks
|
|
2171
|
-
* Frozen all the way down
|
|
2172
|
-
*
|
|
2173
|
-
* mutating an entry would corrupt it for every other consumer in the process.
|
|
1799
|
+
* Frozen all the way down: the module is a singleton, and one consumer mutating
|
|
1800
|
+
* a nested entry would corrupt it for every other consumer in the process.
|
|
2174
1801
|
*
|
|
2175
1802
|
* @example
|
|
2176
1803
|
* ```typescript
|
|
@@ -2240,6 +1867,13 @@ declare class DustChangeError extends Error {
|
|
|
2240
1867
|
readonly dustAmount: bigint;
|
|
2241
1868
|
constructor(change: bigint, dustAmount: bigint);
|
|
2242
1869
|
}
|
|
1870
|
+
/** Thrown when a collaborative exit's change VTXO is above the server's
|
|
1871
|
+
* per-output ceiling, which arkd answers with `AMOUNT_TOO_HIGH`. */
|
|
1872
|
+
declare class OversizedChangeError extends Error {
|
|
1873
|
+
readonly change: bigint;
|
|
1874
|
+
readonly maxAmount: bigint;
|
|
1875
|
+
constructor(change: bigint, maxAmount: bigint);
|
|
1876
|
+
}
|
|
2243
1877
|
/**
|
|
2244
1878
|
* Ramps is a class wrapping `settle` method to provide a more convenient interface for onboarding and offboarding operations.
|
|
2245
1879
|
*
|
|
@@ -2289,6 +1923,10 @@ declare class Ramps {
|
|
|
2289
1923
|
* @param feeInfo - The fee info to deduct from the offboard amount.
|
|
2290
1924
|
* @param amount - The amount to offboard. If not provided, the total amount of virtual outputs will be offboarded.
|
|
2291
1925
|
* @param eventCallback - Optional callback that receives settlement events
|
|
1926
|
+
* @param vtxos - Specific virtual outputs to spend, mirroring {@link onboard}'s
|
|
1927
|
+
* `boardingUtxos`. Omitted, every spendable one is spent — merging the whole
|
|
1928
|
+
* off-chain balance into a single change output. Taken as given like
|
|
1929
|
+
* `settle({ inputs })`: an `amount` these cannot cover is an error, not a top-up.
|
|
2292
1930
|
* @returns The Arkade transaction id created by settlement
|
|
2293
1931
|
* @throws Error if no virtual outputs remain after fee deduction or the destination address cannot be decoded
|
|
2294
1932
|
* @see IWallet.getSpendableVtxos
|
|
@@ -2300,26 +1938,39 @@ declare class Ramps {
|
|
|
2300
1938
|
* await ramps.offboard('bc1q...', feeInfo);
|
|
2301
1939
|
* ```
|
|
2302
1940
|
*/
|
|
2303
|
-
offboard(destinationAddress: string, feeInfo: FeeInfo, amount?: bigint, eventCallback?: (event: SettlementEvent) => void): ReturnType<IWallet["settle"]>;
|
|
1941
|
+
offboard(destinationAddress: string, feeInfo: FeeInfo, amount?: bigint, eventCallback?: (event: SettlementEvent) => void, vtxos?: NormalizedExtendedVirtualCoin[]): ReturnType<IWallet["settle"]>;
|
|
1942
|
+
/**
|
|
1943
|
+
* Collaboratively exit with the DESTINATION paid exactly `amount`, pricing the
|
|
1944
|
+
* fee on that output rather than on a grossed-up figure. {@link offboard} keeps
|
|
1945
|
+
* the other anchor, which needs `g - fee(g) = amount` solved — impossible for
|
|
1946
|
+
* a program charging the whole output.
|
|
1947
|
+
*/
|
|
1948
|
+
offboardExact(params: {
|
|
1949
|
+
destinationAddress: string;
|
|
1950
|
+
feeInfo: FeeInfo;
|
|
1951
|
+
/** Sats the destination receives, exactly. */
|
|
1952
|
+
amount: bigint;
|
|
1953
|
+
eventCallback?: (event: SettlementEvent) => void;
|
|
1954
|
+
vtxos?: NormalizedExtendedVirtualCoin[];
|
|
1955
|
+
}): ReturnType<IWallet["settle"]>;
|
|
1956
|
+
private offboardInputs;
|
|
1957
|
+
/** Every candidate, or with `concurrentSpending` the shortest covering prefix in send order. */
|
|
1958
|
+
private fundExit;
|
|
1959
|
+
/** Re-runs an SDK-picked exit that lost a coin to a concurrent spend. */
|
|
1960
|
+
private withRepick;
|
|
1961
|
+
/** Fund the change output: pay its own fee, then judge it against both
|
|
1962
|
+
* server-side bounds. `0n` in is `0n` out — no change output at all. */
|
|
1963
|
+
private fundChange;
|
|
2304
1964
|
}
|
|
2305
1965
|
|
|
2306
1966
|
/**
|
|
2307
|
-
* HD-wallet {@link DescriptorProvider} that allocates a fresh signing
|
|
2308
|
-
*
|
|
2309
|
-
*
|
|
2310
|
-
* wallet currently bound to?" is answered by querying the contract
|
|
2311
|
-
* repository for active contracts, not by asking this provider.
|
|
1967
|
+
* HD-wallet {@link DescriptorProvider} that allocates a fresh signing descriptor on every call.
|
|
1968
|
+
* A pure rotating allocator: which descriptor the wallet is bound to is answered by the contract
|
|
1969
|
+
* repository, not this provider.
|
|
2312
1970
|
*
|
|
2313
|
-
* State
|
|
2314
|
-
*
|
|
2315
|
-
*
|
|
2316
|
-
* which carries the wildcard account descriptor template (for derivation)
|
|
2317
|
-
* and the signing primitives.
|
|
2318
|
-
*
|
|
2319
|
-
* The read-modify-write of the persisted index runs inside the shared per-
|
|
2320
|
-
* repo `updateWalletState` mutex, so two `getNextSigningDescriptor` callers
|
|
2321
|
-
* — including those driving separate `HDDescriptorProvider` instances on
|
|
2322
|
-
* the same repo — can never observe the same index.
|
|
1971
|
+
* State lives in `settings.hd` of the wallet state, so switching single-key → HD needs no schema
|
|
1972
|
+
* migration. Allocation runs inside the shared per-repo `updateWalletState` mutex, so callers
|
|
1973
|
+
* (even on separate instances over one repo) never observe the same index.
|
|
2323
1974
|
*
|
|
2324
1975
|
* @example
|
|
2325
1976
|
* ```ts
|
|
@@ -2335,104 +1986,50 @@ declare class HDDescriptorProvider implements DescriptorProvider, ReceiveRotator
|
|
|
2335
1986
|
private readonly walletRepository;
|
|
2336
1987
|
private constructor();
|
|
2337
1988
|
/**
|
|
2338
|
-
* Construct an HDDescriptorProvider. No I/O is
|
|
2339
|
-
*
|
|
2340
|
-
* `getNextSigningDescriptor`. A descriptor-mismatch error surfaces on
|
|
2341
|
-
* first use rather than at boot.
|
|
1989
|
+
* Construct an HDDescriptorProvider. No I/O: state is read lazily, so a descriptor-mismatch
|
|
1990
|
+
* error surfaces on first use rather than here.
|
|
2342
1991
|
*/
|
|
2343
1992
|
static create(identity: HDCapableIdentity, walletRepository: WalletRepository): Promise<HDDescriptorProvider>;
|
|
2344
|
-
/**
|
|
2345
|
-
* Allocate the next descriptor and return it. The first call on a fresh
|
|
2346
|
-
* wallet returns descriptor at index 0; subsequent calls return 1, 2, 3,
|
|
2347
|
-
* ... in order. Each call is atomic with respect to other rotations on
|
|
2348
|
-
* the same repo: two concurrent callers can never observe the same
|
|
2349
|
-
* index.
|
|
2350
|
-
*/
|
|
1993
|
+
/** Allocate and return the next descriptor (index 0, 1, 2, …), atomically per repo. */
|
|
2351
1994
|
getNextSigningDescriptor(): Promise<string>;
|
|
2352
1995
|
/**
|
|
2353
|
-
* Re-derive the descriptor
|
|
2354
|
-
*
|
|
2355
|
-
*
|
|
2356
|
-
* when no descriptor has ever been allocated on this repo.
|
|
2357
|
-
*
|
|
2358
|
-
* Used by the boot path to keep the wallet's display address
|
|
2359
|
-
* stable across restarts: when no tagged display contract exists
|
|
2360
|
-
* (e.g. a fresh wallet that hasn't rotated yet, or a wallet whose
|
|
2361
|
-
* baseline-only repo carries no rotation history), the boot should
|
|
2362
|
-
* re-derive the existing index rather than burn a new one.
|
|
1996
|
+
* Re-derive the descriptor `getNextSigningDescriptor` last returned, WITHOUT advancing;
|
|
1997
|
+
* `undefined` if none was ever allocated. Lets boot keep the display address stable across
|
|
1998
|
+
* restarts when no tagged display contract exists, instead of burning a new index.
|
|
2363
1999
|
*/
|
|
2364
2000
|
getCurrentSigningDescriptor(): Promise<string | undefined>;
|
|
2365
|
-
/**
|
|
2366
|
-
* The most recently allocated index, or `undefined` when nothing has ever
|
|
2367
|
-
* been allocated on this repo. Read-only peek at the watermark that
|
|
2368
|
-
* {@link getNextSigningDescriptor} advances.
|
|
2369
|
-
*/
|
|
2001
|
+
/** Read-only peek at the allocation watermark; `undefined` if nothing was ever allocated. */
|
|
2370
2002
|
getLastIndexUsed(): Promise<number | undefined>;
|
|
2371
2003
|
/**
|
|
2372
|
-
* Monotonically advance the
|
|
2373
|
-
* `
|
|
2374
|
-
*
|
|
2375
|
-
*
|
|
2376
|
-
* An invalid `index` (non-integer / negative / past the BIP32
|
|
2377
|
-
* non-hardened ceiling) is ignored (no-op): persisting it would corrupt
|
|
2378
|
-
* `lastIndexUsed` and make the next `parseSettings()` throw, mirroring
|
|
2379
|
-
* the validation parseSettings already enforces. The upper bound matters
|
|
2380
|
-
* because the damage outlives the call — `materializeDescriptorAt` cannot
|
|
2381
|
-
* derive at or above 2^31, so a watermark parked there would fail every
|
|
2382
|
-
* subsequent allocation for the life of the repo.
|
|
2004
|
+
* Monotonically advance the watermark past indices found by a restore scan; never rewinds.
|
|
2005
|
+
* An invalid `index` (non-integer, negative, or >= 2^31) is ignored: persisting it would make
|
|
2006
|
+
* `parseSettings()` throw, and a watermark at the hardened ceiling would fail every later
|
|
2007
|
+
* allocation for the life of the repo.
|
|
2383
2008
|
*/
|
|
2384
2009
|
advanceLastIndexUsed(index: number): Promise<void>;
|
|
2385
|
-
/**
|
|
2386
|
-
* Returns true when the given descriptor is derivable from this wallet's
|
|
2387
|
-
* seed. Delegates to the underlying identity, which handles both HD and
|
|
2388
|
-
* simple `tr(pubkey)` descriptors.
|
|
2389
|
-
*/
|
|
2010
|
+
/** Whether `descriptor` (HD or simple `tr(pubkey)`) is derivable from this wallet's seed. */
|
|
2390
2011
|
isOurs(descriptor: string): boolean;
|
|
2391
|
-
/**
|
|
2392
|
-
* Signs each request with the key derived from its descriptor. Delegates
|
|
2393
|
-
* to the identity's signing primitives — the identity, not the provider,
|
|
2394
|
-
* holds the seed.
|
|
2395
|
-
*/
|
|
2012
|
+
/** Signs each request with its descriptor's derived key (the identity holds the seed). */
|
|
2396
2013
|
signWithDescriptor(requests: DescriptorSigningRequest[]): Promise<Transaction[]>;
|
|
2397
2014
|
/** Signs a message using the key derived from `descriptor`. */
|
|
2398
2015
|
signMessageWithDescriptor(descriptor: string, message: Uint8Array, signatureType?: "schnorr" | "ecdsa"): Promise<Uint8Array>;
|
|
2399
|
-
/**
|
|
2400
|
-
* HD providers participate in receive rotation. The default
|
|
2401
|
-
* factory boot (contract-repo lookup → allocate fresh descriptor)
|
|
2402
|
-
* is exactly what we want, so this just delegates to
|
|
2403
|
-
* {@link WalletReceiveRotator.defaultBoot}.
|
|
2404
|
-
*/
|
|
2016
|
+
/** HD providers take part in receive rotation via {@link WalletReceiveRotator.defaultBoot}. */
|
|
2405
2017
|
createReceiveRotator(opts: ReceiveRotatorBootOpts): Promise<ReceiveRotatorBoot | undefined>;
|
|
2406
2018
|
/**
|
|
2407
|
-
*
|
|
2408
|
-
*
|
|
2409
|
-
*
|
|
2410
|
-
* call validates that the input is a ranged template AND produces a
|
|
2411
|
-
* canonical materialized key expression at the given index.
|
|
2412
|
-
*
|
|
2413
|
-
* This is a pure read: it does NOT advance the allocation watermark.
|
|
2414
|
-
* Used by restore's gap-scan to peek descriptors at arbitrary indices
|
|
2415
|
-
* without side-effects.
|
|
2019
|
+
* Materialize the account template at `index` via the descriptors-scure parser (validates the
|
|
2020
|
+
* ranged template and yields a canonical key expression) rather than string substitution.
|
|
2021
|
+
* Pure: does NOT advance the watermark, so restore's gap-scan can peek arbitrary indices.
|
|
2416
2022
|
*/
|
|
2417
2023
|
materializeDescriptorAt(index: number): string;
|
|
2418
2024
|
/**
|
|
2419
|
-
*
|
|
2420
|
-
*
|
|
2421
|
-
*
|
|
2422
|
-
* surface; the mutated settings are then persisted as part of the same
|
|
2423
|
-
* atomic update.
|
|
2424
|
-
*
|
|
2425
|
-
* Doing the read inside the lock is what prevents two providers (or two
|
|
2426
|
-
* concurrent callers on the same provider) from racing on a stale index.
|
|
2025
|
+
* Read-modify-write HD settings inside the shared per-repo wallet-state mutex; `fn` mutates a
|
|
2026
|
+
* validated snapshot that is persisted atomically. Reading inside the lock prevents races on a
|
|
2027
|
+
* stale index.
|
|
2427
2028
|
*/
|
|
2428
2029
|
private mutate;
|
|
2429
2030
|
/**
|
|
2430
|
-
* Validate
|
|
2431
|
-
*
|
|
2432
|
-
*
|
|
2433
|
-
* The cast to `HDWalletSettings` trusts storage; a corrupted or
|
|
2434
|
-
* partially-migrated repo could otherwise produce `NaN` descriptors.
|
|
2435
|
-
* Fail loud rather than silently derive garbage.
|
|
2031
|
+
* Validate persisted HD settings (or init a fresh record) and return a mutable clone. Fails
|
|
2032
|
+
* loud: a corrupt repo would otherwise derive `NaN` descriptors.
|
|
2436
2033
|
*/
|
|
2437
2034
|
private parseSettings;
|
|
2438
2035
|
}
|
|
@@ -2446,27 +2043,12 @@ declare class ReadonlyWalletError extends Error {
|
|
|
2446
2043
|
declare class DelegateNotConfiguredError extends Error {
|
|
2447
2044
|
constructor();
|
|
2448
2045
|
}
|
|
2449
|
-
/** @deprecated alias for DelegateNotConfiguredError */
|
|
2450
|
-
declare const DelegatorNotConfiguredError: typeof DelegateNotConfiguredError;
|
|
2451
|
-
type DelegatorNotConfiguredError = DelegateNotConfiguredError;
|
|
2452
2046
|
type RequestInitWallet = RequestEnvelope & {
|
|
2453
2047
|
type: "INIT_WALLET";
|
|
2454
2048
|
payload: {
|
|
2455
|
-
/**
|
|
2456
|
-
* Legacy per-request key material. Ignored by the current handler —
|
|
2457
|
-
* identity hydration happens during INITIALIZE_MESSAGE_BUS. Retained
|
|
2458
|
-
* for wire compatibility with older workers that may still read it.
|
|
2459
|
-
* Slated for removal in the next major.
|
|
2460
|
-
*
|
|
2461
|
-
* @deprecated Identity is now carried by INITIALIZE_MESSAGE_BUS.
|
|
2462
|
-
*/
|
|
2463
|
-
key?: {
|
|
2464
|
-
privateKey: string;
|
|
2465
|
-
} | {
|
|
2466
|
-
publicKey: string;
|
|
2467
|
-
} | {};
|
|
2468
2049
|
arkServerUrl: string;
|
|
2469
2050
|
arkServerPublicKey?: string;
|
|
2051
|
+
lazyBoarding?: boolean;
|
|
2470
2052
|
};
|
|
2471
2053
|
};
|
|
2472
2054
|
type ResponseInitWallet = ResponseEnvelope & {
|
|
@@ -2484,16 +2066,6 @@ type ResponseSettle = ResponseEnvelope & {
|
|
|
2484
2066
|
txid: string;
|
|
2485
2067
|
};
|
|
2486
2068
|
};
|
|
2487
|
-
type RequestSendBitcoin = RequestEnvelope & {
|
|
2488
|
-
type: "SEND_BITCOIN";
|
|
2489
|
-
payload: SendBitcoinParams;
|
|
2490
|
-
};
|
|
2491
|
-
type ResponseSendBitcoin = ResponseEnvelope & {
|
|
2492
|
-
type: "SEND_BITCOIN_SUCCESS";
|
|
2493
|
-
payload: {
|
|
2494
|
-
txid: string;
|
|
2495
|
-
};
|
|
2496
|
-
};
|
|
2497
2069
|
type RequestGetAddress = RequestEnvelope & {
|
|
2498
2070
|
type: "GET_ADDRESS";
|
|
2499
2071
|
};
|
|
@@ -2586,13 +2158,14 @@ type ResponseGetVtxos = ResponseEnvelope & {
|
|
|
2586
2158
|
type RequestGetSpendableVtxos = RequestEnvelope & {
|
|
2587
2159
|
type: "GET_SPENDABLE_VTXOS";
|
|
2588
2160
|
payload: {
|
|
2589
|
-
filter?:
|
|
2161
|
+
filter?: GetSpendableVtxosFilter;
|
|
2590
2162
|
};
|
|
2591
2163
|
};
|
|
2592
2164
|
type ResponseGetSpendableVtxos = ResponseEnvelope & {
|
|
2593
2165
|
type: "SPENDABLE_VTXOS";
|
|
2594
2166
|
payload: {
|
|
2595
2167
|
vtxos: Awaited<ReturnType<IWallet["getSpendableVtxos"]>>;
|
|
2168
|
+
filterApplied?: boolean;
|
|
2596
2169
|
};
|
|
2597
2170
|
};
|
|
2598
2171
|
type RequestGetBoardingUtxos = RequestEnvelope & {
|
|
@@ -2690,12 +2263,65 @@ type RequestGetContractsWithVtxos = RequestEnvelope & {
|
|
|
2690
2263
|
type: "GET_CONTRACTS_WITH_VTXOS";
|
|
2691
2264
|
payload: {
|
|
2692
2265
|
filter?: GetContractsFilter;
|
|
2266
|
+
options?: {
|
|
2267
|
+
maxSyncAgeMs?: number;
|
|
2268
|
+
unspentOnly?: boolean;
|
|
2269
|
+
requireSynced?: boolean;
|
|
2270
|
+
};
|
|
2693
2271
|
};
|
|
2694
2272
|
};
|
|
2695
2273
|
type ResponseGetContractsWithVtxos = ResponseEnvelope & {
|
|
2696
2274
|
type: "CONTRACTS_WITH_VTXOS";
|
|
2697
2275
|
payload: {
|
|
2698
2276
|
contracts: ContractWithVtxos[];
|
|
2277
|
+
filterApplied?: boolean;
|
|
2278
|
+
};
|
|
2279
|
+
};
|
|
2280
|
+
type RequestGetStoredContractsWithVtxos = RequestEnvelope & {
|
|
2281
|
+
type: "GET_STORED_CONTRACTS_WITH_VTXOS";
|
|
2282
|
+
payload: {
|
|
2283
|
+
filter?: GetContractsFilter;
|
|
2284
|
+
};
|
|
2285
|
+
};
|
|
2286
|
+
type ResponseGetStoredContractsWithVtxos = ResponseEnvelope & {
|
|
2287
|
+
type: "STORED_CONTRACTS_WITH_VTXOS";
|
|
2288
|
+
payload: {
|
|
2289
|
+
contracts: ContractWithVtxos[];
|
|
2290
|
+
};
|
|
2291
|
+
};
|
|
2292
|
+
type RequestWatchScript = RequestEnvelope & {
|
|
2293
|
+
type: "WATCH_SCRIPT";
|
|
2294
|
+
payload: {
|
|
2295
|
+
script: string | string[];
|
|
2296
|
+
label?: string;
|
|
2297
|
+
};
|
|
2298
|
+
};
|
|
2299
|
+
type ResponseWatchScript = ResponseEnvelope & {
|
|
2300
|
+
type: "SCRIPT_WATCHED";
|
|
2301
|
+
payload: {
|
|
2302
|
+
script: string | string[];
|
|
2303
|
+
};
|
|
2304
|
+
};
|
|
2305
|
+
type RequestUnwatchScript = RequestEnvelope & {
|
|
2306
|
+
type: "UNWATCH_SCRIPT";
|
|
2307
|
+
payload: {
|
|
2308
|
+
script: string | string[];
|
|
2309
|
+
};
|
|
2310
|
+
};
|
|
2311
|
+
type ResponseUnwatchScript = ResponseEnvelope & {
|
|
2312
|
+
type: "SCRIPT_UNWATCHED";
|
|
2313
|
+
payload: {
|
|
2314
|
+
script: string | string[];
|
|
2315
|
+
};
|
|
2316
|
+
};
|
|
2317
|
+
type RequestGetWatchedScripts = RequestEnvelope & {
|
|
2318
|
+
type: "GET_WATCHED_SCRIPTS";
|
|
2319
|
+
payload: Record<string, never>;
|
|
2320
|
+
};
|
|
2321
|
+
type ResponseGetWatchedScripts = ResponseEnvelope & {
|
|
2322
|
+
type: "WATCHED_SCRIPTS";
|
|
2323
|
+
payload: {
|
|
2324
|
+
scripts: WatchedScript[];
|
|
2699
2325
|
};
|
|
2700
2326
|
};
|
|
2701
2327
|
type RequestAnnotateVtxos = RequestEnvelope & {
|
|
@@ -2715,6 +2341,11 @@ type RequestUpdateContract = RequestEnvelope & {
|
|
|
2715
2341
|
payload: {
|
|
2716
2342
|
script: string;
|
|
2717
2343
|
updates: Partial<Omit<Contract, "id" | "createdAt">>;
|
|
2344
|
+
/**
|
|
2345
|
+
* Set only by the proxy's `setContractWatchState`, so the worker keeps its
|
|
2346
|
+
* unchanged-state no-op. A worker predating the flag ignores it and writes.
|
|
2347
|
+
*/
|
|
2348
|
+
watchStateOnly?: boolean;
|
|
2718
2349
|
};
|
|
2719
2350
|
};
|
|
2720
2351
|
type ResponseUpdateContract = ResponseEnvelope & {
|
|
@@ -2723,6 +2354,10 @@ type ResponseUpdateContract = ResponseEnvelope & {
|
|
|
2723
2354
|
contract: Contract;
|
|
2724
2355
|
};
|
|
2725
2356
|
};
|
|
2357
|
+
/** Answers a `watchStateOnly` update; carries no row, so nothing is re-read. */
|
|
2358
|
+
type ResponseContractWatchStateSet = ResponseEnvelope & {
|
|
2359
|
+
type: "CONTRACT_WATCH_STATE_SET";
|
|
2360
|
+
};
|
|
2726
2361
|
type RequestDeleteContract = RequestEnvelope & {
|
|
2727
2362
|
type: "DELETE_CONTRACT";
|
|
2728
2363
|
payload: {
|
|
@@ -2840,6 +2475,15 @@ type ResponseGetAllSpendingPaths = ResponseEnvelope & {
|
|
|
2840
2475
|
paths: PathSelection[];
|
|
2841
2476
|
};
|
|
2842
2477
|
};
|
|
2478
|
+
type RequestGetUnsupportedContracts = RequestEnvelope & {
|
|
2479
|
+
type: "GET_UNSUPPORTED_CONTRACTS";
|
|
2480
|
+
};
|
|
2481
|
+
type ResponseGetUnsupportedContracts = ResponseEnvelope & {
|
|
2482
|
+
type: "UNSUPPORTED_CONTRACTS";
|
|
2483
|
+
payload: {
|
|
2484
|
+
contracts: Contract[];
|
|
2485
|
+
};
|
|
2486
|
+
};
|
|
2843
2487
|
type ResponseSettleEvent = ResponseEnvelope & {
|
|
2844
2488
|
broadcast: true;
|
|
2845
2489
|
type: "SETTLE_EVENT";
|
|
@@ -2886,6 +2530,36 @@ type RequestSend = RequestEnvelope & {
|
|
|
2886
2530
|
recipients: [Recipient, ...Recipient[]];
|
|
2887
2531
|
/** @see SendParams.selectedVtxos */
|
|
2888
2532
|
selectedVtxos?: ExtendedVirtualCoin[];
|
|
2533
|
+
/** @see SendParams.maxChangeFee */
|
|
2534
|
+
maxChangeFee?: number;
|
|
2535
|
+
};
|
|
2536
|
+
};
|
|
2537
|
+
type RequestSendWithDeadline = RequestEnvelope & {
|
|
2538
|
+
type: "SEND_WITH_DEADLINE";
|
|
2539
|
+
payload: {
|
|
2540
|
+
recipients: [Recipient, ...Recipient[]];
|
|
2541
|
+
selectedVtxos?: ExtendedVirtualCoin[];
|
|
2542
|
+
/** @see SendParams.maxChangeFee */
|
|
2543
|
+
maxChangeFee?: number;
|
|
2544
|
+
validUntil: number;
|
|
2545
|
+
};
|
|
2546
|
+
};
|
|
2547
|
+
type RequestSendWithInputExpiryFloor = RequestEnvelope & {
|
|
2548
|
+
type: "SEND_WITH_INPUT_EXPIRY_FLOOR";
|
|
2549
|
+
payload: {
|
|
2550
|
+
recipients: [Recipient, ...Recipient[]];
|
|
2551
|
+
selectedVtxos?: ExtendedVirtualCoin[];
|
|
2552
|
+
/** @see SendParams.maxChangeFee */
|
|
2553
|
+
maxChangeFee?: number;
|
|
2554
|
+
inputExpiryFloor: InputExpiryFloor;
|
|
2555
|
+
validUntil?: number;
|
|
2556
|
+
};
|
|
2557
|
+
};
|
|
2558
|
+
type ResponseSendDeadlineExceeded = ResponseEnvelope & {
|
|
2559
|
+
type: "SEND_DEADLINE_EXCEEDED";
|
|
2560
|
+
error: Error;
|
|
2561
|
+
payload: {
|
|
2562
|
+
validUntil: number;
|
|
2889
2563
|
};
|
|
2890
2564
|
};
|
|
2891
2565
|
type ResponseSend = ResponseEnvelope & {
|
|
@@ -3104,8 +2778,8 @@ type RequestRestoreWallet = RequestEnvelope & {
|
|
|
3104
2778
|
type ResponseRestoreWallet = ResponseEnvelope & {
|
|
3105
2779
|
type: "RESTORE_WALLET_SUCCESS";
|
|
3106
2780
|
};
|
|
3107
|
-
type WalletUpdaterRequest = RequestInitWallet | RequestSettle |
|
|
3108
|
-
type WalletUpdaterResponse = ResponseEnvelope & (ResponseInitWallet | ResponseSettle | ResponseSettleEvent |
|
|
2781
|
+
type WalletUpdaterRequest = RequestInitWallet | RequestSettle | RequestGetAddress | RequestGetBoardingAddress | RequestGetArkadeInfo | RequestIndexerGetVtxos | RequestIndexerGetVirtualTxs | RequestSubmitTx | RequestFinalizeTx | RequestGetBalance | RequestGetVtxos | RequestGetSpendableVtxos | RequestGetBoardingUtxos | RequestGetTransactionHistory | RequestGetStatus | RequestGetContractSyncState | RequestClear | RequestReloadWallet | RequestSignTransaction | RequestCreateContract | RequestGetContracts | RequestGetContractsWithVtxos | RequestGetStoredContractsWithVtxos | RequestWatchScript | RequestUnwatchScript | RequestGetWatchedScripts | RequestAnnotateVtxos | RequestUpdateContract | RequestDeleteContract | RequestGetSpendablePaths | RequestGetAllSpendingPaths | RequestGetUnsupportedContracts | RequestIsContractManagerWatching | RequestRefreshVtxos | RequestRefreshOutpoints | RequestGetCurrentSigningDescriptor | RequestGetNextSigningDescriptor | RequestGetNewAddresses | RequestGetUsedSigningDescriptors | RequestAdvanceSigningDescriptorWatermark | RequestSend | RequestSendWithDeadline | RequestSendWithInputExpiryFloor | RequestGetAssetDetails | RequestIssue | RequestReissue | RequestBurn | RequestDelegate | RequestGetDelegateInfo | RequestRecoverVtxos | RequestGetRecoverableBalance | RequestGetExpiringVtxos | RequestRenewVtxos | RequestGetExpiredBoardingUtxos | RequestSweepExpiredBoardingUtxos | RequestMigrateDeprecatedSignerVtxos | RequestGetDeprecatedSignerStatus | RequestRestoreWallet;
|
|
2782
|
+
type WalletUpdaterResponse = ResponseEnvelope & (ResponseInitWallet | ResponseSettle | ResponseSettleEvent | ResponseGetAddress | ResponseGetBoardingAddress | ResponseGetArkadeInfo | ResponseIndexerGetVtxos | ResponseIndexerGetVirtualTxs | ResponseSubmitTx | ResponseFinalizeTx | ResponseGetBalance | ResponseGetVtxos | ResponseGetSpendableVtxos | ResponseGetBoardingUtxos | ResponseGetTransactionHistory | ResponseGetStatus | ResponseGetContractSyncState | ResponseClear | ResponseReloadWallet | ResponseUtxoUpdate | ResponseVtxoUpdate | ResponseSignTransaction | ResponseCreateContract | ResponseGetContracts | ResponseGetContractsWithVtxos | ResponseGetStoredContractsWithVtxos | ResponseWatchScript | ResponseUnwatchScript | ResponseGetWatchedScripts | ResponseAnnotateVtxos | ResponseUpdateContract | ResponseContractWatchStateSet | ResponseDeleteContract | ResponseGetSpendablePaths | ResponseGetAllSpendingPaths | ResponseGetUnsupportedContracts | ResponseIsContractManagerWatching | ResponseRefreshVtxos | ResponseRefreshOutpoints | ResponseGetCurrentSigningDescriptor | ResponseGetNextSigningDescriptor | ResponseGetNewAddresses | ResponseGetUsedSigningDescriptors | ResponseAdvanceSigningDescriptorWatermark | ResponseContractEvent | ResponseSend | ResponseSendDeadlineExceeded | ResponseGetAssetDetails | ResponseIssue | ResponseReissue | ResponseBurn | ResponseDelegate | ResponseGetDelegateInfo | ResponseRecoverVtxos | ResponseRecoverVtxosEvent | ResponseGetRecoverableBalance | ResponseGetExpiringVtxos | ResponseRenewVtxos | ResponseRenewVtxosEvent | ResponseGetExpiredBoardingUtxos | ResponseSweepExpiredBoardingUtxos | ResponseMigrateDeprecatedSignerVtxos | ResponseMigrateDeprecatedSignerVtxosEvent | ResponseGetDeprecatedSignerStatus | ResponseRestoreWallet);
|
|
3109
2783
|
declare class WalletMessageHandler implements MessageHandler<WalletUpdaterRequest, WalletUpdaterResponse> {
|
|
3110
2784
|
readonly messageTag: string;
|
|
3111
2785
|
private wallet;
|
|
@@ -3119,6 +2793,7 @@ declare class WalletMessageHandler implements MessageHandler<WalletUpdaterReques
|
|
|
3119
2793
|
private channel;
|
|
3120
2794
|
private incomingFundsEpoch;
|
|
3121
2795
|
private contractEventsEpoch;
|
|
2796
|
+
private boardingEpoch;
|
|
3122
2797
|
/** Per-request progress callbacks: ends with the handler, not with a re-init. */
|
|
3123
2798
|
private requestEpoch;
|
|
3124
2799
|
/**
|
|
@@ -3145,6 +2820,10 @@ declare class WalletMessageHandler implements MessageHandler<WalletUpdaterReques
|
|
|
3145
2820
|
isLongRunning(message: WalletUpdaterRequest): boolean;
|
|
3146
2821
|
handleMessage(message: WalletUpdaterRequest): Promise<WalletUpdaterResponse>;
|
|
3147
2822
|
private handleInitWallet;
|
|
2823
|
+
/** @see RequestInitWallet.payload.lazyBoarding */
|
|
2824
|
+
private lazyBoardingInit;
|
|
2825
|
+
/** Set once this session has actually fetched the boarding addresses. */
|
|
2826
|
+
private boardingLoaded;
|
|
3148
2827
|
/**
|
|
3149
2828
|
* The worker's own balance. Same bucketing rules as `Wallet.getBalance` —
|
|
3150
2829
|
* both call {@link computeOffchainBalance} — but deliberately a different
|
|
@@ -3154,14 +2833,26 @@ declare class WalletMessageHandler implements MessageHandler<WalletUpdaterReques
|
|
|
3154
2833
|
* runs over this method's local snapshot instead.
|
|
3155
2834
|
*/
|
|
3156
2835
|
private handleGetBalance;
|
|
3157
|
-
private
|
|
2836
|
+
private getBoardingUtxosForBalance;
|
|
3158
2837
|
private onWalletInitialized;
|
|
3159
2838
|
/**
|
|
3160
|
-
* Refresh
|
|
3161
|
-
*
|
|
3162
|
-
* (post-refresh),
|
|
2839
|
+
* Refresh boarding inputs and transaction history. The virtual outputs come
|
|
2840
|
+
* from the contract manager, which runs before this. Shared by
|
|
2841
|
+
* onWalletInitialized (full bootstrap) and reloadWallet (post-refresh),
|
|
2842
|
+
* avoiding duplicate subscriptions and VtxoManager restarts.
|
|
2843
|
+
*
|
|
2844
|
+
* Both legs reach the onchain provider, so `lazyBoarding` moves them both
|
|
2845
|
+
* off the caller's path. @see RequestInitWallet.payload.lazyBoarding
|
|
3163
2846
|
*/
|
|
3164
2847
|
private refreshCachedData;
|
|
2848
|
+
/** @param gen - set by a background caller; each write is skipped once it goes stale. */
|
|
2849
|
+
private refreshHistoryCache;
|
|
2850
|
+
/**
|
|
2851
|
+
* @param gen - set by a background caller; each write here is skipped once it goes stale.
|
|
2852
|
+
* The fetch saves the fetched rows itself, before control returns, so that one write is
|
|
2853
|
+
* outside this check.
|
|
2854
|
+
*/
|
|
2855
|
+
private refreshBoardingCache;
|
|
3165
2856
|
/**
|
|
3166
2857
|
* Force a full VTXO refresh from the indexer, then refresh cached data.
|
|
3167
2858
|
* Used by RELOAD_WALLET to ensure fresh data without re-subscribing
|
|
@@ -3169,7 +2860,6 @@ declare class WalletMessageHandler implements MessageHandler<WalletUpdaterReques
|
|
|
3169
2860
|
*/
|
|
3170
2861
|
private reloadWallet;
|
|
3171
2862
|
private handleSettle;
|
|
3172
|
-
private handleSendBitcoin;
|
|
3173
2863
|
private handleSignTransaction;
|
|
3174
2864
|
private handleDelegate;
|
|
3175
2865
|
/**
|
|
@@ -3181,6 +2871,14 @@ declare class WalletMessageHandler implements MessageHandler<WalletUpdaterReques
|
|
|
3181
2871
|
/**
|
|
3182
2872
|
* Read all virtual outputs from the repository, aggregated across all contract
|
|
3183
2873
|
* addresses and the wallet's primary address, with deduplication.
|
|
2874
|
+
*
|
|
2875
|
+
* Recovery-only contracts (imported by `claimCash` for server-swept
|
|
2876
|
+
* arkcash) are excluded by default, mirroring {@link ReadonlyWallet.getVtxos}:
|
|
2877
|
+
* they are settled in their own isolated intent and must stay out of the
|
|
2878
|
+
* wallet's balance / VTXO / coin-selection / pending-tx views that read this.
|
|
2879
|
+
* The transaction-history caller opts back in via `includeRecoveryOnly` to
|
|
2880
|
+
* match the non-worker `getTransactionHistory`, which reads contracts
|
|
2881
|
+
* directly and does include them.
|
|
3184
2882
|
*/
|
|
3185
2883
|
private getVtxosFromRepo;
|
|
3186
2884
|
/**
|
|
@@ -3195,11 +2893,21 @@ declare class WalletMessageHandler implements MessageHandler<WalletUpdaterReques
|
|
|
3195
2893
|
* VTXOs with no matching row in the gate, and `gatedContracts` lists only
|
|
3196
2894
|
* what it knows is closed — so the coins of a just-registered escrowed
|
|
3197
2895
|
* contract would count as available until the next poll.
|
|
2896
|
+
*
|
|
2897
|
+
* Recovery-only contracts are skipped unless `includeRecoveryOnly` (see
|
|
2898
|
+
* {@link getVtxosFromRepo}).
|
|
3198
2899
|
*/
|
|
3199
2900
|
private repoSnapshot;
|
|
3200
2901
|
/**
|
|
3201
2902
|
* Build transaction history from cached virtual outputs, hitting the indexer only for
|
|
3202
2903
|
* uncached timestamps. Best-effort, like the plain Wallet path.
|
|
2904
|
+
*
|
|
2905
|
+
* Takes its own {@link repoSnapshot} rather than a caller-supplied VTXO
|
|
2906
|
+
* list: the coins and the gate that judges them have to come off one read
|
|
2907
|
+
* or they answer about different instants, and being the worker's only
|
|
2908
|
+
* history builder means neither caller can supply one without the other.
|
|
2909
|
+
* The snapshot and the boarding read are independent, so they run together
|
|
2910
|
+
* — the same pairing `handleGetBalance` makes.
|
|
3203
2911
|
*/
|
|
3204
2912
|
private buildTransactionHistoryFromCache;
|
|
3205
2913
|
private ensureContractEventBroadcasting;
|
|
@@ -3222,7 +2930,7 @@ declare const DEFAULT_MESSAGE_TIMEOUTS: Readonly<Record<RequestType, number>>;
|
|
|
3222
2930
|
* // SIMPLE: Recommended approach
|
|
3223
2931
|
* const wallet = await ServiceWorkerWallet.setup({
|
|
3224
2932
|
* serviceWorkerPath: '/service-worker.js',
|
|
3225
|
-
*
|
|
2933
|
+
* arkServer: { url: 'https://arkade.computer' },
|
|
3226
2934
|
* identity: MnemonicIdentity.fromMnemonic('abandon abandon...')
|
|
3227
2935
|
* });
|
|
3228
2936
|
*
|
|
@@ -3230,7 +2938,7 @@ declare const DEFAULT_MESSAGE_TIMEOUTS: Readonly<Record<RequestType, number>>;
|
|
|
3230
2938
|
* const serviceWorker = await setupServiceWorker("/service-worker.js");
|
|
3231
2939
|
* const wallet = await ServiceWorkerWallet.create({
|
|
3232
2940
|
* serviceWorker,
|
|
3233
|
-
*
|
|
2941
|
+
* arkServer: { url: 'https://arkade.computer' },
|
|
3234
2942
|
* identity: MnemonicIdentity.fromMnemonic('abandon abandon...')
|
|
3235
2943
|
* });
|
|
3236
2944
|
*
|
|
@@ -3240,27 +2948,15 @@ declare const DEFAULT_MESSAGE_TIMEOUTS: Readonly<Record<RequestType, number>>;
|
|
|
3240
2948
|
* ```
|
|
3241
2949
|
*/
|
|
3242
2950
|
interface ServiceWorkerWalletOptions {
|
|
3243
|
-
/**
|
|
3244
|
-
|
|
3245
|
-
/**
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
/**
|
|
3253
|
-
* Optional override for the indexer URL.
|
|
3254
|
-
*
|
|
3255
|
-
* @deprecated Provide an explicit provider via the worker config instead.
|
|
3256
|
-
*/
|
|
3257
|
-
indexerUrl?: string;
|
|
3258
|
-
/**
|
|
3259
|
-
* Optional override for the Esplora API URL.
|
|
3260
|
-
*
|
|
3261
|
-
* @deprecated Provide an explicit provider via the worker config instead.
|
|
3262
|
-
*/
|
|
3263
|
-
esploraUrl?: string;
|
|
2951
|
+
/** Start contract synchronization in the background; inspect provider connection state. */
|
|
2952
|
+
lazyInitialization?: boolean;
|
|
2953
|
+
/** Defer boarding and history loading; render boarding.loaded=false as unknown. */
|
|
2954
|
+
lazyBoarding?: boolean;
|
|
2955
|
+
/** Arkade server endpoint and optional public key. */
|
|
2956
|
+
arkServer?: {
|
|
2957
|
+
url: string;
|
|
2958
|
+
publicKey?: string;
|
|
2959
|
+
};
|
|
3264
2960
|
/**
|
|
3265
2961
|
* Repository-backed storage configuration overrides.
|
|
3266
2962
|
* Defaults to IndexedDB if unset.
|
|
@@ -3270,8 +2966,6 @@ interface ServiceWorkerWalletOptions {
|
|
|
3270
2966
|
identity: ReadonlyIdentity | Identity;
|
|
3271
2967
|
/** Optional delegation service URL. */
|
|
3272
2968
|
delegateUrl?: string;
|
|
3273
|
-
/** @deprecated alias for @see ServiceWorkerWalletOptions.delegateUrl */
|
|
3274
|
-
delegatorUrl?: string;
|
|
3275
2969
|
/**
|
|
3276
2970
|
* Override the default tag used for messages sent to and received from the service worker.
|
|
3277
2971
|
* @see DEFAULT_MESSAGE_TAG
|
|
@@ -3281,6 +2975,8 @@ interface ServiceWorkerWalletOptions {
|
|
|
3281
2975
|
messageBusTimeoutMs?: number;
|
|
3282
2976
|
/** Optional settlement configuration forwarded to the worker wallet. */
|
|
3283
2977
|
settlementConfig?: SettlementConfig | false;
|
|
2978
|
+
/** Forwarded to the worker wallet. @see WalletConfig.concurrentSpending */
|
|
2979
|
+
concurrentSpending?: boolean;
|
|
3284
2980
|
/**
|
|
3285
2981
|
* Receive-address strategy forwarded to the worker wallet.
|
|
3286
2982
|
*
|
|
@@ -3299,17 +2995,13 @@ interface ServiceWorkerWalletOptions {
|
|
|
3299
2995
|
*/
|
|
3300
2996
|
lookAheadWindow?: number;
|
|
3301
2997
|
/**
|
|
3302
|
-
*
|
|
2998
|
+
* Batch expiry floor forwarded to the worker wallet. Lowering it below its
|
|
3303
2999
|
* per-network default relaxes a fund-safety bound; intended for local
|
|
3304
|
-
* testing.
|
|
3305
|
-
* mainnet-grade checkpoint floor (signet, mutinynet) are defaulted to their
|
|
3306
|
-
* own advertised value, so neither needs these set.
|
|
3000
|
+
* testing.
|
|
3307
3001
|
*
|
|
3308
3002
|
* @see WalletConfig.minBatchExpirySeconds
|
|
3309
3003
|
*/
|
|
3310
3004
|
minBatchExpirySeconds?: bigint;
|
|
3311
|
-
/** @see WalletConfig.minCheckpointExitDelaySeconds */
|
|
3312
|
-
minCheckpointExitDelaySeconds?: bigint;
|
|
3313
3005
|
/**
|
|
3314
3006
|
* Per-request timeout overrides for wallet-updater messages.
|
|
3315
3007
|
* @see DEFAULT_MESSAGE_TIMEOUTS
|
|
@@ -3339,23 +3031,20 @@ type ServiceWorkerWalletSetupOptions = ServiceWorkerWalletOptions & {
|
|
|
3339
3031
|
serviceWorkerActivationTimeoutMs?: number;
|
|
3340
3032
|
};
|
|
3341
3033
|
type MessageBusInitConfig = {
|
|
3342
|
-
|
|
3034
|
+
lazyInitialization?: boolean;
|
|
3035
|
+
wallet: SerializedIdentity;
|
|
3343
3036
|
arkServer: {
|
|
3344
3037
|
url: string;
|
|
3345
3038
|
publicKey?: string;
|
|
3346
3039
|
};
|
|
3347
3040
|
delegateUrl?: string;
|
|
3348
|
-
/** @deprecated alias for @see MessageBusInitConfig.delegateUrl */
|
|
3349
|
-
delegatorUrl?: string;
|
|
3350
|
-
indexerUrl?: string;
|
|
3351
|
-
esploraUrl?: string;
|
|
3352
3041
|
timeoutMs?: number;
|
|
3353
3042
|
settlementConfig?: SettlementConfig | false;
|
|
3043
|
+
concurrentSpending?: boolean;
|
|
3354
3044
|
walletMode?: ServiceWorkerWalletMode;
|
|
3355
3045
|
watcherConfig?: Partial<Omit<ContractWatcherConfig, "indexerProvider">>;
|
|
3356
3046
|
lookAheadWindow?: number;
|
|
3357
3047
|
minBatchExpirySeconds?: bigint;
|
|
3358
|
-
minCheckpointExitDelaySeconds?: bigint;
|
|
3359
3048
|
messageTimeouts?: Record<string, number>;
|
|
3360
3049
|
};
|
|
3361
3050
|
declare class ServiceWorkerReadonlyWallet implements IReadonlyWallet {
|
|
@@ -3370,15 +3059,6 @@ declare class ServiceWorkerReadonlyWallet implements IReadonlyWallet {
|
|
|
3370
3059
|
protected initWalletPayload: RequestInitWallet["payload"] | null;
|
|
3371
3060
|
protected messageBusTimeoutMs?: number;
|
|
3372
3061
|
protected messageTimeouts: Record<RequestType, number>;
|
|
3373
|
-
protected arkServerUrl?: string;
|
|
3374
|
-
protected arkServerPublicKey?: string;
|
|
3375
|
-
protected delegateUrl?: string;
|
|
3376
|
-
/** @deprecated alias for @see ServiceWorkerReadonlyWallet.delegateUrl */
|
|
3377
|
-
protected delegatorUrl?: string;
|
|
3378
|
-
protected indexerUrl?: string;
|
|
3379
|
-
protected esploraUrl?: string;
|
|
3380
|
-
protected watcherConfig?: Partial<Omit<ContractWatcherConfig, "indexerProvider">>;
|
|
3381
|
-
protected settlementConfig?: SettlementConfig | false;
|
|
3382
3062
|
private reinitPromise;
|
|
3383
3063
|
private pingPromise;
|
|
3384
3064
|
private inflightRequests;
|
|
@@ -3393,6 +3073,8 @@ declare class ServiceWorkerReadonlyWallet implements IReadonlyWallet {
|
|
|
3393
3073
|
* @throws Error if service-worker initialization fails
|
|
3394
3074
|
*/
|
|
3395
3075
|
static create(options: ServiceWorkerWalletCreateOptions): Promise<ServiceWorkerReadonlyWallet>;
|
|
3076
|
+
/** Shared tail of both `create()` factories: boot the bus, INIT_WALLET, cache for reinit. */
|
|
3077
|
+
protected static bootstrap<W extends ServiceWorkerReadonlyWallet>(wallet: W, options: ServiceWorkerWalletCreateOptions, serializedWallet: SerializedIdentity, busConfig: Omit<MessageBusInitConfig, "wallet" | "arkServer" | "messageTimeouts">): Promise<W>;
|
|
3396
3078
|
/**
|
|
3397
3079
|
* Simplified setup method that handles service worker registration
|
|
3398
3080
|
* and wallet initialization automatically.
|
|
@@ -3403,7 +3085,7 @@ declare class ServiceWorkerReadonlyWallet implements IReadonlyWallet {
|
|
|
3403
3085
|
* ```typescript
|
|
3404
3086
|
* const wallet = await ServiceWorkerReadonlyWallet.setup({
|
|
3405
3087
|
* serviceWorkerPath: '/service-worker.js',
|
|
3406
|
-
*
|
|
3088
|
+
* arkServer: { url: 'https://arkade.computer' },
|
|
3407
3089
|
* identity: ReadonlySingleKey.fromPublicKey('your_public_key_hex')
|
|
3408
3090
|
* });
|
|
3409
3091
|
* ```
|
|
@@ -3417,20 +3099,8 @@ declare class ServiceWorkerReadonlyWallet implements IReadonlyWallet {
|
|
|
3417
3099
|
onEvent: (response: WalletUpdaterResponse) => void;
|
|
3418
3100
|
isComplete: (response: WalletUpdaterResponse) => boolean;
|
|
3419
3101
|
}): Promise<WalletUpdaterResponse>;
|
|
3420
|
-
/**
|
|
3421
|
-
* Produce a serialized envelope for the wallet's identity. The base
|
|
3422
|
-
* class always emits a readonly envelope; `ServiceWorkerWallet`
|
|
3423
|
-
* overrides to emit a signing envelope.
|
|
3424
|
-
*/
|
|
3425
|
-
protected serializeIdentity(): Promise<SerializedIdentity>;
|
|
3426
|
-
/**
|
|
3427
|
-
* Return the cached init config, or rebuild one from live instance
|
|
3428
|
-
* state when the cache was never populated. Recovery path for
|
|
3429
|
-
* SDK-factory-created wallets; manual constructor bypasses do not
|
|
3430
|
-
* retain enough state here and will hit the "never initialized" throw.
|
|
3431
|
-
*/
|
|
3102
|
+
/** The init config cached by `create()`; manually constructed wallets have none. */
|
|
3432
3103
|
protected buildInitConfig(): Promise<MessageBusInitConfig>;
|
|
3433
|
-
/** Minimal INIT_WALLET payload used on reinitialize when the cache is gone. */
|
|
3434
3104
|
protected buildInitWalletPayload(): RequestInitWallet["payload"];
|
|
3435
3105
|
private reinitialize;
|
|
3436
3106
|
/**
|
|
@@ -3486,7 +3156,7 @@ declare class ServiceWorkerReadonlyWallet implements IReadonlyWallet {
|
|
|
3486
3156
|
* and falling back to `GET_VTXOS` there would silently spend ungated coins.
|
|
3487
3157
|
* Fail closed — loud and recoverable — rather than make the gate advisory.
|
|
3488
3158
|
*/
|
|
3489
|
-
getSpendableVtxos(filter?:
|
|
3159
|
+
getSpendableVtxos(filter?: GetSpendableVtxosFilter): Promise<NormalizedExtendedVirtualCoin[]>;
|
|
3490
3160
|
/**
|
|
3491
3161
|
* Trigger a wallet reload inside the service worker.
|
|
3492
3162
|
*
|
|
@@ -3502,9 +3172,12 @@ declare class ServiceWorkerWallet extends ServiceWorkerReadonlyWallet implements
|
|
|
3502
3172
|
readonly identity: Identity;
|
|
3503
3173
|
private readonly _assetManager;
|
|
3504
3174
|
private readonly hasDelegate;
|
|
3175
|
+
private _restoreInFlight?;
|
|
3176
|
+
private _concurrentSpending;
|
|
3177
|
+
/** @see WalletConfig.concurrentSpending */
|
|
3178
|
+
get concurrentSpending(): boolean;
|
|
3505
3179
|
protected constructor(serviceWorker: ServiceWorker, identity: Identity, walletRepository: WalletRepository, contractRepository: ContractRepository, messageTag: string, hasDelegate: boolean);
|
|
3506
3180
|
get assetManager(): IAssetManager;
|
|
3507
|
-
protected serializeIdentity(): Promise<SerializedIdentity>;
|
|
3508
3181
|
static create(options: ServiceWorkerWalletCreateOptions): Promise<ServiceWorkerWallet>;
|
|
3509
3182
|
/**
|
|
3510
3183
|
* Simplified setup method that handles service worker registration
|
|
@@ -3514,7 +3187,7 @@ declare class ServiceWorkerWallet extends ServiceWorkerReadonlyWallet implements
|
|
|
3514
3187
|
* ```typescript
|
|
3515
3188
|
* const wallet = await ServiceWorkerWallet.setup({
|
|
3516
3189
|
* serviceWorkerPath: '/service-worker.js',
|
|
3517
|
-
*
|
|
3190
|
+
* arkServer: { url: 'https://arkade.computer' },
|
|
3518
3191
|
* identity: MnemonicIdentity.fromMnemonic('abandon abandon...')
|
|
3519
3192
|
* });
|
|
3520
3193
|
* ```
|
|
@@ -3570,7 +3243,6 @@ declare class ServiceWorkerWallet extends ServiceWorkerReadonlyWallet implements
|
|
|
3570
3243
|
* readonly class would promise something the boundary rejects.
|
|
3571
3244
|
*/
|
|
3572
3245
|
getArkadeBroadcaster(): Promise<ArkadeBroadcaster>;
|
|
3573
|
-
sendBitcoin(params: SendBitcoinParams): Promise<string>;
|
|
3574
3246
|
settle(params?: SettleParams, callback?: (event: SettlementEvent) => void): Promise<string>;
|
|
3575
3247
|
/**
|
|
3576
3248
|
* Explicitly recover this wallet's contracts and balance on a fresh repo.
|
|
@@ -3586,15 +3258,14 @@ declare class ServiceWorkerWallet extends ServiceWorkerReadonlyWallet implements
|
|
|
3586
3258
|
restore(opts?: {
|
|
3587
3259
|
gapLimit?: number;
|
|
3588
3260
|
}): Promise<void>;
|
|
3261
|
+
private _restoreWorkerWallet;
|
|
3589
3262
|
send(...args: [SendParams] | [Recipient, ...Recipient[]]): Promise<string>;
|
|
3590
3263
|
getDelegateManager(): Promise<IDelegateManager | undefined>;
|
|
3591
|
-
/** @deprecated alias for @see ServiceWorkerWallet.getDelegateManager */
|
|
3592
|
-
getDelegatorManager(): Promise<IDelegateManager | undefined>;
|
|
3593
3264
|
getVtxoManager(): Promise<IVtxoManager>;
|
|
3594
3265
|
}
|
|
3595
3266
|
|
|
3596
3267
|
/**
|
|
3597
|
-
* A zero-value anchor output.
|
|
3268
|
+
* A zero-value anchor output. An ark tx overrides the amount to carry its fee.
|
|
3598
3269
|
*/
|
|
3599
3270
|
declare const P2A: {
|
|
3600
3271
|
script: Uint8Array<ArrayBuffer>;
|
|
@@ -4074,7 +3745,7 @@ declare class CachingArkProvider implements ArkProvider {
|
|
|
4074
3745
|
/** Releases the inner provider's server-info subscription. */
|
|
4075
3746
|
dispose(): void;
|
|
4076
3747
|
get serverUrl(): string | undefined;
|
|
4077
|
-
getInfo(): Promise<
|
|
3748
|
+
getInfo(): Promise<ArkadeInfo>;
|
|
4078
3749
|
submitTx(signedArkTx: string, checkpointTxs: string[]): Promise<{
|
|
4079
3750
|
arkTxid: string;
|
|
4080
3751
|
finalArkTx: string;
|
|
@@ -4090,7 +3761,7 @@ declare class CachingArkProvider implements ArkProvider {
|
|
|
4090
3761
|
getEventStream(signal: AbortSignal, topics: string[]): AsyncIterableIterator<SettlementEvent>;
|
|
4091
3762
|
getTransactionsStream(signal: AbortSignal): AsyncIterableIterator<TxNotificationEvent>;
|
|
4092
3763
|
getPendingTxs(intent: SignedIntent<Intent.GetPendingTxMessage>): Promise<PendingTx[]>;
|
|
4093
|
-
onServerInfoChanged(listener: (info:
|
|
3764
|
+
onServerInfoChanged(listener: (info: ArkadeInfo) => void): () => void;
|
|
4094
3765
|
}
|
|
4095
3766
|
|
|
4096
3767
|
type ArkTxInput = {
|
|
@@ -4212,6 +3883,9 @@ declare function assertSubmittedArkTxid(response: {
|
|
|
4212
3883
|
interface VerifyServerSignatures {
|
|
4213
3884
|
/** The Ark server's key; x-only or compressed, both accepted. */
|
|
4214
3885
|
serverPubkey: Uint8Array;
|
|
3886
|
+
/** Retired signer keys the server still advertises: a leaf built before a
|
|
3887
|
+
* rotation names one of these, and it is the leaf that decides. */
|
|
3888
|
+
deprecatedServerPubkeys?: Uint8Array[];
|
|
4215
3889
|
}
|
|
4216
3890
|
/**
|
|
4217
3891
|
* Build, sign, submit, and finalize an offchain transaction whose every input
|
|
@@ -4236,6 +3910,21 @@ declare function signAndSubmitOffchainTx(params: {
|
|
|
4236
3910
|
/** Forwarded to {@link submitOffchainTx}; omitted, nothing is checked. */
|
|
4237
3911
|
verifyServerSignatures?: VerifyServerSignatures;
|
|
4238
3912
|
}): Promise<string>;
|
|
3913
|
+
/**
|
|
3914
|
+
* Sign the caller's inputs of a pre-built offchain tx and submit it through the emulator, which
|
|
3915
|
+
* co-signs and finalizes it with arkd. The checkpoints of `inputIndexes` are signed up front: the
|
|
3916
|
+
* emulator verifies them before its own arkd handshake. An emulator-only leaf passes no inputs and
|
|
3917
|
+
* no signer.
|
|
3918
|
+
*/
|
|
3919
|
+
declare function submitViaEmulator(emulator: Pick<EmulatorProvider, "submitTx">, offchainTx: OffchainTx, signer: {
|
|
3920
|
+
sign(tx: Transaction, inputIndexes?: number[]): Promise<Transaction>;
|
|
3921
|
+
} | undefined, opts: {
|
|
3922
|
+
inputIndexes: number[];
|
|
3923
|
+
}): Promise<{
|
|
3924
|
+
txid: string;
|
|
3925
|
+
signedArkTx: string;
|
|
3926
|
+
signedCheckpointTxs: string[];
|
|
3927
|
+
}>;
|
|
4239
3928
|
/**
|
|
4240
3929
|
* Decorate a signer so it reveals `preimage` on every input it signs.
|
|
4241
3930
|
*
|
|
@@ -4490,17 +4179,19 @@ declare class ArkNote implements ExtendedCoin {
|
|
|
4490
4179
|
}
|
|
4491
4180
|
|
|
4492
4181
|
/**
|
|
4493
|
-
* ArkadeCash is a bearer instrument for the
|
|
4182
|
+
* ArkadeCash is a bearer instrument for the Arkade.
|
|
4494
4183
|
* It encodes a private key and contract parameters as a bech32m string,
|
|
4495
4184
|
* enabling wallet-to-wallet transfers without address exchange.
|
|
4496
4185
|
*
|
|
4497
|
-
* Format: arkadecash1... (bech32m encoded)
|
|
4186
|
+
* Format: arkadecash1... / tarkadecash1... (bech32m encoded)
|
|
4498
4187
|
* Payload: version (1 byte) + private key (32 bytes) + server pubkey (32 bytes) + csv timelock sequence (4 bytes)
|
|
4499
4188
|
*/
|
|
4500
4189
|
declare class ArkadeCash {
|
|
4501
4190
|
readonly csvTimelock: RelativeTimelock;
|
|
4502
4191
|
readonly hrp: string;
|
|
4503
4192
|
static readonly DefaultHRP = "arkadecash";
|
|
4193
|
+
/** The only prefixes minted or accepted: mainnet and test networks. */
|
|
4194
|
+
static readonly HRPs: readonly string[];
|
|
4504
4195
|
static readonly Version = 0;
|
|
4505
4196
|
static readonly PayloadLength: number;
|
|
4506
4197
|
private readonly _privateKey;
|
|
@@ -4521,76 +4212,6 @@ declare class ArkadeCash {
|
|
|
4521
4212
|
address(addressHrp: string): ArkAddress;
|
|
4522
4213
|
}
|
|
4523
4214
|
|
|
4524
|
-
/**
|
|
4525
|
-
* Emulator REST client.
|
|
4526
|
-
*
|
|
4527
|
-
* The emulator is a signing service that executes Arkade scripts
|
|
4528
|
-
* and co-signs transactions when the scripts pass validation.
|
|
4529
|
-
*/
|
|
4530
|
-
|
|
4531
|
-
interface EmulatorInfo {
|
|
4532
|
-
signerPubkey: string;
|
|
4533
|
-
}
|
|
4534
|
-
interface EmulatorProvider {
|
|
4535
|
-
getInfo(): Promise<EmulatorInfo>;
|
|
4536
|
-
submitTx(arkTx: string, checkpointTxs: string[]): Promise<{
|
|
4537
|
-
signedArkTx: string;
|
|
4538
|
-
signedCheckpointTxs: string[];
|
|
4539
|
-
}>;
|
|
4540
|
-
submitIntent(intent: {
|
|
4541
|
-
proof: string;
|
|
4542
|
-
message: Intent.RegisterMessage;
|
|
4543
|
-
}): Promise<string>;
|
|
4544
|
-
submitFinalization(intent: {
|
|
4545
|
-
proof: string;
|
|
4546
|
-
message: Intent.RegisterMessage;
|
|
4547
|
-
}, forfeits: string[], connectorTree: ConnectorTreeNode[] | null, commitmentTx: string): Promise<{
|
|
4548
|
-
signedForfeits: string[];
|
|
4549
|
-
signedCommitmentTx?: string;
|
|
4550
|
-
}>;
|
|
4551
|
-
submitOnchainTx(tx: string): Promise<{
|
|
4552
|
-
signedTx: string;
|
|
4553
|
-
}>;
|
|
4554
|
-
}
|
|
4555
|
-
interface ConnectorTreeNode {
|
|
4556
|
-
txid: string;
|
|
4557
|
-
tx: string;
|
|
4558
|
-
children: Record<string, string>;
|
|
4559
|
-
}
|
|
4560
|
-
/**
|
|
4561
|
-
* REST-based emulator client.
|
|
4562
|
-
*
|
|
4563
|
-
* @example
|
|
4564
|
-
* ```typescript
|
|
4565
|
-
* const client = new RestEmulatorProvider('http://localhost:7073');
|
|
4566
|
-
* const info = await client.getInfo();
|
|
4567
|
-
* console.log('Emulator pubkey:', info.signerPubkey);
|
|
4568
|
-
* ```
|
|
4569
|
-
*/
|
|
4570
|
-
declare class RestEmulatorProvider implements EmulatorProvider {
|
|
4571
|
-
serverUrl: string;
|
|
4572
|
-
constructor(serverUrl: string);
|
|
4573
|
-
getInfo(): Promise<EmulatorInfo>;
|
|
4574
|
-
submitTx(arkTx: string, checkpointTxs: string[]): Promise<{
|
|
4575
|
-
signedArkTx: string;
|
|
4576
|
-
signedCheckpointTxs: string[];
|
|
4577
|
-
}>;
|
|
4578
|
-
submitIntent(intent: {
|
|
4579
|
-
proof: string;
|
|
4580
|
-
message: Intent.RegisterMessage;
|
|
4581
|
-
}): Promise<string>;
|
|
4582
|
-
submitFinalization(intent: {
|
|
4583
|
-
proof: string;
|
|
4584
|
-
message: Intent.RegisterMessage;
|
|
4585
|
-
}, forfeits: string[], connectorTree: ConnectorTreeNode[] | null, commitmentTx: string): Promise<{
|
|
4586
|
-
signedForfeits: string[];
|
|
4587
|
-
signedCommitmentTx?: string;
|
|
4588
|
-
}>;
|
|
4589
|
-
submitOnchainTx(tx: string): Promise<{
|
|
4590
|
-
signedTx: string;
|
|
4591
|
-
}>;
|
|
4592
|
-
}
|
|
4593
|
-
|
|
4594
4215
|
/**
|
|
4595
4216
|
* Arkade Batch Handler
|
|
4596
4217
|
*
|
|
@@ -5146,16 +4767,18 @@ declare const UnilateralExit: {
|
|
|
5146
4767
|
*
|
|
5147
4768
|
* Everything else (4xx, invalid JSON, schema violations, network mismatch,
|
|
5148
4769
|
* unsupported network) is terminal and returns `false`.
|
|
5149
|
-
*
|
|
5150
|
-
* NOTE (Step 2, Scope 2): this classifies the errors currently produced by the
|
|
5151
|
-
* boot-critical `getInfo` path. Normalizing the indexer's per-branch
|
|
5152
|
-
* `!res.ok` throws and the remaining Ark RPC methods into
|
|
5153
|
-
* {@link ProviderUnavailableError} is the broader Scope-2 work still pending.
|
|
5154
4770
|
*/
|
|
5155
4771
|
declare function isRetryableProviderError(error: unknown): boolean;
|
|
5156
4772
|
|
|
4773
|
+
/** Raised only before provider submission, so callers can release an unsent reservation. */
|
|
4774
|
+
declare class SendDeadlineExceededError extends Error {
|
|
4775
|
+
constructor(validUntil: number);
|
|
4776
|
+
}
|
|
4777
|
+
declare function captureSendDeadline(value: unknown, required?: boolean): number | undefined;
|
|
4778
|
+
declare function assertSendDeadline(validUntil?: number): void;
|
|
4779
|
+
|
|
5157
4780
|
declare function validateConnectorsTxGraph(settlementTxB64: string, connectorsGraph: TxTree): void;
|
|
5158
|
-
declare function validateVtxoTxGraph(graph: TxTree, roundTransaction: Transaction
|
|
4781
|
+
declare function validateVtxoTxGraph(graph: TxTree, roundTransaction: Transaction, sweepTapTreeRoot: Uint8Array): void;
|
|
5159
4782
|
|
|
5160
4783
|
/**
|
|
5161
4784
|
* Assert the commitment tx received at batch finalization is the one validated
|
|
@@ -5188,6 +4811,19 @@ declare function assertFinalCommitmentMatchesValidated(finalCommitmentTx: Transa
|
|
|
5188
4811
|
*/
|
|
5189
4812
|
declare function validateBatchRecipients(commitmentTx: Transaction, vtxoTreeLeaves: Transaction[], recipients: Recipient[], network: Network): void;
|
|
5190
4813
|
|
|
4814
|
+
/**
|
|
4815
|
+
* Decode and validate a server-supplied `checkpointTapscript`.
|
|
4816
|
+
*
|
|
4817
|
+
* Every offchain send/claim builds its checkpoint outputs' server-claim leaf from this script, so
|
|
4818
|
+
* a sub-floor or wrong-pubkey value lets the operator sweep an in-flight checkpoint before it
|
|
4819
|
+
* settles. This is the sole gate: callers must use the returned script, not decode their own.
|
|
4820
|
+
*
|
|
4821
|
+
* @throws {ServerResponseMismatchError} if the script fails to decode, its
|
|
4822
|
+
* timelock is out of policy, or its pubkey does not match
|
|
4823
|
+
* `advertisedForfeitPubkey` (when set).
|
|
4824
|
+
*/
|
|
4825
|
+
declare function assertValidServerUnrollScript(checkpointTapscript: string, network: Network, advertisedForfeitPubkey?: Bytes): CSVMultisigTapscript.Type;
|
|
4826
|
+
|
|
5191
4827
|
/**
|
|
5192
4828
|
* Build a forfeit transaction that spends the provided inputs to a single forfeit output.
|
|
5193
4829
|
*
|
|
@@ -5296,14 +4932,16 @@ declare class Extension {
|
|
|
5296
4932
|
/**
|
|
5297
4933
|
* Arkade Script Opcodes
|
|
5298
4934
|
*
|
|
5299
|
-
* This module defines ONLY Arkade-specific opcodes (0xb3, 0xc3-
|
|
4935
|
+
* This module defines ONLY Arkade-specific opcodes (0xb3, 0xbb, 0xc3-0xf8).
|
|
5300
4936
|
* Standard Bitcoin opcodes are imported from @scure/btc-signer.
|
|
5301
4937
|
*
|
|
5302
|
-
* Reference: arkade-os/emulator
|
|
4938
|
+
* Reference: arkade-os/emulator pkg/arkade/opcode.go.
|
|
4939
|
+
* Byte 0xdc is OP_CHECKTIME, matching emulator v0.0.8 and compiler artifacts.
|
|
5303
4940
|
*/
|
|
5304
4941
|
|
|
5305
4942
|
declare const ARKADE_OP: {
|
|
5306
4943
|
readonly MERKLEBRANCHVERIFY: 179;
|
|
4944
|
+
readonly PUT: 187;
|
|
5307
4945
|
readonly DIGEST: 195;
|
|
5308
4946
|
readonly SHA256INITIALIZE: 196;
|
|
5309
4947
|
readonly SHA256UPDATE: 197;
|
|
@@ -5327,6 +4965,8 @@ declare const ARKADE_OP: {
|
|
|
5327
4965
|
readonly BIN2NUM: 216;
|
|
5328
4966
|
readonly REVERSEBYTES: 217;
|
|
5329
4967
|
readonly MODEXP: 218;
|
|
4968
|
+
readonly PUSHEXPIRY: 219;
|
|
4969
|
+
readonly CHECKTIME: 220;
|
|
5330
4970
|
readonly ECADD: 224;
|
|
5331
4971
|
readonly ECMUL: 225;
|
|
5332
4972
|
readonly ECPAIRING: 226;
|
|
@@ -5350,6 +4990,8 @@ declare const ARKADE_OP: {
|
|
|
5350
4990
|
readonly INSPECTPACKET: 244;
|
|
5351
4991
|
readonly INSPECTINPUTPACKET: 245;
|
|
5352
4992
|
readonly SIGHASH: 246;
|
|
4993
|
+
readonly TUNNEL: 247;
|
|
4994
|
+
readonly INSPECTINTENTMESSAGE: 248;
|
|
5353
4995
|
};
|
|
5354
4996
|
declare const ARKADE_OPCODES: number[];
|
|
5355
4997
|
declare const ARKADE_OPCODE_NAMES: Record<number, string>;
|
|
@@ -5398,6 +5040,7 @@ declare function getOpcodeValue(name: string): number | undefined;
|
|
|
5398
5040
|
*/
|
|
5399
5041
|
declare const ARKADE_OPS: {
|
|
5400
5042
|
readonly MERKLEBRANCHVERIFY: 179;
|
|
5043
|
+
readonly PUT: 187;
|
|
5401
5044
|
readonly DIGEST: 195;
|
|
5402
5045
|
readonly SHA256INITIALIZE: 196;
|
|
5403
5046
|
readonly SHA256UPDATE: 197;
|
|
@@ -5421,6 +5064,8 @@ declare const ARKADE_OPS: {
|
|
|
5421
5064
|
readonly BIN2NUM: 216;
|
|
5422
5065
|
readonly REVERSEBYTES: 217;
|
|
5423
5066
|
readonly MODEXP: 218;
|
|
5067
|
+
readonly PUSHEXPIRY: 219;
|
|
5068
|
+
readonly CHECKTIME: 220;
|
|
5424
5069
|
readonly ECADD: 224;
|
|
5425
5070
|
readonly ECMUL: 225;
|
|
5426
5071
|
readonly ECPAIRING: 226;
|
|
@@ -5444,119 +5089,121 @@ declare const ARKADE_OPS: {
|
|
|
5444
5089
|
readonly INSPECTPACKET: 244;
|
|
5445
5090
|
readonly INSPECTINPUTPACKET: 245;
|
|
5446
5091
|
readonly SIGHASH: 246;
|
|
5447
|
-
readonly
|
|
5448
|
-
readonly
|
|
5449
|
-
readonly
|
|
5450
|
-
readonly
|
|
5451
|
-
readonly
|
|
5452
|
-
readonly
|
|
5453
|
-
readonly
|
|
5454
|
-
readonly
|
|
5455
|
-
readonly
|
|
5456
|
-
readonly
|
|
5457
|
-
readonly
|
|
5458
|
-
readonly
|
|
5459
|
-
readonly
|
|
5460
|
-
readonly
|
|
5461
|
-
readonly
|
|
5462
|
-
readonly
|
|
5463
|
-
readonly
|
|
5464
|
-
readonly
|
|
5465
|
-
readonly
|
|
5466
|
-
readonly
|
|
5467
|
-
readonly
|
|
5468
|
-
readonly
|
|
5469
|
-
readonly
|
|
5470
|
-
readonly
|
|
5471
|
-
readonly
|
|
5472
|
-
readonly
|
|
5473
|
-
readonly
|
|
5474
|
-
readonly
|
|
5475
|
-
readonly
|
|
5476
|
-
readonly
|
|
5477
|
-
readonly
|
|
5478
|
-
readonly
|
|
5479
|
-
readonly
|
|
5480
|
-
readonly
|
|
5481
|
-
readonly
|
|
5482
|
-
readonly
|
|
5483
|
-
readonly '
|
|
5484
|
-
readonly '
|
|
5485
|
-
readonly '
|
|
5486
|
-
readonly '
|
|
5487
|
-
readonly
|
|
5488
|
-
readonly
|
|
5489
|
-
readonly
|
|
5490
|
-
readonly
|
|
5491
|
-
readonly
|
|
5492
|
-
readonly
|
|
5493
|
-
readonly
|
|
5494
|
-
readonly
|
|
5495
|
-
readonly
|
|
5496
|
-
readonly
|
|
5497
|
-
readonly
|
|
5498
|
-
readonly
|
|
5499
|
-
readonly
|
|
5500
|
-
readonly
|
|
5501
|
-
readonly
|
|
5502
|
-
readonly
|
|
5503
|
-
readonly
|
|
5504
|
-
readonly
|
|
5505
|
-
readonly
|
|
5506
|
-
readonly
|
|
5507
|
-
readonly
|
|
5508
|
-
readonly
|
|
5509
|
-
readonly
|
|
5510
|
-
readonly
|
|
5511
|
-
readonly
|
|
5512
|
-
readonly
|
|
5513
|
-
readonly '
|
|
5514
|
-
readonly '
|
|
5515
|
-
readonly
|
|
5516
|
-
readonly
|
|
5517
|
-
readonly
|
|
5518
|
-
readonly
|
|
5519
|
-
readonly
|
|
5520
|
-
readonly
|
|
5521
|
-
readonly
|
|
5522
|
-
readonly
|
|
5523
|
-
readonly
|
|
5524
|
-
readonly
|
|
5525
|
-
readonly
|
|
5526
|
-
readonly
|
|
5527
|
-
readonly
|
|
5528
|
-
readonly
|
|
5529
|
-
readonly
|
|
5530
|
-
readonly
|
|
5531
|
-
readonly
|
|
5532
|
-
readonly
|
|
5533
|
-
readonly
|
|
5534
|
-
readonly
|
|
5535
|
-
readonly
|
|
5536
|
-
readonly
|
|
5537
|
-
readonly
|
|
5538
|
-
readonly
|
|
5539
|
-
readonly
|
|
5540
|
-
readonly
|
|
5541
|
-
readonly
|
|
5542
|
-
readonly
|
|
5543
|
-
readonly
|
|
5544
|
-
readonly
|
|
5545
|
-
readonly
|
|
5546
|
-
readonly
|
|
5547
|
-
readonly
|
|
5548
|
-
readonly
|
|
5549
|
-
readonly
|
|
5550
|
-
readonly
|
|
5551
|
-
readonly
|
|
5552
|
-
readonly
|
|
5553
|
-
readonly
|
|
5554
|
-
readonly
|
|
5555
|
-
readonly
|
|
5556
|
-
readonly
|
|
5557
|
-
readonly
|
|
5558
|
-
readonly
|
|
5559
|
-
readonly
|
|
5092
|
+
readonly TUNNEL: 247;
|
|
5093
|
+
readonly INSPECTINTENTMESSAGE: 248;
|
|
5094
|
+
readonly OP_0: 0;
|
|
5095
|
+
readonly PUSHDATA1: 76;
|
|
5096
|
+
readonly PUSHDATA2: 77;
|
|
5097
|
+
readonly PUSHDATA4: 78;
|
|
5098
|
+
readonly '1NEGATE': 79;
|
|
5099
|
+
readonly RESERVED: 80;
|
|
5100
|
+
readonly OP_1: 81;
|
|
5101
|
+
readonly OP_2: 82;
|
|
5102
|
+
readonly OP_3: 83;
|
|
5103
|
+
readonly OP_4: 84;
|
|
5104
|
+
readonly OP_5: 85;
|
|
5105
|
+
readonly OP_6: 86;
|
|
5106
|
+
readonly OP_7: 87;
|
|
5107
|
+
readonly OP_8: 88;
|
|
5108
|
+
readonly OP_9: 89;
|
|
5109
|
+
readonly OP_10: 90;
|
|
5110
|
+
readonly OP_11: 91;
|
|
5111
|
+
readonly OP_12: 92;
|
|
5112
|
+
readonly OP_13: 93;
|
|
5113
|
+
readonly OP_14: 94;
|
|
5114
|
+
readonly OP_15: 95;
|
|
5115
|
+
readonly OP_16: 96;
|
|
5116
|
+
readonly NOP: 97;
|
|
5117
|
+
readonly VER: 98;
|
|
5118
|
+
readonly IF: 99;
|
|
5119
|
+
readonly NOTIF: 100;
|
|
5120
|
+
readonly VERIF: 101;
|
|
5121
|
+
readonly VERNOTIF: 102;
|
|
5122
|
+
readonly ELSE: 103;
|
|
5123
|
+
readonly ENDIF: 104;
|
|
5124
|
+
readonly VERIFY: 105;
|
|
5125
|
+
readonly RETURN: 106;
|
|
5126
|
+
readonly TOALTSTACK: 107;
|
|
5127
|
+
readonly FROMALTSTACK: 108;
|
|
5128
|
+
readonly '2DROP': 109;
|
|
5129
|
+
readonly '2DUP': 110;
|
|
5130
|
+
readonly '3DUP': 111;
|
|
5131
|
+
readonly '2OVER': 112;
|
|
5132
|
+
readonly '2ROT': 113;
|
|
5133
|
+
readonly '2SWAP': 114;
|
|
5134
|
+
readonly IFDUP: 115;
|
|
5135
|
+
readonly DEPTH: 116;
|
|
5136
|
+
readonly DROP: 117;
|
|
5137
|
+
readonly DUP: 118;
|
|
5138
|
+
readonly NIP: 119;
|
|
5139
|
+
readonly OVER: 120;
|
|
5140
|
+
readonly PICK: 121;
|
|
5141
|
+
readonly ROLL: 122;
|
|
5142
|
+
readonly ROT: 123;
|
|
5143
|
+
readonly SWAP: 124;
|
|
5144
|
+
readonly TUCK: 125;
|
|
5145
|
+
readonly CAT: 126;
|
|
5146
|
+
readonly SUBSTR: 127;
|
|
5147
|
+
readonly LEFT: 128;
|
|
5148
|
+
readonly RIGHT: 129;
|
|
5149
|
+
readonly SIZE: 130;
|
|
5150
|
+
readonly INVERT: 131;
|
|
5151
|
+
readonly AND: 132;
|
|
5152
|
+
readonly OR: 133;
|
|
5153
|
+
readonly XOR: 134;
|
|
5154
|
+
readonly EQUAL: 135;
|
|
5155
|
+
readonly EQUALVERIFY: 136;
|
|
5156
|
+
readonly RESERVED1: 137;
|
|
5157
|
+
readonly RESERVED2: 138;
|
|
5158
|
+
readonly '1ADD': 139;
|
|
5159
|
+
readonly '1SUB': 140;
|
|
5160
|
+
readonly '2MUL': 141;
|
|
5161
|
+
readonly '2DIV': 142;
|
|
5162
|
+
readonly NEGATE: 143;
|
|
5163
|
+
readonly ABS: 144;
|
|
5164
|
+
readonly NOT: 145;
|
|
5165
|
+
readonly '0NOTEQUAL': 146;
|
|
5166
|
+
readonly ADD: 147;
|
|
5167
|
+
readonly SUB: 148;
|
|
5168
|
+
readonly MUL: 149;
|
|
5169
|
+
readonly DIV: 150;
|
|
5170
|
+
readonly MOD: 151;
|
|
5171
|
+
readonly LSHIFT: 152;
|
|
5172
|
+
readonly RSHIFT: 153;
|
|
5173
|
+
readonly BOOLAND: 154;
|
|
5174
|
+
readonly BOOLOR: 155;
|
|
5175
|
+
readonly NUMEQUAL: 156;
|
|
5176
|
+
readonly NUMEQUALVERIFY: 157;
|
|
5177
|
+
readonly NUMNOTEQUAL: 158;
|
|
5178
|
+
readonly LESSTHAN: 159;
|
|
5179
|
+
readonly GREATERTHAN: 160;
|
|
5180
|
+
readonly LESSTHANOREQUAL: 161;
|
|
5181
|
+
readonly GREATERTHANOREQUAL: 162;
|
|
5182
|
+
readonly MIN: 163;
|
|
5183
|
+
readonly MAX: 164;
|
|
5184
|
+
readonly WITHIN: 165;
|
|
5185
|
+
readonly RIPEMD160: 166;
|
|
5186
|
+
readonly SHA1: 167;
|
|
5187
|
+
readonly SHA256: 168;
|
|
5188
|
+
readonly HASH160: 169;
|
|
5189
|
+
readonly HASH256: 170;
|
|
5190
|
+
readonly CODESEPARATOR: 171;
|
|
5191
|
+
readonly CHECKSIG: 172;
|
|
5192
|
+
readonly CHECKSIGVERIFY: 173;
|
|
5193
|
+
readonly CHECKMULTISIG: 174;
|
|
5194
|
+
readonly CHECKMULTISIGVERIFY: 175;
|
|
5195
|
+
readonly NOP1: 176;
|
|
5196
|
+
readonly CHECKLOCKTIMEVERIFY: 177;
|
|
5197
|
+
readonly CHECKSEQUENCEVERIFY: 178;
|
|
5198
|
+
readonly NOP4: 179;
|
|
5199
|
+
readonly NOP5: 180;
|
|
5200
|
+
readonly NOP6: 181;
|
|
5201
|
+
readonly NOP7: 182;
|
|
5202
|
+
readonly NOP8: 183;
|
|
5203
|
+
readonly NOP9: 184;
|
|
5204
|
+
readonly NOP10: 185;
|
|
5205
|
+
readonly CHECKSIGADD: 186;
|
|
5206
|
+
readonly INVALID: 255;
|
|
5560
5207
|
};
|
|
5561
5208
|
/** A single script operation: opcode string key, raw bytes, number, or bigint */
|
|
5562
5209
|
type ArkadeScriptOP = keyof typeof ARKADE_OPS | Uint8Array | number | bigint;
|
|
@@ -5678,53 +5325,80 @@ declare namespace bignum {
|
|
|
5678
5325
|
export { bignum_BIGNUM_MAX_BYTES as BIGNUM_MAX_BYTES, bignum_decode as decode, bignum_encode as encode };
|
|
5679
5326
|
}
|
|
5680
5327
|
|
|
5328
|
+
/**
|
|
5329
|
+
* Read the JSON `arkadec` writes into a {@link Program}: `$param` placeholders,
|
|
5330
|
+
* @scure opcode names, and one structured tapleaf per compiler leaf.
|
|
5331
|
+
*/
|
|
5332
|
+
|
|
5333
|
+
interface ArtifactParameter {
|
|
5334
|
+
name: string;
|
|
5335
|
+
type: string;
|
|
5336
|
+
}
|
|
5337
|
+
interface ArtifactStruct {
|
|
5338
|
+
name: string;
|
|
5339
|
+
fields: ArtifactParameter[];
|
|
5340
|
+
}
|
|
5341
|
+
interface ArtifactWitnessElement {
|
|
5342
|
+
name: string;
|
|
5343
|
+
type: string;
|
|
5344
|
+
encoding?: string;
|
|
5345
|
+
injected?: boolean;
|
|
5346
|
+
}
|
|
5347
|
+
interface ArtifactLeaf {
|
|
5348
|
+
name: string;
|
|
5349
|
+
witness?: ArtifactWitnessElement[];
|
|
5350
|
+
asm: string[];
|
|
5351
|
+
}
|
|
5352
|
+
interface ArtifactCovenant {
|
|
5353
|
+
inputs: ArtifactParameter[];
|
|
5354
|
+
asm: string[];
|
|
5355
|
+
}
|
|
5356
|
+
interface ArtifactGroup {
|
|
5357
|
+
name: string;
|
|
5358
|
+
arkade?: ArtifactCovenant;
|
|
5359
|
+
leaves: ArtifactLeaf[];
|
|
5360
|
+
}
|
|
5361
|
+
interface ContractArtifact {
|
|
5362
|
+
formatVersion?: number;
|
|
5363
|
+
contractName: string;
|
|
5364
|
+
constructorInputs: ArtifactParameter[];
|
|
5365
|
+
structs?: ArtifactStruct[];
|
|
5366
|
+
functions: ArtifactGroup[];
|
|
5367
|
+
}
|
|
5368
|
+
/** `true` when `value` is an arkadec artifact rather than a Program. */
|
|
5369
|
+
declare function isContractArtifact(value: unknown): value is ContractArtifact;
|
|
5370
|
+
/** Adds `server`, and one param per child-output placeholder for the caller to bind to that output key. */
|
|
5371
|
+
declare function programFromArtifact(artifact: ContractArtifact): Program;
|
|
5372
|
+
|
|
5681
5373
|
/**
|
|
5682
5374
|
* Arkade Contract — artifact-driven, high-level covenant API.
|
|
5683
5375
|
*
|
|
5684
|
-
*
|
|
5685
|
-
*
|
|
5686
|
-
*
|
|
5687
|
-
*
|
|
5688
|
-
*
|
|
5689
|
-
*
|
|
5690
|
-
*
|
|
5691
|
-
*
|
|
5692
|
-
*
|
|
5693
|
-
*
|
|
5694
|
-
*
|
|
5695
|
-
*
|
|
5696
|
-
*
|
|
5697
|
-
*
|
|
5698
|
-
*
|
|
5699
|
-
*
|
|
5700
|
-
*
|
|
5701
|
-
*
|
|
5702
|
-
*
|
|
5703
|
-
* Contract functions are strongly typed from the program's literal shape: a
|
|
5704
|
-
* function declaring `inputs: [{ name: "preimage", type: "bytes" }]` produces a
|
|
5705
|
-
* `functions.claim(preimage: Uint8Array)` call signature. The type flows through
|
|
5706
|
-
* `arkade.contract(...)` automatically for inline literals; for a program stored
|
|
5707
|
-
* in a variable, annotate it with `satisfies Program` to preserve the literal
|
|
5708
|
-
* type (a plain `: Program` annotation would widen it away).
|
|
5709
|
-
*
|
|
5710
|
-
* Constructor `params` follow the same convention: bare name strings are
|
|
5711
|
-
* documentation only, while typed descriptors `{ name, type }` (the form the
|
|
5712
|
-
* ArkadeScript compiler emits) make the list authoritative — every declared
|
|
5713
|
-
* param must be bound, every `$name` reference must be declared, and bound
|
|
5714
|
-
* values are validated against their type at compilation.
|
|
5715
|
-
*
|
|
5716
|
-
* A covenant spend needs an `indexer`, not just an `emulator`: the co-signing
|
|
5717
|
-
* service resolves each input's prevout pkScript from the previous ark tx the
|
|
5718
|
-
* PSBT carries, and only the indexer can supply those bytes. Pure tapscript
|
|
5719
|
-
* spends go straight to arkd and need neither.
|
|
5376
|
+
* A contract is a {@link Program}: named functions, each split into a `tapscript` segment
|
|
5377
|
+
* enforced on-chain and an `arkadeScript` segment emulated by the co-signing service. Compiler
|
|
5378
|
+
* artifacts are normalized into this model, sharing the resolver with hand-written programs.
|
|
5379
|
+
* The SDK never interprets scripts; it resolves `$param` placeholders and signers, builds the
|
|
5380
|
+
* taproot tree (co-signer key tweaked by the arkade-script hash) and assembles the spend.
|
|
5381
|
+
*
|
|
5382
|
+
* Compilation lives in {@link ArkadeProgramScript} and is shared with the `"arkade"` contract
|
|
5383
|
+
* handler: pass a `contractManager` to {@link Arkade.connect} and call
|
|
5384
|
+
* {@link ArkadeContract.register} to persist and watch a contract.
|
|
5385
|
+
*
|
|
5386
|
+
* Functions are typed from the program's literal shape (`inputs: [{ name: "preimage", type:
|
|
5387
|
+
* "bytes" }]` → `functions.claim(preimage: Uint8Array)`). For a program stored in a variable use
|
|
5388
|
+
* `satisfies Program`; a `: Program` annotation widens the literal type away. Typed `params`
|
|
5389
|
+
* descriptors `{ name, type }` make the list authoritative (every param bound, every `$name`
|
|
5390
|
+
* declared, values type-checked).
|
|
5391
|
+
*
|
|
5392
|
+
* A covenant spend needs an `indexer` as well as an `emulator`: the co-signer resolves each
|
|
5393
|
+
* input's prevout from the previous ark tx the PSBT carries. Pure tapscript spends need neither.
|
|
5720
5394
|
*
|
|
5721
5395
|
* @example
|
|
5722
5396
|
* ```typescript
|
|
5723
5397
|
* const htlcProgram = {
|
|
5724
|
-
* version:
|
|
5398
|
+
* version: 1,
|
|
5725
5399
|
* name: "htlc", // metadata only — round-tripped, never compiled
|
|
5726
5400
|
* params: [
|
|
5727
|
-
* { name: "hash", type: "
|
|
5401
|
+
* { name: "hash", type: "bytes20" },
|
|
5728
5402
|
* { name: "receiver", type: "pubkey" },
|
|
5729
5403
|
* { name: "amount", type: "int" },
|
|
5730
5404
|
* { name: "server", type: "pubkey" },
|
|
@@ -5748,21 +5422,17 @@ declare namespace bignum {
|
|
|
5748
5422
|
* @module arkade/contract
|
|
5749
5423
|
*/
|
|
5750
5424
|
|
|
5751
|
-
/** The TS type of a single call argument, derived from its {@link InputRef}. */
|
|
5752
|
-
type ArgTsType<R> = R extends InputDef ? ArkadeValueType[R["type"]] : ArkadeArgValue;
|
|
5753
5425
|
/** The argument tuple of a function, derived from its declared `inputs`. */
|
|
5754
|
-
type ArgsTuple<I extends readonly
|
|
5755
|
-
[K in keyof I]:
|
|
5426
|
+
type ArgsTuple<I extends readonly InputDef[]> = {
|
|
5427
|
+
[K in keyof I]: ArkadeValueType[I[K]["type"]];
|
|
5756
5428
|
};
|
|
5757
5429
|
/** The call signature arguments for one function (nullary when `inputs` is absent). */
|
|
5758
5430
|
type FnArgs<F extends ArkadeFunction> = F extends {
|
|
5759
|
-
inputs: infer I extends readonly
|
|
5431
|
+
inputs: infer I extends readonly InputDef[];
|
|
5760
5432
|
} ? ArgsTuple<I> : [];
|
|
5761
5433
|
/**
|
|
5762
|
-
* The statically-typed `functions` map of a contract
|
|
5763
|
-
*
|
|
5764
|
-
* its `inputs`. When the program is the widened {@link Program} (an index
|
|
5765
|
-
* signature), it falls back to the loose {@link CallableFunctions}.
|
|
5434
|
+
* The statically-typed `functions` map of a contract: precisely typed per function for a literal
|
|
5435
|
+
* program, the loose {@link CallableFunctions} for the widened {@link Program}.
|
|
5766
5436
|
*/
|
|
5767
5437
|
type ContractFunctions<P extends Program> = string extends keyof P["functions"] ? CallableFunctions : {
|
|
5768
5438
|
[K in keyof P["functions"]]: (...args: FnArgs<P["functions"][K]>) => ArkadeTransactionBuilder;
|
|
@@ -5773,13 +5443,9 @@ interface Utxo {
|
|
|
5773
5443
|
vout: number;
|
|
5774
5444
|
value: number;
|
|
5775
5445
|
/**
|
|
5776
|
-
* Raw
|
|
5777
|
-
* the
|
|
5778
|
-
*
|
|
5779
|
-
* An override, not the only channel: covenant spends resolve the previous
|
|
5780
|
-
* tx of every input through the client's indexer. Supply it when the tx is
|
|
5781
|
-
* not yet indexable — a recursive covenant spending the output of an ark tx
|
|
5782
|
-
* the caller just built — and the resolved value is suppressed for input 0.
|
|
5446
|
+
* Raw bytes of the ark tx that created this VTXO, attached as input 0's PrevArkTx. Overrides
|
|
5447
|
+
* the indexer-resolved value; supply it when the tx isn't indexable yet (a recursive covenant
|
|
5448
|
+
* spending an ark tx the caller just built).
|
|
5783
5449
|
*/
|
|
5784
5450
|
sourceTx?: Uint8Array;
|
|
5785
5451
|
}
|
|
@@ -5815,33 +5481,64 @@ interface ArkadeSpendResult {
|
|
|
5815
5481
|
}
|
|
5816
5482
|
/** The callable spending paths of a contract. */
|
|
5817
5483
|
type CallableFunctions = Record<string, (...args: ArkadeArgValue[]) => ArkadeTransactionBuilder>;
|
|
5818
|
-
/**
|
|
5819
|
-
* What {@link Arkade} needs from the Arkade server.
|
|
5820
|
-
*
|
|
5821
|
-
* Only `getInfo` is required — see {@link ArkadeConnectOptions.arkade} for why.
|
|
5822
|
-
* Named so a caller building a derivation-only client has a type to import
|
|
5823
|
-
* rather than reaching into the options bag.
|
|
5824
|
-
*/
|
|
5484
|
+
/** What {@link Arkade} needs from the Arkade server; see {@link ArkadeConnectOptions.arkade}. */
|
|
5825
5485
|
type ArkadeServerProvider = Pick<ArkProvider, "getInfo"> & Partial<ArkadeBroadcaster>;
|
|
5826
|
-
/**
|
|
5827
|
-
interface
|
|
5486
|
+
/** Fields shared by both forms of {@link ArkadeConnectOptions}. */
|
|
5487
|
+
interface ArkadeConnectCommonOptions {
|
|
5488
|
+
/** Signer for paths that require a user signature; optional for watch-only. */
|
|
5489
|
+
identity?: Identity;
|
|
5490
|
+
/**
|
|
5491
|
+
* Network for address derivation. Defaults to the network the server
|
|
5492
|
+
* reports on `getInfo` — or the SDK default when the server names none.
|
|
5493
|
+
*/
|
|
5494
|
+
network?: Network;
|
|
5828
5495
|
/**
|
|
5829
|
-
*
|
|
5496
|
+
* Co-sign with this emulator key (33-byte compressed hex) instead of the one pinned for
|
|
5497
|
+
* `network`. Needed after a key rotation ahead of this SDK, for a self-hosted emulator, or on
|
|
5498
|
+
* networks with no pinned key (signet, testnet, a hand-built `Network` — those throw without
|
|
5499
|
+
* it). Setting it means trusting that operator as co-signer.
|
|
5830
5500
|
*
|
|
5831
|
-
*
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
*
|
|
5836
|
-
*
|
|
5837
|
-
*
|
|
5838
|
-
*
|
|
5501
|
+
* @see resolveEmulatorPubkey
|
|
5502
|
+
*/
|
|
5503
|
+
emulatorPubkey?: string;
|
|
5504
|
+
/**
|
|
5505
|
+
* The wallet's contract manager (`wallet.getContractManager()`). Enables
|
|
5506
|
+
* {@link ArkadeContract.register} and {@link ArkadeContract.on}, and makes
|
|
5507
|
+
* {@link ArkadeContract.getUtxos} read repository-backed state for registered contracts
|
|
5508
|
+
* instead of the indexer. Never disposed by {@link Arkade.dispose}.
|
|
5509
|
+
*/
|
|
5510
|
+
contractManager?: IContractManager;
|
|
5511
|
+
}
|
|
5512
|
+
/**
|
|
5513
|
+
* The one-liner form: name the deployment, and `connect` resolves the providers (and, for
|
|
5514
|
+
* `{ network: "bitcoin" }`, the emulator).
|
|
5515
|
+
*/
|
|
5516
|
+
interface ArkadeConnectServiceOptions extends ArkadeConnectCommonOptions {
|
|
5517
|
+
service: ArkadeService;
|
|
5518
|
+
/**
|
|
5519
|
+
* Persist contracts here. The client builds and owns a contract manager over it (with an
|
|
5520
|
+
* in-memory VTXO store), enabling {@link ArkadeContract.register} and
|
|
5521
|
+
* {@link ArkadeContract.on}; {@link Arkade.dispose} stops it. Exclusive with
|
|
5522
|
+
* `contractManager`. Deliberately narrower than the wallet's `StorageConfig`.
|
|
5523
|
+
*/
|
|
5524
|
+
storage?: {
|
|
5525
|
+
contractRepository: ContractRepository;
|
|
5526
|
+
};
|
|
5527
|
+
arkade?: never;
|
|
5528
|
+
emulator?: never;
|
|
5529
|
+
indexer?: never;
|
|
5530
|
+
}
|
|
5531
|
+
/** The provider form: hand over providers you already hold (e.g. a wallet's). */
|
|
5532
|
+
interface ArkadeConnectProviderOptions extends ArkadeConnectCommonOptions {
|
|
5533
|
+
/**
|
|
5534
|
+
* The Arkade server provider. Only `getInfo` is required (enough to derive, register and
|
|
5535
|
+
* inspect contracts); without `submitTx`/`finalizeTx`, `.send()` throws. So a caller already
|
|
5536
|
+
* holding `wallet.getArkadeInfo()` can connect without a second `/v1/info` round-trip.
|
|
5839
5537
|
*/
|
|
5840
5538
|
arkade: ArkadeServerProvider;
|
|
5841
5539
|
/**
|
|
5842
|
-
* The co-signing (introspector/emulator) service.
|
|
5843
|
-
*
|
|
5844
|
-
* tapscript contracts (multisig/timelock/hashlock) don't need it.
|
|
5540
|
+
* The co-signing (introspector/emulator) service. Required only for functions with an
|
|
5541
|
+
* `arkadeScript` (covenant paths).
|
|
5845
5542
|
*/
|
|
5846
5543
|
emulator?: EmulatorProvider;
|
|
5847
5544
|
/**
|
|
@@ -5850,36 +5547,31 @@ interface ArkadeConnectOptions {
|
|
|
5850
5547
|
* {@link attachPrevArkTxs}). Required for covenant spends.
|
|
5851
5548
|
*/
|
|
5852
5549
|
indexer?: Pick<IndexerProvider, "getVtxos" | "getVirtualTxs">;
|
|
5853
|
-
|
|
5854
|
-
|
|
5855
|
-
/** Network for address derivation; defaults to the SDK default. */
|
|
5856
|
-
network?: Network;
|
|
5857
|
-
/**
|
|
5858
|
-
* Co-sign with this emulator key (33-byte compressed hex) instead of the
|
|
5859
|
-
* one pinned for `network`.
|
|
5860
|
-
*
|
|
5861
|
-
* Needed when a network's emulator key has rotated ahead of this SDK, for a
|
|
5862
|
-
* self-hosted emulator, or on a network with no pinned key at all (signet,
|
|
5863
|
-
* testnet, a hand-built `Network` — those throw without it). Setting it
|
|
5864
|
-
* means trusting that operator as co-signer in place of the network's.
|
|
5865
|
-
*
|
|
5866
|
-
* @see resolveEmulatorPubkey
|
|
5867
|
-
*/
|
|
5868
|
-
emulatorPubkey?: string;
|
|
5869
|
-
/**
|
|
5870
|
-
* The wallet's contract manager. When set, contracts created from this
|
|
5871
|
-
* client can {@link ArkadeContract.register} themselves into the standard
|
|
5872
|
-
* contract pipeline (persistence, watching, events), and
|
|
5873
|
-
* {@link ArkadeContract.getUtxos} reads repository-backed state
|
|
5874
|
-
* (offline-first) for registered contracts instead of querying the
|
|
5875
|
-
* indexer directly. Obtain it via `wallet.getContractManager()`.
|
|
5876
|
-
*/
|
|
5877
|
-
contractManager?: IContractManager;
|
|
5550
|
+
service?: never;
|
|
5551
|
+
storage?: never;
|
|
5878
5552
|
}
|
|
5553
|
+
/** Options for {@link Arkade.connect}: `service` and `arkade` are exclusive. */
|
|
5554
|
+
type ArkadeConnectOptions = ArkadeConnectServiceOptions | ArkadeConnectProviderOptions;
|
|
5555
|
+
/** Event types {@link ArkadeContract.on} reports. */
|
|
5556
|
+
type ArkadeContractEventType = "vtxo_received" | "vtxo_spent" | "connection_reset";
|
|
5557
|
+
/** The event an {@link ArkadeContract.on} handle of type `T` receives. */
|
|
5558
|
+
type ArkadeContractEvent<T extends ArkadeContractEventType = ArkadeContractEventType> = T extends "connection_reset" ? Extract<ContractEvent, {
|
|
5559
|
+
type: "connection_reset";
|
|
5560
|
+
}> : Extract<ContractVtxoEvent, {
|
|
5561
|
+
type: T;
|
|
5562
|
+
}>;
|
|
5563
|
+
/** Returned by {@link ArkadeContract.on}. */
|
|
5564
|
+
interface ArkadeContractSubscription {
|
|
5565
|
+
/** Stop delivery to this handle. Idempotent. */
|
|
5566
|
+
off(): void;
|
|
5567
|
+
}
|
|
5568
|
+
type EventHandle = {
|
|
5569
|
+
type: ArkadeContractEventType;
|
|
5570
|
+
callback: (event: ArkadeContractEvent) => void | Promise<void>;
|
|
5571
|
+
};
|
|
5879
5572
|
/**
|
|
5880
|
-
* A connected Arkade client
|
|
5881
|
-
*
|
|
5882
|
-
* so spinning up contracts is synchronous.
|
|
5573
|
+
* A connected Arkade client holding the providers and resolved network constants (server key,
|
|
5574
|
+
* co-signer key, checkpoint closure), so creating contracts is synchronous.
|
|
5883
5575
|
*/
|
|
5884
5576
|
declare class Arkade {
|
|
5885
5577
|
readonly arkProvider: ArkadeServerProvider;
|
|
@@ -5887,15 +5579,13 @@ declare class Arkade {
|
|
|
5887
5579
|
readonly emulator: EmulatorProvider | undefined;
|
|
5888
5580
|
readonly network: Network;
|
|
5889
5581
|
readonly serverKey: Uint8Array;
|
|
5582
|
+
/** Bare protocol delay (blocks below 512, seconds otherwise), resolved only when needed. */
|
|
5583
|
+
readonly serverExitDelay?: bigint;
|
|
5890
5584
|
/**
|
|
5891
|
-
* The co-signer key covenants are built against (33-byte compressed),
|
|
5892
|
-
*
|
|
5893
|
-
*
|
|
5894
|
-
*
|
|
5895
|
-
* emulator's own report. When a claim is refused because the co-signer
|
|
5896
|
-
* disagrees, compare `hex.encode(arkade.emulatorKey)` against the
|
|
5897
|
-
* `signerPubkey` your emulator serves on `/v1/info`: if they differ, the
|
|
5898
|
-
* network rotated and this SDK's pin is stale.
|
|
5585
|
+
* The co-signer key covenants are built against (33-byte compressed), present only when an
|
|
5586
|
+
* emulator is configured. Resolved from the network or `emulatorPubkey`, never the emulator's
|
|
5587
|
+
* own report. If a claim is refused, compare it with the emulator's `/v1/info` `signerPubkey`:
|
|
5588
|
+
* a difference means the network rotated and this SDK's pin is stale.
|
|
5899
5589
|
*/
|
|
5900
5590
|
readonly emulatorKey: Uint8Array | undefined;
|
|
5901
5591
|
readonly checkpoint: CSVMultisigTapscript.Type;
|
|
@@ -5903,20 +5593,46 @@ declare class Arkade {
|
|
|
5903
5593
|
readonly identity?: Identity;
|
|
5904
5594
|
/** The signing identity's x-only public key, resolved at connect — identifies which inputs the wallet signs. */
|
|
5905
5595
|
readonly userKey?: Uint8Array;
|
|
5906
|
-
/** The
|
|
5596
|
+
/** The contract manager, when contract persistence is wired up (passed in or owned). */
|
|
5907
5597
|
readonly contractManager?: IContractManager;
|
|
5598
|
+
/** Whether {@link connect} built {@link contractManager}, so {@link dispose} must stop it. */
|
|
5599
|
+
private readonly ownsContractManager;
|
|
5600
|
+
/** {@link ArkadeContract.on} handles by contract script (hex). */
|
|
5601
|
+
private readonly handles;
|
|
5602
|
+
/** The single `onContractEvent` subscription fanning out to {@link handles}. */
|
|
5603
|
+
private unsubscribeEvents?;
|
|
5604
|
+
private disposed;
|
|
5908
5605
|
private constructor();
|
|
5909
|
-
/**
|
|
5606
|
+
/**
|
|
5607
|
+
* Connect and resolve the server key, checkpoint closure and (if present) the co-signer key.
|
|
5608
|
+
*
|
|
5609
|
+
* @example
|
|
5610
|
+
* ```typescript
|
|
5611
|
+
* const arkade = await Arkade.connect({
|
|
5612
|
+
* service: { network: "bitcoin" },
|
|
5613
|
+
* identity,
|
|
5614
|
+
* storage: { contractRepository },
|
|
5615
|
+
* });
|
|
5616
|
+
* ```
|
|
5617
|
+
*/
|
|
5910
5618
|
static connect(opts: ArkadeConnectOptions): Promise<Arkade>;
|
|
5911
5619
|
/**
|
|
5912
|
-
*
|
|
5913
|
-
*
|
|
5914
|
-
|
|
5915
|
-
|
|
5620
|
+
* Stop event delivery to every {@link ArkadeContract.on} handle and, when {@link connect}
|
|
5621
|
+
* built the contract manager (`storage`), dispose it. A caller-passed manager keeps running.
|
|
5622
|
+
*/
|
|
5623
|
+
dispose(): void;
|
|
5624
|
+
/**
|
|
5625
|
+
* @internal Add a handle for `script`, subscribing to the manager on first use; the last
|
|
5626
|
+
* handle's `off()` releases the subscription.
|
|
5627
|
+
*/
|
|
5628
|
+
addEventHandle(manager: IContractManager, script: string, handle: EventHandle): () => void;
|
|
5629
|
+
private dispatch;
|
|
5630
|
+
/**
|
|
5631
|
+
* Instantiate a contract from a program and its constructor arguments. `const` inference keeps
|
|
5632
|
+
* the program's literal type, so `functions` is strongly typed.
|
|
5916
5633
|
*
|
|
5917
|
-
*
|
|
5918
|
-
*
|
|
5919
|
-
* key respectively; explicit args always win.
|
|
5634
|
+
* Declared `server`/`user` params default to the client's keys. Compiler
|
|
5635
|
+
* artifacts reserve the server key and exit delay to the connected server.
|
|
5920
5636
|
*/
|
|
5921
5637
|
contract<const P extends Program>(program: P, args?: Record<string, ArkadeParamValue>): ArkadeContract<P>;
|
|
5922
5638
|
}
|
|
@@ -5935,11 +5651,8 @@ declare class ArkadeContract<P extends Program = Program> {
|
|
|
5935
5651
|
private readonly compiled;
|
|
5936
5652
|
constructor(client: Arkade, program: P, args?: Record<string, ArkadeParamValue>, keys?: ProgramKeys);
|
|
5937
5653
|
/**
|
|
5938
|
-
* Rebuild a callable contract from a persisted `"arkade"`
|
|
5939
|
-
*
|
|
5940
|
-
* compilation — not the client's current ones — so the derived script and
|
|
5941
|
-
* address stay identical to the registered contract even after a server
|
|
5942
|
-
* signer rotation.
|
|
5654
|
+
* Rebuild a callable contract from a persisted `"arkade"` row. Compiles with the stored keys,
|
|
5655
|
+
* not the client's current ones, so script and address survive a server signer rotation.
|
|
5943
5656
|
*/
|
|
5944
5657
|
static fromContract(client: Arkade, contract: Contract): ArkadeContract;
|
|
5945
5658
|
/** Resolve the {@link TapLeafScript} for a spending path by its index. */
|
|
@@ -5948,16 +5661,11 @@ declare class ArkadeContract<P extends Program = Program> {
|
|
|
5948
5661
|
get address(): string;
|
|
5949
5662
|
/** Taproot output script. */
|
|
5950
5663
|
get pkScript(): Uint8Array;
|
|
5951
|
-
/**
|
|
5952
|
-
* Callable spending paths: `contract.functions.<name>(...args)`. Strongly
|
|
5953
|
-
* typed from the program's literal type — each function's argument types are
|
|
5954
|
-
* derived from its `inputs` descriptors (see {@link ContractFunctions}).
|
|
5955
|
-
*/
|
|
5664
|
+
/** Callable spending paths: `functions.<name>(...args)` (see {@link ContractFunctions}). */
|
|
5956
5665
|
get functions(): ContractFunctions<P>;
|
|
5957
5666
|
/**
|
|
5958
|
-
* The `createContract` payload
|
|
5959
|
-
*
|
|
5960
|
-
* through a manager the client does not hold.
|
|
5667
|
+
* The `createContract` payload (serialized program, args, keys, script, address), for
|
|
5668
|
+
* registering through a manager the client does not hold.
|
|
5961
5669
|
*/
|
|
5962
5670
|
toContractParams(): {
|
|
5963
5671
|
type: string;
|
|
@@ -5966,26 +5674,42 @@ declare class ArkadeContract<P extends Program = Program> {
|
|
|
5966
5674
|
address: string;
|
|
5967
5675
|
};
|
|
5968
5676
|
/**
|
|
5969
|
-
* Persist this contract through the wallet's {@link IContractManager}
|
|
5970
|
-
*
|
|
5971
|
-
* repository, watched for VTXO events, counted in repository-backed
|
|
5972
|
-
* balances, and re-derivable offline via the `"arkade"` contract handler.
|
|
5973
|
-
* Idempotent — re-registering the same script is a no-op.
|
|
5677
|
+
* Persist this contract through the wallet's {@link IContractManager} (stored, watched,
|
|
5678
|
+
* counted in balances, re-derivable via the `"arkade"` handler). Idempotent per script.
|
|
5974
5679
|
*/
|
|
5975
5680
|
register(options?: {
|
|
5976
5681
|
label?: string;
|
|
5977
5682
|
metadata?: Record<string, unknown>;
|
|
5978
5683
|
}): Promise<Contract>;
|
|
5979
5684
|
/**
|
|
5980
|
-
*
|
|
5685
|
+
* Report this contract's activity: `vtxo_received`/`vtxo_spent` for its script, and
|
|
5686
|
+
* `connection_reset` when the manager's event stream reconnects. Registers the contract
|
|
5687
|
+
* (idempotent) so it is persisted and watched; requires a contract manager (`storage` or
|
|
5688
|
+
* `contractManager` on {@link Arkade.connect}).
|
|
5981
5689
|
*
|
|
5982
|
-
*
|
|
5983
|
-
*
|
|
5984
|
-
*
|
|
5690
|
+
* Activity is reported from subscription on — coins that predate it are not replayed. After
|
|
5691
|
+
* subscribing, and on every `connection_reset` (the manager re-syncs silently), read stored
|
|
5692
|
+
* state with {@link getVtxos}.
|
|
5985
5693
|
*
|
|
5986
|
-
*
|
|
5987
|
-
*
|
|
5988
|
-
*
|
|
5694
|
+
* @example
|
|
5695
|
+
* ```typescript
|
|
5696
|
+
* const spent = await htlc.on("vtxo_spent", (e) => console.log(e.vtxos));
|
|
5697
|
+
* const reset = await htlc.on("connection_reset", async () => reconcile(await htlc.getVtxos()));
|
|
5698
|
+
* spent.off();
|
|
5699
|
+
* ```
|
|
5700
|
+
*/
|
|
5701
|
+
on<T extends ArkadeContractEventType>(type: T, callback: (event: ArkadeContractEvent<T>) => void | Promise<void>): Promise<ArkadeContractSubscription>;
|
|
5702
|
+
/**
|
|
5703
|
+
* Every stored VTXO of this contract, spent ones included (`getUtxos` hides those), as the
|
|
5704
|
+
* contract manager last synced them. The recovery read for {@link on}. Empty when the
|
|
5705
|
+
* contract is not registered.
|
|
5706
|
+
*/
|
|
5707
|
+
getVtxos(): Promise<ExtendedContractVtxo[]>;
|
|
5708
|
+
private requireManager;
|
|
5709
|
+
/**
|
|
5710
|
+
* Spendable VTXOs locked by this contract: repository-backed when registered with a
|
|
5711
|
+
* `contractManager`, otherwise a direct indexer query. Both drop spent and unrolled outputs;
|
|
5712
|
+
* only the indexer branch (`spendableOnly`) also drops swept coins.
|
|
5989
5713
|
*/
|
|
5990
5714
|
getUtxos(): Promise<VirtualCoin[]>;
|
|
5991
5715
|
/** Total spendable balance (requires an indexer). */
|
|
@@ -6002,6 +5726,7 @@ declare class ArkadeTransactionBuilder {
|
|
|
6002
5726
|
private readonly outputs;
|
|
6003
5727
|
private readonly fundingCoins;
|
|
6004
5728
|
private readonly assetSpecs;
|
|
5729
|
+
private readonly extraPackets;
|
|
6005
5730
|
private coin?;
|
|
6006
5731
|
private changeScript?;
|
|
6007
5732
|
/** @internal */
|
|
@@ -6014,6 +5739,8 @@ declare class ArkadeTransactionBuilder {
|
|
|
6014
5739
|
fund(coins: ArkTxInput[]): this;
|
|
6015
5740
|
/** Transfer an asset group: which inputs supply it and which outputs receive it. */
|
|
6016
5741
|
withAsset(spec: AssetSpec): this;
|
|
5742
|
+
/** Add an extension packet; reusing the asset or emulator packet's type fails at build. */
|
|
5743
|
+
withPacket(packet: ExtensionPacket): this;
|
|
6017
5744
|
/** Destination for any surplus (inputs − outputs). Required when the spend is not exact. */
|
|
6018
5745
|
change(script: Uint8Array): this;
|
|
6019
5746
|
/** Add an output — `(script, amount)` or a list of outputs. */
|
|
@@ -6062,9 +5789,14 @@ declare const index_ArkadeArgType: typeof ArkadeArgType;
|
|
|
6062
5789
|
declare const index_ArkadeArgValue: typeof ArkadeArgValue;
|
|
6063
5790
|
type index_ArkadeBatchInput = ArkadeBatchInput;
|
|
6064
5791
|
type index_ArkadeConnectOptions = ArkadeConnectOptions;
|
|
5792
|
+
type index_ArkadeConnectProviderOptions = ArkadeConnectProviderOptions;
|
|
5793
|
+
type index_ArkadeConnectServiceOptions = ArkadeConnectServiceOptions;
|
|
6065
5794
|
type index_ArkadeContract<P extends Program = Program> = ArkadeContract<P>;
|
|
6066
5795
|
declare const index_ArkadeContract: typeof ArkadeContract;
|
|
5796
|
+
type index_ArkadeContractEvent<T extends ArkadeContractEventType = ArkadeContractEventType> = ArkadeContractEvent<T>;
|
|
5797
|
+
type index_ArkadeContractEventType = ArkadeContractEventType;
|
|
6067
5798
|
declare const index_ArkadeContractParams: typeof ArkadeContractParams;
|
|
5799
|
+
type index_ArkadeContractSubscription = ArkadeContractSubscription;
|
|
6068
5800
|
type index_ArkadeExtendedCoin = ArkadeExtendedCoin;
|
|
6069
5801
|
type index_ArkadeExtendedVirtualCoin = ArkadeExtendedVirtualCoin;
|
|
6070
5802
|
declare const index_ArkadeFunction: typeof ArkadeFunction;
|
|
@@ -6075,6 +5807,7 @@ type index_ArkadeScriptOP = ArkadeScriptOP;
|
|
|
6075
5807
|
type index_ArkadeScriptType = ArkadeScriptType;
|
|
6076
5808
|
declare const index_ArkadeSegment: typeof ArkadeSegment;
|
|
6077
5809
|
type index_ArkadeServerProvider = ArkadeServerProvider;
|
|
5810
|
+
declare const index_ArkadeService: typeof ArkadeService;
|
|
6078
5811
|
type index_ArkadeSpendResult = ArkadeSpendResult;
|
|
6079
5812
|
type index_ArkadeTransactionBuilder = ArkadeTransactionBuilder;
|
|
6080
5813
|
declare const index_ArkadeTransactionBuilder: typeof ArkadeTransactionBuilder;
|
|
@@ -6082,6 +5815,7 @@ declare const index_AsmToken: typeof AsmToken;
|
|
|
6082
5815
|
type index_AssetSpec = AssetSpec;
|
|
6083
5816
|
type index_CallableFunctions = CallableFunctions;
|
|
6084
5817
|
declare const index_CompiledProgramFunction: typeof CompiledProgramFunction;
|
|
5818
|
+
type index_ContractArtifact = ContractArtifact;
|
|
6085
5819
|
type index_ContractFunctions<P extends Program> = ContractFunctions<P>;
|
|
6086
5820
|
declare const index_InputDef: typeof InputDef;
|
|
6087
5821
|
declare const index_InputRef: typeof InputRef;
|
|
@@ -6090,11 +5824,14 @@ declare const index_OPCODE_NAMES: typeof OPCODE_NAMES;
|
|
|
6090
5824
|
declare const index_OPCODE_VALUES: typeof OPCODE_VALUES;
|
|
6091
5825
|
declare const index_Program: typeof Program;
|
|
6092
5826
|
declare const index_ProgramKeys: typeof ProgramKeys;
|
|
5827
|
+
declare const index_ResolvedArkadeService: typeof ResolvedArkadeService;
|
|
6093
5828
|
declare const index_SUPPORTED_PROGRAM_VERSION: typeof SUPPORTED_PROGRAM_VERSION;
|
|
6094
5829
|
declare const index_Script: typeof Script;
|
|
6095
5830
|
declare const index_ScriptType: typeof ScriptType;
|
|
6096
5831
|
declare const index_SignerRef: typeof SignerRef;
|
|
6097
5832
|
declare const index_TapscriptSegment: typeof TapscriptSegment;
|
|
5833
|
+
declare const index_TweakedSigner: typeof TweakedSigner;
|
|
5834
|
+
declare const index_UnsupportedProgramVersionError: typeof UnsupportedProgramVersionError;
|
|
6098
5835
|
type index_Utxo = Utxo;
|
|
6099
5836
|
declare const index_WitnessRef: typeof WitnessRef;
|
|
6100
5837
|
declare const index_arkadeScriptHash: typeof arkadeScriptHash;
|
|
@@ -6107,7 +5844,10 @@ declare const index_deserializeArkadeContractParams: typeof deserializeArkadeCon
|
|
|
6107
5844
|
declare const index_fromASM: typeof fromASM;
|
|
6108
5845
|
declare const index_getOpcodeName: typeof getOpcodeName;
|
|
6109
5846
|
declare const index_getOpcodeValue: typeof getOpcodeValue;
|
|
5847
|
+
declare const index_isContractArtifact: typeof isContractArtifact;
|
|
6110
5848
|
declare const index_parseArtifact: typeof parseArtifact;
|
|
5849
|
+
declare const index_programFromArtifact: typeof programFromArtifact;
|
|
5850
|
+
declare const index_resolveArkadeService: typeof resolveArkadeService;
|
|
6111
5851
|
declare const index_resolveAsm: typeof resolveAsm;
|
|
6112
5852
|
declare const index_serializeArkadeContractParams: typeof serializeArkadeContractParams;
|
|
6113
5853
|
declare const index_stringifyArtifact: typeof stringifyArtifact;
|
|
@@ -6115,7 +5855,7 @@ declare const index_toASM: typeof toASM;
|
|
|
6115
5855
|
declare const index_validateProgram: typeof validateProgram;
|
|
6116
5856
|
declare const index_witnessRefToBytes: typeof witnessRefToBytes;
|
|
6117
5857
|
declare namespace index {
|
|
6118
|
-
export { index_ARKADE_OP as ARKADE_OP, index_ARKADE_OPCODES as ARKADE_OPCODES, index_ARKADE_OPCODE_NAMES as ARKADE_OPCODE_NAMES, index_ARKADE_OPCODE_VALUES as ARKADE_OPCODE_VALUES, index_ARKADE_OPS as ARKADE_OPS, index_Arkade as Arkade, index_ArkadeArgType as ArkadeArgType, index_ArkadeArgValue as ArkadeArgValue, type index_ArkadeBatchInput as ArkadeBatchInput, type index_ArkadeConnectOptions as ArkadeConnectOptions, index_ArkadeContract as ArkadeContract, index_ArkadeContractParams as ArkadeContractParams, type index_ArkadeExtendedCoin as ArkadeExtendedCoin, type index_ArkadeExtendedVirtualCoin as ArkadeExtendedVirtualCoin, index_ArkadeFunction as ArkadeFunction, index_ArkadeParamValue as ArkadeParamValue, index_ArkadeProgramScript as ArkadeProgramScript, index_ArkadeScript as ArkadeScript, type index_ArkadeScriptOP as ArkadeScriptOP, type index_ArkadeScriptType as ArkadeScriptType, index_ArkadeSegment as ArkadeSegment, type index_ArkadeServerProvider as ArkadeServerProvider, type index_ArkadeSpendResult as ArkadeSpendResult, index_ArkadeTransactionBuilder as ArkadeTransactionBuilder, index_AsmToken as AsmToken, type index_AssetSpec as AssetSpec, bignum as BigNum, type index_CallableFunctions as CallableFunctions, index_CompiledProgramFunction as CompiledProgramFunction, type index_ContractFunctions as ContractFunctions, index_InputDef as InputDef, index_InputRef as InputRef, index_OP as OP, index_OPCODE_NAMES as OPCODE_NAMES, index_OPCODE_VALUES as OPCODE_VALUES, index_Program as Program, index_ProgramKeys as ProgramKeys, index_SUPPORTED_PROGRAM_VERSION as SUPPORTED_PROGRAM_VERSION, index_Script as Script, index_ScriptType as ScriptType, index_SignerRef as SignerRef, index_TapscriptSegment as TapscriptSegment, type index_Utxo as Utxo, index_WitnessRef as WitnessRef, index_arkadeScriptHash as arkadeScriptHash, index_arkadeWitnessHash as arkadeWitnessHash, index_asmToBytes as asmToBytes, index_bytesToASM as bytesToASM, index_computeArkadeScriptPublicKey as computeArkadeScriptPublicKey, index_createArkadeBatchHandler as createArkadeBatchHandler, index_deserializeArkadeContractParams as deserializeArkadeContractParams, index_fromASM as fromASM, index_getOpcodeName as getOpcodeName, index_getOpcodeValue as getOpcodeValue, index_parseArtifact as parseArtifact, index_resolveAsm as resolveAsm, index_serializeArkadeContractParams as serializeArkadeContractParams, index_stringifyArtifact as stringifyArtifact, index_toASM as toASM, index_validateProgram as validateProgram, index_witnessRefToBytes as witnessRefToBytes };
|
|
5858
|
+
export { index_ARKADE_OP as ARKADE_OP, index_ARKADE_OPCODES as ARKADE_OPCODES, index_ARKADE_OPCODE_NAMES as ARKADE_OPCODE_NAMES, index_ARKADE_OPCODE_VALUES as ARKADE_OPCODE_VALUES, index_ARKADE_OPS as ARKADE_OPS, index_Arkade as Arkade, index_ArkadeArgType as ArkadeArgType, index_ArkadeArgValue as ArkadeArgValue, type index_ArkadeBatchInput as ArkadeBatchInput, type index_ArkadeConnectOptions as ArkadeConnectOptions, type index_ArkadeConnectProviderOptions as ArkadeConnectProviderOptions, type index_ArkadeConnectServiceOptions as ArkadeConnectServiceOptions, index_ArkadeContract as ArkadeContract, type index_ArkadeContractEvent as ArkadeContractEvent, type index_ArkadeContractEventType as ArkadeContractEventType, index_ArkadeContractParams as ArkadeContractParams, type index_ArkadeContractSubscription as ArkadeContractSubscription, type index_ArkadeExtendedCoin as ArkadeExtendedCoin, type index_ArkadeExtendedVirtualCoin as ArkadeExtendedVirtualCoin, index_ArkadeFunction as ArkadeFunction, index_ArkadeParamValue as ArkadeParamValue, index_ArkadeProgramScript as ArkadeProgramScript, index_ArkadeScript as ArkadeScript, type index_ArkadeScriptOP as ArkadeScriptOP, type index_ArkadeScriptType as ArkadeScriptType, index_ArkadeSegment as ArkadeSegment, type index_ArkadeServerProvider as ArkadeServerProvider, index_ArkadeService as ArkadeService, type index_ArkadeSpendResult as ArkadeSpendResult, index_ArkadeTransactionBuilder as ArkadeTransactionBuilder, index_AsmToken as AsmToken, type index_AssetSpec as AssetSpec, bignum as BigNum, type index_CallableFunctions as CallableFunctions, index_CompiledProgramFunction as CompiledProgramFunction, type index_ContractArtifact as ContractArtifact, type index_ContractFunctions as ContractFunctions, index_InputDef as InputDef, index_InputRef as InputRef, index_OP as OP, index_OPCODE_NAMES as OPCODE_NAMES, index_OPCODE_VALUES as OPCODE_VALUES, index_Program as Program, index_ProgramKeys as ProgramKeys, index_ResolvedArkadeService as ResolvedArkadeService, index_SUPPORTED_PROGRAM_VERSION as SUPPORTED_PROGRAM_VERSION, index_Script as Script, index_ScriptType as ScriptType, index_SignerRef as SignerRef, index_TapscriptSegment as TapscriptSegment, index_TweakedSigner as TweakedSigner, index_UnsupportedProgramVersionError as UnsupportedProgramVersionError, type index_Utxo as Utxo, index_WitnessRef as WitnessRef, index_arkadeScriptHash as arkadeScriptHash, index_arkadeWitnessHash as arkadeWitnessHash, index_asmToBytes as asmToBytes, index_bytesToASM as bytesToASM, index_computeArkadeScriptPublicKey as computeArkadeScriptPublicKey, index_createArkadeBatchHandler as createArkadeBatchHandler, index_deserializeArkadeContractParams as deserializeArkadeContractParams, index_fromASM as fromASM, index_getOpcodeName as getOpcodeName, index_getOpcodeValue as getOpcodeValue, index_isContractArtifact as isContractArtifact, index_parseArtifact as parseArtifact, index_programFromArtifact as programFromArtifact, index_resolveArkadeService as resolveArkadeService, index_resolveAsm as resolveAsm, index_serializeArkadeContractParams as serializeArkadeContractParams, index_stringifyArtifact as stringifyArtifact, index_toASM as toASM, index_validateProgram as validateProgram, index_witnessRefToBytes as witnessRefToBytes };
|
|
6119
5859
|
}
|
|
6120
5860
|
|
|
6121
5861
|
/** Known BIP21 parameters including Arkade-specific extensions. */
|
|
@@ -6193,23 +5933,14 @@ interface PaymentHandle {
|
|
|
6193
5933
|
}): Promise<RouteResult>;
|
|
6194
5934
|
}
|
|
6195
5935
|
/**
|
|
6196
|
-
* A priced route. The
|
|
6197
|
-
*
|
|
6198
|
-
*
|
|
6199
|
-
*
|
|
6200
|
-
* - `amount` — sats delivered **to the recipient**.
|
|
6201
|
-
* - `fee` — sats charged **on top**, by the rail and its counterparty.
|
|
6202
|
-
* - `total` — `amount + fee`; the sats that leave the wallet.
|
|
5936
|
+
* A priced route. The amounts are **receiver-exact** on every rail, so options rank on cost and
|
|
5937
|
+
* rails swap without changing what the recipient gets. Rails whose primitive *deducts* its fee
|
|
5938
|
+
* (collaborative exit) gross the amount up; a rail that can't (it doesn't choose the fee) flags
|
|
5939
|
+
* it via `claimFeeDeductedFromPayout`.
|
|
6203
5940
|
*
|
|
6204
|
-
*
|
|
6205
|
-
*
|
|
6206
|
-
*
|
|
6207
|
-
* never chooses, and flags that instead: see `claimFeeDeductedFromPayout`.
|
|
6208
|
-
*
|
|
6209
|
-
* `fee` is a pre-send estimate wherever the true cost is only fixed later: the
|
|
6210
|
-
* collaborative exit does not include the per-input intent fees, which depend
|
|
6211
|
-
* on the VTXO selection made at settlement. Treat it as a display and ranking
|
|
6212
|
-
* figure, not a guarantee.
|
|
5941
|
+
* `fee` is an estimate where cost is fixed later: the collaborative exit omits per-input intent
|
|
5942
|
+
* fees unless {@link PaymentRequest.selectedVtxos} is named. A display/ranking figure, not a
|
|
5943
|
+
* guarantee.
|
|
6213
5944
|
*/
|
|
6214
5945
|
interface RouteQuote {
|
|
6215
5946
|
railId: string;
|
|
@@ -6220,19 +5951,18 @@ interface RouteQuote {
|
|
|
6220
5951
|
/** `amount + fee` — what leaves the wallet. */
|
|
6221
5952
|
total: number;
|
|
6222
5953
|
/**
|
|
6223
|
-
*
|
|
6224
|
-
*
|
|
6225
|
-
*
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
*
|
|
6230
|
-
*
|
|
5954
|
+
* Unix seconds after which the counterparty stops honouring this quote. Absent means "no
|
|
5955
|
+
* check possible" (rails without a counterparty), not "never expires"; {@link send} may
|
|
5956
|
+
* still refuse, since swap rails re-check validity at spend time.
|
|
5957
|
+
*/
|
|
5958
|
+
validUntil?: number;
|
|
5959
|
+
/**
|
|
5960
|
+
* @experimental The asset shape is provisional, expected to converge with the v2 swap
|
|
5961
|
+
* client's `give`/`take`/`amountOn` over `AssetRef` in v0.5; not stable 0.4.x API.
|
|
6231
5962
|
*
|
|
6232
|
-
*
|
|
6233
|
-
*
|
|
6234
|
-
*
|
|
6235
|
-
* cost display.
|
|
5963
|
+
* The asset view; absent means BTC only. `amount` stays the sats carrier, not zero. On a
|
|
5964
|
+
* cross-asset route `delivered`/`spent` are different assets, so the purchase price lands in
|
|
5965
|
+
* `fee`; prefer `assets.spent` for a cost display.
|
|
6236
5966
|
*/
|
|
6237
5967
|
assets?: {
|
|
6238
5968
|
delivered: Asset;
|
|
@@ -6251,7 +5981,11 @@ interface RouterPreferences {
|
|
|
6251
5981
|
tieBreak?: "first" | "require-choice";
|
|
6252
5982
|
}
|
|
6253
5983
|
interface RouterContext {
|
|
6254
|
-
|
|
5984
|
+
/** A rail needing more than this takes it as a constructor dep, rather than
|
|
5985
|
+
* narrowing the context every other rail shares. */
|
|
5986
|
+
wallet: IWallet;
|
|
5987
|
+
/** Loosely typed in core to avoid a dependency on boltz-swap; swap rails cast it. */
|
|
5988
|
+
swaps?: unknown;
|
|
6255
5989
|
prefs: RouterPreferences;
|
|
6256
5990
|
}
|
|
6257
5991
|
/** Mirrors {@link Recipient}: an Arkade address is the same string for BTC and
|
|
@@ -6266,6 +6000,13 @@ interface PaymentRequest {
|
|
|
6266
6000
|
* Additive: an asset transfer also moves sats, so a 500 USDX request
|
|
6267
6001
|
* legitimately has both. A rail that cannot deliver assets must REFUSE. */
|
|
6268
6002
|
assets?: Asset[];
|
|
6003
|
+
/**
|
|
6004
|
+
* Spend exactly these (normalized) virtual outputs, as {@link SendParams.selectedVtxos}:
|
|
6005
|
+
* ungated like `settle({ inputs })`, and a shortfall is an error, not a top-up. Only rails
|
|
6006
|
+
* spending the wallet's own coins (`ark`, `ark-asset`, `onchain`) can honour it;
|
|
6007
|
+
* counterparty-funded rails must REFUSE, not ignore it.
|
|
6008
|
+
*/
|
|
6009
|
+
selectedVtxos?: NormalizedExtendedVirtualCoin[];
|
|
6269
6010
|
}
|
|
6270
6011
|
/** A payment rail — registered by id, mirrors the ActivityRegistry resolver shape. */
|
|
6271
6012
|
interface PaymentRail {
|
|
@@ -6298,10 +6039,11 @@ declare const isLightningInvoice: (raw: string) => boolean;
|
|
|
6298
6039
|
/**
|
|
6299
6040
|
* True for an LNURL or a Lightning address (`user@host`).
|
|
6300
6041
|
*
|
|
6301
|
-
*
|
|
6302
|
-
*
|
|
6303
|
-
*
|
|
6304
|
-
*
|
|
6042
|
+
* No rail here consumes it, and that is the layering rather than a gap:
|
|
6043
|
+
* routing an LNURL needs an LNURL client, so the rails ship from
|
|
6044
|
+
* `@arkade-os/lnurl-client/arkade` (`lnurlRails`) and are registered by the
|
|
6045
|
+
* app, as the solver rails from `@arkade-os/swap` are. With none registered,
|
|
6046
|
+
* `route()` throws "no rail for" on these targets.
|
|
6305
6047
|
*/
|
|
6306
6048
|
declare const isLnurl: (raw: string) => boolean;
|
|
6307
6049
|
/** True for a bech32 (segwit) or base58 (legacy) Bitcoin address, any network —
|
|
@@ -6338,6 +6080,11 @@ declare function assetsOf(req: PaymentRequest): Asset[];
|
|
|
6338
6080
|
/** For a BTC-only rail: refusing is what leaves the router free to rank an
|
|
6339
6081
|
* asset-capable one, instead of paying the carrier and dropping the asset. */
|
|
6340
6082
|
declare function assertNoAssets(railId: string, req: PaymentRequest): void;
|
|
6083
|
+
/** The inputs a request names. An EMPTY array is still a selection, covering nothing. */
|
|
6084
|
+
declare function selectionOf(req: PaymentRequest): NormalizedExtendedVirtualCoin[] | undefined;
|
|
6085
|
+
/** For a rail whose counterparty funds the spend: ignoring a named input set
|
|
6086
|
+
* would spend coins the caller had promised elsewhere, so refuse instead. */
|
|
6087
|
+
declare function assertNoSelection(railId: string, req: PaymentRequest): void;
|
|
6341
6088
|
/** Exactly one: `Wallet.send` takes a list because one output can carry
|
|
6342
6089
|
* several, but a routed PAYMENT is one thing being paid. */
|
|
6343
6090
|
declare function resolveAssetAmount(railId: string, req: PaymentRequest): Asset;
|
|
@@ -6406,23 +6153,36 @@ declare const ASSET_CARRIER_SATS = 330;
|
|
|
6406
6153
|
*/
|
|
6407
6154
|
declare function arkAssetRail(): PaymentRail;
|
|
6408
6155
|
|
|
6156
|
+
/** The canonical fee source for {@link onchainRail}: the operator's schedule, as
|
|
6157
|
+
* the wallet already reads it. Keeps the one `arkProvider` reach in one place,
|
|
6158
|
+
* so an app registering the rail itself need not know where fees live. */
|
|
6159
|
+
declare const walletFeeSource: (wallet: Wallet) => () => Promise<FeeInfo>;
|
|
6409
6160
|
/**
|
|
6410
6161
|
* On-chain BTC send via collaborative exit — the Wallet-only on-chain path (no
|
|
6411
6162
|
* swap). Matches a bare BTC address or the on-chain part of a unified BIP21 URI
|
|
6412
6163
|
* and offboards VTXOs to the address via {@link Ramps.offboard}, which owns
|
|
6413
6164
|
* fee-aware coin selection, dust-safe change, and settlement.
|
|
6414
6165
|
*
|
|
6415
|
-
*
|
|
6416
|
-
* the
|
|
6417
|
-
*
|
|
6418
|
-
*
|
|
6419
|
-
*
|
|
6420
|
-
*
|
|
6166
|
+
* The exit fee is priced on the DESTINATION output — the one arkd charges for —
|
|
6167
|
+
* and met from the balance, so the recipient receives exactly `quote.amount`
|
|
6168
|
+
* (see {@link RouteQuote}). {@link Ramps.offboardExact} carries that; the
|
|
6169
|
+
* gross-up this rail used to do could only approximate it.
|
|
6170
|
+
*
|
|
6171
|
+
* A request naming `selectedVtxos` offboards exactly those — so the exit need not
|
|
6172
|
+
* sweep the whole off-chain balance into one change output — and only then does
|
|
6173
|
+
* the quote carry the per-input intent fees: unselected, the coins are chosen
|
|
6174
|
+
* later at settlement and there is nothing here to price.
|
|
6421
6175
|
*
|
|
6422
6176
|
* An explicit amount is mandatory. To sweep the full balance, call
|
|
6423
6177
|
* `Ramps.offboard(address, feeInfo)` directly — the router has no amountless path.
|
|
6178
|
+
*
|
|
6179
|
+
* @param deps.feeInfo - Source of the operator's fee schedule. Required: a rail
|
|
6180
|
+
* that cannot price an offboard must not be constructible — a silently dropped
|
|
6181
|
+
* rail on the money path is worse than a wiring error at startup.
|
|
6424
6182
|
*/
|
|
6425
|
-
declare function onchainRail(
|
|
6183
|
+
declare function onchainRail(deps: {
|
|
6184
|
+
feeInfo: () => Promise<FeeInfo>;
|
|
6185
|
+
}): PaymentRail;
|
|
6426
6186
|
|
|
6427
6187
|
/**
|
|
6428
6188
|
* Default payment router with the Wallet-only rails: `ark` (off-chain BTC send),
|
|
@@ -6481,9 +6241,7 @@ declare function sequenceToTimelock(sequence: number): RelativeTimelock;
|
|
|
6481
6241
|
declare function toXOnly(key: Uint8Array, label?: string): Uint8Array;
|
|
6482
6242
|
|
|
6483
6243
|
declare const buildVersion = "0.9.9";
|
|
6484
|
-
/**
|
|
6485
|
-
* The SDK's own version string, sourced from package.json
|
|
6486
|
-
*/
|
|
6244
|
+
/** The SDK's own version string, sourced from package.json */
|
|
6487
6245
|
declare const sdkVersion: string;
|
|
6488
6246
|
/**
|
|
6489
6247
|
* Wraps a transport-level `fetch` rejection (DNS failure, connection refused,
|
|
@@ -6501,6 +6259,12 @@ declare class FetchError extends Error {
|
|
|
6501
6259
|
cause?: unknown;
|
|
6502
6260
|
});
|
|
6503
6261
|
}
|
|
6262
|
+
/**
|
|
6263
|
+
* Deadline for a read that carries no `AbortSignal` of its own. `fetch` has no default timeout,
|
|
6264
|
+
* so a silently dropped connection stays pending, and every retry ladder, queue or mutex built on
|
|
6265
|
+
* top of it waits with it.
|
|
6266
|
+
*/
|
|
6267
|
+
declare const READ_TIMEOUT_MS = 30000;
|
|
6504
6268
|
|
|
6505
6269
|
/**
|
|
6506
6270
|
* How long a blocked upgrade waits before the open is reported as failed.
|
|
@@ -6561,46 +6325,22 @@ interface ManagedConnection extends AsyncDisposable {
|
|
|
6561
6325
|
/**
|
|
6562
6326
|
* The open connection, opening it on first call.
|
|
6563
6327
|
*
|
|
6564
|
-
* Call
|
|
6565
|
-
*
|
|
6566
|
-
*
|
|
6567
|
-
*
|
|
6568
|
-
* after which every transaction on that handle throws `InvalidStateError`;
|
|
6569
|
-
* a later `get()` transparently reopens, but only for callers that ask
|
|
6570
|
-
* again. Holding the resolved database is exactly the defect this type
|
|
6571
|
-
* exists to remove.
|
|
6328
|
+
* Call once per operation and use the handle for the transaction you start right away —
|
|
6329
|
+
* never store it or carry it across an `await`. It can be closed underneath you at any time
|
|
6330
|
+
* (`versionchange` from another tab, eviction, "clear site data"), after which every
|
|
6331
|
+
* transaction on it throws `InvalidStateError`; a later `get()` transparently reopens.
|
|
6572
6332
|
*
|
|
6573
|
-
*
|
|
6574
|
-
*
|
|
6575
|
-
*
|
|
6576
|
-
*
|
|
6577
|
-
* released this connection's single reference, and reopening would take a
|
|
6578
|
-
* refcount nothing is left to release. Disposal is final by design — there
|
|
6579
|
-
* is no revive; construct a new repository, which constructs a new
|
|
6580
|
-
* connection, instead.
|
|
6581
|
-
*
|
|
6582
|
-
* Dispose neither awaits nor cancels work already in flight. A transaction
|
|
6583
|
-
* started just before it can abort when the underlying handle closes, and
|
|
6584
|
-
* an in-flight `get()` may resolve to a database that is closing. So
|
|
6585
|
-
* sequence disposal after the operations you care about have settled —
|
|
6586
|
-
* `await` the repository's outstanding calls first — rather than racing it
|
|
6587
|
-
* against them.
|
|
6588
|
-
*
|
|
6589
|
-
* Callers must not close the database themselves; the reference this
|
|
6590
|
-
* connection holds is released by its own dispose, once.
|
|
6333
|
+
* After `[Symbol.asyncDispose]` it rejects with {@link ConnectionDisposedError}, permanently:
|
|
6334
|
+
* reopening would take a refcount nothing releases, so construct a new repository instead.
|
|
6335
|
+
* Dispose neither awaits nor cancels in-flight work, so `await` outstanding repository calls
|
|
6336
|
+
* before disposing. Callers must not close the database themselves.
|
|
6591
6337
|
*/
|
|
6592
6338
|
get(): Promise<IDBDatabase>;
|
|
6593
6339
|
}
|
|
6594
6340
|
/**
|
|
6595
|
-
* Forget-and-reopen around {@link openDatabase}, shared by every IndexedDB
|
|
6596
|
-
*
|
|
6597
|
-
*
|
|
6598
|
-
* that handle throws `InvalidStateError` with no path back.
|
|
6599
|
-
*
|
|
6600
|
-
* Opens nothing until the first {@link ManagedConnection.get} — repositories
|
|
6601
|
-
* construct their storage in their own constructors, and an eager open would
|
|
6602
|
-
* move the "IndexedDB is not available in this environment" throw to
|
|
6603
|
-
* construction time.
|
|
6341
|
+
* Forget-and-reopen around {@link openDatabase}, shared by every IndexedDB repository: a cached
|
|
6342
|
+
* `IDBDatabase` throws `InvalidStateError` forever once the manager closes it on `versionchange`.
|
|
6343
|
+
* Lazy, so the "IndexedDB is not available" throw stays out of repository constructors.
|
|
6604
6344
|
*/
|
|
6605
6345
|
declare function createManagedConnection(dbName: string, version: number, initDatabase: (db: IDBDatabase, oldVersion: number, transaction: IDBTransaction | null) => void): ManagedConnection;
|
|
6606
6346
|
|
|
@@ -6674,6 +6414,7 @@ declare class AssetManager extends ReadonlyAssetManager implements IAssetManager
|
|
|
6674
6414
|
* ```
|
|
6675
6415
|
*/
|
|
6676
6416
|
issue(params: IssuanceParams): Promise<IssuanceResult>;
|
|
6417
|
+
private issueWith;
|
|
6677
6418
|
/**
|
|
6678
6419
|
* Reissue more units of an existing asset.
|
|
6679
6420
|
* Requires ownership of the control asset.
|
|
@@ -6692,6 +6433,7 @@ declare class AssetManager extends ReadonlyAssetManager implements IAssetManager
|
|
|
6692
6433
|
* ```
|
|
6693
6434
|
*/
|
|
6694
6435
|
reissue(params: ReissuanceParams): Promise<string>;
|
|
6436
|
+
private reissueWith;
|
|
6695
6437
|
/**
|
|
6696
6438
|
* Burn assets.
|
|
6697
6439
|
* @param params - Parameters for burning
|
|
@@ -6708,6 +6450,7 @@ declare class AssetManager extends ReadonlyAssetManager implements IAssetManager
|
|
|
6708
6450
|
* ```
|
|
6709
6451
|
*/
|
|
6710
6452
|
burn(params: BurnParams): Promise<string>;
|
|
6453
|
+
private burnWith;
|
|
6711
6454
|
}
|
|
6712
6455
|
|
|
6713
|
-
export { ARKADE_MAGIC, ARKADE_SALTED_PREIMAGE_TAG, ARKADE_SWAP_PREIMAGE_TAG, ASSET_CARRIER_SATS, Activity, ActivityRegistry, AddressAllocationCapable, AmbiguousRouteError, type AnchorBumper, ArkAddress,
|
|
6456
|
+
export { ARKADE_MAGIC, ARKADE_SALTED_PREIMAGE_TAG, ARKADE_SWAP_PREIMAGE_TAG, ASSET_CARRIER_SATS, Activity, ActivityRegistry, AddressAllocationCapable, AmbiguousRouteError, type AnchorBumper, ArkAddress, ArkIntent, ArkNote, ArkProvider, type ArkPsbtFieldCoder, ArkPsbtFieldKey, ArkPsbtFieldKeyType, ArkTransaction, type ArkTxInput, Arkade, type ArkadeBatchInput, ArkadeBroadcaster, ArkadeCash, ArkadeContractParams, type ArkadeExtendedCoin, type ArkadeExtendedVirtualCoin, ArkadeInfo, ArkadeReader, ArkadeService, Asset, AssetDetails, AssetManager, BIP21, BIP21Error, type BIP21Params, type BIP21ParseResult, BIP322, BLOCKED_UPGRADE_TIMEOUT_MS, Batch, BatchExpiryPolicy, BurnParams, CSVMultisigTapscript, CachingArkProvider, ChainTx, Coin, ConditionWitness, ConnectionDisposedError, Contract, ContractEvent, ContractFilter, ContractRepository, ContractSyncState, ContractVtxoEvent, ContractWatcherConfig, ContractWithVtxos, CosignerPublicKey, CreateContractParams, DEFAULT_MESSAGE_TIMEOUTS, DatabaseUpgradeBlockedError, DefaultVtxo, DelegateInfo, DelegateNotConfiguredError, DescriptorIdentity, type DescriptorIdentityOptions, type DescriptorOptions, DescriptorProvider, type DescriptorSigner, DescriptorSigningProviderMissingError, DescriptorSigningRequest, type DeterministicSigner, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, type BlockHeader as ElectrumBlockHeader, ElectrumOnchainProvider, type TransactionHistory as ElectrumTransactionHistory, type Unspent as ElectrumUnspent, type EmulatorEntry, EmulatorPacket, 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, ExtendedContractVtxo, ExtendedVirtualCoin, Extension, ExtensionNotFoundError, type ExtensionPacket, FeeAmount, FeeInfo, FeeOutput, FetchError, GetArkadeInfoOptions, GetNewAddressesOptions, GetSpendableVtxosFilter, GetVtxosFilter, GetVtxosOptions, HDAllocationCapable, HDDescriptorProvider, type HDDeterministicSignCapable, HDWalletCapable, IAssetManager, IContractManager, IDelegateManager, IReadonlyAssetManager, IReadonlyWallet, IVtxoManager, IWallet, Identity, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexerProvider, InputExpiryFloor, Intent, IntentFeeConfig, IntentPageFilter, IntentRepository, IssuanceParams, IssuanceResult, MESSAGE_BUS_INITIALIZING, MESSAGE_BUS_NOT_INITIALIZED, type ManagedConnection, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, type MessageHandler, type MessageTimeouts, MigrationGlobalSkipReason, MigrationLegSkipReason, MissingSigningDescriptorError, MnemonicIdentity, type MnemonicOptions, Network, NetworkName, type NetworkOptions, NewAddress, NormalizedExtendedVirtualCoin, NormalizedVtxoPage, OffchainInput, type OffchainTx, type OnExitObserved, OnchainInput, OnchainProvider, OnchainWallet, Outpoint, OversizedChangeError, P2A, PageRequest, PageResult, PaginationOptions, type ParsedArkContract, PathContext, PathSelection, type PaymentHandle, type PaymentOption, type PaymentRail, type PaymentRequest, PaymentRouter, type PaymentStatus, PrevArkTxField, PrevoutTxField, ProviderConnectionState, type ProvisionedClaimSecret, type ProvisionedKey, READ_TIMEOUT_MS, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlyIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, Recipient, ReissuanceParams, RelativeTimelock, RenewVtxosOptions, type RequestEnvelope, type ResponseEnvelope, type RouteQuote, type RouteResult, type RouterContext, type RouterPreferences, ScriptVtxoCursor, ScriptVtxoPageOptions, SeedIdentity, type SeedIdentityOptions, SendBitcoinParams, SendDeadlineExceededError, SendParams, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, type ServiceWorkerWalletMode, SettleParams, SettlementConfig, SettlementEvent, SignedIntent, SignerSession, SignerStatus, SingleKey, StaticDescriptorProvider, Status, StorageConfig, StoredVtxo, TapLeafScript, Transaction, TransactionHistoryPageCursor, TransactionHistoryPageFilter, TreeNonces, TreePartialSigs, TxNotificationEvent, TxTree, TxWeightEstimator, UnannotatableInputError, UnilateralExit, UnknownPacket, Unroll, UnsupportedProgramVersionError, type VSize, type VerifyServerSignatures, VirtualCoin, VirtualTx, VirtualTxRepository, VtxoBranch, type VtxoExclusion, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, Wallet, WalletBalance, WalletCannotSignError, WalletMessageHandler, WalletNotInitializedError, WalletRepository, type WalletRestoreHook, WatchedScript, WsElectrumChainSource, adoptContractDescriptor, arkAssetRail, arkRail, arkTarget, index as arkade, assembleBtcdTaprootTree, assertFinalCommitmentMatchesValidated, assertNoAssets, assertNoSelection, assertNonNegativeMs, assertSendDeadline, assertSendableAmount, assertSubmittedArkTxid, assertTimerMs, assertValidServerUnrollScript, index$1 as asset, assetsOf, awaitTransaction, btcTarget, buildForfeitTx, buildOffchainTx, buildPreimageMessage, buildSaltedPreimageMessage, buildVersion, captureSendDeadline, claimWithPreimageIdentity, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, contractPreimage, contractSigner, createAssetPacket, createDefaultPaymentRouter, createManagedConnection, decodeArkContract, deleteByIndex, deriveDescriptorLeafCompressedPubKey, deriveDescriptorLeafPubKey, deserializeExitPackage, encodeArkContract, exitObserverFor, gateExclusion, gatedContracts, getAllByIndexValues, getArkPsbtFields, hasBoardingTxExpired, identityDescriptor, invoiceTarget, isArkContract, isBtcAddress, isCltvSatisfied, isContractGenericallySpendable, isCsvSpendable, isDeterministicSigner, isHDDeterministicSignCapable, isLightningInvoice, isLnurl, isMessageBusInitializingError, isMessageBusNotInitializedError, isPerArtifactDescriptor, isRetryableProviderError, isValidArkAddress, logExcludedVtxos, makeHandle, matchServerCheckpoints, normalizeToDescriptor, notifyExitObserved, onchainRail, openDatabase, outpointExclusion, outpointReasons, parseHDDescriptor, promisifyRequest, provisionClaimSecret, provisionRefundKey, registerWalletRestoreHook, resolveAssetAmount, resolveSendAmount, sdkVersion, selectCoinsWithAsset, selectionOf, sequenceToTimelock, serializeExitPackage, setArkPsbtField, setupServiceWorker, signAndSubmitOffchainTx, submitViaEmulator, timelockToSequence, toXOnly, tryResolveSendAmount, validateBatchRecipients, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, walletFeeSource };
|