@btc-vision/transaction 1.6.7 → 1.6.9

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.
@@ -1 +1 @@
1
- export declare const version = "1.6.7";
1
+ export declare const version = "1.6.9";
package/build/_version.js CHANGED
@@ -1 +1 @@
1
- export const version = '1.6.7';
1
+ export const version = '1.6.9';
@@ -7,7 +7,6 @@ import { InteractionTransaction } from './builders/InteractionTransaction.js';
7
7
  import { TransactionBuilder } from './builders/TransactionBuilder.js';
8
8
  import { P2WDADetector } from '../p2wda/P2WDADetector.js';
9
9
  import { InteractionTransactionP2WDA } from './builders/InteractionTransactionP2WDA.js';
10
- import { ChallengeSolution } from '../epoch/ChallengeSolution.js';
11
10
  import { Address } from '../keypair/Address.js';
12
11
  import { BitcoinUtils } from '../utils/BitcoinUtils.js';
13
12
  export class TransactionFactory {
@@ -423,10 +422,7 @@ export class TransactionFactory {
423
422
  finalPreTransaction = preTransaction;
424
423
  if ('getChallenge' in preTransaction &&
425
424
  typeof preTransaction.getChallenge === 'function') {
426
- const result = preTransaction.getChallenge();
427
- if (result instanceof ChallengeSolution) {
428
- challenge = result;
429
- }
425
+ challenge = preTransaction.getChallenge();
430
426
  }
431
427
  iterations++;
432
428
  if (this.debug) {
@@ -240,11 +240,23 @@ export class TransactionBuilder extends TweakedTransaction {
240
240
  ]),
241
241
  };
242
242
  }
243
- if (!input.witnessUtxo && input.nonWitnessUtxo) {
244
- return {
245
- finalScriptSig: bitcoin.script.compile([dummyEcdsaSig, dummyCompressedPubkey]),
246
- finalScriptWitness: undefined,
247
- };
243
+ if (input.witnessUtxo) {
244
+ const script = input.witnessUtxo.script;
245
+ const decompiled = bitcoin.script.decompile(script);
246
+ if (decompiled &&
247
+ decompiled.length === 5 &&
248
+ decompiled[0] === opcodes.OP_DUP &&
249
+ decompiled[1] === opcodes.OP_HASH160 &&
250
+ decompiled[3] === opcodes.OP_EQUALVERIFY &&
251
+ decompiled[4] === opcodes.OP_CHECKSIG) {
252
+ return {
253
+ finalScriptSig: bitcoin.script.compile([
254
+ dummyEcdsaSig,
255
+ dummyCompressedPubkey,
256
+ ]),
257
+ finalScriptWitness: undefined,
258
+ };
259
+ }
248
260
  }
249
261
  if (input.witnessScript) {
250
262
  if (this.csvInputIndices.has(inputIndex)) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@btc-vision/transaction",
3
3
  "type": "module",
4
- "version": "1.6.7",
4
+ "version": "1.6.9",
5
5
  "author": "BlobMaster41",
6
6
  "description": "OPNet transaction library allows you to create and sign transactions for the OPNet network.",
7
7
  "engines": {
package/src/_version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '1.6.7';
1
+ export const version = '1.6.9';
@@ -703,10 +703,7 @@ export class TransactionFactory {
703
703
  'getChallenge' in preTransaction &&
704
704
  typeof preTransaction.getChallenge === 'function'
705
705
  ) {
706
- const result = preTransaction.getChallenge();
707
- if (result instanceof ChallengeSolution) {
708
- challenge = result;
709
- }
706
+ challenge = preTransaction.getChallenge();
710
707
  }
711
708
 
712
709
  iterations++;
@@ -523,11 +523,25 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
523
523
  };
524
524
  }
525
525
 
526
- if (!input.witnessUtxo && input.nonWitnessUtxo) {
527
- return {
528
- finalScriptSig: bitcoin.script.compile([dummyEcdsaSig, dummyCompressedPubkey]),
529
- finalScriptWitness: undefined,
530
- };
526
+ if (input.witnessUtxo) {
527
+ const script = input.witnessUtxo.script;
528
+ const decompiled = bitcoin.script.decompile(script);
529
+ if (
530
+ decompiled &&
531
+ decompiled.length === 5 &&
532
+ decompiled[0] === opcodes.OP_DUP &&
533
+ decompiled[1] === opcodes.OP_HASH160 &&
534
+ decompiled[3] === opcodes.OP_EQUALVERIFY &&
535
+ decompiled[4] === opcodes.OP_CHECKSIG
536
+ ) {
537
+ return {
538
+ finalScriptSig: bitcoin.script.compile([
539
+ dummyEcdsaSig,
540
+ dummyCompressedPubkey,
541
+ ]),
542
+ finalScriptWitness: undefined,
543
+ };
544
+ }
531
545
  }
532
546
 
533
547
  if (input.witnessScript) {