@lifi/data-types 2.3.0-alpha.1 → 2.3.1
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/chains/index.d.ts +3 -0
- package/dist/chains/index.js +3 -0
- package/dist/chains/supportedChains.d.ts +2 -5
- package/dist/chains/supportedChains.evm.d.ts +2 -0
- package/dist/chains/supportedChains.evm.js +1171 -0
- package/dist/chains/supportedChains.js +3 -1291
- package/dist/chains/supportedChains.svm.d.ts +2 -0
- package/dist/chains/supportedChains.svm.js +28 -0
- package/dist/chains/supportedChains.unit.spec.js +16 -4
- package/dist/chains/supportedChains.utxo.d.ts +2 -0
- package/dist/chains/supportedChains.utxo.js +90 -0
- package/dist/chains/utils.js +1 -2
- package/dist/cjs/chains/index.d.ts +3 -0
- package/dist/cjs/chains/index.js +7 -0
- package/dist/cjs/chains/supportedChains.d.ts +2 -5
- package/dist/cjs/chains/supportedChains.evm.d.ts +2 -0
- package/dist/cjs/chains/supportedChains.evm.js +1174 -0
- package/dist/cjs/chains/supportedChains.js +7 -1295
- package/dist/cjs/chains/supportedChains.svm.d.ts +2 -0
- package/dist/cjs/chains/supportedChains.svm.js +31 -0
- package/dist/cjs/chains/supportedChains.unit.spec.js +16 -4
- package/dist/cjs/chains/supportedChains.utxo.d.ts +2 -0
- package/dist/cjs/chains/supportedChains.utxo.js +93 -0
- package/dist/cjs/chains/utils.js +1 -2
- package/package.json +2 -3
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ChainKey, ChainType, CoinKey, ChainId } from '@lifi/types';
|
|
2
|
+
export const supportedSolanaChains = [
|
|
3
|
+
{
|
|
4
|
+
key: ChainKey.SOL,
|
|
5
|
+
chainType: ChainType.SVM,
|
|
6
|
+
name: 'Solana',
|
|
7
|
+
coin: CoinKey.SOL,
|
|
8
|
+
id: ChainId.SOL,
|
|
9
|
+
mainnet: true,
|
|
10
|
+
logoURI: 'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/chains/solana.svg',
|
|
11
|
+
faucetUrls: ['https://stakely.io/faucet/solana-sol'],
|
|
12
|
+
metamask: {
|
|
13
|
+
chainId: ChainId.SOL.toString(),
|
|
14
|
+
blockExplorerUrls: [
|
|
15
|
+
'https://explorer.solana.com/',
|
|
16
|
+
'https://solscan.io/',
|
|
17
|
+
'https://solana.fm/',
|
|
18
|
+
],
|
|
19
|
+
chainName: 'Solana',
|
|
20
|
+
nativeCurrency: {
|
|
21
|
+
name: 'SOL',
|
|
22
|
+
symbol: 'SOL',
|
|
23
|
+
decimals: 9,
|
|
24
|
+
},
|
|
25
|
+
rpcUrls: ['https://api.mainnet-beta.solana.com'],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
];
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ChainId, ChainKey, CoinKey } from '@lifi/types';
|
|
2
2
|
import { findDefaultToken, findTokenByChainIdAndAddress, findWrappedGasOnChain, } from '../coins';
|
|
3
|
-
import { getChainById, getChainByKey,
|
|
3
|
+
import { getChainById, getChainByKey, supportedChains } from './supportedChains';
|
|
4
4
|
import { prefixChainId } from './utils';
|
|
5
|
+
import { supportedEVMChains } from './supportedChains.evm';
|
|
5
6
|
test('getChainById', () => {
|
|
6
7
|
expect(getChainById(ChainId.ETH)).toBeDefined();
|
|
7
8
|
});
|
|
@@ -10,7 +11,7 @@ test('getChainByKey', () => {
|
|
|
10
11
|
});
|
|
11
12
|
test('native token defined for all chains', () => {
|
|
12
13
|
// currently unused chains
|
|
13
|
-
const
|
|
14
|
+
const ignoredChainsForNativeToken = [
|
|
14
15
|
ChainId.FSN,
|
|
15
16
|
ChainId.EXP,
|
|
16
17
|
ChainId.TCH,
|
|
@@ -29,8 +30,15 @@ test('native token defined for all chains', () => {
|
|
|
29
30
|
ChainId.TLOT,
|
|
30
31
|
ChainId.RSKT,
|
|
31
32
|
];
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
const ignoredChainsForWrappedToken = [
|
|
34
|
+
...ignoredChainsForNativeToken,
|
|
35
|
+
ChainId.BTC,
|
|
36
|
+
ChainId.BCH,
|
|
37
|
+
ChainId.LTC,
|
|
38
|
+
ChainId.DGE,
|
|
39
|
+
];
|
|
40
|
+
for (const chain of supportedChains) {
|
|
41
|
+
if (ignoredChainsForNativeToken.includes(chain.id))
|
|
34
42
|
continue;
|
|
35
43
|
try {
|
|
36
44
|
const gasToken = findDefaultToken(chain.coin, chain.id);
|
|
@@ -39,6 +47,10 @@ test('native token defined for all chains', () => {
|
|
|
39
47
|
catch (e) {
|
|
40
48
|
throw new Error(`Failed to load gas token for ${chain.name}(${chain.id})`);
|
|
41
49
|
}
|
|
50
|
+
}
|
|
51
|
+
for (const chain of supportedChains) {
|
|
52
|
+
if (ignoredChainsForWrappedToken.includes(chain.id))
|
|
53
|
+
continue;
|
|
42
54
|
try {
|
|
43
55
|
const wrappedGasToken = findWrappedGasOnChain(chain.id);
|
|
44
56
|
expect(wrappedGasToken).toBeDefined();
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { ChainKey, ChainType, CoinKey, ChainId } from '@lifi/types';
|
|
2
|
+
export const supportedUXTOChains = [
|
|
3
|
+
{
|
|
4
|
+
key: ChainKey.BTC,
|
|
5
|
+
chainType: ChainType.UTXO,
|
|
6
|
+
name: 'Bitcoin',
|
|
7
|
+
coin: CoinKey.BTC,
|
|
8
|
+
id: ChainId.BTC,
|
|
9
|
+
mainnet: true,
|
|
10
|
+
logoURI: 'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/chains/bitcoin.svg',
|
|
11
|
+
faucetUrls: [],
|
|
12
|
+
metamask: {
|
|
13
|
+
chainId: ChainId.BTC.toString(),
|
|
14
|
+
blockExplorerUrls: [
|
|
15
|
+
'https://blockchair.com/bitcoin',
|
|
16
|
+
'https://bitcoinexplorer.org/',
|
|
17
|
+
],
|
|
18
|
+
chainName: 'Bitcoin',
|
|
19
|
+
nativeCurrency: {
|
|
20
|
+
name: 'BTC',
|
|
21
|
+
symbol: 'BTC',
|
|
22
|
+
decimals: 8,
|
|
23
|
+
},
|
|
24
|
+
rpcUrls: ['https://node-router.thorswap.net/bitcoin'],
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
key: ChainKey.BCH,
|
|
29
|
+
chainType: ChainType.UTXO,
|
|
30
|
+
name: 'Bitcoin Cash',
|
|
31
|
+
coin: CoinKey.BCH,
|
|
32
|
+
id: ChainId.BCH,
|
|
33
|
+
mainnet: true,
|
|
34
|
+
logoURI: 'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/chains/bitcoincash.svg',
|
|
35
|
+
faucetUrls: [],
|
|
36
|
+
metamask: {
|
|
37
|
+
chainId: ChainId.BCH.toString(),
|
|
38
|
+
blockExplorerUrls: ['https://www.blockchair.com/bitcoin-cash'],
|
|
39
|
+
chainName: 'Bitcoin Cash',
|
|
40
|
+
nativeCurrency: {
|
|
41
|
+
name: 'BCH',
|
|
42
|
+
symbol: 'BCH',
|
|
43
|
+
decimals: 8,
|
|
44
|
+
},
|
|
45
|
+
rpcUrls: ['https://node-router.thorswap.net/bitcoin-cash'],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
key: ChainKey.LTC,
|
|
50
|
+
chainType: ChainType.UTXO,
|
|
51
|
+
name: 'Litecoin',
|
|
52
|
+
coin: CoinKey.LTC,
|
|
53
|
+
id: ChainId.LTC,
|
|
54
|
+
mainnet: true,
|
|
55
|
+
logoURI: 'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/chains/litecoin.svg',
|
|
56
|
+
faucetUrls: [],
|
|
57
|
+
metamask: {
|
|
58
|
+
chainId: ChainId.LTC.toString(),
|
|
59
|
+
blockExplorerUrls: ['https://blockchair.com/litecoin'],
|
|
60
|
+
chainName: 'Litecoin',
|
|
61
|
+
nativeCurrency: {
|
|
62
|
+
name: 'LTC',
|
|
63
|
+
symbol: 'LTC',
|
|
64
|
+
decimals: 8,
|
|
65
|
+
},
|
|
66
|
+
rpcUrls: ['https://node-router.thorswap.net/litecoin'],
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
key: ChainKey.DGE,
|
|
71
|
+
chainType: ChainType.UTXO,
|
|
72
|
+
name: 'Dogecoin',
|
|
73
|
+
coin: CoinKey.DOGE,
|
|
74
|
+
id: ChainId.DGE,
|
|
75
|
+
mainnet: true,
|
|
76
|
+
logoURI: 'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/chains/dogecoin.svg',
|
|
77
|
+
faucetUrls: [],
|
|
78
|
+
metamask: {
|
|
79
|
+
chainId: ChainId.DGE.toString(),
|
|
80
|
+
blockExplorerUrls: ['https://blockchair.com/dogecoin'],
|
|
81
|
+
chainName: 'Dogecoin',
|
|
82
|
+
nativeCurrency: {
|
|
83
|
+
name: 'DODGE',
|
|
84
|
+
symbol: 'DOGE',
|
|
85
|
+
decimals: 8,
|
|
86
|
+
},
|
|
87
|
+
rpcUrls: ['https://node-router.thorswap.net/dogecoin'],
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
];
|
package/dist/chains/utils.js
CHANGED
package/dist/cjs/chains/index.js
CHANGED
|
@@ -14,5 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.supportedUXTOChains = exports.supportedSolanaChains = exports.supportedEVMChains = void 0;
|
|
18
|
+
var supportedChains_evm_1 = require("./supportedChains.evm");
|
|
19
|
+
Object.defineProperty(exports, "supportedEVMChains", { enumerable: true, get: function () { return supportedChains_evm_1.supportedEVMChains; } });
|
|
20
|
+
var supportedChains_svm_1 = require("./supportedChains.svm");
|
|
21
|
+
Object.defineProperty(exports, "supportedSolanaChains", { enumerable: true, get: function () { return supportedChains_svm_1.supportedSolanaChains; } });
|
|
22
|
+
var supportedChains_utxo_1 = require("./supportedChains.utxo");
|
|
23
|
+
Object.defineProperty(exports, "supportedUXTOChains", { enumerable: true, get: function () { return supportedChains_utxo_1.supportedUXTOChains; } });
|
|
17
24
|
__exportStar(require("./supportedChains"), exports);
|
|
18
25
|
__exportStar(require("./utils"), exports);
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { Chain, ChainKey
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const supportedSolanaChains: SolanaChain[];
|
|
4
|
-
export declare const supportedUXTOChains: UTXOChain[];
|
|
5
|
-
export declare const supportedChains: UTXOChain[];
|
|
1
|
+
import { Chain, ChainKey } from '@lifi/types';
|
|
2
|
+
export declare const supportedChains: import("@lifi/types").UTXOChain[];
|
|
6
3
|
export declare const getChainByKey: (chainKey: ChainKey) => Chain;
|
|
7
4
|
export declare const getChainById: (chainId: number) => Chain;
|