@lifi/data-types 5.24.0-beta.2 → 5.24.0-beta.3

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 (45) hide show
  1. package/package.json +2 -2
  2. package/src/_cjs/chains/index.js +4 -2
  3. package/src/_cjs/chains/index.js.map +1 -1
  4. package/src/_cjs/chains/supportedChains.evm.js +1 -1
  5. package/src/_cjs/chains/supportedChains.evm.js.map +1 -1
  6. package/src/_cjs/chains/supportedChains.js +2 -0
  7. package/src/_cjs/chains/supportedChains.js.map +1 -1
  8. package/src/_cjs/chains/supportedChains.mvm.int.spec.js +45 -0
  9. package/src/_cjs/chains/supportedChains.mvm.int.spec.js.map +1 -0
  10. package/src/_cjs/chains/supportedChains.mvm.js +28 -0
  11. package/src/_cjs/chains/supportedChains.mvm.js.map +1 -0
  12. package/src/_cjs/coins/coins.js +37 -0
  13. package/src/_cjs/coins/coins.js.map +1 -1
  14. package/src/_cjs/multicall.js.map +1 -1
  15. package/src/_esm/chains/index.js +2 -1
  16. package/src/_esm/chains/index.js.map +1 -1
  17. package/src/_esm/chains/supportedChains.evm.js +1 -1
  18. package/src/_esm/chains/supportedChains.evm.js.map +1 -1
  19. package/src/_esm/chains/supportedChains.js +2 -0
  20. package/src/_esm/chains/supportedChains.js.map +1 -1
  21. package/src/_esm/chains/supportedChains.mvm.int.spec.js +43 -0
  22. package/src/_esm/chains/supportedChains.mvm.int.spec.js.map +1 -0
  23. package/src/_esm/chains/supportedChains.mvm.js +25 -0
  24. package/src/_esm/chains/supportedChains.mvm.js.map +1 -0
  25. package/src/_esm/coins/coins.js +38 -0
  26. package/src/_esm/coins/coins.js.map +1 -1
  27. package/src/_esm/multicall.js +1 -0
  28. package/src/_esm/multicall.js.map +1 -1
  29. package/src/_types/chains/index.d.ts +2 -1
  30. package/src/_types/chains/index.d.ts.map +1 -1
  31. package/src/_types/chains/supportedChains.d.ts +1 -1
  32. package/src/_types/chains/supportedChains.d.ts.map +1 -1
  33. package/src/_types/chains/supportedChains.mvm.d.ts +3 -0
  34. package/src/_types/chains/supportedChains.mvm.d.ts.map +1 -0
  35. package/src/_types/chains/supportedChains.mvm.int.spec.d.ts +2 -0
  36. package/src/_types/chains/supportedChains.mvm.int.spec.d.ts.map +1 -0
  37. package/src/_types/coins/coins.d.ts.map +1 -1
  38. package/src/_types/multicall.d.ts.map +1 -1
  39. package/src/chains/index.ts +2 -1
  40. package/src/chains/supportedChains.evm.ts +1 -1
  41. package/src/chains/supportedChains.mvm.int.spec.ts +71 -0
  42. package/src/chains/supportedChains.mvm.ts +27 -0
  43. package/src/chains/supportedChains.ts +2 -0
  44. package/src/coins/coins.ts +45 -0
  45. package/src/multicall.ts +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"multicall.d.ts","sourceRoot":"","sources":["../multicall.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,kBAAkB,EAAE;IAAE,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAA;CAgE3D,CAAA"}
1
+ {"version":3,"file":"multicall.d.ts","sourceRoot":"","sources":["../multicall.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,kBAAkB,EAAE;IAAE,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAA;CAiE3D,CAAA"}
@@ -1,5 +1,6 @@
1
1
  export { supportedEVMChains } from './supportedChains.evm.js'
2
+ export * from './supportedChains.js'
3
+ export { supportedMVMChains } from './supportedChains.mvm.js'
2
4
  export { supportedSolanaChains } from './supportedChains.svm.js'
3
5
  export { supportedUXTOChains } from './supportedChains.utxo.js'
4
- export * from './supportedChains.js'
5
6
  export * from './utils.js'
@@ -1159,7 +1159,7 @@ export const supportedEVMChains: EVMChain[] = [
1159
1159
 
1160
1160
  metamask: {
1161
1161
  chainId: prefixChainId(80094),
1162
- blockExplorerUrls: ['https://berascan.com/'],
1162
+ blockExplorerUrls: ['https://berascan.com/', 'https://beratrail.io/'],
1163
1163
  chainName: 'Berachain Mainnet',
1164
1164
  nativeCurrency: {
1165
1165
  name: 'Bera',
@@ -0,0 +1,71 @@
1
+ import type { CoinSupply } from '@mysten/sui/client'
2
+ import { SuiClient } from '@mysten/sui/client'
3
+ import { describe, expect, test } from 'vitest'
4
+
5
+ import { supportedMVMChains } from './supportedChains.mvm.js'
6
+
7
+ const WalletAddress =
8
+ '0xcc2bd176a478baea9a0de7a24cd927661cc6e860d5bacecb9a138ef20dbab231'
9
+
10
+ const SuiTypeName =
11
+ '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI'
12
+
13
+ const SuiTotalSupply = '10000000000000000000' // 1B tokens
14
+
15
+ describe.concurrent('MVM chains RPC check', () => {
16
+ const rpcUrls = supportedMVMChains.flatMap((chain) =>
17
+ chain.metamask.rpcUrls.map((rpcUrl) => ({
18
+ rpcUrl: rpcUrl,
19
+ chainId: chain.id,
20
+ chainName: chain.name,
21
+ }))
22
+ )
23
+
24
+ test.for(rpcUrls)(
25
+ `should successfully get chain ID from $chainName - $chainId RPC: $rpcUrl`,
26
+ { timeout: 10_000, retry: 3 },
27
+ async ({ rpcUrl }) => {
28
+ const client = new SuiClient({ url: rpcUrl })
29
+
30
+ const [coins, balance, ownedObjects, suiSupply] =
31
+ await Promise.allSettled([
32
+ client.getCoins({
33
+ owner: WalletAddress,
34
+ }),
35
+ client.getBalance({ owner: WalletAddress }),
36
+ client.getOwnedObjects({ owner: WalletAddress }),
37
+ client.getTotalSupply({ coinType: SuiTypeName }),
38
+ ])
39
+
40
+ expect(coins.status).toBe('fulfilled')
41
+ expect(balance.status).toBe('fulfilled')
42
+ expect(ownedObjects.status).toBe('fulfilled')
43
+ expect(suiSupply.status).toBe('fulfilled')
44
+
45
+ expect(
46
+ (suiSupply as PromiseFulfilledResult<CoinSupply>).value.value
47
+ ).toBe(SuiTotalSupply)
48
+ }
49
+ )
50
+ })
51
+
52
+ describe.concurrent('MVM chains block explorer check', () => {
53
+ const blockExplorerUrls = supportedMVMChains.flatMap((chain) =>
54
+ chain.metamask.blockExplorerUrls.map((blockExplorerUrl) => ({
55
+ blockExplorerUrl: blockExplorerUrl,
56
+ chainId: chain.id,
57
+ chainName: chain.name,
58
+ }))
59
+ )
60
+
61
+ test.for(blockExplorerUrls)(
62
+ `block explorer should be alive $chainName - $chainId - $blockExplorerUrl`,
63
+ { timeout: 10_000, retry: 3 },
64
+ async ({ blockExplorerUrl }) => {
65
+ const response = await fetch(blockExplorerUrl)
66
+ expect(response.url).toBe(blockExplorerUrl)
67
+ expect(response.ok).toBe(true)
68
+ expect(response.status).toBe(200)
69
+ }
70
+ )
71
+ })
@@ -0,0 +1,27 @@
1
+ import type { MVMChain } from '@lifi/types'
2
+ import { ChainId, ChainKey, ChainType, CoinKey } from '@lifi/types'
3
+
4
+ export const supportedMVMChains: MVMChain[] = [
5
+ {
6
+ key: ChainKey.SUI,
7
+ chainType: ChainType.MVM,
8
+ name: 'SUI',
9
+ coin: CoinKey.SUI,
10
+ id: ChainId.SUI,
11
+ mainnet: true,
12
+ logoURI:
13
+ 'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/chains/sui.svg',
14
+ faucetUrls: ['https://stakely.io/faucet/sui-sui'],
15
+ metamask: {
16
+ chainId: ChainId.SUI.toString(),
17
+ blockExplorerUrls: ['https://www.suiscan.xyz/', 'https://suivision.xyz/'],
18
+ chainName: 'SUI',
19
+ nativeCurrency: {
20
+ name: 'SUI',
21
+ symbol: 'SUI',
22
+ decimals: 9,
23
+ },
24
+ rpcUrls: ['https://fullnode.mainnet.sui.io:443'],
25
+ },
26
+ },
27
+ ]
@@ -1,5 +1,6 @@
1
1
  import type { Chain, ChainKey } from '@lifi/types'
2
2
  import { supportedEVMChains } from './supportedChains.evm.js'
3
+ import { supportedMVMChains } from './supportedChains.mvm.js'
3
4
  import { supportedSolanaChains } from './supportedChains.svm.js'
4
5
  import { supportedUXTOChains } from './supportedChains.utxo.js'
5
6
 
@@ -9,6 +10,7 @@ import { supportedUXTOChains } from './supportedChains.utxo.js'
9
10
  export const supportedChains = [
10
11
  ...supportedEVMChains,
11
12
  ...supportedSolanaChains,
13
+ ...supportedMVMChains,
12
14
  ...supportedUXTOChains,
13
15
  ]
14
16
 
@@ -486,6 +486,21 @@ export const basicCoins: BasicCoin[] = [
486
486
  },
487
487
  },
488
488
 
489
+ // > SUI
490
+ {
491
+ key: CoinKey.SUI,
492
+ name: CoinKey.SUI,
493
+ logoURI: 'https://s2.coinmarketcap.com/static/img/coins/64x64/20947.png',
494
+ verified: true,
495
+ chains: {
496
+ [ChainId.SUI]: {
497
+ address:
498
+ '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI',
499
+ decimals: 9,
500
+ },
501
+ },
502
+ },
503
+
489
504
  // OTHER STABLECOINS
490
505
  // USDT
491
506
  {
@@ -504,6 +519,12 @@ export const basicCoins: BasicCoin[] = [
504
519
  decimals: 6,
505
520
  name: 'USDT',
506
521
  },
522
+ [ChainId.SUI]: {
523
+ address:
524
+ '0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN',
525
+ decimals: 6,
526
+ name: 'Tether USD',
527
+ },
507
528
  [ChainId.BSC]: {
508
529
  address: '0x55d398326f99059ff775485246999027b3197955',
509
530
  decimals: 18,
@@ -671,6 +692,12 @@ export const basicCoins: BasicCoin[] = [
671
692
  decimals: 6,
672
693
  name: 'USD Coin',
673
694
  },
695
+ [ChainId.SUI]: {
696
+ address:
697
+ '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC',
698
+ decimals: 6,
699
+ name: 'USDC',
700
+ },
674
701
  [ChainId.BSC]: {
675
702
  address: '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d',
676
703
  decimals: 18,
@@ -1113,6 +1140,12 @@ export const basicCoins: BasicCoin[] = [
1113
1140
  decimals: 8,
1114
1141
  name: 'Wrapped BTC (Wormhole)',
1115
1142
  },
1143
+ [ChainId.SUI]: {
1144
+ address:
1145
+ '0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881::coin::COIN',
1146
+ decimals: 8,
1147
+ name: 'Wrapped BTC (Wormhole)',
1148
+ },
1116
1149
  [ChainId.POL]: {
1117
1150
  address: '0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6',
1118
1151
  decimals: 8,
@@ -1225,6 +1258,12 @@ export const basicCoins: BasicCoin[] = [
1225
1258
  decimals: 9,
1226
1259
  name: 'Wrapped ETH (Allbridge from Ethereum)',
1227
1260
  },
1261
+ [ChainId.SUI]: {
1262
+ address:
1263
+ '0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN',
1264
+ decimals: 8,
1265
+ name: 'Wrapped ETH (Wormhole)',
1266
+ },
1228
1267
  [ChainId.BSC]: {
1229
1268
  address: '0x2170ed0880ac9a755fd29b2688956bd959f933f8',
1230
1269
  decimals: 18,
@@ -1698,6 +1737,12 @@ export const basicCoins: BasicCoin[] = [
1698
1737
  decimals: 9,
1699
1738
  name: 'Wrapped SOL (Wormhole)',
1700
1739
  },
1740
+ [ChainId.SUI]: {
1741
+ address:
1742
+ '0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8::coin::COIN',
1743
+ decimals: 8,
1744
+ name: 'Wrapped SOL (Wormhole)',
1745
+ },
1701
1746
  [ChainId.POL]: {
1702
1747
  address: '0xd93f7E271cB87c23AaA73edC008A79646d1F9912',
1703
1748
  decimals: 9,
package/src/multicall.ts CHANGED
@@ -71,4 +71,5 @@ export const multicallAddresses: { [ChainId: number]: string } = {
71
71
  // [ChainId.SOLT]: '', // NOT NEEDED
72
72
  // [ChainId.TERT]: '', // NOT NEEDED
73
73
  // [ChainId.OAST]: '', // NOT NEEDED
74
+ // [ChainId.SUI]: '', // NOT NEEDED
74
75
  }