@btc-vision/transaction 1.6.17 → 1.6.19
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/transaction/browser/types/Unisat.d.ts +1 -1
- package/browser/transaction/shared/TweakedTransaction.d.ts +1 -1
- package/build/_version.d.ts +1 -1
- package/build/_version.js +1 -1
- package/build/abi/ABICoder.js +1 -1
- package/build/buffer/BinaryReader.js +1 -1
- package/build/keypair/EcKeyPair.js +2 -2
- package/build/transaction/browser/types/Unisat.d.ts +1 -1
- package/build/transaction/browser/types/Unisat.js +1 -1
- package/build/transaction/builders/InteractionTransactionP2WDA.js +1 -1
- package/build/transaction/shared/TweakedTransaction.d.ts +1 -1
- package/build/transaction/shared/TweakedTransaction.js +3 -3
- package/package.json +6 -6
- package/src/_version.ts +1 -1
- package/src/abi/ABICoder.ts +1 -1
- package/src/buffer/BinaryReader.ts +1 -1
- package/src/keypair/EcKeyPair.ts +2 -2
- package/src/transaction/browser/types/Unisat.ts +1 -1
- package/src/transaction/builders/InteractionTransactionP2WDA.ts +1 -1
- package/src/transaction/shared/TweakedTransaction.ts +3 -3
|
@@ -48,7 +48,7 @@ export declare abstract class TweakedTransaction extends Logger {
|
|
|
48
48
|
protected unlockScript: Buffer[] | undefined;
|
|
49
49
|
protected txVersion: SupportedTransactionVersion;
|
|
50
50
|
protected constructor(data: ITweakedTransactionData);
|
|
51
|
-
static readScriptWitnessToWitnessStack(
|
|
51
|
+
static readScriptWitnessToWitnessStack(buffer: Buffer): Buffer[];
|
|
52
52
|
static preEstimateTaprootTransactionFees(feeRate: bigint, numInputs: bigint, numOutputs: bigint, numWitnessElements: bigint, witnessElementSize: bigint, emptyWitness: bigint, taprootControlWitnessSize?: bigint, taprootScriptSize?: bigint): bigint;
|
|
53
53
|
protected static signInput(transaction: Psbt, input: PsbtInput, i: number, signer: Signer | ECPairInterface, sighashTypes: number[]): void;
|
|
54
54
|
protected static calculateSignHash(sighashTypes: number[]): number;
|
package/build/_version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.6.
|
|
1
|
+
export declare const version = "1.6.19";
|
package/build/_version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '1.6.
|
|
1
|
+
export const version = '1.6.19';
|
package/build/abi/ABICoder.js
CHANGED
|
@@ -113,7 +113,7 @@ export class ABICoder {
|
|
|
113
113
|
}
|
|
114
114
|
encodeSelector(selectorIdentifier) {
|
|
115
115
|
const hash = this.sha256(selectorIdentifier);
|
|
116
|
-
const selector = hash.subarray(0, 4);
|
|
116
|
+
const selector = Buffer.from(hash.subarray(0, 4));
|
|
117
117
|
return selector.toString('hex');
|
|
118
118
|
}
|
|
119
119
|
numericSelectorToHex(selector) {
|
|
@@ -99,7 +99,7 @@ export class BinaryReader {
|
|
|
99
99
|
for (let i = 0; i < length; i++) {
|
|
100
100
|
const b = this.buffer.getUint8(this.currentOffset++);
|
|
101
101
|
if (zeroStop && b === 0) {
|
|
102
|
-
bytes = bytes.subarray(0, i);
|
|
102
|
+
bytes = Buffer.from(bytes.subarray(0, i));
|
|
103
103
|
break;
|
|
104
104
|
}
|
|
105
105
|
bytes[i] = b;
|
|
@@ -3,9 +3,9 @@ import bip32, { BIP32Factory } from 'bip32';
|
|
|
3
3
|
import bitcoin, { address, fromOutputScript, initEccLib, networks, opcodes, payments, script, toXOnly, } from '@btc-vision/bitcoin';
|
|
4
4
|
import { ECPairFactory } from 'ecpair';
|
|
5
5
|
import { secp256k1 } from '@noble/curves/secp256k1';
|
|
6
|
-
import { bytesToNumberBE, concatBytes, utf8ToBytes } from '@noble/curves/abstract/utils';
|
|
7
6
|
import { mod } from '@noble/curves/abstract/modular';
|
|
8
7
|
import { sha256 } from '@noble/hashes/sha2';
|
|
8
|
+
import { bytesToNumberBE, concatBytes, utf8ToBytes } from '@noble/curves/utils.js';
|
|
9
9
|
initEccLib(ecc);
|
|
10
10
|
const BIP32factory = typeof bip32 === 'function' ? bip32 : BIP32Factory;
|
|
11
11
|
if (!BIP32factory) {
|
|
@@ -113,7 +113,7 @@ export class EcKeyPair {
|
|
|
113
113
|
pub = pub.slice(2);
|
|
114
114
|
const P = Point.fromHex(pub);
|
|
115
115
|
const Peven = (P.y & 1n) === 0n ? P : P.negate();
|
|
116
|
-
const xBytes = Peven.toBytes(true).subarray(1);
|
|
116
|
+
const xBytes = Buffer.from(Peven.toBytes(true).subarray(1));
|
|
117
117
|
const tBytes = tapTweakHash(xBytes);
|
|
118
118
|
const t = mod(bytesToNumberBE(tBytes), CURVE_N);
|
|
119
119
|
const Q = Peven.add(Point.BASE.multiply(t));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export var UnisatNetwork;
|
|
2
2
|
(function (UnisatNetwork) {
|
|
3
3
|
UnisatNetwork["testnet"] = "testnet";
|
|
4
|
-
UnisatNetwork["mainnet"] = "
|
|
4
|
+
UnisatNetwork["mainnet"] = "mainnet";
|
|
5
5
|
UnisatNetwork["regtest"] = "regtest";
|
|
6
6
|
})(UnisatNetwork || (UnisatNetwork = {}));
|
|
7
7
|
export var UnisatChainType;
|
|
@@ -178,7 +178,7 @@ export class InteractionTransactionP2WDA extends TransactionBuilder {
|
|
|
178
178
|
let offset = 0;
|
|
179
179
|
while (offset < data.length) {
|
|
180
180
|
const size = Math.min(InteractionTransactionP2WDA.MAX_BYTES_PER_WITNESS, data.length - offset);
|
|
181
|
-
chunks.push(data.subarray(offset, offset + size));
|
|
181
|
+
chunks.push(Buffer.from(data.subarray(offset, offset + size)));
|
|
182
182
|
offset += size;
|
|
183
183
|
}
|
|
184
184
|
return chunks;
|
|
@@ -48,7 +48,7 @@ export declare abstract class TweakedTransaction extends Logger {
|
|
|
48
48
|
protected unlockScript: Buffer[] | undefined;
|
|
49
49
|
protected txVersion: SupportedTransactionVersion;
|
|
50
50
|
protected constructor(data: ITweakedTransactionData);
|
|
51
|
-
static readScriptWitnessToWitnessStack(
|
|
51
|
+
static readScriptWitnessToWitnessStack(buffer: Buffer): Buffer[];
|
|
52
52
|
static preEstimateTaprootTransactionFees(feeRate: bigint, numInputs: bigint, numOutputs: bigint, numWitnessElements: bigint, witnessElementSize: bigint, emptyWitness: bigint, taprootControlWitnessSize?: bigint, taprootScriptSize?: bigint): bigint;
|
|
53
53
|
protected static signInput(transaction: Psbt, input: PsbtInput, i: number, signer: Signer | ECPairInterface, sighashTypes: number[]): void;
|
|
54
54
|
protected static calculateSignHash(sighashTypes: number[]): number;
|
|
@@ -79,15 +79,15 @@ export class TweakedTransaction extends Logger {
|
|
|
79
79
|
this.txVersion = data.txVersion;
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
static readScriptWitnessToWitnessStack(
|
|
82
|
+
static readScriptWitnessToWitnessStack(buffer) {
|
|
83
83
|
let offset = 0;
|
|
84
84
|
function readSlice(n) {
|
|
85
|
-
const slice = Buffer.subarray(offset, offset + n);
|
|
85
|
+
const slice = Buffer.from(buffer.subarray(offset, offset + n));
|
|
86
86
|
offset += n;
|
|
87
87
|
return slice;
|
|
88
88
|
}
|
|
89
89
|
function readVarInt() {
|
|
90
|
-
const varint = varuint.decode(
|
|
90
|
+
const varint = varuint.decode(buffer, offset);
|
|
91
91
|
offset += varint.bytes;
|
|
92
92
|
return varint.numberValue || 0;
|
|
93
93
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@btc-vision/transaction",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.6.
|
|
4
|
+
"version": "1.6.19",
|
|
5
5
|
"author": "BlobMaster41",
|
|
6
6
|
"description": "OPNet transaction library allows you to create and sign transactions for the OPNet network.",
|
|
7
7
|
"engines": {
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"@babel/preset-typescript": "^7.27.1",
|
|
74
74
|
"@types/node": "^24.2.1",
|
|
75
75
|
"@types/sha.js": "^2.4.4",
|
|
76
|
-
"eslint": "
|
|
76
|
+
"eslint": "9.38.0",
|
|
77
77
|
"gulp": "^5.0.1",
|
|
78
78
|
"gulp-cached": "^1.1.1",
|
|
79
79
|
"gulp-typescript": "^6.0.0-alpha.1",
|
|
@@ -89,10 +89,10 @@
|
|
|
89
89
|
"dependencies": {
|
|
90
90
|
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
|
|
91
91
|
"@bitcoinerlab/secp256k1": "^1.2.0",
|
|
92
|
-
"@btc-vision/bitcoin": "^6.4.
|
|
93
|
-
"@btc-vision/bitcoin-rpc": "^1.0.
|
|
94
|
-
"@btc-vision/logger": "^1.0.
|
|
95
|
-
"@eslint/js": "
|
|
92
|
+
"@btc-vision/bitcoin": "^6.4.11",
|
|
93
|
+
"@btc-vision/bitcoin-rpc": "^1.0.5",
|
|
94
|
+
"@btc-vision/logger": "^1.0.7",
|
|
95
|
+
"@eslint/js": "9.38.0",
|
|
96
96
|
"@noble/secp256k1": "^2.3.0",
|
|
97
97
|
"assert": "^2.1.0",
|
|
98
98
|
"babel-loader": "^10.0.0",
|
package/src/_version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '1.6.
|
|
1
|
+
export const version = '1.6.19';
|
package/src/abi/ABICoder.ts
CHANGED
|
@@ -119,7 +119,7 @@ export class ABICoder {
|
|
|
119
119
|
public encodeSelector(selectorIdentifier: string): string {
|
|
120
120
|
// first 4 bytes of sha256 hash of the function signature
|
|
121
121
|
const hash = this.sha256(selectorIdentifier);
|
|
122
|
-
const selector = hash.subarray(0, 4); // 4 bytes
|
|
122
|
+
const selector = Buffer.from(hash.subarray(0, 4)); // 4 bytes
|
|
123
123
|
|
|
124
124
|
return selector.toString('hex');
|
|
125
125
|
}
|
|
@@ -170,7 +170,7 @@ export class BinaryReader {
|
|
|
170
170
|
for (let i: u32 = 0; i < length; i++) {
|
|
171
171
|
const b = this.buffer.getUint8(this.currentOffset++);
|
|
172
172
|
if (zeroStop && b === 0) {
|
|
173
|
-
bytes = bytes.subarray(0, i);
|
|
173
|
+
bytes = Buffer.from(bytes.subarray(0, i));
|
|
174
174
|
break;
|
|
175
175
|
}
|
|
176
176
|
bytes[i] = b;
|
package/src/keypair/EcKeyPair.ts
CHANGED
|
@@ -15,9 +15,9 @@ import bitcoin, {
|
|
|
15
15
|
import { ECPairAPI, ECPairFactory, ECPairInterface } from 'ecpair';
|
|
16
16
|
import { IWallet } from './interfaces/IWallet.js';
|
|
17
17
|
import { secp256k1 } from '@noble/curves/secp256k1';
|
|
18
|
-
import { bytesToNumberBE, concatBytes, utf8ToBytes } from '@noble/curves/abstract/utils';
|
|
19
18
|
import { mod } from '@noble/curves/abstract/modular';
|
|
20
19
|
import { sha256 } from '@noble/hashes/sha2';
|
|
20
|
+
import { bytesToNumberBE, concatBytes, utf8ToBytes } from '@noble/curves/utils.js';
|
|
21
21
|
|
|
22
22
|
initEccLib(ecc);
|
|
23
23
|
|
|
@@ -277,7 +277,7 @@ export class EcKeyPair {
|
|
|
277
277
|
const P = Point.fromHex(pub);
|
|
278
278
|
const Peven = (P.y & 1n) === 0n ? P : P.negate();
|
|
279
279
|
|
|
280
|
-
const xBytes = Peven.toBytes(true).subarray(1);
|
|
280
|
+
const xBytes = Buffer.from(Peven.toBytes(true).subarray(1));
|
|
281
281
|
const tBytes = tapTweakHash(xBytes);
|
|
282
282
|
const t = mod(bytesToNumberBE(tBytes), CURVE_N);
|
|
283
283
|
|
|
@@ -345,7 +345,7 @@ export class InteractionTransactionP2WDA extends TransactionBuilder<TransactionT
|
|
|
345
345
|
InteractionTransactionP2WDA.MAX_BYTES_PER_WITNESS,
|
|
346
346
|
data.length - offset,
|
|
347
347
|
);
|
|
348
|
-
chunks.push(data.subarray(offset, offset + size));
|
|
348
|
+
chunks.push(Buffer.from(data.subarray(offset, offset + size)));
|
|
349
349
|
offset += size;
|
|
350
350
|
}
|
|
351
351
|
|
|
@@ -182,17 +182,17 @@ export abstract class TweakedTransaction extends Logger {
|
|
|
182
182
|
* Read witnesses
|
|
183
183
|
* @protected
|
|
184
184
|
*/
|
|
185
|
-
public static readScriptWitnessToWitnessStack(
|
|
185
|
+
public static readScriptWitnessToWitnessStack(buffer: Buffer): Buffer[] {
|
|
186
186
|
let offset = 0;
|
|
187
187
|
|
|
188
188
|
function readSlice(n: number): Buffer {
|
|
189
|
-
const slice = Buffer.subarray(offset, offset + n);
|
|
189
|
+
const slice = Buffer.from(buffer.subarray(offset, offset + n));
|
|
190
190
|
offset += n;
|
|
191
191
|
return slice;
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
function readVarInt(): number {
|
|
195
|
-
const varint = varuint.decode(
|
|
195
|
+
const varint = varuint.decode(buffer, offset);
|
|
196
196
|
offset += varint.bytes;
|
|
197
197
|
return varint.numberValue || 0;
|
|
198
198
|
}
|