@btc-vision/transaction 1.8.0-beta.0 → 1.8.0-beta.1
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 +941 -933
- package/browser/keypair/EcKeyPair.d.ts +1 -0
- package/build/_version.d.ts +1 -1
- package/build/_version.js +1 -1
- package/build/keypair/EcKeyPair.d.ts +1 -0
- package/build/keypair/EcKeyPair.js +9 -0
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/_version.ts +1 -1
- package/src/keypair/EcKeyPair.ts +12 -1
|
@@ -2,6 +2,7 @@ import { BIP32API, BIP32Interface, MLDSAKeyPair, MLDSASecurityLevel } from '../.
|
|
|
2
2
|
import { Network, Signer } from '../../node_modules/@btc-vision/bitcoin/build/index.js';
|
|
3
3
|
import { ECPairAPI, ECPairInterface } from 'ecpair';
|
|
4
4
|
import { IWallet } from './interfaces/IWallet.js';
|
|
5
|
+
import { Buffer } from '../../buffer';
|
|
5
6
|
export declare class EcKeyPair {
|
|
6
7
|
static BIP32: BIP32API;
|
|
7
8
|
static ECPair: ECPairAPI;
|
package/build/_version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.8.0-beta.
|
|
1
|
+
export declare const version = "1.8.0-beta.1";
|
package/build/_version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '1.8.0-beta.
|
|
1
|
+
export const version = '1.8.0-beta.1';
|
|
@@ -2,6 +2,7 @@ import { BIP32API, BIP32Interface, MLDSAKeyPair, MLDSASecurityLevel } from '@btc
|
|
|
2
2
|
import { Network, Signer } from '@btc-vision/bitcoin';
|
|
3
3
|
import { ECPairAPI, ECPairInterface } from 'ecpair';
|
|
4
4
|
import { IWallet } from './interfaces/IWallet.js';
|
|
5
|
+
import { Buffer } from 'buffer';
|
|
5
6
|
export declare class EcKeyPair {
|
|
6
7
|
static BIP32: BIP32API;
|
|
7
8
|
static ECPair: ECPairAPI;
|
|
@@ -6,6 +6,7 @@ import { secp256k1 } from '@noble/curves/secp256k1';
|
|
|
6
6
|
import { mod } from '@noble/curves/abstract/modular';
|
|
7
7
|
import { sha256 } from '@noble/hashes/sha2';
|
|
8
8
|
import { bytesToNumberBE, concatBytes, randomBytes, utf8ToBytes } from '@noble/curves/utils.js';
|
|
9
|
+
import { Buffer } from 'buffer';
|
|
9
10
|
initEccLib(ecc);
|
|
10
11
|
const BIP32factory = typeof bip32 === 'function' ? bip32 : BIP32Factory;
|
|
11
12
|
if (!BIP32factory) {
|
|
@@ -131,6 +132,10 @@ export class EcKeyPair {
|
|
|
131
132
|
static generateWallet(network = networks.bitcoin, securityLevel = MLDSASecurityLevel.LEVEL2) {
|
|
132
133
|
const keyPair = this.ECPair.makeRandom({
|
|
133
134
|
network: network,
|
|
135
|
+
rng: (size) => {
|
|
136
|
+
const bytes = randomBytes(size);
|
|
137
|
+
return Buffer.from(bytes);
|
|
138
|
+
},
|
|
134
139
|
});
|
|
135
140
|
const wallet = this.getP2WPKHAddress(keyPair, network);
|
|
136
141
|
if (!wallet) {
|
|
@@ -193,6 +198,10 @@ export class EcKeyPair {
|
|
|
193
198
|
static generateRandomKeyPair(network = networks.bitcoin) {
|
|
194
199
|
return this.ECPair.makeRandom({
|
|
195
200
|
network: network,
|
|
201
|
+
rng: (size) => {
|
|
202
|
+
const bytes = randomBytes(size);
|
|
203
|
+
return Buffer.from(bytes);
|
|
204
|
+
},
|
|
196
205
|
});
|
|
197
206
|
}
|
|
198
207
|
static fromSeed(seed, network = networks.bitcoin) {
|