@cityofzion/bs-ethereum 2.4.0 → 2.5.0

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.
@@ -14,7 +14,7 @@ export declare class BSEthereum<BSCustomName extends string = string> implements
14
14
  network: Network<BSEthereumNetworkId>;
15
15
  explorerService: ExplorerService;
16
16
  constructor(blockchainName: BSCustomName, network?: Network<BSEthereumNetworkId>, getLedgerTransport?: GetLedgerTransport);
17
- clone(): BSEthereum<BSCustomName>;
17
+ testNetwork(network: Network<BSEthereumNetworkId>): Promise<void>;
18
18
  setNetwork(network: Network<BSEthereumNetworkId>): void;
19
19
  validateAddress(address: string): boolean;
20
20
  validateEncrypted(json: string): boolean;
@@ -58,6 +58,7 @@ const MoralisBDSEthereum_1 = require("./services/blockchain-data/MoralisBDSEther
58
58
  const MoralisEDSEthereum_1 = require("./services/exchange-data/MoralisEDSEthereum");
59
59
  const GhostMarketNDSEthereum_1 = require("./services/nft-data/GhostMarketNDSEthereum");
60
60
  const BlockscoutESEthereum_1 = require("./services/explorer/BlockscoutESEthereum");
61
+ const RpcBDSEthereum_1 = require("./services/blockchain-data/RpcBDSEthereum");
61
62
  class BSEthereum {
62
63
  constructor(blockchainName, network, getLedgerTransport) {
63
64
  _BSEthereum_instances.add(this);
@@ -69,8 +70,11 @@ class BSEthereum {
69
70
  this.bip44DerivationPath = BSEthereumConstants_1.BSEthereumConstants.DEFAULT_BIP44_DERIVATION_PATH;
70
71
  this.setNetwork(network);
71
72
  }
72
- clone() {
73
- return new BSEthereum(this.blockchainName, this.network, __classPrivateFieldGet(this, _BSEthereum_getLedgerTransport, "f"));
73
+ testNetwork(network) {
74
+ return __awaiter(this, void 0, void 0, function* () {
75
+ const blockchainDataServiceClone = new RpcBDSEthereum_1.RpcBDSEthereum(network);
76
+ yield blockchainDataServiceClone.getBlockHeight();
77
+ });
74
78
  }
75
79
  setNetwork(network) {
76
80
  __classPrivateFieldGet(this, _BSEthereum_instances, "m", _BSEthereum_setTokens).call(this, network);
@@ -97,18 +101,14 @@ class BSEthereum {
97
101
  if (!key.startsWith('0x')) {
98
102
  key = '0x' + key;
99
103
  }
100
- if (ethersBytes.hexDataLength(key) !== 32)
101
- return false;
102
- return true;
104
+ return ethersBytes.hexDataLength(key) === 32;
103
105
  }
104
106
  catch (error) {
105
107
  return false;
106
108
  }
107
109
  }
108
110
  validateNameServiceDomainFormat(domainName) {
109
- if (!domainName.endsWith('.eth'))
110
- return false;
111
- return true;
111
+ return domainName.endsWith('.eth');
112
112
  }
113
113
  generateAccountFromMnemonic(mnemonic, index) {
114
114
  const bip44Path = this.bip44DerivationPath.replace('?', index.toString());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cityofzion/bs-ethereum",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": "https://github.com/CityOfZion/blockchain-services",
@@ -20,7 +20,7 @@
20
20
  "@ledgerhq/hw-app-eth": "~6.35.7",
21
21
  "@ethersproject/abstract-signer": "~5.7.0",
22
22
  "@ethersproject/properties": "~5.7.0",
23
- "@cityofzion/blockchain-service": "1.5.0"
23
+ "@cityofzion/blockchain-service": "1.6.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@ledgerhq/hw-transport-node-hid": "~6.28.5",