@lifi/data-types 2.3.0-alpha.1 → 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.
- 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/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,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
|
|
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
|
-
|
|
35
|
-
|
|
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
|
-
|
|
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,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
|
+
];
|
package/dist/cjs/chains/utils.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.prefixChainId = void 0;
|
|
4
|
-
const bignumber_1 = require("@ethersproject/bignumber");
|
|
5
4
|
const prefixChainId = (chainId) => {
|
|
6
|
-
return '0x' +
|
|
5
|
+
return '0x' + chainId.toString(16);
|
|
7
6
|
};
|
|
8
7
|
exports.prefixChainId = prefixChainId;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/data-types",
|
|
3
|
-
"version": "2.3.0
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Data types for the LI.FI stack",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sdk",
|
|
@@ -63,8 +63,7 @@
|
|
|
63
63
|
]
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@
|
|
67
|
-
"@lifi/types": "11.0.0-alpha.0"
|
|
66
|
+
"@lifi/types": "^11.2.0"
|
|
68
67
|
},
|
|
69
68
|
"devDependencies": {
|
|
70
69
|
"@commitlint/cli": "^17.7.1",
|