@arkade-os/sdk 0.3.13 → 0.4.0-next.1
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 +586 -54
- package/dist/cjs/asset/assetGroup.js +141 -0
- package/dist/cjs/asset/assetId.js +88 -0
- package/dist/cjs/asset/assetInput.js +204 -0
- package/dist/cjs/asset/assetOutput.js +159 -0
- package/dist/cjs/asset/assetRef.js +82 -0
- package/dist/cjs/asset/index.js +24 -0
- package/dist/cjs/asset/metadata.js +172 -0
- package/dist/cjs/asset/packet.js +164 -0
- package/dist/cjs/asset/types.js +25 -0
- package/dist/cjs/asset/utils.js +105 -0
- package/dist/cjs/bip322/index.js +270 -0
- package/dist/cjs/contracts/arkcontract.js +148 -0
- package/dist/cjs/contracts/contractManager.js +436 -0
- package/dist/cjs/contracts/contractWatcher.js +567 -0
- package/dist/cjs/contracts/handlers/default.js +85 -0
- package/dist/cjs/contracts/handlers/delegate.js +89 -0
- package/dist/cjs/contracts/handlers/helpers.js +105 -0
- package/dist/cjs/contracts/handlers/index.js +19 -0
- package/dist/cjs/contracts/handlers/registry.js +89 -0
- package/dist/cjs/contracts/handlers/vhtlc.js +193 -0
- package/dist/cjs/contracts/index.js +41 -0
- package/dist/cjs/contracts/types.js +2 -0
- package/dist/cjs/forfeit.js +12 -8
- package/dist/cjs/identity/index.js +1 -0
- package/dist/cjs/identity/seedIdentity.js +255 -0
- package/dist/cjs/index.js +72 -14
- package/dist/cjs/intent/index.js +47 -11
- package/dist/cjs/providers/ark.js +7 -0
- package/dist/cjs/providers/delegator.js +66 -0
- package/dist/cjs/providers/expoIndexer.js +5 -0
- package/dist/cjs/providers/indexer.js +68 -1
- package/dist/cjs/providers/utils.js +1 -0
- package/dist/cjs/repositories/contractRepository.js +0 -103
- package/dist/cjs/repositories/inMemory/contractRepository.js +55 -0
- package/dist/cjs/repositories/inMemory/walletRepository.js +80 -0
- package/dist/cjs/repositories/index.js +16 -0
- package/dist/cjs/repositories/indexedDB/contractRepository.js +187 -0
- package/dist/cjs/repositories/indexedDB/db.js +19 -0
- package/dist/cjs/repositories/indexedDB/manager.js +97 -0
- package/dist/cjs/repositories/indexedDB/schema.js +159 -0
- package/dist/cjs/repositories/indexedDB/walletRepository.js +338 -0
- package/dist/cjs/repositories/indexedDB/websqlAdapter.js +144 -0
- package/dist/cjs/repositories/migrations/contractRepositoryImpl.js +127 -0
- package/dist/cjs/repositories/migrations/fromStorageAdapter.js +66 -0
- package/dist/cjs/repositories/migrations/walletRepositoryImpl.js +180 -0
- package/dist/cjs/repositories/realm/contractRepository.js +120 -0
- package/dist/cjs/repositories/realm/index.js +9 -0
- package/dist/cjs/repositories/realm/schemas.js +108 -0
- package/dist/cjs/repositories/realm/types.js +7 -0
- package/dist/cjs/repositories/realm/walletRepository.js +273 -0
- package/dist/cjs/repositories/serialization.js +49 -0
- package/dist/cjs/repositories/sqlite/contractRepository.js +139 -0
- package/dist/cjs/repositories/sqlite/index.js +7 -0
- package/dist/cjs/repositories/sqlite/types.js +2 -0
- package/dist/cjs/repositories/sqlite/walletRepository.js +328 -0
- package/dist/cjs/repositories/walletRepository.js +0 -169
- package/dist/cjs/script/base.js +54 -0
- package/dist/cjs/script/delegate.js +49 -0
- package/dist/cjs/storage/asyncStorage.js +4 -1
- package/dist/cjs/storage/fileSystem.js +3 -0
- package/dist/cjs/storage/inMemory.js +3 -0
- package/dist/cjs/storage/indexedDB.js +5 -1
- package/dist/cjs/storage/localStorage.js +3 -0
- package/dist/cjs/utils/arkTransaction.js +16 -0
- package/dist/cjs/utils/transactionHistory.js +50 -0
- package/dist/cjs/wallet/asset-manager.js +338 -0
- package/dist/cjs/wallet/asset.js +117 -0
- package/dist/cjs/wallet/batch.js +1 -1
- package/dist/cjs/wallet/delegator.js +235 -0
- package/dist/cjs/wallet/expo/background.js +133 -0
- package/dist/cjs/wallet/expo/index.js +9 -0
- package/dist/cjs/wallet/expo/wallet.js +231 -0
- package/dist/cjs/wallet/serviceWorker/wallet-message-handler.js +568 -0
- package/dist/cjs/wallet/serviceWorker/wallet.js +383 -102
- package/dist/cjs/wallet/utils.js +58 -0
- package/dist/cjs/wallet/validation.js +151 -0
- package/dist/cjs/wallet/vtxo-manager.js +8 -1
- package/dist/cjs/wallet/wallet.js +702 -260
- package/dist/cjs/worker/browser/service-worker-manager.js +82 -0
- package/dist/cjs/{wallet/serviceWorker → worker/browser}/utils.js +2 -1
- package/dist/cjs/worker/expo/asyncStorageTaskQueue.js +78 -0
- package/dist/cjs/worker/expo/index.js +12 -0
- package/dist/cjs/worker/expo/processors/contractPollProcessor.js +61 -0
- package/dist/cjs/worker/expo/processors/index.js +6 -0
- package/dist/cjs/worker/expo/taskQueue.js +41 -0
- package/dist/cjs/worker/expo/taskRunner.js +57 -0
- package/dist/cjs/worker/messageBus.js +252 -0
- package/dist/esm/asset/assetGroup.js +137 -0
- package/dist/esm/asset/assetId.js +84 -0
- package/dist/esm/asset/assetInput.js +199 -0
- package/dist/esm/asset/assetOutput.js +154 -0
- package/dist/esm/asset/assetRef.js +78 -0
- package/dist/esm/asset/index.js +8 -0
- package/dist/esm/asset/metadata.js +167 -0
- package/dist/esm/asset/packet.js +159 -0
- package/dist/esm/asset/types.js +22 -0
- package/dist/esm/asset/utils.js +99 -0
- package/dist/esm/bip322/index.js +267 -0
- package/dist/esm/contracts/arkcontract.js +141 -0
- package/dist/esm/contracts/contractManager.js +432 -0
- package/dist/esm/contracts/contractWatcher.js +563 -0
- package/dist/esm/contracts/handlers/default.js +82 -0
- package/dist/esm/contracts/handlers/delegate.js +86 -0
- package/dist/esm/contracts/handlers/helpers.js +66 -0
- package/dist/esm/contracts/handlers/index.js +12 -0
- package/dist/esm/contracts/handlers/registry.js +86 -0
- package/dist/esm/contracts/handlers/vhtlc.js +190 -0
- package/dist/esm/contracts/index.js +13 -0
- package/dist/esm/contracts/types.js +1 -0
- package/dist/esm/forfeit.js +11 -8
- package/dist/esm/identity/index.js +1 -0
- package/dist/esm/identity/seedIdentity.js +249 -0
- package/dist/esm/index.js +28 -15
- package/dist/esm/intent/index.js +44 -9
- package/dist/esm/providers/ark.js +7 -0
- package/dist/esm/providers/delegator.js +62 -0
- package/dist/esm/providers/expoIndexer.js +5 -0
- package/dist/esm/providers/indexer.js +68 -1
- package/dist/esm/providers/utils.js +1 -0
- package/dist/esm/repositories/contractRepository.js +1 -101
- package/dist/esm/repositories/inMemory/contractRepository.js +51 -0
- package/dist/esm/repositories/inMemory/walletRepository.js +76 -0
- package/dist/esm/repositories/index.js +8 -0
- package/dist/esm/repositories/indexedDB/contractRepository.js +183 -0
- package/dist/esm/repositories/indexedDB/db.js +4 -0
- package/dist/esm/repositories/indexedDB/manager.js +92 -0
- package/dist/esm/repositories/indexedDB/schema.js +155 -0
- package/dist/esm/repositories/indexedDB/walletRepository.js +334 -0
- package/dist/esm/repositories/indexedDB/websqlAdapter.js +138 -0
- package/dist/esm/repositories/migrations/contractRepositoryImpl.js +121 -0
- package/dist/esm/repositories/migrations/fromStorageAdapter.js +58 -0
- package/dist/esm/repositories/migrations/walletRepositoryImpl.js +176 -0
- package/dist/esm/repositories/realm/contractRepository.js +116 -0
- package/dist/esm/repositories/realm/index.js +3 -0
- package/dist/esm/repositories/realm/schemas.js +105 -0
- package/dist/esm/repositories/realm/types.js +6 -0
- package/dist/esm/repositories/realm/walletRepository.js +269 -0
- package/dist/esm/repositories/serialization.js +40 -0
- package/dist/esm/repositories/sqlite/contractRepository.js +135 -0
- package/dist/esm/repositories/sqlite/index.js +2 -0
- package/dist/esm/repositories/sqlite/types.js +1 -0
- package/dist/esm/repositories/sqlite/walletRepository.js +324 -0
- package/dist/esm/repositories/walletRepository.js +1 -167
- package/dist/esm/script/base.js +21 -1
- package/dist/esm/script/delegate.js +46 -0
- package/dist/esm/storage/asyncStorage.js +4 -1
- package/dist/esm/storage/fileSystem.js +3 -0
- package/dist/esm/storage/inMemory.js +3 -0
- package/dist/esm/storage/indexedDB.js +5 -1
- package/dist/esm/storage/localStorage.js +3 -0
- package/dist/esm/utils/arkTransaction.js +15 -0
- package/dist/esm/utils/transactionHistory.js +50 -0
- package/dist/esm/wallet/asset-manager.js +333 -0
- package/dist/esm/wallet/asset.js +111 -0
- package/dist/esm/wallet/batch.js +1 -1
- package/dist/esm/wallet/delegator.js +231 -0
- package/dist/esm/wallet/expo/background.js +128 -0
- package/dist/esm/wallet/expo/index.js +2 -0
- package/dist/esm/wallet/expo/wallet.js +194 -0
- package/dist/esm/wallet/serviceWorker/wallet-message-handler.js +564 -0
- package/dist/esm/wallet/serviceWorker/wallet.js +382 -101
- package/dist/esm/wallet/utils.js +54 -0
- package/dist/esm/wallet/validation.js +139 -0
- package/dist/esm/wallet/vtxo-manager.js +8 -1
- package/dist/esm/wallet/wallet.js +704 -229
- package/dist/esm/worker/browser/service-worker-manager.js +76 -0
- package/dist/esm/{wallet/serviceWorker → worker/browser}/utils.js +2 -1
- package/dist/esm/worker/expo/asyncStorageTaskQueue.js +74 -0
- package/dist/esm/worker/expo/index.js +4 -0
- package/dist/esm/worker/expo/processors/contractPollProcessor.js +58 -0
- package/dist/esm/worker/expo/processors/index.js +1 -0
- package/dist/esm/worker/expo/taskQueue.js +37 -0
- package/dist/esm/worker/expo/taskRunner.js +54 -0
- package/dist/esm/worker/messageBus.js +248 -0
- package/dist/types/asset/assetGroup.d.ts +28 -0
- package/dist/types/asset/assetId.d.ts +19 -0
- package/dist/types/asset/assetInput.d.ts +46 -0
- package/dist/types/asset/assetOutput.d.ts +39 -0
- package/dist/types/asset/assetRef.d.ts +25 -0
- package/dist/types/asset/index.d.ts +8 -0
- package/dist/types/asset/metadata.d.ts +37 -0
- package/dist/types/asset/packet.d.ts +27 -0
- package/dist/types/asset/types.d.ts +18 -0
- package/dist/types/asset/utils.d.ts +21 -0
- package/dist/types/bip322/index.d.ts +55 -0
- package/dist/types/contracts/arkcontract.d.ts +101 -0
- package/dist/types/contracts/contractManager.d.ts +331 -0
- package/dist/types/contracts/contractWatcher.d.ts +192 -0
- package/dist/types/contracts/handlers/default.d.ts +19 -0
- package/dist/types/contracts/handlers/delegate.d.ts +21 -0
- package/dist/types/contracts/handlers/helpers.d.ts +18 -0
- package/dist/types/contracts/handlers/index.d.ts +7 -0
- package/dist/types/contracts/handlers/registry.d.ts +65 -0
- package/dist/types/contracts/handlers/vhtlc.d.ts +32 -0
- package/dist/types/contracts/index.d.ts +14 -0
- package/dist/types/contracts/types.d.ts +222 -0
- package/dist/types/forfeit.d.ts +2 -1
- package/dist/types/identity/index.d.ts +1 -0
- package/dist/types/identity/seedIdentity.d.ts +128 -0
- package/dist/types/index.d.ts +22 -12
- package/dist/types/intent/index.d.ts +15 -1
- package/dist/types/providers/ark.d.ts +11 -2
- package/dist/types/providers/delegator.d.ts +29 -0
- package/dist/types/providers/indexer.d.ts +11 -1
- package/dist/types/repositories/contractRepository.d.ts +30 -19
- package/dist/types/repositories/inMemory/contractRepository.d.ts +17 -0
- package/dist/types/repositories/inMemory/walletRepository.d.ts +26 -0
- package/dist/types/repositories/index.d.ts +7 -0
- package/dist/types/repositories/indexedDB/contractRepository.d.ts +21 -0
- package/dist/types/repositories/indexedDB/db.d.ts +4 -0
- package/dist/types/repositories/indexedDB/manager.d.ts +22 -0
- package/dist/types/repositories/indexedDB/schema.d.ts +8 -0
- package/dist/types/repositories/indexedDB/walletRepository.d.ts +25 -0
- package/dist/types/repositories/indexedDB/websqlAdapter.d.ts +49 -0
- package/dist/types/repositories/migrations/contractRepositoryImpl.d.ts +24 -0
- package/dist/types/repositories/migrations/fromStorageAdapter.d.ts +19 -0
- package/dist/types/repositories/migrations/walletRepositoryImpl.d.ts +27 -0
- package/dist/types/repositories/realm/contractRepository.d.ts +24 -0
- package/dist/types/repositories/realm/index.d.ts +4 -0
- package/dist/types/repositories/realm/schemas.d.ts +208 -0
- package/dist/types/repositories/realm/types.d.ts +16 -0
- package/dist/types/repositories/realm/walletRepository.d.ts +31 -0
- package/dist/types/repositories/serialization.d.ts +40 -0
- package/dist/types/repositories/sqlite/contractRepository.d.ts +33 -0
- package/dist/types/repositories/sqlite/index.d.ts +3 -0
- package/dist/types/repositories/sqlite/types.d.ts +18 -0
- package/dist/types/repositories/sqlite/walletRepository.d.ts +40 -0
- package/dist/types/repositories/walletRepository.d.ts +13 -24
- package/dist/types/script/base.d.ts +1 -0
- package/dist/types/script/delegate.d.ts +36 -0
- package/dist/types/storage/asyncStorage.d.ts +4 -0
- package/dist/types/storage/fileSystem.d.ts +3 -0
- package/dist/types/storage/inMemory.d.ts +3 -0
- package/dist/types/storage/index.d.ts +3 -0
- package/dist/types/storage/indexedDB.d.ts +3 -0
- package/dist/types/storage/localStorage.d.ts +3 -0
- package/dist/types/utils/arkTransaction.d.ts +6 -0
- package/dist/types/wallet/asset-manager.d.ts +78 -0
- package/dist/types/wallet/asset.d.ts +21 -0
- package/dist/types/wallet/batch.d.ts +1 -1
- package/dist/types/wallet/delegator.d.ts +24 -0
- package/dist/types/wallet/expo/background.d.ts +66 -0
- package/dist/types/wallet/expo/index.d.ts +4 -0
- package/dist/types/wallet/expo/wallet.d.ts +97 -0
- package/dist/types/wallet/index.d.ts +75 -2
- package/dist/types/wallet/serviceWorker/wallet-message-handler.d.ts +366 -0
- package/dist/types/wallet/serviceWorker/wallet.d.ts +20 -11
- package/dist/types/wallet/utils.d.ts +12 -1
- package/dist/types/wallet/validation.d.ts +24 -0
- package/dist/types/wallet/wallet.d.ts +111 -17
- package/dist/types/worker/browser/service-worker-manager.d.ts +21 -0
- package/dist/types/{wallet/serviceWorker → worker/browser}/utils.d.ts +2 -1
- package/dist/types/worker/expo/asyncStorageTaskQueue.d.ts +46 -0
- package/dist/types/worker/expo/index.d.ts +7 -0
- package/dist/types/worker/expo/processors/contractPollProcessor.d.ts +14 -0
- package/dist/types/worker/expo/processors/index.d.ts +1 -0
- package/dist/types/worker/expo/taskQueue.d.ts +50 -0
- package/dist/types/worker/expo/taskRunner.d.ts +42 -0
- package/dist/types/worker/messageBus.d.ts +109 -0
- package/package.json +69 -11
- package/dist/cjs/wallet/serviceWorker/request.js +0 -78
- package/dist/cjs/wallet/serviceWorker/response.js +0 -222
- package/dist/cjs/wallet/serviceWorker/worker.js +0 -655
- package/dist/esm/wallet/serviceWorker/request.js +0 -75
- package/dist/esm/wallet/serviceWorker/response.js +0 -219
- package/dist/esm/wallet/serviceWorker/worker.js +0 -651
- package/dist/types/wallet/serviceWorker/request.d.ts +0 -74
- package/dist/types/wallet/serviceWorker/response.d.ts +0 -123
- package/dist/types/wallet/serviceWorker/worker.d.ts +0 -53
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { IndexerProvider } from "../providers/indexer";
|
|
2
|
+
import { WalletRepository } from "../repositories/walletRepository";
|
|
3
|
+
import { Contract, ContractEventCallback } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for the ContractWatcher.
|
|
6
|
+
*/
|
|
7
|
+
export interface ContractWatcherConfig {
|
|
8
|
+
/** The indexer provider to use for subscriptions and queries */
|
|
9
|
+
indexerProvider: IndexerProvider;
|
|
10
|
+
/** The wallet repository for VTXO persistence (optional) */
|
|
11
|
+
walletRepository: WalletRepository;
|
|
12
|
+
/**
|
|
13
|
+
* Interval for failsafe polling (ms).
|
|
14
|
+
* Polls even when subscription is active to catch missed events.
|
|
15
|
+
* Default: 60000 (1 minute)
|
|
16
|
+
*/
|
|
17
|
+
failsafePollIntervalMs?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Initial reconnection delay (ms).
|
|
20
|
+
* Uses exponential backoff on repeated failures.
|
|
21
|
+
* Default: 1000 (1 second)
|
|
22
|
+
*/
|
|
23
|
+
reconnectDelayMs?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Maximum reconnection delay (ms).
|
|
26
|
+
* Default: 30000 (30 seconds)
|
|
27
|
+
*/
|
|
28
|
+
maxReconnectDelayMs?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Maximum reconnection attempts before giving up.
|
|
31
|
+
* Set to 0 for unlimited attempts.
|
|
32
|
+
* Default: 0 (unlimited)
|
|
33
|
+
*/
|
|
34
|
+
maxReconnectAttempts?: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Connection state for the watcher.
|
|
38
|
+
*/
|
|
39
|
+
type ConnectionState = "disconnected" | "connecting" | "connected" | "reconnecting";
|
|
40
|
+
/**
|
|
41
|
+
* Watches multiple contracts for VTXO changes with resilient connection handling.
|
|
42
|
+
*
|
|
43
|
+
* Features:
|
|
44
|
+
* - Automatic reconnection with exponential backoff
|
|
45
|
+
* - Failsafe polling to catch missed events
|
|
46
|
+
* - Polls immediately after (re)connection to sync state
|
|
47
|
+
* - Graceful handling of subscription failures
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* const watcher = new ContractWatcher({
|
|
52
|
+
* indexerProvider: wallet.indexerProvider,
|
|
53
|
+
* });
|
|
54
|
+
*
|
|
55
|
+
* // Add the wallet's default contract
|
|
56
|
+
* await watcher.addContract(defaultContract);
|
|
57
|
+
*
|
|
58
|
+
* // Add additional contracts (swaps, etc.)
|
|
59
|
+
* await watcher.addContract(swapContract);
|
|
60
|
+
*
|
|
61
|
+
* // Start watching for events
|
|
62
|
+
* const stop = await watcher.startWatching((event) => {
|
|
63
|
+
* console.log(`${event.type} on contract ${event.contractScript}`);
|
|
64
|
+
* });
|
|
65
|
+
*
|
|
66
|
+
* // Later: stop watching
|
|
67
|
+
* stop();
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare class ContractWatcher {
|
|
71
|
+
private config;
|
|
72
|
+
private contracts;
|
|
73
|
+
private subscriptionId?;
|
|
74
|
+
private abortController?;
|
|
75
|
+
private isWatching;
|
|
76
|
+
private eventCallback?;
|
|
77
|
+
private connectionState;
|
|
78
|
+
private reconnectAttempts;
|
|
79
|
+
private reconnectTimeoutId?;
|
|
80
|
+
private failsafePollIntervalId?;
|
|
81
|
+
constructor(config: ContractWatcherConfig);
|
|
82
|
+
/**
|
|
83
|
+
* Add a contract to be watched.
|
|
84
|
+
*
|
|
85
|
+
* Active contracts are immediately subscribed. All contracts are polled
|
|
86
|
+
* to discover any existing VTXOs (which may cause them to be watched
|
|
87
|
+
* even if inactive).
|
|
88
|
+
*/
|
|
89
|
+
addContract(contract: Contract): Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* Update an existing contract.
|
|
92
|
+
*/
|
|
93
|
+
updateContract(contract: Contract): Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* Remove a contract from watching.
|
|
96
|
+
*/
|
|
97
|
+
removeContract(contractScript: string): Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Get all in-memory contracts.
|
|
100
|
+
*/
|
|
101
|
+
getAllContracts(): Contract[];
|
|
102
|
+
/**
|
|
103
|
+
* Get all active in-memory contracts.
|
|
104
|
+
*/
|
|
105
|
+
getActiveContracts(): Contract[];
|
|
106
|
+
/**
|
|
107
|
+
* Get scripts that should be watched.
|
|
108
|
+
*
|
|
109
|
+
* Returns scripts for:
|
|
110
|
+
* - All active contracts
|
|
111
|
+
* - All contracts with known VTXOs (regardless of state)
|
|
112
|
+
*
|
|
113
|
+
* This ensures we continue monitoring contracts even after they're
|
|
114
|
+
* deactivated, as long as they have unspent VTXOs.
|
|
115
|
+
*/
|
|
116
|
+
private getScriptsToWatch;
|
|
117
|
+
/**
|
|
118
|
+
* Get VTXOs for contracts, grouped by contract script.
|
|
119
|
+
* Uses Repository.
|
|
120
|
+
*/
|
|
121
|
+
private getContractVtxos;
|
|
122
|
+
/**
|
|
123
|
+
* Start watching for VTXO events across all active contracts.
|
|
124
|
+
*/
|
|
125
|
+
startWatching(callback: ContractEventCallback): Promise<() => void>;
|
|
126
|
+
/**
|
|
127
|
+
* Stop watching for events.
|
|
128
|
+
*/
|
|
129
|
+
stopWatching(): Promise<void>;
|
|
130
|
+
/**
|
|
131
|
+
* Check if currently watching.
|
|
132
|
+
*/
|
|
133
|
+
isCurrentlyWatching(): boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Get current connection state.
|
|
136
|
+
*/
|
|
137
|
+
getConnectionState(): ConnectionState;
|
|
138
|
+
/**
|
|
139
|
+
* Force a poll of all active contracts.
|
|
140
|
+
* Useful for manual refresh or after app resume.
|
|
141
|
+
*/
|
|
142
|
+
forcePoll(): Promise<void>;
|
|
143
|
+
/**
|
|
144
|
+
* Check for expired contracts, update their state, and emit events.
|
|
145
|
+
*/
|
|
146
|
+
private checkExpiredContracts;
|
|
147
|
+
/**
|
|
148
|
+
* Connect to the subscription.
|
|
149
|
+
*/
|
|
150
|
+
private connect;
|
|
151
|
+
/**
|
|
152
|
+
* Schedule a reconnection attempt.
|
|
153
|
+
*/
|
|
154
|
+
private scheduleReconnect;
|
|
155
|
+
/**
|
|
156
|
+
* Start the failsafe polling interval.
|
|
157
|
+
*/
|
|
158
|
+
private startFailsafePolling;
|
|
159
|
+
/**
|
|
160
|
+
* Poll all active contracts for current state.
|
|
161
|
+
*/
|
|
162
|
+
private pollAllContracts;
|
|
163
|
+
/**
|
|
164
|
+
* Poll specific contracts and emit events for changes.
|
|
165
|
+
*/
|
|
166
|
+
private pollContracts;
|
|
167
|
+
private tryUpdateSubscription;
|
|
168
|
+
/**
|
|
169
|
+
* Update the subscription with scripts that should be watched.
|
|
170
|
+
*
|
|
171
|
+
* Watches both active contracts and contracts with VTXOs.
|
|
172
|
+
*/
|
|
173
|
+
private updateSubscription;
|
|
174
|
+
/**
|
|
175
|
+
* Main listening loop for subscription events.
|
|
176
|
+
*/
|
|
177
|
+
private listenLoop;
|
|
178
|
+
/**
|
|
179
|
+
* Handle a subscription update.
|
|
180
|
+
*/
|
|
181
|
+
private handleSubscriptionUpdate;
|
|
182
|
+
/**
|
|
183
|
+
* Process VTXOs from subscription and route to correct contracts.
|
|
184
|
+
* Uses the scripts from the subscription response to determine contract ownership.
|
|
185
|
+
*/
|
|
186
|
+
private processSubscriptionVtxos;
|
|
187
|
+
/**
|
|
188
|
+
* Emit a VTXO event for a contract.
|
|
189
|
+
*/
|
|
190
|
+
private emitVtxoEvent;
|
|
191
|
+
}
|
|
192
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DefaultVtxo } from "../../script/default";
|
|
2
|
+
import { RelativeTimelock } from "../../script/tapscript";
|
|
3
|
+
import { ContractHandler } from "../types";
|
|
4
|
+
/**
|
|
5
|
+
* Typed parameters for DefaultVtxo contracts.
|
|
6
|
+
*/
|
|
7
|
+
export interface DefaultContractParams {
|
|
8
|
+
pubKey: Uint8Array;
|
|
9
|
+
serverPubKey: Uint8Array;
|
|
10
|
+
csvTimelock: RelativeTimelock;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Handler for default wallet VTXOs.
|
|
14
|
+
*
|
|
15
|
+
* Default contracts use the standard forfeit + exit tapscript:
|
|
16
|
+
* - forfeit: (Alice + Server) multisig for collaborative spending
|
|
17
|
+
* - exit: (Alice) + CSV timelock for unilateral exit
|
|
18
|
+
*/
|
|
19
|
+
export declare const DefaultContractHandler: ContractHandler<DefaultContractParams, DefaultVtxo.Script>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DelegateVtxo } from "../../script/delegate";
|
|
2
|
+
import { RelativeTimelock } from "../../script/tapscript";
|
|
3
|
+
import { ContractHandler } from "../types";
|
|
4
|
+
/**
|
|
5
|
+
* Typed parameters for DelegateVtxo contracts.
|
|
6
|
+
*/
|
|
7
|
+
export interface DelegateContractParams {
|
|
8
|
+
pubKey: Uint8Array;
|
|
9
|
+
serverPubKey: Uint8Array;
|
|
10
|
+
delegatePubKey: Uint8Array;
|
|
11
|
+
csvTimelock: RelativeTimelock;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Handler for delegate wallet VTXOs.
|
|
15
|
+
*
|
|
16
|
+
* Delegate contracts extend the default tapscript with an additional delegate path:
|
|
17
|
+
* - forfeit: (Alice + Server) multisig for collaborative spending
|
|
18
|
+
* - exit: (Alice) + CSV timelock for unilateral exit
|
|
19
|
+
* - delegate: (Alice + Delegate + Server) multisig for delegated renewal
|
|
20
|
+
*/
|
|
21
|
+
export declare const DelegateContractHandler: ContractHandler<DelegateContractParams, DelegateVtxo.Script>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { RelativeTimelock } from "../../script/tapscript";
|
|
2
|
+
import { Contract, PathContext } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Convert RelativeTimelock to BIP68 sequence number.
|
|
5
|
+
*/
|
|
6
|
+
export declare function timelockToSequence(timelock: RelativeTimelock): number;
|
|
7
|
+
/**
|
|
8
|
+
* Convert BIP68 sequence number back to RelativeTimelock.
|
|
9
|
+
*/
|
|
10
|
+
export declare function sequenceToTimelock(sequence: number): RelativeTimelock;
|
|
11
|
+
/**
|
|
12
|
+
* Resolve wallet's role from explicit role or by matching pubkey.
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveRole(contract: Contract, context: PathContext): "sender" | "receiver" | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Check if a CSV timelock is currently satisfied for the given context/VTXO.
|
|
17
|
+
*/
|
|
18
|
+
export declare function isCsvSpendable(context: PathContext, sequence?: number): boolean;
|
|
@@ -0,0 +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";
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ContractHandler } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Registry for contract handlers.
|
|
4
|
+
*
|
|
5
|
+
* Each contract type ("default", "vhtlc", etc.) has a handler that knows
|
|
6
|
+
* how to create VtxoScripts, serialize params, and select spending paths.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* // Register a custom handler
|
|
11
|
+
* contractHandlers.register(myCustomHandler);
|
|
12
|
+
*
|
|
13
|
+
* // Get handler for a type
|
|
14
|
+
* const handler = contractHandlers.get("vhtlc");
|
|
15
|
+
* const script = handler.createScript(contract.params);
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
declare class ContractHandlerRegistry {
|
|
19
|
+
private handlers;
|
|
20
|
+
/**
|
|
21
|
+
* Register a contract handler.
|
|
22
|
+
*
|
|
23
|
+
* @param handler - The handler to register
|
|
24
|
+
* @throws If a handler for this type is already registered
|
|
25
|
+
*/
|
|
26
|
+
register(handler: ContractHandler<unknown>): void;
|
|
27
|
+
/**
|
|
28
|
+
* Get a handler by type.
|
|
29
|
+
*
|
|
30
|
+
* @param type - The contract type
|
|
31
|
+
* @returns The handler, or undefined if not found
|
|
32
|
+
*/
|
|
33
|
+
get(type: string): ContractHandler<unknown> | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Get a handler by type, throwing if not found.
|
|
36
|
+
*
|
|
37
|
+
* @param type - The contract type
|
|
38
|
+
* @returns The handler
|
|
39
|
+
* @throws If no handler is registered for this type
|
|
40
|
+
*/
|
|
41
|
+
getOrThrow(type: string): ContractHandler<unknown>;
|
|
42
|
+
/**
|
|
43
|
+
* Check if a handler is registered.
|
|
44
|
+
*
|
|
45
|
+
* @param type - The contract type
|
|
46
|
+
*/
|
|
47
|
+
has(type: string): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Get all registered types.
|
|
50
|
+
*/
|
|
51
|
+
getRegisteredTypes(): string[];
|
|
52
|
+
/**
|
|
53
|
+
* Unregister a handler (mainly for testing).
|
|
54
|
+
*/
|
|
55
|
+
unregister(type: string): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Clear all handlers (mainly for testing).
|
|
58
|
+
*/
|
|
59
|
+
clear(): void;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Global registry of contract handlers.
|
|
63
|
+
*/
|
|
64
|
+
export declare const contractHandlers: ContractHandlerRegistry;
|
|
65
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { VHTLC } from "../../script/vhtlc";
|
|
2
|
+
import { RelativeTimelock } from "../../script/tapscript";
|
|
3
|
+
import { ContractHandler } from "../types";
|
|
4
|
+
/**
|
|
5
|
+
* Typed parameters for VHTLC contracts.
|
|
6
|
+
*/
|
|
7
|
+
export interface VHTLCContractParams {
|
|
8
|
+
sender: Uint8Array;
|
|
9
|
+
receiver: Uint8Array;
|
|
10
|
+
server: Uint8Array;
|
|
11
|
+
preimageHash: Uint8Array;
|
|
12
|
+
refundLocktime: bigint;
|
|
13
|
+
unilateralClaimDelay: RelativeTimelock;
|
|
14
|
+
unilateralRefundDelay: RelativeTimelock;
|
|
15
|
+
unilateralRefundWithoutReceiverDelay: RelativeTimelock;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Handler for Virtual Hash Time Lock Contract (VHTLC).
|
|
19
|
+
*
|
|
20
|
+
* VHTLC supports multiple spending paths:
|
|
21
|
+
*
|
|
22
|
+
* Collaborative paths (with server):
|
|
23
|
+
* - claim: Receiver + Server with preimage
|
|
24
|
+
* - refund: Sender + Receiver + Server
|
|
25
|
+
* - refundWithoutReceiver: Sender + Server after CLTV locktime
|
|
26
|
+
*
|
|
27
|
+
* Unilateral paths (without server):
|
|
28
|
+
* - unilateralClaim: Receiver with preimage after CSV delay
|
|
29
|
+
* - unilateralRefund: Sender + Receiver after CSV delay
|
|
30
|
+
* - unilateralRefundWithoutReceiver: Sender after CSV delay
|
|
31
|
+
*/
|
|
32
|
+
export declare const VHTLCContractHandler: ContractHandler<VHTLCContractParams, VHTLC.Script>;
|
|
@@ -0,0 +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, } from "./contractManager";
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { Bytes } from "@scure/btc-signer/utils.js";
|
|
2
|
+
import { TapLeafScript, VtxoScript } from "../script/base";
|
|
3
|
+
import { VirtualCoin, ExtendedVirtualCoin } from "../wallet";
|
|
4
|
+
import { ContractFilter } from "../repositories";
|
|
5
|
+
/**
|
|
6
|
+
* Contract state indicating whether it should be actively monitored.
|
|
7
|
+
*/
|
|
8
|
+
export type ContractState = "active" | "inactive";
|
|
9
|
+
/**
|
|
10
|
+
* Represents a contract that can receive and manage VTXOs.
|
|
11
|
+
*
|
|
12
|
+
* A contract is defined by its type and parameters, which together
|
|
13
|
+
* determine the VtxoScript (spending paths). The wallet's default
|
|
14
|
+
* receiving address is itself a contract of type "default".
|
|
15
|
+
*
|
|
16
|
+
* External services (Boltz swaps, atomic swaps, etc.) create additional
|
|
17
|
+
* contracts with their own types and parameters.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const vhtlcContract: Contract = {
|
|
22
|
+
* type: "vhtlc",
|
|
23
|
+
* params: {
|
|
24
|
+
* sender: "ab12...",
|
|
25
|
+
* receiver: "cd34...",
|
|
26
|
+
* server: "ef56...",
|
|
27
|
+
* hash: "1234...",
|
|
28
|
+
* refundLocktime: "800000",
|
|
29
|
+
* // ... timelocks
|
|
30
|
+
* },
|
|
31
|
+
* script: "5120...",
|
|
32
|
+
* address: "tark1...",
|
|
33
|
+
* state: "active",
|
|
34
|
+
* createdAt: 1704067200000,
|
|
35
|
+
* };
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export interface Contract {
|
|
39
|
+
/** Human-readable label for display purposes */
|
|
40
|
+
label?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Contract type identifier.
|
|
43
|
+
* Built-in types: "default", "vhtlc"
|
|
44
|
+
* Custom types can be registered via ContractHandler.
|
|
45
|
+
*/
|
|
46
|
+
type: string;
|
|
47
|
+
/**
|
|
48
|
+
* Type-specific parameters for constructing the VtxoScript.
|
|
49
|
+
* All values are serialized as strings (hex for bytes, string for bigint).
|
|
50
|
+
* The ContractHandler for this type knows how to interpret these.
|
|
51
|
+
*/
|
|
52
|
+
params: Record<string, string>;
|
|
53
|
+
/** The pkScript hex - unique identifier and primary key for contracts */
|
|
54
|
+
script: string;
|
|
55
|
+
/** The address derived from the script */
|
|
56
|
+
address: string;
|
|
57
|
+
/** Current state of the contract */
|
|
58
|
+
state: ContractState;
|
|
59
|
+
/** Unix timestamp (ms) when this contract was created */
|
|
60
|
+
createdAt: number;
|
|
61
|
+
/** Unix timestamp (ms) when this contract expires (optional) */
|
|
62
|
+
expiresAt?: number;
|
|
63
|
+
/**
|
|
64
|
+
* Optional metadata for external integrations.
|
|
65
|
+
*/
|
|
66
|
+
metadata?: Record<string, unknown>;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* A VTXO that has been associated with a specific contract.
|
|
70
|
+
*/
|
|
71
|
+
export interface ContractVtxo extends ExtendedVirtualCoin {
|
|
72
|
+
/** The contract script this VTXO belongs to */
|
|
73
|
+
contractScript: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Result of path selection - which tapleaf to use and extra witness data.
|
|
77
|
+
*/
|
|
78
|
+
export interface PathSelection {
|
|
79
|
+
/** The tapleaf script to use for spending */
|
|
80
|
+
leaf: TapLeafScript;
|
|
81
|
+
/** Additional witness elements (e.g., preimage for HTLC) */
|
|
82
|
+
extraWitness?: Bytes[];
|
|
83
|
+
/** Sequence number override (for CSV timelocks) */
|
|
84
|
+
sequence?: number;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Context for path selection decisions.
|
|
88
|
+
*/
|
|
89
|
+
export interface PathContext {
|
|
90
|
+
/** Is collaborative spending available (server cooperation)? */
|
|
91
|
+
collaborative: boolean;
|
|
92
|
+
/** Current time in milliseconds */
|
|
93
|
+
currentTime: number;
|
|
94
|
+
/** Current block height (optional) */
|
|
95
|
+
blockHeight?: number;
|
|
96
|
+
/**
|
|
97
|
+
* Wallet's public key (x-only, 32 bytes hex).
|
|
98
|
+
* Used by handlers to determine wallet's role in multi-party contracts.
|
|
99
|
+
*/
|
|
100
|
+
walletPubKey?: string;
|
|
101
|
+
/**
|
|
102
|
+
* Explicit role override (for multi-party contracts like VHTLC).
|
|
103
|
+
* If not provided, handler may derive role from walletPubKey.
|
|
104
|
+
*/
|
|
105
|
+
role?: string;
|
|
106
|
+
/** The specific VTXO being evaluated */
|
|
107
|
+
vtxo?: VirtualCoin;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Handler for a specific contract type.
|
|
111
|
+
*
|
|
112
|
+
* Each contract type (default, vhtlc, etc.) has a handler that knows how to:
|
|
113
|
+
* 1. Create the VtxoScript from parameters
|
|
114
|
+
* 2. Serialize/deserialize parameters for storage
|
|
115
|
+
* 3. Select the appropriate spending path based on context
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```typescript
|
|
119
|
+
* const vhtlcHandler: ContractHandler = {
|
|
120
|
+
* type: "vhtlc",
|
|
121
|
+
* createScript(params) {
|
|
122
|
+
* return new VHTLC.Script(this.deserializeParams(params));
|
|
123
|
+
* },
|
|
124
|
+
* selectPath(script, contract, context) {
|
|
125
|
+
* const vhtlc = script as VHTLC.Script;
|
|
126
|
+
* const preimage = contract.data?.preimage;
|
|
127
|
+
* if (context.collaborative && preimage) {
|
|
128
|
+
* return { leaf: vhtlc.claim(), extraWitness: [hex.decode(preimage)] };
|
|
129
|
+
* }
|
|
130
|
+
* // ... other paths
|
|
131
|
+
* },
|
|
132
|
+
* // ...
|
|
133
|
+
* };
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
export interface ContractHandler<P = Record<string, unknown>, S extends VtxoScript = VtxoScript> {
|
|
137
|
+
/** The contract type this handler manages */
|
|
138
|
+
readonly type: string;
|
|
139
|
+
/**
|
|
140
|
+
* Create the VtxoScript from serialized parameters.
|
|
141
|
+
*/
|
|
142
|
+
createScript(params: Record<string, string>): S;
|
|
143
|
+
/**
|
|
144
|
+
* Serialize typed parameters to string key-value pairs.
|
|
145
|
+
*/
|
|
146
|
+
serializeParams(params: P): Record<string, string>;
|
|
147
|
+
/**
|
|
148
|
+
* Deserialize string key-value pairs to typed parameters.
|
|
149
|
+
*/
|
|
150
|
+
deserializeParams(params: Record<string, string>): P;
|
|
151
|
+
/**
|
|
152
|
+
* Select the preferred spending path based on contract state and context.
|
|
153
|
+
* Returns the best available path (e.g., collaborative over unilateral).
|
|
154
|
+
*
|
|
155
|
+
* @returns PathSelection if a viable path exists, null otherwise
|
|
156
|
+
*/
|
|
157
|
+
selectPath(script: S, contract: Contract, context: PathContext): PathSelection | null;
|
|
158
|
+
/**
|
|
159
|
+
* Get all possible spending paths for the current context.
|
|
160
|
+
* Returns empty array if no paths are available.
|
|
161
|
+
*
|
|
162
|
+
* Useful for showing users which spending options exist regardless of
|
|
163
|
+
* current spendability.
|
|
164
|
+
*/
|
|
165
|
+
getAllSpendingPaths(script: S, contract: Contract, context: PathContext): PathSelection[];
|
|
166
|
+
/**
|
|
167
|
+
* Get all currently spendable paths.
|
|
168
|
+
* Returns empty array if no paths are available.
|
|
169
|
+
*/
|
|
170
|
+
getSpendablePaths(script: S, contract: Contract, context: PathContext): PathSelection[];
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Event emitted when contract-related changes occur.
|
|
174
|
+
*/
|
|
175
|
+
export type ContractEvent = {
|
|
176
|
+
type: "vtxo_received";
|
|
177
|
+
contractScript: string;
|
|
178
|
+
vtxos: ContractVtxo[];
|
|
179
|
+
contract: Contract;
|
|
180
|
+
timestamp: number;
|
|
181
|
+
} | {
|
|
182
|
+
type: "vtxo_spent";
|
|
183
|
+
contractScript: string;
|
|
184
|
+
vtxos: ContractVtxo[];
|
|
185
|
+
contract: Contract;
|
|
186
|
+
timestamp: number;
|
|
187
|
+
} | {
|
|
188
|
+
type: "contract_expired";
|
|
189
|
+
contractScript: string;
|
|
190
|
+
contract: Contract;
|
|
191
|
+
timestamp: number;
|
|
192
|
+
} | {
|
|
193
|
+
type: "connection_reset";
|
|
194
|
+
timestamp: number;
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* Callback for contract events.
|
|
198
|
+
*/
|
|
199
|
+
export type ContractEventCallback = (event: ContractEvent) => void;
|
|
200
|
+
/**
|
|
201
|
+
* Options for retrieving contracts from the Contract Manager.
|
|
202
|
+
* Currently an alias of the repository's filter type but can be extended in the future.
|
|
203
|
+
*/
|
|
204
|
+
export type GetContractsFilter = ContractFilter;
|
|
205
|
+
/**
|
|
206
|
+
* Contract with its VTXOs included.
|
|
207
|
+
*/
|
|
208
|
+
export type ContractWithVtxos = {
|
|
209
|
+
contract: Contract;
|
|
210
|
+
vtxos: ContractVtxo[];
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* Summary of a contract's balance.
|
|
214
|
+
*/
|
|
215
|
+
export interface ContractBalance {
|
|
216
|
+
/** Total balance (settled + pending) in satoshis */
|
|
217
|
+
total: number;
|
|
218
|
+
/** Spendable balance in satoshis */
|
|
219
|
+
spendable: number;
|
|
220
|
+
/** Number of VTXOs in this contract */
|
|
221
|
+
vtxoCount: number;
|
|
222
|
+
}
|
package/dist/types/forfeit.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { Transaction } from "./utils/transaction";
|
|
2
|
-
import { TransactionInputUpdate } from "@scure/btc-signer/psbt.js";
|
|
2
|
+
import { TransactionInputUpdate, TransactionOutput } from "@scure/btc-signer/psbt.js";
|
|
3
3
|
export declare function buildForfeitTx(inputs: TransactionInputUpdate[], forfeitPkScript: Uint8Array, txLocktime?: number): Transaction;
|
|
4
|
+
export declare function buildForfeitTxWithOutput(inputs: TransactionInputUpdate[], output: TransactionOutput, txLocktime?: number): Transaction;
|