@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,13 +1,30 @@
|
|
|
1
|
-
import { IndexerProvider } from "../providers/indexer";
|
|
2
|
-
import { WalletRepository } from "../repositories/walletRepository";
|
|
3
|
-
import { Contract, ContractEventCallback, ContractState, ContractWithVtxos, GetContractsFilter, PathSelection } from "./types";
|
|
4
|
-
import { ContractWatcherConfig } from "./contractWatcher";
|
|
5
|
-
import { ExtendedVirtualCoin, Outpoint, VirtualCoin } from "../wallet";
|
|
6
|
-
import { ContractRepository } from "../repositories";
|
|
1
|
+
import { IndexerProvider } from "../providers/indexer.js";
|
|
2
|
+
import { WalletRepository } from "../repositories/walletRepository.js";
|
|
3
|
+
import { Contract, ContractEventCallback, ContractState, ContractWithVtxos, GetContractsFilter, PathSelection } from "./types.js";
|
|
4
|
+
import { ContractWatcherConfig } from "./contractWatcher.js";
|
|
5
|
+
import { ExtendedVirtualCoin, Outpoint, VirtualCoin } from "../wallet/index.js";
|
|
6
|
+
import { ContractRepository } from "../repositories/index.js";
|
|
7
7
|
export type RefreshVtxosOptions = {
|
|
8
8
|
scripts?: string[];
|
|
9
9
|
after?: number;
|
|
10
10
|
before?: number;
|
|
11
|
+
/**
|
|
12
|
+
* When true and `scripts` is not set, refresh every contract in
|
|
13
|
+
* the repository — including those marked `inactive` and those
|
|
14
|
+
* that have dropped out of the watcher's active set. Useful for
|
|
15
|
+
* "did anyone send funds to a stale rotated display address?"
|
|
16
|
+
* audits.
|
|
17
|
+
*
|
|
18
|
+
* Because this is a *superset* of the watcher's watched set, the
|
|
19
|
+
* cursor invariant still holds and the cursor advances normally
|
|
20
|
+
* (unless an explicit `after` / `before` window is also supplied).
|
|
21
|
+
*
|
|
22
|
+
* Ignored when `scripts` is set (the explicit list already
|
|
23
|
+
* specifies what to refresh, regardless of contract state).
|
|
24
|
+
*
|
|
25
|
+
* @defaultValue `false`
|
|
26
|
+
*/
|
|
27
|
+
includeInactive?: boolean;
|
|
11
28
|
};
|
|
12
29
|
export interface IContractManager extends Disposable {
|
|
13
30
|
/**
|
|
@@ -320,9 +337,22 @@ export declare class ContractManager implements IContractManager {
|
|
|
320
337
|
/**
|
|
321
338
|
* Force refresh virtual outputs from the indexer.
|
|
322
339
|
*
|
|
323
|
-
* Without options, re-fetches every contract
|
|
324
|
-
*
|
|
325
|
-
*
|
|
340
|
+
* Without options, re-fetches every contract in the watcher's
|
|
341
|
+
* watched set and advances the global cursor.
|
|
342
|
+
*
|
|
343
|
+
* `scripts` narrows the refresh to a specific list (subset query —
|
|
344
|
+
* cursor is not advanced because contracts outside the list may
|
|
345
|
+
* have data we'd skip).
|
|
346
|
+
*
|
|
347
|
+
* `includeInactive: true` (and no `scripts`) widens the refresh to
|
|
348
|
+
* every contract in the repository, including ones marked
|
|
349
|
+
* `inactive` and ones that have dropped out of the watcher's
|
|
350
|
+
* active set. This is a *superset* of the watched set, so the
|
|
351
|
+
* cursor invariant still holds and the cursor advances normally.
|
|
352
|
+
*
|
|
353
|
+
* `after` / `before` apply a caller-supplied time window. The
|
|
354
|
+
* cursor never advances on a windowed query because the window
|
|
355
|
+
* may skip data outside its bounds.
|
|
326
356
|
*/
|
|
327
357
|
refreshVtxos(opts?: RefreshVtxosOptions): Promise<void>;
|
|
328
358
|
refreshOutpoints(outpoints: Outpoint[]): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IndexerProvider } from "../providers/indexer";
|
|
2
|
-
import { WalletRepository } from "../repositories/walletRepository";
|
|
3
|
-
import { Contract, ContractEventCallback } from "./types";
|
|
1
|
+
import { IndexerProvider } from "../providers/indexer.js";
|
|
2
|
+
import { WalletRepository } from "../repositories/walletRepository.js";
|
|
3
|
+
import { Contract, ContractEventCallback } from "./types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Configuration for the ContractWatcher.
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DefaultVtxo } from "../../script/default";
|
|
2
|
-
import { RelativeTimelock } from "../../script/tapscript";
|
|
3
|
-
import { ContractHandler } from "../types";
|
|
1
|
+
import { DefaultVtxo } from "../../script/default.js";
|
|
2
|
+
import { RelativeTimelock } from "../../script/tapscript.js";
|
|
3
|
+
import { ContractHandler } from "../types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Typed parameters for DefaultVtxo contracts.
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DelegateVtxo } from "../../script/delegate";
|
|
2
|
-
import { RelativeTimelock } from "../../script/tapscript";
|
|
3
|
-
import { ContractHandler } from "../types";
|
|
1
|
+
import { DelegateVtxo } from "../../script/delegate.js";
|
|
2
|
+
import { RelativeTimelock } from "../../script/tapscript.js";
|
|
3
|
+
import { ContractHandler } from "../types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Typed parameters for DelegateVtxo contracts.
|
|
6
6
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { contractHandlers } from "./registry";
|
|
2
|
-
export { DefaultContractHandler } from "./default";
|
|
3
|
-
export type { DefaultContractParams } from "./default";
|
|
4
|
-
export { DelegateContractHandler } from "./delegate";
|
|
5
|
-
export type { DelegateContractParams } from "./delegate";
|
|
6
|
-
export { VHTLCContractHandler } from "./vhtlc";
|
|
7
|
-
export type { VHTLCContractParams } from "./vhtlc";
|
|
1
|
+
export { contractHandlers } from "./registry.js";
|
|
2
|
+
export { DefaultContractHandler } from "./default.js";
|
|
3
|
+
export type { DefaultContractParams } from "./default.js";
|
|
4
|
+
export { DelegateContractHandler } from "./delegate.js";
|
|
5
|
+
export type { DelegateContractParams } from "./delegate.js";
|
|
6
|
+
export { VHTLCContractHandler } from "./vhtlc.js";
|
|
7
|
+
export type { VHTLCContractParams } from "./vhtlc.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { VHTLC } from "../../script/vhtlc";
|
|
2
|
-
import { RelativeTimelock } from "../../script/tapscript";
|
|
3
|
-
import { ContractHandler } from "../types";
|
|
1
|
+
import { VHTLC } from "../../script/vhtlc.js";
|
|
2
|
+
import { RelativeTimelock } from "../../script/tapscript.js";
|
|
3
|
+
import { ContractHandler } from "../types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Typed parameters for VHTLC contracts.
|
|
6
6
|
*/
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export * from "./types";
|
|
2
|
-
export { contractHandlers } from "./handlers";
|
|
3
|
-
export { DefaultContractHandler } from "./handlers";
|
|
4
|
-
export type { DefaultContractParams } from "./handlers";
|
|
5
|
-
export { DelegateContractHandler } from "./handlers";
|
|
6
|
-
export type { DelegateContractParams } from "./handlers";
|
|
7
|
-
export { VHTLCContractHandler } from "./handlers";
|
|
8
|
-
export type { VHTLCContractParams } from "./handlers";
|
|
9
|
-
export { encodeArkContract, decodeArkContract, contractFromArkContract, contractFromArkContractWithAddress, isArkContract, } from "./arkcontract";
|
|
10
|
-
export type { ParsedArkContract } from "./arkcontract";
|
|
11
|
-
export { ContractWatcher } from "./contractWatcher";
|
|
12
|
-
export type { ContractWatcherConfig } from "./contractWatcher";
|
|
13
|
-
export { ContractManager } from "./contractManager";
|
|
14
|
-
export type { ContractManagerConfig, CreateContractParams, RefreshVtxosOptions, } from "./contractManager";
|
|
1
|
+
export * from "./types.js";
|
|
2
|
+
export { contractHandlers } from "./handlers/index.js";
|
|
3
|
+
export { DefaultContractHandler } from "./handlers/index.js";
|
|
4
|
+
export type { DefaultContractParams } from "./handlers/index.js";
|
|
5
|
+
export { DelegateContractHandler } from "./handlers/index.js";
|
|
6
|
+
export type { DelegateContractParams } from "./handlers/index.js";
|
|
7
|
+
export { VHTLCContractHandler } from "./handlers/index.js";
|
|
8
|
+
export type { VHTLCContractParams } from "./handlers/index.js";
|
|
9
|
+
export { encodeArkContract, decodeArkContract, contractFromArkContract, contractFromArkContractWithAddress, isArkContract, } from "./arkcontract.js";
|
|
10
|
+
export type { ParsedArkContract } from "./arkcontract.js";
|
|
11
|
+
export { ContractWatcher } from "./contractWatcher.js";
|
|
12
|
+
export type { ContractWatcherConfig } from "./contractWatcher.js";
|
|
13
|
+
export { ContractManager } from "./contractManager.js";
|
|
14
|
+
export type { ContractManagerConfig, CreateContractParams, RefreshVtxosOptions, } from "./contractManager.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Bytes } from "@scure/btc-signer/utils.js";
|
|
2
|
-
import { EncodedVtxoScript, TapLeafScript, VtxoScript } from "../script/base";
|
|
3
|
-
import { VirtualCoin, TapLeaves } from "../wallet";
|
|
4
|
-
import { ContractFilter } from "../repositories";
|
|
2
|
+
import { EncodedVtxoScript, TapLeafScript, VtxoScript } from "../script/base.js";
|
|
3
|
+
import { ExtendedVirtualCoin, VirtualCoin, TapLeaves } from "../wallet/index.js";
|
|
4
|
+
import { ContractFilter } from "../repositories/index.js";
|
|
5
5
|
/**
|
|
6
6
|
* Contract state indicating whether it should be actively monitored.
|
|
7
7
|
*/
|
|
@@ -70,6 +70,23 @@ export type ContractVtxo = VirtualCoin & Partial<TapLeaves & EncodedVtxoScript>
|
|
|
70
70
|
extraWitness?: Bytes[];
|
|
71
71
|
contractScript: string;
|
|
72
72
|
};
|
|
73
|
+
/**
|
|
74
|
+
* A {@link ContractVtxo} with all taproot annotation fields required.
|
|
75
|
+
*
|
|
76
|
+
* Mirrors the {@link ExtendedVirtualCoin} / {@link VirtualCoin} split:
|
|
77
|
+
* - {@link ContractVtxo} carries `TapLeaves` and `EncodedVtxoScript` as
|
|
78
|
+
* `Partial<>` because VTXOs fetched raw from the indexer do not yet have
|
|
79
|
+
* taproot data.
|
|
80
|
+
* - `ExtendedContractVtxo` narrows those fields to required, guaranteeing
|
|
81
|
+
* that `annotateVtxos` has run and the taproot leaves are present.
|
|
82
|
+
*
|
|
83
|
+
* Use this type (instead of {@link ContractVtxo}) wherever the compiler
|
|
84
|
+
* should enforce that annotation has happened — e.g. `saveVtxos` and
|
|
85
|
+
* forfeit transaction construction.
|
|
86
|
+
*/
|
|
87
|
+
export type ExtendedContractVtxo = ExtendedVirtualCoin & {
|
|
88
|
+
contractScript: string;
|
|
89
|
+
};
|
|
73
90
|
/**
|
|
74
91
|
* Result of path selection, including the tapleaf to use and any extra witness data.
|
|
75
92
|
*/
|
|
@@ -218,7 +235,7 @@ export type GetContractsFilter = ContractFilter;
|
|
|
218
235
|
*/
|
|
219
236
|
export type ContractWithVtxos = {
|
|
220
237
|
contract: Contract;
|
|
221
|
-
vtxos:
|
|
238
|
+
vtxos: ExtendedContractVtxo[];
|
|
222
239
|
};
|
|
223
240
|
/**
|
|
224
241
|
* Summary of a contract's balance.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ExtendedVirtualCoin, VirtualCoin } from "../wallet";
|
|
2
|
-
import type { WalletRepository } from "../repositories/walletRepository";
|
|
3
|
-
import type { Contract } from "./types";
|
|
1
|
+
import type { ExtendedVirtualCoin, VirtualCoin } from "../wallet/index.js";
|
|
2
|
+
import type { WalletRepository } from "../repositories/walletRepository.js";
|
|
3
|
+
import type { Contract } from "./types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Tier 1 helpers that enforce VTXO ownership at call sites that already know
|
|
6
6
|
* the intended contract script. Address-keyed repositories may still hand back
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { AssetId } from "./assetId";
|
|
2
|
-
import { AssetRef } from "./assetRef";
|
|
3
|
-
import { AssetInput } from "./assetInput";
|
|
4
|
-
import { AssetOutput } from "./assetOutput";
|
|
5
|
-
import { Metadata } from "./metadata";
|
|
6
|
-
import { BufferReader, BufferWriter } from "./utils";
|
|
1
|
+
import { AssetId } from "./assetId.js";
|
|
2
|
+
import { AssetRef } from "./assetRef.js";
|
|
3
|
+
import { AssetInput } from "./assetInput.js";
|
|
4
|
+
import { AssetOutput } from "./assetOutput.js";
|
|
5
|
+
import { Metadata } from "./metadata.js";
|
|
6
|
+
import { BufferReader, BufferWriter } from "./utils.js";
|
|
7
7
|
/**
|
|
8
8
|
* An asset group contains inputs, outputs, and all data related to a given asset id.
|
|
9
9
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AssetInputType } from "./types";
|
|
2
|
-
import { BufferReader, BufferWriter } from "./utils";
|
|
1
|
+
import { AssetInputType } from "./types.js";
|
|
2
|
+
import { BufferReader, BufferWriter } from "./utils.js";
|
|
3
3
|
type AssetInputLocal = {
|
|
4
4
|
type: AssetInputType.Local;
|
|
5
5
|
vin: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AssetRefType } from "./types";
|
|
2
|
-
import { AssetId } from "./assetId";
|
|
3
|
-
import { BufferReader, BufferWriter } from "./utils";
|
|
1
|
+
import { AssetRefType } from "./types.js";
|
|
2
|
+
import { AssetId } from "./assetId.js";
|
|
3
|
+
import { BufferReader, BufferWriter } from "./utils.js";
|
|
4
4
|
type AssetRefByID = {
|
|
5
5
|
type: AssetRefType.ByID;
|
|
6
6
|
assetId: AssetId;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { AssetInputType, AssetRefType } from "./types";
|
|
2
|
-
export { AssetId } from "./assetId";
|
|
3
|
-
export { AssetRef } from "./assetRef";
|
|
4
|
-
export { AssetInput, AssetInputs } from "./assetInput";
|
|
5
|
-
export { AssetOutput, AssetOutputs } from "./assetOutput";
|
|
6
|
-
export { Metadata, MetadataList } from "./metadata";
|
|
7
|
-
export { AssetGroup } from "./assetGroup";
|
|
8
|
-
export { Packet } from "./packet";
|
|
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,5 +1,5 @@
|
|
|
1
|
-
import type { ExtensionPacket } from "../packet";
|
|
2
|
-
import { AssetGroup } from "./assetGroup";
|
|
1
|
+
import type { ExtensionPacket } from "../packet.js";
|
|
2
|
+
import { AssetGroup } from "./assetGroup.js";
|
|
3
3
|
/**
|
|
4
4
|
* Packet represents a collection of asset groups.
|
|
5
5
|
* It encodes/decodes as raw bytes only — OP_RETURN framing is handled by the Extension module.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Packet } from "./asset/packet";
|
|
2
|
-
import { ExtensionPacket } from "./packet";
|
|
3
|
-
import type { TransactionOutput } from "@scure/btc-signer/psbt";
|
|
4
|
-
import type { Transaction } from "../utils/transaction";
|
|
5
|
-
export type { ExtensionPacket } from "./packet";
|
|
6
|
-
export { UnknownPacket } from "./packet";
|
|
1
|
+
import { Packet } from "./asset/packet.js";
|
|
2
|
+
import { ExtensionPacket } from "./packet.js";
|
|
3
|
+
import type { TransactionOutput } from "@scure/btc-signer/psbt.js";
|
|
4
|
+
import type { Transaction } from "../utils/transaction.js";
|
|
5
|
+
export type { ExtensionPacket } from "./packet.js";
|
|
6
|
+
export { UnknownPacket } from "./packet.js";
|
|
7
7
|
/**
|
|
8
8
|
* ArkadeMagic is the 3-byte magic prefix ("ARK") that identifies an OP_RETURN
|
|
9
9
|
* output as an Arkade extension blob.
|
package/dist/types/forfeit.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Transaction } from "./utils/transaction";
|
|
1
|
+
import { Transaction } from "./utils/transaction.js";
|
|
2
2
|
import { TransactionInputUpdate, TransactionOutput } from "@scure/btc-signer/psbt.js";
|
|
3
3
|
/**
|
|
4
4
|
* Build a forfeit transaction that spends the provided inputs to a single forfeit output.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Transaction } from "../utils/transaction";
|
|
1
|
+
import { Transaction } from "../utils/transaction.js";
|
|
2
2
|
/** A signing request that pairs a descriptor with a transaction. */
|
|
3
3
|
export interface DescriptorSigningRequest {
|
|
4
4
|
/** Descriptor identifying which key to sign with */
|
|
@@ -18,6 +18,13 @@ export interface DescriptorSigningRequest {
|
|
|
18
18
|
* The provider has no read accessor for "current" — it is a pure descriptor
|
|
19
19
|
* allocator. "What addresses am I currently bound to?" is a question the
|
|
20
20
|
* contract repository answers, not the provider.
|
|
21
|
+
*
|
|
22
|
+
* Providers that want to participate in HD receive rotation can also
|
|
23
|
+
* implement the wallet-side `ReceiveRotatorFactory` interface (see
|
|
24
|
+
* `src/wallet/walletReceiveRotator.ts`). That extension is opt-in — the
|
|
25
|
+
* core `DescriptorProvider` contract intentionally stays free of
|
|
26
|
+
* wallet-specific concerns so HSM-backed and other minimal providers
|
|
27
|
+
* don't have to know about the receive-rotation lifecycle.
|
|
21
28
|
*/
|
|
22
29
|
export interface DescriptorProvider {
|
|
23
30
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Identity, ReadonlyIdentity } from ".";
|
|
2
|
-
import { DescriptorSigningRequest } from "./descriptorProvider";
|
|
3
|
-
import { Transaction } from "../utils/transaction";
|
|
1
|
+
import { Identity, ReadonlyIdentity } from "./index.js";
|
|
2
|
+
import { DescriptorSigningRequest } from "./descriptorProvider.js";
|
|
3
|
+
import { Transaction } from "../utils/transaction.js";
|
|
4
4
|
/**
|
|
5
5
|
* Read-side HD capability marker. Exposes the wildcard-suffixed account
|
|
6
6
|
* descriptor *template* and the descriptor-membership predicate, but no
|
|
@@ -19,7 +19,13 @@ export interface ReadonlyHDCapableIdentity extends ReadonlyIdentity {
|
|
|
19
19
|
* concrete descriptor by replacing the `*` with a derivation index.
|
|
20
20
|
*/
|
|
21
21
|
readonly descriptor: string;
|
|
22
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* True iff `descriptor` derives from this identity's xpub/seed.
|
|
24
|
+
*
|
|
25
|
+
* @deprecated Prefer `DescriptorProvider.isOurs()` via
|
|
26
|
+
* `HDDescriptorProvider` for rotating HD wallets or
|
|
27
|
+
* `StaticDescriptorProvider` for legacy single-key wallets.
|
|
28
|
+
*/
|
|
23
29
|
isOurs(descriptor: string): boolean;
|
|
24
30
|
}
|
|
25
31
|
/**
|
|
@@ -37,8 +43,29 @@ export interface ReadonlyHDCapableIdentity extends ReadonlyIdentity {
|
|
|
37
43
|
* explicitly-non-rotating use cases.
|
|
38
44
|
*/
|
|
39
45
|
export interface HDCapableIdentity extends ReadonlyHDCapableIdentity, Identity {
|
|
40
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Signs each request with the key derived from its descriptor.
|
|
48
|
+
*
|
|
49
|
+
* @deprecated Prefer `DescriptorProvider.signWithDescriptor()` via
|
|
50
|
+
* `HDDescriptorProvider` or `StaticDescriptorProvider`. Identities keep
|
|
51
|
+
* this method only as backing implementation for descriptor providers.
|
|
52
|
+
*/
|
|
41
53
|
signWithDescriptor(requests: DescriptorSigningRequest[]): Promise<Transaction[]>;
|
|
42
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* Signs a message using the key derived from `descriptor`.
|
|
56
|
+
*
|
|
57
|
+
* @deprecated Prefer `DescriptorProvider.signMessageWithDescriptor()` via
|
|
58
|
+
* `HDDescriptorProvider` or `StaticDescriptorProvider`. Identities keep
|
|
59
|
+
* this method only as backing implementation for descriptor providers.
|
|
60
|
+
*/
|
|
43
61
|
signMessageWithDescriptor(descriptor: string, message: Uint8Array, signatureType?: "schnorr" | "ecdsa"): Promise<Uint8Array>;
|
|
44
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Structural type guard for {@link HDCapableIdentity}. Returns `true`
|
|
65
|
+
* when the value exposes the four members the HD wallet flow relies on:
|
|
66
|
+
* `descriptor`, `isOurs`, `signWithDescriptor`, and
|
|
67
|
+
* `signMessageWithDescriptor`. Used by callers that need to opt into
|
|
68
|
+
* the HD path (e.g. installing an `HDDescriptorProvider`) without
|
|
69
|
+
* coupling to a concrete identity class.
|
|
70
|
+
*/
|
|
71
|
+
export declare function isHDCapableIdentity(value: unknown): value is HDCapableIdentity;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Transaction } from "../utils/transaction";
|
|
2
|
-
import { SignerSession } from "../tree/signingSession";
|
|
1
|
+
import { Transaction } from "../utils/transaction.js";
|
|
2
|
+
import { SignerSession } from "../tree/signingSession.js";
|
|
3
3
|
export interface Identity extends ReadonlyIdentity {
|
|
4
4
|
/** Returns a signer session used for musig2 tree signing flows. */
|
|
5
5
|
signerSession(): SignerSession;
|
|
@@ -45,12 +45,13 @@ export interface BatchSignableIdentity extends Identity {
|
|
|
45
45
|
}
|
|
46
46
|
/** Type guard for identities that support batch signing. */
|
|
47
47
|
export declare function isBatchSignable(identity: Identity): identity is BatchSignableIdentity;
|
|
48
|
-
export * from "./singleKey";
|
|
49
|
-
export type { NetworkOptions, DescriptorOptions, SeedIdentityOptions, MnemonicOptions, } from "./seedIdentity";
|
|
50
|
-
export { SeedIdentity, MnemonicIdentity, ReadonlyDescriptorIdentity, } from "./seedIdentity";
|
|
51
|
-
export * from "./serialize";
|
|
52
|
-
export { isDescriptor, normalizeToDescriptor, extractPubKey, parseHDDescriptor, } from "./descriptor";
|
|
53
|
-
export type { ParsedHDDescriptor } from "./descriptor";
|
|
54
|
-
export type { DescriptorProvider, DescriptorSigningRequest, } from "./descriptorProvider";
|
|
55
|
-
export type { HDCapableIdentity, ReadonlyHDCapableIdentity, } from "./hdCapableIdentity";
|
|
56
|
-
export {
|
|
48
|
+
export * from "./singleKey.js";
|
|
49
|
+
export type { NetworkOptions, DescriptorOptions, SeedIdentityOptions, MnemonicOptions, } from "./seedIdentity.js";
|
|
50
|
+
export { SeedIdentity, MnemonicIdentity, ReadonlyDescriptorIdentity, } from "./seedIdentity.js";
|
|
51
|
+
export * from "./serialize.js";
|
|
52
|
+
export { isDescriptor, normalizeToDescriptor, extractPubKey, parseHDDescriptor, } from "./descriptor.js";
|
|
53
|
+
export type { ParsedHDDescriptor } from "./descriptor.js";
|
|
54
|
+
export type { DescriptorProvider, DescriptorSigningRequest, } from "./descriptorProvider.js";
|
|
55
|
+
export type { HDCapableIdentity, ReadonlyHDCapableIdentity, } from "./hdCapableIdentity.js";
|
|
56
|
+
export { isHDCapableIdentity } from "./hdCapableIdentity.js";
|
|
57
|
+
export { StaticDescriptorProvider } from "./staticDescriptorProvider.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Transaction } from "../utils/transaction";
|
|
2
|
-
import { SignerSession } from "../tree/signingSession";
|
|
3
|
-
import type { SerializedSigningIdentity, SerializedReadonlyIdentity } from "./serialize";
|
|
4
|
-
import { DescriptorSigningRequest } from "./descriptorProvider";
|
|
5
|
-
import { HDCapableIdentity, ReadonlyHDCapableIdentity } from "./hdCapableIdentity";
|
|
1
|
+
import { Transaction } from "../utils/transaction.js";
|
|
2
|
+
import { SignerSession } from "../tree/signingSession.js";
|
|
3
|
+
import type { SerializedSigningIdentity, SerializedReadonlyIdentity } from "./serialize.js";
|
|
4
|
+
import { DescriptorSigningRequest } from "./descriptorProvider.js";
|
|
5
|
+
import { HDCapableIdentity, ReadonlyHDCapableIdentity } from "./hdCapableIdentity.js";
|
|
6
6
|
/** Used for default BIP86 derivation with network selection. */
|
|
7
7
|
export interface NetworkOptions {
|
|
8
8
|
/**
|
|
@@ -117,15 +117,27 @@ export declare class SeedIdentity implements HDCapableIdentity {
|
|
|
117
117
|
* Returns true when `descriptor` is derived from this identity's seed.
|
|
118
118
|
* HD descriptors match by account xpub; bare `tr(pubkey)` descriptors
|
|
119
119
|
* match by raw pubkey. See {@link descriptorIsOurs}.
|
|
120
|
+
*
|
|
121
|
+
* @deprecated Prefer `DescriptorProvider.isOurs()` via
|
|
122
|
+
* `HDDescriptorProvider` for rotating HD wallets or
|
|
123
|
+
* `StaticDescriptorProvider` for legacy single-key wallets.
|
|
120
124
|
*/
|
|
121
125
|
isOurs(descriptor: string): boolean;
|
|
122
126
|
/**
|
|
123
127
|
* Signs each request with the key derived from its descriptor.
|
|
124
128
|
* Each descriptor must share this identity's seed ({@link isOurs}).
|
|
129
|
+
*
|
|
130
|
+
* @deprecated Prefer `DescriptorProvider.signWithDescriptor()` via
|
|
131
|
+
* `HDDescriptorProvider` or `StaticDescriptorProvider`. Identities keep
|
|
132
|
+
* this method only as backing implementation for descriptor providers.
|
|
125
133
|
*/
|
|
126
134
|
signWithDescriptor(requests: DescriptorSigningRequest[]): Promise<Transaction[]>;
|
|
127
135
|
/**
|
|
128
136
|
* Signs a message with the key derived from `descriptor`.
|
|
137
|
+
*
|
|
138
|
+
* @deprecated Prefer `DescriptorProvider.signMessageWithDescriptor()` via
|
|
139
|
+
* `HDDescriptorProvider` or `StaticDescriptorProvider`. Identities keep
|
|
140
|
+
* this method only as backing implementation for descriptor providers.
|
|
129
141
|
*/
|
|
130
142
|
signMessageWithDescriptor(descriptor: string, message: Uint8Array, signatureType?: "schnorr" | "ecdsa"): Promise<Uint8Array>;
|
|
131
143
|
private derivePrivateKeyForDescriptor;
|
|
@@ -212,6 +224,10 @@ export declare class ReadonlyDescriptorIdentity implements ReadonlyHDCapableIden
|
|
|
212
224
|
* HD descriptors match by account xpub; bare `tr(pubkey)` descriptors
|
|
213
225
|
* fall back to comparing against the index-0 x-only pubkey. See
|
|
214
226
|
* {@link descriptorIsOurs}.
|
|
227
|
+
*
|
|
228
|
+
* @deprecated Prefer `DescriptorProvider.isOurs()` via
|
|
229
|
+
* `HDDescriptorProvider` for rotating HD wallets or
|
|
230
|
+
* `StaticDescriptorProvider` for legacy single-key wallets.
|
|
215
231
|
*/
|
|
216
232
|
isOurs(descriptor: string): boolean;
|
|
217
233
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Identity, ReadonlyIdentity } from ".";
|
|
2
|
-
import { Transaction } from "../utils/transaction";
|
|
3
|
-
import { SignerSession } from "../tree/signingSession";
|
|
1
|
+
import { Identity, ReadonlyIdentity } from "./index.js";
|
|
2
|
+
import { Transaction } from "../utils/transaction.js";
|
|
3
|
+
import { SignerSession } from "../tree/signingSession.js";
|
|
4
4
|
/**
|
|
5
5
|
* In-memory single key implementation for Bitcoin transaction signing.
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Identity } from ".";
|
|
2
|
-
import { DescriptorProvider, DescriptorSigningRequest } from "./descriptorProvider";
|
|
3
|
-
import { Transaction } from "../utils/transaction";
|
|
1
|
+
import { Identity } from "./index.js";
|
|
2
|
+
import { DescriptorProvider, DescriptorSigningRequest } from "./descriptorProvider.js";
|
|
3
|
+
import { Transaction } from "../utils/transaction.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.
|