@btc-vision/transaction 1.8.7-beta.0 → 1.8.8
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/browser/btc-vision-bitcoin.js +832 -828
- package/browser/index.js +1074 -947
- package/browser/noble-curves.js +1183 -2156
- package/browser/noble-hashes.js +88 -88
- package/browser/rolldown-runtime.js +26 -19
- package/browser/src/epoch/validator/EpochValidator.d.ts +28 -6
- package/browser/src/transaction/builders/TransactionBuilder.d.ts +1 -0
- package/browser/src/transaction/offline/OfflineTransactionManager.d.ts +50 -0
- package/browser/src/transaction/offline/interfaces/ISerializableState.d.ts +10 -2
- package/browser/vendors.js +3267 -3229
- package/build/epoch/validator/EpochValidator.d.ts +28 -6
- package/build/epoch/validator/EpochValidator.js +44 -10
- package/build/transaction/TransactionFactory.js +1 -1
- package/build/transaction/builders/FundingTransaction.js +17 -13
- package/build/transaction/builders/TransactionBuilder.d.ts +1 -0
- package/build/transaction/builders/TransactionBuilder.js +32 -7
- package/build/transaction/offline/OfflineTransactionManager.d.ts +50 -0
- package/build/transaction/offline/OfflineTransactionManager.js +142 -1
- package/build/transaction/offline/TransactionSerializer.js +9 -0
- package/build/transaction/offline/interfaces/ISerializableState.d.ts +10 -2
- package/build/transaction/offline/interfaces/ISerializableState.js +3 -2
- package/build/transaction/shared/TweakedTransaction.js +27 -5
- package/package.json +1 -1
- package/src/epoch/validator/EpochValidator.ts +67 -6
- package/src/transaction/TransactionFactory.ts +1 -1
- package/src/transaction/builders/FundingTransaction.ts +21 -16
- package/src/transaction/builders/TransactionBuilder.ts +46 -10
- package/src/transaction/offline/OfflineTransactionManager.ts +191 -1
- package/src/transaction/offline/TransactionSerializer.ts +11 -0
- package/src/transaction/offline/interfaces/ISerializableState.ts +10 -2
- package/src/transaction/shared/TweakedTransaction.ts +33 -5
- package/test/add-refund-output.test.ts +96 -11
- package/test/csv-multisig-offline-edges.test.ts +293 -0
- package/test/csv-multisig-offline.test.ts +202 -0
- package/test/transaction-builders.test.ts +69 -3
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -5,6 +5,19 @@ import { TransactionBuilder } from '../builders/TransactionBuilder.js';
|
|
|
5
5
|
import { ISerializableTransactionState, PrecomputedData } from './interfaces/ISerializableState.js';
|
|
6
6
|
import { ReconstructionOptions } from './TransactionReconstructor.js';
|
|
7
7
|
import { IDeploymentParameters, IFundingTransactionParameters, IInteractionParameters, ITransactionParameters } from '../interfaces/ITransactionParameters.js';
|
|
8
|
+
/**
|
|
9
|
+
* Per-input CSV multisig signing status.
|
|
10
|
+
*/
|
|
11
|
+
export interface CSVMultisigInputStatus {
|
|
12
|
+
/** PSBT input index */
|
|
13
|
+
readonly inputIndex: number;
|
|
14
|
+
/** Threshold required to spend this input */
|
|
15
|
+
readonly required: number;
|
|
16
|
+
/** Number of distinct cosigner signatures collected so far */
|
|
17
|
+
readonly collected: number;
|
|
18
|
+
/** Hex-encoded x-only pubkeys of the cosigners that have signed */
|
|
19
|
+
readonly signers: string[];
|
|
20
|
+
}
|
|
8
21
|
/**
|
|
9
22
|
* Export options for offline transaction signing
|
|
10
23
|
*/
|
|
@@ -246,4 +259,41 @@ export declare class OfflineTransactionManager {
|
|
|
246
259
|
* @returns Updated state
|
|
247
260
|
*/
|
|
248
261
|
static multiSigUpdatePsbt(serializedState: string, psbtBase64: string): string;
|
|
262
|
+
/**
|
|
263
|
+
* Inspect collaborative signing progress on all CSV multisig inputs.
|
|
264
|
+
* Returns an empty array when no partial PSBT has been produced yet.
|
|
265
|
+
*/
|
|
266
|
+
static csvMultisigGetStatus(serializedState: string): CSVMultisigInputStatus[];
|
|
267
|
+
/**
|
|
268
|
+
* Add the given signer's contribution to every CSV multisig input it can sign.
|
|
269
|
+
* No-op for inputs whose tapscript does not contain the signer's x-only pubkey.
|
|
270
|
+
*
|
|
271
|
+
* First call (no partial PSBT yet) builds the PSBT from the funding params
|
|
272
|
+
* using the provided signer as the builder's signer. Subsequent calls load
|
|
273
|
+
* the carried PSBT and add the signer's tapScriptSig where applicable.
|
|
274
|
+
*/
|
|
275
|
+
static addCSVMultisigSignature(serializedState: string, signer: Signer | UniversalSigner): Promise<{
|
|
276
|
+
state: string;
|
|
277
|
+
final: boolean;
|
|
278
|
+
perInput: CSVMultisigInputStatus[];
|
|
279
|
+
}>;
|
|
280
|
+
/**
|
|
281
|
+
* Finalize every CSV multisig input on the partial PSBT and extract the
|
|
282
|
+
* raw transaction hex. Throws if any input is still below its threshold.
|
|
283
|
+
*/
|
|
284
|
+
static csvMultisigFinalize(serializedState: string): string;
|
|
285
|
+
/**
|
|
286
|
+
* Sign every CSV multisig input whose tapscript contains the signer's
|
|
287
|
+
* x-only pubkey and does not yet carry a signature from that pubkey.
|
|
288
|
+
*/
|
|
289
|
+
private static addSignerToCSVInputs;
|
|
290
|
+
/**
|
|
291
|
+
* Build per-input status for every CSV multisig input.
|
|
292
|
+
*
|
|
293
|
+
* Walks state.utxos so we can detect CSV multisig inputs even after the
|
|
294
|
+
* builder has already finalized them (which clears tapLeafScript). For
|
|
295
|
+
* partially-signed inputs the signers list reflects collected tapScriptSig
|
|
296
|
+
* entries; for finalized inputs collected is set to the threshold.
|
|
297
|
+
*/
|
|
298
|
+
private static computeCSVMultisigStatus;
|
|
249
299
|
}
|
|
@@ -2,9 +2,10 @@ import { TransactionType } from '../../enums/TransactionType.js';
|
|
|
2
2
|
import { ChainId } from '../../../network/ChainId.js';
|
|
3
3
|
import { TypeSpecificData } from './ITypeSpecificData.js';
|
|
4
4
|
/**
|
|
5
|
-
* Format version for serialization compatibility
|
|
5
|
+
* Format version for serialization compatibility.
|
|
6
|
+
* v2 adds the optional `partialPsbtBase64` field on the top-level state.
|
|
6
7
|
*/
|
|
7
|
-
export declare const SERIALIZATION_FORMAT_VERSION =
|
|
8
|
+
export declare const SERIALIZATION_FORMAT_VERSION = 2;
|
|
8
9
|
/**
|
|
9
10
|
* Magic byte for identifying serialized transaction state
|
|
10
11
|
*/
|
|
@@ -129,4 +130,11 @@ export interface ISerializableTransactionState {
|
|
|
129
130
|
readonly typeSpecificData: TypeSpecificData;
|
|
130
131
|
/** Pre-computed data for deterministic rebuild */
|
|
131
132
|
readonly precomputedData: PrecomputedData;
|
|
133
|
+
/**
|
|
134
|
+
* Partial PSBT (base64) carrying signatures collected so far.
|
|
135
|
+
* Used by collaborative flows like CSV multisig where multiple cosigners
|
|
136
|
+
* accumulate signatures across hops before finalization.
|
|
137
|
+
* Only present once at least one signing hop has run.
|
|
138
|
+
*/
|
|
139
|
+
readonly partialPsbtBase64?: string;
|
|
132
140
|
}
|