@sentio/sdk 2.15.0-rc.2 → 2.15.0-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/lib/aptos/context.d.ts +7 -8
  2. package/lib/aptos/context.js +10 -7
  3. package/lib/aptos/context.js.map +1 -1
  4. package/lib/aptos/ext/aptos-dex.d.ts +11 -19
  5. package/lib/aptos/ext/aptos-dex.js +13 -172
  6. package/lib/aptos/ext/aptos-dex.js.map +1 -1
  7. package/lib/aptos/ext/coin.d.ts +2 -10
  8. package/lib/aptos/ext/coin.js +0 -3
  9. package/lib/aptos/ext/coin.js.map +1 -1
  10. package/lib/move/abstract-move-coder.d.ts +1 -1
  11. package/lib/move/abstract-move-coder.js.map +1 -1
  12. package/lib/move/ext/coin-list.d.ts +8 -0
  13. package/lib/move/ext/coin-list.js +2 -0
  14. package/lib/move/ext/coin-list.js.map +1 -0
  15. package/lib/move/ext/index.d.ts +2 -0
  16. package/lib/move/ext/index.js +3 -0
  17. package/lib/move/ext/index.js.map +1 -0
  18. package/lib/move/ext/move-dex.d.ts +34 -0
  19. package/lib/move/ext/move-dex.js +180 -0
  20. package/lib/move/ext/move-dex.js.map +1 -0
  21. package/lib/move/index.d.ts +1 -0
  22. package/lib/move/index.js +1 -0
  23. package/lib/move/index.js.map +1 -1
  24. package/lib/move/move-context.d.ts +14 -0
  25. package/lib/move/move-context.js +12 -0
  26. package/lib/move/move-context.js.map +1 -0
  27. package/lib/sui/context.d.ts +9 -8
  28. package/lib/sui/context.js +11 -6
  29. package/lib/sui/context.js.map +1 -1
  30. package/lib/sui/ext/coin.d.ts +14 -0
  31. package/lib/sui/ext/coin.js +508 -0
  32. package/lib/sui/ext/coin.js.map +1 -0
  33. package/lib/sui/ext/move-dex.d.ts +18 -0
  34. package/lib/sui/ext/move-dex.js +21 -0
  35. package/lib/sui/ext/move-dex.js.map +1 -0
  36. package/lib/sui/sui-plugin.d.ts +2 -1
  37. package/lib/sui/sui-plugin.js +4 -0
  38. package/lib/sui/sui-plugin.js.map +1 -1
  39. package/package.json +3 -3
  40. package/src/aptos/context.ts +13 -8
  41. package/src/aptos/ext/aptos-dex.ts +34 -224
  42. package/src/aptos/ext/coin.ts +2 -11
  43. package/src/move/abstract-move-coder.ts +1 -1
  44. package/src/move/ext/coin-list.ts +9 -0
  45. package/src/move/ext/index.ts +2 -0
  46. package/src/move/ext/move-dex.ts +255 -0
  47. package/src/move/index.ts +1 -0
  48. package/src/move/move-context.ts +18 -0
  49. package/src/sui/context.ts +26 -8
  50. package/src/sui/ext/coin.ts +537 -0
  51. package/src/sui/ext/move-dex.ts +41 -0
  52. package/src/sui/sui-plugin.ts +5 -0
@@ -0,0 +1,508 @@
1
+ import fetch from 'node-fetch';
2
+ import { SPLITTER } from '../../move/index.js';
3
+ import { getPriceByType } from '../../utils/index.js';
4
+ import { SuiChainId } from '../../core/chain.js';
5
+ import { validateAndNormalizeAddress } from '../utils.js';
6
+ const WHITELISTED_COINS = new Map();
7
+ export async function initCoinList() {
8
+ let list = DEFAULT_LIST.coinlist;
9
+ try {
10
+ const resp = await fetch('https://raw.githubusercontent.com/solflare-wallet/sui-coinlist/master/sui-coinlist.json');
11
+ list = (await resp.json()).coinlist;
12
+ }
13
+ catch (e) {
14
+ console.warn("Can't not fetch newest coin list, use default list");
15
+ }
16
+ setCoinList(list);
17
+ }
18
+ function setCoinList(list) {
19
+ for (const info of list) {
20
+ if (info.address.startsWith('0x2::coin::Coin')) {
21
+ continue;
22
+ }
23
+ if (info.network !== 'mainnet') {
24
+ continue;
25
+ }
26
+ let bridge = 'native';
27
+ if (info.name.includes('Celer')) {
28
+ bridge = 'Celer';
29
+ }
30
+ if (info.name.includes('LayerZero')) {
31
+ bridge = 'LayerZero';
32
+ }
33
+ if (info.name.includes('Wormhole')) {
34
+ bridge = 'Wormhole';
35
+ }
36
+ WHITELISTED_COINS.set(info.address, {
37
+ token_type: {
38
+ type: info.address,
39
+ account_address: info.address.split('::')[0],
40
+ },
41
+ symbol: info.symbol,
42
+ decimals: info.decimals,
43
+ bridge,
44
+ });
45
+ }
46
+ }
47
+ export function whitelistCoins() {
48
+ return WHITELISTED_COINS;
49
+ }
50
+ export function whiteListed(coin) {
51
+ const [addr, module, type] = coin.split(SPLITTER);
52
+ const normalized = [validateAndNormalizeAddress(addr), module, type].join(SPLITTER);
53
+ return WHITELISTED_COINS.has(normalized);
54
+ }
55
+ export function getCoinInfo(type) {
56
+ const r = WHITELISTED_COINS.get(type);
57
+ if (!r) {
58
+ const parts = type.split('::');
59
+ // TDDO retrive from network
60
+ return {
61
+ token_type: { type: type, account_address: parts[0] },
62
+ symbol: parts[2],
63
+ decimals: 8,
64
+ bridge: 'native',
65
+ };
66
+ }
67
+ return r;
68
+ }
69
+ export async function getPrice(coinType, timestamp) {
70
+ if (!whiteListed(coinType)) {
71
+ return 0.0;
72
+ }
73
+ const date = new Date(timestamp / 1000);
74
+ try {
75
+ return (await getPriceByType(SuiChainId.SUI_MAINNET, coinType, date)) || 0;
76
+ }
77
+ catch (error) {
78
+ console.log(JSON.stringify(error));
79
+ throw error;
80
+ }
81
+ }
82
+ export async function calculateValueInUsd(n, coinInfo, timestamp) {
83
+ const price = await getPrice(coinInfo.token_type.type, timestamp);
84
+ const amount = n.scaleDown(coinInfo.decimals);
85
+ return amount.multipliedBy(price);
86
+ }
87
+ const DEFAULT_LIST = {
88
+ name: 'Sui Coin List',
89
+ timestamp: '2022-12-01T13:34:30.145Z',
90
+ logoURI: 'https://s2.coinmarketcap.com/static/img/coins/128x128/20947.png',
91
+ coinlist: [
92
+ {
93
+ network: 'mainnet',
94
+ address: '0x2::coin::Coin<0x2::sui::SUI>',
95
+ symbol: 'SUI',
96
+ name: 'Sui Coin',
97
+ decimals: 9,
98
+ logoURI: 'https://cryptototem.com/wp-content/uploads/2022/08/SUI-logo.jpg',
99
+ tags: [],
100
+ extensions: {
101
+ coingeckoId: 'sui',
102
+ },
103
+ },
104
+ {
105
+ network: 'testnet',
106
+ address: '0x2::coin::Coin<0x2::sui::SUI>',
107
+ symbol: 'SUI',
108
+ name: 'Sui Coin',
109
+ decimals: 9,
110
+ logoURI: 'https://cryptototem.com/wp-content/uploads/2022/08/SUI-logo.jpg',
111
+ tags: [],
112
+ extensions: {
113
+ coingeckoId: 'sui',
114
+ },
115
+ },
116
+ {
117
+ network: 'devnet',
118
+ address: '0x2::coin::Coin<0x2::sui::SUI>',
119
+ symbol: 'SUI',
120
+ name: 'Sui Coin',
121
+ decimals: 9,
122
+ logoURI: 'https://cryptototem.com/wp-content/uploads/2022/08/SUI-logo.jpg',
123
+ tags: [],
124
+ extensions: {
125
+ coingeckoId: 'sui',
126
+ },
127
+ },
128
+ {
129
+ network: 'mainnet',
130
+ address: '0x2::sui::SUI',
131
+ symbol: 'SUI',
132
+ name: 'Sui Coin',
133
+ decimals: 9,
134
+ logoURI: 'https://cryptototem.com/wp-content/uploads/2022/08/SUI-logo.jpg',
135
+ tags: [],
136
+ extensions: {
137
+ coingeckoId: 'sui',
138
+ },
139
+ },
140
+ {
141
+ network: 'testnet',
142
+ address: '0x2::sui::SUI',
143
+ symbol: 'SUI',
144
+ name: 'Sui Coin',
145
+ decimals: 9,
146
+ logoURI: 'https://cryptototem.com/wp-content/uploads/2022/08/SUI-logo.jpg',
147
+ tags: [],
148
+ extensions: {
149
+ coingeckoId: 'sui',
150
+ },
151
+ },
152
+ {
153
+ network: 'devnet',
154
+ address: '0x2::sui::SUI',
155
+ symbol: 'SUI',
156
+ name: 'Sui Coin',
157
+ decimals: 9,
158
+ logoURI: 'https://cryptototem.com/wp-content/uploads/2022/08/SUI-logo.jpg',
159
+ tags: [],
160
+ extensions: {
161
+ coingeckoId: 'sui',
162
+ },
163
+ },
164
+ {
165
+ network: 'testnet',
166
+ address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestTEST',
167
+ symbol: 'TEST',
168
+ name: 'Test Token',
169
+ logoURI: 'https://suiswap.app/images/token/suiswap-test.svg',
170
+ tags: [],
171
+ decimals: 8,
172
+ extensions: {},
173
+ },
174
+ {
175
+ network: 'testnet',
176
+ address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestUSDT',
177
+ symbol: 'USDT',
178
+ name: 'Tether',
179
+ logoURI: 'https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/BQcdHdAQW1hczDbBi9hiegXAR7A98Q9jx3X3iBBBDiq4/logo.png',
180
+ tags: [],
181
+ decimals: 8,
182
+ extensions: {
183
+ coingeckoId: 'tether',
184
+ },
185
+ },
186
+ {
187
+ network: 'testnet',
188
+ address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestUSDC',
189
+ symbol: 'USDC',
190
+ name: 'USD Coin',
191
+ logoURI: 'https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/logo.png',
192
+ decimals: 8,
193
+ tags: [],
194
+ extensions: {
195
+ coingeckoId: 'usd-coin',
196
+ },
197
+ },
198
+ {
199
+ network: 'testnet',
200
+ address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestSOL',
201
+ symbol: 'SOL',
202
+ name: 'Solana',
203
+ logoURI: 'https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png',
204
+ decimals: 8,
205
+ extensions: {
206
+ coingeckoId: 'solana',
207
+ },
208
+ },
209
+ {
210
+ network: 'testnet',
211
+ address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestBTC',
212
+ symbol: 'BTC',
213
+ name: 'Bitcoin',
214
+ logoURI: 'https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E/logo.png',
215
+ decimals: 8,
216
+ tags: [],
217
+ extensions: {
218
+ coingeckoId: 'bitcoin',
219
+ },
220
+ },
221
+ {
222
+ network: 'testnet',
223
+ address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestDAI',
224
+ symbol: 'DAI',
225
+ name: 'DAI',
226
+ logoURI: 'https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/FYpdBuyAHSbdaAyD1sKkxyLWbAP8uUW9h6uvdhK74ij1/logo.png',
227
+ decimals: 8,
228
+ tags: [],
229
+ extensions: {
230
+ coingeckoId: 'dai',
231
+ },
232
+ },
233
+ {
234
+ network: 'testnet',
235
+ address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestBNB',
236
+ symbol: 'BNB',
237
+ name: 'BNB',
238
+ logoURI: 'https://assets.coingecko.com/coins/images/825/large/bnb-icon2_2x.png',
239
+ decimals: 8,
240
+ tags: [],
241
+ extensions: {
242
+ coingeckoId: 'binancecoin',
243
+ },
244
+ },
245
+ {
246
+ network: 'testnet',
247
+ address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestETH',
248
+ symbol: 'ETH',
249
+ name: 'Ethereum',
250
+ logoURI: 'https://assets.coingecko.com/coins/images/279/large/ethereum.png',
251
+ decimals: 8,
252
+ tags: [],
253
+ extensions: {
254
+ coingeckoId: 'ethereum',
255
+ },
256
+ },
257
+ {
258
+ network: 'testnet',
259
+ address: '0x31b14985adb91360ed90a5786cb0956c83e7f275a8ae6123f38adab9d2b792b1::usdc::USDC',
260
+ symbol: 'USDC',
261
+ name: 'USD Coin',
262
+ logoURI: 'https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/logo.png',
263
+ decimals: 8,
264
+ tags: [],
265
+ extensions: {
266
+ coingeckoId: 'usd-coin',
267
+ },
268
+ },
269
+ {
270
+ network: 'devnet',
271
+ address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestTEST',
272
+ symbol: 'TEST',
273
+ name: 'Test Token',
274
+ logoURI: 'https://suiswap.app/images/token/suiswap-test.svg',
275
+ tags: [],
276
+ decimals: 8,
277
+ extensions: {},
278
+ },
279
+ {
280
+ network: 'devnet',
281
+ address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestUSDT',
282
+ symbol: 'USDT',
283
+ name: 'Tether',
284
+ logoURI: 'https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/BQcdHdAQW1hczDbBi9hiegXAR7A98Q9jx3X3iBBBDiq4/logo.png',
285
+ tags: [],
286
+ decimals: 8,
287
+ extensions: {
288
+ coingeckoId: 'tether',
289
+ },
290
+ },
291
+ {
292
+ network: 'devnet',
293
+ address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestUSDC',
294
+ symbol: 'USDC',
295
+ name: 'USD Coin',
296
+ logoURI: 'https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/logo.png',
297
+ decimals: 8,
298
+ tags: [],
299
+ extensions: {
300
+ coingeckoId: 'usd-coin',
301
+ },
302
+ },
303
+ {
304
+ network: 'devnet',
305
+ address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestSOL',
306
+ symbol: 'SOL',
307
+ name: 'Solana',
308
+ logoURI: 'https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png',
309
+ decimals: 8,
310
+ extensions: {
311
+ coingeckoId: 'solana',
312
+ },
313
+ },
314
+ {
315
+ network: 'devnet',
316
+ address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestBTC',
317
+ symbol: 'BTC',
318
+ name: 'Bitcoin',
319
+ logoURI: 'https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E/logo.png',
320
+ decimals: 8,
321
+ tags: [],
322
+ extensions: {
323
+ coingeckoId: 'bitcoin',
324
+ },
325
+ },
326
+ {
327
+ network: 'devnet',
328
+ address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestDAI',
329
+ symbol: 'DAI',
330
+ name: 'DAI',
331
+ logoURI: 'https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/FYpdBuyAHSbdaAyD1sKkxyLWbAP8uUW9h6uvdhK74ij1/logo.png',
332
+ decimals: 8,
333
+ tags: [],
334
+ extensions: {
335
+ coingeckoId: 'dai',
336
+ },
337
+ },
338
+ {
339
+ network: 'devnet',
340
+ address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestBNB',
341
+ symbol: 'BNB',
342
+ name: 'BNB',
343
+ logoURI: 'https://assets.coingecko.com/coins/images/825/large/bnb-icon2_2x.png',
344
+ decimals: 8,
345
+ tags: [],
346
+ extensions: {
347
+ coingeckoId: 'binancecoin',
348
+ },
349
+ },
350
+ {
351
+ network: 'devnet',
352
+ address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestETH',
353
+ symbol: 'ETH',
354
+ name: 'Ethereum',
355
+ logoURI: 'https://assets.coingecko.com/coins/images/279/large/ethereum.png',
356
+ decimals: 8,
357
+ tags: [],
358
+ extensions: {
359
+ coingeckoId: 'ethereum',
360
+ },
361
+ },
362
+ {
363
+ network: 'mainnet',
364
+ address: '0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN',
365
+ symbol: 'wETH',
366
+ name: 'Wrapped Ethereum (Wormhole)',
367
+ decimals: 8,
368
+ logoURI: 'https://assets.coingecko.com/coins/images/279/large/ethereum.png',
369
+ tags: [],
370
+ extensions: {
371
+ coingeckoId: 'ethereum',
372
+ },
373
+ },
374
+ {
375
+ network: 'mainnet',
376
+ address: '0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN',
377
+ symbol: 'wUSDT',
378
+ name: 'Tether (Wormhole)',
379
+ decimals: 6,
380
+ logoURI: 'https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/BQcdHdAQW1hczDbBi9hiegXAR7A98Q9jx3X3iBBBDiq4/logo.png',
381
+ tags: [],
382
+ extensions: {
383
+ coingeckoId: 'tether',
384
+ },
385
+ },
386
+ {
387
+ network: 'mainnet',
388
+ address: '0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN',
389
+ symbol: 'wUSDC',
390
+ name: 'USD Coin (Wormhole)',
391
+ decimals: 6,
392
+ logoURI: 'https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/logo.png',
393
+ tags: [],
394
+ extensions: {
395
+ coingeckoId: 'usd-coin',
396
+ },
397
+ },
398
+ {
399
+ network: 'mainnet',
400
+ address: '0xa198f3be41cda8c07b3bf3fee02263526e535d682499806979a111e88a5a8d0f::coin::COIN',
401
+ symbol: 'wCELO',
402
+ name: 'Celo (Wormhole)',
403
+ decimals: 8,
404
+ logoURI: 'https://assets.coingecko.com/coins/images/11090/large/InjXBNx9_400x400.jpg',
405
+ tags: [],
406
+ extensions: {
407
+ coingeckoId: 'celo',
408
+ },
409
+ },
410
+ {
411
+ network: 'mainnet',
412
+ address: '0xdbe380b13a6d0f5cdedd58de8f04625263f113b3f9db32b3e1983f49e2841676::coin::COIN',
413
+ symbol: 'wMATIC',
414
+ name: 'Wrapped Matic (Wormhole)',
415
+ decimals: 8,
416
+ logoURI: 'https://assets.coingecko.com/coins/images/4713/large/matic-token-icon.png',
417
+ tags: [],
418
+ extensions: {
419
+ coingeckoId: 'matic-network',
420
+ },
421
+ },
422
+ {
423
+ network: 'mainnet',
424
+ address: '0xb848cce11ef3a8f62eccea6eb5b35a12c4c2b1ee1af7755d02d7bd6218e8226f::coin::COIN',
425
+ symbol: 'wBNB',
426
+ name: 'Wrapped BNB (Wormhole)',
427
+ decimals: 8,
428
+ logoURI: 'https://assets.coingecko.com/coins/images/825/large/bnb-icon2_2x.png',
429
+ tags: [],
430
+ extensions: {
431
+ coingeckoId: 'binancecoin',
432
+ },
433
+ },
434
+ {
435
+ network: 'mainnet',
436
+ address: '0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881::coin::COIN',
437
+ symbol: 'wBTC',
438
+ name: 'Wrapped Bitcoin (Wormhole)',
439
+ decimals: 8,
440
+ logoURI: 'https://assets.coingecko.com/coins/images/1/large/bitcoin.png',
441
+ tags: [],
442
+ extensions: {
443
+ coingeckoId: 'bitcoin',
444
+ },
445
+ },
446
+ {
447
+ network: 'mainnet',
448
+ address: '0x1e8b532cca6569cab9f9b9ebc73f8c13885012ade714729aa3b450e0339ac766::coin::COIN',
449
+ symbol: 'wAVAX',
450
+ name: 'Wrapped AVAX (Wormhole)',
451
+ decimals: 8,
452
+ logoURI: 'https://assets.coingecko.com/coins/images/12559/large/Avalanche_Circle_RedWhite_Trans.png',
453
+ tags: [],
454
+ extensions: {
455
+ coingeckoId: 'avalanche-2',
456
+ },
457
+ },
458
+ {
459
+ network: 'mainnet',
460
+ address: '0x6081300950a4f1e2081580e919c210436a1bed49080502834950d31ee55a2396::coin::COIN',
461
+ symbol: 'wFTM',
462
+ name: 'Wrapped Fantom (Wormhole)',
463
+ decimals: 8,
464
+ logoURI: 'https://assets.coingecko.com/coins/images/4001/large/Fantom_round.png',
465
+ tags: [],
466
+ extensions: {
467
+ coingeckoId: 'fantom',
468
+ },
469
+ },
470
+ {
471
+ network: 'mainnet',
472
+ address: '0x66f87084e49c38f76502d17f87d17f943f183bb94117561eb573e075fdc5ff75::coin::COIN',
473
+ symbol: 'wGLMR',
474
+ name: 'Wrapped GLMR (Wormhole)',
475
+ decimals: 8,
476
+ logoURI: 'https://assets.coingecko.com/coins/images/22459/large/glmr.png',
477
+ tags: [],
478
+ extensions: {
479
+ coingeckoId: 'moonbeam',
480
+ },
481
+ },
482
+ {
483
+ network: 'mainnet',
484
+ address: '0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8::coin::COIN',
485
+ symbol: 'wSOL',
486
+ name: 'Wrapped Solana (Wormhole)',
487
+ decimals: 8,
488
+ logoURI: 'https://assets.coingecko.com/coins/images/4128/large/solana.png',
489
+ tags: [],
490
+ extensions: {
491
+ coingeckoId: 'solana',
492
+ },
493
+ },
494
+ {
495
+ network: 'mainnet',
496
+ address: '0xb231fcda8bbddb31f2ef02e6161444aec64a514e2c89279584ac9806ce9cf037::coin::COIN',
497
+ symbol: 'wUSDCsol',
498
+ name: 'USD Coin Solana (Wormhole)',
499
+ decimals: 6,
500
+ logoURI: 'https://assets.coingecko.com/coins/images/6319/large/USD_Coin_icon.png',
501
+ tags: [],
502
+ extensions: {
503
+ coingeckoId: 'usd-coin',
504
+ },
505
+ },
506
+ ],
507
+ };
508
+ //# sourceMappingURL=coin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coin.js","sourceRoot":"","sources":["../../../src/sui/ext/coin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,YAAY,CAAA;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AAEzD,MAAM,iBAAiB,GAAG,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ACE,OAAO,EAAE,SAAS;YAClB,OAAO,EAAE,gFAAgF;YACzF,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,yBAAyB;YAC/B,QAAQ,EAAE,CAAC;YACX,OAAO,EAAE,2FAA2F;YACpG,IAAI,EAAE,EAAE;YACR,UAAU,EAAE;gBACV,WAAW,EAAE,aAAa;aAC3B;SACF;QACD;YACE,OAAO,EAAE,SAAS;YAClB,OAAO,EAAE,gFAAgF;YACzF,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,2BAA2B;YACjC,QAAQ,EAAE,CAAC;YACX,OAAO,EAAE,uEAAuE;YAChF,IAAI,EAAE,EAAE;YACR,UAAU,EAAE;gBACV,WAAW,EAAE,QAAQ;aACtB;SACF;QACD;YACE,OAAO,EAAE,SAAS;YAClB,OAAO,EAAE,gFAAgF;YACzF,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,yBAAyB;YAC/B,QAAQ,EAAE,CAAC;YACX,OAAO,EAAE,gEAAgE;YACzE,IAAI,EAAE,EAAE;YACR,UAAU,EAAE;gBACV,WAAW,EAAE,UAAU;aACxB;SACF;QACD;YACE,OAAO,EAAE,SAAS;YAClB,OAAO,EAAE,gFAAgF;YACzF,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,2BAA2B;YACjC,QAAQ,EAAE,CAAC;YACX,OAAO,EAAE,iEAAiE;YAC1E,IAAI,EAAE,EAAE;YACR,UAAU,EAAE;gBACV,WAAW,EAAE,QAAQ;aACtB;SACF;QACD;YACE,OAAO,EAAE,SAAS;YAClB,OAAO,EAAE,gFAAgF;YACzF,MAAM,EAAE,UAAU;YAClB,IAAI,EAAE,4BAA4B;YAClC,QAAQ,EAAE,CAAC;YACX,OAAO,EAAE,wEAAwE;YACjF,IAAI,EAAE,EAAE;YACR,UAAU,EAAE;gBACV,WAAW,EAAE,UAAU;aACxB;SACF;KACF;CACF,CAAA","sourcesContent":["import { SimpleCoinInfo } from '../../move/ext/index.js'\nimport fetch from 'node-fetch'\nimport { SPLITTER } from '../../move/index.js'\nimport { getPriceByType } from '../../utils/index.js'\nimport { SuiChainId } from '../../core/chain.js'\nimport { validateAndNormalizeAddress } from '../utils.js'\n\nconst WHITELISTED_COINS = new Map<string, SimpleCoinInfo>()\n\nexport async function initCoinList() {\n let list = DEFAULT_LIST.coinlist\n try {\n const resp = await fetch('https://raw.githubusercontent.com/solflare-wallet/sui-coinlist/master/sui-coinlist.json')\n list = ((await resp.json()) as any).coinlist\n } catch (e) {\n console.warn(\"Can't not fetch newest coin list, use default list\")\n }\n\n setCoinList(list)\n}\n\nexport interface SuiCoinInfo {\n network: string\n address: string\n symbol: string\n name: string\n decimals: number\n}\n\nfunction setCoinList(list: SuiCoinInfo[]) {\n for (const info of list) {\n if (info.address.startsWith('0x2::coin::Coin')) {\n continue\n }\n if (info.network !== 'mainnet') {\n continue\n }\n let bridge = 'native'\n if (info.name.includes('Celer')) {\n bridge = 'Celer'\n }\n if (info.name.includes('LayerZero')) {\n bridge = 'LayerZero'\n }\n if (info.name.includes('Wormhole')) {\n bridge = 'Wormhole'\n }\n WHITELISTED_COINS.set(info.address, {\n token_type: {\n type: info.address,\n account_address: info.address.split('::')[0],\n },\n symbol: info.symbol,\n decimals: info.decimals,\n bridge,\n })\n }\n}\n\nexport function whitelistCoins() {\n return WHITELISTED_COINS\n}\n\nexport function whiteListed(coin: string): boolean {\n const [addr, module, type] = coin.split(SPLITTER)\n const normalized = [validateAndNormalizeAddress(addr), module, type].join(SPLITTER)\n return WHITELISTED_COINS.has(normalized)\n}\n\nexport function getCoinInfo(type: string): SimpleCoinInfo {\n const r = WHITELISTED_COINS.get(type)\n if (!r) {\n const parts = type.split('::')\n // TDDO retrive from network\n return {\n token_type: { type: type, account_address: parts[0] },\n symbol: parts[2],\n decimals: 8,\n bridge: 'native',\n }\n }\n return r\n}\n\nexport async function getPrice(coinType: string, timestamp: number): Promise<number> {\n if (!whiteListed(coinType)) {\n return 0.0\n }\n const date = new Date(timestamp / 1000)\n try {\n return (await getPriceByType(SuiChainId.SUI_MAINNET, coinType, date)) || 0\n } catch (error) {\n console.log(JSON.stringify(error))\n throw error\n }\n}\n\nexport async function calculateValueInUsd(n: bigint, coinInfo: SimpleCoinInfo, timestamp: number) {\n const price = await getPrice(coinInfo.token_type.type, timestamp)\n const amount = n.scaleDown(coinInfo.decimals)\n return amount.multipliedBy(price)\n}\n\nconst DEFAULT_LIST = {\n name: 'Sui Coin List',\n timestamp: '2022-12-01T13:34:30.145Z',\n logoURI: 'https://s2.coinmarketcap.com/static/img/coins/128x128/20947.png',\n coinlist: [\n {\n network: 'mainnet',\n address: '0x2::coin::Coin<0x2::sui::SUI>',\n symbol: 'SUI',\n name: 'Sui Coin',\n decimals: 9,\n logoURI: 'https://cryptototem.com/wp-content/uploads/2022/08/SUI-logo.jpg',\n tags: [],\n extensions: {\n coingeckoId: 'sui',\n },\n },\n {\n network: 'testnet',\n address: '0x2::coin::Coin<0x2::sui::SUI>',\n symbol: 'SUI',\n name: 'Sui Coin',\n decimals: 9,\n logoURI: 'https://cryptototem.com/wp-content/uploads/2022/08/SUI-logo.jpg',\n tags: [],\n extensions: {\n coingeckoId: 'sui',\n },\n },\n {\n network: 'devnet',\n address: '0x2::coin::Coin<0x2::sui::SUI>',\n symbol: 'SUI',\n name: 'Sui Coin',\n decimals: 9,\n logoURI: 'https://cryptototem.com/wp-content/uploads/2022/08/SUI-logo.jpg',\n tags: [],\n extensions: {\n coingeckoId: 'sui',\n },\n },\n {\n network: 'mainnet',\n address: '0x2::sui::SUI',\n symbol: 'SUI',\n name: 'Sui Coin',\n decimals: 9,\n logoURI: 'https://cryptototem.com/wp-content/uploads/2022/08/SUI-logo.jpg',\n tags: [],\n extensions: {\n coingeckoId: 'sui',\n },\n },\n {\n network: 'testnet',\n address: '0x2::sui::SUI',\n symbol: 'SUI',\n name: 'Sui Coin',\n decimals: 9,\n logoURI: 'https://cryptototem.com/wp-content/uploads/2022/08/SUI-logo.jpg',\n tags: [],\n extensions: {\n coingeckoId: 'sui',\n },\n },\n {\n network: 'devnet',\n address: '0x2::sui::SUI',\n symbol: 'SUI',\n name: 'Sui Coin',\n decimals: 9,\n logoURI: 'https://cryptototem.com/wp-content/uploads/2022/08/SUI-logo.jpg',\n tags: [],\n extensions: {\n coingeckoId: 'sui',\n },\n },\n {\n network: 'testnet',\n address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestTEST',\n symbol: 'TEST',\n name: 'Test Token',\n logoURI: 'https://suiswap.app/images/token/suiswap-test.svg',\n tags: [],\n decimals: 8,\n extensions: {},\n },\n {\n network: 'testnet',\n address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestUSDT',\n symbol: 'USDT',\n name: 'Tether',\n logoURI:\n 'https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/BQcdHdAQW1hczDbBi9hiegXAR7A98Q9jx3X3iBBBDiq4/logo.png',\n tags: [],\n decimals: 8,\n extensions: {\n coingeckoId: 'tether',\n },\n },\n {\n network: 'testnet',\n address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestUSDC',\n symbol: 'USDC',\n name: 'USD Coin',\n logoURI:\n 'https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/logo.png',\n decimals: 8,\n tags: [],\n extensions: {\n coingeckoId: 'usd-coin',\n },\n },\n {\n network: 'testnet',\n address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestSOL',\n symbol: 'SOL',\n name: 'Solana',\n logoURI:\n 'https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png',\n decimals: 8,\n extensions: {\n coingeckoId: 'solana',\n },\n },\n {\n network: 'testnet',\n address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestBTC',\n symbol: 'BTC',\n name: 'Bitcoin',\n logoURI:\n 'https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E/logo.png',\n decimals: 8,\n tags: [],\n extensions: {\n coingeckoId: 'bitcoin',\n },\n },\n {\n network: 'testnet',\n address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestDAI',\n symbol: 'DAI',\n name: 'DAI',\n logoURI:\n 'https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/FYpdBuyAHSbdaAyD1sKkxyLWbAP8uUW9h6uvdhK74ij1/logo.png',\n decimals: 8,\n tags: [],\n extensions: {\n coingeckoId: 'dai',\n },\n },\n {\n network: 'testnet',\n address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestBNB',\n symbol: 'BNB',\n name: 'BNB',\n logoURI: 'https://assets.coingecko.com/coins/images/825/large/bnb-icon2_2x.png',\n decimals: 8,\n tags: [],\n extensions: {\n coingeckoId: 'binancecoin',\n },\n },\n {\n network: 'testnet',\n address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestETH',\n symbol: 'ETH',\n name: 'Ethereum',\n logoURI: 'https://assets.coingecko.com/coins/images/279/large/ethereum.png',\n decimals: 8,\n tags: [],\n extensions: {\n coingeckoId: 'ethereum',\n },\n },\n {\n network: 'testnet',\n address: '0x31b14985adb91360ed90a5786cb0956c83e7f275a8ae6123f38adab9d2b792b1::usdc::USDC',\n symbol: 'USDC',\n name: 'USD Coin',\n logoURI:\n 'https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/logo.png',\n decimals: 8,\n tags: [],\n extensions: {\n coingeckoId: 'usd-coin',\n },\n },\n {\n network: 'devnet',\n address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestTEST',\n symbol: 'TEST',\n name: 'Test Token',\n logoURI: 'https://suiswap.app/images/token/suiswap-test.svg',\n tags: [],\n decimals: 8,\n extensions: {},\n },\n {\n network: 'devnet',\n address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestUSDT',\n symbol: 'USDT',\n name: 'Tether',\n logoURI:\n 'https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/BQcdHdAQW1hczDbBi9hiegXAR7A98Q9jx3X3iBBBDiq4/logo.png',\n tags: [],\n decimals: 8,\n extensions: {\n coingeckoId: 'tether',\n },\n },\n {\n network: 'devnet',\n address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestUSDC',\n symbol: 'USDC',\n name: 'USD Coin',\n logoURI:\n 'https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/logo.png',\n decimals: 8,\n tags: [],\n extensions: {\n coingeckoId: 'usd-coin',\n },\n },\n {\n network: 'devnet',\n address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestSOL',\n symbol: 'SOL',\n name: 'Solana',\n logoURI:\n 'https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png',\n decimals: 8,\n extensions: {\n coingeckoId: 'solana',\n },\n },\n {\n network: 'devnet',\n address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestBTC',\n symbol: 'BTC',\n name: 'Bitcoin',\n logoURI:\n 'https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E/logo.png',\n decimals: 8,\n tags: [],\n extensions: {\n coingeckoId: 'bitcoin',\n },\n },\n {\n network: 'devnet',\n address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestDAI',\n symbol: 'DAI',\n name: 'DAI',\n logoURI:\n 'https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/FYpdBuyAHSbdaAyD1sKkxyLWbAP8uUW9h6uvdhK74ij1/logo.png',\n decimals: 8,\n tags: [],\n extensions: {\n coingeckoId: 'dai',\n },\n },\n {\n network: 'devnet',\n address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestBNB',\n symbol: 'BNB',\n name: 'BNB',\n logoURI: 'https://assets.coingecko.com/coins/images/825/large/bnb-icon2_2x.png',\n decimals: 8,\n tags: [],\n extensions: {\n coingeckoId: 'binancecoin',\n },\n },\n {\n network: 'devnet',\n address: '0xe158e6df182971bb6c85eb9de9fbfb460b68163d19afc45873c8672b5cc521b2::TOKEN::TestETH',\n symbol: 'ETH',\n name: 'Ethereum',\n logoURI: 'https://assets.coingecko.com/coins/images/279/large/ethereum.png',\n decimals: 8,\n tags: [],\n extensions: {\n coingeckoId: 'ethereum',\n },\n },\n {\n network: 'mainnet',\n address: '0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN',\n symbol: 'wETH',\n name: 'Wrapped Ethereum (Wormhole)',\n decimals: 8,\n logoURI: 'https://assets.coingecko.com/coins/images/279/large/ethereum.png',\n tags: [],\n extensions: {\n coingeckoId: 'ethereum',\n },\n },\n {\n network: 'mainnet',\n address: '0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN',\n symbol: 'wUSDT',\n name: 'Tether (Wormhole)',\n decimals: 6,\n logoURI:\n 'https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/BQcdHdAQW1hczDbBi9hiegXAR7A98Q9jx3X3iBBBDiq4/logo.png',\n tags: [],\n extensions: {\n coingeckoId: 'tether',\n },\n },\n {\n network: 'mainnet',\n address: '0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN',\n symbol: 'wUSDC',\n name: 'USD Coin (Wormhole)',\n decimals: 6,\n logoURI:\n 'https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v/logo.png',\n tags: [],\n extensions: {\n coingeckoId: 'usd-coin',\n },\n },\n {\n network: 'mainnet',\n address: '0xa198f3be41cda8c07b3bf3fee02263526e535d682499806979a111e88a5a8d0f::coin::COIN',\n symbol: 'wCELO',\n name: 'Celo (Wormhole)',\n decimals: 8,\n logoURI: 'https://assets.coingecko.com/coins/images/11090/large/InjXBNx9_400x400.jpg',\n tags: [],\n extensions: {\n coingeckoId: 'celo',\n },\n },\n {\n network: 'mainnet',\n address: '0xdbe380b13a6d0f5cdedd58de8f04625263f113b3f9db32b3e1983f49e2841676::coin::COIN',\n symbol: 'wMATIC',\n name: 'Wrapped Matic (Wormhole)',\n decimals: 8,\n logoURI: 'https://assets.coingecko.com/coins/images/4713/large/matic-token-icon.png',\n tags: [],\n extensions: {\n coingeckoId: 'matic-network',\n },\n },\n {\n network: 'mainnet',\n address: '0xb848cce11ef3a8f62eccea6eb5b35a12c4c2b1ee1af7755d02d7bd6218e8226f::coin::COIN',\n symbol: 'wBNB',\n name: 'Wrapped BNB (Wormhole)',\n decimals: 8,\n logoURI: 'https://assets.coingecko.com/coins/images/825/large/bnb-icon2_2x.png',\n tags: [],\n extensions: {\n coingeckoId: 'binancecoin',\n },\n },\n {\n network: 'mainnet',\n address: '0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881::coin::COIN',\n symbol: 'wBTC',\n name: 'Wrapped Bitcoin (Wormhole)',\n decimals: 8,\n logoURI: 'https://assets.coingecko.com/coins/images/1/large/bitcoin.png',\n tags: [],\n extensions: {\n coingeckoId: 'bitcoin',\n },\n },\n {\n network: 'mainnet',\n address: '0x1e8b532cca6569cab9f9b9ebc73f8c13885012ade714729aa3b450e0339ac766::coin::COIN',\n symbol: 'wAVAX',\n name: 'Wrapped AVAX (Wormhole)',\n decimals: 8,\n logoURI: 'https://assets.coingecko.com/coins/images/12559/large/Avalanche_Circle_RedWhite_Trans.png',\n tags: [],\n extensions: {\n coingeckoId: 'avalanche-2',\n },\n },\n {\n network: 'mainnet',\n address: '0x6081300950a4f1e2081580e919c210436a1bed49080502834950d31ee55a2396::coin::COIN',\n symbol: 'wFTM',\n name: 'Wrapped Fantom (Wormhole)',\n decimals: 8,\n logoURI: 'https://assets.coingecko.com/coins/images/4001/large/Fantom_round.png',\n tags: [],\n extensions: {\n coingeckoId: 'fantom',\n },\n },\n {\n network: 'mainnet',\n address: '0x66f87084e49c38f76502d17f87d17f943f183bb94117561eb573e075fdc5ff75::coin::COIN',\n symbol: 'wGLMR',\n name: 'Wrapped GLMR (Wormhole)',\n decimals: 8,\n logoURI: 'https://assets.coingecko.com/coins/images/22459/large/glmr.png',\n tags: [],\n extensions: {\n coingeckoId: 'moonbeam',\n },\n },\n {\n network: 'mainnet',\n address: '0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8::coin::COIN',\n symbol: 'wSOL',\n name: 'Wrapped Solana (Wormhole)',\n decimals: 8,\n logoURI: 'https://assets.coingecko.com/coins/images/4128/large/solana.png',\n tags: [],\n extensions: {\n coingeckoId: 'solana',\n },\n },\n {\n network: 'mainnet',\n address: '0xb231fcda8bbddb31f2ef02e6161444aec64a514e2c89279584ac9806ce9cf037::coin::COIN',\n symbol: 'wUSDCsol',\n name: 'USD Coin Solana (Wormhole)',\n decimals: 6,\n logoURI: 'https://assets.coingecko.com/coins/images/6319/large/USD_Coin_icon.png',\n tags: [],\n extensions: {\n coingeckoId: 'usd-coin',\n },\n },\n ],\n}\n"]}
@@ -0,0 +1,18 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import { BigDecimal } from '@sentio/bigdecimal';
3
+ import { MoveCoinList, MoveDex, MovePoolAdaptor, SimpleCoinInfo } from '../../move/ext/index.js';
4
+ import { SuiMoveObject, SuiMovePackage } from '@mysten/sui.js';
5
+ import { SuiNetwork } from '../network.js';
6
+ import { SuiContext, SuiObjectsContext } from '../context.js';
7
+ export type PoolAdaptor<T> = MovePoolAdaptor<SuiMoveObject, T>;
8
+ export declare class CoinList implements MoveCoinList {
9
+ calculateValueInUsd(amount: bigint, coinInfo: SimpleCoinInfo, timestamp: number): Promise<BigDecimal>;
10
+ getCoinInfo(type: string): SimpleCoinInfo;
11
+ whiteListed(type: string): boolean;
12
+ whitelistCoins(): Map<string, SimpleCoinInfo>;
13
+ }
14
+ export declare const SuiCoinList: CoinList;
15
+ export declare class SuiDex<T> extends MoveDex<SuiNetwork, SuiMovePackage, SuiMoveObject, Event, SuiContext, SuiObjectsContext, T> {
16
+ coinList: CoinList;
17
+ poolAdaptor: PoolAdaptor<T>;
18
+ }
@@ -0,0 +1,21 @@
1
+ import { calculateValueInUsd, getCoinInfo, whitelistCoins, whiteListed } from './coin.js';
2
+ import { MoveDex } from '../../move/ext/index.js';
3
+ export class CoinList {
4
+ calculateValueInUsd(amount, coinInfo, timestamp) {
5
+ return calculateValueInUsd(amount, coinInfo, timestamp);
6
+ }
7
+ getCoinInfo(type) {
8
+ return getCoinInfo(type);
9
+ }
10
+ whiteListed(type) {
11
+ return whiteListed(type);
12
+ }
13
+ whitelistCoins() {
14
+ return whitelistCoins();
15
+ }
16
+ }
17
+ export const SuiCoinList = new CoinList();
18
+ export class SuiDex extends MoveDex {
19
+ coinList = SuiCoinList;
20
+ }
21
+ //# sourceMappingURL=move-dex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"move-dex.js","sourceRoot":"","sources":["../../../src/sui/ext/move-dex.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACzF,OAAO,EAAgB,OAAO,EAAmC,MAAM,yBAAyB,CAAA;AAOhG,MAAM,OAAO,QAAQ;IACnB,mBAAmB,CAAC,MAAc,EAAE,QAAwB,EAAE,SAAiB;QAC7E,OAAO,mBAAmB,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAA;IACzD,CAAC;IAED,WAAW,CAAC,IAAY;QACtB,OAAO,WAAW,CAAC,IAAI,CAAC,CAAA;IAC1B,CAAC;IAED,WAAW,CAAC,IAAY;QACtB,OAAO,WAAW,CAAC,IAAI,CAAC,CAAA;IAC1B,CAAC;IAED,cAAc;QACZ,OAAO,cAAc,EAAE,CAAA;IACzB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,QAAQ,EAAE,CAAA;AAEzC,MAAM,OAAO,MAAU,SAAQ,OAQ9B;IACC,QAAQ,GAAG,WAAW,CAAA;CAEvB","sourcesContent":["import { BigDecimal } from '@sentio/bigdecimal'\nimport { calculateValueInUsd, getCoinInfo, whitelistCoins, whiteListed } from './coin.js'\nimport { MoveCoinList, MoveDex, MovePoolAdaptor, SimpleCoinInfo } from '../../move/ext/index.js'\nimport { SuiMoveObject, SuiMovePackage } from '@mysten/sui.js'\nimport { SuiNetwork } from '../network.js'\nimport { SuiContext, SuiObjectsContext } from '../context.js'\n\nexport type PoolAdaptor<T> = MovePoolAdaptor<SuiMoveObject, T>\n\nexport class CoinList implements MoveCoinList {\n calculateValueInUsd(amount: bigint, coinInfo: SimpleCoinInfo, timestamp: number): Promise<BigDecimal> {\n return calculateValueInUsd(amount, coinInfo, timestamp)\n }\n\n getCoinInfo(type: string): SimpleCoinInfo {\n return getCoinInfo(type)\n }\n\n whiteListed(type: string): boolean {\n return whiteListed(type)\n }\n\n whitelistCoins(): Map<string, SimpleCoinInfo> {\n return whitelistCoins()\n }\n}\n\nexport const SuiCoinList = new CoinList()\n\nexport class SuiDex<T> extends MoveDex<\n SuiNetwork,\n SuiMovePackage,\n SuiMoveObject,\n Event,\n SuiContext,\n SuiObjectsContext,\n T\n> {\n coinList = SuiCoinList\n declare poolAdaptor: PoolAdaptor<T>\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { Plugin } from '@sentio/runtime';
2
- import { Data_SuiCall, Data_SuiEvent, Data_SuiObject, DataBinding, HandlerType, ProcessConfigResponse, ProcessResult } from '@sentio/protos';
2
+ import { Data_SuiCall, Data_SuiEvent, Data_SuiObject, DataBinding, HandlerType, ProcessConfigResponse, ProcessResult, StartRequest } from '@sentio/protos';
3
3
  interface Handlers {
4
4
  suiEventHandlers: ((event: Data_SuiEvent) => Promise<ProcessResult>)[];
5
5
  suiCallHandlers: ((func: Data_SuiCall) => Promise<ProcessResult>)[];
@@ -8,6 +8,7 @@ interface Handlers {
8
8
  export declare class SuiPlugin extends Plugin {
9
9
  name: string;
10
10
  handlers: Handlers;
11
+ start(start: StartRequest): Promise<void>;
11
12
  configure(config: ProcessConfigResponse): Promise<void>;
12
13
  supportedHandlers: HandlerType[];
13
14
  processSuiEvent(binding: DataBinding): Promise<ProcessResult>;
@@ -3,6 +3,7 @@ import { AccountConfig, ContractConfig, HandlerType, } from '@sentio/protos';
3
3
  import { ServerError, Status } from 'nice-grpc';
4
4
  import { SuiAccountProcessorState, SuiProcessorState } from './sui-processor.js';
5
5
  import { validateAndNormalizeAddress } from './utils.js';
6
+ import { initCoinList } from './ext/coin.js';
6
7
  export class SuiPlugin extends Plugin {
7
8
  name = 'SuiPlugin';
8
9
  handlers = {
@@ -10,6 +11,9 @@ export class SuiPlugin extends Plugin {
10
11
  suiEventHandlers: [],
11
12
  suiObjectHandlers: [],
12
13
  };
14
+ async start(start) {
15
+ await initCoinList();
16
+ }
13
17
  async configure(config) {
14
18
  const handlers = {
15
19
  suiCallHandlers: [],