@octaflowlabs/onchain-sdk 1.3.1 → 1.3.4

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,6 +1,7 @@
1
1
  export interface NetworkField {
2
2
  id: string;
3
3
  name: string;
4
+ nameForDisplay: string;
4
5
  chainId: number;
5
6
  rpcUrl: string;
6
7
  explorerUrl: string;
@@ -7,7 +7,8 @@ exports.NETWORKS_REGISTRY = [
7
7
  networks: [
8
8
  {
9
9
  id: 'ethereum-mainnet',
10
- name: 'Ethereum Mainnet',
10
+ name: 'eth-mainnet',
11
+ nameForDisplay: 'Ethereum Mainnet',
11
12
  chainId: 1,
12
13
  rpcUrl: 'https://ethereum-rpc.publicnode.com',
13
14
  explorerUrl: 'https://etherscan.io',
@@ -17,7 +18,8 @@ exports.NETWORKS_REGISTRY = [
17
18
  },
18
19
  {
19
20
  id: 'bnb-smart-chain',
20
- name: 'BNB Smart Chain',
21
+ name: 'bnb-mainnet',
22
+ nameForDisplay: 'BNB Smart Chain',
21
23
  chainId: 56,
22
24
  rpcUrl: 'https://bsc-dataseed.bnbchain.org',
23
25
  explorerUrl: 'https://bscscan.com/',
@@ -27,7 +29,8 @@ exports.NETWORKS_REGISTRY = [
27
29
  },
28
30
  {
29
31
  id: 'polygon-mainnet',
30
- name: 'Polygon Mainnet',
32
+ name: 'polygon-mainnet',
33
+ nameForDisplay: 'Polygon Mainnet',
31
34
  iconUrl: 'https://assets.coingecko.com/coins/images/4713/large/matic-token-icon.png',
32
35
  chainId: 137,
33
36
  rpcUrl: 'https://polygon.publicnode.com',
@@ -37,7 +40,8 @@ exports.NETWORKS_REGISTRY = [
37
40
  },
38
41
  {
39
42
  id: 'arbitrum-mainnet',
40
- name: 'Arbitrum Mainnet',
43
+ name: 'arb-mainnet',
44
+ nameForDisplay: 'Arbitrum Mainnet',
41
45
  chainId: 42161,
42
46
  rpcUrl: 'https://public-arb-mainnet.fastnode.io',
43
47
  explorerUrl: 'https://arbiscan.io',
@@ -52,7 +56,8 @@ exports.NETWORKS_REGISTRY = [
52
56
  networks: [
53
57
  {
54
58
  id: 'sepolia-eth',
55
- name: 'Sepolia Testnet',
59
+ name: 'eth-sepolia',
60
+ nameForDisplay: 'ETH Sepolia Testnet',
56
61
  chainId: 11155111,
57
62
  rpcUrl: 'https://ethereum-sepolia-rpc.publicnode.com',
58
63
  explorerUrl: 'https://sepolia.etherscan.io',
@@ -25,15 +25,16 @@ class EvmWalletService {
25
25
  this.validateMnemonic(mnemonic);
26
26
  const wallets = [];
27
27
  const mnemonicObject = ethers_1.Mnemonic.fromPhrase(mnemonic);
28
+ const rootNode = ethers_1.HDNodeWallet.fromMnemonic(mnemonicObject, this.DEFAULT_DERIVATION_PATH);
28
29
  for (let i = 0; i < count; i++) {
29
30
  const accountIndex = startIndex + i;
31
+ const child = rootNode.deriveChild(accountIndex);
30
32
  const path = `${this.DEFAULT_DERIVATION_PATH}/${accountIndex}`;
31
- const hdNode = ethers_1.HDNodeWallet.fromMnemonic(mnemonicObject, path);
32
33
  wallets.push({
33
- address: hdNode.address,
34
- privateKey: hdNode.privateKey,
34
+ address: child.address,
35
+ privateKey: child.privateKey,
35
36
  path,
36
- publicKey: hdNode.publicKey,
37
+ publicKey: child.publicKey,
37
38
  });
38
39
  }
39
40
  return wallets;
@@ -1,6 +1,7 @@
1
1
  export interface NetworkField {
2
2
  id: string;
3
3
  name: string;
4
+ nameForDisplay: string;
4
5
  chainId: number;
5
6
  rpcUrl: string;
6
7
  explorerUrl: string;
@@ -4,7 +4,8 @@ export const NETWORKS_REGISTRY = [
4
4
  networks: [
5
5
  {
6
6
  id: 'ethereum-mainnet',
7
- name: 'Ethereum Mainnet',
7
+ name: 'eth-mainnet',
8
+ nameForDisplay: 'Ethereum Mainnet',
8
9
  chainId: 1,
9
10
  rpcUrl: 'https://ethereum-rpc.publicnode.com',
10
11
  explorerUrl: 'https://etherscan.io',
@@ -14,7 +15,8 @@ export const NETWORKS_REGISTRY = [
14
15
  },
15
16
  {
16
17
  id: 'bnb-smart-chain',
17
- name: 'BNB Smart Chain',
18
+ name: 'bnb-mainnet',
19
+ nameForDisplay: 'BNB Smart Chain',
18
20
  chainId: 56,
19
21
  rpcUrl: 'https://bsc-dataseed.bnbchain.org',
20
22
  explorerUrl: 'https://bscscan.com/',
@@ -24,7 +26,8 @@ export const NETWORKS_REGISTRY = [
24
26
  },
25
27
  {
26
28
  id: 'polygon-mainnet',
27
- name: 'Polygon Mainnet',
29
+ name: 'polygon-mainnet',
30
+ nameForDisplay: 'Polygon Mainnet',
28
31
  iconUrl: 'https://assets.coingecko.com/coins/images/4713/large/matic-token-icon.png',
29
32
  chainId: 137,
30
33
  rpcUrl: 'https://polygon.publicnode.com',
@@ -34,7 +37,8 @@ export const NETWORKS_REGISTRY = [
34
37
  },
35
38
  {
36
39
  id: 'arbitrum-mainnet',
37
- name: 'Arbitrum Mainnet',
40
+ name: 'arb-mainnet',
41
+ nameForDisplay: 'Arbitrum Mainnet',
38
42
  chainId: 42161,
39
43
  rpcUrl: 'https://public-arb-mainnet.fastnode.io',
40
44
  explorerUrl: 'https://arbiscan.io',
@@ -49,7 +53,8 @@ export const NETWORKS_REGISTRY = [
49
53
  networks: [
50
54
  {
51
55
  id: 'sepolia-eth',
52
- name: 'Sepolia Testnet',
56
+ name: 'eth-sepolia',
57
+ nameForDisplay: 'ETH Sepolia Testnet',
53
58
  chainId: 11155111,
54
59
  rpcUrl: 'https://ethereum-sepolia-rpc.publicnode.com',
55
60
  explorerUrl: 'https://sepolia.etherscan.io',
@@ -22,15 +22,16 @@ export class EvmWalletService {
22
22
  this.validateMnemonic(mnemonic);
23
23
  const wallets = [];
24
24
  const mnemonicObject = Mnemonic.fromPhrase(mnemonic);
25
+ const rootNode = HDNodeWallet.fromMnemonic(mnemonicObject, this.DEFAULT_DERIVATION_PATH);
25
26
  for (let i = 0; i < count; i++) {
26
27
  const accountIndex = startIndex + i;
28
+ const child = rootNode.deriveChild(accountIndex);
27
29
  const path = `${this.DEFAULT_DERIVATION_PATH}/${accountIndex}`;
28
- const hdNode = HDNodeWallet.fromMnemonic(mnemonicObject, path);
29
30
  wallets.push({
30
- address: hdNode.address,
31
- privateKey: hdNode.privateKey,
31
+ address: child.address,
32
+ privateKey: child.privateKey,
32
33
  path,
33
- publicKey: hdNode.publicKey,
34
+ publicKey: child.publicKey,
34
35
  });
35
36
  }
36
37
  return wallets;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octaflowlabs/onchain-sdk",
3
- "version": "1.3.1",
3
+ "version": "1.3.4",
4
4
  "description": "onchain methods for web3",
5
5
  "repository": "https://github.com/crisramb665/onchain-sdk.git",
6
6
  "license": "MIT",