@cityofzion/bs-ethereum 2.8.3 → 2.8.5

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.
@@ -104,10 +104,10 @@ class BSEthereum {
104
104
  }
105
105
  generateAccountFromMnemonic(mnemonic, index) {
106
106
  const bip44Path = this.bip44DerivationPath.replace('?', index.toString());
107
- const wallet = ethers_1.ethers.Wallet.fromMnemonic(Array.isArray(mnemonic) ? mnemonic.join(' ') : mnemonic, bip44Path);
107
+ const hd = ethers_1.ethers.utils.HDNode.fromMnemonic(Array.isArray(mnemonic) ? mnemonic.join(' ') : mnemonic).derivePath(bip44Path);
108
108
  return {
109
- address: wallet.address,
110
- key: wallet.privateKey,
109
+ address: hd.address,
110
+ key: hd.privateKey,
111
111
  type: 'privateKey',
112
112
  bip44Path,
113
113
  blockchain: this.name,
@@ -28,6 +28,16 @@ BSEthereumConstants.NATIVE_SYMBOL_BY_NETWORK_ID = {
28
28
  };
29
29
  BSEthereumConstants.NATIVE_WRAPPED_HASH_BY_NETWORK_ID = {
30
30
  '1': '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
31
+ '10': '0x4200000000000000000000000000000000000006',
32
+ '25': '0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23',
33
+ '56': '0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c',
34
+ '137': '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270',
35
+ '250': '0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83',
36
+ '8453': '0x4200000000000000000000000000000000000006',
37
+ '42161': '0x82af49447d8a07e3bd95bd0d56f35241523fbab1',
38
+ '42220': '0x471EcE3750Da237f93B8E339c536989b8978a438',
39
+ '43114': '0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7',
40
+ '59144': '0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f',
31
41
  };
32
42
  BSEthereumConstants.RPC_LIST_BY_NETWORK_ID = {
33
43
  '1': [
@@ -68,6 +68,8 @@ class MoralisEDSEthereum extends blockchain_service_1.CryptoCompareEDS {
68
68
  });
69
69
  }
70
70
  });
71
+ if (tokensBody.length === 0)
72
+ return [];
71
73
  const splitTokensBody = [];
72
74
  for (let i = 0; i < tokensBody.length; i += __classPrivateFieldGet(this, _MoralisEDSEthereum_maxTokenPricesPerCall, "f")) {
73
75
  splitTokensBody.push(tokensBody.slice(i, i + __classPrivateFieldGet(this, _MoralisEDSEthereum_maxTokenPricesPerCall, "f")));
@@ -146,23 +148,8 @@ _MoralisEDSEthereum_network = new WeakMap(), _MoralisEDSEthereum_blockchainDataS
146
148
  const nativeToken = BSEthereumHelper_1.BSEthereumHelper.getNativeAsset(__classPrivateFieldGet(this, _MoralisEDSEthereum_network, "f"));
147
149
  const wrappedSymbol = `W${nativeToken.symbol}`;
148
150
  const localWrappedHash = BSEthereumConstants_1.BSEthereumConstants.NATIVE_WRAPPED_HASH_BY_NETWORK_ID[__classPrivateFieldGet(this, _MoralisEDSEthereum_network, "f").id];
149
- if (localWrappedHash) {
150
- return Object.assign(Object.assign({}, nativeToken), { symbol: wrappedSymbol, hash: localWrappedHash });
151
- }
152
- const client = MoralisBDSEthereum_1.MoralisBDSEthereum.getClient(__classPrivateFieldGet(this, _MoralisEDSEthereum_network, "f"));
153
- const { data } = yield client.get('/erc20/metadata/symbols', {
154
- params: {
155
- symbols: [wrappedSymbol],
156
- },
157
- });
158
- const wrapperToken = data.find(token => token.verified_contract && !token.possible_spam);
159
- if (!wrapperToken)
151
+ if (!localWrappedHash)
160
152
  throw new Error('Wrapper token not found');
161
- return {
162
- decimals: Number(wrapperToken.decimals),
163
- hash: wrapperToken.address,
164
- name: wrapperToken.name,
165
- symbol: wrapperToken.symbol,
166
- };
153
+ return Object.assign(Object.assign({}, nativeToken), { symbol: wrappedSymbol, hash: localWrappedHash });
167
154
  });
168
155
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cityofzion/bs-ethereum",
3
- "version": "2.8.3",
3
+ "version": "2.8.5",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": "https://github.com/CityOfZion/blockchain-services",