@arkade-os/sdk 0.5.0-rc.11 → 0.5.0-rc.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -12
- package/dist/adapters/expo.cjs +5 -5
- package/dist/adapters/expo.d.cts +2 -2
- package/dist/adapters/expo.d.ts +2 -2
- package/dist/adapters/expo.js +3 -3
- package/dist/{asyncStorageTaskQueue-DBaZsltv.d.cts → asyncStorageTaskQueue-0EeSeCAt.d.cts} +1 -1
- package/dist/{asyncStorageTaskQueue-uAG3XLyg.d.ts → asyncStorageTaskQueue-DV94jhwq.d.ts} +1 -1
- package/dist/{chunk-WSQAWSEH.js → chunk-3JLYJ5KZ.js} +75 -237
- package/dist/chunk-3JLYJ5KZ.js.map +1 -0
- package/dist/{chunk-VMLLYEYM.js → chunk-4EU2Q6YT.js} +12 -14
- package/dist/chunk-4EU2Q6YT.js.map +1 -0
- package/dist/{chunk-IA32YGLH.cjs → chunk-7BACS4XK.cjs} +10 -10
- package/dist/chunk-7BACS4XK.cjs.map +1 -0
- package/dist/{chunk-5OBGYL6U.cjs → chunk-7NK6XFC3.cjs} +120 -194
- package/dist/chunk-7NK6XFC3.cjs.map +1 -0
- package/dist/{chunk-CQPQ7D4U.cjs → chunk-BFQX2KS3.cjs} +87 -248
- package/dist/chunk-BFQX2KS3.cjs.map +1 -0
- package/dist/{chunk-DD6MTNAS.js → chunk-D7JLTHSZ.js} +5 -5
- package/dist/chunk-D7JLTHSZ.js.map +1 -0
- package/dist/{chunk-CMLSTGOC.js → chunk-EJYWGTZ7.js} +119 -194
- package/dist/chunk-EJYWGTZ7.js.map +1 -0
- package/dist/{chunk-T2ILYGWE.cjs → chunk-FDQQOF3F.cjs} +327 -1080
- package/dist/chunk-FDQQOF3F.cjs.map +1 -0
- package/dist/{chunk-MGDXN74N.cjs → chunk-I4YBVHAK.cjs} +2357 -3374
- package/dist/chunk-I4YBVHAK.cjs.map +1 -0
- package/dist/{chunk-M2ZUPLKQ.js → chunk-IV2252XM.js} +1946 -2977
- package/dist/chunk-IV2252XM.js.map +1 -0
- package/dist/{chunk-OMJRW2D5.js → chunk-JOUPIZ32.js} +263 -1036
- package/dist/chunk-JOUPIZ32.js.map +1 -0
- package/dist/{chunk-PWEBQNIE.cjs → chunk-RDQSVIXD.cjs} +22 -24
- package/dist/chunk-RDQSVIXD.cjs.map +1 -0
- package/dist/contracts/handlers/index.cjs +9 -9
- package/dist/contracts/handlers/index.d.cts +3 -3
- package/dist/contracts/handlers/index.d.ts +3 -3
- package/dist/contracts/handlers/index.js +2 -2
- package/dist/{delegate-DFwlkVYR.d.cts → delegate-BgpUJW5B.d.cts} +1 -1
- package/dist/{delegate-D3YHDERL.d.ts → delegate-BuagcGnG.d.ts} +1 -1
- package/dist/{index-DTvUv5lD.d.cts → index-CKmB14Yu.d.cts} +1145 -2263
- package/dist/{index-DTvUv5lD.d.ts → index-CKmB14Yu.d.ts} +1145 -2263
- package/dist/index-D0BuYwhF.d.cts +637 -0
- package/dist/index-DbzyrqK7.d.ts +637 -0
- package/dist/index.cjs +341 -297
- package/dist/index.d.cts +379 -788
- package/dist/index.d.ts +379 -788
- package/dist/index.js +4 -4
- package/dist/repositories/realm/index.cjs +142 -101
- package/dist/repositories/realm/index.cjs.map +1 -1
- package/dist/repositories/realm/index.d.cts +13 -11
- package/dist/repositories/realm/index.d.ts +13 -11
- package/dist/repositories/realm/index.js +130 -89
- package/dist/repositories/realm/index.js.map +1 -1
- package/dist/repositories/sqlite/index.cjs +158 -118
- package/dist/repositories/sqlite/index.cjs.map +1 -1
- package/dist/repositories/sqlite/index.d.cts +14 -13
- package/dist/repositories/sqlite/index.d.ts +14 -13
- package/dist/repositories/sqlite/index.js +147 -107
- package/dist/repositories/sqlite/index.js.map +1 -1
- package/dist/{taskRunner-B5bl0YRt.d.ts → taskRunner-BX-pB0sv.d.ts} +1 -1
- package/dist/{taskRunner--sKy9Inv.d.cts → taskRunner-DJrFFyus.d.cts} +1 -1
- package/dist/wallet/expo/background.cjs +14 -14
- package/dist/wallet/expo/background.cjs.map +1 -1
- package/dist/wallet/expo/background.d.cts +8 -14
- package/dist/wallet/expo/background.d.ts +8 -14
- package/dist/wallet/expo/background.js +6 -6
- package/dist/wallet/expo/background.js.map +1 -1
- package/dist/wallet/expo/index.cjs +14 -14
- package/dist/wallet/expo/index.cjs.map +1 -1
- package/dist/wallet/expo/index.d.cts +5 -5
- package/dist/wallet/expo/index.d.ts +5 -5
- package/dist/wallet/expo/index.js +5 -5
- package/dist/wallet/expo/index.js.map +1 -1
- package/dist/wallet-BsL2G3Qb.d.cts +1542 -0
- package/dist/wallet-DXNiCmq8.d.ts +1542 -0
- package/dist/worker/expo/index.cjs +9 -9
- package/dist/worker/expo/index.d.cts +4 -4
- package/dist/worker/expo/index.d.ts +4 -4
- package/dist/worker/expo/index.js +5 -5
- package/package.json +3 -2
- package/dist/chunk-5OBGYL6U.cjs.map +0 -1
- package/dist/chunk-CMLSTGOC.js.map +0 -1
- package/dist/chunk-CQPQ7D4U.cjs.map +0 -1
- package/dist/chunk-DD6MTNAS.js.map +0 -1
- package/dist/chunk-IA32YGLH.cjs.map +0 -1
- package/dist/chunk-M2ZUPLKQ.js.map +0 -1
- package/dist/chunk-MGDXN74N.cjs.map +0 -1
- package/dist/chunk-OMJRW2D5.js.map +0 -1
- package/dist/chunk-PWEBQNIE.cjs.map +0 -1
- package/dist/chunk-T2ILYGWE.cjs.map +0 -1
- package/dist/chunk-VMLLYEYM.js.map +0 -1
- package/dist/chunk-WSQAWSEH.js.map +0 -1
- package/dist/hdWalletCapable-C350s3bP.d.ts +0 -2206
- package/dist/hdWalletCapable-rrOmXcbT.d.cts +0 -2206
- package/dist/index-C0ZyGoyP.d.cts +0 -850
- package/dist/index-DASN1cVk.d.ts +0 -850
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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 { f as AbortError, g as ArkError, h as ArkErrorName, i as ArkadeCashClaimResult, j as ArkadeCashCreateError, k as ArkadeCashUnclaimedReason, l as ArkadeCashUnclaimedVtxo, m as BoardingUtxoGroup, C as CheckpointExitDelayPolicy, D as DEFAULT_MIN_BATCH_EXPIRY_SECONDS, n as DEFAULT_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, F as ForeignDescriptorError, I as IncomingFunds, M as MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD, o as MUTINYNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, p as ProviderKind, q as ProviderUnavailableError, r as REGTEST_MIN_BATCH_EXPIRY_SECONDS, s as REGTEST_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, S as SIGNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, t as ServerInfoSource, u as ServerResponseMismatchError, v as WaitForIncomingFundsOptions, w as WalletCannotAllocateAddressError, x as assertValidBatchExpiry, y as assertValidServerUnrollScript, z as defaultBatchExpiryPolicy, E as defaultCheckpointExitDelayPolicy, G as isAddressAllocationCapable, J as isArkError, K as isHDAllocationCapable, L as isHDWalletCapable, N as maybeArkError, O as resolveBatchExpiryPolicy, Q as resolveCheckpointExitDelayPolicy, T as resolveDescriptorSigner, U as selectVirtualCoins, V as signingDescriptorIndex, X as strictSigningDescriptorIndex, Y as waitForIncomingFunds } from './
|
|
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 InputRef, e as InputDef, f as ArkadeValueType, g as ArkadeArgType, h as ArkadeContractParams, i as ArkadeSegment, j as AsmToken, S as SUPPORTED_PROGRAM_VERSION, k as SignerRef, T as TapscriptSegment, W as WitnessRef,
|
|
6
|
-
export {
|
|
7
|
-
import { D as DefaultVtxo } from './delegate-
|
|
8
|
-
export { a as DelegateVtxo } from './delegate-
|
|
1
|
+
import { af as ReadonlyIdentity, a as Identity, aB as DescriptorSigningRequest, aC as Transaction, ax as SignerSession, a2 as DescriptorProvider, aD as IntentFeeConfig, aE as OffchainInput, aF as FeeAmount, aG as OnchainInput, aH as FeeOutput, X as IntentRepository, Y as ArkIntent, Z as IntentPageFilter, P as PageRequest, D as PageResult, O as Outpoint, _ as VirtualTxRepository, $ as VirtualTx, a0 as VtxoBranch, W as WalletRepository, B as ExtendedVirtualCoin, F as ScriptVtxoCursor, H as ScriptVtxoPageOptions, J as StoredVtxo, K as VtxoRepositoryKey, E as ExtendedCoin, L as TransactionHistoryPageFilter, M as TransactionHistoryPageCursor, h as ArkTransaction, Q as WalletState, z as Contract, C as ContractRepository, U as ContractFilter, I as IWallet, u as ArkProvider, av as SettlementConfig, aI as ContractWatcherConfig, aJ as Asset, R as Recipient, aK as FeeInfo, o as SettlementEvent, N as NormalizedExtendedVirtualCoin, S as SettleParams, G as GetArkadeInfoOptions, aL as GetVtxosOptions, aM as PaginationOptions, f as GetVtxosFilter, g as GetSpendableVtxosFilter, aN as CreateContractParams, aO as GetContractsFilter, y as VirtualCoin, aP as GetSpendablePathsOptions, aQ as GetAllSpendingPathsOptions, l as GetNewAddressesOptions, aR as IssuanceParams, aS as ReissuanceParams, aT as BurnParams, aU as RenewVtxosOptions, A as ArkadeInfo, aV as NormalizedVtxoPage, c as ArkadeReader, d as ArkadeBroadcaster, e as WalletBalance, am as ContractSyncState, aq as ContractWithVtxos, aW as WatchedScript, aX as PathSelection, m as NewAddress, aY as ContractEvent, aZ as AssetDetails, a_ as IssuanceResult, a$ as DelegateInfo, b0 as MigrationGlobalSkipReason, b1 as MigrationLegSkipReason, b2 as SignerStatus, ae as IReadonlyWallet, i as ActivityRegistry, al as IReadonlyAssetManager, b3 as StorageConfig, j as Activity, k as IContractManager, q as IAssetManager, p as SendParams, n as IDelegateManager, b4 as IVtxoManager, ag as OnchainProvider, a3 as Network, ao as NetworkName, as as Coin, b5 as SendBitcoinParams, b6 as ExplorerTransaction, ay as SignedIntent, az as Intent, b7 as TreeNonces, b8 as TreePartialSigs, T as TxNotificationEvent, b9 as PendingTx, x as TapLeafScript, ba as EncodedVtxoScript, a4 as CSVMultisigTapscript, w as RelativeTimelock, V as VtxoScript, bb as Status, ap as ArkAddress, bc as ChainTx, v as IndexerProvider, a7 as TxTree, bd as PathContext } from './index-CKmB14Yu.cjs';
|
|
2
|
+
export { be as ActivityIntent, bf as ActivityResolver, bg as ArkIntentState, bh as ArkTapscript, bi as AssetMetadata, bj as BITCOIN_EMULATOR_PUBKEY, bk as BaseWalletConfig, ab as BatchFailedEvent, a9 as BatchFinalizationEvent, aa as BatchFinalizedEvent, bl as BatchInfo, bm as BatchSignableIdentity, a5 as BatchStartedEvent, bn as CLTVMultisigTapscript, bo as CandidateDeps, bp as ChainTxType, a1 as ChainedTxType, bq as CommitmentTx, br as ConditionCSVMultisigTapscript, bs as ConditionMultisigTapscript, bt as ContractBalance, bu as ContractEventCallback, bv as ContractHandler, at as ContractManager, au as ContractManagerConfig, bw as ContractState, bx as ContractVtxo, by as ContractVtxoEvent, bz as ContractWatcher, bA as DEFAULT_VTXO_PAGE_SIZE, bB as DelegateManagerImpl, bC as DelegateOptions, ah as DelegateProvider, bD as DeprecatedSignerMigrationReport, bE as DeprecatedSignerReport, bF as DigestMismatchError, bG as Discoverable, bH as DiscoveredContract, bI as DiscoveryDeps, bJ as ESPLORA_URL, bK as EsploraProvider, bL as EventSourceCapable, bM as EventSourceFactory, bN as EventSourceLike, bO as EventSourceUnavailableError, aj as ExitCaptureMode, bP as ExitChainResolver, ak as ExitDataSource, bQ as ExtendedContractVtxo, bR as GroupMembership, bS as HandlerError, bT as INTENT_TERMINAL_STATES, bU as IndexerTxType, bV as IntentCoin, bW as IntentFilter, bX as KnownMetadata, bY as MAX_PAGE_SIZE, bZ as MUTINYNET_EMULATOR_PUBKEY, b_ as MigrateDeprecatedSignerOptions, b$ as MigrationLegReport, c0 as MigrationVtxoRef, c1 as MultisigTapscript, c2 as NewAddressType, c3 as Nonces, c4 as Output, c5 as PageResponse, c6 as PartialSig, c7 as PrevTxSource, c8 as PrevTxUnavailableError, c9 as ProviderClass, ca as REGTEST_EMULATOR_PUBKEY, cb as RawTxSource, ai as ReadonlyWalletConfig, an as RecipientArkadeAddressContext, r as RestArkProvider, cc as RestDelegateProvider, s as RestIndexerProvider, cd as ScanContractsOptions, ce as ScanResult, cf as ScheduledSession, cg as SettlementEventType, ch as SignRequest, ci as SignerClassification, cj as SignerSet, ck as SubscriptionEvent, cl as SubscriptionHeartbeat, t as SubscriptionResponse, cm as SweepTxNotification, cn as TapLeaves, co as TapTreeCoder, cp as TapscriptType, aA as TimeHeight, a8 as TreeNoncesEvent, ad as TreeSignatureEvent, a6 as TreeSigningStartedEvent, ac as TreeTxEvent, cq as Tx, cr as TxHistoryRecord, cs as TxKey, ct as TxNotification, cu as TxTag, cv as TxTreeNode, cw as TxType, cx as Vtxo, cy as VtxoChain, aw as VtxoManager, cz as VtxoType, b as WalletConfig, cA as WalletMode, cB as WithPrevTx, cC as assertAllowedSighashTypes, cD as assertPageRequest, cE as assertRecipientArkadeAddress, cF as assetMintResolver, cG as attachPrevArkTxs, cH as attachPrevoutTxs, cI as boardingResolver, cJ as canRecoverOnchain, cK as canSpendOffchain, cL as canSweepOnchain, cM as classifyAgainstSignerSet, cN as classifyContractSigner, cO as collabExitResolver, cP as collectContracts, cQ as collectIntents, cR as collectPages, cS as collectScriptVtxos, cT as collectTransactionHistory, cU as collectUtxos, cV as collectVtxos, cW as configureEventSource, cX as createDefaultActivityRegistry, cY as createExitChainResolver, cZ as decodeTapscript, c_ as defaultEmulatorPubkey, c$ as getAllNormalizedVtxos, d0 as getConfiguredEventSource, d1 as getNetwork, d2 as getNormalizedVtxos, d3 as getRandomId, d4 as getSequence, d5 as hasCandidates, d6 as isBatchSignable, d7 as isContractVtxoEvent, d8 as isCooperativelyMigratable, d9 as isDiscoverable, da as isEventSourceUnavailableError, db as isPastExpiry, dc as isSigningIdentity, dd as isSubdust, de as isTerminalIntentState, df as isVirtualCoin, dg as isVtxoExpiringSoon, dh as isVtxoSpent, di as iteratePages, dj as networkFromArkadeInfo, dk as networks, dl as pageResult, dm as resolveEmulatorPubkey, dn as resolveEventSource, dp as resolvePrevTxs, dq as scriptFromTapLeafScript, dr as signerSetFromInfo, ds as toXOnlySignerHex, dt as withPrevTxs } from './index-CKmB14Yu.cjs';
|
|
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-BsL2G3Qb.cjs';
|
|
4
|
+
export { f as AbortError, g as ArkError, h as ArkErrorName, i as ArkadeCashClaimResult, j as ArkadeCashCreateError, k as ArkadeCashUnclaimedReason, l as ArkadeCashUnclaimedVtxo, m as BoardingUtxoGroup, C as CheckpointExitDelayPolicy, D as DEFAULT_MIN_BATCH_EXPIRY_SECONDS, n as DEFAULT_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, F as ForeignDescriptorError, I as IncomingFunds, M as MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD, o as MUTINYNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, p as ProviderKind, q as ProviderUnavailableError, r as REGTEST_MIN_BATCH_EXPIRY_SECONDS, s as REGTEST_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, S as SIGNET_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, t as ServerInfoSource, u as ServerResponseMismatchError, v as WaitForIncomingFundsOptions, w as WalletCannotAllocateAddressError, x as assertValidBatchExpiry, y as assertValidServerUnrollScript, z as defaultBatchExpiryPolicy, E as defaultCheckpointExitDelayPolicy, G as isAddressAllocationCapable, J as isArkError, K as isHDAllocationCapable, L as isHDWalletCapable, N as maybeArkError, O as resolveBatchExpiryPolicy, Q as resolveCheckpointExitDelayPolicy, T as resolveDescriptorSigner, U as selectVirtualCoins, V as signingDescriptorIndex, X as strictSigningDescriptorIndex, Y as waitForIncomingFunds } from './wallet-BsL2G3Qb.cjs';
|
|
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 InputRef, e as InputDef, f as ArkadeValueType, g as ArkadeArgType, h as ArkadeContractParams, i as ArkadeSegment, j as AsmToken, S as SUPPORTED_PROGRAM_VERSION, k as SignerRef, T as TapscriptSegment, l as TweakedSigner, 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-D0BuYwhF.cjs';
|
|
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-D0BuYwhF.cjs';
|
|
7
|
+
import { D as DefaultVtxo } from './delegate-BgpUJW5B.cjs';
|
|
8
|
+
export { a as DelegateVtxo } from './delegate-BgpUJW5B.cjs';
|
|
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';
|
|
@@ -109,9 +109,8 @@ interface NetworkOptions {
|
|
|
109
109
|
/** Used for a caller-supplied account-descriptor template. */
|
|
110
110
|
interface DescriptorOptions {
|
|
111
111
|
/**
|
|
112
|
-
* Account-descriptor *template
|
|
113
|
-
*
|
|
114
|
-
* read by HD providers to rotate through derivation indices.
|
|
112
|
+
* Account-descriptor *template*; must end with the BIP-32 wildcard suffix `/*)`. Stored as-is
|
|
113
|
+
* on {@link SeedIdentity.descriptor} for HD providers to rotate through indices.
|
|
115
114
|
*/
|
|
116
115
|
descriptor: string;
|
|
117
116
|
}
|
|
@@ -123,32 +122,18 @@ type MnemonicOptions = SeedIdentityOptions & {
|
|
|
123
122
|
passphrase?: string;
|
|
124
123
|
};
|
|
125
124
|
/**
|
|
126
|
-
* Seed-based identity derived from a raw seed and an account descriptor
|
|
127
|
-
* *template*.
|
|
125
|
+
* Seed-based identity derived from a raw seed and an account descriptor *template*.
|
|
128
126
|
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
127
|
+
* The recommended identity type: BIP86 (Taproot) derivation by default, or a caller-supplied
|
|
128
|
+
* wildcard template. Prefer it (or @see MnemonicIdentity) over `SingleKey`, which exists for
|
|
129
|
+
* backward compatibility with raw nsec-style keys.
|
|
132
130
|
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
* raw nsec-style keys.
|
|
131
|
+
* {@link descriptor} holds the wildcard template (e.g. `tr([fp/86'/0'/0']xpub/0/*)`); consumers
|
|
132
|
+
* materialize concrete indices themselves (see `HDDescriptorProvider`).
|
|
136
133
|
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
* concrete descriptor at a specific index materialize it themselves
|
|
141
|
-
* (see `HDDescriptorProvider` in the wallet layer).
|
|
142
|
-
*
|
|
143
|
-
* Exposes seed-level primitives (signing, derivation, the template)
|
|
144
|
-
* but is deliberately NOT a `DescriptorProvider`. Wrap it explicitly
|
|
145
|
-
* to get one:
|
|
146
|
-
* - `HDDescriptorProvider` for rotating receive addresses.
|
|
147
|
-
* - {@link StaticDescriptorProvider} for legacy, single-key behaviour.
|
|
148
|
-
*
|
|
149
|
-
* The split prevents a SeedIdentity from being silently used as a
|
|
150
|
-
* concrete descriptor source, which would defeat HD rotation without
|
|
151
|
-
* any compile-time signal that something was wrong.
|
|
134
|
+
* Deliberately NOT a `DescriptorProvider`, so it can't silently be used as a concrete
|
|
135
|
+
* descriptor source and defeat HD rotation. Wrap it in `HDDescriptorProvider` (rotating
|
|
136
|
+
* receive addresses) or {@link StaticDescriptorProvider} (legacy single-key behaviour).
|
|
152
137
|
*
|
|
153
138
|
* @example
|
|
154
139
|
* ```typescript
|
|
@@ -166,34 +151,21 @@ type MnemonicOptions = SeedIdentityOptions & {
|
|
|
166
151
|
*/
|
|
167
152
|
declare class SeedIdentity implements HDCapableIdentity {
|
|
168
153
|
private readonly derivedKey;
|
|
169
|
-
/**
|
|
170
|
-
* Wildcard account-descriptor template (e.g.
|
|
171
|
-
* `tr([fp/86'/0'/0']xpub/0/*)`). The canonical thing to pass
|
|
172
|
-
* through the system; consumers materialize a concrete descriptor
|
|
173
|
-
* at a specific index themselves (see `HDDescriptorProvider` in
|
|
174
|
-
* the wallet layer for the rotating-counter use case).
|
|
175
|
-
*/
|
|
154
|
+
/** Wildcard account-descriptor template (e.g. `tr([fp/86'/0'/0']xpub/0/*)`). */
|
|
176
155
|
readonly descriptor: string;
|
|
177
156
|
/**
|
|
178
|
-
* Constructs a SeedIdentity from a 64-byte seed and either a
|
|
179
|
-
*
|
|
180
|
-
* default BIP86 path at the requested network (`{ isMainnet }`).
|
|
181
|
-
* Prefer the {@link fromSeed} factory for symmetry with
|
|
182
|
-
* {@link MnemonicIdentity.fromMnemonic}.
|
|
157
|
+
* Constructs a SeedIdentity from a 64-byte seed and either a wildcard `{ descriptor }` or the
|
|
158
|
+
* default BIP86 path for `{ isMainnet }`. Prefer {@link fromSeed}.
|
|
183
159
|
*
|
|
184
|
-
* Throws on a non-wildcard descriptor, an xpub mismatch with the
|
|
185
|
-
*
|
|
160
|
+
* Throws on a non-wildcard descriptor, an xpub mismatch with the seed, or a missing
|
|
161
|
+
* derivation path.
|
|
186
162
|
*/
|
|
187
163
|
constructor(seed: Uint8Array, opts?: SeedIdentityOptions);
|
|
188
164
|
/**
|
|
189
|
-
* Creates a SeedIdentity from a raw 64-byte seed
|
|
190
|
-
*
|
|
191
|
-
* Pass `{ isMainnet }` for default BIP86 derivation, or
|
|
192
|
-
* `{ descriptor }` for a caller-supplied account-descriptor
|
|
193
|
-
* template (the option's value must end with `/*)`).
|
|
165
|
+
* Creates a SeedIdentity from a raw 64-byte seed: `{ isMainnet }` for default BIP86
|
|
166
|
+
* derivation, or `{ descriptor }` for a template ending in `/*)`.
|
|
194
167
|
*
|
|
195
168
|
* @param seed - 64-byte seed (typically from mnemonicToSeedSync)
|
|
196
|
-
* @param opts - Network selection or descriptor template.
|
|
197
169
|
*/
|
|
198
170
|
static fromSeed(seed: Uint8Array, opts?: SeedIdentityOptions): SeedIdentity;
|
|
199
171
|
xOnlyPublicKey(): Promise<Uint8Array>;
|
|
@@ -201,22 +173,13 @@ declare class SeedIdentity implements HDCapableIdentity {
|
|
|
201
173
|
sign(tx: Transaction, inputIndexes?: number[]): Promise<Transaction>;
|
|
202
174
|
signMessage(message: Uint8Array, signatureType?: "schnorr" | "ecdsa"): Promise<Uint8Array>;
|
|
203
175
|
/**
|
|
204
|
-
* BIP-340 sign `messageHash` with this identity's own key, aux_rand = 0
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
* {@link signSchnorrDeterministicWithDescriptor}, for an `auto`-mode wallet
|
|
208
|
-
* whose bare `tr(pubkey)` resolves to the identity itself rather than to a
|
|
209
|
-
* {@link DescriptorIdentity}. Deliberately NOT routed through
|
|
210
|
-
* `signMessage`, whose schnorr branch draws a random aux_rand and would
|
|
211
|
-
* make the "deterministic" signature unreproducible.
|
|
176
|
+
* BIP-340 sign `messageHash` with this identity's own key, aux_rand = 0 (for an `auto`-mode
|
|
177
|
+
* wallet whose bare `tr(pubkey)` resolves to the identity itself). NOT via `signMessage`,
|
|
178
|
+
* whose random aux_rand would make the signature unreproducible.
|
|
212
179
|
*/
|
|
213
180
|
signSchnorrDeterministic(messageHash: Uint8Array): Promise<Uint8Array>;
|
|
214
181
|
signerSession(): SignerSession;
|
|
215
|
-
/**
|
|
216
|
-
* Converts to a watch-only identity that cannot sign. Carries the
|
|
217
|
-
* template forward, so the readonly side stays HD-capable (can
|
|
218
|
-
* derive descriptors at any index without seed access).
|
|
219
|
-
*/
|
|
182
|
+
/** Watch-only copy; carries the template forward, so it stays HD-capable without the seed. */
|
|
220
183
|
toReadonly(): Promise<ReadonlyDescriptorIdentity>;
|
|
221
184
|
/** Returns true when `descriptor` is derived from this identity's seed. */
|
|
222
185
|
ownsDescriptor(descriptor: string): boolean;
|
|
@@ -238,12 +201,8 @@ declare class SeedIdentity implements HDCapableIdentity {
|
|
|
238
201
|
private signMessageWithKey;
|
|
239
202
|
}
|
|
240
203
|
/**
|
|
241
|
-
* Mnemonic-based identity derived from a BIP39 phrase
|
|
242
|
-
*
|
|
243
|
-
* This is the most user-friendly identity type — recommended for wallet
|
|
244
|
-
* applications where users manage their own backup phrase. Extends
|
|
245
|
-
* @see SeedIdentity with mnemonic validation and optional passphrase
|
|
246
|
-
* support.
|
|
204
|
+
* Mnemonic-based identity derived from a BIP39 phrase; recommended where users manage their own
|
|
205
|
+
* backup phrase. Extends @see SeedIdentity with mnemonic validation and an optional passphrase.
|
|
247
206
|
*
|
|
248
207
|
* @example
|
|
249
208
|
* ```typescript
|
|
@@ -256,27 +215,16 @@ declare class SeedIdentity implements HDCapableIdentity {
|
|
|
256
215
|
declare class MnemonicIdentity extends SeedIdentity {
|
|
257
216
|
private constructor();
|
|
258
217
|
/**
|
|
259
|
-
* Creates a MnemonicIdentity from a BIP39
|
|
260
|
-
*
|
|
261
|
-
* Pass `{ isMainnet }` for default BIP86 derivation, or
|
|
262
|
-
* `{ descriptor }` for a caller-supplied account-descriptor
|
|
263
|
-
* template (the option's value must end with `/*)`).
|
|
218
|
+
* Creates a MnemonicIdentity from a BIP39 phrase: `{ isMainnet }` for default BIP86
|
|
219
|
+
* derivation, or `{ descriptor }` for a template ending in `/*)`, plus optional passphrase.
|
|
264
220
|
*
|
|
265
221
|
* @param phrase - BIP39 mnemonic phrase (12 or 24 words)
|
|
266
|
-
* @param opts - Network selection or descriptor template, plus optional passphrase
|
|
267
222
|
*/
|
|
268
223
|
static fromMnemonic(phrase: string, opts?: MnemonicOptions): MnemonicIdentity;
|
|
269
224
|
}
|
|
270
225
|
/**
|
|
271
|
-
* Watch-only HD identity from a descriptor
|
|
272
|
-
*
|
|
273
|
-
* Can derive public keys but cannot sign transactions. Use this for
|
|
274
|
-
* watch-only wallets — given just an xpub-based template, the readonly
|
|
275
|
-
* side still rotates through HD indices.
|
|
276
|
-
*
|
|
277
|
-
* Constructed from a wildcard template (e.g.
|
|
278
|
-
* `tr([fp/86'/0'/0']xpub.../0/*)`); the {@link descriptor} field
|
|
279
|
-
* holds it for HD providers to consume.
|
|
226
|
+
* Watch-only HD identity from a wildcard descriptor template (e.g.
|
|
227
|
+
* `tr([fp/86'/0'/0']xpub.../0/*)`): derives public keys and rotates HD indices, cannot sign.
|
|
280
228
|
*
|
|
281
229
|
* @example
|
|
282
230
|
* ```typescript
|
|
@@ -289,26 +237,14 @@ declare class MnemonicIdentity extends SeedIdentity {
|
|
|
289
237
|
*/
|
|
290
238
|
declare class ReadonlyDescriptorIdentity implements ReadonlyHDCapableIdentity {
|
|
291
239
|
/**
|
|
292
|
-
* Index-0 expansion of {@link descriptor}
|
|
293
|
-
* (
|
|
294
|
-
* pubkey (derived through the bip32 node when needed) are read off
|
|
295
|
-
* this on demand — no separate caches.
|
|
240
|
+
* Index-0 expansion of {@link descriptor}; the x-only pubkey (32 bytes) and the compressed
|
|
241
|
+
* pubkey (via the bip32 node) are both read off it on demand.
|
|
296
242
|
*/
|
|
297
243
|
private readonly indexZero;
|
|
298
|
-
/**
|
|
299
|
-
* Wildcard account-descriptor template (e.g.
|
|
300
|
-
* `tr([fp/86'/0'/0']xpub/0/*)`). HD rotation consumers materialize
|
|
301
|
-
* a concrete descriptor at a specific index themselves.
|
|
302
|
-
*/
|
|
244
|
+
/** Wildcard account-descriptor template (e.g. `tr([fp/86'/0'/0']xpub/0/*)`). */
|
|
303
245
|
readonly descriptor: string;
|
|
304
246
|
private constructor();
|
|
305
|
-
/**
|
|
306
|
-
* Creates a ReadonlyDescriptorIdentity from an account-descriptor
|
|
307
|
-
* *template* (must end with the BIP-32 wildcard suffix `/*)`).
|
|
308
|
-
*
|
|
309
|
-
* @param descriptor - Wildcard-suffixed Taproot template
|
|
310
|
-
* (`tr([fp/path']xpub.../child/*)`).
|
|
311
|
-
*/
|
|
247
|
+
/** @param descriptor - Wildcard-suffixed Taproot template (`tr([fp/path']xpub.../child/*)`). */
|
|
312
248
|
static fromDescriptor(descriptor: string): ReadonlyDescriptorIdentity;
|
|
313
249
|
xOnlyPublicKey(): Promise<Uint8Array>;
|
|
314
250
|
compressedPublicKey(): Promise<Uint8Array>;
|
|
@@ -553,7 +489,7 @@ declare class InMemoryIntentRepository implements IntentRepository {
|
|
|
553
489
|
private byId;
|
|
554
490
|
clear(): Promise<void>;
|
|
555
491
|
saveIntent(intent: ArkIntent): Promise<void>;
|
|
556
|
-
|
|
492
|
+
getIntentsPage(filter: IntentPageFilter | undefined, page: PageRequest): Promise<PageResult<ArkIntent>>;
|
|
557
493
|
getLockedVtxoOutpoints(): Promise<Outpoint[]>;
|
|
558
494
|
[Symbol.asyncDispose](): Promise<void>;
|
|
559
495
|
}
|
|
@@ -608,7 +544,7 @@ declare class IndexedDBIntentRepository implements IntentRepository {
|
|
|
608
544
|
private getDB;
|
|
609
545
|
clear(): Promise<void>;
|
|
610
546
|
saveIntent(intent: ArkIntent): Promise<void>;
|
|
611
|
-
|
|
547
|
+
getIntentsPage(filter: IntentPageFilter | undefined, page: PageRequest): Promise<PageResult<ArkIntent>>;
|
|
612
548
|
getLockedVtxoOutpoints(): Promise<Outpoint[]>;
|
|
613
549
|
[Symbol.asyncDispose](): Promise<void>;
|
|
614
550
|
}
|
|
@@ -618,21 +554,21 @@ declare class IndexedDBIntentRepository implements IntentRepository {
|
|
|
618
554
|
* Data is ephemeral and scoped to the instance.
|
|
619
555
|
*/
|
|
620
556
|
declare class InMemoryWalletRepository implements WalletRepository {
|
|
621
|
-
readonly version:
|
|
557
|
+
readonly version: 2;
|
|
622
558
|
private readonly vtxosByAddress;
|
|
623
559
|
private readonly utxosByAddress;
|
|
624
560
|
private readonly txsByAddress;
|
|
625
561
|
private walletState;
|
|
626
|
-
|
|
562
|
+
getVtxosPage(address: string, page: PageRequest<Outpoint>): Promise<PageResult<ExtendedVirtualCoin, Outpoint>>;
|
|
627
563
|
saveVtxos(address: string, vtxos: ExtendedVirtualCoin[]): Promise<void>;
|
|
628
564
|
deleteVtxos(address: string): Promise<void>;
|
|
629
|
-
|
|
565
|
+
getVtxosForScriptPage(script: string, page: PageRequest<ScriptVtxoCursor>, options?: ScriptVtxoPageOptions): Promise<PageResult<StoredVtxo, ScriptVtxoCursor>>;
|
|
630
566
|
saveVtxosForScript(key: VtxoRepositoryKey, vtxos: ExtendedVirtualCoin[]): Promise<void>;
|
|
631
567
|
deleteVtxosForScript(script: string): Promise<void>;
|
|
632
|
-
|
|
568
|
+
getUtxosPage(address: string, page: PageRequest<Outpoint>): Promise<PageResult<ExtendedCoin, Outpoint>>;
|
|
633
569
|
saveUtxos(address: string, utxos: ExtendedCoin[]): Promise<void>;
|
|
634
570
|
deleteUtxos(address: string): Promise<void>;
|
|
635
|
-
|
|
571
|
+
getTransactionHistoryPage(filter: TransactionHistoryPageFilter, page: PageRequest<TransactionHistoryPageCursor>): Promise<PageResult<ArkTransaction, TransactionHistoryPageCursor>>;
|
|
636
572
|
saveTransactions(address: string, txs: ArkTransaction[]): Promise<void>;
|
|
637
573
|
deleteTransactions(address: string): Promise<void>;
|
|
638
574
|
getWalletState(): Promise<WalletState | null>;
|
|
@@ -642,11 +578,8 @@ declare class InMemoryWalletRepository implements WalletRepository {
|
|
|
642
578
|
}
|
|
643
579
|
|
|
644
580
|
/**
|
|
645
|
-
* Whether generic wallet spending may select this contract's VTXOs.
|
|
646
|
-
*
|
|
647
|
-
* Default closed: a type whose handler declares nothing — a custom type, a
|
|
648
|
-
* plugin type, a row whose handler is not registered in this context — is not
|
|
649
|
-
* spendable. Every shipped handler answers explicitly.
|
|
581
|
+
* Whether generic wallet spending may select this contract's VTXOs. Default closed: a type whose
|
|
582
|
+
* handler declares nothing, or has no handler registered here, is not spendable.
|
|
650
583
|
*
|
|
651
584
|
* @see ContractHandler.isGenericallySpendable
|
|
652
585
|
*/
|
|
@@ -665,68 +598,44 @@ type ExcludableVtxo = {
|
|
|
665
598
|
/** {@link gatedContracts}' answer, as callers that only read it should take it. */
|
|
666
599
|
type GatedContracts = ReadonlyMap<string, string>;
|
|
667
600
|
/**
|
|
668
|
-
* Why generic spending skips a VTXO, or `undefined` when it does not
|
|
669
|
-
*
|
|
670
|
-
*
|
|
671
|
-
* Generic spending applies three exclusions (the contract gate, pending
|
|
672
|
-
* recovery, intent locks) that key on different things — script, script,
|
|
673
|
-
* outpoint. Stating each as a reason-or-undefined lets all three report through
|
|
674
|
-
* one path, so no exclusion can drop a coin silently while another logs.
|
|
601
|
+
* Why generic spending skips a VTXO, or `undefined` when it does not; phrased to follow the
|
|
602
|
+
* outpoint in a log line. One shape for all exclusions (contract gate, pending recovery, intent
|
|
603
|
+
* locks) so none can drop a coin silently while another logs.
|
|
675
604
|
*/
|
|
676
605
|
type VtxoExclusion = (vtxo: ExcludableVtxo) => string | undefined;
|
|
677
606
|
/**
|
|
678
|
-
* The contract gate as an exclusion,
|
|
679
|
-
*
|
|
680
|
-
*
|
|
681
|
-
* The two want opposite reactions from whoever reads the log. A decline is
|
|
682
|
-
* the gate working as designed — nothing to do. A missing handler means a
|
|
683
|
-
* contract row this build cannot interpret, e.g. a vendoring or version
|
|
684
|
-
* mismatch, which is worth a reader's attention. `contractHandlers` is
|
|
685
|
-
* already available here, so the message can tell them apart instead of
|
|
686
|
-
* collapsing both into one sentence that reads as the same case either way.
|
|
607
|
+
* The contract gate as an exclusion, distinguishing a handler's decline (working as designed)
|
|
608
|
+
* from a missing handler (a row this build can't interpret, e.g. a version mismatch, worth a
|
|
609
|
+
* reader's attention).
|
|
687
610
|
*/
|
|
688
611
|
declare function gateExclusion(gated: GatedContracts): VtxoExclusion;
|
|
689
612
|
/** Outpoints excluded for a shared reason, e.g. an intent-lock set. */
|
|
690
613
|
declare function outpointExclusion(outpoints: ReadonlySet<string>, reason: string): VtxoExclusion;
|
|
691
614
|
/**
|
|
692
|
-
* Outpoints excluded for
|
|
693
|
-
*
|
|
694
|
-
*
|
|
695
|
-
* Unlike {@link gateExclusion}, the reasons are the handlers' own sentences and
|
|
696
|
-
* are not rephrased to follow the outpoint: that text is what tells the reader
|
|
697
|
-
* when to retry, and a paraphrase here would be a second spelling to keep in
|
|
698
|
-
* step with it.
|
|
615
|
+
* Outpoints excluded for per-input reasons (e.g. a per-input timelock). The handlers' own
|
|
616
|
+
* sentences, unparaphrased: they tell the reader when to retry.
|
|
699
617
|
*
|
|
700
618
|
* @see outpointExclusion for the shared-reason form.
|
|
701
619
|
*/
|
|
702
620
|
declare function outpointReasons(reasons: ReadonlyMap<string, string>): VtxoExclusion;
|
|
703
621
|
/**
|
|
704
|
-
* Report VTXOs an exclusion dropped
|
|
705
|
-
*
|
|
706
|
-
* Debug level, one line per VTXO per reason.
|
|
622
|
+
* Report VTXOs an exclusion dropped, the only field-diagnosable signal for a coin missing from a
|
|
623
|
+
* spend. Debug level, one line per VTXO per reason.
|
|
707
624
|
*/
|
|
708
625
|
declare function logExcludedVtxos(source: string, vtxos: readonly ExcludableVtxo[], exclusions: readonly VtxoExclusion[]): void;
|
|
709
626
|
/**
|
|
710
|
-
* Thrown when a spend names VTXOs whose contract can no longer be annotated
|
|
711
|
-
*
|
|
712
|
-
*
|
|
713
|
-
*
|
|
714
|
-
* Raised before submission on purpose. Spending reads the tapscripts stored on
|
|
715
|
-
* each coin rather than re-deriving them, so such a spend would otherwise build
|
|
716
|
-
* and broadcast normally and only fail in the bookkeeping afterwards, leaving
|
|
717
|
-
* the transaction on the network and the local state behind it.
|
|
627
|
+
* Thrown before submission when a spend names VTXOs whose contract can no longer be annotated
|
|
628
|
+
* (handler unregistered, stored params rejected, or no row). Otherwise the spend would broadcast
|
|
629
|
+
* and fail in the bookkeeping, leaving local state behind the network.
|
|
718
630
|
*/
|
|
719
631
|
declare class UnannotatableInputError extends Error {
|
|
720
632
|
readonly name = "UnannotatableInputError";
|
|
721
633
|
}
|
|
722
634
|
|
|
723
635
|
/**
|
|
724
|
-
* Encode a contract to the arkcontract string format
|
|
725
|
-
*
|
|
726
|
-
*
|
|
727
|
-
*
|
|
728
|
-
* This format is compatible with NArk and allows contracts to be
|
|
729
|
-
* shared/imported across different Arkade SDKs.
|
|
636
|
+
* Encode a contract to the arkcontract string format:
|
|
637
|
+
* `arkcontract={type}&{key1}={value1}&...`. NArk-compatible, so contracts can be shared
|
|
638
|
+
* across Arkade SDKs.
|
|
730
639
|
*
|
|
731
640
|
* @example
|
|
732
641
|
* ```typescript
|
|
@@ -742,27 +651,18 @@ declare class UnannotatableInputError extends Error {
|
|
|
742
651
|
*/
|
|
743
652
|
declare function encodeArkContract(contract: Contract): string;
|
|
744
653
|
/**
|
|
745
|
-
*
|
|
746
|
-
*
|
|
747
|
-
* This is a low-level representation. For type-safe contract creation,
|
|
748
|
-
* use `contractFromArkContract` or `contractFromArkContractWithAddress`
|
|
749
|
-
* which validate params through the handler system.
|
|
654
|
+
* Raw (unvalidated) result of decoding an arkcontract string. For typed contracts use
|
|
655
|
+
* `contractFromArkContract` / `contractFromArkContractWithAddress`, which validate via handlers.
|
|
750
656
|
*/
|
|
751
657
|
interface ParsedArkContract {
|
|
752
658
|
/** Contract type (e.g., "vhtlc", "default") */
|
|
753
659
|
type: string;
|
|
754
|
-
/** All key-value pairs from the string */
|
|
660
|
+
/** All other key-value pairs from the string */
|
|
755
661
|
data: Record<string, string>;
|
|
756
662
|
}
|
|
757
663
|
/**
|
|
758
|
-
* Decode an arkcontract string into raw type and data.
|
|
759
|
-
*
|
|
760
|
-
* This is a low-level function that parses the URL-encoded format.
|
|
761
|
-
* For creating typed Contract objects, use `contractFromArkContract`
|
|
762
|
-
* or `contractFromArkContractWithAddress` instead.
|
|
664
|
+
* Decode an arkcontract string into raw type and data (low-level; see {@link ParsedArkContract}).
|
|
763
665
|
*
|
|
764
|
-
* @param encoded - The arkcontract string
|
|
765
|
-
* @returns Parsed type and key-value data
|
|
766
666
|
* @throws If the string is not a valid arkcontract
|
|
767
667
|
*
|
|
768
668
|
* @example
|
|
@@ -773,14 +673,9 @@ interface ParsedArkContract {
|
|
|
773
673
|
*/
|
|
774
674
|
declare function decodeArkContract(encoded: string): ParsedArkContract;
|
|
775
675
|
/**
|
|
776
|
-
* Create a Contract from an arkcontract string.
|
|
777
|
-
*
|
|
778
|
-
* This requires a handler to be registered for the contract type.
|
|
676
|
+
* Create a Contract (without script/address) from an arkcontract string.
|
|
779
677
|
*
|
|
780
|
-
* @
|
|
781
|
-
* @param options - Additional options for the contract
|
|
782
|
-
* @returns A Contract object
|
|
783
|
-
* @throws If the string is invalid or no handler exists for the type
|
|
678
|
+
* @throws If the string is invalid or no handler is registered for the type
|
|
784
679
|
*
|
|
785
680
|
* @example
|
|
786
681
|
* ```typescript
|
|
@@ -803,56 +698,26 @@ declare function contractFromArkContract(encoded: string, options?: {
|
|
|
803
698
|
/**
|
|
804
699
|
* Create a full Contract with derived script and address.
|
|
805
700
|
*
|
|
806
|
-
* @param encoded - The arkcontract string
|
|
807
701
|
* @param serverPubKey - Server public key (for address derivation)
|
|
808
702
|
* @param addressPrefix - Address prefix (e.g., "tark" for testnet)
|
|
809
|
-
* @param options - Additional options
|
|
810
|
-
* @returns A complete Contract object
|
|
811
703
|
*/
|
|
812
704
|
declare function contractFromArkContractWithAddress(encoded: string, serverPubKey: Uint8Array, addressPrefix?: string, options?: {
|
|
813
705
|
label?: string;
|
|
814
706
|
state?: "active" | "inactive";
|
|
815
707
|
metadata?: Record<string, unknown>;
|
|
816
708
|
}): Contract;
|
|
817
|
-
/**
|
|
818
|
-
* Check if a string is an arkcontract.
|
|
819
|
-
*/
|
|
709
|
+
/** Check if a string is an arkcontract. */
|
|
820
710
|
declare function isArkContract(str: string): boolean;
|
|
821
711
|
|
|
822
|
-
/**
|
|
823
|
-
* Thrown when a descriptor-capable contract (default, delegate, or boarding)
|
|
824
|
-
* cannot be routed to any signer: its owner key (`params.pubKey`) is not this
|
|
825
|
-
* wallet's baseline signing key, and the record carries no
|
|
826
|
-
* `metadata.signingDescriptor` to send it to a descriptor-aware signer.
|
|
827
|
-
*
|
|
828
|
-
* Note that this can arise also when a contract belongs to a different identity (storage reuse).
|
|
829
|
-
*/
|
|
830
|
-
declare class MissingSigningDescriptorError extends Error {
|
|
831
|
-
readonly contractScript: string;
|
|
832
|
-
readonly contractType: "default" | "delegate" | "boarding";
|
|
833
|
-
readonly name = "MissingSigningDescriptorError";
|
|
834
|
-
constructor(contractScript: string, contractType: "default" | "delegate" | "boarding");
|
|
835
|
-
}
|
|
836
|
-
/**
|
|
837
|
-
* Thrown when an input needs descriptor-aware signing but no
|
|
838
|
-
* DescriptorProvider was wired into the wallet.
|
|
839
|
-
*/
|
|
840
|
-
declare class DescriptorSigningProviderMissingError extends Error {
|
|
841
|
-
readonly name = "DescriptorSigningProviderMissingError";
|
|
842
|
-
constructor();
|
|
843
|
-
}
|
|
844
|
-
|
|
845
712
|
/**
|
|
846
713
|
* In-memory implementation of ContractRepository.
|
|
847
714
|
* Data is ephemeral and scoped to the instance.
|
|
848
715
|
*/
|
|
849
716
|
declare class InMemoryContractRepository implements ContractRepository {
|
|
850
|
-
readonly version:
|
|
851
|
-
private readonly contractData;
|
|
852
|
-
private readonly collections;
|
|
717
|
+
readonly version: 3;
|
|
853
718
|
private readonly contractsByScript;
|
|
854
719
|
clear(): Promise<void>;
|
|
855
|
-
|
|
720
|
+
getContractsPage(filter: ContractFilter | undefined, page: PageRequest): Promise<PageResult<Contract>>;
|
|
856
721
|
saveContract(contract: Contract): Promise<void>;
|
|
857
722
|
deleteContract(script: string): Promise<void>;
|
|
858
723
|
[Symbol.asyncDispose](): Promise<void>;
|
|
@@ -864,11 +729,11 @@ declare class InMemoryContractRepository implements ContractRepository {
|
|
|
864
729
|
* Data is stored as JSON strings in key/value stores.
|
|
865
730
|
*/
|
|
866
731
|
declare class IndexedDBContractRepository implements ContractRepository {
|
|
867
|
-
readonly version:
|
|
732
|
+
readonly version: 3;
|
|
868
733
|
private readonly connection;
|
|
869
734
|
constructor(dbName?: string);
|
|
870
735
|
clear(): Promise<void>;
|
|
871
|
-
|
|
736
|
+
getContractsPage(filter: ContractFilter | undefined, page: PageRequest): Promise<PageResult<Contract>>;
|
|
872
737
|
saveContract(contract: Contract): Promise<void>;
|
|
873
738
|
deleteContract(script: string): Promise<void>;
|
|
874
739
|
private applyContractFilter;
|
|
@@ -880,21 +745,22 @@ declare class IndexedDBContractRepository implements ContractRepository {
|
|
|
880
745
|
* IndexedDB-based implementation of WalletRepository.
|
|
881
746
|
*/
|
|
882
747
|
declare class IndexedDBWalletRepository implements WalletRepository {
|
|
883
|
-
readonly version:
|
|
748
|
+
readonly version: 2;
|
|
884
749
|
private readonly connection;
|
|
885
750
|
constructor(dbName?: string);
|
|
886
751
|
clear(): Promise<void>;
|
|
887
752
|
[Symbol.asyncDispose](): Promise<void>;
|
|
888
|
-
|
|
753
|
+
getVtxosPage(address: string, page: PageRequest<Outpoint>): Promise<PageResult<ExtendedVirtualCoin, Outpoint>>;
|
|
889
754
|
saveVtxos(address: string, vtxos: ExtendedVirtualCoin[]): Promise<void>;
|
|
890
755
|
deleteVtxos(address: string): Promise<void>;
|
|
891
|
-
|
|
756
|
+
getVtxosForScriptPage(script: string, page: PageRequest<ScriptVtxoCursor>, options?: ScriptVtxoPageOptions): Promise<PageResult<StoredVtxo, ScriptVtxoCursor>>;
|
|
892
757
|
saveVtxosForScript(key: VtxoRepositoryKey, vtxos: ExtendedVirtualCoin[]): Promise<void>;
|
|
893
758
|
deleteVtxosForScript(script: string): Promise<void>;
|
|
894
|
-
|
|
759
|
+
getUtxosPage(address: string, page: PageRequest<Outpoint>): Promise<PageResult<ExtendedCoin, Outpoint>>;
|
|
760
|
+
private pageByAddress;
|
|
895
761
|
saveUtxos(address: string, utxos: ExtendedCoin[]): Promise<void>;
|
|
896
762
|
deleteUtxos(address: string): Promise<void>;
|
|
897
|
-
|
|
763
|
+
getTransactionHistoryPage(filter: TransactionHistoryPageFilter, page: PageRequest<TransactionHistoryPageCursor>): Promise<PageResult<ArkTransaction, TransactionHistoryPageCursor>>;
|
|
898
764
|
saveTransactions(address: string, txs: ArkTransaction[]): Promise<void>;
|
|
899
765
|
deleteTransactions(address: string): Promise<void>;
|
|
900
766
|
getWalletState(): Promise<WalletState | null>;
|
|
@@ -909,43 +775,28 @@ interface WalletRestoreHook {
|
|
|
909
775
|
declare function registerWalletRestoreHook(wallet: IWallet, hook: WalletRestoreHook): () => void;
|
|
910
776
|
|
|
911
777
|
/**
|
|
912
|
-
* Domain separator for the preimage derivation.
|
|
913
|
-
*
|
|
914
|
-
*
|
|
915
|
-
*
|
|
916
|
-
* scheme reproduces the same preimage and can recover an artifact another
|
|
917
|
-
* SDK created. Deliberately distinct from the Boltz tag: a shared tag would
|
|
918
|
-
* make one wallet key derive one preimage for both corridors.
|
|
778
|
+
* Domain separator for the preimage derivation. Protocol-scoped and versioned, mirroring NArk's
|
|
779
|
+
* `Arkade-Boltz-Preimage-v1` (`SwapsManagementService.cs:128`), so any Arkade SDK reproduces the
|
|
780
|
+
* same preimage and can recover another SDK's artifact. Deliberately distinct from the Boltz tag:
|
|
781
|
+
* a shared tag would make one wallet key derive one preimage for both corridors.
|
|
919
782
|
*/
|
|
920
783
|
declare const ARKADE_SWAP_PREIMAGE_TAG = "Arkade-RFQ-Preimage-v1";
|
|
921
784
|
/**
|
|
922
|
-
* Domain separator for the **salted**
|
|
923
|
-
*
|
|
924
|
-
*
|
|
925
|
-
*
|
|
926
|
-
* asymmetry is deliberate. The v1 tags must be per-corridor
|
|
927
|
-
* (`Arkade-RFQ-Preimage-v1` here, NArk's `Arkade-Boltz-Preimage-v1` there)
|
|
928
|
-
* because v1 pins its message index, so the tag is the only thing separating
|
|
929
|
-
* two corridors that reach the same key. v2 mints a salt per artifact, so no
|
|
930
|
-
* two artifacts share a message within a corridor, let alone across two — the
|
|
931
|
-
* salt carries the separation, and the tag names the layer it belongs to.
|
|
785
|
+
* Domain separator for the **salted** derivation, used when the descriptor repeats across
|
|
786
|
+
* artifacts. Corridor-generic, unlike {@link ARKADE_SWAP_PREIMAGE_TAG}, deliberately: v1 pins its
|
|
787
|
+
* message index, so its tag is all that separates two corridors reaching the same key; here the
|
|
788
|
+
* per-artifact salt carries that separation.
|
|
932
789
|
*/
|
|
933
790
|
declare const ARKADE_SALTED_PREIMAGE_TAG = "Arkade-Contract-Preimage-Salted-v1";
|
|
934
791
|
/**
|
|
935
|
-
* `TAG ‖ xonly(32) ‖ u32le(index)` — the message that gets BIP-340 signed.
|
|
936
|
-
*
|
|
937
|
-
*
|
|
938
|
-
* restore reconstructs a bare descriptor that serialises differently from the
|
|
939
|
-
* signing descriptor used at creation, and only the key agrees across both.
|
|
792
|
+
* `TAG ‖ xonly(32) ‖ u32le(index)` — the message that gets BIP-340 signed. Anchored on the x-only
|
|
793
|
+
* key, not the descriptor string: a restore rebuilds a descriptor that serialises differently from
|
|
794
|
+
* the one used at creation, and only the key agrees across both.
|
|
940
795
|
*/
|
|
941
796
|
declare function buildPreimageMessage(xonly: Uint8Array, index: number): Uint8Array;
|
|
942
797
|
/**
|
|
943
|
-
* `TAG ‖ xonly(32) ‖ salt(32)` — the salted message that gets BIP-340 signed.
|
|
944
|
-
*
|
|
945
|
-
* The salt replaces v1's pinned index as the source of per-artifact
|
|
946
|
-
* uniqueness, which is what lets a key that repeats across artifacts still
|
|
947
|
-
* derive a distinct preimage for each. It is public: knowing it yields nothing
|
|
948
|
-
* without the seed.
|
|
798
|
+
* `TAG ‖ xonly(32) ‖ salt(32)` — the salted message that gets BIP-340 signed. The salt replaces
|
|
799
|
+
* v1's pinned index as the per-artifact uniqueness source; it is public, useless without the seed.
|
|
949
800
|
*/
|
|
950
801
|
declare function buildSaltedPreimageMessage(xonly: Uint8Array, salt: Uint8Array): Uint8Array;
|
|
951
802
|
/**
|
|
@@ -964,18 +815,14 @@ interface ProvisionedKey {
|
|
|
964
815
|
*/
|
|
965
816
|
descriptor: string;
|
|
966
817
|
/**
|
|
967
|
-
* The
|
|
968
|
-
*
|
|
969
|
-
* callers building the lockup script do not need a separate
|
|
970
|
-
* {@link IWallet.getAddress} round-trip or an `ArkAddress.decode` call.
|
|
818
|
+
* The pkScript of the wallet's current receive address, so callers building the lockup need
|
|
819
|
+
* no separate {@link IWallet.getAddress} or `ArkAddress.decode`.
|
|
971
820
|
*/
|
|
972
821
|
pkScript: Uint8Array;
|
|
973
822
|
/**
|
|
974
|
-
* The receive address {@link pkScript} was decoded from,
|
|
975
|
-
*
|
|
976
|
-
*
|
|
977
|
-
* script, and two independent reads of a wallet that rotates its receive
|
|
978
|
-
* address would not guarantee that — reuse this, never a second
|
|
823
|
+
* The receive address {@link pkScript} was decoded from, in the same {@link IWallet.getAddress}
|
|
824
|
+
* read. The quote-time refund address and the covenant's `refundPkScript` must name the same
|
|
825
|
+
* script, and two reads of a rotating wallet need not agree — reuse this, never a second
|
|
979
826
|
* `getAddress()` call.
|
|
980
827
|
*/
|
|
981
828
|
address: string;
|
|
@@ -990,93 +837,61 @@ interface ProvisionedClaimSecret extends Omit<ProvisionedKey, "pkScript" | "addr
|
|
|
990
837
|
/** `sha256(preimage)` — what the contract commits to. */
|
|
991
838
|
paymentHash: Uint8Array;
|
|
992
839
|
/**
|
|
993
|
-
* The salt {@link preimage} was derived from,
|
|
994
|
-
*
|
|
995
|
-
*
|
|
996
|
-
* still cannot re-derive P.
|
|
997
|
-
*
|
|
998
|
-
* Absent on the other two arms: an HD child descriptor already names one
|
|
999
|
-
* artifact, and a stored preimage needs no derivation input.
|
|
840
|
+
* The salt {@link preimage} was derived from, on the salted arm. **Public**, unlike
|
|
841
|
+
* {@link preimage}: persist it in the clear with the artifact — without it even the seed
|
|
842
|
+
* cannot re-derive P. Absent on the other arms.
|
|
1000
843
|
*/
|
|
1001
844
|
preimageSalt?: Uint8Array;
|
|
1002
845
|
/**
|
|
1003
|
-
* Persist `preimage` with the artifact: this wallet cannot re-derive it
|
|
1004
|
-
*
|
|
1005
|
-
*
|
|
1006
|
-
* given {@link preimageSalt}, where there is one — and nothing secret
|
|
1007
|
-
* needs to be stored.
|
|
846
|
+
* Persist `preimage` with the artifact: this wallet cannot re-derive it (caller-supplied P,
|
|
847
|
+
* or a signer that cannot sign deterministically). When false, P re-derives from the seed
|
|
848
|
+
* (given {@link preimageSalt}, if any) and nothing secret needs storing.
|
|
1008
849
|
*/
|
|
1009
850
|
mustPersistPreimage: boolean;
|
|
1010
851
|
}
|
|
1011
852
|
/**
|
|
1012
|
-
* The key that spends a leg we fund —
|
|
1013
|
-
* of a covenant's cancel path.
|
|
853
|
+
* The key that spends a leg we fund — an HTLC's refund key, a covenant's cancel-path user key.
|
|
1014
854
|
*
|
|
1015
|
-
*
|
|
1016
|
-
*
|
|
1017
|
-
*
|
|
1018
|
-
*
|
|
1019
|
-
* allocated by a worker rebound to another identity, a record restored onto
|
|
1020
|
-
* the wrong seed — and the covenant would bind it, the leg would fund, and
|
|
1021
|
-
* the failure would surface at refund time with the money already committed.
|
|
1022
|
-
* Throws {@link ForeignDescriptorError} instead, before there is a quote.
|
|
855
|
+
* `pubkey` comes from a signer the wallet produced, never the descriptor string alone: parsing
|
|
856
|
+
* succeeds just as well for a key this wallet cannot sign for (a worker rebound to another
|
|
857
|
+
* identity, a record restored onto the wrong seed), and the failure would surface at refund time
|
|
858
|
+
* with the money committed. Throws {@link ForeignDescriptorError} instead, before any quote.
|
|
1023
859
|
*
|
|
1024
|
-
*
|
|
1025
|
-
*
|
|
1026
|
-
* refund path is on the same key as the refund address the caller sends to
|
|
1027
|
-
* at quote time.
|
|
860
|
+
* Reuses the identity key rather than a fresh HD child, so no index is consumed for an artifact
|
|
861
|
+
* never built, and the refund path is on the same key as the quote-time refund address.
|
|
1028
862
|
*/
|
|
1029
863
|
declare function provisionRefundKey(wallet: IWallet): Promise<ProvisionedKey>;
|
|
1030
864
|
/**
|
|
1031
|
-
* The key that spends a leg we claim, plus the preimage that unlocks it.
|
|
1032
|
-
*
|
|
1033
|
-
* Pass `opts.preimage` to bring your own 32-byte P; it comes back verbatim
|
|
1034
|
-
* with `mustPersistPreimage` set, since the wallet cannot re-derive what it
|
|
1035
|
-
* did not choose.
|
|
865
|
+
* The key that spends a leg we claim, plus the preimage that unlocks it. Three arms:
|
|
1036
866
|
*
|
|
1037
|
-
*
|
|
1038
|
-
*
|
|
1039
|
-
*
|
|
1040
|
-
*
|
|
1041
|
-
*
|
|
1042
|
-
*
|
|
1043
|
-
*
|
|
1044
|
-
*
|
|
1045
|
-
* descriptor from a custom provider. Mints a public per-artifact salt and
|
|
1046
|
-
* derives from it, so a key that repeats still yields a distinct P. Only
|
|
1047
|
-
* this arm falls back to a stored random preimage, and only when the signer
|
|
1048
|
-
* refuses — which is discovered by deriving, never by probing.
|
|
867
|
+
* 1. **Caller-supplied `opts.preimage`** (32 bytes). Returned verbatim with
|
|
868
|
+
* `mustPersistPreimage: true`, since the wallet cannot re-derive what it did not choose.
|
|
869
|
+
* 2. **Per-artifact descriptor** (an HD child). Derives from the key alone at the pinned index;
|
|
870
|
+
* nothing at rest. Raises if the signer cannot sign deterministically — that is a broken HD
|
|
871
|
+
* wallet, not a fallback case.
|
|
872
|
+
* 3. **Anything else** (a static `tr(pubkey)`, a custom provider's constant descriptor). Mints a
|
|
873
|
+
* public per-artifact salt and derives from it. Only this arm falls back to a stored random
|
|
874
|
+
* preimage, and only when the signer refuses — discovered by deriving, never by probing.
|
|
1049
875
|
*/
|
|
1050
876
|
declare function provisionClaimSecret(wallet: IWallet, opts?: {
|
|
1051
877
|
preimage?: Uint8Array;
|
|
1052
878
|
}): Promise<ProvisionedClaimSecret>;
|
|
1053
879
|
/**
|
|
1054
|
-
* The signer for a provisioned descriptor, verified
|
|
1055
|
-
* descriptor's key
|
|
1056
|
-
*
|
|
1057
|
-
* The verification is a public-key equality, never a wallet-type probe: a
|
|
1058
|
-
* wallet that answers with the wrong key — another seed's, after a restore
|
|
1059
|
-
* mix-up — would sign happily, and the failure would surface only as a
|
|
1060
|
-
* counterparty rejection or a dead script.
|
|
880
|
+
* The signer for a provisioned descriptor, verified by public-key equality (never a wallet-type
|
|
881
|
+
* probe) to be that descriptor's key: a wallet answering with another seed's key would sign
|
|
882
|
+
* happily and fail only as a counterparty rejection or a dead script.
|
|
1061
883
|
*
|
|
1062
|
-
*
|
|
1063
|
-
*
|
|
1064
|
-
*
|
|
1065
|
-
*
|
|
1066
|
-
* comparison becomes a tautology. What rules that case out is
|
|
1067
|
-
* {@link resolveDescriptorSigner}'s `isOurs` test, which both shipped wallets
|
|
1068
|
-
* resolve through — so this is the backstop for a hand-rolled `IWallet`, not
|
|
1069
|
-
* the primary guarantee.
|
|
884
|
+
* Limit: this catches a wallet substituting its *baseline* identity. A descriptor-scoped identity
|
|
885
|
+
* over the same descriptor reads its pubkey back from the string, making the check a tautology;
|
|
886
|
+
* {@link resolveDescriptorSigner}'s `isOurs` test (used by both shipped wallets) rules that out,
|
|
887
|
+
* so this is the backstop for a hand-rolled `IWallet`, not the primary guarantee.
|
|
1070
888
|
*/
|
|
1071
889
|
declare function contractSigner(wallet: IWallet, descriptor: string): Promise<Identity>;
|
|
1072
890
|
/**
|
|
1073
|
-
* A wallet that holds a contract's key but cannot sign with it
|
|
1074
|
-
*
|
|
1075
|
-
*
|
|
1076
|
-
*
|
|
1077
|
-
* that one says "wrong wallet", this one says "this wallet, without its
|
|
1078
|
-
* signer". Raised at provisioning as well as at signing, so a wallet that
|
|
1079
|
-
* could never spend the leg finds out before it funds one.
|
|
891
|
+
* A wallet that holds a contract's key but cannot sign with it (watch-only, or a remote signer
|
|
892
|
+
* without its transport). Distinct from {@link ForeignDescriptorError} ("wrong wallet") because
|
|
893
|
+
* the remedy differs. Raised at provisioning too, so a wallet that could never spend a leg finds
|
|
894
|
+
* out before funding it.
|
|
1080
895
|
*/
|
|
1081
896
|
declare class WalletCannotSignError extends Error {
|
|
1082
897
|
readonly descriptor: string;
|
|
@@ -1084,18 +899,12 @@ declare class WalletCannotSignError extends Error {
|
|
|
1084
899
|
constructor(descriptor: string);
|
|
1085
900
|
}
|
|
1086
901
|
/**
|
|
1087
|
-
* The preimage for a provisioned descriptor
|
|
1088
|
-
* kept one, otherwise re-derived from the seed.
|
|
902
|
+
* The preimage for a provisioned descriptor, in the precedence {@link provisionClaimSecret} chose:
|
|
1089
903
|
*
|
|
1090
|
-
*
|
|
1091
|
-
* {@link provisionClaimSecret} chose between:
|
|
1092
|
-
*
|
|
1093
|
-
* 1. `opts.stored` — a caller-supplied P, or one from a wallet that could not
|
|
1094
|
-
* derive. Whatever the wallet can do now, a stored P is the artifact's.
|
|
904
|
+
* 1. `opts.stored` — a caller-supplied P, or one a wallet could not derive; always the artifact's.
|
|
1095
905
|
* 2. a per-artifact descriptor — derive at the pinned index.
|
|
1096
906
|
* 3. `opts.salt` — derive from the salted message.
|
|
1097
|
-
* 4. otherwise throw: a repeating descriptor with neither
|
|
1098
|
-
* nor a salt has nothing to derive from that would not collide.
|
|
907
|
+
* 4. otherwise throw: a repeating descriptor with neither has nothing collision-free to derive.
|
|
1099
908
|
*/
|
|
1100
909
|
declare function contractPreimage(wallet: IWallet, descriptor: string, opts?: {
|
|
1101
910
|
stored?: Uint8Array;
|
|
@@ -1106,33 +915,47 @@ declare function contractPreimage(wallet: IWallet, descriptor: string, opts?: {
|
|
|
1106
915
|
* rather than degrading to a random-aux signer. */
|
|
1107
916
|
interface DeterministicSigner extends ReadonlyIdentity {
|
|
1108
917
|
/**
|
|
1109
|
-
* Implementors wrapping a remote: throw only for a refusal that will
|
|
1110
|
-
*
|
|
1111
|
-
*
|
|
1112
|
-
* back to a stored random preimage for the artifact's whole life. That is
|
|
1113
|
-
* claimable, but it persists a secret the seed would otherwise have
|
|
1114
|
-
* replaced, and nothing surfaces the downgrade to the caller.
|
|
918
|
+
* Implementors wrapping a remote: throw only for a refusal that will repeat.
|
|
919
|
+
* {@link provisionClaimSecret} reads any throw (even a network hiccup) as "cannot derive" and
|
|
920
|
+
* silently falls back to a stored random preimage for the artifact's whole life.
|
|
1115
921
|
*/
|
|
1116
922
|
signSchnorrDeterministic(messageHash: Uint8Array): Promise<Uint8Array>;
|
|
1117
923
|
}
|
|
1118
924
|
declare function isDeterministicSigner(value: unknown): value is DeterministicSigner;
|
|
1119
925
|
/**
|
|
1120
|
-
* Claim a restored artifact's index so a later allocation cannot reissue it
|
|
1121
|
-
*
|
|
1122
|
-
* one.
|
|
1123
|
-
*
|
|
1124
|
-
* Monotonic, and a no-op wherever there is no index to reserve — a shared-key
|
|
1125
|
-
* descriptor, or another seed's artifact. Restores iterate whole histories, so
|
|
1126
|
-
* an artifact this wallet has nothing to adopt for must not abort the loop.
|
|
926
|
+
* Claim a restored artifact's index so a later allocation cannot reissue it (which would derive
|
|
927
|
+
* that artifact's preimage again, for a different one).
|
|
1127
928
|
*
|
|
1128
|
-
*
|
|
1129
|
-
*
|
|
1130
|
-
*
|
|
1131
|
-
*
|
|
1132
|
-
* skip. Every wallet shipped here implements both.
|
|
929
|
+
* Monotonic, and a no-op wherever there is no index to reserve (a shared-key descriptor, another
|
|
930
|
+
* seed's artifact), since restores iterate whole histories. Recognising "another seed's" needs
|
|
931
|
+
* {@link HDWalletCapable.signerForDescriptor}; without it a foreign artifact surfaces as the
|
|
932
|
+
* watermark call's untyped error. Every shipped wallet implements both.
|
|
1133
933
|
*/
|
|
1134
934
|
declare function adoptContractDescriptor(wallet: IWallet, descriptor: string): Promise<void>;
|
|
1135
935
|
|
|
936
|
+
/**
|
|
937
|
+
* Thrown when a descriptor-capable contract (default, delegate, or boarding)
|
|
938
|
+
* cannot be routed to any signer: its owner key (`params.pubKey`) is not this
|
|
939
|
+
* wallet's baseline signing key, and the record carries no
|
|
940
|
+
* `metadata.signingDescriptor` to send it to a descriptor-aware signer.
|
|
941
|
+
*
|
|
942
|
+
* Note that this can arise also when a contract belongs to a different identity (storage reuse).
|
|
943
|
+
*/
|
|
944
|
+
declare class MissingSigningDescriptorError extends Error {
|
|
945
|
+
readonly contractScript: string;
|
|
946
|
+
readonly contractType: "default" | "delegate" | "boarding";
|
|
947
|
+
readonly name = "MissingSigningDescriptorError";
|
|
948
|
+
constructor(contractScript: string, contractType: "default" | "delegate" | "boarding");
|
|
949
|
+
}
|
|
950
|
+
/**
|
|
951
|
+
* Thrown when an input needs descriptor-aware signing but no
|
|
952
|
+
* DescriptorProvider was wired into the wallet.
|
|
953
|
+
*/
|
|
954
|
+
declare class DescriptorSigningProviderMissingError extends Error {
|
|
955
|
+
readonly name = "DescriptorSigningProviderMissingError";
|
|
956
|
+
constructor();
|
|
957
|
+
}
|
|
958
|
+
|
|
1136
959
|
type RequestEnvelope = {
|
|
1137
960
|
tag: string;
|
|
1138
961
|
id: string;
|
|
@@ -1154,6 +977,11 @@ type ResponseEnvelope = {
|
|
|
1154
977
|
errorName?: string;
|
|
1155
978
|
broadcast?: boolean;
|
|
1156
979
|
};
|
|
980
|
+
type MessageBusServices = {
|
|
981
|
+
arkProvider: ArkProvider;
|
|
982
|
+
wallet?: Wallet;
|
|
983
|
+
readonlyWallet: ReadonlyWallet;
|
|
984
|
+
};
|
|
1157
985
|
interface MessageHandler<REQ extends RequestEnvelope = RequestEnvelope, RES extends ResponseEnvelope = ResponseEnvelope> {
|
|
1158
986
|
/**
|
|
1159
987
|
* A unique identifier for the updater.
|
|
@@ -1170,11 +998,7 @@ interface MessageHandler<REQ extends RequestEnvelope = RequestEnvelope, RES exte
|
|
|
1170
998
|
* bus re-init or `stop()` it goes inert on its own, so retaining one past
|
|
1171
999
|
* `stop()` cannot post.
|
|
1172
1000
|
**/
|
|
1173
|
-
start(services: {
|
|
1174
|
-
arkProvider: ArkProvider;
|
|
1175
|
-
wallet?: Wallet;
|
|
1176
|
-
readonlyWallet: ReadonlyWallet;
|
|
1177
|
-
}, repositories: {
|
|
1001
|
+
start(services: MessageBusServices, repositories: {
|
|
1178
1002
|
walletRepository: WalletRepository;
|
|
1179
1003
|
}, channel?: {
|
|
1180
1004
|
broadcast(response: RES): void;
|
|
@@ -1226,11 +1050,7 @@ type Options = {
|
|
|
1226
1050
|
*/
|
|
1227
1051
|
intentRepository?: IntentRepository;
|
|
1228
1052
|
debug?: boolean;
|
|
1229
|
-
buildServices?: (config: Initialize["config"]) => Promise<
|
|
1230
|
-
arkProvider: ArkProvider;
|
|
1231
|
-
wallet?: Wallet;
|
|
1232
|
-
readonlyWallet: ReadonlyWallet;
|
|
1233
|
-
}>;
|
|
1053
|
+
buildServices?: (config: Initialize["config"]) => Promise<MessageBusServices>;
|
|
1234
1054
|
};
|
|
1235
1055
|
type Initialize = {
|
|
1236
1056
|
type: "INITIALIZE_MESSAGE_BUS";
|
|
@@ -1387,51 +1207,22 @@ declare class MessageBus {
|
|
|
1387
1207
|
static setup(path: string): Promise<ServiceWorker>;
|
|
1388
1208
|
}
|
|
1389
1209
|
|
|
1390
|
-
/**
|
|
1391
|
-
* A leaf node in the Taproot script tree, as consumed by
|
|
1392
|
-
* `@scure/btc-signer`'s `p2tr(internalKey, tree, ...)`.
|
|
1393
|
-
*/
|
|
1210
|
+
/** A leaf node in the Taproot script tree, as consumed by `@scure/btc-signer`'s `p2tr`. */
|
|
1394
1211
|
interface TaprootLeaf {
|
|
1395
1212
|
script: Bytes;
|
|
1396
1213
|
leafVersion: number;
|
|
1397
1214
|
}
|
|
1398
|
-
/**
|
|
1399
|
-
* Internal tree node shape consumed by `@scure/btc-signer`'s `p2tr`:
|
|
1400
|
-
* - A leaf is `{ script, leafVersion }`
|
|
1401
|
-
* - A branch is a 2-element tuple `[leftNode, rightNode]` of nodes
|
|
1402
|
-
*/
|
|
1215
|
+
/** A `p2tr` tree node: a leaf, or a `[left, right]` branch tuple. */
|
|
1403
1216
|
type TaprootTreeNode = TaprootLeaf | [TaprootTreeNode, TaprootTreeNode];
|
|
1404
1217
|
/**
|
|
1405
|
-
* Assemble a Taproot script tree
|
|
1406
|
-
*
|
|
1407
|
-
* (`txscript.AssembleTaprootScriptTree`, see
|
|
1408
|
-
* https://github.com/btcsuite/btcd/blob/master/txscript/taproot.go).
|
|
1218
|
+
* Assemble a Taproot script tree with btcd's `txscript.AssembleTaprootScriptTree` algorithm
|
|
1219
|
+
* (the one arkd uses).
|
|
1409
1220
|
*
|
|
1410
|
-
*
|
|
1221
|
+
* `@scure/btc-signer`'s `taprootListToTree` builds a Huffman tree instead; the two agree only for
|
|
1222
|
+
* power-of-2 leaf counts. Any other count yields a different merkle root → different output key
|
|
1223
|
+
* → arkd rejects spends with `INVALID_PSBT_INPUT`.
|
|
1411
1224
|
*
|
|
1412
|
-
*
|
|
1413
|
-
* for i := 0; i < len(leaves); i += 2:
|
|
1414
|
-
* if i is the last index (odd leaf at end):
|
|
1415
|
-
* merge with the LAST branch built so far (do NOT pair as a fresh leaf)
|
|
1416
|
-
* else:
|
|
1417
|
-
* create a new branch from (leaves[i], leaves[i+1])
|
|
1418
|
-
*
|
|
1419
|
-
* Phase 2 — FIFO-queue merge branches:
|
|
1420
|
-
* while branches has ≥ 2 items:
|
|
1421
|
-
* take front two, combine into a new branch, push to back of queue
|
|
1422
|
-
*
|
|
1423
|
-
* This matters because `@scure/btc-signer`'s `taprootListToTree` builds a
|
|
1424
|
-
* Huffman tree (weight-1 leaves combine by smallest-weight pairs). For
|
|
1425
|
-
* power-of-2 leaf counts both algorithms happen to produce the same
|
|
1426
|
-
* perfectly-balanced binary tree and agree. For any other count they
|
|
1427
|
-
* produce DIFFERENT shapes → different merkle roots → different taproot
|
|
1428
|
-
* output keys → arkd rejects spends with `INVALID_PSBT_INPUT`.
|
|
1429
|
-
*
|
|
1430
|
-
* Reproducing btcd's algorithm here lets the SDK construct taptrees that
|
|
1431
|
-
* arkd accepts for arbitrary leaf counts.
|
|
1432
|
-
*
|
|
1433
|
-
* @param scripts - Raw tapscript bytes for each leaf, in the order they
|
|
1434
|
-
* should be encoded in the TapTree PSBT field.
|
|
1225
|
+
* @param scripts - Raw tapscript bytes per leaf, in TapTree PSBT field order.
|
|
1435
1226
|
* @returns The nested-tuple form `p2tr` accepts.
|
|
1436
1227
|
*/
|
|
1437
1228
|
declare function assembleBtcdTaprootTree(scripts: Bytes[]): TaprootTreeNode;
|
|
@@ -1492,11 +1283,10 @@ declare class AssetId {
|
|
|
1492
1283
|
readonly groupIndex: number;
|
|
1493
1284
|
private constructor();
|
|
1494
1285
|
/**
|
|
1495
|
-
* Create
|
|
1286
|
+
* Create a validated asset id from a genesis transaction id and group index.
|
|
1496
1287
|
*
|
|
1497
1288
|
* @param txid - Hex-encoded genesis transaction id
|
|
1498
1289
|
* @param groupIndex - Asset group index within the genesis transaction
|
|
1499
|
-
* @returns A validated asset id
|
|
1500
1290
|
* @throws Error if the txid is missing, malformed, or not 32 bytes long
|
|
1501
1291
|
* @see fromString
|
|
1502
1292
|
*/
|
|
@@ -1504,8 +1294,6 @@ declare class AssetId {
|
|
|
1504
1294
|
/**
|
|
1505
1295
|
* Decode an asset id from its hex string representation.
|
|
1506
1296
|
*
|
|
1507
|
-
* @param s - Hex-encoded asset id
|
|
1508
|
-
* @returns Decoded asset id
|
|
1509
1297
|
* @throws Error if the string is not valid hex or does not encode a valid asset id
|
|
1510
1298
|
* @see toString
|
|
1511
1299
|
*/
|
|
@@ -1513,22 +1301,18 @@ declare class AssetId {
|
|
|
1513
1301
|
/**
|
|
1514
1302
|
* Decode an asset id from its serialized bytes.
|
|
1515
1303
|
*
|
|
1516
|
-
* @param buf - Serialized asset id bytes
|
|
1517
|
-
* @returns Decoded asset id
|
|
1518
1304
|
* @throws Error if the buffer length is invalid
|
|
1519
1305
|
*/
|
|
1520
1306
|
static fromBytes(buf: Uint8Array): AssetId;
|
|
1521
1307
|
/**
|
|
1522
1308
|
* Serialize the asset id to raw bytes.
|
|
1523
1309
|
*
|
|
1524
|
-
* @returns Serialized asset id bytes
|
|
1525
1310
|
* @see fromBytes
|
|
1526
1311
|
*/
|
|
1527
1312
|
serialize(): Uint8Array;
|
|
1528
1313
|
/**
|
|
1529
1314
|
* Encode the asset id to a hex string.
|
|
1530
1315
|
*
|
|
1531
|
-
* @returns Hex-encoded asset id
|
|
1532
1316
|
* @see fromString
|
|
1533
1317
|
*/
|
|
1534
1318
|
toString(): string;
|
|
@@ -1539,17 +1323,14 @@ declare class AssetId {
|
|
|
1539
1323
|
*/
|
|
1540
1324
|
validate(): void;
|
|
1541
1325
|
/**
|
|
1542
|
-
* Decode an asset id from a binary reader.
|
|
1326
|
+
* Decode an asset id from a binary reader positioned at one.
|
|
1543
1327
|
*
|
|
1544
|
-
* @param reader - Reader positioned at an asset id
|
|
1545
|
-
* @returns Decoded asset id
|
|
1546
1328
|
* @throws Error if the reader does not contain enough bytes
|
|
1547
1329
|
*/
|
|
1548
1330
|
static fromReader(reader: BufferReader): AssetId;
|
|
1549
1331
|
/**
|
|
1550
1332
|
* Serialize the asset id into an existing binary writer.
|
|
1551
1333
|
*
|
|
1552
|
-
* @param writer - Writer to append the asset id to
|
|
1553
1334
|
* @see serialize
|
|
1554
1335
|
*/
|
|
1555
1336
|
serializeTo(writer: BufferWriter): void;
|
|
@@ -1579,27 +1360,18 @@ declare class AssetRef {
|
|
|
1579
1360
|
private constructor();
|
|
1580
1361
|
/** Reference type discriminator. */
|
|
1581
1362
|
get type(): AssetRefType;
|
|
1582
|
-
/**
|
|
1583
|
-
* Create an asset reference that points to a specific asset id.
|
|
1584
|
-
*
|
|
1585
|
-
* @param assetId - Asset id referenced by this pointer
|
|
1586
|
-
* @returns Asset reference by id
|
|
1587
|
-
* @see fromGroupIndex
|
|
1588
|
-
*/
|
|
1363
|
+
/** Reference a specific asset id. @see fromGroupIndex */
|
|
1589
1364
|
static fromId(assetId: AssetId): AssetRef;
|
|
1590
1365
|
/**
|
|
1591
|
-
*
|
|
1366
|
+
* Reference another asset group in the packet.
|
|
1592
1367
|
*
|
|
1593
1368
|
* @param groupIndex - Zero-based asset group index in the packet
|
|
1594
|
-
* @returns Asset reference by group index
|
|
1595
1369
|
* @see fromId
|
|
1596
1370
|
*/
|
|
1597
1371
|
static fromGroupIndex(groupIndex: number): AssetRef;
|
|
1598
1372
|
/**
|
|
1599
|
-
* Decode an asset reference from
|
|
1373
|
+
* Decode an asset reference from hex.
|
|
1600
1374
|
*
|
|
1601
|
-
* @param s - Hex-encoded asset reference
|
|
1602
|
-
* @returns Decoded asset reference
|
|
1603
1375
|
* @throws Error if the string is not valid hex or does not encode a valid asset reference
|
|
1604
1376
|
* @see toString
|
|
1605
1377
|
*/
|
|
@@ -1607,39 +1379,20 @@ declare class AssetRef {
|
|
|
1607
1379
|
/**
|
|
1608
1380
|
* Decode an asset reference from its serialized bytes.
|
|
1609
1381
|
*
|
|
1610
|
-
* @param buf - Serialized asset reference bytes
|
|
1611
|
-
* @returns Decoded asset reference
|
|
1612
1382
|
* @throws Error if the buffer is empty or malformed
|
|
1613
1383
|
*/
|
|
1614
1384
|
static fromBytes(buf: Uint8Array): AssetRef;
|
|
1615
|
-
/**
|
|
1616
|
-
* Serialize the asset reference to raw bytes.
|
|
1617
|
-
*
|
|
1618
|
-
* @returns Serialized asset reference bytes
|
|
1619
|
-
* @see fromBytes
|
|
1620
|
-
*/
|
|
1385
|
+
/** Serialize to raw bytes. @see fromBytes */
|
|
1621
1386
|
serialize(): Uint8Array;
|
|
1622
|
-
/**
|
|
1623
|
-
* Encode the asset reference to a hex string.
|
|
1624
|
-
*
|
|
1625
|
-
* @returns Hex-encoded asset reference
|
|
1626
|
-
* @see fromString
|
|
1627
|
-
*/
|
|
1387
|
+
/** Encode to hex. @see fromString */
|
|
1628
1388
|
toString(): string;
|
|
1629
1389
|
/**
|
|
1630
|
-
* Decode an asset reference from a
|
|
1390
|
+
* Decode an asset reference from a reader positioned at one.
|
|
1631
1391
|
*
|
|
1632
|
-
* @param reader - Reader positioned at an asset reference
|
|
1633
|
-
* @returns Decoded asset reference
|
|
1634
1392
|
* @throws Error if the type is unknown or the reader does not contain enough bytes
|
|
1635
1393
|
*/
|
|
1636
1394
|
static fromReader(reader: BufferReader): AssetRef;
|
|
1637
|
-
/**
|
|
1638
|
-
* Serialize the asset reference into an existing binary writer.
|
|
1639
|
-
*
|
|
1640
|
-
* @param writer - Writer to append the asset reference to
|
|
1641
|
-
* @see serialize
|
|
1642
|
-
*/
|
|
1395
|
+
/** Append the serialized reference to `writer`. @see serialize */
|
|
1643
1396
|
serializeTo(writer: BufferWriter): void;
|
|
1644
1397
|
}
|
|
1645
1398
|
|
|
@@ -1993,15 +1746,9 @@ declare class Packet implements ExtensionPacket {
|
|
|
1993
1746
|
* Shipped from `src/` rather than `test/` so consumers outside this package can
|
|
1994
1747
|
* pin the same bytes: `lightning-swap-service` imports this value, while NArk
|
|
1995
1748
|
* and go-sdk vendor the backing `assetIdVectors.json` from a pinned revision of
|
|
1996
|
-
* this repository.
|
|
1997
|
-
*
|
|
1998
|
-
*
|
|
1999
|
-
* disagreement between them fails silently — a flipped txid makes a covenant
|
|
2000
|
-
* unsatisfiable, a flipped group index resolves to a different asset, a case
|
|
2001
|
-
* mismatch is a routing miss. None of those name their cause, which is what
|
|
2002
|
-
* these vectors are for.
|
|
2003
|
-
*
|
|
2004
|
-
* @see plans/asset-id-shared-vectors.md
|
|
1749
|
+
* this repository. The encoding is implemented in seven places across three
|
|
1750
|
+
* repos, and every disagreement fails silently (a flipped txid makes a covenant
|
|
1751
|
+
* unsatisfiable, a flipped group index resolves to a different asset).
|
|
2005
1752
|
*/
|
|
2006
1753
|
interface AssetIdVectors {
|
|
2007
1754
|
readonly version: number;
|
|
@@ -2051,9 +1798,8 @@ interface AssetIdVectors {
|
|
|
2051
1798
|
* The asset-id test vectors, deeply frozen.
|
|
2052
1799
|
*
|
|
2053
1800
|
* @remarks
|
|
2054
|
-
* Frozen all the way down
|
|
2055
|
-
*
|
|
2056
|
-
* mutating an entry would corrupt it for every other consumer in the process.
|
|
1801
|
+
* Frozen all the way down: the module is a singleton, and one consumer mutating
|
|
1802
|
+
* a nested entry would corrupt it for every other consumer in the process.
|
|
2057
1803
|
*
|
|
2058
1804
|
* @example
|
|
2059
1805
|
* ```typescript
|
|
@@ -2209,28 +1955,20 @@ declare class Ramps {
|
|
|
2209
1955
|
eventCallback?: (event: SettlementEvent) => void;
|
|
2210
1956
|
vtxos?: NormalizedExtendedVirtualCoin[];
|
|
2211
1957
|
}): ReturnType<IWallet["settle"]>;
|
|
1958
|
+
private offboardInputs;
|
|
2212
1959
|
/** Fund the change output: pay its own fee, then judge it against both
|
|
2213
1960
|
* server-side bounds. `0n` in is `0n` out — no change output at all. */
|
|
2214
1961
|
private fundChange;
|
|
2215
1962
|
}
|
|
2216
1963
|
|
|
2217
1964
|
/**
|
|
2218
|
-
* HD-wallet {@link DescriptorProvider} that allocates a fresh signing
|
|
2219
|
-
*
|
|
2220
|
-
*
|
|
2221
|
-
* wallet currently bound to?" is answered by querying the contract
|
|
2222
|
-
* repository for active contracts, not by asking this provider.
|
|
2223
|
-
*
|
|
2224
|
-
* State is persisted under `WalletRepository.getWalletState().settings.hd` so
|
|
2225
|
-
* that no storage-schema migration is required when switching a wallet from
|
|
2226
|
-
* single-key to HD. The provider is backed by an {@link HDCapableIdentity},
|
|
2227
|
-
* which carries the wildcard account descriptor template (for derivation)
|
|
2228
|
-
* and the signing primitives.
|
|
1965
|
+
* HD-wallet {@link DescriptorProvider} that allocates a fresh signing descriptor on every call.
|
|
1966
|
+
* A pure rotating allocator: which descriptor the wallet is bound to is answered by the contract
|
|
1967
|
+
* repository, not this provider.
|
|
2229
1968
|
*
|
|
2230
|
-
*
|
|
2231
|
-
* repo `updateWalletState` mutex, so
|
|
2232
|
-
*
|
|
2233
|
-
* the same repo — can never observe the same index.
|
|
1969
|
+
* State lives in `settings.hd` of the wallet state, so switching single-key → HD needs no schema
|
|
1970
|
+
* migration. Allocation runs inside the shared per-repo `updateWalletState` mutex, so callers
|
|
1971
|
+
* (even on separate instances over one repo) never observe the same index.
|
|
2234
1972
|
*
|
|
2235
1973
|
* @example
|
|
2236
1974
|
* ```ts
|
|
@@ -2246,104 +1984,50 @@ declare class HDDescriptorProvider implements DescriptorProvider, ReceiveRotator
|
|
|
2246
1984
|
private readonly walletRepository;
|
|
2247
1985
|
private constructor();
|
|
2248
1986
|
/**
|
|
2249
|
-
* Construct an HDDescriptorProvider. No I/O is
|
|
2250
|
-
*
|
|
2251
|
-
* `getNextSigningDescriptor`. A descriptor-mismatch error surfaces on
|
|
2252
|
-
* first use rather than at boot.
|
|
1987
|
+
* Construct an HDDescriptorProvider. No I/O: state is read lazily, so a descriptor-mismatch
|
|
1988
|
+
* error surfaces on first use rather than here.
|
|
2253
1989
|
*/
|
|
2254
1990
|
static create(identity: HDCapableIdentity, walletRepository: WalletRepository): Promise<HDDescriptorProvider>;
|
|
2255
|
-
/**
|
|
2256
|
-
* Allocate the next descriptor and return it. The first call on a fresh
|
|
2257
|
-
* wallet returns descriptor at index 0; subsequent calls return 1, 2, 3,
|
|
2258
|
-
* ... in order. Each call is atomic with respect to other rotations on
|
|
2259
|
-
* the same repo: two concurrent callers can never observe the same
|
|
2260
|
-
* index.
|
|
2261
|
-
*/
|
|
1991
|
+
/** Allocate and return the next descriptor (index 0, 1, 2, …), atomically per repo. */
|
|
2262
1992
|
getNextSigningDescriptor(): Promise<string>;
|
|
2263
1993
|
/**
|
|
2264
|
-
* Re-derive the descriptor
|
|
2265
|
-
*
|
|
2266
|
-
*
|
|
2267
|
-
* when no descriptor has ever been allocated on this repo.
|
|
2268
|
-
*
|
|
2269
|
-
* Used by the boot path to keep the wallet's display address
|
|
2270
|
-
* stable across restarts: when no tagged display contract exists
|
|
2271
|
-
* (e.g. a fresh wallet that hasn't rotated yet, or a wallet whose
|
|
2272
|
-
* baseline-only repo carries no rotation history), the boot should
|
|
2273
|
-
* re-derive the existing index rather than burn a new one.
|
|
1994
|
+
* Re-derive the descriptor `getNextSigningDescriptor` last returned, WITHOUT advancing;
|
|
1995
|
+
* `undefined` if none was ever allocated. Lets boot keep the display address stable across
|
|
1996
|
+
* restarts when no tagged display contract exists, instead of burning a new index.
|
|
2274
1997
|
*/
|
|
2275
1998
|
getCurrentSigningDescriptor(): Promise<string | undefined>;
|
|
2276
|
-
/**
|
|
2277
|
-
* The most recently allocated index, or `undefined` when nothing has ever
|
|
2278
|
-
* been allocated on this repo. Read-only peek at the watermark that
|
|
2279
|
-
* {@link getNextSigningDescriptor} advances.
|
|
2280
|
-
*/
|
|
1999
|
+
/** Read-only peek at the allocation watermark; `undefined` if nothing was ever allocated. */
|
|
2281
2000
|
getLastIndexUsed(): Promise<number | undefined>;
|
|
2282
2001
|
/**
|
|
2283
|
-
* Monotonically advance the
|
|
2284
|
-
* `
|
|
2285
|
-
*
|
|
2286
|
-
*
|
|
2287
|
-
* An invalid `index` (non-integer / negative / past the BIP32
|
|
2288
|
-
* non-hardened ceiling) is ignored (no-op): persisting it would corrupt
|
|
2289
|
-
* `lastIndexUsed` and make the next `parseSettings()` throw, mirroring
|
|
2290
|
-
* the validation parseSettings already enforces. The upper bound matters
|
|
2291
|
-
* because the damage outlives the call — `materializeDescriptorAt` cannot
|
|
2292
|
-
* derive at or above 2^31, so a watermark parked there would fail every
|
|
2293
|
-
* subsequent allocation for the life of the repo.
|
|
2002
|
+
* Monotonically advance the watermark past indices found by a restore scan; never rewinds.
|
|
2003
|
+
* An invalid `index` (non-integer, negative, or >= 2^31) is ignored: persisting it would make
|
|
2004
|
+
* `parseSettings()` throw, and a watermark at the hardened ceiling would fail every later
|
|
2005
|
+
* allocation for the life of the repo.
|
|
2294
2006
|
*/
|
|
2295
2007
|
advanceLastIndexUsed(index: number): Promise<void>;
|
|
2296
|
-
/**
|
|
2297
|
-
* Returns true when the given descriptor is derivable from this wallet's
|
|
2298
|
-
* seed. Delegates to the underlying identity, which handles both HD and
|
|
2299
|
-
* simple `tr(pubkey)` descriptors.
|
|
2300
|
-
*/
|
|
2008
|
+
/** Whether `descriptor` (HD or simple `tr(pubkey)`) is derivable from this wallet's seed. */
|
|
2301
2009
|
isOurs(descriptor: string): boolean;
|
|
2302
|
-
/**
|
|
2303
|
-
* Signs each request with the key derived from its descriptor. Delegates
|
|
2304
|
-
* to the identity's signing primitives — the identity, not the provider,
|
|
2305
|
-
* holds the seed.
|
|
2306
|
-
*/
|
|
2010
|
+
/** Signs each request with its descriptor's derived key (the identity holds the seed). */
|
|
2307
2011
|
signWithDescriptor(requests: DescriptorSigningRequest[]): Promise<Transaction[]>;
|
|
2308
2012
|
/** Signs a message using the key derived from `descriptor`. */
|
|
2309
2013
|
signMessageWithDescriptor(descriptor: string, message: Uint8Array, signatureType?: "schnorr" | "ecdsa"): Promise<Uint8Array>;
|
|
2310
|
-
/**
|
|
2311
|
-
* HD providers participate in receive rotation. The default
|
|
2312
|
-
* factory boot (contract-repo lookup → allocate fresh descriptor)
|
|
2313
|
-
* is exactly what we want, so this just delegates to
|
|
2314
|
-
* {@link WalletReceiveRotator.defaultBoot}.
|
|
2315
|
-
*/
|
|
2014
|
+
/** HD providers take part in receive rotation via {@link WalletReceiveRotator.defaultBoot}. */
|
|
2316
2015
|
createReceiveRotator(opts: ReceiveRotatorBootOpts): Promise<ReceiveRotatorBoot | undefined>;
|
|
2317
2016
|
/**
|
|
2318
|
-
*
|
|
2319
|
-
*
|
|
2320
|
-
*
|
|
2321
|
-
* call validates that the input is a ranged template AND produces a
|
|
2322
|
-
* canonical materialized key expression at the given index.
|
|
2323
|
-
*
|
|
2324
|
-
* This is a pure read: it does NOT advance the allocation watermark.
|
|
2325
|
-
* Used by restore's gap-scan to peek descriptors at arbitrary indices
|
|
2326
|
-
* without side-effects.
|
|
2017
|
+
* Materialize the account template at `index` via the descriptors-scure parser (validates the
|
|
2018
|
+
* ranged template and yields a canonical key expression) rather than string substitution.
|
|
2019
|
+
* Pure: does NOT advance the watermark, so restore's gap-scan can peek arbitrary indices.
|
|
2327
2020
|
*/
|
|
2328
2021
|
materializeDescriptorAt(index: number): string;
|
|
2329
2022
|
/**
|
|
2330
|
-
*
|
|
2331
|
-
*
|
|
2332
|
-
*
|
|
2333
|
-
* surface; the mutated settings are then persisted as part of the same
|
|
2334
|
-
* atomic update.
|
|
2335
|
-
*
|
|
2336
|
-
* Doing the read inside the lock is what prevents two providers (or two
|
|
2337
|
-
* concurrent callers on the same provider) from racing on a stale index.
|
|
2023
|
+
* Read-modify-write HD settings inside the shared per-repo wallet-state mutex; `fn` mutates a
|
|
2024
|
+
* validated snapshot that is persisted atomically. Reading inside the lock prevents races on a
|
|
2025
|
+
* stale index.
|
|
2338
2026
|
*/
|
|
2339
2027
|
private mutate;
|
|
2340
2028
|
/**
|
|
2341
|
-
* Validate
|
|
2342
|
-
*
|
|
2343
|
-
*
|
|
2344
|
-
* The cast to `HDWalletSettings` trusts storage; a corrupted or
|
|
2345
|
-
* partially-migrated repo could otherwise produce `NaN` descriptors.
|
|
2346
|
-
* Fail loud rather than silently derive garbage.
|
|
2029
|
+
* Validate persisted HD settings (or init a fresh record) and return a mutable clone. Fails
|
|
2030
|
+
* loud: a corrupt repo would otherwise derive `NaN` descriptors.
|
|
2347
2031
|
*/
|
|
2348
2032
|
private parseSettings;
|
|
2349
2033
|
}
|
|
@@ -2471,13 +2155,14 @@ type ResponseGetVtxos = ResponseEnvelope & {
|
|
|
2471
2155
|
type RequestGetSpendableVtxos = RequestEnvelope & {
|
|
2472
2156
|
type: "GET_SPENDABLE_VTXOS";
|
|
2473
2157
|
payload: {
|
|
2474
|
-
filter?:
|
|
2158
|
+
filter?: GetSpendableVtxosFilter;
|
|
2475
2159
|
};
|
|
2476
2160
|
};
|
|
2477
2161
|
type ResponseGetSpendableVtxos = ResponseEnvelope & {
|
|
2478
2162
|
type: "SPENDABLE_VTXOS";
|
|
2479
2163
|
payload: {
|
|
2480
2164
|
vtxos: Awaited<ReturnType<IWallet["getSpendableVtxos"]>>;
|
|
2165
|
+
filterApplied?: boolean;
|
|
2481
2166
|
};
|
|
2482
2167
|
};
|
|
2483
2168
|
type RequestGetBoardingUtxos = RequestEnvelope & {
|
|
@@ -2575,12 +2260,18 @@ type RequestGetContractsWithVtxos = RequestEnvelope & {
|
|
|
2575
2260
|
type: "GET_CONTRACTS_WITH_VTXOS";
|
|
2576
2261
|
payload: {
|
|
2577
2262
|
filter?: GetContractsFilter;
|
|
2263
|
+
options?: {
|
|
2264
|
+
maxSyncAgeMs?: number;
|
|
2265
|
+
unspentOnly?: boolean;
|
|
2266
|
+
requireSynced?: boolean;
|
|
2267
|
+
};
|
|
2578
2268
|
};
|
|
2579
2269
|
};
|
|
2580
2270
|
type ResponseGetContractsWithVtxos = ResponseEnvelope & {
|
|
2581
2271
|
type: "CONTRACTS_WITH_VTXOS";
|
|
2582
2272
|
payload: {
|
|
2583
2273
|
contracts: ContractWithVtxos[];
|
|
2274
|
+
filterApplied?: boolean;
|
|
2584
2275
|
};
|
|
2585
2276
|
};
|
|
2586
2277
|
type RequestWatchScript = RequestEnvelope & {
|
|
@@ -3274,13 +2965,6 @@ declare class ServiceWorkerReadonlyWallet implements IReadonlyWallet {
|
|
|
3274
2965
|
protected initWalletPayload: RequestInitWallet["payload"] | null;
|
|
3275
2966
|
protected messageBusTimeoutMs?: number;
|
|
3276
2967
|
protected messageTimeouts: Record<RequestType, number>;
|
|
3277
|
-
protected arkServer?: {
|
|
3278
|
-
url: string;
|
|
3279
|
-
publicKey?: string;
|
|
3280
|
-
};
|
|
3281
|
-
protected delegateUrl?: string;
|
|
3282
|
-
protected watcherConfig?: Partial<Omit<ContractWatcherConfig, "indexerProvider">>;
|
|
3283
|
-
protected settlementConfig?: SettlementConfig | false;
|
|
3284
2968
|
private reinitPromise;
|
|
3285
2969
|
private pingPromise;
|
|
3286
2970
|
private inflightRequests;
|
|
@@ -3295,6 +2979,8 @@ declare class ServiceWorkerReadonlyWallet implements IReadonlyWallet {
|
|
|
3295
2979
|
* @throws Error if service-worker initialization fails
|
|
3296
2980
|
*/
|
|
3297
2981
|
static create(options: ServiceWorkerWalletCreateOptions): Promise<ServiceWorkerReadonlyWallet>;
|
|
2982
|
+
/** Shared tail of both `create()` factories: boot the bus, INIT_WALLET, cache for reinit. */
|
|
2983
|
+
protected static bootstrap<W extends ServiceWorkerReadonlyWallet>(wallet: W, options: ServiceWorkerWalletCreateOptions, serializedWallet: SerializedIdentity, busConfig: Omit<MessageBusInitConfig, "wallet" | "arkServer" | "messageTimeouts">): Promise<W>;
|
|
3298
2984
|
/**
|
|
3299
2985
|
* Simplified setup method that handles service worker registration
|
|
3300
2986
|
* and wallet initialization automatically.
|
|
@@ -3319,20 +3005,8 @@ declare class ServiceWorkerReadonlyWallet implements IReadonlyWallet {
|
|
|
3319
3005
|
onEvent: (response: WalletUpdaterResponse) => void;
|
|
3320
3006
|
isComplete: (response: WalletUpdaterResponse) => boolean;
|
|
3321
3007
|
}): Promise<WalletUpdaterResponse>;
|
|
3322
|
-
/**
|
|
3323
|
-
* Produce a serialized envelope for the wallet's identity. The base
|
|
3324
|
-
* class always emits a readonly envelope; `ServiceWorkerWallet`
|
|
3325
|
-
* overrides to emit a signing envelope.
|
|
3326
|
-
*/
|
|
3327
|
-
protected serializeIdentity(): Promise<SerializedIdentity>;
|
|
3328
|
-
/**
|
|
3329
|
-
* Return the cached init config, or rebuild one from live instance
|
|
3330
|
-
* state when the cache was never populated. Recovery path for
|
|
3331
|
-
* SDK-factory-created wallets; manual constructor bypasses do not
|
|
3332
|
-
* retain enough state here and will hit the "never initialized" throw.
|
|
3333
|
-
*/
|
|
3008
|
+
/** The init config cached by `create()`; manually constructed wallets have none. */
|
|
3334
3009
|
protected buildInitConfig(): Promise<MessageBusInitConfig>;
|
|
3335
|
-
/** Minimal INIT_WALLET payload used on reinitialize when the cache is gone. */
|
|
3336
3010
|
protected buildInitWalletPayload(): RequestInitWallet["payload"];
|
|
3337
3011
|
private reinitialize;
|
|
3338
3012
|
/**
|
|
@@ -3388,7 +3062,7 @@ declare class ServiceWorkerReadonlyWallet implements IReadonlyWallet {
|
|
|
3388
3062
|
* and falling back to `GET_VTXOS` there would silently spend ungated coins.
|
|
3389
3063
|
* Fail closed — loud and recoverable — rather than make the gate advisory.
|
|
3390
3064
|
*/
|
|
3391
|
-
getSpendableVtxos(filter?:
|
|
3065
|
+
getSpendableVtxos(filter?: GetSpendableVtxosFilter): Promise<NormalizedExtendedVirtualCoin[]>;
|
|
3392
3066
|
/**
|
|
3393
3067
|
* Trigger a wallet reload inside the service worker.
|
|
3394
3068
|
*
|
|
@@ -3407,7 +3081,6 @@ declare class ServiceWorkerWallet extends ServiceWorkerReadonlyWallet implements
|
|
|
3407
3081
|
private _restoreInFlight?;
|
|
3408
3082
|
protected constructor(serviceWorker: ServiceWorker, identity: Identity, walletRepository: WalletRepository, contractRepository: ContractRepository, messageTag: string, hasDelegate: boolean);
|
|
3409
3083
|
get assetManager(): IAssetManager;
|
|
3410
|
-
protected serializeIdentity(): Promise<SerializedIdentity>;
|
|
3411
3084
|
static create(options: ServiceWorkerWalletCreateOptions): Promise<ServiceWorkerWallet>;
|
|
3412
3085
|
/**
|
|
3413
3086
|
* Simplified setup method that handles service worker registration
|
|
@@ -5056,11 +4729,6 @@ declare const UnilateralExit: {
|
|
|
5056
4729
|
*
|
|
5057
4730
|
* Everything else (4xx, invalid JSON, schema violations, network mismatch,
|
|
5058
4731
|
* unsupported network) is terminal and returns `false`.
|
|
5059
|
-
*
|
|
5060
|
-
* NOTE (Step 2, Scope 2): this classifies the errors currently produced by the
|
|
5061
|
-
* boot-critical `getInfo` path. Normalizing the indexer's per-branch
|
|
5062
|
-
* `!res.ok` throws and the remaining Ark RPC methods into
|
|
5063
|
-
* {@link ProviderUnavailableError} is the broader Scope-2 work still pending.
|
|
5064
4732
|
*/
|
|
5065
4733
|
declare function isRetryableProviderError(error: unknown): boolean;
|
|
5066
4734
|
|
|
@@ -5209,7 +4877,8 @@ declare class Extension {
|
|
|
5209
4877
|
* This module defines ONLY Arkade-specific opcodes (0xb3, 0xc3-0xf8).
|
|
5210
4878
|
* Standard Bitcoin opcodes are imported from @scure/btc-signer.
|
|
5211
4879
|
*
|
|
5212
|
-
* Reference: arkade-os/emulator
|
|
4880
|
+
* Reference: arkade-os/emulator pkg/arkade/opcode.go.
|
|
4881
|
+
* Byte 0xdc is OP_CHECKTIME, matching emulator v0.0.8 and compiler artifacts.
|
|
5213
4882
|
*/
|
|
5214
4883
|
|
|
5215
4884
|
declare const ARKADE_OP: {
|
|
@@ -5596,45 +5265,70 @@ declare namespace bignum {
|
|
|
5596
5265
|
export { bignum_BIGNUM_MAX_BYTES as BIGNUM_MAX_BYTES, bignum_decode as decode, bignum_encode as encode };
|
|
5597
5266
|
}
|
|
5598
5267
|
|
|
5268
|
+
/**
|
|
5269
|
+
* Read the JSON `arkadec` writes into a {@link Program}: `$param` placeholders,
|
|
5270
|
+
* @scure opcode names, and one structured tapleaf per compiler leaf.
|
|
5271
|
+
*/
|
|
5272
|
+
|
|
5273
|
+
interface ArtifactParameter {
|
|
5274
|
+
name: string;
|
|
5275
|
+
type: string;
|
|
5276
|
+
}
|
|
5277
|
+
interface ArtifactStruct {
|
|
5278
|
+
name: string;
|
|
5279
|
+
fields: ArtifactParameter[];
|
|
5280
|
+
}
|
|
5281
|
+
interface ArtifactWitnessElement {
|
|
5282
|
+
name: string;
|
|
5283
|
+
type: string;
|
|
5284
|
+
injected?: boolean;
|
|
5285
|
+
}
|
|
5286
|
+
interface ArtifactLeaf {
|
|
5287
|
+
name: string;
|
|
5288
|
+
witness?: ArtifactWitnessElement[];
|
|
5289
|
+
asm: string[];
|
|
5290
|
+
}
|
|
5291
|
+
interface ArtifactCovenant {
|
|
5292
|
+
inputs: ArtifactParameter[];
|
|
5293
|
+
asm: string[];
|
|
5294
|
+
}
|
|
5295
|
+
interface ArtifactGroup {
|
|
5296
|
+
name: string;
|
|
5297
|
+
arkade?: ArtifactCovenant;
|
|
5298
|
+
leaves: ArtifactLeaf[];
|
|
5299
|
+
}
|
|
5300
|
+
interface ContractArtifact {
|
|
5301
|
+
contractName: string;
|
|
5302
|
+
constructorInputs: ArtifactParameter[];
|
|
5303
|
+
structs?: ArtifactStruct[];
|
|
5304
|
+
functions: ArtifactGroup[];
|
|
5305
|
+
}
|
|
5306
|
+
/** `true` when `value` is an arkadec artifact rather than a Program. */
|
|
5307
|
+
declare function isContractArtifact(value: unknown): value is ContractArtifact;
|
|
5308
|
+
/** Adds `server`, and one param per child-output placeholder for the caller to bind to that output key. */
|
|
5309
|
+
declare function programFromArtifact(artifact: ContractArtifact): Program;
|
|
5310
|
+
|
|
5599
5311
|
/**
|
|
5600
5312
|
* Arkade Contract — artifact-driven, high-level covenant API.
|
|
5601
5313
|
*
|
|
5602
|
-
*
|
|
5603
|
-
*
|
|
5604
|
-
*
|
|
5605
|
-
*
|
|
5606
|
-
*
|
|
5607
|
-
*
|
|
5608
|
-
*
|
|
5609
|
-
*
|
|
5610
|
-
*
|
|
5611
|
-
*
|
|
5612
|
-
*
|
|
5613
|
-
*
|
|
5614
|
-
*
|
|
5615
|
-
*
|
|
5616
|
-
*
|
|
5617
|
-
*
|
|
5618
|
-
*
|
|
5619
|
-
*
|
|
5620
|
-
*
|
|
5621
|
-
* Contract functions are strongly typed from the program's literal shape: a
|
|
5622
|
-
* function declaring `inputs: [{ name: "preimage", type: "bytes" }]` produces a
|
|
5623
|
-
* `functions.claim(preimage: Uint8Array)` call signature. The type flows through
|
|
5624
|
-
* `arkade.contract(...)` automatically for inline literals; for a program stored
|
|
5625
|
-
* in a variable, annotate it with `satisfies Program` to preserve the literal
|
|
5626
|
-
* type (a plain `: Program` annotation would widen it away).
|
|
5627
|
-
*
|
|
5628
|
-
* Constructor `params` follow the same convention: bare name strings are
|
|
5629
|
-
* documentation only, while typed descriptors `{ name, type }` (the form the
|
|
5630
|
-
* ArkadeScript compiler emits) make the list authoritative — every declared
|
|
5631
|
-
* param must be bound, every `$name` reference must be declared, and bound
|
|
5632
|
-
* values are validated against their type at compilation.
|
|
5633
|
-
*
|
|
5634
|
-
* A covenant spend needs an `indexer`, not just an `emulator`: the co-signing
|
|
5635
|
-
* service resolves each input's prevout pkScript from the previous ark tx the
|
|
5636
|
-
* PSBT carries, and only the indexer can supply those bytes. Pure tapscript
|
|
5637
|
-
* spends go straight to arkd and need neither.
|
|
5314
|
+
* A contract is a {@link Program}: named functions, each split into a `tapscript` segment
|
|
5315
|
+
* enforced on-chain and an `arkadeScript` segment emulated by the co-signing service. The shape
|
|
5316
|
+
* mirrors the compiler artifact, so hand-written programs and compiler output share one resolver.
|
|
5317
|
+
* The SDK never interprets scripts; it resolves `$param` placeholders and signers, builds the
|
|
5318
|
+
* taproot tree (co-signer key tweaked by the arkade-script hash) and assembles the spend.
|
|
5319
|
+
*
|
|
5320
|
+
* Compilation lives in {@link ArkadeProgramScript} and is shared with the `"arkade"` contract
|
|
5321
|
+
* handler: pass a `contractManager` to {@link Arkade.connect} and call
|
|
5322
|
+
* {@link ArkadeContract.register} to persist and watch a contract.
|
|
5323
|
+
*
|
|
5324
|
+
* Functions are typed from the program's literal shape (`inputs: [{ name: "preimage", type:
|
|
5325
|
+
* "bytes" }]` → `functions.claim(preimage: Uint8Array)`). For a program stored in a variable use
|
|
5326
|
+
* `satisfies Program`; a `: Program` annotation widens the literal type away. Typed `params`
|
|
5327
|
+
* descriptors `{ name, type }` make the list authoritative (every param bound, every `$name`
|
|
5328
|
+
* declared, values type-checked); bare name strings are documentation only.
|
|
5329
|
+
*
|
|
5330
|
+
* A covenant spend needs an `indexer` as well as an `emulator`: the co-signer resolves each
|
|
5331
|
+
* input's prevout from the previous ark tx the PSBT carries. Pure tapscript spends need neither.
|
|
5638
5332
|
*
|
|
5639
5333
|
* @example
|
|
5640
5334
|
* ```typescript
|
|
@@ -5677,10 +5371,8 @@ type FnArgs<F extends ArkadeFunction> = F extends {
|
|
|
5677
5371
|
inputs: infer I extends readonly InputRef[];
|
|
5678
5372
|
} ? ArgsTuple<I> : [];
|
|
5679
5373
|
/**
|
|
5680
|
-
* The statically-typed `functions` map of a contract
|
|
5681
|
-
*
|
|
5682
|
-
* its `inputs`. When the program is the widened {@link Program} (an index
|
|
5683
|
-
* signature), it falls back to the loose {@link CallableFunctions}.
|
|
5374
|
+
* The statically-typed `functions` map of a contract: precisely typed per function for a literal
|
|
5375
|
+
* program, the loose {@link CallableFunctions} for the widened {@link Program}.
|
|
5684
5376
|
*/
|
|
5685
5377
|
type ContractFunctions<P extends Program> = string extends keyof P["functions"] ? CallableFunctions : {
|
|
5686
5378
|
[K in keyof P["functions"]]: (...args: FnArgs<P["functions"][K]>) => ArkadeTransactionBuilder;
|
|
@@ -5691,13 +5383,9 @@ interface Utxo {
|
|
|
5691
5383
|
vout: number;
|
|
5692
5384
|
value: number;
|
|
5693
5385
|
/**
|
|
5694
|
-
* Raw
|
|
5695
|
-
* the
|
|
5696
|
-
*
|
|
5697
|
-
* An override, not the only channel: covenant spends resolve the previous
|
|
5698
|
-
* tx of every input through the client's indexer. Supply it when the tx is
|
|
5699
|
-
* not yet indexable — a recursive covenant spending the output of an ark tx
|
|
5700
|
-
* the caller just built — and the resolved value is suppressed for input 0.
|
|
5386
|
+
* Raw bytes of the ark tx that created this VTXO, attached as input 0's PrevArkTx. Overrides
|
|
5387
|
+
* the indexer-resolved value; supply it when the tx isn't indexable yet (a recursive covenant
|
|
5388
|
+
* spending an ark tx the caller just built).
|
|
5701
5389
|
*/
|
|
5702
5390
|
sourceTx?: Uint8Array;
|
|
5703
5391
|
}
|
|
@@ -5733,33 +5421,19 @@ interface ArkadeSpendResult {
|
|
|
5733
5421
|
}
|
|
5734
5422
|
/** The callable spending paths of a contract. */
|
|
5735
5423
|
type CallableFunctions = Record<string, (...args: ArkadeArgValue[]) => ArkadeTransactionBuilder>;
|
|
5736
|
-
/**
|
|
5737
|
-
* What {@link Arkade} needs from the Arkade server.
|
|
5738
|
-
*
|
|
5739
|
-
* Only `getInfo` is required — see {@link ArkadeConnectOptions.arkade} for why.
|
|
5740
|
-
* Named so a caller building a derivation-only client has a type to import
|
|
5741
|
-
* rather than reaching into the options bag.
|
|
5742
|
-
*/
|
|
5424
|
+
/** What {@link Arkade} needs from the Arkade server; see {@link ArkadeConnectOptions.arkade}. */
|
|
5743
5425
|
type ArkadeServerProvider = Pick<ArkProvider, "getInfo"> & Partial<ArkadeBroadcaster>;
|
|
5744
5426
|
/** Options for {@link Arkade.connect}. */
|
|
5745
5427
|
interface ArkadeConnectOptions {
|
|
5746
5428
|
/**
|
|
5747
|
-
* The Arkade server provider.
|
|
5748
|
-
*
|
|
5749
|
-
*
|
|
5750
|
-
* checkpoint closure, and it is all a client needs to derive, register and
|
|
5751
|
-
* inspect contracts. `submitTx`/`finalizeTx` are needed solely to
|
|
5752
|
-
* broadcast, so a client built without them throws at `.send()` — the same
|
|
5753
|
-
* deferred, explicit failure an absent `indexer` gives `getUtxos()` and an
|
|
5754
|
-
* absent `emulator` gives a covenant spend. That lets a caller that already
|
|
5755
|
-
* holds the server info (`wallet.getArkadeInfo()`) connect without a
|
|
5756
|
-
* provider of its own, and without a second `/v1/info` round-trip.
|
|
5429
|
+
* The Arkade server provider. Only `getInfo` is required (enough to derive, register and
|
|
5430
|
+
* inspect contracts); without `submitTx`/`finalizeTx`, `.send()` throws. So a caller already
|
|
5431
|
+
* holding `wallet.getArkadeInfo()` can connect without a second `/v1/info` round-trip.
|
|
5757
5432
|
*/
|
|
5758
5433
|
arkade: ArkadeServerProvider;
|
|
5759
5434
|
/**
|
|
5760
|
-
* The co-signing (introspector/emulator) service.
|
|
5761
|
-
*
|
|
5762
|
-
* tapscript contracts (multisig/timelock/hashlock) don't need it.
|
|
5435
|
+
* The co-signing (introspector/emulator) service. Required only for functions with an
|
|
5436
|
+
* `arkadeScript` (covenant paths).
|
|
5763
5437
|
*/
|
|
5764
5438
|
emulator?: EmulatorProvider;
|
|
5765
5439
|
/**
|
|
@@ -5776,31 +5450,24 @@ interface ArkadeConnectOptions {
|
|
|
5776
5450
|
*/
|
|
5777
5451
|
network?: Network;
|
|
5778
5452
|
/**
|
|
5779
|
-
* Co-sign with this emulator key (33-byte compressed hex) instead of the
|
|
5780
|
-
*
|
|
5781
|
-
*
|
|
5782
|
-
*
|
|
5783
|
-
* self-hosted emulator, or on a network with no pinned key at all (signet,
|
|
5784
|
-
* testnet, a hand-built `Network` — those throw without it). Setting it
|
|
5785
|
-
* means trusting that operator as co-signer in place of the network's.
|
|
5453
|
+
* Co-sign with this emulator key (33-byte compressed hex) instead of the one pinned for
|
|
5454
|
+
* `network`. Needed after a key rotation ahead of this SDK, for a self-hosted emulator, or on
|
|
5455
|
+
* networks with no pinned key (signet, testnet, a hand-built `Network` — those throw without
|
|
5456
|
+
* it). Setting it means trusting that operator as co-signer.
|
|
5786
5457
|
*
|
|
5787
5458
|
* @see resolveEmulatorPubkey
|
|
5788
5459
|
*/
|
|
5789
5460
|
emulatorPubkey?: string;
|
|
5790
5461
|
/**
|
|
5791
|
-
* The wallet's contract manager.
|
|
5792
|
-
*
|
|
5793
|
-
*
|
|
5794
|
-
* {@link ArkadeContract.getUtxos} reads repository-backed state
|
|
5795
|
-
* (offline-first) for registered contracts instead of querying the
|
|
5796
|
-
* indexer directly. Obtain it via `wallet.getContractManager()`.
|
|
5462
|
+
* The wallet's contract manager (`wallet.getContractManager()`). Enables
|
|
5463
|
+
* {@link ArkadeContract.register}, and makes {@link ArkadeContract.getUtxos} read
|
|
5464
|
+
* repository-backed state for registered contracts instead of the indexer.
|
|
5797
5465
|
*/
|
|
5798
5466
|
contractManager?: IContractManager;
|
|
5799
5467
|
}
|
|
5800
5468
|
/**
|
|
5801
|
-
* A connected Arkade client
|
|
5802
|
-
*
|
|
5803
|
-
* so spinning up contracts is synchronous.
|
|
5469
|
+
* A connected Arkade client holding the providers and resolved network constants (server key,
|
|
5470
|
+
* co-signer key, checkpoint closure), so creating contracts is synchronous.
|
|
5804
5471
|
*/
|
|
5805
5472
|
declare class Arkade {
|
|
5806
5473
|
readonly arkProvider: ArkadeServerProvider;
|
|
@@ -5809,14 +5476,10 @@ declare class Arkade {
|
|
|
5809
5476
|
readonly network: Network;
|
|
5810
5477
|
readonly serverKey: Uint8Array;
|
|
5811
5478
|
/**
|
|
5812
|
-
* The co-signer key covenants are built against (33-byte compressed),
|
|
5813
|
-
*
|
|
5814
|
-
*
|
|
5815
|
-
*
|
|
5816
|
-
* emulator's own report. When a claim is refused because the co-signer
|
|
5817
|
-
* disagrees, compare `hex.encode(arkade.emulatorKey)` against the
|
|
5818
|
-
* `signerPubkey` your emulator serves on `/v1/info`: if they differ, the
|
|
5819
|
-
* network rotated and this SDK's pin is stale.
|
|
5479
|
+
* The co-signer key covenants are built against (33-byte compressed), present only when an
|
|
5480
|
+
* emulator is configured. Resolved from the network or `emulatorPubkey`, never the emulator's
|
|
5481
|
+
* own report. If a claim is refused, compare it with the emulator's `/v1/info` `signerPubkey`:
|
|
5482
|
+
* a difference means the network rotated and this SDK's pin is stale.
|
|
5820
5483
|
*/
|
|
5821
5484
|
readonly emulatorKey: Uint8Array | undefined;
|
|
5822
5485
|
readonly checkpoint: CSVMultisigTapscript.Type;
|
|
@@ -5830,14 +5493,11 @@ declare class Arkade {
|
|
|
5830
5493
|
/** Connect and resolve the server key, checkpoint closure and (if present) the co-signer key. */
|
|
5831
5494
|
static connect(opts: ArkadeConnectOptions): Promise<Arkade>;
|
|
5832
5495
|
/**
|
|
5833
|
-
* Instantiate a contract from a program and its constructor arguments.
|
|
5834
|
-
*
|
|
5835
|
-
* contract's `functions` map is strongly typed — `functions.<name>(...)`
|
|
5836
|
-
* knows each argument's type from the function's `inputs` descriptors.
|
|
5496
|
+
* Instantiate a contract from a program and its constructor arguments. `const` inference keeps
|
|
5497
|
+
* the program's literal type, so `functions` is strongly typed.
|
|
5837
5498
|
*
|
|
5838
|
-
*
|
|
5839
|
-
*
|
|
5840
|
-
* key respectively; explicit args always win.
|
|
5499
|
+
* Unbound declared `server`/`user` params default to the client's server key / identity key;
|
|
5500
|
+
* explicit args win.
|
|
5841
5501
|
*/
|
|
5842
5502
|
contract<const P extends Program>(program: P, args?: Record<string, ArkadeParamValue>): ArkadeContract<P>;
|
|
5843
5503
|
}
|
|
@@ -5856,11 +5516,8 @@ declare class ArkadeContract<P extends Program = Program> {
|
|
|
5856
5516
|
private readonly compiled;
|
|
5857
5517
|
constructor(client: Arkade, program: P, args?: Record<string, ArkadeParamValue>, keys?: ProgramKeys);
|
|
5858
5518
|
/**
|
|
5859
|
-
* Rebuild a callable contract from a persisted `"arkade"`
|
|
5860
|
-
*
|
|
5861
|
-
* compilation — not the client's current ones — so the derived script and
|
|
5862
|
-
* address stay identical to the registered contract even after a server
|
|
5863
|
-
* signer rotation.
|
|
5519
|
+
* Rebuild a callable contract from a persisted `"arkade"` row. Compiles with the stored keys,
|
|
5520
|
+
* not the client's current ones, so script and address survive a server signer rotation.
|
|
5864
5521
|
*/
|
|
5865
5522
|
static fromContract(client: Arkade, contract: Contract): ArkadeContract;
|
|
5866
5523
|
/** Resolve the {@link TapLeafScript} for a spending path by its index. */
|
|
@@ -5869,16 +5526,11 @@ declare class ArkadeContract<P extends Program = Program> {
|
|
|
5869
5526
|
get address(): string;
|
|
5870
5527
|
/** Taproot output script. */
|
|
5871
5528
|
get pkScript(): Uint8Array;
|
|
5872
|
-
/**
|
|
5873
|
-
* Callable spending paths: `contract.functions.<name>(...args)`. Strongly
|
|
5874
|
-
* typed from the program's literal type — each function's argument types are
|
|
5875
|
-
* derived from its `inputs` descriptors (see {@link ContractFunctions}).
|
|
5876
|
-
*/
|
|
5529
|
+
/** Callable spending paths: `functions.<name>(...args)` (see {@link ContractFunctions}). */
|
|
5877
5530
|
get functions(): ContractFunctions<P>;
|
|
5878
5531
|
/**
|
|
5879
|
-
* The `createContract` payload
|
|
5880
|
-
*
|
|
5881
|
-
* through a manager the client does not hold.
|
|
5532
|
+
* The `createContract` payload (serialized program, args, keys, script, address), for
|
|
5533
|
+
* registering through a manager the client does not hold.
|
|
5882
5534
|
*/
|
|
5883
5535
|
toContractParams(): {
|
|
5884
5536
|
type: string;
|
|
@@ -5887,26 +5539,17 @@ declare class ArkadeContract<P extends Program = Program> {
|
|
|
5887
5539
|
address: string;
|
|
5888
5540
|
};
|
|
5889
5541
|
/**
|
|
5890
|
-
* Persist this contract through the wallet's {@link IContractManager}
|
|
5891
|
-
*
|
|
5892
|
-
* repository, watched for VTXO events, counted in repository-backed
|
|
5893
|
-
* balances, and re-derivable offline via the `"arkade"` contract handler.
|
|
5894
|
-
* Idempotent — re-registering the same script is a no-op.
|
|
5542
|
+
* Persist this contract through the wallet's {@link IContractManager} (stored, watched,
|
|
5543
|
+
* counted in balances, re-derivable via the `"arkade"` handler). Idempotent per script.
|
|
5895
5544
|
*/
|
|
5896
5545
|
register(options?: {
|
|
5897
5546
|
label?: string;
|
|
5898
5547
|
metadata?: Record<string, unknown>;
|
|
5899
5548
|
}): Promise<Contract>;
|
|
5900
5549
|
/**
|
|
5901
|
-
* Spendable VTXOs locked by this contract
|
|
5902
|
-
*
|
|
5903
|
-
*
|
|
5904
|
-
* reads the repository-backed state (offline-first, kept fresh by the
|
|
5905
|
-
* contract watcher). Otherwise falls back to a direct indexer query.
|
|
5906
|
-
*
|
|
5907
|
-
* Both branches refuse a spent or unilaterally exited output. They are not
|
|
5908
|
-
* otherwise interchangeable: the fallback asks `spendableOnly`, which also
|
|
5909
|
-
* drops swept coins — the manager branch keeps those.
|
|
5550
|
+
* Spendable VTXOs locked by this contract: repository-backed when registered with a
|
|
5551
|
+
* `contractManager`, otherwise a direct indexer query. Both drop spent and unrolled outputs;
|
|
5552
|
+
* only the indexer branch (`spendableOnly`) also drops swept coins.
|
|
5910
5553
|
*/
|
|
5911
5554
|
getUtxos(): Promise<VirtualCoin[]>;
|
|
5912
5555
|
/** Total spendable balance (requires an indexer). */
|
|
@@ -6003,6 +5646,7 @@ declare const index_AsmToken: typeof AsmToken;
|
|
|
6003
5646
|
type index_AssetSpec = AssetSpec;
|
|
6004
5647
|
type index_CallableFunctions = CallableFunctions;
|
|
6005
5648
|
declare const index_CompiledProgramFunction: typeof CompiledProgramFunction;
|
|
5649
|
+
type index_ContractArtifact = ContractArtifact;
|
|
6006
5650
|
type index_ContractFunctions<P extends Program> = ContractFunctions<P>;
|
|
6007
5651
|
declare const index_InputDef: typeof InputDef;
|
|
6008
5652
|
declare const index_InputRef: typeof InputRef;
|
|
@@ -6016,6 +5660,7 @@ declare const index_Script: typeof Script;
|
|
|
6016
5660
|
declare const index_ScriptType: typeof ScriptType;
|
|
6017
5661
|
declare const index_SignerRef: typeof SignerRef;
|
|
6018
5662
|
declare const index_TapscriptSegment: typeof TapscriptSegment;
|
|
5663
|
+
declare const index_TweakedSigner: typeof TweakedSigner;
|
|
6019
5664
|
type index_Utxo = Utxo;
|
|
6020
5665
|
declare const index_WitnessRef: typeof WitnessRef;
|
|
6021
5666
|
declare const index_arkadeScriptHash: typeof arkadeScriptHash;
|
|
@@ -6028,7 +5673,9 @@ declare const index_deserializeArkadeContractParams: typeof deserializeArkadeCon
|
|
|
6028
5673
|
declare const index_fromASM: typeof fromASM;
|
|
6029
5674
|
declare const index_getOpcodeName: typeof getOpcodeName;
|
|
6030
5675
|
declare const index_getOpcodeValue: typeof getOpcodeValue;
|
|
5676
|
+
declare const index_isContractArtifact: typeof isContractArtifact;
|
|
6031
5677
|
declare const index_parseArtifact: typeof parseArtifact;
|
|
5678
|
+
declare const index_programFromArtifact: typeof programFromArtifact;
|
|
6032
5679
|
declare const index_resolveAsm: typeof resolveAsm;
|
|
6033
5680
|
declare const index_serializeArkadeContractParams: typeof serializeArkadeContractParams;
|
|
6034
5681
|
declare const index_stringifyArtifact: typeof stringifyArtifact;
|
|
@@ -6036,7 +5683,7 @@ declare const index_toASM: typeof toASM;
|
|
|
6036
5683
|
declare const index_validateProgram: typeof validateProgram;
|
|
6037
5684
|
declare const index_witnessRefToBytes: typeof witnessRefToBytes;
|
|
6038
5685
|
declare namespace index {
|
|
6039
|
-
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 };
|
|
5686
|
+
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_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_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, 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_resolveAsm as resolveAsm, index_serializeArkadeContractParams as serializeArkadeContractParams, index_stringifyArtifact as stringifyArtifact, index_toASM as toASM, index_validateProgram as validateProgram, index_witnessRefToBytes as witnessRefToBytes };
|
|
6040
5687
|
}
|
|
6041
5688
|
|
|
6042
5689
|
/** Known BIP21 parameters including Arkade-specific extensions. */
|
|
@@ -6114,24 +5761,14 @@ interface PaymentHandle {
|
|
|
6114
5761
|
}): Promise<RouteResult>;
|
|
6115
5762
|
}
|
|
6116
5763
|
/**
|
|
6117
|
-
* A priced route. The
|
|
6118
|
-
*
|
|
6119
|
-
*
|
|
6120
|
-
*
|
|
6121
|
-
* - `amount` — sats delivered **to the recipient**.
|
|
6122
|
-
* - `fee` — sats charged **on top**, by the rail and its counterparty.
|
|
6123
|
-
* - `total` — `amount + fee`; the sats that leave the wallet.
|
|
5764
|
+
* A priced route. The amounts are **receiver-exact** on every rail, so options rank on cost and
|
|
5765
|
+
* rails swap without changing what the recipient gets. Rails whose primitive *deducts* its fee
|
|
5766
|
+
* (collaborative exit) gross the amount up; a rail that can't (it doesn't choose the fee) flags
|
|
5767
|
+
* it via `claimFeeDeductedFromPayout`.
|
|
6124
5768
|
*
|
|
6125
|
-
*
|
|
6126
|
-
*
|
|
6127
|
-
*
|
|
6128
|
-
* never chooses, and flags that instead: see `claimFeeDeductedFromPayout`.
|
|
6129
|
-
*
|
|
6130
|
-
* `fee` is a pre-send estimate wherever the true cost is only fixed later: the
|
|
6131
|
-
* collaborative exit omits the per-input intent fees whenever the request left
|
|
6132
|
-
* the VTXO selection to settlement — naming {@link PaymentRequest.selectedVtxos}
|
|
6133
|
-
* fixes them, and they are priced in. Treat it as a display and ranking figure,
|
|
6134
|
-
* not a guarantee.
|
|
5769
|
+
* `fee` is an estimate where cost is fixed later: the collaborative exit omits per-input intent
|
|
5770
|
+
* fees unless {@link PaymentRequest.selectedVtxos} is named. A display/ranking figure, not a
|
|
5771
|
+
* guarantee.
|
|
6135
5772
|
*/
|
|
6136
5773
|
interface RouteQuote {
|
|
6137
5774
|
railId: string;
|
|
@@ -6142,31 +5779,18 @@ interface RouteQuote {
|
|
|
6142
5779
|
/** `amount + fee` — what leaves the wallet. */
|
|
6143
5780
|
total: number;
|
|
6144
5781
|
/**
|
|
6145
|
-
* Unix seconds after which the counterparty stops honouring this quote.
|
|
6146
|
-
*
|
|
6147
|
-
*
|
|
6148
|
-
* counterparty and no quote book — an Arkade transfer, an asset transfer, a
|
|
6149
|
-
* collaborative exit — has no validity to state. A caller holding a quote
|
|
6150
|
-
* across user think-time should read absence as "no check possible", and must
|
|
6151
|
-
* still expect {@link send} to refuse either way: the swap rails re-check
|
|
6152
|
-
* validity there, which is the only point that can judge it against the
|
|
6153
|
-
* moment of spending.
|
|
5782
|
+
* Unix seconds after which the counterparty stops honouring this quote. Absent means "no
|
|
5783
|
+
* check possible" (rails without a counterparty), not "never expires"; {@link send} may
|
|
5784
|
+
* still refuse, since swap rails re-check validity at spend time.
|
|
6154
5785
|
*/
|
|
6155
5786
|
validUntil?: number;
|
|
6156
5787
|
/**
|
|
6157
|
-
* @experimental The asset shape is provisional
|
|
6158
|
-
*
|
|
6159
|
-
* vocabularies are expected to converge on v0.5; do not treat this field as
|
|
6160
|
-
* stable 0.4.x API.
|
|
6161
|
-
*
|
|
6162
|
-
* The asset view; absent means BTC only. The sats fields keep their
|
|
6163
|
-
* meaning — an asset rides a sats-carrying output, so `amount` is the
|
|
6164
|
-
* carrier, not zero.
|
|
5788
|
+
* @experimental The asset shape is provisional, expected to converge with the v2 swap
|
|
5789
|
+
* client's `give`/`take`/`amountOn` over `AssetRef` in v0.5; not stable 0.4.x API.
|
|
6165
5790
|
*
|
|
6166
|
-
*
|
|
6167
|
-
*
|
|
6168
|
-
*
|
|
6169
|
-
* cost display.
|
|
5791
|
+
* The asset view; absent means BTC only. `amount` stays the sats carrier, not zero. On a
|
|
5792
|
+
* cross-asset route `delivered`/`spent` are different assets, so the purchase price lands in
|
|
5793
|
+
* `fee`; prefer `assets.spent` for a cost display.
|
|
6170
5794
|
*/
|
|
6171
5795
|
assets?: {
|
|
6172
5796
|
delivered: Asset;
|
|
@@ -6205,14 +5829,10 @@ interface PaymentRequest {
|
|
|
6205
5829
|
* legitimately has both. A rail that cannot deliver assets must REFUSE. */
|
|
6206
5830
|
assets?: Asset[];
|
|
6207
5831
|
/**
|
|
6208
|
-
* Spend exactly these virtual outputs,
|
|
6209
|
-
* {
|
|
6210
|
-
*
|
|
6211
|
-
*
|
|
6212
|
-
*
|
|
6213
|
-
* Only the rails spending the wallet's own coins can honour it (`ark`,
|
|
6214
|
-
* `ark-asset`, `onchain`). A rail funding its payment through a counterparty
|
|
6215
|
-
* picks its own inputs, so it must REFUSE rather than ignore the selection.
|
|
5832
|
+
* Spend exactly these (normalized) virtual outputs, as {@link SendParams.selectedVtxos}:
|
|
5833
|
+
* ungated like `settle({ inputs })`, and a shortfall is an error, not a top-up. Only rails
|
|
5834
|
+
* spending the wallet's own coins (`ark`, `ark-asset`, `onchain`) can honour it;
|
|
5835
|
+
* counterparty-funded rails must REFUSE, not ignore it.
|
|
6216
5836
|
*/
|
|
6217
5837
|
selectedVtxos?: NormalizedExtendedVirtualCoin[];
|
|
6218
5838
|
}
|
|
@@ -6449,9 +6069,7 @@ declare function sequenceToTimelock(sequence: number): RelativeTimelock;
|
|
|
6449
6069
|
declare function toXOnly(key: Uint8Array, label?: string): Uint8Array;
|
|
6450
6070
|
|
|
6451
6071
|
declare const buildVersion = "0.9.9";
|
|
6452
|
-
/**
|
|
6453
|
-
* The SDK's own version string, sourced from package.json
|
|
6454
|
-
*/
|
|
6072
|
+
/** The SDK's own version string, sourced from package.json */
|
|
6455
6073
|
declare const sdkVersion: string;
|
|
6456
6074
|
/**
|
|
6457
6075
|
* Wraps a transport-level `fetch` rejection (DNS failure, connection refused,
|
|
@@ -6470,12 +6088,9 @@ declare class FetchError extends Error {
|
|
|
6470
6088
|
});
|
|
6471
6089
|
}
|
|
6472
6090
|
/**
|
|
6473
|
-
* Deadline
|
|
6474
|
-
*
|
|
6475
|
-
*
|
|
6476
|
-
* stays pending until the runtime gives up — and every bound built on top of it
|
|
6477
|
-
* waits with it. A retry ladder, a bounded queue or a mutex only work if the
|
|
6478
|
-
* call underneath them terminates.
|
|
6091
|
+
* Deadline for a read that carries no `AbortSignal` of its own. `fetch` has no default timeout,
|
|
6092
|
+
* so a silently dropped connection stays pending, and every retry ladder, queue or mutex built on
|
|
6093
|
+
* top of it waits with it.
|
|
6479
6094
|
*/
|
|
6480
6095
|
declare const READ_TIMEOUT_MS = 30000;
|
|
6481
6096
|
|
|
@@ -6538,46 +6153,22 @@ interface ManagedConnection extends AsyncDisposable {
|
|
|
6538
6153
|
/**
|
|
6539
6154
|
* The open connection, opening it on first call.
|
|
6540
6155
|
*
|
|
6541
|
-
* Call
|
|
6542
|
-
*
|
|
6543
|
-
*
|
|
6544
|
-
*
|
|
6545
|
-
* after which every transaction on that handle throws `InvalidStateError`;
|
|
6546
|
-
* a later `get()` transparently reopens, but only for callers that ask
|
|
6547
|
-
* again. Holding the resolved database is exactly the defect this type
|
|
6548
|
-
* exists to remove.
|
|
6549
|
-
*
|
|
6550
|
-
* ## The dispose boundary
|
|
6551
|
-
*
|
|
6552
|
-
* `get()` is valid only before `[Symbol.asyncDispose]`. Afterwards it
|
|
6553
|
-
* rejects with {@link ConnectionDisposedError}, permanently: dispose has
|
|
6554
|
-
* released this connection's single reference, and reopening would take a
|
|
6555
|
-
* refcount nothing is left to release. Disposal is final by design — there
|
|
6556
|
-
* is no revive; construct a new repository, which constructs a new
|
|
6557
|
-
* connection, instead.
|
|
6156
|
+
* Call once per operation and use the handle for the transaction you start right away —
|
|
6157
|
+
* never store it or carry it across an `await`. It can be closed underneath you at any time
|
|
6158
|
+
* (`versionchange` from another tab, eviction, "clear site data"), after which every
|
|
6159
|
+
* transaction on it throws `InvalidStateError`; a later `get()` transparently reopens.
|
|
6558
6160
|
*
|
|
6559
|
-
*
|
|
6560
|
-
*
|
|
6561
|
-
*
|
|
6562
|
-
*
|
|
6563
|
-
* `await` the repository's outstanding calls first — rather than racing it
|
|
6564
|
-
* against them.
|
|
6565
|
-
*
|
|
6566
|
-
* Callers must not close the database themselves; the reference this
|
|
6567
|
-
* connection holds is released by its own dispose, once.
|
|
6161
|
+
* After `[Symbol.asyncDispose]` it rejects with {@link ConnectionDisposedError}, permanently:
|
|
6162
|
+
* reopening would take a refcount nothing releases, so construct a new repository instead.
|
|
6163
|
+
* Dispose neither awaits nor cancels in-flight work, so `await` outstanding repository calls
|
|
6164
|
+
* before disposing. Callers must not close the database themselves.
|
|
6568
6165
|
*/
|
|
6569
6166
|
get(): Promise<IDBDatabase>;
|
|
6570
6167
|
}
|
|
6571
6168
|
/**
|
|
6572
|
-
* Forget-and-reopen around {@link openDatabase}, shared by every IndexedDB
|
|
6573
|
-
*
|
|
6574
|
-
*
|
|
6575
|
-
* that handle throws `InvalidStateError` with no path back.
|
|
6576
|
-
*
|
|
6577
|
-
* Opens nothing until the first {@link ManagedConnection.get} — repositories
|
|
6578
|
-
* construct their storage in their own constructors, and an eager open would
|
|
6579
|
-
* move the "IndexedDB is not available in this environment" throw to
|
|
6580
|
-
* construction time.
|
|
6169
|
+
* Forget-and-reopen around {@link openDatabase}, shared by every IndexedDB repository: a cached
|
|
6170
|
+
* `IDBDatabase` throws `InvalidStateError` forever once the manager closes it on `versionchange`.
|
|
6171
|
+
* Lazy, so the "IndexedDB is not available" throw stays out of repository constructors.
|
|
6581
6172
|
*/
|
|
6582
6173
|
declare function createManagedConnection(dbName: string, version: number, initDatabase: (db: IDBDatabase, oldVersion: number, transaction: IDBTransaction | null) => void): ManagedConnection;
|
|
6583
6174
|
|
|
@@ -6687,4 +6278,4 @@ declare class AssetManager extends ReadonlyAssetManager implements IAssetManager
|
|
|
6687
6278
|
burn(params: BurnParams): Promise<string>;
|
|
6688
6279
|
}
|
|
6689
6280
|
|
|
6690
|
-
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, type ArkadeBatchInput, ArkadeBroadcaster, ArkadeCash, ArkadeContractParams, type ArkadeExtendedCoin, type ArkadeExtendedVirtualCoin, ArkadeInfo, ArkadeReader, Asset, AssetDetails, AssetManager, BIP21, BIP21Error, type BIP21Params, type BIP21ParseResult, BIP322, BLOCKED_UPGRADE_TIMEOUT_MS, Batch, BatchExpiryPolicy, BurnParams, CSVMultisigTapscript, CachingArkProvider, ChainTx, Coin, ConditionWitness, ConnectionDisposedError, type ConnectorTreeNode, Contract, ContractEvent, ContractRepository, ContractSyncState, ContractWatcherConfig, ContractWithVtxos, CosignerPublicKey, CreateContractParams, DEFAULT_MESSAGE_TIMEOUTS, DatabaseUpgradeBlockedError, DefaultVtxo, DelegateInfo, DelegateNotConfiguredError, DescriptorIdentity, type DescriptorIdentityOptions, type DescriptorOptions, type DescriptorSigner, DescriptorSigningProviderMissingError, type DeterministicSigner, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, type BlockHeader as ElectrumBlockHeader, ElectrumOnchainProvider, type TransactionHistory as ElectrumTransactionHistory, type Unspent as ElectrumUnspent, type EmulatorEntry, type EmulatorInfo, EmulatorPacket, type EmulatorProvider, EncodedVtxoScript, Estimator, type ExcludableVtxo, type ExecutorEvent, type ExecutorOptions, type ExitDelay, type ExitFeeWallet, type ExitMode, type ExitOptions, type ExitPackage, type ExitQuote, type ExitStep, type ExitTotals, type ExitVtxoInfo, ExplorerTransaction, ExtendedCoin, ExtendedVirtualCoin, Extension, ExtensionNotFoundError, type ExtensionPacket, FeeAmount, FeeInfo, FeeOutput, FetchError, GetArkadeInfoOptions, GetNewAddressesOptions, GetVtxosFilter, GetVtxosOptions, HDAllocationCapable, HDDescriptorProvider, type HDDeterministicSignCapable, HDWalletCapable, IAssetManager, IContractManager, IDelegateManager, IReadonlyAssetManager, IReadonlyWallet, IVtxoManager, IWallet, Identity, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexedDBWalletRepository, IndexerProvider, Intent, IntentFeeConfig,
|
|
6281
|
+
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, type ArkadeBatchInput, ArkadeBroadcaster, ArkadeCash, ArkadeContractParams, type ArkadeExtendedCoin, type ArkadeExtendedVirtualCoin, ArkadeInfo, ArkadeReader, Asset, AssetDetails, AssetManager, BIP21, BIP21Error, type BIP21Params, type BIP21ParseResult, BIP322, BLOCKED_UPGRADE_TIMEOUT_MS, Batch, BatchExpiryPolicy, BurnParams, CSVMultisigTapscript, CachingArkProvider, ChainTx, Coin, ConditionWitness, ConnectionDisposedError, type ConnectorTreeNode, Contract, ContractEvent, ContractFilter, ContractRepository, ContractSyncState, ContractWatcherConfig, ContractWithVtxos, CosignerPublicKey, CreateContractParams, DEFAULT_MESSAGE_TIMEOUTS, DatabaseUpgradeBlockedError, DefaultVtxo, DelegateInfo, DelegateNotConfiguredError, DescriptorIdentity, type DescriptorIdentityOptions, type DescriptorOptions, type DescriptorSigner, DescriptorSigningProviderMissingError, type DeterministicSigner, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, type BlockHeader as ElectrumBlockHeader, ElectrumOnchainProvider, type TransactionHistory as ElectrumTransactionHistory, type Unspent as ElectrumUnspent, type EmulatorEntry, type EmulatorInfo, EmulatorPacket, type EmulatorProvider, EncodedVtxoScript, Estimator, type ExcludableVtxo, type ExecutorEvent, type ExecutorOptions, type ExitDelay, type ExitFeeWallet, type ExitMode, type ExitOptions, type ExitPackage, type ExitQuote, type ExitStep, type ExitTotals, type ExitVtxoInfo, ExplorerTransaction, ExtendedCoin, ExtendedVirtualCoin, Extension, ExtensionNotFoundError, type ExtensionPacket, FeeAmount, FeeInfo, FeeOutput, FetchError, 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, IndexedDBWalletRepository, IndexerProvider, 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, RestEmulatorProvider, type RouteQuote, type RouteResult, type RouterContext, type RouterPreferences, ScriptVtxoCursor, ScriptVtxoPageOptions, SeedIdentity, type SeedIdentityOptions, SendBitcoinParams, SendParams, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, type ServiceWorkerWalletMode, SettleParams, SettlementConfig, SettlementEvent, SignedIntent, SignerSession, SignerStatus, SingleKey, Status, StorageConfig, StoredVtxo, TapLeafScript, Transaction, TransactionHistoryPageCursor, TransactionHistoryPageFilter, TreeNonces, TreePartialSigs, TxNotificationEvent, TxTree, TxWeightEstimator, UnannotatableInputError, UnilateralExit, UnknownPacket, Unroll, type VSize, type VerifyServerSignatures, VirtualCoin, VirtualTx, VirtualTxRepository, VtxoBranch, type VtxoExclusion, VtxoScript, VtxoTaprootTree, VtxoTreeExpiry, Wallet, WalletBalance, WalletCannotSignError, WalletMessageHandler, WalletNotInitializedError, WalletRepository, type WalletRestoreHook, WatchedScript, WsElectrumChainSource, adoptContractDescriptor, arkAssetRail, arkRail, arkTarget, index as arkade, assembleBtcdTaprootTree, assertFinalCommitmentMatchesValidated, assertNoAssets, assertNoSelection, assertSendableAmount, assertSubmittedArkTxid, index$1 as asset, assetsOf, awaitTransaction, btcTarget, buildForfeitTx, buildOffchainTx, buildPreimageMessage, buildSaltedPreimageMessage, buildVersion, claimWithPreimageIdentity, closeDatabase, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, contractPreimage, contractSigner, createAssetPacket, createDefaultPaymentRouter, createManagedConnection, decodeArkContract, deleteByIndex, deriveDescriptorLeafCompressedPubKey, deriveDescriptorLeafPubKey, deserializeExitPackage, encodeArkContract, exitObserverFor, gateExclusion, gatedContracts, getAllByIndexValues, getArkPsbtFields, 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, timelockToSequence, toXOnly, tryResolveSendAmount, validateBatchRecipients, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, walletFeeSource };
|