@octaflowlabs/onchain-sdk 1.3.2 → 1.3.5
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.
- package/dist/cjs/constants/BASIC_TOKENS_REGISTRY.d.ts +17 -0
- package/dist/cjs/constants/BASIC_TOKENS_REGISTRY.js +371 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/services/evm-wallet-core/evmWalletService.js +5 -4
- package/dist/constants/BASIC_TOKENS_REGISTRY.d.ts +17 -0
- package/dist/constants/BASIC_TOKENS_REGISTRY.js +367 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/services/evm-wallet-core/evmWalletService.js +5 -4
- package/package.json +1 -1
|
@@ -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;
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { ERC20_TOKEN_CONTRACT_ABI };
|
|
|
4
4
|
/** constants exports */
|
|
5
5
|
export { GAS_LIMIT_PER_TX_TYPE, MULTICALL3_ADDRESS } from './constants/constants';
|
|
6
6
|
export { NETWORKS_REGISTRY, NetworkField, NetworkRegistry } 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';
|
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.getProvider = exports.estimateGasLimitFromProvider = exports.broadcastTransaction = exports.buildUnsignedTransferTx = exports.buildMaxNativeTransferTx = exports.buildBaseUnsignedTransferTx = exports.BASIC_TOKENS_BY_CHAIN = exports.NETWORKS_REGISTRY = 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;
|
|
@@ -13,6 +13,8 @@ Object.defineProperty(exports, "GAS_LIMIT_PER_TX_TYPE", { enumerable: true, get:
|
|
|
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
15
|
Object.defineProperty(exports, "NETWORKS_REGISTRY", { enumerable: true, get: function () { return NETWORKS_REGISTRY_1.NETWORKS_REGISTRY; } });
|
|
16
|
+
var BASIC_TOKENS_REGISTRY_1 = require("./constants/BASIC_TOKENS_REGISTRY");
|
|
17
|
+
Object.defineProperty(exports, "BASIC_TOKENS_BY_CHAIN", { enumerable: true, get: function () { return BASIC_TOKENS_REGISTRY_1.BASIC_TOKENS_BY_CHAIN; } });
|
|
16
18
|
/** basic blockchain exports */
|
|
17
19
|
var buildUnsignedTransferTx_1 = require("./blockchain/buildUnsignedTransferTx");
|
|
18
20
|
Object.defineProperty(exports, "buildBaseUnsignedTransferTx", { enumerable: true, get: function () { return buildUnsignedTransferTx_1.buildBaseUnsignedTransferTx; } });
|
|
@@ -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:
|
|
34
|
-
privateKey:
|
|
34
|
+
address: child.address,
|
|
35
|
+
privateKey: child.privateKey,
|
|
35
36
|
path,
|
|
36
|
-
publicKey:
|
|
37
|
+
publicKey: child.publicKey,
|
|
37
38
|
});
|
|
38
39
|
}
|
|
39
40
|
return wallets;
|
|
@@ -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
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { ERC20_TOKEN_CONTRACT_ABI };
|
|
|
4
4
|
/** constants exports */
|
|
5
5
|
export { GAS_LIMIT_PER_TX_TYPE, MULTICALL3_ADDRESS } from './constants/constants';
|
|
6
6
|
export { NETWORKS_REGISTRY, NetworkField, NetworkRegistry } 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';
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export { ERC20_TOKEN_CONTRACT_ABI };
|
|
|
4
4
|
/** constants exports */
|
|
5
5
|
export { GAS_LIMIT_PER_TX_TYPE, MULTICALL3_ADDRESS } from './constants/constants';
|
|
6
6
|
export { NETWORKS_REGISTRY } 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';
|
|
@@ -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:
|
|
31
|
-
privateKey:
|
|
31
|
+
address: child.address,
|
|
32
|
+
privateKey: child.privateKey,
|
|
32
33
|
path,
|
|
33
|
-
publicKey:
|
|
34
|
+
publicKey: child.publicKey,
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
37
|
return wallets;
|