@xchainjs/xchain-thorchain 3.0.4 → 3.0.6

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
@@ -6,10 +6,10 @@ import { Client as Client$1, bech32ToBase64, MsgTypes, makeClientPath, base64ToB
6
6
  import { getSeed } from '@xchainjs/xchain-crypto';
7
7
  import { toWords, encode } from 'bech32';
8
8
  import { BigNumber } from 'bignumber.js';
9
- import { fromSeed } from 'bip32';
9
+ import { HDKey } from '@scure/bip32';
10
10
  import { TxRaw } from 'cosmjs-types/cosmos/tx/v1beta1/tx';
11
11
  import { createHash } from 'crypto';
12
- import { publicKeyCreate } from 'secp256k1';
12
+ import * as secp from '@bitcoin-js/tiny-secp256k1-asmjs';
13
13
  import { assetToString, isSynthAsset, isSecuredAsset, AssetType, assetToBase, assetAmount, eqAsset, assetFromString, assetFromStringEx } from '@xchainjs/xchain-util';
14
14
  import { Network } from '@xchainjs/xchain-client';
15
15
  import * as minimal from 'protobufjs/minimal';
@@ -3479,12 +3479,14 @@ class ClientKeystore extends Client {
3479
3479
  */
3480
3480
  getAddress(walletIndex) {
3481
3481
  const seed = getSeed(this.phrase);
3482
- const node = fromSeed(seed);
3483
- const child = node.derivePath(this.getFullDerivationPath(walletIndex || 0));
3482
+ const node = HDKey.fromMasterSeed(seed);
3483
+ const child = node.derive(this.getFullDerivationPath(walletIndex || 0));
3484
3484
  if (!child.privateKey)
3485
3485
  throw new Error('child does not have a privateKey');
3486
3486
  // TODO: Make this method async and use CosmosJS official address generation strategy
3487
- const pubKey = publicKeyCreate(child.privateKey);
3487
+ const pubKey = secp.pointFromScalar(child.privateKey, true);
3488
+ if (!pubKey)
3489
+ throw new Error('pubKey is null');
3488
3490
  const rawAddress = this.hash160(Uint8Array.from(pubKey));
3489
3491
  const words = toWords(Buffer.from(rawAddress));
3490
3492
  const address = encode(this.prefix, words);
package/lib/index.js CHANGED
@@ -8,10 +8,10 @@ var xchainCosmosSdk = require('@xchainjs/xchain-cosmos-sdk');
8
8
  var xchainCrypto = require('@xchainjs/xchain-crypto');
9
9
  var bech32 = require('bech32');
10
10
  var bignumber_js = require('bignumber.js');
11
- var bip32 = require('bip32');
11
+ var bip32 = require('@scure/bip32');
12
12
  var tx = require('cosmjs-types/cosmos/tx/v1beta1/tx');
13
13
  var crypto = require('crypto');
14
- var secp256k1 = require('secp256k1');
14
+ var secp = require('@bitcoin-js/tiny-secp256k1-asmjs');
15
15
  var xchainUtil = require('@xchainjs/xchain-util');
16
16
  var xchainClient = require('@xchainjs/xchain-client');
17
17
  var minimal = require('protobufjs/minimal');
@@ -40,6 +40,7 @@ function _interopNamespace(e) {
40
40
  return Object.freeze(n);
41
41
  }
42
42
 
43
+ var secp__namespace = /*#__PURE__*/_interopNamespace(secp);
43
44
  var minimal__namespace = /*#__PURE__*/_interopNamespace(minimal);
44
45
  var axios__default = /*#__PURE__*/_interopDefault(axios);
45
46
  var THORChainApp__default = /*#__PURE__*/_interopDefault(THORChainApp);
@@ -3505,12 +3506,14 @@ class ClientKeystore extends Client {
3505
3506
  */
3506
3507
  getAddress(walletIndex) {
3507
3508
  const seed = xchainCrypto.getSeed(this.phrase);
3508
- const node = bip32.fromSeed(seed);
3509
- const child = node.derivePath(this.getFullDerivationPath(walletIndex || 0));
3509
+ const node = bip32.HDKey.fromMasterSeed(seed);
3510
+ const child = node.derive(this.getFullDerivationPath(walletIndex || 0));
3510
3511
  if (!child.privateKey)
3511
3512
  throw new Error('child does not have a privateKey');
3512
3513
  // TODO: Make this method async and use CosmosJS official address generation strategy
3513
- const pubKey = secp256k1.publicKeyCreate(child.privateKey);
3514
+ const pubKey = secp__namespace.pointFromScalar(child.privateKey, true);
3515
+ if (!pubKey)
3516
+ throw new Error('pubKey is null');
3514
3517
  const rawAddress = this.hash160(Uint8Array.from(pubKey));
3515
3518
  const words = bech32.toWords(Buffer.from(rawAddress));
3516
3519
  const address = bech32.encode(this.prefix, words);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xchainjs/xchain-thorchain",
3
- "version": "3.0.4",
3
+ "version": "3.0.6",
4
4
  "description": "Custom Thorchain client and utilities used by XChainJS clients",
5
5
  "keywords": [
6
6
  "THORChain",
@@ -34,25 +34,25 @@
34
34
  "generate:ThorchainMsgs": "./genMsgs.sh"
35
35
  },
36
36
  "dependencies": {
37
- "@cosmjs/amino": "0.32.4",
38
- "@cosmjs/crypto": "0.32.4",
39
- "@cosmjs/encoding": "0.32.4",
40
- "@cosmjs/math": "0.32.4",
41
- "@cosmjs/proto-signing": "0.32.4",
42
- "@cosmjs/stargate": "0.32.4",
43
- "@ledgerhq/hw-transport": "6.30.6",
44
- "@xchainjs/ledger-thorchain": "0.2.0",
45
- "@xchainjs/xchain-client": "2.0.0",
46
- "@xchainjs/xchain-cosmos-sdk": "2.0.0",
47
- "@xchainjs/xchain-crypto": "1.0.0",
48
- "@xchainjs/xchain-util": "2.0.0",
37
+ "@bitcoin-js/tiny-secp256k1-asmjs": "^2.2.3",
38
+ "@cosmjs/amino": "0.33.1",
39
+ "@cosmjs/crypto": "0.33.1",
40
+ "@cosmjs/encoding": "0.33.1",
41
+ "@cosmjs/math": "0.33.1",
42
+ "@cosmjs/proto-signing": "0.33.1",
43
+ "@cosmjs/stargate": "0.33.1",
44
+ "@ledgerhq/hw-transport": "^6.31.6",
45
+ "@scure/bip32": "^1.7.0",
46
+ "@xchainjs/ledger-thorchain": "0.3.0",
47
+ "@xchainjs/xchain-client": "2.0.2",
48
+ "@xchainjs/xchain-cosmos-sdk": "2.0.2",
49
+ "@xchainjs/xchain-crypto": "1.0.1",
50
+ "@xchainjs/xchain-util": "2.0.1",
49
51
  "axios": "1.8.4",
50
52
  "bech32": "^1.1.3",
51
- "bignumber.js": "9.0.0",
52
- "bip32": "^2.0.6",
53
+ "bignumber.js": "^9.0.0",
53
54
  "cosmjs-types": "0.9.0",
54
- "protobufjs": "6.11.4",
55
- "secp256k1": "5.0.1"
55
+ "protobufjs": "6.11.4"
56
56
  },
57
57
  "publishConfig": {
58
58
  "access": "public",