carbon-js-sdk 0.3.18 → 0.3.20

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) {
@@ -4,6 +4,7 @@ export declare enum Blockchain {
4
4
  Ethereum = "eth",
5
5
  BinanceSmartChain = "bsc",
6
6
  Zilliqa = "zil",
7
+ Arbitrum = "arbitrum",
7
8
  Native = "native",
8
9
  Btc = "btc",
9
10
  Carbon = "carbon",
@@ -40,6 +41,8 @@ export declare const ChainNames: {
40
41
  readonly 97: "BSC TestNet";
41
42
  readonly 110: "ZIL DevNet";
42
43
  readonly 111: "ZIL TestNet";
44
+ readonly 42161: "Arbitrum MainNet";
45
+ readonly 421611: "Arbitrum TestNet";
43
46
  };
44
47
  export declare const CHAIN_IDS: ChainIds;
45
48
  export declare const CHAIN_IDS_DEV: ChainIds;
@@ -47,5 +50,5 @@ export declare const CHAIN_IDS_TEST: ChainIds;
47
50
  export declare const chainIdsByBlockchain: SimpleMap<ChainIds>;
48
51
  export declare function parseBlockchain(value: string | null): Blockchain | null;
49
52
  export declare function getChainFromID(id: number): string | undefined;
50
- export declare const getBlockchainFromChain: (chainId?: number | undefined) => Blockchain.Ethereum | Blockchain.BinanceSmartChain | Blockchain.Zilliqa | undefined;
53
+ export declare const getBlockchainFromChain: (chainId?: number | undefined) => Blockchain.Ethereum | Blockchain.BinanceSmartChain | Blockchain.Zilliqa | Blockchain.Arbitrum | undefined;
51
54
  export declare const blockchainForChainId: (chainId?: number | undefined) => Blockchain | undefined;
@@ -8,6 +8,7 @@ var Blockchain;
8
8
  Blockchain["Ethereum"] = "eth";
9
9
  Blockchain["BinanceSmartChain"] = "bsc";
10
10
  Blockchain["Zilliqa"] = "zil";
11
+ Blockchain["Arbitrum"] = "arbitrum";
11
12
  Blockchain["Native"] = "native";
12
13
  Blockchain["Btc"] = "btc";
13
14
  Blockchain["Carbon"] = "carbon";
@@ -44,6 +45,8 @@ exports.ChainNames = {
44
45
  97: 'BSC TestNet',
45
46
  110: 'ZIL DevNet',
46
47
  111: 'ZIL TestNet',
48
+ 42161: 'Arbitrum MainNet',
49
+ 421611: 'Arbitrum TestNet',
47
50
  };
48
51
  exports.CHAIN_IDS = {
49
52
  'native': 0,
@@ -53,6 +56,7 @@ exports.CHAIN_IDS = {
53
56
  'bsc': 6,
54
57
  'neo3': 14,
55
58
  'zil': 18,
59
+ 'arbitrum': 19,
56
60
  'osmosis': 244,
57
61
  'terra': 245,
58
62
  'cosmoshub': 246,
@@ -111,6 +115,9 @@ const getBlockchainFromChain = (chainId) => {
111
115
  case 110:
112
116
  case 111:
113
117
  return Blockchain.Zilliqa;
118
+ case 42161:
119
+ case 421611:
120
+ return Blockchain.Arbitrum;
114
121
  }
115
122
  return undefined;
116
123
  };
@@ -139,6 +146,8 @@ const blockchainForChainId = (chainId) => {
139
146
  case 14: // mainnet
140
147
  case 88: // testnet
141
148
  return Blockchain.Neo3;
149
+ case 19: // mainnet
150
+ return Blockchain.Arbitrum;
142
151
  case 244: // mainnet
143
152
  return Blockchain.Osmosis;
144
153
  case 245: // mainnet
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.20",
4
4
  "description": "TypeScript SDK for Carbon blockchain",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",