@btc-vision/transaction 1.0.112 → 1.0.113
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/_version.d.ts +1 -1
- package/browser/index.js +1 -1
- package/browser/keypair/AddressVerificator.d.ts +15 -3
- package/browser/keypair/EcKeyPair.d.ts +7 -4
- package/browser/keypair/Wallet.d.ts +1 -0
- package/browser/signer/TweakedSigner.d.ts +2 -2
- package/browser/transaction/builders/FundingTransaction.d.ts +2 -1
- package/browser/transaction/builders/MultiSignTransaction.d.ts +2 -1
- package/browser/transaction/builders/SharedInteractionTransaction.d.ts +1 -1
- package/browser/transaction/builders/TransactionBuilder.d.ts +2 -2
- package/browser/transaction/shared/TweakedTransaction.d.ts +8 -7
- package/build/_version.d.ts +1 -1
- package/build/_version.js +1 -1
- package/build/keypair/AddressVerificator.d.ts +15 -3
- package/build/keypair/AddressVerificator.js +74 -3
- package/build/keypair/EcKeyPair.d.ts +7 -4
- package/build/keypair/EcKeyPair.js +54 -9
- package/build/keypair/Wallet.d.ts +1 -0
- package/build/keypair/Wallet.js +5 -4
- package/build/signer/TweakedSigner.d.ts +2 -2
- package/build/signer/TweakedSigner.js +1 -1
- package/build/transaction/builders/CustomScriptTransaction.js +3 -3
- package/build/transaction/builders/DeploymentTransaction.js +4 -4
- package/build/transaction/builders/FundingTransaction.d.ts +2 -1
- package/build/transaction/builders/MultiSignTransaction.d.ts +2 -1
- package/build/transaction/builders/SharedInteractionTransaction.d.ts +1 -1
- package/build/transaction/builders/SharedInteractionTransaction.js +4 -4
- package/build/transaction/builders/TransactionBuilder.d.ts +2 -2
- package/build/transaction/builders/UnwrapTransaction.js +2 -2
- package/build/transaction/shared/TweakedTransaction.d.ts +8 -7
- package/build/transaction/shared/TweakedTransaction.js +1 -1
- package/package.json +2 -1
- package/src/_version.ts +1 -1
- package/src/keypair/AddressVerificator.ts +144 -5
- package/src/keypair/EcKeyPair.ts +111 -14
- package/src/keypair/Wallet.ts +11 -3
- package/src/signer/TweakedSigner.ts +3 -2
- package/src/transaction/builders/CustomScriptTransaction.ts +6 -5
- package/src/transaction/builders/DeploymentTransaction.ts +6 -5
- package/src/transaction/builders/FundingTransaction.ts +2 -1
- package/src/transaction/builders/MultiSignTransaction.ts +6 -2
- package/src/transaction/builders/SharedInteractionTransaction.ts +5 -5
- package/src/transaction/builders/TransactionBuilder.ts +18 -8
- package/src/transaction/builders/UnwrapSegwitTransaction.ts +7 -3
- package/src/transaction/builders/UnwrapTransaction.ts +2 -2
- package/src/transaction/builders/WrapTransaction.ts +1 -6
- package/src/transaction/shared/TweakedTransaction.ts +12 -12
|
@@ -13,6 +13,7 @@ import { Compressor } from '../../bytecode/Compressor.js';
|
|
|
13
13
|
import { AddressGenerator } from '../../generators/AddressGenerator.js';
|
|
14
14
|
import { Address } from '@btc-vision/bsi-binary';
|
|
15
15
|
import { SharedInteractionTransaction } from './SharedInteractionTransaction.js';
|
|
16
|
+
import { ECPairInterface } from 'ecpair';
|
|
16
17
|
|
|
17
18
|
export class DeploymentTransaction extends TransactionBuilder<TransactionType.DEPLOYMENT> {
|
|
18
19
|
public static readonly MAXIMUM_CONTRACT_SIZE = 128 * 1024;
|
|
@@ -75,7 +76,7 @@ export class DeploymentTransaction extends TransactionBuilder<TransactionType.DE
|
|
|
75
76
|
* The contract signer
|
|
76
77
|
* @private
|
|
77
78
|
*/
|
|
78
|
-
private readonly contractSigner: Signer;
|
|
79
|
+
private readonly contractSigner: Signer | ECPairInterface;
|
|
79
80
|
|
|
80
81
|
/**
|
|
81
82
|
* The contract salt random bytes
|
|
@@ -100,7 +101,7 @@ export class DeploymentTransaction extends TransactionBuilder<TransactionType.DE
|
|
|
100
101
|
this.contractSigner = EcKeyPair.fromSeedKeyPair(this.contractSeed, this.network);
|
|
101
102
|
|
|
102
103
|
this.deploymentGenerator = new DeploymentGenerator(
|
|
103
|
-
this.signer.publicKey,
|
|
104
|
+
Buffer.from(this.signer.publicKey),
|
|
104
105
|
this.contractSignerXOnlyPubKey(),
|
|
105
106
|
this.network,
|
|
106
107
|
);
|
|
@@ -145,7 +146,7 @@ export class DeploymentTransaction extends TransactionBuilder<TransactionType.DE
|
|
|
145
146
|
* @protected
|
|
146
147
|
*/
|
|
147
148
|
protected contractSignerXOnlyPubKey(): Buffer {
|
|
148
|
-
return toXOnly(this.contractSigner.publicKey);
|
|
149
|
+
return toXOnly(Buffer.from(this.contractSigner.publicKey));
|
|
149
150
|
}
|
|
150
151
|
|
|
151
152
|
/**
|
|
@@ -323,10 +324,10 @@ export class DeploymentTransaction extends TransactionBuilder<TransactionType.DE
|
|
|
323
324
|
* @private
|
|
324
325
|
*/
|
|
325
326
|
private getPubKeys(): Buffer[] {
|
|
326
|
-
const pubkeys = [this.signer.publicKey];
|
|
327
|
+
const pubkeys = [Buffer.from(this.signer.publicKey)];
|
|
327
328
|
|
|
328
329
|
if (this.contractSigner) {
|
|
329
|
-
pubkeys.push(this.contractSigner.publicKey);
|
|
330
|
+
pubkeys.push(Buffer.from(this.contractSigner.publicKey));
|
|
330
331
|
}
|
|
331
332
|
|
|
332
333
|
return pubkeys;
|
|
@@ -2,6 +2,7 @@ import { TransactionType } from '../enums/TransactionType.js';
|
|
|
2
2
|
import { IFundingTransactionParameters } from '../interfaces/ITransactionParameters.js';
|
|
3
3
|
import { Signer } from 'bitcoinjs-lib';
|
|
4
4
|
import { TransactionBuilder } from './TransactionBuilder.js';
|
|
5
|
+
import { ECPairInterface } from 'ecpair';
|
|
5
6
|
|
|
6
7
|
export class FundingTransaction extends TransactionBuilder<TransactionType.FUNDING> {
|
|
7
8
|
public readonly type: TransactionType.FUNDING = TransactionType.FUNDING;
|
|
@@ -64,7 +65,7 @@ export class FundingTransaction extends TransactionBuilder<TransactionType.FUNDI
|
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
67
|
|
|
67
|
-
protected override getSignerKey(): Signer {
|
|
68
|
+
protected override getSignerKey(): Signer | ECPairInterface {
|
|
68
69
|
return this.signer;
|
|
69
70
|
}
|
|
70
71
|
}
|
|
@@ -10,6 +10,7 @@ import { Address } from '@btc-vision/bsi-binary';
|
|
|
10
10
|
import { UTXO } from '../../utxo/interfaces/IUTXO.js';
|
|
11
11
|
import { toXOnly } from 'bitcoinjs-lib/src/psbt/bip371.js';
|
|
12
12
|
import { EcKeyPair } from '../../keypair/EcKeyPair.js';
|
|
13
|
+
import { ECPairInterface } from 'ecpair';
|
|
13
14
|
|
|
14
15
|
export interface MultiSignParameters
|
|
15
16
|
extends Omit<ITransactionParameters, 'priorityFee' | 'signer'> {
|
|
@@ -172,7 +173,7 @@ export class MultiSignTransaction extends TransactionBuilder<TransactionType.MUL
|
|
|
172
173
|
*/
|
|
173
174
|
public static signPartial(
|
|
174
175
|
psbt: Psbt,
|
|
175
|
-
signer: Signer,
|
|
176
|
+
signer: Signer | ECPairInterface,
|
|
176
177
|
originalInputCount: number,
|
|
177
178
|
minimums: number[],
|
|
178
179
|
): {
|
|
@@ -498,7 +499,10 @@ export class MultiSignTransaction extends TransactionBuilder<TransactionType.MUL
|
|
|
498
499
|
* @returns {Promise<boolean>}
|
|
499
500
|
* @throws {Error} - If something went wrong while building the transaction
|
|
500
501
|
*/
|
|
501
|
-
protected override async internalBuildTransaction(
|
|
502
|
+
protected override async internalBuildTransaction(
|
|
503
|
+
transaction: Psbt,
|
|
504
|
+
checkPartialSigs: boolean = false,
|
|
505
|
+
): Promise<boolean> {
|
|
502
506
|
const inputs: PsbtInputExtended[] = this.getInputs();
|
|
503
507
|
const outputs: PsbtOutputExtended[] = this.getOutputs();
|
|
504
508
|
|
|
@@ -50,7 +50,7 @@ export abstract class SharedInteractionTransaction<
|
|
|
50
50
|
* Script signer for the interaction
|
|
51
51
|
* @protected
|
|
52
52
|
*/
|
|
53
|
-
protected readonly scriptSigner: Signer;
|
|
53
|
+
protected readonly scriptSigner: Signer | ECPairInterface;
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
56
|
* Disable auto refund
|
|
@@ -73,7 +73,7 @@ export abstract class SharedInteractionTransaction<
|
|
|
73
73
|
this.scriptSigner = this.generateKeyPairFromSeed();
|
|
74
74
|
|
|
75
75
|
this.calldataGenerator = new CalldataGenerator(
|
|
76
|
-
this.signer.publicKey,
|
|
76
|
+
Buffer.from(this.signer.publicKey),
|
|
77
77
|
this.scriptSignerXOnlyPubKey(),
|
|
78
78
|
this.network,
|
|
79
79
|
);
|
|
@@ -113,7 +113,7 @@ export abstract class SharedInteractionTransaction<
|
|
|
113
113
|
* @returns {Buffer} The internal pubkey as an x-only key
|
|
114
114
|
*/
|
|
115
115
|
protected scriptSignerXOnlyPubKey(): Buffer {
|
|
116
|
-
return toXOnly(this.scriptSigner.publicKey);
|
|
116
|
+
return toXOnly(Buffer.from(this.scriptSigner.publicKey));
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
/**
|
|
@@ -362,10 +362,10 @@ export abstract class SharedInteractionTransaction<
|
|
|
362
362
|
* @returns {Buffer[]} The public keys
|
|
363
363
|
*/
|
|
364
364
|
private getPubKeys(): Buffer[] {
|
|
365
|
-
const pubkeys = [this.signer.publicKey];
|
|
365
|
+
const pubkeys = [Buffer.from(this.signer.publicKey)];
|
|
366
366
|
|
|
367
367
|
if (this.scriptSigner) {
|
|
368
|
-
pubkeys.push(this.scriptSigner.publicKey);
|
|
368
|
+
pubkeys.push(Buffer.from(this.scriptSigner.publicKey));
|
|
369
369
|
}
|
|
370
370
|
|
|
371
371
|
return pubkeys;
|
|
@@ -43,65 +43,79 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
43
43
|
* @description Cost in satoshis of the transaction fee
|
|
44
44
|
*/
|
|
45
45
|
public transactionFee: bigint = 0n;
|
|
46
|
+
|
|
46
47
|
/**
|
|
47
48
|
* @description The estimated fees of the transaction
|
|
48
49
|
*/
|
|
49
50
|
public estimatedFees: bigint = 0n;
|
|
51
|
+
|
|
50
52
|
/**
|
|
51
53
|
* @param {ITransactionParameters} parameters - The transaction parameters
|
|
52
54
|
*/
|
|
53
|
-
|
|
54
55
|
public optionalOutputs: PsbtOutputExtended[] | undefined;
|
|
56
|
+
|
|
55
57
|
/**
|
|
56
58
|
* @description The transaction itself.
|
|
57
59
|
*/
|
|
58
60
|
protected transaction: Psbt;
|
|
61
|
+
|
|
59
62
|
/**
|
|
60
63
|
* @description Inputs to update later on.
|
|
61
64
|
*/
|
|
62
65
|
protected readonly updateInputs: UpdateInput[] = [];
|
|
66
|
+
|
|
63
67
|
/**
|
|
64
68
|
* @description The outputs of the transaction
|
|
65
69
|
*/
|
|
66
70
|
protected readonly outputs: PsbtOutputExtended[] = [];
|
|
71
|
+
|
|
67
72
|
/**
|
|
68
73
|
* @description Output that will be used to pay the fees
|
|
69
74
|
*/
|
|
70
75
|
protected feeOutput: PsbtOutputExtended | null = null;
|
|
76
|
+
|
|
71
77
|
/**
|
|
72
78
|
* @description The total amount of satoshis in the inputs
|
|
73
79
|
*/
|
|
74
80
|
protected totalInputAmount: bigint;
|
|
81
|
+
|
|
75
82
|
/**
|
|
76
83
|
* @description The signer of the transaction
|
|
77
84
|
*/
|
|
78
|
-
protected readonly signer: Signer;
|
|
85
|
+
protected readonly signer: Signer | ECPairInterface;
|
|
86
|
+
|
|
79
87
|
/**
|
|
80
88
|
* @description The network where the transaction will be broadcasted
|
|
81
89
|
*/
|
|
82
90
|
protected readonly network: Network;
|
|
91
|
+
|
|
83
92
|
/**
|
|
84
93
|
* @description The fee rate of the transaction
|
|
85
94
|
*/
|
|
86
95
|
protected readonly feeRate: number;
|
|
96
|
+
|
|
87
97
|
/**
|
|
88
98
|
* @description The opnet priority fee of the transaction
|
|
89
99
|
*/
|
|
90
100
|
protected priorityFee: bigint;
|
|
101
|
+
|
|
91
102
|
/**
|
|
92
103
|
* @description The utxos used in the transaction
|
|
93
104
|
*/
|
|
94
105
|
protected utxos: UTXO[];
|
|
106
|
+
|
|
95
107
|
/**
|
|
96
108
|
* @description The address where the transaction is sent to
|
|
97
109
|
* @protected
|
|
98
110
|
*/
|
|
99
111
|
protected to: Address | undefined;
|
|
112
|
+
|
|
100
113
|
/**
|
|
101
114
|
* @description The address where the transaction is sent from
|
|
102
115
|
* @protected
|
|
103
116
|
*/
|
|
104
117
|
protected from: Address;
|
|
118
|
+
|
|
105
119
|
/**
|
|
106
120
|
* @description The maximum fee rate of the transaction
|
|
107
121
|
*/
|
|
@@ -131,11 +145,7 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
131
145
|
|
|
132
146
|
this.optionalOutputs = parameters.optionalOutputs;
|
|
133
147
|
|
|
134
|
-
this.from = TransactionBuilder.getFrom(
|
|
135
|
-
parameters.from,
|
|
136
|
-
this.signer as ECPairInterface,
|
|
137
|
-
this.network,
|
|
138
|
-
);
|
|
148
|
+
this.from = TransactionBuilder.getFrom(parameters.from, this.signer, this.network);
|
|
139
149
|
|
|
140
150
|
this.totalInputAmount = this.calculateTotalUTXOAmount();
|
|
141
151
|
|
|
@@ -151,7 +161,7 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
|
|
|
151
161
|
|
|
152
162
|
public static getFrom(
|
|
153
163
|
from: string | undefined,
|
|
154
|
-
keypair: ECPairInterface,
|
|
164
|
+
keypair: ECPairInterface | Signer,
|
|
155
165
|
network: Network,
|
|
156
166
|
): Address {
|
|
157
167
|
return from || EcKeyPair.getTaprootAddress(keypair, network);
|
|
@@ -10,6 +10,7 @@ import { EcKeyPair } from '../../keypair/EcKeyPair.js';
|
|
|
10
10
|
import { IWBTCUTXODocument, PsbtTransaction, VaultUTXOs } from '../processor/PsbtTransaction.js';
|
|
11
11
|
import { PsbtInputExtended, PsbtOutputExtended } from '../interfaces/Tap.js';
|
|
12
12
|
import { currentConsensusConfig } from '../../consensus/ConsensusConfig.js';
|
|
13
|
+
import { ECPairInterface } from 'ecpair';
|
|
13
14
|
|
|
14
15
|
const abiCoder: ABICoder = new ABICoder();
|
|
15
16
|
|
|
@@ -196,7 +197,10 @@ export class UnwrapSegwitTransaction extends SharedInteractionTransaction<Transa
|
|
|
196
197
|
* @returns {Promise<boolean>}
|
|
197
198
|
* @throws {Error} - If something went wrong while building the transaction
|
|
198
199
|
*/
|
|
199
|
-
protected async internalBuildTransaction(
|
|
200
|
+
protected async internalBuildTransaction(
|
|
201
|
+
transaction: Psbt,
|
|
202
|
+
checkPartialSigs: boolean = false,
|
|
203
|
+
): Promise<boolean> {
|
|
200
204
|
if (transaction.data.inputs.length === 0) {
|
|
201
205
|
const inputs: PsbtInputExtended[] = this.getInputs();
|
|
202
206
|
const outputs: PsbtOutputExtended[] = this.getOutputs();
|
|
@@ -300,12 +304,12 @@ export class UnwrapSegwitTransaction extends SharedInteractionTransaction<Transa
|
|
|
300
304
|
/**
|
|
301
305
|
* @description Add vault inputs to the transaction
|
|
302
306
|
* @param {VaultUTXOs} vault The vault UTXOs
|
|
303
|
-
* @param {Signer} [firstSigner] The first signer
|
|
307
|
+
* @param {Signer | ECPairInterface} [firstSigner] The first signer
|
|
304
308
|
* @private
|
|
305
309
|
*/
|
|
306
310
|
private async addVaultInputs(
|
|
307
311
|
vault: VaultUTXOs,
|
|
308
|
-
firstSigner: Signer = this.signer,
|
|
312
|
+
firstSigner: Signer | ECPairInterface = this.signer,
|
|
309
313
|
): Promise<void> {
|
|
310
314
|
const p2wshOutput = this.generateMultiSignRedeemScript(vault.publicKeys, vault.minimum);
|
|
311
315
|
for (const utxo of vault.utxos) {
|
|
@@ -109,7 +109,7 @@ export class UnwrapTransaction extends SharedInteractionTransaction<TransactionT
|
|
|
109
109
|
this.contractSecret = this.generateSecret();
|
|
110
110
|
|
|
111
111
|
this.calldataGenerator = new CalldataGenerator(
|
|
112
|
-
this.signer.publicKey,
|
|
112
|
+
Buffer.from(this.signer.publicKey),
|
|
113
113
|
this.scriptSignerXOnlyPubKey(),
|
|
114
114
|
this.network,
|
|
115
115
|
);
|
|
@@ -372,7 +372,7 @@ export class UnwrapTransaction extends SharedInteractionTransaction<TransactionT
|
|
|
372
372
|
|
|
373
373
|
return [
|
|
374
374
|
this.contractSecret,
|
|
375
|
-
toXOnly(this.signer.publicKey),
|
|
375
|
+
toXOnly(Buffer.from(this.signer.publicKey)),
|
|
376
376
|
input.tapScriptSig[0].signature,
|
|
377
377
|
input.tapScriptSig[1].signature,
|
|
378
378
|
];
|
|
@@ -6,7 +6,6 @@ import { SharedInteractionTransaction } from './SharedInteractionTransaction.js'
|
|
|
6
6
|
import { wBTC } from '../../metadata/contracts/wBTC.js';
|
|
7
7
|
import { ABICoder, Address, BinaryWriter, Selector } from '@btc-vision/bsi-binary';
|
|
8
8
|
import { TransactionBuilder } from './TransactionBuilder.js';
|
|
9
|
-
import { ECPairInterface } from 'ecpair';
|
|
10
9
|
import { WrappedGeneration } from '../../wbtc/WrappedGenerationParameters.js';
|
|
11
10
|
import { BitcoinUtils } from '../../utils/BitcoinUtils.js';
|
|
12
11
|
import { AddressVerificator } from '../../keypair/AddressVerificator.js';
|
|
@@ -94,11 +93,7 @@ export class WrapTransaction extends SharedInteractionTransaction<TransactionTyp
|
|
|
94
93
|
|
|
95
94
|
const receiver: Address =
|
|
96
95
|
parameters.receiver ||
|
|
97
|
-
TransactionBuilder.getFrom(
|
|
98
|
-
parameters.from,
|
|
99
|
-
parameters.signer as ECPairInterface,
|
|
100
|
-
parameters.network,
|
|
101
|
-
);
|
|
96
|
+
TransactionBuilder.getFrom(parameters.from, parameters.signer, parameters.network);
|
|
102
97
|
|
|
103
98
|
parameters.calldata = WrapTransaction.generateMintCalldata(
|
|
104
99
|
parameters.amount,
|
|
@@ -11,7 +11,7 @@ import { ChainId } from '../../network/ChainId.js';
|
|
|
11
11
|
import { varuint } from 'bitcoinjs-lib/src/bufferutils.js';
|
|
12
12
|
|
|
13
13
|
export interface ITweakedTransactionData {
|
|
14
|
-
readonly signer: Signer;
|
|
14
|
+
readonly signer: Signer | ECPairInterface;
|
|
15
15
|
readonly network: Network;
|
|
16
16
|
readonly chainId?: ChainId;
|
|
17
17
|
readonly nonWitnessUtxo?: Buffer;
|
|
@@ -34,11 +34,11 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
34
34
|
/**
|
|
35
35
|
* @description Was the transaction signed?
|
|
36
36
|
*/
|
|
37
|
-
protected signer: Signer;
|
|
37
|
+
protected signer: Signer | ECPairInterface;
|
|
38
38
|
/**
|
|
39
39
|
* @description Tweaked signer
|
|
40
40
|
*/
|
|
41
|
-
protected tweakedSigner?:
|
|
41
|
+
protected tweakedSigner?: ECPairInterface;
|
|
42
42
|
/**
|
|
43
43
|
* @description The network of the transaction
|
|
44
44
|
*/
|
|
@@ -190,7 +190,7 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
190
190
|
transaction: Psbt,
|
|
191
191
|
input: PsbtInput,
|
|
192
192
|
i: number,
|
|
193
|
-
signer: Signer,
|
|
193
|
+
signer: Signer | ECPairInterface,
|
|
194
194
|
sighashTypes: number[],
|
|
195
195
|
): void {
|
|
196
196
|
if (sighashTypes && sighashTypes[0]) input.sighashType = sighashTypes[0];
|
|
@@ -336,9 +336,9 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
336
336
|
/**
|
|
337
337
|
* Returns the signer key.
|
|
338
338
|
* @protected
|
|
339
|
-
* @returns {Signer}
|
|
339
|
+
* @returns {Signer | ECPairInterface}
|
|
340
340
|
*/
|
|
341
|
-
protected getSignerKey(): Signer {
|
|
341
|
+
protected getSignerKey(): Signer | ECPairInterface {
|
|
342
342
|
return this.signer;
|
|
343
343
|
}
|
|
344
344
|
|
|
@@ -354,7 +354,7 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
354
354
|
transaction: Psbt,
|
|
355
355
|
input: PsbtInput,
|
|
356
356
|
i: number,
|
|
357
|
-
signer?: Signer,
|
|
357
|
+
signer?: Signer | ECPairInterface,
|
|
358
358
|
): Promise<void> {
|
|
359
359
|
const signHash =
|
|
360
360
|
this.sighashTypes && this.sighashTypes.length
|
|
@@ -367,7 +367,7 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
367
367
|
if (input.tapInternalKey) {
|
|
368
368
|
if (!this.tweakedSigner) this.tweakSigner();
|
|
369
369
|
|
|
370
|
-
let tweakedSigner:
|
|
370
|
+
let tweakedSigner: ECPairInterface | undefined;
|
|
371
371
|
if (signer !== this.signer) {
|
|
372
372
|
tweakedSigner = this.getTweakedSigner(true, signer);
|
|
373
373
|
} else {
|
|
@@ -481,7 +481,7 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
481
481
|
* @returns {Buffer}
|
|
482
482
|
*/
|
|
483
483
|
protected internalPubKeyToXOnly(): Buffer {
|
|
484
|
-
return toXOnly(this.signer.publicKey);
|
|
484
|
+
return toXOnly(Buffer.from(this.signer.publicKey));
|
|
485
485
|
}
|
|
486
486
|
|
|
487
487
|
/**
|
|
@@ -507,12 +507,12 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
507
507
|
/**
|
|
508
508
|
* Get the tweaked signer
|
|
509
509
|
* @private
|
|
510
|
-
* @returns {
|
|
510
|
+
* @returns {ECPairInterface} The tweaked signer
|
|
511
511
|
*/
|
|
512
512
|
protected getTweakedSigner(
|
|
513
513
|
useTweakedHash: boolean = false,
|
|
514
|
-
signer: Signer = this.signer,
|
|
515
|
-
):
|
|
514
|
+
signer: Signer | ECPairInterface = this.signer,
|
|
515
|
+
): ECPairInterface | undefined {
|
|
516
516
|
const settings: TweakSettings = {
|
|
517
517
|
network: this.network,
|
|
518
518
|
};
|