@btc-vision/transaction 1.8.0-beta.1 → 1.8.0-beta.3
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 +1862 -2431
- package/browser/index.js +90 -90
- package/browser/noble-curves.js +2006 -2150
- package/browser/noble-hashes.js +2761 -1003
- package/browser/vendors.js +5354 -5123
- package/build/keypair/Address.js +1 -1
- package/build/keypair/EcKeyPair.js +7 -7
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/src/crypto/crypto-browser.js +3 -4
- package/src/keypair/Address.ts +1 -1
- package/src/keypair/EcKeyPair.ts +7 -7
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@btc-vision/transaction",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.8.0-beta.
|
|
4
|
+
"version": "1.8.0-beta.3",
|
|
5
5
|
"author": "BlobMaster41",
|
|
6
6
|
"description": "OPNet transaction library allows you to create and sign transactions for the OPNet network.",
|
|
7
7
|
"engines": {
|
|
@@ -156,15 +156,15 @@
|
|
|
156
156
|
"@babel/preset-react": "^7.28.5",
|
|
157
157
|
"@babel/preset-typescript": "^7.28.5",
|
|
158
158
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
159
|
-
"@types/node": "^25.0.
|
|
159
|
+
"@types/node": "^25.0.10",
|
|
160
160
|
"@types/sha.js": "^2.4.4",
|
|
161
161
|
"@vitejs/plugin-legacy": "^7.2.1",
|
|
162
|
-
"@vitest/ui": "^4.0.
|
|
162
|
+
"@vitest/ui": "^4.0.18",
|
|
163
163
|
"eslint": "^9.39.2",
|
|
164
164
|
"https-browserify": "^1.0.0",
|
|
165
165
|
"madge": "^8.0.0",
|
|
166
166
|
"os-browserify": "^0.3.0",
|
|
167
|
-
"prettier": "^3.8.
|
|
167
|
+
"prettier": "^3.8.1",
|
|
168
168
|
"stream-browserify": "^3.0.0",
|
|
169
169
|
"stream-http": "^3.2.0",
|
|
170
170
|
"tslib": "^2.8.1",
|
|
@@ -173,18 +173,18 @@
|
|
|
173
173
|
"vite": "^7.3.1",
|
|
174
174
|
"vite-plugin-dts": "^4.5.4",
|
|
175
175
|
"vite-plugin-node-polyfills": "^0.25.0",
|
|
176
|
-
"vitest": "^4.0.
|
|
176
|
+
"vitest": "^4.0.18"
|
|
177
177
|
},
|
|
178
178
|
"dependencies": {
|
|
179
179
|
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
|
|
180
180
|
"@bitcoinerlab/secp256k1": "^1.2.0",
|
|
181
|
-
"@btc-vision/bip32": "^6.0
|
|
182
|
-
"@btc-vision/bitcoin": "^6.5.
|
|
181
|
+
"@btc-vision/bip32": "^6.1.0",
|
|
182
|
+
"@btc-vision/bitcoin": "^6.5.6",
|
|
183
183
|
"@btc-vision/bitcoin-rpc": "^1.0.6",
|
|
184
184
|
"@btc-vision/logger": "^1.0.8",
|
|
185
185
|
"@btc-vision/post-quantum": "^0.5.3",
|
|
186
186
|
"@eslint/js": "^9.39.2",
|
|
187
|
-
"@noble/curves": "^
|
|
187
|
+
"@noble/curves": "^2.0.1",
|
|
188
188
|
"@noble/secp256k1": "^3.0.0",
|
|
189
189
|
"assert": "^2.1.0",
|
|
190
190
|
"babel-loader": "^10.0.0",
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/* Browser Crypto Shims */
|
|
2
|
-
import { hmac } from '@noble/hashes/hmac';
|
|
3
|
-
import { pbkdf2 } from '@noble/hashes/pbkdf2';
|
|
4
|
-
import { sha256 } from '@noble/hashes/
|
|
5
|
-
import { sha512 } from '@noble/hashes/sha512';
|
|
2
|
+
import { hmac } from '@noble/hashes/hmac.js';
|
|
3
|
+
import { pbkdf2 } from '@noble/hashes/pbkdf2.js';
|
|
4
|
+
import { sha256, sha512 } from '@noble/hashes/sha2.js';
|
|
6
5
|
|
|
7
6
|
function assertArgument(check, message, name, value) {
|
|
8
7
|
if (!check) {
|
package/src/keypair/Address.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { BitcoinUtils } from '../utils/BitcoinUtils.js';
|
|
|
8
8
|
import { TimeLockGenerator } from '../transaction/mineable/TimelockGenerator.js';
|
|
9
9
|
import { IP2WSHAddress } from '../transaction/mineable/IP2WSHAddress.js';
|
|
10
10
|
import { P2WDADetector } from '../p2wda/P2WDADetector.js';
|
|
11
|
-
import { sha256 } from '@noble/hashes/sha2';
|
|
11
|
+
import { sha256 } from '@noble/hashes/sha2.js';
|
|
12
12
|
import { MLDSASecurityLevel } from '@btc-vision/bip32';
|
|
13
13
|
|
|
14
14
|
/**
|
package/src/keypair/EcKeyPair.ts
CHANGED
|
@@ -21,10 +21,10 @@ import bitcoin, {
|
|
|
21
21
|
} from '@btc-vision/bitcoin';
|
|
22
22
|
import { ECPairAPI, ECPairFactory, ECPairInterface } from 'ecpair';
|
|
23
23
|
import { IWallet } from './interfaces/IWallet.js';
|
|
24
|
-
import { secp256k1 } from '@noble/curves/secp256k1';
|
|
25
|
-
import { mod } from '@noble/curves/abstract/modular';
|
|
26
|
-
import { sha256 } from '@noble/hashes/sha2';
|
|
27
|
-
import { bytesToNumberBE, concatBytes, randomBytes
|
|
24
|
+
import { secp256k1 } from '@noble/curves/secp256k1.js';
|
|
25
|
+
import { mod } from '@noble/curves/abstract/modular.js';
|
|
26
|
+
import { sha256 } from '@noble/hashes/sha2.js';
|
|
27
|
+
import { bytesToNumberBE, concatBytes, randomBytes } from '@noble/curves/utils.js';
|
|
28
28
|
import { Buffer } from 'buffer';
|
|
29
29
|
|
|
30
30
|
initEccLib(ecc);
|
|
@@ -37,7 +37,7 @@ if (!BIP32factory) {
|
|
|
37
37
|
const Point = secp256k1.Point;
|
|
38
38
|
const CURVE_N = Point.Fn.ORDER;
|
|
39
39
|
|
|
40
|
-
const TAP_TAG =
|
|
40
|
+
const TAP_TAG = Buffer.from('TapTweak', 'utf-8');
|
|
41
41
|
const TAP_TAG_HASH = sha256(TAP_TAG);
|
|
42
42
|
|
|
43
43
|
function tapTweakHash(x: Uint8Array): Uint8Array {
|
|
@@ -282,7 +282,7 @@ export class EcKeyPair {
|
|
|
282
282
|
public static tweakPublicKey(pub: Uint8Array | Buffer | string): Buffer {
|
|
283
283
|
if (typeof pub === 'string' && pub.startsWith('0x')) pub = pub.slice(2);
|
|
284
284
|
|
|
285
|
-
const P = Point.fromHex(pub);
|
|
285
|
+
const P = Point.fromHex(Buffer.from(pub).toString('hex'));
|
|
286
286
|
const Peven = (P.y & 1n) === 0n ? P : P.negate();
|
|
287
287
|
|
|
288
288
|
const xBytes = Buffer.from(Peven.toBytes(true).subarray(1));
|
|
@@ -306,7 +306,7 @@ export class EcKeyPair {
|
|
|
306
306
|
const T = Point.BASE.multiply(tweakScalar);
|
|
307
307
|
|
|
308
308
|
return pubkeys.map((bytes) => {
|
|
309
|
-
const P = Point.fromHex(bytes);
|
|
309
|
+
const P = Point.fromHex(Buffer.from(bytes).toString('hex'));
|
|
310
310
|
const P_even = P.y % 2n === 0n ? P : P.negate();
|
|
311
311
|
const Q = P_even.add(T);
|
|
312
312
|
return Q.toBytes(true);
|