@arkade-os/sdk 0.4.25 → 0.4.27
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 +5 -25
- package/dist/cjs/contracts/contractManager.js +31 -11
- package/dist/cjs/contracts/contractWatcher.js +2 -2
- package/dist/cjs/identity/hdCapableIdentity.js +18 -0
- package/dist/cjs/identity/index.js +3 -1
- package/dist/cjs/identity/seedIdentity.js +16 -0
- package/dist/cjs/index.js +4 -2
- package/dist/cjs/script/address.js +2 -2
- package/dist/cjs/wallet/delegator.js +10 -4
- package/dist/cjs/wallet/hdDescriptorProvider.js +29 -0
- package/dist/cjs/wallet/inputSignerRouter.js +98 -0
- package/dist/cjs/wallet/serviceWorker/wallet.js +1 -0
- package/dist/cjs/wallet/signingErrors.js +32 -0
- package/dist/cjs/wallet/unroll.js +5 -1
- package/dist/cjs/wallet/wallet.js +232 -86
- package/dist/cjs/wallet/walletReceiveRotator.js +547 -0
- package/dist/cjs/worker/messageBus.js +1 -0
- package/dist/esm/adapters/asyncStorage.js +1 -1
- package/dist/esm/adapters/expo.js +2 -2
- package/dist/esm/adapters/fileSystem.js +1 -1
- package/dist/esm/adapters/indexedDB.js +1 -1
- package/dist/esm/adapters/localStorage.js +1 -1
- package/dist/esm/arkfee/index.js +1 -1
- package/dist/esm/arknote/index.js +1 -1
- package/dist/esm/bip322/index.js +2 -2
- package/dist/esm/contracts/arkcontract.js +2 -2
- package/dist/esm/contracts/contractManager.js +36 -16
- package/dist/esm/contracts/contractWatcher.js +5 -5
- package/dist/esm/contracts/handlers/default.js +4 -4
- package/dist/esm/contracts/handlers/delegate.js +4 -4
- package/dist/esm/contracts/handlers/helpers.js +2 -2
- package/dist/esm/contracts/handlers/index.js +8 -8
- package/dist/esm/contracts/handlers/vhtlc.js +3 -3
- package/dist/esm/contracts/index.js +8 -8
- package/dist/esm/extension/asset/assetGroup.js +7 -7
- package/dist/esm/extension/asset/assetId.js +2 -2
- package/dist/esm/extension/asset/assetInput.js +2 -2
- package/dist/esm/extension/asset/assetOutput.js +1 -1
- package/dist/esm/extension/asset/assetRef.js +3 -3
- package/dist/esm/extension/asset/index.js +8 -8
- package/dist/esm/extension/asset/metadata.js +1 -1
- package/dist/esm/extension/asset/packet.js +3 -3
- package/dist/esm/extension/index.js +4 -4
- package/dist/esm/forfeit.js +2 -2
- package/dist/esm/identity/hdCapableIdentity.js +17 -1
- package/dist/esm/identity/index.js +6 -5
- package/dist/esm/identity/seedIdentity.js +18 -2
- package/dist/esm/identity/serialize.js +2 -2
- package/dist/esm/identity/singleKey.js +1 -1
- package/dist/esm/identity/staticDescriptorProvider.js +2 -2
- package/dist/esm/index.js +48 -48
- package/dist/esm/intent/index.js +3 -3
- package/dist/esm/musig2/index.js +3 -3
- package/dist/esm/musig2/sign.js +1 -1
- package/dist/esm/providers/ark.js +3 -3
- package/dist/esm/providers/delegator.js +1 -1
- package/dist/esm/providers/electrum.js +2 -2
- package/dist/esm/providers/expoArk.js +2 -2
- package/dist/esm/providers/expoIndexer.js +3 -3
- package/dist/esm/providers/indexer.js +3 -3
- package/dist/esm/repositories/inMemory/walletRepository.js +1 -1
- package/dist/esm/repositories/index.js +9 -9
- package/dist/esm/repositories/indexedDB/contractRepository.js +4 -4
- package/dist/esm/repositories/indexedDB/db.js +2 -2
- package/dist/esm/repositories/indexedDB/schema.js +1 -1
- package/dist/esm/repositories/indexedDB/walletRepository.js +6 -6
- package/dist/esm/repositories/migrations/fromStorageAdapter.js +1 -1
- package/dist/esm/repositories/migrations/walletRepositoryImpl.js +1 -1
- package/dist/esm/repositories/realm/index.js +3 -3
- package/dist/esm/repositories/realm/schemas.js +1 -1
- package/dist/esm/repositories/realm/walletRepository.js +3 -3
- package/dist/esm/repositories/scriptFromAddress.js +1 -1
- package/dist/esm/repositories/sqlite/index.js +2 -2
- package/dist/esm/repositories/sqlite/walletRepository.js +3 -3
- package/dist/esm/script/address.js +3 -3
- package/dist/esm/script/base.js +3 -3
- package/dist/esm/script/default.js +2 -2
- package/dist/esm/script/delegate.js +3 -3
- package/dist/esm/script/tapscript.js +1 -1
- package/dist/esm/script/vhtlc.js +2 -2
- package/dist/esm/storage/indexedDB.js +1 -1
- package/dist/esm/tree/signingSession.js +2 -2
- package/dist/esm/tree/validation.js +2 -2
- package/dist/esm/utils/arkTransaction.js +7 -7
- package/dist/esm/utils/transactionHistory.js +1 -1
- package/dist/esm/utils/unknownFields.js +1 -1
- package/dist/esm/wallet/asset-manager.js +5 -5
- package/dist/esm/wallet/asset.js +1 -1
- package/dist/esm/wallet/batch.js +2 -2
- package/dist/esm/wallet/delegator.js +16 -10
- package/dist/esm/wallet/expo/background.js +5 -5
- package/dist/esm/wallet/expo/index.js +2 -2
- package/dist/esm/wallet/expo/wallet.js +8 -8
- package/dist/esm/wallet/hdDescriptorProvider.js +31 -2
- package/dist/esm/wallet/inputSignerRouter.js +94 -0
- package/dist/esm/wallet/onchain.js +7 -7
- package/dist/esm/wallet/ramps.js +3 -3
- package/dist/esm/wallet/serviceWorker/wallet-message-handler.js +6 -6
- package/dist/esm/wallet/serviceWorker/wallet.js +8 -7
- package/dist/esm/wallet/signingErrors.js +27 -0
- package/dist/esm/wallet/unroll.js +12 -8
- package/dist/esm/wallet/utils.js +2 -2
- package/dist/esm/wallet/validation.js +2 -2
- package/dist/esm/wallet/vtxo-manager.js +9 -9
- package/dist/esm/wallet/wallet.js +262 -117
- package/dist/esm/wallet/walletReceiveRotator.js +540 -0
- package/dist/esm/worker/expo/index.js +4 -4
- package/dist/esm/worker/expo/processors/contractPollProcessor.js +1 -1
- package/dist/esm/worker/expo/processors/index.js +1 -1
- package/dist/esm/worker/expo/taskRunner.js +1 -1
- package/dist/esm/worker/messageBus.js +7 -6
- package/dist/types/adapters/asyncStorage.d.ts +2 -2
- package/dist/types/adapters/expo.d.ts +4 -4
- package/dist/types/adapters/fileSystem.d.ts +2 -2
- package/dist/types/adapters/indexedDB.d.ts +2 -2
- package/dist/types/adapters/localStorage.d.ts +2 -2
- package/dist/types/arkfee/index.d.ts +2 -2
- package/dist/types/arknote/index.d.ts +2 -2
- package/dist/types/bip322/index.d.ts +1 -1
- package/dist/types/contracts/arkcontract.d.ts +1 -1
- package/dist/types/contracts/contractManager.d.ts +39 -9
- package/dist/types/contracts/contractWatcher.d.ts +3 -3
- package/dist/types/contracts/handlers/default.d.ts +3 -3
- package/dist/types/contracts/handlers/delegate.d.ts +3 -3
- package/dist/types/contracts/handlers/helpers.d.ts +1 -1
- package/dist/types/contracts/handlers/index.d.ts +7 -7
- package/dist/types/contracts/handlers/registry.d.ts +1 -1
- package/dist/types/contracts/handlers/vhtlc.d.ts +3 -3
- package/dist/types/contracts/index.d.ts +14 -14
- package/dist/types/contracts/types.d.ts +21 -4
- package/dist/types/contracts/vtxoOwnership.d.ts +3 -3
- package/dist/types/extension/asset/assetGroup.d.ts +6 -6
- package/dist/types/extension/asset/assetId.d.ts +1 -1
- package/dist/types/extension/asset/assetInput.d.ts +2 -2
- package/dist/types/extension/asset/assetOutput.d.ts +1 -1
- package/dist/types/extension/asset/assetRef.d.ts +3 -3
- package/dist/types/extension/asset/index.d.ts +8 -8
- package/dist/types/extension/asset/metadata.d.ts +1 -1
- package/dist/types/extension/asset/packet.d.ts +2 -2
- package/dist/types/extension/index.d.ts +6 -6
- package/dist/types/forfeit.d.ts +1 -1
- package/dist/types/identity/descriptorProvider.d.ts +8 -1
- package/dist/types/identity/hdCapableIdentity.d.ts +33 -6
- package/dist/types/identity/index.d.ts +12 -11
- package/dist/types/identity/seedIdentity.d.ts +21 -5
- package/dist/types/identity/serialize.d.ts +1 -1
- package/dist/types/identity/singleKey.d.ts +3 -3
- package/dist/types/identity/staticDescriptorProvider.d.ts +3 -3
- package/dist/types/index.d.ts +59 -59
- package/dist/types/intent/index.d.ts +2 -2
- package/dist/types/musig2/index.d.ts +4 -4
- package/dist/types/providers/ark.d.ts +5 -5
- package/dist/types/providers/delegator.d.ts +2 -2
- package/dist/types/providers/electrum.d.ts +5 -5
- package/dist/types/providers/expoArk.d.ts +1 -1
- package/dist/types/providers/expoIndexer.d.ts +1 -1
- package/dist/types/providers/indexer.d.ts +1 -1
- package/dist/types/providers/onchain.d.ts +2 -2
- package/dist/types/repositories/contractRepository.d.ts +1 -1
- package/dist/types/repositories/inMemory/contractRepository.d.ts +2 -2
- package/dist/types/repositories/inMemory/walletRepository.d.ts +2 -2
- package/dist/types/repositories/index.d.ts +9 -9
- package/dist/types/repositories/indexedDB/contractRepository.d.ts +2 -2
- package/dist/types/repositories/indexedDB/db.d.ts +3 -3
- package/dist/types/repositories/indexedDB/walletRepository.d.ts +2 -2
- package/dist/types/repositories/migrations/contractRepositoryImpl.d.ts +3 -3
- package/dist/types/repositories/migrations/fromStorageAdapter.d.ts +2 -2
- package/dist/types/repositories/migrations/walletRepositoryImpl.d.ts +3 -3
- package/dist/types/repositories/realm/contractRepository.d.ts +3 -3
- package/dist/types/repositories/realm/index.d.ts +4 -4
- package/dist/types/repositories/realm/walletRepository.d.ts +3 -3
- package/dist/types/repositories/serialization.d.ts +11 -11
- package/dist/types/repositories/sqlite/contractRepository.d.ts +3 -3
- package/dist/types/repositories/sqlite/index.d.ts +3 -3
- package/dist/types/repositories/sqlite/walletRepository.d.ts +3 -3
- package/dist/types/repositories/walletRepository.d.ts +1 -1
- package/dist/types/script/address.d.ts +2 -2
- package/dist/types/script/base.d.ts +2 -2
- package/dist/types/script/default.d.ts +2 -2
- package/dist/types/script/delegate.d.ts +3 -3
- package/dist/types/script/vhtlc.d.ts +2 -2
- package/dist/types/storage/asyncStorage.d.ts +1 -1
- package/dist/types/storage/fileSystem.d.ts +1 -1
- package/dist/types/storage/inMemory.d.ts +1 -1
- package/dist/types/storage/indexedDB.d.ts +1 -1
- package/dist/types/storage/localStorage.d.ts +1 -1
- package/dist/types/tree/signingSession.d.ts +2 -2
- package/dist/types/tree/validation.d.ts +1 -1
- package/dist/types/utils/arkTransaction.d.ts +5 -5
- package/dist/types/utils/syncCursors.d.ts +1 -1
- package/dist/types/utils/timelock.d.ts +1 -1
- package/dist/types/utils/transaction.d.ts +2 -2
- package/dist/types/utils/transactionHistory.d.ts +1 -1
- package/dist/types/utils/txSizeEstimator.d.ts +1 -1
- package/dist/types/wallet/asset-manager.d.ts +3 -3
- package/dist/types/wallet/asset.d.ts +2 -2
- package/dist/types/wallet/batch.d.ts +2 -2
- package/dist/types/wallet/delegator.d.ts +5 -5
- package/dist/types/wallet/expo/background.d.ts +4 -4
- package/dist/types/wallet/expo/index.d.ts +4 -4
- package/dist/types/wallet/expo/wallet.d.ts +8 -8
- package/dist/types/wallet/hdDescriptorProvider.d.ts +26 -5
- package/dist/types/wallet/index.d.ts +63 -26
- package/dist/types/wallet/inputSignerRouter.d.ts +35 -0
- package/dist/types/wallet/onchain.d.ts +6 -6
- package/dist/types/wallet/ramps.d.ts +2 -2
- package/dist/types/wallet/serviceWorker/wallet-message-handler.d.ts +7 -7
- package/dist/types/wallet/serviceWorker/wallet.d.ts +20 -10
- package/dist/types/wallet/signingErrors.d.ts +19 -0
- package/dist/types/wallet/unroll.d.ts +6 -6
- package/dist/types/wallet/utils.d.ts +5 -5
- package/dist/types/wallet/validation.d.ts +3 -3
- package/dist/types/wallet/vtxo-manager.d.ts +2 -2
- package/dist/types/wallet/wallet.d.ts +71 -22
- package/dist/types/wallet/walletReceiveRotator.d.ts +306 -0
- package/dist/types/worker/expo/asyncStorageTaskQueue.d.ts +1 -1
- package/dist/types/worker/expo/index.d.ts +7 -7
- package/dist/types/worker/expo/processors/contractPollProcessor.d.ts +1 -1
- package/dist/types/worker/expo/processors/index.d.ts +1 -1
- package/dist/types/worker/expo/taskRunner.d.ts +7 -7
- package/dist/types/worker/messageBus.d.ts +7 -6
- package/package.json +2 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { hex } from "@scure/base";
|
|
2
|
-
import { ContractWatcher } from
|
|
3
|
-
import { contractHandlers } from
|
|
4
|
-
import { extendVirtualCoinForContract } from
|
|
5
|
-
import { advanceSyncCursor, computeSyncWindow, cursorCutoff, getSyncCursor, } from
|
|
6
|
-
import { getVtxosForContract, saveVtxosForContract, warnAndFilterVtxosForScript, } from
|
|
2
|
+
import { ContractWatcher } from "./contractWatcher.js";
|
|
3
|
+
import { contractHandlers } from "./handlers/index.js";
|
|
4
|
+
import { extendVirtualCoinForContract } from "../wallet/utils.js";
|
|
5
|
+
import { advanceSyncCursor, computeSyncWindow, cursorCutoff, getSyncCursor, } from "../utils/syncCursors.js";
|
|
6
|
+
import { getVtxosForContract, saveVtxosForContract, warnAndFilterVtxosForScript, } from "./vtxoOwnership.js";
|
|
7
7
|
const DEFAULT_PAGE_SIZE = 500;
|
|
8
8
|
/**
|
|
9
9
|
* Central manager for contract lifecycle and operations.
|
|
@@ -347,9 +347,22 @@ export class ContractManager {
|
|
|
347
347
|
/**
|
|
348
348
|
* Force refresh virtual outputs from the indexer.
|
|
349
349
|
*
|
|
350
|
-
* Without options, re-fetches every contract
|
|
351
|
-
*
|
|
352
|
-
*
|
|
350
|
+
* Without options, re-fetches every contract in the watcher's
|
|
351
|
+
* watched set and advances the global cursor.
|
|
352
|
+
*
|
|
353
|
+
* `scripts` narrows the refresh to a specific list (subset query —
|
|
354
|
+
* cursor is not advanced because contracts outside the list may
|
|
355
|
+
* have data we'd skip).
|
|
356
|
+
*
|
|
357
|
+
* `includeInactive: true` (and no `scripts`) widens the refresh to
|
|
358
|
+
* every contract in the repository, including ones marked
|
|
359
|
+
* `inactive` and ones that have dropped out of the watcher's
|
|
360
|
+
* active set. This is a *superset* of the watched set, so the
|
|
361
|
+
* cursor invariant still holds and the cursor advances normally.
|
|
362
|
+
*
|
|
363
|
+
* `after` / `before` apply a caller-supplied time window. The
|
|
364
|
+
* cursor never advances on a windowed query because the window
|
|
365
|
+
* may skip data outside its bounds.
|
|
353
366
|
*/
|
|
354
367
|
async refreshVtxos(opts) {
|
|
355
368
|
const contracts = opts?.scripts
|
|
@@ -365,6 +378,9 @@ export class ContractManager {
|
|
|
365
378
|
const hasExplicitWindow = opts?.after !== undefined || opts?.before !== undefined;
|
|
366
379
|
await this.syncContracts({
|
|
367
380
|
contracts,
|
|
381
|
+
// Scope-only widener; never set together with explicit
|
|
382
|
+
// `contracts` because `scripts` already names the exact set.
|
|
383
|
+
includeInactive: contracts ? false : opts?.includeInactive,
|
|
368
384
|
window: hasExplicitWindow
|
|
369
385
|
? { after: opts?.after, before: opts?.before }
|
|
370
386
|
: undefined,
|
|
@@ -469,17 +485,21 @@ export class ContractManager {
|
|
|
469
485
|
async syncContracts(options) {
|
|
470
486
|
const cursor = await getSyncCursor(this.config.walletRepository);
|
|
471
487
|
const window = options.window ?? computeSyncWindow(cursor);
|
|
472
|
-
// Advance the global cursor only on
|
|
473
|
-
//
|
|
474
|
-
//
|
|
475
|
-
//
|
|
476
|
-
//
|
|
477
|
-
//
|
|
478
|
-
//
|
|
488
|
+
// Advance the global cursor only on cursor-derived delta syncs
|
|
489
|
+
// whose contract scope covers at least the watcher's watched
|
|
490
|
+
// set. Targeted subset queries (caller-supplied `contracts`) and
|
|
491
|
+
// bounded-window queries must not move the cursor — they may
|
|
492
|
+
// skip data outside their bounds. `includeInactive` (with no
|
|
493
|
+
// `contracts`) widens the scope rather than narrowing it, so it
|
|
494
|
+
// is cursor-safe. `<=` lets the bootstrap case (cursor=0,
|
|
495
|
+
// window.after=0) write the migration marker on first boot.
|
|
479
496
|
const mustUpdateCursor = options.contracts === undefined &&
|
|
480
497
|
options.window === undefined &&
|
|
481
498
|
(window.after ?? 0) <= cursor;
|
|
482
|
-
const contracts = options.contracts ??
|
|
499
|
+
const contracts = options.contracts ??
|
|
500
|
+
(options.includeInactive
|
|
501
|
+
? await this.config.contractRepository.getContracts({})
|
|
502
|
+
: this.watcher.getWatchedContracts());
|
|
483
503
|
const requestStartedAt = Date.now();
|
|
484
504
|
const result = await this.fetchContractVxosFromIndexer(contracts, options.pageSize, window);
|
|
485
505
|
if (mustUpdateCursor) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { extendVirtualCoinForContract } from
|
|
2
|
-
import { isEventSourceError } from
|
|
3
|
-
import { getVtxosForContract } from
|
|
1
|
+
import { extendVirtualCoinForContract } from "../wallet/utils.js";
|
|
2
|
+
import { isEventSourceError } from "../providers/utils.js";
|
|
3
|
+
import { getVtxosForContract } from "./vtxoOwnership.js";
|
|
4
4
|
/**
|
|
5
5
|
* Watches multiple contracts for virtual output state changes with resilient connection handling.
|
|
6
6
|
*
|
|
@@ -563,8 +563,8 @@ export class ContractWatcher {
|
|
|
563
563
|
const extendedVtxo = extendVirtualCoinForContract(v, state.contract);
|
|
564
564
|
extended.push({ ...extendedVtxo, contractScript });
|
|
565
565
|
}
|
|
566
|
-
catch {
|
|
567
|
-
console.warn(
|
|
566
|
+
catch (err) {
|
|
567
|
+
console.warn(`failed to extend vtxo ${v.txid}:${v.vout}`, err);
|
|
568
568
|
extended.push({ ...v, contractScript });
|
|
569
569
|
}
|
|
570
570
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { hex } from "@scure/base";
|
|
2
|
-
import { DefaultVtxo } from
|
|
3
|
-
import { isCsvSpendable } from
|
|
4
|
-
import { sequenceToTimelock, timelockToSequence } from
|
|
5
|
-
import { normalizeToDescriptor, extractPubKey, } from
|
|
2
|
+
import { DefaultVtxo } from "../../script/default.js";
|
|
3
|
+
import { isCsvSpendable } from "./helpers.js";
|
|
4
|
+
import { sequenceToTimelock, timelockToSequence } from "../../utils/timelock.js";
|
|
5
|
+
import { normalizeToDescriptor, extractPubKey, } from "../../identity/descriptor.js";
|
|
6
6
|
/**
|
|
7
7
|
* Extract pubkey bytes from a descriptor or hex string.
|
|
8
8
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { hex } from "@scure/base";
|
|
2
|
-
import { DelegateVtxo } from
|
|
3
|
-
import { DefaultVtxo } from
|
|
4
|
-
import { isCsvSpendable } from
|
|
5
|
-
import { sequenceToTimelock, timelockToSequence } from
|
|
2
|
+
import { DelegateVtxo } from "../../script/delegate.js";
|
|
3
|
+
import { DefaultVtxo } from "../../script/default.js";
|
|
4
|
+
import { isCsvSpendable } from "./helpers.js";
|
|
5
|
+
import { sequenceToTimelock, timelockToSequence } from "../../utils/timelock.js";
|
|
6
6
|
/**
|
|
7
7
|
* Handler for delegate wallet virtual outputs.
|
|
8
8
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { sequenceToTimelock } from
|
|
2
|
-
import { isDescriptor, extractPubKey } from
|
|
1
|
+
import { sequenceToTimelock } from "../../utils/timelock.js";
|
|
2
|
+
import { isDescriptor, extractPubKey } from "../../identity/descriptor.js";
|
|
3
3
|
/**
|
|
4
4
|
* Extract raw hex pubkey from a value that may be a descriptor or raw hex.
|
|
5
5
|
* Returns undefined for HD descriptors or unparseable values so role
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { contractHandlers } from
|
|
2
|
-
export { DefaultContractHandler } from
|
|
3
|
-
export { DelegateContractHandler } from
|
|
4
|
-
export { VHTLCContractHandler } from
|
|
1
|
+
export { contractHandlers } from "./registry.js";
|
|
2
|
+
export { DefaultContractHandler } from "./default.js";
|
|
3
|
+
export { DelegateContractHandler } from "./delegate.js";
|
|
4
|
+
export { VHTLCContractHandler } from "./vhtlc.js";
|
|
5
5
|
// Register built-in handlers
|
|
6
|
-
import { contractHandlers } from
|
|
7
|
-
import { DefaultContractHandler } from
|
|
8
|
-
import { DelegateContractHandler } from
|
|
9
|
-
import { VHTLCContractHandler } from
|
|
6
|
+
import { contractHandlers } from "./registry.js";
|
|
7
|
+
import { DefaultContractHandler } from "./default.js";
|
|
8
|
+
import { DelegateContractHandler } from "./delegate.js";
|
|
9
|
+
import { VHTLCContractHandler } from "./vhtlc.js";
|
|
10
10
|
contractHandlers.register(DefaultContractHandler);
|
|
11
11
|
contractHandlers.register(DelegateContractHandler);
|
|
12
12
|
contractHandlers.register(VHTLCContractHandler);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { hex } from "@scure/base";
|
|
2
|
-
import { VHTLC } from
|
|
3
|
-
import { isCltvSatisfied, isCsvSpendable, resolveRole } from
|
|
4
|
-
import { sequenceToTimelock, timelockToSequence } from
|
|
2
|
+
import { VHTLC } from "../../script/vhtlc.js";
|
|
3
|
+
import { isCltvSatisfied, isCsvSpendable, resolveRole } from "./helpers.js";
|
|
4
|
+
import { sequenceToTimelock, timelockToSequence } from "../../utils/timelock.js";
|
|
5
5
|
/**
|
|
6
6
|
* Handler for Virtual Hash Time Lock Contract (VHTLC).
|
|
7
7
|
*
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// Types
|
|
2
|
-
export * from
|
|
2
|
+
export * from "./types.js";
|
|
3
3
|
// Contract handlers
|
|
4
|
-
export { contractHandlers } from
|
|
5
|
-
export { DefaultContractHandler } from
|
|
6
|
-
export { DelegateContractHandler } from
|
|
7
|
-
export { VHTLCContractHandler } from
|
|
4
|
+
export { contractHandlers } from "./handlers/index.js";
|
|
5
|
+
export { DefaultContractHandler } from "./handlers/index.js";
|
|
6
|
+
export { DelegateContractHandler } from "./handlers/index.js";
|
|
7
|
+
export { VHTLCContractHandler } from "./handlers/index.js";
|
|
8
8
|
// arkcontract string codec
|
|
9
|
-
export { encodeArkContract, decodeArkContract, contractFromArkContract, contractFromArkContractWithAddress, isArkContract, } from
|
|
9
|
+
export { encodeArkContract, decodeArkContract, contractFromArkContract, contractFromArkContractWithAddress, isArkContract, } from "./arkcontract.js";
|
|
10
10
|
// Contract watcher
|
|
11
|
-
export { ContractWatcher } from
|
|
11
|
+
export { ContractWatcher } from "./contractWatcher.js";
|
|
12
12
|
// Contract manager
|
|
13
|
-
export { ContractManager } from
|
|
13
|
+
export { ContractManager } from "./contractManager.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { hex } from "@scure/base";
|
|
2
|
-
import { AssetInputType, MASK_ASSET_ID, MASK_CONTROL_ASSET, MASK_METADATA, } from
|
|
3
|
-
import { AssetId } from
|
|
4
|
-
import { AssetRef } from
|
|
5
|
-
import { AssetInput, AssetInputs } from
|
|
6
|
-
import { AssetOutputs } from
|
|
7
|
-
import { MetadataList } from
|
|
8
|
-
import { BufferReader, BufferWriter } from
|
|
2
|
+
import { AssetInputType, MASK_ASSET_ID, MASK_CONTROL_ASSET, MASK_METADATA, } from "./types.js";
|
|
3
|
+
import { AssetId } from "./assetId.js";
|
|
4
|
+
import { AssetRef } from "./assetRef.js";
|
|
5
|
+
import { AssetInput, AssetInputs } from "./assetInput.js";
|
|
6
|
+
import { AssetOutputs } from "./assetOutput.js";
|
|
7
|
+
import { MetadataList } from "./metadata.js";
|
|
8
|
+
import { BufferReader, BufferWriter } from "./utils.js";
|
|
9
9
|
/**
|
|
10
10
|
* An asset group contains inputs, outputs, and all data related to a given asset id.
|
|
11
11
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { hex } from "@scure/base";
|
|
2
|
-
import { TX_HASH_SIZE, ASSET_ID_SIZE } from
|
|
3
|
-
import { BufferReader, BufferWriter, isZeroBytes } from
|
|
2
|
+
import { TX_HASH_SIZE, ASSET_ID_SIZE } from "./types.js";
|
|
3
|
+
import { BufferReader, BufferWriter, isZeroBytes } from "./utils.js";
|
|
4
4
|
/**
|
|
5
5
|
* AssetId identifies a specific asset.
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { hex } from "@scure/base";
|
|
2
|
-
import { AssetInputType, TX_HASH_SIZE } from
|
|
3
|
-
import { BufferReader, BufferWriter, isZeroBytes } from
|
|
2
|
+
import { AssetInputType, TX_HASH_SIZE } from "./types.js";
|
|
3
|
+
import { BufferReader, BufferWriter, isZeroBytes } from "./utils.js";
|
|
4
4
|
/**
|
|
5
5
|
* AssetInput represents an input of an asset group.
|
|
6
6
|
* a local input references a real transaction input and specify the amount in satoshis.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { hex } from "@scure/base";
|
|
2
|
-
import { BufferReader, BufferWriter } from
|
|
2
|
+
import { BufferReader, BufferWriter } from "./utils.js";
|
|
3
3
|
/**
|
|
4
4
|
* AssetOutput references a real transaction output and specify the amount in satoshis.
|
|
5
5
|
* it must be present in an AssetGroup.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { hex } from "@scure/base";
|
|
2
|
-
import { AssetRefType } from
|
|
3
|
-
import { AssetId } from
|
|
4
|
-
import { BufferReader, BufferWriter } from
|
|
2
|
+
import { AssetRefType } from "./types.js";
|
|
3
|
+
import { AssetId } from "./assetId.js";
|
|
4
|
+
import { BufferReader, BufferWriter } from "./utils.js";
|
|
5
5
|
/**
|
|
6
6
|
* Reference to either an explicit asset id or another asset group in the same packet.
|
|
7
7
|
*
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { AssetInputType, AssetRefType } from
|
|
2
|
-
export { AssetId } from
|
|
3
|
-
export { AssetRef } from
|
|
4
|
-
export { AssetInput, AssetInputs } from
|
|
5
|
-
export { AssetOutput, AssetOutputs } from
|
|
6
|
-
export { Metadata, MetadataList } from
|
|
7
|
-
export { AssetGroup } from
|
|
8
|
-
export { Packet } from
|
|
1
|
+
export { AssetInputType, AssetRefType } from "./types.js";
|
|
2
|
+
export { AssetId } from "./assetId.js";
|
|
3
|
+
export { AssetRef } from "./assetRef.js";
|
|
4
|
+
export { AssetInput, AssetInputs } from "./assetInput.js";
|
|
5
|
+
export { AssetOutput, AssetOutputs } from "./assetOutput.js";
|
|
6
|
+
export { Metadata, MetadataList } from "./metadata.js";
|
|
7
|
+
export { AssetGroup } from "./assetGroup.js";
|
|
8
|
+
export { Packet } from "./packet.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { schnorr } from "@noble/curves/secp256k1.js";
|
|
2
2
|
import { hex } from "@scure/base";
|
|
3
3
|
import { compareBytes } from "@scure/btc-signer/utils.js";
|
|
4
|
-
import { BufferReader, BufferWriter } from
|
|
4
|
+
import { BufferReader, BufferWriter } from "./utils.js";
|
|
5
5
|
/**
|
|
6
6
|
* Metadata represents a key-value pair.
|
|
7
7
|
* @param key - the key
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { hex } from "@scure/base";
|
|
2
|
-
import { AssetRefType } from
|
|
3
|
-
import { AssetGroup } from
|
|
4
|
-
import { BufferReader, BufferWriter } from
|
|
2
|
+
import { AssetRefType } from "./types.js";
|
|
3
|
+
import { AssetGroup } from "./assetGroup.js";
|
|
4
|
+
import { BufferReader, BufferWriter } from "./utils.js";
|
|
5
5
|
/**
|
|
6
6
|
* Packet represents a collection of asset groups.
|
|
7
7
|
* It encodes/decodes as raw bytes only — OP_RETURN framing is handled by the Extension module.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { hex } from "@scure/base";
|
|
2
2
|
import { Script } from "@scure/btc-signer";
|
|
3
3
|
import { equalBytes } from "@scure/btc-signer/utils.js";
|
|
4
|
-
import { Packet } from
|
|
5
|
-
import { BufferReader } from
|
|
6
|
-
import { UnknownPacket } from
|
|
7
|
-
export { UnknownPacket } from
|
|
4
|
+
import { Packet } from "./asset/packet.js";
|
|
5
|
+
import { BufferReader } from "./asset/utils.js";
|
|
6
|
+
import { UnknownPacket } from "./packet.js";
|
|
7
|
+
export { UnknownPacket } from "./packet.js";
|
|
8
8
|
/**
|
|
9
9
|
* ArkadeMagic is the 3-byte magic prefix ("ARK") that identifies an OP_RETURN
|
|
10
10
|
* output as an Arkade extension blob.
|
package/dist/esm/forfeit.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Transaction } from
|
|
2
|
-
import { P2A } from
|
|
1
|
+
import { Transaction } from "./utils/transaction.js";
|
|
2
|
+
import { P2A } from "./utils/anchor.js";
|
|
3
3
|
/**
|
|
4
4
|
* Build a forfeit transaction that spends the provided inputs to a single forfeit output.
|
|
5
5
|
*
|
|
@@ -1 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Structural type guard for {@link HDCapableIdentity}. Returns `true`
|
|
3
|
+
* when the value exposes the four members the HD wallet flow relies on:
|
|
4
|
+
* `descriptor`, `isOurs`, `signWithDescriptor`, and
|
|
5
|
+
* `signMessageWithDescriptor`. Used by callers that need to opt into
|
|
6
|
+
* the HD path (e.g. installing an `HDDescriptorProvider`) without
|
|
7
|
+
* coupling to a concrete identity class.
|
|
8
|
+
*/
|
|
9
|
+
export function isHDCapableIdentity(value) {
|
|
10
|
+
if (typeof value !== "object" || value === null)
|
|
11
|
+
return false;
|
|
12
|
+
const v = value;
|
|
13
|
+
return (typeof v.descriptor === "string" &&
|
|
14
|
+
typeof v.isOurs === "function" &&
|
|
15
|
+
typeof v.signWithDescriptor === "function" &&
|
|
16
|
+
typeof v.signMessageWithDescriptor === "function");
|
|
17
|
+
}
|
|
@@ -3,10 +3,11 @@ export function isBatchSignable(identity) {
|
|
|
3
3
|
return ("signMultiple" in identity &&
|
|
4
4
|
typeof identity.signMultiple === "function");
|
|
5
5
|
}
|
|
6
|
-
export * from
|
|
7
|
-
export { SeedIdentity, MnemonicIdentity, ReadonlyDescriptorIdentity, } from
|
|
8
|
-
export * from
|
|
6
|
+
export * from "./singleKey.js";
|
|
7
|
+
export { SeedIdentity, MnemonicIdentity, ReadonlyDescriptorIdentity, } from "./seedIdentity.js";
|
|
8
|
+
export * from "./serialize.js";
|
|
9
9
|
// Descriptor utilities
|
|
10
|
-
export { isDescriptor, normalizeToDescriptor, extractPubKey, parseHDDescriptor, } from
|
|
10
|
+
export { isDescriptor, normalizeToDescriptor, extractPubKey, parseHDDescriptor, } from "./descriptor.js";
|
|
11
|
+
export { isHDCapableIdentity } from "./hdCapableIdentity.js";
|
|
11
12
|
// Static descriptor provider (wrapper for legacy Identity)
|
|
12
|
-
export { StaticDescriptorProvider } from
|
|
13
|
+
export { StaticDescriptorProvider } from "./staticDescriptorProvider.js";
|
|
@@ -3,10 +3,10 @@ import { wordlist } from "@scure/bip39/wordlists/english.js";
|
|
|
3
3
|
import { pubECDSA, pubSchnorr } from "@scure/btc-signer/utils.js";
|
|
4
4
|
import { SigHash } from "@scure/btc-signer";
|
|
5
5
|
import { hex } from "@scure/base";
|
|
6
|
-
import { TreeSignerSession } from
|
|
6
|
+
import { TreeSignerSession } from "../tree/signingSession.js";
|
|
7
7
|
import { schnorr, signAsync } from "@noble/secp256k1";
|
|
8
8
|
import { HDKey, expand, networks, scriptExpressions, } from "@bitcoinerlab/descriptors-scure";
|
|
9
|
-
import { descriptorIsOurs, isMainnetDescriptor } from
|
|
9
|
+
import { descriptorIsOurs, isMainnetDescriptor } from "./descriptor.js";
|
|
10
10
|
const ALL_SIGHASH = Object.values(SigHash).filter((x) => typeof x === "number");
|
|
11
11
|
/**
|
|
12
12
|
* Secret-bearing state for seed-backed identities, held off the public
|
|
@@ -180,6 +180,10 @@ export class SeedIdentity {
|
|
|
180
180
|
* Returns true when `descriptor` is derived from this identity's seed.
|
|
181
181
|
* HD descriptors match by account xpub; bare `tr(pubkey)` descriptors
|
|
182
182
|
* match by raw pubkey. See {@link descriptorIsOurs}.
|
|
183
|
+
*
|
|
184
|
+
* @deprecated Prefer `DescriptorProvider.isOurs()` via
|
|
185
|
+
* `HDDescriptorProvider` for rotating HD wallets or
|
|
186
|
+
* `StaticDescriptorProvider` for legacy single-key wallets.
|
|
183
187
|
*/
|
|
184
188
|
isOurs(descriptor) {
|
|
185
189
|
return descriptorIsOurs(descriptor, this.descriptor, pubSchnorr(this.derivedKey));
|
|
@@ -187,6 +191,10 @@ export class SeedIdentity {
|
|
|
187
191
|
/**
|
|
188
192
|
* Signs each request with the key derived from its descriptor.
|
|
189
193
|
* Each descriptor must share this identity's seed ({@link isOurs}).
|
|
194
|
+
*
|
|
195
|
+
* @deprecated Prefer `DescriptorProvider.signWithDescriptor()` via
|
|
196
|
+
* `HDDescriptorProvider` or `StaticDescriptorProvider`. Identities keep
|
|
197
|
+
* this method only as backing implementation for descriptor providers.
|
|
190
198
|
*/
|
|
191
199
|
async signWithDescriptor(requests) {
|
|
192
200
|
return requests.map((request) => {
|
|
@@ -199,6 +207,10 @@ export class SeedIdentity {
|
|
|
199
207
|
}
|
|
200
208
|
/**
|
|
201
209
|
* Signs a message with the key derived from `descriptor`.
|
|
210
|
+
*
|
|
211
|
+
* @deprecated Prefer `DescriptorProvider.signMessageWithDescriptor()` via
|
|
212
|
+
* `HDDescriptorProvider` or `StaticDescriptorProvider`. Identities keep
|
|
213
|
+
* this method only as backing implementation for descriptor providers.
|
|
202
214
|
*/
|
|
203
215
|
async signMessageWithDescriptor(descriptor, message, signatureType = "schnorr") {
|
|
204
216
|
if (!this.isOurs(descriptor)) {
|
|
@@ -379,6 +391,10 @@ export class ReadonlyDescriptorIdentity {
|
|
|
379
391
|
* HD descriptors match by account xpub; bare `tr(pubkey)` descriptors
|
|
380
392
|
* fall back to comparing against the index-0 x-only pubkey. See
|
|
381
393
|
* {@link descriptorIsOurs}.
|
|
394
|
+
*
|
|
395
|
+
* @deprecated Prefer `DescriptorProvider.isOurs()` via
|
|
396
|
+
* `HDDescriptorProvider` for rotating HD wallets or
|
|
397
|
+
* `StaticDescriptorProvider` for legacy single-key wallets.
|
|
382
398
|
*/
|
|
383
399
|
isOurs(descriptor) {
|
|
384
400
|
return descriptorIsOurs(descriptor, this.descriptor, this.indexZero.pubkey);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { hex } from "@scure/base";
|
|
2
|
-
import { SingleKey, ReadonlySingleKey } from
|
|
3
|
-
import { SeedIdentity, MnemonicIdentity, ReadonlyDescriptorIdentity, serializeSeedOwnedSigningIdentity, serializeSeedOwnedReadonlyIdentity, } from
|
|
2
|
+
import { SingleKey, ReadonlySingleKey } from "./singleKey.js";
|
|
3
|
+
import { SeedIdentity, MnemonicIdentity, ReadonlyDescriptorIdentity, serializeSeedOwnedSigningIdentity, serializeSeedOwnedReadonlyIdentity, } from "./seedIdentity.js";
|
|
4
4
|
/** Type guard — true for signing envelopes, false for readonly envelopes. */
|
|
5
5
|
export function isSigningSerialized(s) {
|
|
6
6
|
return (s.type === "single-key" || s.type === "seed" || s.type === "mnemonic");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { pubECDSA, pubSchnorr, randomPrivateKeyBytes, } from "@scure/btc-signer/utils.js";
|
|
2
2
|
import { SigHash } from "@scure/btc-signer";
|
|
3
3
|
import { hex } from "@scure/base";
|
|
4
|
-
import { TreeSignerSession } from
|
|
4
|
+
import { TreeSignerSession } from "../tree/signingSession.js";
|
|
5
5
|
import { schnorr, signAsync } from "@noble/secp256k1";
|
|
6
6
|
const ALL_SIGHASH = Object.values(SigHash).filter((x) => typeof x === "number");
|
|
7
7
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { hex } from "@scure/base";
|
|
2
|
-
import { isBatchSignable } from
|
|
3
|
-
import { normalizeToDescriptor, extractPubKey } from
|
|
2
|
+
import { isBatchSignable } from "./index.js";
|
|
3
|
+
import { normalizeToDescriptor, extractPubKey } from "./descriptor.js";
|
|
4
4
|
/**
|
|
5
5
|
* Wraps a legacy Identity (single-key) as a DescriptorProvider.
|
|
6
6
|
* The descriptor is always a simple tr(pubkey) format.
|
package/dist/esm/index.js
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import { Transaction } from
|
|
2
|
-
import { SingleKey, ReadonlySingleKey } from
|
|
3
|
-
import { SeedIdentity, MnemonicIdentity, ReadonlyDescriptorIdentity, } from
|
|
4
|
-
import { isBatchSignable, } from
|
|
5
|
-
import { ArkAddress } from
|
|
6
|
-
import { VHTLC } from
|
|
7
|
-
import { DefaultVtxo } from
|
|
8
|
-
import { DelegateVtxo } from
|
|
9
|
-
import { MessageBus, } from
|
|
10
|
-
import { VtxoScript, TapTreeCoder, getSequence, } from
|
|
11
|
-
import { TxType, isSpendable, isSubdust, isRecoverable, isExpired, } from
|
|
12
|
-
import { Batch } from
|
|
13
|
-
import { Wallet, ReadonlyWallet, waitForIncomingFunds, } from
|
|
14
|
-
import { TxTree } from
|
|
15
|
-
import { Ramps } from
|
|
16
|
-
import { HDDescriptorProvider } from
|
|
17
|
-
import { isVtxoExpiringSoon, VtxoManager } from
|
|
18
|
-
import { ServiceWorkerWallet, ServiceWorkerReadonlyWallet, DEFAULT_MESSAGE_TIMEOUTS, } from
|
|
19
|
-
import { OnchainWallet } from
|
|
20
|
-
import { setupServiceWorker } from
|
|
21
|
-
import { ESPLORA_URL, EsploraProvider, } from
|
|
22
|
-
import { ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, ElectrumOnchainProvider, WsElectrumChainSource, } from
|
|
23
|
-
import { RestArkProvider, SettlementEventType, } from
|
|
24
|
-
import { RestDelegatorProvider, } from
|
|
25
|
-
import { CLTVMultisigTapscript, ConditionCSVMultisigTapscript, ConditionMultisigTapscript, CSVMultisigTapscript, decodeTapscript, MultisigTapscript, } from
|
|
26
|
-
import { hasBoardingTxExpired, buildOffchainTx, verifyTapscriptSignatures, combineTapscriptSigs, isValidArkAddress, } from
|
|
27
|
-
import { VtxoTaprootTree, ConditionWitness, getArkPsbtFields, setArkPsbtField, ArkPsbtFieldKey, ArkPsbtFieldKeyType, CosignerPublicKey, VtxoTreeExpiry, } from
|
|
28
|
-
import { Intent } from
|
|
29
|
-
import { BIP322 } from
|
|
30
|
-
import { ArkNote } from
|
|
31
|
-
import { networks } from
|
|
32
|
-
import { RestIndexerProvider, IndexerTxType, ChainTxType, } from
|
|
33
|
-
import { P2A } from
|
|
34
|
-
import { TxWeightEstimator } from
|
|
35
|
-
import { Unroll } from
|
|
36
|
-
import { ArkError, maybeArkError } from
|
|
37
|
-
import { validateVtxoTxGraph, validateConnectorsTxGraph, } from
|
|
38
|
-
import { buildForfeitTx } from
|
|
39
|
-
import { IndexedDBWalletRepository, IndexedDBContractRepository, InMemoryWalletRepository, InMemoryContractRepository, MIGRATION_KEY, migrateWalletRepository, requiresMigration, getMigrationStatus, rollbackMigration, WalletRepositoryImpl, ContractRepositoryImpl, } from
|
|
40
|
-
import { DelegatorManagerImpl } from
|
|
41
|
-
export * from
|
|
42
|
-
export * as asset from
|
|
1
|
+
import { Transaction } from "./utils/transaction.js";
|
|
2
|
+
import { SingleKey, ReadonlySingleKey } from "./identity/singleKey.js";
|
|
3
|
+
import { SeedIdentity, MnemonicIdentity, ReadonlyDescriptorIdentity, } from "./identity/seedIdentity.js";
|
|
4
|
+
import { isBatchSignable, } from "./identity/index.js";
|
|
5
|
+
import { ArkAddress } from "./script/address.js";
|
|
6
|
+
import { VHTLC } from "./script/vhtlc.js";
|
|
7
|
+
import { DefaultVtxo } from "./script/default.js";
|
|
8
|
+
import { DelegateVtxo } from "./script/delegate.js";
|
|
9
|
+
import { MessageBus, } from "./worker/messageBus.js";
|
|
10
|
+
import { VtxoScript, TapTreeCoder, getSequence, } from "./script/base.js";
|
|
11
|
+
import { TxType, isSpendable, isSubdust, isRecoverable, isExpired, } from "./wallet/index.js";
|
|
12
|
+
import { Batch } from "./wallet/batch.js";
|
|
13
|
+
import { Wallet, ReadonlyWallet, waitForIncomingFunds, DescriptorSigningProviderMissingError, MissingSigningDescriptorError, } from "./wallet/wallet.js";
|
|
14
|
+
import { TxTree } from "./tree/txTree.js";
|
|
15
|
+
import { Ramps } from "./wallet/ramps.js";
|
|
16
|
+
import { HDDescriptorProvider } from "./wallet/hdDescriptorProvider.js";
|
|
17
|
+
import { isVtxoExpiringSoon, VtxoManager } from "./wallet/vtxo-manager.js";
|
|
18
|
+
import { ServiceWorkerWallet, ServiceWorkerReadonlyWallet, DEFAULT_MESSAGE_TIMEOUTS, } from "./wallet/serviceWorker/wallet.js";
|
|
19
|
+
import { OnchainWallet } from "./wallet/onchain.js";
|
|
20
|
+
import { setupServiceWorker } from "./worker/browser/utils.js";
|
|
21
|
+
import { ESPLORA_URL, EsploraProvider, } from "./providers/onchain.js";
|
|
22
|
+
import { ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, ElectrumOnchainProvider, WsElectrumChainSource, } from "./providers/electrum.js";
|
|
23
|
+
import { RestArkProvider, SettlementEventType, } from "./providers/ark.js";
|
|
24
|
+
import { RestDelegatorProvider, } from "./providers/delegator.js";
|
|
25
|
+
import { CLTVMultisigTapscript, ConditionCSVMultisigTapscript, ConditionMultisigTapscript, CSVMultisigTapscript, decodeTapscript, MultisigTapscript, } from "./script/tapscript.js";
|
|
26
|
+
import { hasBoardingTxExpired, buildOffchainTx, verifyTapscriptSignatures, combineTapscriptSigs, isValidArkAddress, } from "./utils/arkTransaction.js";
|
|
27
|
+
import { VtxoTaprootTree, ConditionWitness, getArkPsbtFields, setArkPsbtField, ArkPsbtFieldKey, ArkPsbtFieldKeyType, CosignerPublicKey, VtxoTreeExpiry, } from "./utils/unknownFields.js";
|
|
28
|
+
import { Intent } from "./intent/index.js";
|
|
29
|
+
import { BIP322 } from "./bip322/index.js";
|
|
30
|
+
import { ArkNote } from "./arknote/index.js";
|
|
31
|
+
import { networks } from "./networks.js";
|
|
32
|
+
import { RestIndexerProvider, IndexerTxType, ChainTxType, } from "./providers/indexer.js";
|
|
33
|
+
import { P2A } from "./utils/anchor.js";
|
|
34
|
+
import { TxWeightEstimator } from "./utils/txSizeEstimator.js";
|
|
35
|
+
import { Unroll } from "./wallet/unroll.js";
|
|
36
|
+
import { ArkError, maybeArkError } from "./providers/errors.js";
|
|
37
|
+
import { validateVtxoTxGraph, validateConnectorsTxGraph, } from "./tree/validation.js";
|
|
38
|
+
import { buildForfeitTx } from "./forfeit.js";
|
|
39
|
+
import { IndexedDBWalletRepository, IndexedDBContractRepository, InMemoryWalletRepository, InMemoryContractRepository, MIGRATION_KEY, migrateWalletRepository, requiresMigration, getMigrationStatus, rollbackMigration, WalletRepositoryImpl, ContractRepositoryImpl, } from "./repositories/index.js";
|
|
40
|
+
import { DelegatorManagerImpl } from "./wallet/delegator.js";
|
|
41
|
+
export * from "./arkfee/index.js";
|
|
42
|
+
export * as asset from "./extension/asset/index.js";
|
|
43
43
|
// Contracts
|
|
44
|
-
import { ContractManager, ContractWatcher, contractHandlers, DefaultContractHandler, DelegateContractHandler, VHTLCContractHandler, encodeArkContract, decodeArkContract, contractFromArkContract, contractFromArkContractWithAddress, isArkContract, } from
|
|
45
|
-
import { timelockToSequence, sequenceToTimelock } from
|
|
46
|
-
import { closeDatabase, openDatabase } from
|
|
47
|
-
import { WalletMessageHandler, WalletNotInitializedError, ReadonlyWalletError, DelegatorNotConfiguredError, } from
|
|
48
|
-
import { MESSAGE_BUS_NOT_INITIALIZED, MessageBusNotInitializedError, ServiceWorkerTimeoutError, } from
|
|
44
|
+
import { ContractManager, ContractWatcher, contractHandlers, DefaultContractHandler, DelegateContractHandler, VHTLCContractHandler, encodeArkContract, decodeArkContract, contractFromArkContract, contractFromArkContractWithAddress, isArkContract, } from "./contracts/index.js";
|
|
45
|
+
import { timelockToSequence, sequenceToTimelock } from "./utils/timelock.js";
|
|
46
|
+
import { closeDatabase, openDatabase } from "./repositories/indexedDB/manager.js";
|
|
47
|
+
import { WalletMessageHandler, WalletNotInitializedError, ReadonlyWalletError, DelegatorNotConfiguredError, } from "./wallet/serviceWorker/wallet-message-handler.js";
|
|
48
|
+
import { MESSAGE_BUS_NOT_INITIALIZED, MessageBusNotInitializedError, ServiceWorkerTimeoutError, } from "./worker/errors.js";
|
|
49
49
|
export {
|
|
50
50
|
// Wallets
|
|
51
51
|
Wallet, ReadonlyWallet, SingleKey, ReadonlySingleKey, SeedIdentity, MnemonicIdentity, ReadonlyDescriptorIdentity, isBatchSignable, OnchainWallet, Ramps, VtxoManager, HDDescriptorProvider, DelegatorManagerImpl, RestDelegatorProvider,
|
|
@@ -80,7 +80,7 @@ TxTree,
|
|
|
80
80
|
// Anchor
|
|
81
81
|
P2A, Unroll, Transaction, TxWeightEstimator, timelockToSequence, sequenceToTimelock,
|
|
82
82
|
// Errors
|
|
83
|
-
ArkError, maybeArkError,
|
|
83
|
+
ArkError, maybeArkError, DescriptorSigningProviderMissingError, MissingSigningDescriptorError,
|
|
84
84
|
// Batch session
|
|
85
85
|
Batch, validateVtxoTxGraph, validateConnectorsTxGraph, buildForfeitTx, isRecoverable, isSpendable, isSubdust, isExpired, getSequence,
|
|
86
86
|
// Contracts
|
package/dist/esm/intent/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { OP, Script, SigHash } from "@scure/btc-signer";
|
|
2
2
|
import { schnorr } from "@noble/curves/secp256k1.js";
|
|
3
|
-
import { Transaction } from
|
|
4
|
-
import { ConditionWitness, VtxoTaprootTree } from
|
|
3
|
+
import { Transaction } from "../utils/transaction.js";
|
|
4
|
+
import { ConditionWitness, VtxoTaprootTree } from "../utils/unknownFields.js";
|
|
5
5
|
import { hex } from "@scure/base";
|
|
6
|
-
import { getSequence, VtxoScript } from
|
|
6
|
+
import { getSequence, VtxoScript } from "../script/base.js";
|
|
7
7
|
/**
|
|
8
8
|
* Intent proof implementation for Bitcoin message signing.
|
|
9
9
|
*
|
package/dist/esm/musig2/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { generateNonces, aggregateNonces } from
|
|
2
|
-
export { PartialSig, sign } from
|
|
3
|
-
export { aggregateKeys } from
|
|
1
|
+
export { generateNonces, aggregateNonces } from "./nonces.js";
|
|
2
|
+
export { PartialSig, sign } from "./sign.js";
|
|
3
|
+
export { aggregateKeys } from "./keys.js";
|
package/dist/esm/musig2/sign.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as musig from "@scure/btc-signer/musig2.js";
|
|
2
2
|
import { bytesToNumberBE } from "@noble/curves/utils.js";
|
|
3
3
|
import { Point } from "@noble/secp256k1";
|
|
4
|
-
import { aggregateKeys } from
|
|
4
|
+
import { aggregateKeys } from "./keys.js";
|
|
5
5
|
import { schnorr } from "@noble/curves/secp256k1.js";
|
|
6
6
|
// Add this error type for decode failures
|
|
7
7
|
export class PartialSignatureError extends Error {
|