@octaflowlabs/onchain-sdk 1.3.4 → 1.3.6

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,3 +1,6 @@
1
1
  /** npm imports */
2
2
  import { JsonRpcProvider } from 'ethers';
3
+ /** local imports */
4
+ import { NetworkId } from '../constants/NETWORKS_REGISTRY';
3
5
  export declare const getProvider: (rpcUrl: string, chainId?: number) => JsonRpcProvider | undefined;
6
+ export declare const getDefaultRpc: (networkId: NetworkId) => string;
@@ -1,5 +1,7 @@
1
1
  /** npm imports */
2
2
  import { JsonRpcProvider, Network } from 'ethers';
3
+ /** local imports */
4
+ import { NETWORKS } from '../constants/NETWORKS_REGISTRY';
3
5
  export const getProvider = (rpcUrl, chainId) => {
4
6
  try {
5
7
  if (!chainId)
@@ -11,3 +13,4 @@ export const getProvider = (rpcUrl, chainId) => {
11
13
  console.warn('Could not create provider with chainId, falling back to rpcUrl only:', error);
12
14
  }
13
15
  };
16
+ export const getDefaultRpc = (networkId) => NETWORKS[networkId].rpcUrl;
@@ -1,3 +1,6 @@
1
1
  /** npm imports */
2
2
  import { JsonRpcProvider } from 'ethers';
3
+ /** local imports */
4
+ import { NetworkId } from '../constants/NETWORKS_REGISTRY';
3
5
  export declare const getProvider: (rpcUrl: string, chainId?: number) => JsonRpcProvider | undefined;
6
+ export declare const getDefaultRpc: (networkId: NetworkId) => string;
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getProvider = void 0;
3
+ exports.getDefaultRpc = exports.getProvider = void 0;
4
4
  /** npm imports */
5
5
  const ethers_1 = require("ethers");
6
+ /** local imports */
7
+ const NETWORKS_REGISTRY_1 = require("../constants/NETWORKS_REGISTRY");
6
8
  const getProvider = (rpcUrl, chainId) => {
7
9
  try {
8
10
  if (!chainId)
@@ -15,3 +17,5 @@ const getProvider = (rpcUrl, chainId) => {
15
17
  }
16
18
  };
17
19
  exports.getProvider = getProvider;
20
+ const getDefaultRpc = (networkId) => NETWORKS_REGISTRY_1.NETWORKS[networkId].rpcUrl;
21
+ exports.getDefaultRpc = getDefaultRpc;
@@ -0,0 +1,17 @@
1
+ export type BasicTokenSymbol = 'ETH' | 'BNB' | 'POL' | 'USDC' | 'USDT' | 'USD₮0' | 'DAI' | 'WETH' | 'WBNB' | 'WBTC' | 'UNI' | 'NTK';
2
+ export interface BasicTokenData {
3
+ id: string;
4
+ address: string | null;
5
+ chainId: number;
6
+ symbol: BasicTokenSymbol;
7
+ name: string;
8
+ decimals: number;
9
+ iconUrl: string;
10
+ amount: string;
11
+ usdValue: string;
12
+ isNative: boolean;
13
+ }
14
+ export type ChainTokenDataMap = Record<number, BasicTokenData[]>;
15
+ export declare const BASIC_TOKENS_BY_CHAIN: ChainTokenDataMap;
16
+ export declare const MOCK_TOKENS: BasicTokenData[];
17
+ export declare const getTokensByChain: (chainId?: number) => BasicTokenData[];
@@ -0,0 +1,371 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTokensByChain = exports.MOCK_TOKENS = exports.BASIC_TOKENS_BY_CHAIN = void 0;
4
+ //! IMPORTANT: ALL THESE TOKENS SHOULD COME FROM AN EXTERNAL SOURCE IN THE FUTURE, THEY ARE HARDCODED FOR TESTING PURPOSES ONLY. DO NOT TREAT THIS AS A SOURCE OF TRUTH FOR TOKEN ADDRESSES OR ANY OTHER TOKEN DATA, AS THIS IS LIKELY TO BE OUTDATED AND INACCURATE.
5
+ exports.BASIC_TOKENS_BY_CHAIN = {
6
+ 1: [
7
+ {
8
+ id: 'eth',
9
+ address: null,
10
+ chainId: 1,
11
+ symbol: 'ETH',
12
+ name: 'Ether',
13
+ decimals: 18,
14
+ iconUrl: 'https://assets.coingecko.com/coins/images/279/small/ethereum.png',
15
+ amount: '38.80',
16
+ usdValue: '150,000 USD',
17
+ isNative: true,
18
+ },
19
+ {
20
+ id: 'usdc',
21
+ address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
22
+ chainId: 1,
23
+ symbol: 'USDC',
24
+ name: 'USD Coin',
25
+ decimals: 6,
26
+ iconUrl: 'https://assets.coingecko.com/coins/images/6319/small/USD_Coin_icon.png',
27
+ amount: '150,000',
28
+ usdValue: '150,000 USD',
29
+ isNative: false,
30
+ },
31
+ {
32
+ id: 'usdt',
33
+ address: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
34
+ chainId: 1,
35
+ symbol: 'USDT',
36
+ name: 'Tether USD',
37
+ decimals: 6,
38
+ iconUrl: 'https://assets.coingecko.com/coins/images/325/small/Tether.png',
39
+ amount: '75,000',
40
+ usdValue: '75,000 USD',
41
+ isNative: false,
42
+ },
43
+ {
44
+ id: 'dai',
45
+ address: '0x6B175474E89094C44Da98b954EedeAC495271d0F',
46
+ chainId: 1,
47
+ symbol: 'DAI',
48
+ name: 'Dai Stablecoin',
49
+ decimals: 18,
50
+ iconUrl: 'https://assets.coingecko.com/coins/images/9956/small/Badge_Dai.png',
51
+ amount: '25,000',
52
+ usdValue: '25,000 USD',
53
+ isNative: false,
54
+ },
55
+ {
56
+ id: 'wbtc',
57
+ address: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
58
+ chainId: 1,
59
+ symbol: 'WBTC',
60
+ name: 'Wrapped BTC',
61
+ decimals: 8,
62
+ iconUrl: 'https://assets.coingecko.com/coins/images/7598/small/wrapped_bitcoin_wbtc.png',
63
+ amount: '1.5',
64
+ usdValue: '100,000 USD',
65
+ isNative: false,
66
+ },
67
+ {
68
+ id: 'uni',
69
+ address: '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984',
70
+ chainId: 1,
71
+ symbol: 'UNI',
72
+ name: 'Uniswap',
73
+ decimals: 18,
74
+ iconUrl: 'https://assets.coingecko.com/coins/images/12504/small/uniswap-uni.png',
75
+ amount: '5,000',
76
+ usdValue: '50,000 USD',
77
+ isNative: false,
78
+ },
79
+ ],
80
+ 56: [
81
+ {
82
+ id: 'bnb',
83
+ address: null,
84
+ chainId: 56,
85
+ symbol: 'BNB',
86
+ name: 'Binance Coin',
87
+ decimals: 18,
88
+ iconUrl: 'https://assets.coingecko.com/coins/images/825/small/binance-coin-logo.png',
89
+ amount: '38.80',
90
+ usdValue: '150,000 USD',
91
+ isNative: true,
92
+ },
93
+ {
94
+ id: 'wbnb',
95
+ address: '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c',
96
+ chainId: 56,
97
+ symbol: 'WBNB',
98
+ name: 'Wrapped BNB',
99
+ decimals: 18,
100
+ iconUrl: 'https://assets.coingecko.com/coins/images/825/small/binance-coin-logo.png',
101
+ amount: '38.80',
102
+ usdValue: '150,000 USD',
103
+ isNative: false,
104
+ },
105
+ {
106
+ id: 'eth',
107
+ address: '0x2170Ed0880ac9A755fd29B2688956BD959F933F8',
108
+ chainId: 56,
109
+ symbol: 'ETH',
110
+ name: 'Ether',
111
+ decimals: 18,
112
+ iconUrl: 'https://assets.coingecko.com/coins/images/279/small/ethereum.png',
113
+ amount: '38.80',
114
+ usdValue: '150,000 USD',
115
+ isNative: false,
116
+ },
117
+ {
118
+ id: 'usdc',
119
+ address: '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d',
120
+ chainId: 56,
121
+ symbol: 'USDC',
122
+ name: 'USD Coin',
123
+ decimals: 18,
124
+ iconUrl: 'https://assets.coingecko.com/coins/images/6319/small/USD_Coin_icon.png',
125
+ amount: '150,000',
126
+ usdValue: '150,000 USD',
127
+ isNative: false,
128
+ },
129
+ {
130
+ id: 'usdt',
131
+ address: '0x55d398326f99059fF775485246999027B3197955',
132
+ chainId: 56,
133
+ symbol: 'USDT',
134
+ name: 'Tether USD',
135
+ decimals: 18,
136
+ iconUrl: 'https://assets.coingecko.com/coins/images/325/small/Tether.png',
137
+ amount: '75,000',
138
+ usdValue: '75,000 USD',
139
+ isNative: false,
140
+ },
141
+ {
142
+ id: 'dai',
143
+ address: '0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3',
144
+ chainId: 56,
145
+ symbol: 'DAI',
146
+ name: 'Dai Stablecoin',
147
+ decimals: 18,
148
+ iconUrl: 'https://assets.coingecko.com/coins/images/9956/small/Badge_Dai.png',
149
+ amount: '25,000',
150
+ usdValue: '25,000 USD',
151
+ isNative: false,
152
+ },
153
+ {
154
+ id: 'wbtc',
155
+ address: '0x0555E30da8f98308EdB960aa94C0Db47230d2B9c',
156
+ chainId: 56,
157
+ symbol: 'WBTC',
158
+ name: 'Wrapped BTC',
159
+ decimals: 8,
160
+ iconUrl: 'https://assets.coingecko.com/coins/images/7598/small/wrapped_bitcoin_wbtc.png',
161
+ amount: '1.5',
162
+ usdValue: '100,000 USD',
163
+ isNative: false,
164
+ },
165
+ {
166
+ id: 'uni',
167
+ address: '0xBf5140A22578168FD562DCcF235E5D43A02ce9B1',
168
+ chainId: 56,
169
+ symbol: 'UNI',
170
+ name: 'Uniswap',
171
+ decimals: 18,
172
+ iconUrl: 'https://assets.coingecko.com/coins/images/12504/small/uniswap-uni.png',
173
+ amount: '5,000',
174
+ usdValue: '50,000 USD',
175
+ isNative: false,
176
+ },
177
+ ],
178
+ 137: [
179
+ {
180
+ id: 'pol',
181
+ address: null,
182
+ chainId: 137,
183
+ symbol: 'POL',
184
+ name: 'Polygon',
185
+ decimals: 18,
186
+ iconUrl: 'https://assets.coingecko.com/coins/images/4713/small/polygon.png',
187
+ amount: '38.80',
188
+ usdValue: '150,000 USD',
189
+ isNative: true,
190
+ },
191
+ {
192
+ id: 'weth',
193
+ address: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',
194
+ chainId: 137,
195
+ symbol: 'WETH',
196
+ name: 'Wrapped Ether',
197
+ decimals: 18,
198
+ iconUrl: 'https://assets.coingecko.com/coins/images/279/small/ethereum.png',
199
+ amount: '38.80',
200
+ usdValue: '150,000 USD',
201
+ isNative: false,
202
+ },
203
+ {
204
+ id: 'usdc',
205
+ address: '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359',
206
+ chainId: 137,
207
+ symbol: 'USDC',
208
+ name: 'USD Coin',
209
+ decimals: 6,
210
+ iconUrl: 'https://assets.coingecko.com/coins/images/6319/small/USD_Coin_icon.png',
211
+ amount: '150,000',
212
+ usdValue: '150,000 USD',
213
+ isNative: false,
214
+ },
215
+ {
216
+ id: 'usdt',
217
+ address: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F',
218
+ chainId: 137,
219
+ symbol: 'USDT',
220
+ name: 'Tether USD',
221
+ decimals: 6,
222
+ iconUrl: 'https://assets.coingecko.com/coins/images/325/small/Tether.png',
223
+ amount: '75,000',
224
+ usdValue: '75,000 USD',
225
+ isNative: false,
226
+ },
227
+ {
228
+ id: 'dai',
229
+ address: '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063',
230
+ chainId: 137,
231
+ symbol: 'DAI',
232
+ name: 'Dai Stablecoin',
233
+ decimals: 18,
234
+ iconUrl: 'https://assets.coingecko.com/coins/images/9956/small/Badge_Dai.png',
235
+ amount: '25,000',
236
+ usdValue: '25,000 USD',
237
+ isNative: false,
238
+ },
239
+ {
240
+ id: 'wbtc',
241
+ address: '0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6',
242
+ chainId: 137,
243
+ symbol: 'WBTC',
244
+ name: 'Wrapped BTC',
245
+ decimals: 8,
246
+ iconUrl: 'https://assets.coingecko.com/coins/images/7598/small/wrapped_bitcoin_wbtc.png',
247
+ amount: '1.5',
248
+ usdValue: '100,000 USD',
249
+ isNative: false,
250
+ },
251
+ {
252
+ id: 'uni',
253
+ address: '0xb33EaAd8d922B1083446DC23f610c2567fB5180f',
254
+ chainId: 137,
255
+ symbol: 'UNI',
256
+ name: 'Uniswap',
257
+ decimals: 18,
258
+ iconUrl: 'https://assets.coingecko.com/coins/images/12504/small/uniswap-uni.png',
259
+ amount: '5,000',
260
+ usdValue: '50,000 USD',
261
+ isNative: false,
262
+ },
263
+ ],
264
+ 42161: [
265
+ {
266
+ id: 'eth',
267
+ address: null,
268
+ chainId: 42161,
269
+ symbol: 'ETH',
270
+ name: 'Ether',
271
+ decimals: 18,
272
+ iconUrl: 'https://assets.coingecko.com/coins/images/279/small/ethereum.png',
273
+ amount: '38.80',
274
+ usdValue: '150,000 USD',
275
+ isNative: true,
276
+ },
277
+ {
278
+ id: 'usdc',
279
+ address: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831',
280
+ chainId: 42161,
281
+ symbol: 'USDC',
282
+ name: 'USD Coin',
283
+ decimals: 6,
284
+ iconUrl: 'https://assets.coingecko.com/coins/images/6319/small/USD_Coin_icon.png',
285
+ amount: '150,000',
286
+ usdValue: '150,000 USD',
287
+ isNative: false,
288
+ },
289
+ {
290
+ id: 'usdt',
291
+ address: '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9',
292
+ chainId: 42161,
293
+ symbol: 'USD₮0',
294
+ name: 'USD₮0',
295
+ decimals: 6,
296
+ iconUrl: 'https://assets.coingecko.com/coins/images/325/small/Tether.png',
297
+ amount: '75,000',
298
+ usdValue: '75,000 USD',
299
+ isNative: false,
300
+ },
301
+ {
302
+ id: 'dai',
303
+ address: '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1',
304
+ chainId: 42161,
305
+ symbol: 'DAI',
306
+ name: 'Dai Stablecoin',
307
+ decimals: 18,
308
+ iconUrl: 'https://assets.coingecko.com/coins/images/9956/small/Badge_Dai.png',
309
+ amount: '25,000',
310
+ usdValue: '25,000 USD',
311
+ isNative: false,
312
+ },
313
+ {
314
+ id: 'wbtc',
315
+ address: '0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f',
316
+ chainId: 42161,
317
+ symbol: 'WBTC',
318
+ name: 'Wrapped BTC',
319
+ decimals: 8,
320
+ iconUrl: 'https://assets.coingecko.com/coins/images/7598/small/wrapped_bitcoin_wbtc.png',
321
+ amount: '1.5',
322
+ usdValue: '100,000 USD',
323
+ isNative: false,
324
+ },
325
+ {
326
+ id: 'uni',
327
+ address: '0xFa7F8980b0f1E64A2062791cc3b0871572f1F7f0',
328
+ chainId: 42161,
329
+ symbol: 'UNI',
330
+ name: 'Uniswap',
331
+ decimals: 18,
332
+ iconUrl: 'https://assets.coingecko.com/coins/images/12504/small/uniswap-uni.png',
333
+ amount: '5,000',
334
+ usdValue: '50,000 USD',
335
+ isNative: false,
336
+ },
337
+ ],
338
+ 11155111: [
339
+ {
340
+ id: 'eth',
341
+ address: null,
342
+ chainId: 11155111,
343
+ symbol: 'ETH',
344
+ name: 'Ether',
345
+ decimals: 18,
346
+ iconUrl: 'https://assets.coingecko.com/coins/images/279/small/ethereum.png',
347
+ amount: '38.80',
348
+ usdValue: '150,000 USD',
349
+ isNative: true,
350
+ },
351
+ {
352
+ id: 'ntk',
353
+ address: '0x3EF76C34D1F3559918a86F2881fDC469595b5C6e',
354
+ chainId: 11155111,
355
+ symbol: 'NTK',
356
+ name: 'Novatide Token',
357
+ decimals: 18,
358
+ iconUrl: 'https://assets.coingecko.com/coins/images/279/small/ethereum.png',
359
+ amount: '38.80',
360
+ usdValue: '150,000 USD',
361
+ isNative: false,
362
+ },
363
+ ],
364
+ };
365
+ exports.MOCK_TOKENS = Object.values(exports.BASIC_TOKENS_BY_CHAIN).flat();
366
+ const getTokensByChain = (chainId) => {
367
+ if (!chainId)
368
+ return exports.MOCK_TOKENS;
369
+ return exports.BASIC_TOKENS_BY_CHAIN[chainId] || [];
370
+ };
371
+ exports.getTokensByChain = getTokensByChain;
@@ -1,5 +1,15 @@
1
+ export declare const NETWORK_IDS: {
2
+ readonly ETHEREUM_MAINNET: "ethereum-mainnet";
3
+ readonly BNB_SMART_CHAIN: "bnb-smart-chain";
4
+ readonly POLYGON_MAINNET: "polygon-mainnet";
5
+ readonly ARBITRUM_MAINNET: "arbitrum-mainnet";
6
+ readonly SEPOLIA_ETH: "sepolia-eth";
7
+ };
8
+ export type NetworkId = (typeof NETWORK_IDS)[keyof typeof NETWORK_IDS];
9
+ export type NetworkCategory = 'popular' | 'custom' | 'testnet';
1
10
  export interface NetworkField {
2
- id: string;
11
+ id: NetworkId;
12
+ category: NetworkCategory;
3
13
  name: string;
4
14
  nameForDisplay: string;
5
15
  chainId: number;
@@ -9,8 +19,5 @@ export interface NetworkField {
9
19
  symbol: string;
10
20
  failoverRpcUrl?: string;
11
21
  }
12
- export interface NetworkRegistry {
13
- category: string;
14
- networks: NetworkField[];
15
- }
16
- export declare const NETWORKS_REGISTRY: NetworkRegistry[];
22
+ export declare const NETWORKS: Record<NetworkId, NetworkField>;
23
+ export declare const getNetworksByCategory: (category: NetworkCategory) => NetworkField[];
@@ -1,70 +1,74 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NETWORKS_REGISTRY = void 0;
4
- exports.NETWORKS_REGISTRY = [
5
- {
3
+ exports.getNetworksByCategory = exports.NETWORKS = exports.NETWORK_IDS = void 0;
4
+ exports.NETWORK_IDS = {
5
+ ETHEREUM_MAINNET: 'ethereum-mainnet',
6
+ BNB_SMART_CHAIN: 'bnb-smart-chain',
7
+ POLYGON_MAINNET: 'polygon-mainnet',
8
+ ARBITRUM_MAINNET: 'arbitrum-mainnet',
9
+ SEPOLIA_ETH: 'sepolia-eth',
10
+ };
11
+ exports.NETWORKS = {
12
+ [exports.NETWORK_IDS.ETHEREUM_MAINNET]: {
13
+ id: exports.NETWORK_IDS.ETHEREUM_MAINNET,
6
14
  category: 'popular',
7
- networks: [
8
- {
9
- id: 'ethereum-mainnet',
10
- name: 'eth-mainnet',
11
- nameForDisplay: 'Ethereum Mainnet',
12
- chainId: 1,
13
- rpcUrl: 'https://ethereum-rpc.publicnode.com',
14
- explorerUrl: 'https://etherscan.io',
15
- iconUrl: 'https://assets.coingecko.com/coins/images/279/large/ethereum.png',
16
- symbol: 'ETH',
17
- failoverRpcUrl: 'https://eth.llamarpc.com',
18
- },
19
- {
20
- id: 'bnb-smart-chain',
21
- name: 'bnb-mainnet',
22
- nameForDisplay: 'BNB Smart Chain',
23
- chainId: 56,
24
- rpcUrl: 'https://bsc-dataseed.bnbchain.org',
25
- explorerUrl: 'https://bscscan.com/',
26
- iconUrl: 'https://assets.coingecko.com/coins/images/825/large/bnb-icon2_2x.png',
27
- symbol: 'BNB',
28
- failoverRpcUrl: 'https://bsc.llamarpc.com',
29
- },
30
- {
31
- id: 'polygon-mainnet',
32
- name: 'polygon-mainnet',
33
- nameForDisplay: 'Polygon Mainnet',
34
- iconUrl: 'https://assets.coingecko.com/coins/images/4713/large/matic-token-icon.png',
35
- chainId: 137,
36
- rpcUrl: 'https://polygon.publicnode.com',
37
- explorerUrl: 'https://polygonscan.com',
38
- symbol: 'POL',
39
- failoverRpcUrl: 'https://polygon.llamarpc.com',
40
- },
41
- {
42
- id: 'arbitrum-mainnet',
43
- name: 'arb-mainnet',
44
- nameForDisplay: 'Arbitrum Mainnet',
45
- chainId: 42161,
46
- rpcUrl: 'https://public-arb-mainnet.fastnode.io',
47
- explorerUrl: 'https://arbiscan.io',
48
- iconUrl: 'https://assets.coingecko.com/coins/images/16547/large/photo_2023-03-29_21.47.00.jpeg',
49
- symbol: 'ARB',
50
- failoverRpcUrl: 'https://arb.llamarpc.com',
51
- },
52
- ],
15
+ name: 'eth-mainnet',
16
+ nameForDisplay: 'Ethereum Mainnet',
17
+ chainId: 1,
18
+ rpcUrl: 'https://ethereum-rpc.publicnode.com',
19
+ explorerUrl: 'https://etherscan.io',
20
+ iconUrl: 'https://assets.coingecko.com/coins/images/279/large/ethereum.png',
21
+ symbol: 'ETH',
22
+ failoverRpcUrl: 'https://eth.llamarpc.com',
53
23
  },
54
- {
55
- category: 'custom',
56
- networks: [
57
- {
58
- id: 'sepolia-eth',
59
- name: 'eth-sepolia',
60
- nameForDisplay: 'ETH Sepolia Testnet',
61
- chainId: 11155111,
62
- rpcUrl: 'https://ethereum-sepolia-rpc.publicnode.com',
63
- explorerUrl: 'https://sepolia.etherscan.io',
64
- iconUrl: 'https://assets.coingecko.com/coins/images/279/large/ethereum.png',
65
- symbol: 'ETH',
66
- failoverRpcUrl: 'https://eth-sepolia.llamarpc.com',
67
- },
68
- ],
24
+ [exports.NETWORK_IDS.BNB_SMART_CHAIN]: {
25
+ id: exports.NETWORK_IDS.BNB_SMART_CHAIN,
26
+ category: 'popular',
27
+ name: 'bnb-mainnet',
28
+ nameForDisplay: 'BNB Smart Chain',
29
+ chainId: 56,
30
+ rpcUrl: 'https://bsc-dataseed.bnbchain.org',
31
+ explorerUrl: 'https://bscscan.com/',
32
+ iconUrl: 'https://assets.coingecko.com/coins/images/825/large/bnb-icon2_2x.png',
33
+ symbol: 'BNB',
34
+ failoverRpcUrl: 'https://bsc.llamarpc.com',
35
+ },
36
+ [exports.NETWORK_IDS.POLYGON_MAINNET]: {
37
+ id: exports.NETWORK_IDS.POLYGON_MAINNET,
38
+ category: 'popular',
39
+ name: 'polygon-mainnet',
40
+ nameForDisplay: 'Polygon Mainnet',
41
+ chainId: 137,
42
+ rpcUrl: 'https://polygon.publicnode.com',
43
+ explorerUrl: 'https://polygonscan.com',
44
+ iconUrl: 'https://assets.coingecko.com/coins/images/4713/large/matic-token-icon.png',
45
+ symbol: 'POL',
46
+ failoverRpcUrl: 'https://polygon.llamarpc.com',
47
+ },
48
+ [exports.NETWORK_IDS.ARBITRUM_MAINNET]: {
49
+ id: exports.NETWORK_IDS.ARBITRUM_MAINNET,
50
+ category: 'popular',
51
+ name: 'arb-mainnet',
52
+ nameForDisplay: 'Arbitrum Mainnet',
53
+ chainId: 42161,
54
+ rpcUrl: 'https://public-arb-mainnet.fastnode.io',
55
+ explorerUrl: 'https://arbiscan.io',
56
+ iconUrl: 'https://assets.coingecko.com/coins/images/16547/large/photo_2023-03-29_21.47.00.jpeg',
57
+ symbol: 'ARB',
58
+ failoverRpcUrl: 'https://arb.llamarpc.com',
59
+ },
60
+ [exports.NETWORK_IDS.SEPOLIA_ETH]: {
61
+ id: exports.NETWORK_IDS.SEPOLIA_ETH,
62
+ category: 'testnet',
63
+ name: 'eth-sepolia',
64
+ nameForDisplay: 'ETH Sepolia Testnet',
65
+ chainId: 11155111,
66
+ rpcUrl: 'https://ethereum-sepolia-rpc.publicnode.com',
67
+ explorerUrl: 'https://sepolia.etherscan.io',
68
+ iconUrl: 'https://assets.coingecko.com/coins/images/279/large/ethereum.png',
69
+ symbol: 'ETH',
70
+ failoverRpcUrl: 'https://eth-sepolia.llamarpc.com',
69
71
  },
70
- ];
72
+ };
73
+ const getNetworksByCategory = (category) => Object.values(exports.NETWORKS).filter((n) => n.category === category);
74
+ exports.getNetworksByCategory = getNetworksByCategory;
@@ -3,12 +3,13 @@ import ERC20_TOKEN_CONTRACT_ABI from './ABIs/ERC20_TOKEN_CONTRACT_ABI';
3
3
  export { ERC20_TOKEN_CONTRACT_ABI };
4
4
  /** constants exports */
5
5
  export { GAS_LIMIT_PER_TX_TYPE, MULTICALL3_ADDRESS } from './constants/constants';
6
- export { NETWORKS_REGISTRY, NetworkField, NetworkRegistry } from './constants/NETWORKS_REGISTRY';
6
+ export { NetworkField, NETWORKS, NetworkId, NetworkCategory, getNetworksByCategory, } from './constants/NETWORKS_REGISTRY';
7
+ export { BASIC_TOKENS_BY_CHAIN, BasicTokenData, BasicTokenSymbol, ChainTokenDataMap, } from './constants/BASIC_TOKENS_REGISTRY';
7
8
  /** basic blockchain exports */
8
9
  export { buildBaseUnsignedTransferTx, buildMaxNativeTransferTx, buildUnsignedTransferTx, } from './blockchain/buildUnsignedTransferTx';
9
10
  export { broadcastTransaction } from './blockchain/broadcastTransaction';
10
11
  export { estimateGasLimitFromProvider } from './blockchain/estimateGasLimitFromProvider';
11
- export { getProvider } from './blockchain/getProvider';
12
+ export { getProvider, getDefaultRpc } from './blockchain/getProvider';
12
13
  export { txStatus } from './blockchain/txStatus';
13
14
  export { getBalance, getBalances } from './blockchain/getBalances';
14
15
  export { estimateTransaction } from './blockchain/estimateTransaction';
package/dist/cjs/index.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.normalizeAddress = exports.errorMessagesForGasLimitEstimation = exports.errorMessagesForBroadcast = exports.handleErrorMessages = exports.parsedAmount = exports.formattedAmountForDisplay = exports.NATIVE_TOKENS = exports.transformBigInt = exports.getShortenData = exports.getShortenTransactionHashOrAddress = exports.signTransaction = exports.signMessage = exports.createWallet = exports.EvmWalletService = exports.prepareTransaction = exports.estimateTransaction = exports.getBalances = exports.getBalance = exports.txStatus = exports.getProvider = exports.estimateGasLimitFromProvider = exports.broadcastTransaction = exports.buildUnsignedTransferTx = exports.buildMaxNativeTransferTx = exports.buildBaseUnsignedTransferTx = exports.NETWORKS_REGISTRY = exports.MULTICALL3_ADDRESS = exports.GAS_LIMIT_PER_TX_TYPE = exports.ERC20_TOKEN_CONTRACT_ABI = void 0;
6
+ exports.normalizeAddress = exports.errorMessagesForGasLimitEstimation = exports.errorMessagesForBroadcast = exports.handleErrorMessages = exports.parsedAmount = exports.formattedAmountForDisplay = exports.NATIVE_TOKENS = exports.transformBigInt = exports.getShortenData = exports.getShortenTransactionHashOrAddress = exports.signTransaction = exports.signMessage = exports.createWallet = exports.EvmWalletService = exports.prepareTransaction = exports.estimateTransaction = exports.getBalances = exports.getBalance = exports.txStatus = exports.getDefaultRpc = exports.getProvider = exports.estimateGasLimitFromProvider = exports.broadcastTransaction = exports.buildUnsignedTransferTx = exports.buildMaxNativeTransferTx = exports.buildBaseUnsignedTransferTx = exports.BASIC_TOKENS_BY_CHAIN = exports.getNetworksByCategory = exports.NETWORKS = exports.MULTICALL3_ADDRESS = exports.GAS_LIMIT_PER_TX_TYPE = exports.ERC20_TOKEN_CONTRACT_ABI = void 0;
7
7
  /** ABIs exports */
8
8
  const ERC20_TOKEN_CONTRACT_ABI_1 = __importDefault(require("./ABIs/ERC20_TOKEN_CONTRACT_ABI"));
9
9
  exports.ERC20_TOKEN_CONTRACT_ABI = ERC20_TOKEN_CONTRACT_ABI_1.default;
@@ -12,7 +12,10 @@ var constants_1 = require("./constants/constants");
12
12
  Object.defineProperty(exports, "GAS_LIMIT_PER_TX_TYPE", { enumerable: true, get: function () { return constants_1.GAS_LIMIT_PER_TX_TYPE; } });
13
13
  Object.defineProperty(exports, "MULTICALL3_ADDRESS", { enumerable: true, get: function () { return constants_1.MULTICALL3_ADDRESS; } });
14
14
  var NETWORKS_REGISTRY_1 = require("./constants/NETWORKS_REGISTRY");
15
- Object.defineProperty(exports, "NETWORKS_REGISTRY", { enumerable: true, get: function () { return NETWORKS_REGISTRY_1.NETWORKS_REGISTRY; } });
15
+ Object.defineProperty(exports, "NETWORKS", { enumerable: true, get: function () { return NETWORKS_REGISTRY_1.NETWORKS; } });
16
+ Object.defineProperty(exports, "getNetworksByCategory", { enumerable: true, get: function () { return NETWORKS_REGISTRY_1.getNetworksByCategory; } });
17
+ var BASIC_TOKENS_REGISTRY_1 = require("./constants/BASIC_TOKENS_REGISTRY");
18
+ Object.defineProperty(exports, "BASIC_TOKENS_BY_CHAIN", { enumerable: true, get: function () { return BASIC_TOKENS_REGISTRY_1.BASIC_TOKENS_BY_CHAIN; } });
16
19
  /** basic blockchain exports */
17
20
  var buildUnsignedTransferTx_1 = require("./blockchain/buildUnsignedTransferTx");
18
21
  Object.defineProperty(exports, "buildBaseUnsignedTransferTx", { enumerable: true, get: function () { return buildUnsignedTransferTx_1.buildBaseUnsignedTransferTx; } });
@@ -24,6 +27,7 @@ var estimateGasLimitFromProvider_1 = require("./blockchain/estimateGasLimitFromP
24
27
  Object.defineProperty(exports, "estimateGasLimitFromProvider", { enumerable: true, get: function () { return estimateGasLimitFromProvider_1.estimateGasLimitFromProvider; } });
25
28
  var getProvider_1 = require("./blockchain/getProvider");
26
29
  Object.defineProperty(exports, "getProvider", { enumerable: true, get: function () { return getProvider_1.getProvider; } });
30
+ Object.defineProperty(exports, "getDefaultRpc", { enumerable: true, get: function () { return getProvider_1.getDefaultRpc; } });
27
31
  var txStatus_1 = require("./blockchain/txStatus");
28
32
  Object.defineProperty(exports, "txStatus", { enumerable: true, get: function () { return txStatus_1.txStatus; } });
29
33
  var getBalances_1 = require("./blockchain/getBalances");
@@ -0,0 +1,17 @@
1
+ export type BasicTokenSymbol = 'ETH' | 'BNB' | 'POL' | 'USDC' | 'USDT' | 'USD₮0' | 'DAI' | 'WETH' | 'WBNB' | 'WBTC' | 'UNI' | 'NTK';
2
+ export interface BasicTokenData {
3
+ id: string;
4
+ address: string | null;
5
+ chainId: number;
6
+ symbol: BasicTokenSymbol;
7
+ name: string;
8
+ decimals: number;
9
+ iconUrl: string;
10
+ amount: string;
11
+ usdValue: string;
12
+ isNative: boolean;
13
+ }
14
+ export type ChainTokenDataMap = Record<number, BasicTokenData[]>;
15
+ export declare const BASIC_TOKENS_BY_CHAIN: ChainTokenDataMap;
16
+ export declare const MOCK_TOKENS: BasicTokenData[];
17
+ export declare const getTokensByChain: (chainId?: number) => BasicTokenData[];
@@ -0,0 +1,367 @@
1
+ //! IMPORTANT: ALL THESE TOKENS SHOULD COME FROM AN EXTERNAL SOURCE IN THE FUTURE, THEY ARE HARDCODED FOR TESTING PURPOSES ONLY. DO NOT TREAT THIS AS A SOURCE OF TRUTH FOR TOKEN ADDRESSES OR ANY OTHER TOKEN DATA, AS THIS IS LIKELY TO BE OUTDATED AND INACCURATE.
2
+ export const BASIC_TOKENS_BY_CHAIN = {
3
+ 1: [
4
+ {
5
+ id: 'eth',
6
+ address: null,
7
+ chainId: 1,
8
+ symbol: 'ETH',
9
+ name: 'Ether',
10
+ decimals: 18,
11
+ iconUrl: 'https://assets.coingecko.com/coins/images/279/small/ethereum.png',
12
+ amount: '38.80',
13
+ usdValue: '150,000 USD',
14
+ isNative: true,
15
+ },
16
+ {
17
+ id: 'usdc',
18
+ address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
19
+ chainId: 1,
20
+ symbol: 'USDC',
21
+ name: 'USD Coin',
22
+ decimals: 6,
23
+ iconUrl: 'https://assets.coingecko.com/coins/images/6319/small/USD_Coin_icon.png',
24
+ amount: '150,000',
25
+ usdValue: '150,000 USD',
26
+ isNative: false,
27
+ },
28
+ {
29
+ id: 'usdt',
30
+ address: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
31
+ chainId: 1,
32
+ symbol: 'USDT',
33
+ name: 'Tether USD',
34
+ decimals: 6,
35
+ iconUrl: 'https://assets.coingecko.com/coins/images/325/small/Tether.png',
36
+ amount: '75,000',
37
+ usdValue: '75,000 USD',
38
+ isNative: false,
39
+ },
40
+ {
41
+ id: 'dai',
42
+ address: '0x6B175474E89094C44Da98b954EedeAC495271d0F',
43
+ chainId: 1,
44
+ symbol: 'DAI',
45
+ name: 'Dai Stablecoin',
46
+ decimals: 18,
47
+ iconUrl: 'https://assets.coingecko.com/coins/images/9956/small/Badge_Dai.png',
48
+ amount: '25,000',
49
+ usdValue: '25,000 USD',
50
+ isNative: false,
51
+ },
52
+ {
53
+ id: 'wbtc',
54
+ address: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
55
+ chainId: 1,
56
+ symbol: 'WBTC',
57
+ name: 'Wrapped BTC',
58
+ decimals: 8,
59
+ iconUrl: 'https://assets.coingecko.com/coins/images/7598/small/wrapped_bitcoin_wbtc.png',
60
+ amount: '1.5',
61
+ usdValue: '100,000 USD',
62
+ isNative: false,
63
+ },
64
+ {
65
+ id: 'uni',
66
+ address: '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984',
67
+ chainId: 1,
68
+ symbol: 'UNI',
69
+ name: 'Uniswap',
70
+ decimals: 18,
71
+ iconUrl: 'https://assets.coingecko.com/coins/images/12504/small/uniswap-uni.png',
72
+ amount: '5,000',
73
+ usdValue: '50,000 USD',
74
+ isNative: false,
75
+ },
76
+ ],
77
+ 56: [
78
+ {
79
+ id: 'bnb',
80
+ address: null,
81
+ chainId: 56,
82
+ symbol: 'BNB',
83
+ name: 'Binance Coin',
84
+ decimals: 18,
85
+ iconUrl: 'https://assets.coingecko.com/coins/images/825/small/binance-coin-logo.png',
86
+ amount: '38.80',
87
+ usdValue: '150,000 USD',
88
+ isNative: true,
89
+ },
90
+ {
91
+ id: 'wbnb',
92
+ address: '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c',
93
+ chainId: 56,
94
+ symbol: 'WBNB',
95
+ name: 'Wrapped BNB',
96
+ decimals: 18,
97
+ iconUrl: 'https://assets.coingecko.com/coins/images/825/small/binance-coin-logo.png',
98
+ amount: '38.80',
99
+ usdValue: '150,000 USD',
100
+ isNative: false,
101
+ },
102
+ {
103
+ id: 'eth',
104
+ address: '0x2170Ed0880ac9A755fd29B2688956BD959F933F8',
105
+ chainId: 56,
106
+ symbol: 'ETH',
107
+ name: 'Ether',
108
+ decimals: 18,
109
+ iconUrl: 'https://assets.coingecko.com/coins/images/279/small/ethereum.png',
110
+ amount: '38.80',
111
+ usdValue: '150,000 USD',
112
+ isNative: false,
113
+ },
114
+ {
115
+ id: 'usdc',
116
+ address: '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d',
117
+ chainId: 56,
118
+ symbol: 'USDC',
119
+ name: 'USD Coin',
120
+ decimals: 18,
121
+ iconUrl: 'https://assets.coingecko.com/coins/images/6319/small/USD_Coin_icon.png',
122
+ amount: '150,000',
123
+ usdValue: '150,000 USD',
124
+ isNative: false,
125
+ },
126
+ {
127
+ id: 'usdt',
128
+ address: '0x55d398326f99059fF775485246999027B3197955',
129
+ chainId: 56,
130
+ symbol: 'USDT',
131
+ name: 'Tether USD',
132
+ decimals: 18,
133
+ iconUrl: 'https://assets.coingecko.com/coins/images/325/small/Tether.png',
134
+ amount: '75,000',
135
+ usdValue: '75,000 USD',
136
+ isNative: false,
137
+ },
138
+ {
139
+ id: 'dai',
140
+ address: '0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3',
141
+ chainId: 56,
142
+ symbol: 'DAI',
143
+ name: 'Dai Stablecoin',
144
+ decimals: 18,
145
+ iconUrl: 'https://assets.coingecko.com/coins/images/9956/small/Badge_Dai.png',
146
+ amount: '25,000',
147
+ usdValue: '25,000 USD',
148
+ isNative: false,
149
+ },
150
+ {
151
+ id: 'wbtc',
152
+ address: '0x0555E30da8f98308EdB960aa94C0Db47230d2B9c',
153
+ chainId: 56,
154
+ symbol: 'WBTC',
155
+ name: 'Wrapped BTC',
156
+ decimals: 8,
157
+ iconUrl: 'https://assets.coingecko.com/coins/images/7598/small/wrapped_bitcoin_wbtc.png',
158
+ amount: '1.5',
159
+ usdValue: '100,000 USD',
160
+ isNative: false,
161
+ },
162
+ {
163
+ id: 'uni',
164
+ address: '0xBf5140A22578168FD562DCcF235E5D43A02ce9B1',
165
+ chainId: 56,
166
+ symbol: 'UNI',
167
+ name: 'Uniswap',
168
+ decimals: 18,
169
+ iconUrl: 'https://assets.coingecko.com/coins/images/12504/small/uniswap-uni.png',
170
+ amount: '5,000',
171
+ usdValue: '50,000 USD',
172
+ isNative: false,
173
+ },
174
+ ],
175
+ 137: [
176
+ {
177
+ id: 'pol',
178
+ address: null,
179
+ chainId: 137,
180
+ symbol: 'POL',
181
+ name: 'Polygon',
182
+ decimals: 18,
183
+ iconUrl: 'https://assets.coingecko.com/coins/images/4713/small/polygon.png',
184
+ amount: '38.80',
185
+ usdValue: '150,000 USD',
186
+ isNative: true,
187
+ },
188
+ {
189
+ id: 'weth',
190
+ address: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',
191
+ chainId: 137,
192
+ symbol: 'WETH',
193
+ name: 'Wrapped Ether',
194
+ decimals: 18,
195
+ iconUrl: 'https://assets.coingecko.com/coins/images/279/small/ethereum.png',
196
+ amount: '38.80',
197
+ usdValue: '150,000 USD',
198
+ isNative: false,
199
+ },
200
+ {
201
+ id: 'usdc',
202
+ address: '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359',
203
+ chainId: 137,
204
+ symbol: 'USDC',
205
+ name: 'USD Coin',
206
+ decimals: 6,
207
+ iconUrl: 'https://assets.coingecko.com/coins/images/6319/small/USD_Coin_icon.png',
208
+ amount: '150,000',
209
+ usdValue: '150,000 USD',
210
+ isNative: false,
211
+ },
212
+ {
213
+ id: 'usdt',
214
+ address: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F',
215
+ chainId: 137,
216
+ symbol: 'USDT',
217
+ name: 'Tether USD',
218
+ decimals: 6,
219
+ iconUrl: 'https://assets.coingecko.com/coins/images/325/small/Tether.png',
220
+ amount: '75,000',
221
+ usdValue: '75,000 USD',
222
+ isNative: false,
223
+ },
224
+ {
225
+ id: 'dai',
226
+ address: '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063',
227
+ chainId: 137,
228
+ symbol: 'DAI',
229
+ name: 'Dai Stablecoin',
230
+ decimals: 18,
231
+ iconUrl: 'https://assets.coingecko.com/coins/images/9956/small/Badge_Dai.png',
232
+ amount: '25,000',
233
+ usdValue: '25,000 USD',
234
+ isNative: false,
235
+ },
236
+ {
237
+ id: 'wbtc',
238
+ address: '0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6',
239
+ chainId: 137,
240
+ symbol: 'WBTC',
241
+ name: 'Wrapped BTC',
242
+ decimals: 8,
243
+ iconUrl: 'https://assets.coingecko.com/coins/images/7598/small/wrapped_bitcoin_wbtc.png',
244
+ amount: '1.5',
245
+ usdValue: '100,000 USD',
246
+ isNative: false,
247
+ },
248
+ {
249
+ id: 'uni',
250
+ address: '0xb33EaAd8d922B1083446DC23f610c2567fB5180f',
251
+ chainId: 137,
252
+ symbol: 'UNI',
253
+ name: 'Uniswap',
254
+ decimals: 18,
255
+ iconUrl: 'https://assets.coingecko.com/coins/images/12504/small/uniswap-uni.png',
256
+ amount: '5,000',
257
+ usdValue: '50,000 USD',
258
+ isNative: false,
259
+ },
260
+ ],
261
+ 42161: [
262
+ {
263
+ id: 'eth',
264
+ address: null,
265
+ chainId: 42161,
266
+ symbol: 'ETH',
267
+ name: 'Ether',
268
+ decimals: 18,
269
+ iconUrl: 'https://assets.coingecko.com/coins/images/279/small/ethereum.png',
270
+ amount: '38.80',
271
+ usdValue: '150,000 USD',
272
+ isNative: true,
273
+ },
274
+ {
275
+ id: 'usdc',
276
+ address: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831',
277
+ chainId: 42161,
278
+ symbol: 'USDC',
279
+ name: 'USD Coin',
280
+ decimals: 6,
281
+ iconUrl: 'https://assets.coingecko.com/coins/images/6319/small/USD_Coin_icon.png',
282
+ amount: '150,000',
283
+ usdValue: '150,000 USD',
284
+ isNative: false,
285
+ },
286
+ {
287
+ id: 'usdt',
288
+ address: '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9',
289
+ chainId: 42161,
290
+ symbol: 'USD₮0',
291
+ name: 'USD₮0',
292
+ decimals: 6,
293
+ iconUrl: 'https://assets.coingecko.com/coins/images/325/small/Tether.png',
294
+ amount: '75,000',
295
+ usdValue: '75,000 USD',
296
+ isNative: false,
297
+ },
298
+ {
299
+ id: 'dai',
300
+ address: '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1',
301
+ chainId: 42161,
302
+ symbol: 'DAI',
303
+ name: 'Dai Stablecoin',
304
+ decimals: 18,
305
+ iconUrl: 'https://assets.coingecko.com/coins/images/9956/small/Badge_Dai.png',
306
+ amount: '25,000',
307
+ usdValue: '25,000 USD',
308
+ isNative: false,
309
+ },
310
+ {
311
+ id: 'wbtc',
312
+ address: '0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f',
313
+ chainId: 42161,
314
+ symbol: 'WBTC',
315
+ name: 'Wrapped BTC',
316
+ decimals: 8,
317
+ iconUrl: 'https://assets.coingecko.com/coins/images/7598/small/wrapped_bitcoin_wbtc.png',
318
+ amount: '1.5',
319
+ usdValue: '100,000 USD',
320
+ isNative: false,
321
+ },
322
+ {
323
+ id: 'uni',
324
+ address: '0xFa7F8980b0f1E64A2062791cc3b0871572f1F7f0',
325
+ chainId: 42161,
326
+ symbol: 'UNI',
327
+ name: 'Uniswap',
328
+ decimals: 18,
329
+ iconUrl: 'https://assets.coingecko.com/coins/images/12504/small/uniswap-uni.png',
330
+ amount: '5,000',
331
+ usdValue: '50,000 USD',
332
+ isNative: false,
333
+ },
334
+ ],
335
+ 11155111: [
336
+ {
337
+ id: 'eth',
338
+ address: null,
339
+ chainId: 11155111,
340
+ symbol: 'ETH',
341
+ name: 'Ether',
342
+ decimals: 18,
343
+ iconUrl: 'https://assets.coingecko.com/coins/images/279/small/ethereum.png',
344
+ amount: '38.80',
345
+ usdValue: '150,000 USD',
346
+ isNative: true,
347
+ },
348
+ {
349
+ id: 'ntk',
350
+ address: '0x3EF76C34D1F3559918a86F2881fDC469595b5C6e',
351
+ chainId: 11155111,
352
+ symbol: 'NTK',
353
+ name: 'Novatide Token',
354
+ decimals: 18,
355
+ iconUrl: 'https://assets.coingecko.com/coins/images/279/small/ethereum.png',
356
+ amount: '38.80',
357
+ usdValue: '150,000 USD',
358
+ isNative: false,
359
+ },
360
+ ],
361
+ };
362
+ export const MOCK_TOKENS = Object.values(BASIC_TOKENS_BY_CHAIN).flat();
363
+ export const getTokensByChain = (chainId) => {
364
+ if (!chainId)
365
+ return MOCK_TOKENS;
366
+ return BASIC_TOKENS_BY_CHAIN[chainId] || [];
367
+ };
@@ -1,5 +1,15 @@
1
+ export declare const NETWORK_IDS: {
2
+ readonly ETHEREUM_MAINNET: "ethereum-mainnet";
3
+ readonly BNB_SMART_CHAIN: "bnb-smart-chain";
4
+ readonly POLYGON_MAINNET: "polygon-mainnet";
5
+ readonly ARBITRUM_MAINNET: "arbitrum-mainnet";
6
+ readonly SEPOLIA_ETH: "sepolia-eth";
7
+ };
8
+ export type NetworkId = (typeof NETWORK_IDS)[keyof typeof NETWORK_IDS];
9
+ export type NetworkCategory = 'popular' | 'custom' | 'testnet';
1
10
  export interface NetworkField {
2
- id: string;
11
+ id: NetworkId;
12
+ category: NetworkCategory;
3
13
  name: string;
4
14
  nameForDisplay: string;
5
15
  chainId: number;
@@ -9,8 +19,5 @@ export interface NetworkField {
9
19
  symbol: string;
10
20
  failoverRpcUrl?: string;
11
21
  }
12
- export interface NetworkRegistry {
13
- category: string;
14
- networks: NetworkField[];
15
- }
16
- export declare const NETWORKS_REGISTRY: NetworkRegistry[];
22
+ export declare const NETWORKS: Record<NetworkId, NetworkField>;
23
+ export declare const getNetworksByCategory: (category: NetworkCategory) => NetworkField[];
@@ -1,67 +1,70 @@
1
- export const NETWORKS_REGISTRY = [
2
- {
1
+ export const NETWORK_IDS = {
2
+ ETHEREUM_MAINNET: 'ethereum-mainnet',
3
+ BNB_SMART_CHAIN: 'bnb-smart-chain',
4
+ POLYGON_MAINNET: 'polygon-mainnet',
5
+ ARBITRUM_MAINNET: 'arbitrum-mainnet',
6
+ SEPOLIA_ETH: 'sepolia-eth',
7
+ };
8
+ export const NETWORKS = {
9
+ [NETWORK_IDS.ETHEREUM_MAINNET]: {
10
+ id: NETWORK_IDS.ETHEREUM_MAINNET,
3
11
  category: 'popular',
4
- networks: [
5
- {
6
- id: 'ethereum-mainnet',
7
- name: 'eth-mainnet',
8
- nameForDisplay: 'Ethereum Mainnet',
9
- chainId: 1,
10
- rpcUrl: 'https://ethereum-rpc.publicnode.com',
11
- explorerUrl: 'https://etherscan.io',
12
- iconUrl: 'https://assets.coingecko.com/coins/images/279/large/ethereum.png',
13
- symbol: 'ETH',
14
- failoverRpcUrl: 'https://eth.llamarpc.com',
15
- },
16
- {
17
- id: 'bnb-smart-chain',
18
- name: 'bnb-mainnet',
19
- nameForDisplay: 'BNB Smart Chain',
20
- chainId: 56,
21
- rpcUrl: 'https://bsc-dataseed.bnbchain.org',
22
- explorerUrl: 'https://bscscan.com/',
23
- iconUrl: 'https://assets.coingecko.com/coins/images/825/large/bnb-icon2_2x.png',
24
- symbol: 'BNB',
25
- failoverRpcUrl: 'https://bsc.llamarpc.com',
26
- },
27
- {
28
- id: 'polygon-mainnet',
29
- name: 'polygon-mainnet',
30
- nameForDisplay: 'Polygon Mainnet',
31
- iconUrl: 'https://assets.coingecko.com/coins/images/4713/large/matic-token-icon.png',
32
- chainId: 137,
33
- rpcUrl: 'https://polygon.publicnode.com',
34
- explorerUrl: 'https://polygonscan.com',
35
- symbol: 'POL',
36
- failoverRpcUrl: 'https://polygon.llamarpc.com',
37
- },
38
- {
39
- id: 'arbitrum-mainnet',
40
- name: 'arb-mainnet',
41
- nameForDisplay: 'Arbitrum Mainnet',
42
- chainId: 42161,
43
- rpcUrl: 'https://public-arb-mainnet.fastnode.io',
44
- explorerUrl: 'https://arbiscan.io',
45
- iconUrl: 'https://assets.coingecko.com/coins/images/16547/large/photo_2023-03-29_21.47.00.jpeg',
46
- symbol: 'ARB',
47
- failoverRpcUrl: 'https://arb.llamarpc.com',
48
- },
49
- ],
12
+ name: 'eth-mainnet',
13
+ nameForDisplay: 'Ethereum Mainnet',
14
+ chainId: 1,
15
+ rpcUrl: 'https://ethereum-rpc.publicnode.com',
16
+ explorerUrl: 'https://etherscan.io',
17
+ iconUrl: 'https://assets.coingecko.com/coins/images/279/large/ethereum.png',
18
+ symbol: 'ETH',
19
+ failoverRpcUrl: 'https://eth.llamarpc.com',
50
20
  },
51
- {
52
- category: 'custom',
53
- networks: [
54
- {
55
- id: 'sepolia-eth',
56
- name: 'eth-sepolia',
57
- nameForDisplay: 'ETH Sepolia Testnet',
58
- chainId: 11155111,
59
- rpcUrl: 'https://ethereum-sepolia-rpc.publicnode.com',
60
- explorerUrl: 'https://sepolia.etherscan.io',
61
- iconUrl: 'https://assets.coingecko.com/coins/images/279/large/ethereum.png',
62
- symbol: 'ETH',
63
- failoverRpcUrl: 'https://eth-sepolia.llamarpc.com',
64
- },
65
- ],
21
+ [NETWORK_IDS.BNB_SMART_CHAIN]: {
22
+ id: NETWORK_IDS.BNB_SMART_CHAIN,
23
+ category: 'popular',
24
+ name: 'bnb-mainnet',
25
+ nameForDisplay: 'BNB Smart Chain',
26
+ chainId: 56,
27
+ rpcUrl: 'https://bsc-dataseed.bnbchain.org',
28
+ explorerUrl: 'https://bscscan.com/',
29
+ iconUrl: 'https://assets.coingecko.com/coins/images/825/large/bnb-icon2_2x.png',
30
+ symbol: 'BNB',
31
+ failoverRpcUrl: 'https://bsc.llamarpc.com',
32
+ },
33
+ [NETWORK_IDS.POLYGON_MAINNET]: {
34
+ id: NETWORK_IDS.POLYGON_MAINNET,
35
+ category: 'popular',
36
+ name: 'polygon-mainnet',
37
+ nameForDisplay: 'Polygon Mainnet',
38
+ chainId: 137,
39
+ rpcUrl: 'https://polygon.publicnode.com',
40
+ explorerUrl: 'https://polygonscan.com',
41
+ iconUrl: 'https://assets.coingecko.com/coins/images/4713/large/matic-token-icon.png',
42
+ symbol: 'POL',
43
+ failoverRpcUrl: 'https://polygon.llamarpc.com',
44
+ },
45
+ [NETWORK_IDS.ARBITRUM_MAINNET]: {
46
+ id: NETWORK_IDS.ARBITRUM_MAINNET,
47
+ category: 'popular',
48
+ name: 'arb-mainnet',
49
+ nameForDisplay: 'Arbitrum Mainnet',
50
+ chainId: 42161,
51
+ rpcUrl: 'https://public-arb-mainnet.fastnode.io',
52
+ explorerUrl: 'https://arbiscan.io',
53
+ iconUrl: 'https://assets.coingecko.com/coins/images/16547/large/photo_2023-03-29_21.47.00.jpeg',
54
+ symbol: 'ARB',
55
+ failoverRpcUrl: 'https://arb.llamarpc.com',
56
+ },
57
+ [NETWORK_IDS.SEPOLIA_ETH]: {
58
+ id: NETWORK_IDS.SEPOLIA_ETH,
59
+ category: 'testnet',
60
+ name: 'eth-sepolia',
61
+ nameForDisplay: 'ETH Sepolia Testnet',
62
+ chainId: 11155111,
63
+ rpcUrl: 'https://ethereum-sepolia-rpc.publicnode.com',
64
+ explorerUrl: 'https://sepolia.etherscan.io',
65
+ iconUrl: 'https://assets.coingecko.com/coins/images/279/large/ethereum.png',
66
+ symbol: 'ETH',
67
+ failoverRpcUrl: 'https://eth-sepolia.llamarpc.com',
66
68
  },
67
- ];
69
+ };
70
+ export const getNetworksByCategory = (category) => Object.values(NETWORKS).filter((n) => n.category === category);
package/dist/index.d.ts CHANGED
@@ -3,12 +3,13 @@ import ERC20_TOKEN_CONTRACT_ABI from './ABIs/ERC20_TOKEN_CONTRACT_ABI';
3
3
  export { ERC20_TOKEN_CONTRACT_ABI };
4
4
  /** constants exports */
5
5
  export { GAS_LIMIT_PER_TX_TYPE, MULTICALL3_ADDRESS } from './constants/constants';
6
- export { NETWORKS_REGISTRY, NetworkField, NetworkRegistry } from './constants/NETWORKS_REGISTRY';
6
+ export { NetworkField, NETWORKS, NetworkId, NetworkCategory, getNetworksByCategory, } from './constants/NETWORKS_REGISTRY';
7
+ export { BASIC_TOKENS_BY_CHAIN, BasicTokenData, BasicTokenSymbol, ChainTokenDataMap, } from './constants/BASIC_TOKENS_REGISTRY';
7
8
  /** basic blockchain exports */
8
9
  export { buildBaseUnsignedTransferTx, buildMaxNativeTransferTx, buildUnsignedTransferTx, } from './blockchain/buildUnsignedTransferTx';
9
10
  export { broadcastTransaction } from './blockchain/broadcastTransaction';
10
11
  export { estimateGasLimitFromProvider } from './blockchain/estimateGasLimitFromProvider';
11
- export { getProvider } from './blockchain/getProvider';
12
+ export { getProvider, getDefaultRpc } from './blockchain/getProvider';
12
13
  export { txStatus } from './blockchain/txStatus';
13
14
  export { getBalance, getBalances } from './blockchain/getBalances';
14
15
  export { estimateTransaction } from './blockchain/estimateTransaction';
package/dist/index.js CHANGED
@@ -3,12 +3,13 @@ import ERC20_TOKEN_CONTRACT_ABI from './ABIs/ERC20_TOKEN_CONTRACT_ABI';
3
3
  export { ERC20_TOKEN_CONTRACT_ABI };
4
4
  /** constants exports */
5
5
  export { GAS_LIMIT_PER_TX_TYPE, MULTICALL3_ADDRESS } from './constants/constants';
6
- export { NETWORKS_REGISTRY } from './constants/NETWORKS_REGISTRY';
6
+ export { NETWORKS, getNetworksByCategory, } from './constants/NETWORKS_REGISTRY';
7
+ export { BASIC_TOKENS_BY_CHAIN, } from './constants/BASIC_TOKENS_REGISTRY';
7
8
  /** basic blockchain exports */
8
9
  export { buildBaseUnsignedTransferTx, buildMaxNativeTransferTx, buildUnsignedTransferTx, } from './blockchain/buildUnsignedTransferTx';
9
10
  export { broadcastTransaction } from './blockchain/broadcastTransaction';
10
11
  export { estimateGasLimitFromProvider } from './blockchain/estimateGasLimitFromProvider';
11
- export { getProvider } from './blockchain/getProvider';
12
+ export { getProvider, getDefaultRpc } from './blockchain/getProvider';
12
13
  export { txStatus } from './blockchain/txStatus';
13
14
  export { getBalance, getBalances } from './blockchain/getBalances';
14
15
  export { estimateTransaction } from './blockchain/estimateTransaction';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octaflowlabs/onchain-sdk",
3
- "version": "1.3.4",
3
+ "version": "1.3.6",
4
4
  "description": "onchain methods for web3",
5
5
  "repository": "https://github.com/crisramb665/onchain-sdk.git",
6
6
  "license": "MIT",