carbon-js-sdk 0.3.18 → 0.3.19

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.
@@ -62,6 +62,56 @@ const getEncryptMessage = (input) => {
62
62
  -----END MNEMONIC PHRASE-----
63
63
  `.trim().replace(/^\s+/gm, '');
64
64
  };
65
+ const BSC_MAINNET = {
66
+ chainId: '0x38',
67
+ blockExplorerUrls: ['https://bscscan.com'],
68
+ chainName: 'BSC Mainnet',
69
+ rpcUrls: [
70
+ 'https://bsc-dataseed2.binance.org/',
71
+ 'https://bsc-dataseed3.binance.org/',
72
+ 'https://bsc-dataseed4.binance.org/',
73
+ 'https://bsc-dataseed1.defibit.io/',
74
+ 'https://bsc-dataseed2.defibit.io/',
75
+ 'https://bsc-dataseed3.defibit.io/',
76
+ 'https://bsc-dataseed4.defibit.io/',
77
+ 'https://bsc-dataseed1.ninicoin.io/',
78
+ 'https://bsc-dataseed2.ninicoin.io/',
79
+ 'https://bsc-dataseed3.ninicoin.io/',
80
+ 'https://bsc-dataseed4.ninicoin.io/',
81
+ 'https://bsc-dataseed1.binance.org/',
82
+ ],
83
+ nativeCurrency: {
84
+ decimals: 18,
85
+ name: 'Binance Coin',
86
+ symbol: 'BNB',
87
+ },
88
+ };
89
+ const BSC_TESTNET = {
90
+ chainId: '0x61',
91
+ blockExplorerUrls: ['https://testnet.bscscan.com'],
92
+ chainName: 'BSC Testnet',
93
+ rpcUrls: [
94
+ 'https://data-seed-prebsc-2-s1.binance.org:8545/',
95
+ 'http://data-seed-prebsc-1-s2.binance.org:8545/',
96
+ 'http://data-seed-prebsc-2-s2.binance.org:8545/',
97
+ 'https://data-seed-prebsc-1-s3.binance.org:8545/',
98
+ 'https://data-seed-prebsc-2-s3.binance.org:8545/',
99
+ 'https://data-seed-prebsc-1-s1.binance.org:8545/',
100
+ ],
101
+ nativeCurrency: {
102
+ decimals: 18,
103
+ name: 'Binance Coin',
104
+ symbol: 'BNB',
105
+ },
106
+ };
107
+ const ETH_MAINNET = {
108
+ chainId: '0x1',
109
+ rpcUrls: ['https://mainnet.infura.io/v3/'],
110
+ };
111
+ const ETH_TESTNET = {
112
+ chainId: '0x4',
113
+ rpcUrls: ['https://rinkeby.infura.io/v3/'],
114
+ };
65
115
  /**
66
116
  * TODO: Add docs
67
117
  */
@@ -74,58 +124,18 @@ class MetaMask {
74
124
  if (network === constant_1.Network.MainNet) {
75
125
  switch (blockchain) {
76
126
  case blockchain_1.Blockchain.BinanceSmartChain:
77
- return {
78
- chainId: '0x38',
79
- blockExplorerUrls: ['https://bscscan.com'],
80
- chainName: 'BSC Mainnet',
81
- rpcUrls: [
82
- 'https://bsc-dataseed2.binance.org/',
83
- 'https://bsc-dataseed3.binance.org/',
84
- 'https://bsc-dataseed4.binance.org/',
85
- 'https://bsc-dataseed1.defibit.io/',
86
- 'https://bsc-dataseed2.defibit.io/',
87
- 'https://bsc-dataseed3.defibit.io/',
88
- 'https://bsc-dataseed4.defibit.io/',
89
- 'https://bsc-dataseed1.ninicoin.io/',
90
- 'https://bsc-dataseed2.ninicoin.io/',
91
- 'https://bsc-dataseed3.ninicoin.io/',
92
- 'https://bsc-dataseed4.ninicoin.io/',
93
- 'https://bsc-dataseed1.binance.org/',
94
- ],
95
- nativeCurrency: {
96
- decimals: 18,
97
- name: 'Binance Coin',
98
- symbol: 'BNB',
99
- },
100
- };
127
+ return BSC_MAINNET;
101
128
  default:
102
129
  // metamask should come with Ethereum configs
103
- return { chainId: '0x1' };
130
+ return ETH_MAINNET;
104
131
  }
105
132
  }
106
133
  switch (blockchain) {
107
134
  case blockchain_1.Blockchain.BinanceSmartChain:
108
- return {
109
- chainId: '0x61',
110
- blockExplorerUrls: ['https://testnet.bscscan.com'],
111
- chainName: 'BSC Testnet',
112
- rpcUrls: [
113
- 'https://data-seed-prebsc-2-s1.binance.org:8545/',
114
- 'http://data-seed-prebsc-1-s2.binance.org:8545/',
115
- 'http://data-seed-prebsc-2-s2.binance.org:8545/',
116
- 'https://data-seed-prebsc-1-s3.binance.org:8545/',
117
- 'https://data-seed-prebsc-2-s3.binance.org:8545/',
118
- 'https://data-seed-prebsc-1-s1.binance.org:8545/',
119
- ],
120
- nativeCurrency: {
121
- decimals: 18,
122
- name: 'Binance Coin',
123
- symbol: 'BNB',
124
- },
125
- };
135
+ return BSC_TESTNET;
126
136
  default:
127
137
  // metamask should come with Ethereum configs
128
- return { chainId: '0x3' };
138
+ return ETH_TESTNET;
129
139
  }
130
140
  }
131
141
  static getRequiredChainId(network, blockchain = blockchain_1.Blockchain.Ethereum) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-js-sdk",
3
- "version": "0.3.18",
3
+ "version": "0.3.19",
4
4
  "description": "TypeScript SDK for Carbon blockchain",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",