@xchainjs/xchain-dash 2.0.1 → 2.0.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.
@@ -1,7 +1,7 @@
1
1
  import { FeeRate, TxHash } from '@xchainjs/xchain-client';
2
2
  import { Address } from '@xchainjs/xchain-util';
3
3
  import { TxParams } from '@xchainjs/xchain-utxo';
4
- import * as Dash from 'bitcoinjs-lib';
4
+ import { ECPairInterface } from 'ecpair';
5
5
  import { Client } from './client';
6
6
  export declare class ClientKeystore extends Client {
7
7
  /**
@@ -27,7 +27,7 @@ export declare class ClientKeystore extends Client {
27
27
  * @returns {Dash.ECPairInterface} The DASH ECPairInterface object.
28
28
  * @throws {"Could not get private key from phrase"} Thrown if private key cannot be obtained from the phrase.
29
29
  */
30
- getDashKeys(phrase: string, index?: number): Dash.ECPairInterface;
30
+ getDashKeys(phrase: string, index?: number): ECPairInterface;
31
31
  /**
32
32
  * Asynchronously transfers assets between addresses.
33
33
  * @param {TxParams & { feeRate?: FeeRate }} params - Parameters for the transfer.
package/lib/index.esm.js CHANGED
@@ -5,7 +5,10 @@ import * as dashcore from '@dashevo/dashcore-lib';
5
5
  import { toBitcoinJS, Client as Client$1 } from '@xchainjs/xchain-utxo';
6
6
  import * as Dash from 'bitcoinjs-lib';
7
7
  import accumulative from 'coinselect/accumulative';
8
+ import * as ecc from '@bitcoin-js/tiny-secp256k1-asmjs';
8
9
  import { getSeed } from '@xchainjs/xchain-crypto';
10
+ import { HDKey } from '@scure/bip32';
11
+ import { ECPairFactory } from 'ecpair';
9
12
  import AppBtc from '@ledgerhq/hw-app-btc';
10
13
 
11
14
  /**
@@ -4275,6 +4278,7 @@ const broadcastTx = (params) => __awaiter(void 0, void 0, void 0, function* () {
4275
4278
  }
4276
4279
  });
4277
4280
 
4281
+ const ECPair = ECPairFactory(ecc);
4278
4282
  class ClientKeystore extends Client {
4279
4283
  /**
4280
4284
  * Get the DASH address corresponding to the given index.
@@ -4323,11 +4327,11 @@ class ClientKeystore extends Client {
4323
4327
  getDashKeys(phrase, index = 0) {
4324
4328
  const dashNetwork$1 = dashNetwork(this.network);
4325
4329
  const seed = getSeed(phrase);
4326
- const master = Dash.bip32.fromSeed(seed, dashNetwork$1).derivePath(this.getFullDerivationPath(index));
4330
+ const master = HDKey.fromMasterSeed(Uint8Array.from(seed), dashNetwork$1.bip32).derive(this.getFullDerivationPath(index));
4327
4331
  if (!master.privateKey) {
4328
4332
  throw new Error('Could not get private key from phrase');
4329
4333
  }
4330
- return Dash.ECPair.fromPrivateKey(master.privateKey, { network: dashNetwork$1 });
4334
+ return ECPair.fromPrivateKey(Buffer.from(master.privateKey), { network: dashNetwork$1 });
4331
4335
  }
4332
4336
  /**
4333
4337
  * Asynchronously transfers assets between addresses.
package/lib/index.js CHANGED
@@ -7,7 +7,10 @@ var dashcore = require('@dashevo/dashcore-lib');
7
7
  var xchainUtxo = require('@xchainjs/xchain-utxo');
8
8
  var Dash = require('bitcoinjs-lib');
9
9
  var accumulative = require('coinselect/accumulative');
10
+ var ecc = require('@bitcoin-js/tiny-secp256k1-asmjs');
10
11
  var xchainCrypto = require('@xchainjs/xchain-crypto');
12
+ var bip32 = require('@scure/bip32');
13
+ var ecpair = require('ecpair');
11
14
  var AppBtc = require('@ledgerhq/hw-app-btc');
12
15
 
13
16
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -33,6 +36,7 @@ function _interopNamespace(e) {
33
36
  var dashcore__namespace = /*#__PURE__*/_interopNamespace(dashcore);
34
37
  var Dash__namespace = /*#__PURE__*/_interopNamespace(Dash);
35
38
  var accumulative__default = /*#__PURE__*/_interopDefault(accumulative);
39
+ var ecc__namespace = /*#__PURE__*/_interopNamespace(ecc);
36
40
  var AppBtc__default = /*#__PURE__*/_interopDefault(AppBtc);
37
41
 
38
42
  /**
@@ -4302,6 +4306,7 @@ const broadcastTx = (params) => __awaiter(void 0, void 0, void 0, function* () {
4302
4306
  }
4303
4307
  });
4304
4308
 
4309
+ const ECPair = ecpair.ECPairFactory(ecc__namespace);
4305
4310
  class ClientKeystore extends Client {
4306
4311
  /**
4307
4312
  * Get the DASH address corresponding to the given index.
@@ -4350,11 +4355,11 @@ class ClientKeystore extends Client {
4350
4355
  getDashKeys(phrase, index = 0) {
4351
4356
  const dashNetwork$1 = dashNetwork(this.network);
4352
4357
  const seed = xchainCrypto.getSeed(phrase);
4353
- const master = Dash__namespace.bip32.fromSeed(seed, dashNetwork$1).derivePath(this.getFullDerivationPath(index));
4358
+ const master = bip32.HDKey.fromMasterSeed(Uint8Array.from(seed), dashNetwork$1.bip32).derive(this.getFullDerivationPath(index));
4354
4359
  if (!master.privateKey) {
4355
4360
  throw new Error('Could not get private key from phrase');
4356
4361
  }
4357
- return Dash__namespace.ECPair.fromPrivateKey(master.privateKey, { network: dashNetwork$1 });
4362
+ return ECPair.fromPrivateKey(Buffer.from(master.privateKey), { network: dashNetwork$1 });
4358
4363
  }
4359
4364
  /**
4360
4365
  * Asynchronously transfers assets between addresses.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xchainjs/xchain-dash",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "Custom Dash client and utilities used by XChainJS clients",
5
5
  "keywords": [
6
6
  "XChain",
@@ -33,21 +33,24 @@
33
33
  "postversion": "git push --follow-tags"
34
34
  },
35
35
  "dependencies": {
36
- "@dashevo/dashcore-lib": "0.19.41",
37
- "@ledgerhq/hw-app-btc": "10.1.0",
38
- "@xchainjs/xchain-client": "2.0.1",
39
- "@xchainjs/xchain-crypto": "1.0.0",
40
- "@xchainjs/xchain-util": "2.0.0",
41
- "@xchainjs/xchain-utxo": "2.0.1",
42
- "@xchainjs/xchain-utxo-providers": "2.0.1",
43
- "bitcoinjs-lib": "5.2.0",
44
- "coinselect": "3.1.12"
36
+ "@bitcoin-js/tiny-secp256k1-asmjs": "^2.2.3",
37
+ "@dashevo/dashcore-lib": "^0.25.0",
38
+ "@ledgerhq/hw-app-btc": "10.9.0",
39
+ "@scure/bip32": "^1.7.0",
40
+ "@xchainjs/xchain-client": "2.0.3",
41
+ "@xchainjs/xchain-crypto": "1.0.1",
42
+ "@xchainjs/xchain-util": "2.0.2",
43
+ "@xchainjs/xchain-utxo": "2.0.3",
44
+ "@xchainjs/xchain-utxo-providers": "2.0.3",
45
+ "bitcoinjs-lib": "^6.1.7",
46
+ "coinselect": "3.1.12",
47
+ "ecpair": "2.1.0"
45
48
  },
46
49
  "devDependencies": {
47
50
  "@ledgerhq/hw-transport-node-hid": "6.28.6",
48
- "@types/bitcoinjs-lib": "5.0.0",
51
+ "@types/bitcoinjs-lib": "^5.0.4",
49
52
  "axios": "1.8.4",
50
- "axios-mock-adapter": "1.20.0"
53
+ "axios-mock-adapter": "2.1.0"
51
54
  },
52
55
  "publishConfig": {
53
56
  "access": "public",