@btc-vision/transaction 1.7.12 → 1.7.13
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/build/_version.d.ts +1 -1
- package/build/_version.js +1 -1
- package/build/keypair/Wallet.js +1 -2
- package/build/mnemonic/Mnemonic.js +3 -3
- package/package.json +2 -2
- package/src/_version.ts +1 -1
- package/src/keypair/Wallet.ts +2 -2
- package/src/mnemonic/Mnemonic.ts +3 -0
package/build/_version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.7.
|
|
1
|
+
export declare const version = "1.7.13";
|
package/build/_version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '1.7.
|
|
1
|
+
export const version = '1.7.13';
|
package/build/keypair/Wallet.js
CHANGED
|
@@ -4,7 +4,6 @@ import { Address } from './Address.js';
|
|
|
4
4
|
import { BitcoinUtils } from '../utils/BitcoinUtils.js';
|
|
5
5
|
import * as ecc from '@bitcoinerlab/secp256k1';
|
|
6
6
|
import { getMLDSAConfig, MLDSASecurityLevel, QuantumBIP32Factory, } from '@btc-vision/bip32';
|
|
7
|
-
import { randomBytes } from 'crypto';
|
|
8
7
|
initEccLib(ecc);
|
|
9
8
|
export class Wallet {
|
|
10
9
|
constructor(privateKeyOrWif, mldsaPrivateKeyOrBase58, network = networks.bitcoin, securityLevel = MLDSASecurityLevel.LEVEL2, chainCode) {
|
|
@@ -41,7 +40,7 @@ export class Wallet {
|
|
|
41
40
|
if (chainCode && chainCode.length !== 32) {
|
|
42
41
|
throw new Error('Chain code must be 32 bytes');
|
|
43
42
|
}
|
|
44
|
-
this._chainCode = chainCode ||
|
|
43
|
+
this._chainCode = chainCode || Buffer.alloc(32);
|
|
45
44
|
this._mldsaKeypair = QuantumBIP32Factory.fromPrivateKey(mldsaPrivateKeyBuffer, this._chainCode, this.network, securityLevel);
|
|
46
45
|
}
|
|
47
46
|
else {
|
|
@@ -55,7 +55,7 @@ export class Mnemonic {
|
|
|
55
55
|
if (!quantumChild.privateKey) {
|
|
56
56
|
throw new Error(`Failed to derive quantum private key at index ${index}`);
|
|
57
57
|
}
|
|
58
|
-
return new Wallet(Buffer.from(classicalChild.privateKey).toString('hex'), Buffer.from(quantumChild.privateKey).toString('hex'), this._network, this._securityLevel);
|
|
58
|
+
return new Wallet(Buffer.from(classicalChild.privateKey).toString('hex'), Buffer.from(quantumChild.privateKey).toString('hex'), this._network, this._securityLevel, Buffer.from(this._quantumRoot.chainCode));
|
|
59
59
|
}
|
|
60
60
|
deriveUnisat(addressType = AddressTypes.P2TR, index = 0, account = 0, isChange = false) {
|
|
61
61
|
let purpose;
|
|
@@ -87,7 +87,7 @@ export class Mnemonic {
|
|
|
87
87
|
if (!quantumChild.privateKey) {
|
|
88
88
|
throw new Error(`Failed to derive quantum private key at path ${quantumPath}`);
|
|
89
89
|
}
|
|
90
|
-
return new Wallet(Buffer.from(classicalChild.privateKey).toString('hex'), Buffer.from(quantumChild.privateKey).toString('hex'), this._network, this._securityLevel);
|
|
90
|
+
return new Wallet(Buffer.from(classicalChild.privateKey).toString('hex'), Buffer.from(quantumChild.privateKey).toString('hex'), this._network, this._securityLevel, Buffer.from(this._quantumRoot.chainCode));
|
|
91
91
|
}
|
|
92
92
|
deriveMultipleUnisat(addressType = AddressTypes.P2TR, count = 5, startIndex = 0, account = 0, isChange = false) {
|
|
93
93
|
const wallets = [];
|
|
@@ -112,7 +112,7 @@ export class Mnemonic {
|
|
|
112
112
|
if (!quantumChild.privateKey) {
|
|
113
113
|
throw new Error(`Failed to derive quantum private key at path ${quantumPath}`);
|
|
114
114
|
}
|
|
115
|
-
return new Wallet(Buffer.from(classicalChild.privateKey).toString('hex'), Buffer.from(quantumChild.privateKey).toString('hex'), this._network, this._securityLevel);
|
|
115
|
+
return new Wallet(Buffer.from(classicalChild.privateKey).toString('hex'), Buffer.from(quantumChild.privateKey).toString('hex'), this._network, this._securityLevel, Buffer.from(this._quantumRoot.chainCode));
|
|
116
116
|
}
|
|
117
117
|
getClassicalRoot() {
|
|
118
118
|
return this._classicalRoot;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@btc-vision/transaction",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.7.
|
|
4
|
+
"version": "1.7.13",
|
|
5
5
|
"author": "BlobMaster41",
|
|
6
6
|
"description": "OPNet transaction library allows you to create and sign transactions for the OPNet network.",
|
|
7
7
|
"engines": {
|
|
@@ -95,13 +95,13 @@
|
|
|
95
95
|
"dependencies": {
|
|
96
96
|
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
|
|
97
97
|
"@bitcoinerlab/secp256k1": "^1.2.0",
|
|
98
|
-
"@noble/curves": "^1.9.7",
|
|
99
98
|
"@btc-vision/bip32": "^6.0.3",
|
|
100
99
|
"@btc-vision/bitcoin": "^6.4.11",
|
|
101
100
|
"@btc-vision/bitcoin-rpc": "^1.0.5",
|
|
102
101
|
"@btc-vision/logger": "^1.0.7",
|
|
103
102
|
"@btc-vision/post-quantum": "^0.5.3",
|
|
104
103
|
"@eslint/js": "^9.39.1",
|
|
104
|
+
"@noble/curves": "^1.9.7",
|
|
105
105
|
"@noble/secp256k1": "^3.0.0",
|
|
106
106
|
"assert": "^2.1.0",
|
|
107
107
|
"babel-loader": "^10.0.0",
|
package/src/_version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '1.7.
|
|
1
|
+
export const version = '1.7.13';
|
package/src/keypair/Wallet.ts
CHANGED
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
QuantumBIP32Factory,
|
|
12
12
|
QuantumBIP32Interface,
|
|
13
13
|
} from '@btc-vision/bip32';
|
|
14
|
-
import { randomBytes } from 'crypto';
|
|
15
14
|
|
|
16
15
|
initEccLib(ecc);
|
|
17
16
|
|
|
@@ -168,7 +167,8 @@ export class Wallet {
|
|
|
168
167
|
if (chainCode && chainCode.length !== 32) {
|
|
169
168
|
throw new Error('Chain code must be 32 bytes');
|
|
170
169
|
}
|
|
171
|
-
|
|
170
|
+
|
|
171
|
+
this._chainCode = chainCode || Buffer.alloc(32);
|
|
172
172
|
|
|
173
173
|
// Create QuantumBIP32Interface from private key and chain code
|
|
174
174
|
// Pass network to ensure network-specific derivation
|
package/src/mnemonic/Mnemonic.ts
CHANGED
|
@@ -244,6 +244,7 @@ export class Mnemonic {
|
|
|
244
244
|
Buffer.from(quantumChild.privateKey).toString('hex'),
|
|
245
245
|
this._network,
|
|
246
246
|
this._securityLevel,
|
|
247
|
+
Buffer.from(this._quantumRoot.chainCode),
|
|
247
248
|
);
|
|
248
249
|
}
|
|
249
250
|
|
|
@@ -313,6 +314,7 @@ export class Mnemonic {
|
|
|
313
314
|
Buffer.from(quantumChild.privateKey).toString('hex'),
|
|
314
315
|
this._network,
|
|
315
316
|
this._securityLevel,
|
|
317
|
+
Buffer.from(this._quantumRoot.chainCode),
|
|
316
318
|
);
|
|
317
319
|
}
|
|
318
320
|
|
|
@@ -393,6 +395,7 @@ export class Mnemonic {
|
|
|
393
395
|
Buffer.from(quantumChild.privateKey).toString('hex'),
|
|
394
396
|
this._network,
|
|
395
397
|
this._securityLevel,
|
|
398
|
+
Buffer.from(this._quantumRoot.chainCode),
|
|
396
399
|
);
|
|
397
400
|
}
|
|
398
401
|
|