@xchainjs/xchain-doge 2.0.1 → 2.0.2

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/lib/index.esm.js CHANGED
@@ -1,6 +1,9 @@
1
+ import * as ecc from '@bitcoin-js/tiny-secp256k1-asmjs';
1
2
  import { ExplorerProvider, Network, FeeOption, checkFeeBounds } from '@xchainjs/xchain-client';
2
3
  import { getSeed } from '@xchainjs/xchain-crypto';
3
4
  import * as Dogecoin from 'bitcoinjs-lib';
5
+ import { ECPairFactory } from 'ecpair';
6
+ import { HDKey } from '@scure/bip32';
4
7
  import { toBitcoinJS, Client as Client$1 } from '@xchainjs/xchain-utxo';
5
8
  import accumulative from 'coinselect/accumulative';
6
9
  import { AssetType } from '@xchainjs/xchain-util';
@@ -397,6 +400,7 @@ class Client extends Client$1 {
397
400
  }
398
401
  }
399
402
 
403
+ const ECPair = ECPairFactory(ecc);
400
404
  /**
401
405
  * Custom Doge client extended to support keystore functionality
402
406
  */
@@ -445,11 +449,11 @@ class ClientKeystore extends Client {
445
449
  getDogeKeys(phrase, index = 0) {
446
450
  const dogeNetwork$1 = dogeNetwork(this.network);
447
451
  const seed = getSeed(phrase);
448
- const master = Dogecoin.bip32.fromSeed(seed, dogeNetwork$1).derivePath(this.getFullDerivationPath(index));
452
+ const master = HDKey.fromMasterSeed(Uint8Array.from(seed), dogeNetwork$1.bip32).derive(this.getFullDerivationPath(index));
449
453
  if (!master.privateKey) {
450
454
  throw new Error('Could not get private key from phrase');
451
455
  }
452
- return Dogecoin.ECPair.fromPrivateKey(master.privateKey, { network: dogeNetwork$1 });
456
+ return ECPair.fromPrivateKey(Buffer.from(master.privateKey), { network: dogeNetwork$1 });
453
457
  }
454
458
  /**
455
459
  * Get the current address.
package/lib/index.js CHANGED
@@ -1,8 +1,11 @@
1
1
  'use strict';
2
2
 
3
+ var ecc = require('@bitcoin-js/tiny-secp256k1-asmjs');
3
4
  var xchainClient = require('@xchainjs/xchain-client');
4
5
  var xchainCrypto = require('@xchainjs/xchain-crypto');
5
6
  var Dogecoin = require('bitcoinjs-lib');
7
+ var ecpair = require('ecpair');
8
+ var bip32 = require('@scure/bip32');
6
9
  var xchainUtxo = require('@xchainjs/xchain-utxo');
7
10
  var accumulative = require('coinselect/accumulative');
8
11
  var xchainUtil = require('@xchainjs/xchain-util');
@@ -29,6 +32,7 @@ function _interopNamespace(e) {
29
32
  return Object.freeze(n);
30
33
  }
31
34
 
35
+ var ecc__namespace = /*#__PURE__*/_interopNamespace(ecc);
32
36
  var Dogecoin__namespace = /*#__PURE__*/_interopNamespace(Dogecoin);
33
37
  var accumulative__default = /*#__PURE__*/_interopDefault(accumulative);
34
38
  var AppBtc__default = /*#__PURE__*/_interopDefault(AppBtc);
@@ -423,6 +427,7 @@ class Client extends xchainUtxo.Client {
423
427
  }
424
428
  }
425
429
 
430
+ const ECPair = ecpair.ECPairFactory(ecc__namespace);
426
431
  /**
427
432
  * Custom Doge client extended to support keystore functionality
428
433
  */
@@ -471,11 +476,11 @@ class ClientKeystore extends Client {
471
476
  getDogeKeys(phrase, index = 0) {
472
477
  const dogeNetwork$1 = dogeNetwork(this.network);
473
478
  const seed = xchainCrypto.getSeed(phrase);
474
- const master = Dogecoin__namespace.bip32.fromSeed(seed, dogeNetwork$1).derivePath(this.getFullDerivationPath(index));
479
+ const master = bip32.HDKey.fromMasterSeed(Uint8Array.from(seed), dogeNetwork$1.bip32).derive(this.getFullDerivationPath(index));
475
480
  if (!master.privateKey) {
476
481
  throw new Error('Could not get private key from phrase');
477
482
  }
478
- return Dogecoin__namespace.ECPair.fromPrivateKey(master.privateKey, { network: dogeNetwork$1 });
483
+ return ECPair.fromPrivateKey(Buffer.from(master.privateKey), { network: dogeNetwork$1 });
479
484
  }
480
485
  /**
481
486
  * Get the current address.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xchainjs/xchain-doge",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "Custom Doge client and utilities used by XChain clients",
5
5
  "keywords": [
6
6
  "Xchain",
@@ -33,19 +33,23 @@
33
33
  "postversion": "git push --follow-tags"
34
34
  },
35
35
  "dependencies": {
36
- "@ledgerhq/hw-app-btc": "10.1.0",
37
- "@xchainjs/xchain-client": "2.0.1",
38
- "@xchainjs/xchain-crypto": "1.0.0",
39
- "@xchainjs/xchain-util": "2.0.0",
40
- "@xchainjs/xchain-utxo": "2.0.1",
41
- "@xchainjs/xchain-utxo-providers": "2.0.1",
42
- "bitcoinjs-lib": "5.2.0",
43
- "coinselect": "3.1.12"
36
+ "@bitcoin-js/tiny-secp256k1-asmjs": "^2.2.3",
37
+ "@ledgerhq/hw-app-btc": "10.9.0",
38
+ "@scure/bip32": "^1.7.0",
39
+ "@xchainjs/xchain-client": "2.0.2",
40
+ "@xchainjs/xchain-crypto": "1.0.1",
41
+ "@xchainjs/xchain-util": "2.0.1",
42
+ "@xchainjs/xchain-utxo": "2.0.2",
43
+ "@xchainjs/xchain-utxo-providers": "2.0.2",
44
+ "bitcoinjs-lib": "^6.1.7",
45
+ "coinselect": "3.1.12",
46
+ "ecpair": "2.1.0"
44
47
  },
45
48
  "devDependencies": {
46
49
  "@ledgerhq/hw-transport-node-hid": "6.28.6",
50
+ "@types/bitcoinjs-lib": "^5.0.4",
47
51
  "axios": "1.8.4",
48
- "axios-mock-adapter": "1.20.0"
52
+ "axios-mock-adapter": "2.1.0"
49
53
  },
50
54
  "publishConfig": {
51
55
  "access": "public",