@lifi/data-types 2.2.2 → 2.3.0

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.
@@ -0,0 +1,2 @@
1
+ import { SolanaChain } from '@lifi/types';
2
+ export declare const supportedSolanaChains: SolanaChain[];
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.supportedSolanaChains = void 0;
4
+ const types_1 = require("@lifi/types");
5
+ exports.supportedSolanaChains = [
6
+ {
7
+ key: types_1.ChainKey.SOL,
8
+ chainType: types_1.ChainType.SVM,
9
+ name: 'Solana',
10
+ coin: types_1.CoinKey.SOL,
11
+ id: types_1.ChainId.SOL,
12
+ mainnet: true,
13
+ logoURI: 'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/chains/solana.svg',
14
+ faucetUrls: ['https://stakely.io/faucet/solana-sol'],
15
+ metamask: {
16
+ chainId: types_1.ChainId.SOL.toString(),
17
+ blockExplorerUrls: [
18
+ 'https://explorer.solana.com/',
19
+ 'https://solscan.io/',
20
+ 'https://solana.fm/',
21
+ ],
22
+ chainName: 'Solana',
23
+ nativeCurrency: {
24
+ name: 'SOL',
25
+ symbol: 'SOL',
26
+ decimals: 9,
27
+ },
28
+ rpcUrls: ['https://api.mainnet-beta.solana.com'],
29
+ },
30
+ },
31
+ ];
@@ -4,6 +4,7 @@ const types_1 = require("@lifi/types");
4
4
  const coins_1 = require("../coins");
5
5
  const supportedChains_1 = require("./supportedChains");
6
6
  const utils_1 = require("./utils");
7
+ const supportedChains_evm_1 = require("./supportedChains.evm");
7
8
  test('getChainById', () => {
8
9
  expect((0, supportedChains_1.getChainById)(types_1.ChainId.ETH)).toBeDefined();
9
10
  });
@@ -12,7 +13,7 @@ test('getChainByKey', () => {
12
13
  });
13
14
  test('native token defined for all chains', () => {
14
15
  // currently unused chains
15
- const ignoredChains = [
16
+ const ignoredChainsForNativeToken = [
16
17
  types_1.ChainId.FSN,
17
18
  types_1.ChainId.EXP,
18
19
  types_1.ChainId.TCH,
@@ -31,8 +32,15 @@ test('native token defined for all chains', () => {
31
32
  types_1.ChainId.TLOT,
32
33
  types_1.ChainId.RSKT,
33
34
  ];
34
- for (const chain of supportedChains_1.supportedEVMChains) {
35
- if (ignoredChains.includes(chain.id))
35
+ const ignoredChainsForWrappedToken = [
36
+ ...ignoredChainsForNativeToken,
37
+ types_1.ChainId.BTC,
38
+ types_1.ChainId.BCH,
39
+ types_1.ChainId.LTC,
40
+ types_1.ChainId.DGE,
41
+ ];
42
+ for (const chain of supportedChains_1.supportedChains) {
43
+ if (ignoredChainsForNativeToken.includes(chain.id))
36
44
  continue;
37
45
  try {
38
46
  const gasToken = (0, coins_1.findDefaultToken)(chain.coin, chain.id);
@@ -41,6 +49,10 @@ test('native token defined for all chains', () => {
41
49
  catch (e) {
42
50
  throw new Error(`Failed to load gas token for ${chain.name}(${chain.id})`);
43
51
  }
52
+ }
53
+ for (const chain of supportedChains_1.supportedChains) {
54
+ if (ignoredChainsForWrappedToken.includes(chain.id))
55
+ continue;
44
56
  try {
45
57
  const wrappedGasToken = (0, coins_1.findWrappedGasOnChain)(chain.id);
46
58
  expect(wrappedGasToken).toBeDefined();
@@ -63,7 +75,7 @@ describe('findTokenByChainIdAndAddress', () => {
63
75
  });
64
76
  });
65
77
  describe('validate chains', () => {
66
- supportedChains_1.supportedEVMChains.forEach((chain) => {
78
+ supportedChains_evm_1.supportedEVMChains.forEach((chain) => {
67
79
  it(`validate chain ${chain.name}`, () => {
68
80
  // blockExplorerUrls
69
81
  expect(chain.metamask.blockExplorerUrls.length).toBeGreaterThan(0);
@@ -0,0 +1,2 @@
1
+ import { UTXOChain } from '@lifi/types';
2
+ export declare const supportedUXTOChains: UTXOChain[];
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.supportedUXTOChains = void 0;
4
+ const types_1 = require("@lifi/types");
5
+ exports.supportedUXTOChains = [
6
+ {
7
+ key: types_1.ChainKey.BTC,
8
+ chainType: types_1.ChainType.UTXO,
9
+ name: 'Bitcoin',
10
+ coin: types_1.CoinKey.BTC,
11
+ id: types_1.ChainId.BTC,
12
+ mainnet: true,
13
+ logoURI: 'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/chains/bitcoin.svg',
14
+ faucetUrls: [],
15
+ metamask: {
16
+ chainId: types_1.ChainId.BTC.toString(),
17
+ blockExplorerUrls: [
18
+ 'https://blockchair.com/bitcoin',
19
+ 'https://bitcoinexplorer.org/',
20
+ ],
21
+ chainName: 'Bitcoin',
22
+ nativeCurrency: {
23
+ name: 'BTC',
24
+ symbol: 'BTC',
25
+ decimals: 8,
26
+ },
27
+ rpcUrls: ['https://node-router.thorswap.net/bitcoin'],
28
+ },
29
+ },
30
+ {
31
+ key: types_1.ChainKey.BCH,
32
+ chainType: types_1.ChainType.UTXO,
33
+ name: 'Bitcoin Cash',
34
+ coin: types_1.CoinKey.BCH,
35
+ id: types_1.ChainId.BCH,
36
+ mainnet: true,
37
+ logoURI: 'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/chains/bitcoincash.svg',
38
+ faucetUrls: [],
39
+ metamask: {
40
+ chainId: types_1.ChainId.BCH.toString(),
41
+ blockExplorerUrls: ['https://www.blockchair.com/bitcoin-cash'],
42
+ chainName: 'Bitcoin Cash',
43
+ nativeCurrency: {
44
+ name: 'BCH',
45
+ symbol: 'BCH',
46
+ decimals: 8,
47
+ },
48
+ rpcUrls: ['https://node-router.thorswap.net/bitcoin-cash'],
49
+ },
50
+ },
51
+ {
52
+ key: types_1.ChainKey.LTC,
53
+ chainType: types_1.ChainType.UTXO,
54
+ name: 'Litecoin',
55
+ coin: types_1.CoinKey.LTC,
56
+ id: types_1.ChainId.LTC,
57
+ mainnet: true,
58
+ logoURI: 'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/chains/litecoin.svg',
59
+ faucetUrls: [],
60
+ metamask: {
61
+ chainId: types_1.ChainId.LTC.toString(),
62
+ blockExplorerUrls: ['https://blockchair.com/litecoin'],
63
+ chainName: 'Litecoin',
64
+ nativeCurrency: {
65
+ name: 'LTC',
66
+ symbol: 'LTC',
67
+ decimals: 8,
68
+ },
69
+ rpcUrls: ['https://node-router.thorswap.net/litecoin'],
70
+ },
71
+ },
72
+ {
73
+ key: types_1.ChainKey.DGE,
74
+ chainType: types_1.ChainType.UTXO,
75
+ name: 'Dogecoin',
76
+ coin: types_1.CoinKey.DOGE,
77
+ id: types_1.ChainId.DGE,
78
+ mainnet: true,
79
+ logoURI: 'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/chains/dogecoin.svg',
80
+ faucetUrls: [],
81
+ metamask: {
82
+ chainId: types_1.ChainId.DGE.toString(),
83
+ blockExplorerUrls: ['https://blockchair.com/dogecoin'],
84
+ chainName: 'Dogecoin',
85
+ nativeCurrency: {
86
+ name: 'DODGE',
87
+ symbol: 'DOGE',
88
+ decimals: 8,
89
+ },
90
+ rpcUrls: ['https://node-router.thorswap.net/dogecoin'],
91
+ },
92
+ },
93
+ ];
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.prefixChainId = void 0;
4
- const ethers_1 = require("ethers");
5
4
  const prefixChainId = (chainId) => {
6
- return '0x' + ethers_1.BigNumber.from(chainId)._hex.split('0x')[1].replace(/\b0+/g, '');
5
+ return '0x' + chainId.toString(16);
7
6
  };
8
7
  exports.prefixChainId = prefixChainId;
@@ -1543,6 +1543,62 @@ exports.basicCoins = [
1543
1543
  },
1544
1544
  },
1545
1545
  },
1546
+ // > Bitcoin
1547
+ {
1548
+ key: types_1.CoinKey.BTC,
1549
+ name: types_1.CoinKey.BTC,
1550
+ logoURI: 'https://assets.coingecko.com/coins/images/1/standard/bitcoin.png',
1551
+ verified: true,
1552
+ chains: {
1553
+ [types_1.ChainId.BTC]: {
1554
+ address: 'bitcoin',
1555
+ decimals: 8,
1556
+ name: 'Bitcoin',
1557
+ },
1558
+ },
1559
+ },
1560
+ // > Bitcoin Cash
1561
+ {
1562
+ key: types_1.CoinKey.BCH,
1563
+ name: types_1.CoinKey.BCH,
1564
+ logoURI: 'https://assets.coingecko.com/coins/images/780/standard/bitcoin-cash-circle.png',
1565
+ verified: true,
1566
+ chains: {
1567
+ [types_1.ChainId.BCH]: {
1568
+ address: 'bitcoin-cash',
1569
+ decimals: 8,
1570
+ name: 'Bitcoin Cash',
1571
+ },
1572
+ },
1573
+ },
1574
+ // > Bitcoin
1575
+ {
1576
+ key: types_1.CoinKey.LTC,
1577
+ name: types_1.CoinKey.LTC,
1578
+ logoURI: 'https://assets.coingecko.com/coins/images/2/standard/litecoin.png',
1579
+ verified: true,
1580
+ chains: {
1581
+ [types_1.ChainId.LTC]: {
1582
+ address: 'litecoin',
1583
+ decimals: 8,
1584
+ name: 'Litecoin',
1585
+ },
1586
+ },
1587
+ },
1588
+ // > Doge
1589
+ {
1590
+ key: types_1.CoinKey.DOGE,
1591
+ name: types_1.CoinKey.DOGE,
1592
+ logoURI: 'https://assets.coingecko.com/coins/images/5/standard/dogecoin.png',
1593
+ verified: true,
1594
+ chains: {
1595
+ [types_1.ChainId.DGE]: {
1596
+ address: 'dogecoin',
1597
+ decimals: 8,
1598
+ name: 'Dogecoin',
1599
+ },
1600
+ },
1601
+ },
1546
1602
  ];
1547
1603
  exports.defaultCoins = exports.basicCoins.map((coin) => {
1548
1604
  var _a, _b, _c;
@@ -1540,6 +1540,62 @@ export const basicCoins = [
1540
1540
  },
1541
1541
  },
1542
1542
  },
1543
+ // > Bitcoin
1544
+ {
1545
+ key: CoinKey.BTC,
1546
+ name: CoinKey.BTC,
1547
+ logoURI: 'https://assets.coingecko.com/coins/images/1/standard/bitcoin.png',
1548
+ verified: true,
1549
+ chains: {
1550
+ [ChainId.BTC]: {
1551
+ address: 'bitcoin',
1552
+ decimals: 8,
1553
+ name: 'Bitcoin',
1554
+ },
1555
+ },
1556
+ },
1557
+ // > Bitcoin Cash
1558
+ {
1559
+ key: CoinKey.BCH,
1560
+ name: CoinKey.BCH,
1561
+ logoURI: 'https://assets.coingecko.com/coins/images/780/standard/bitcoin-cash-circle.png',
1562
+ verified: true,
1563
+ chains: {
1564
+ [ChainId.BCH]: {
1565
+ address: 'bitcoin-cash',
1566
+ decimals: 8,
1567
+ name: 'Bitcoin Cash',
1568
+ },
1569
+ },
1570
+ },
1571
+ // > Bitcoin
1572
+ {
1573
+ key: CoinKey.LTC,
1574
+ name: CoinKey.LTC,
1575
+ logoURI: 'https://assets.coingecko.com/coins/images/2/standard/litecoin.png',
1576
+ verified: true,
1577
+ chains: {
1578
+ [ChainId.LTC]: {
1579
+ address: 'litecoin',
1580
+ decimals: 8,
1581
+ name: 'Litecoin',
1582
+ },
1583
+ },
1584
+ },
1585
+ // > Doge
1586
+ {
1587
+ key: CoinKey.DOGE,
1588
+ name: CoinKey.DOGE,
1589
+ logoURI: 'https://assets.coingecko.com/coins/images/5/standard/dogecoin.png',
1590
+ verified: true,
1591
+ chains: {
1592
+ [ChainId.DGE]: {
1593
+ address: 'dogecoin',
1594
+ decimals: 8,
1595
+ name: 'Dogecoin',
1596
+ },
1597
+ },
1598
+ },
1543
1599
  ];
1544
1600
  export const defaultCoins = basicCoins.map((coin) => {
1545
1601
  var _a, _b, _c;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifi/data-types",
3
- "version": "2.2.2",
3
+ "version": "2.3.0",
4
4
  "description": "Data types for the LI.FI stack",
5
5
  "keywords": [
6
6
  "sdk",
@@ -63,7 +63,7 @@
63
63
  ]
64
64
  },
65
65
  "dependencies": {
66
- "@lifi/types": "^9.0.1"
66
+ "@lifi/types": "^11.2.0"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@commitlint/cli": "^17.7.1",