@lifi/types 1.4.1 → 1.6.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/CHANGELOG.md +17 -0
- package/dist/api.js +6 -15
- package/dist/apiErrors.js +1 -2
- package/dist/base.d.ts +2 -0
- package/dist/base.js +8 -9
- package/dist/bridges.js +4 -7
- package/dist/chains/Chain.js +2 -5
- package/dist/chains/EVMChain.js +3 -7
- package/dist/chains/SolanaChain.js +1 -2
- package/dist/chains/chain.utils.js +10 -20
- package/dist/chains/index.js +5 -21
- package/dist/chains/supported.chains.js +273 -253
- package/dist/cjs/api.d.ts +218 -0
- package/dist/cjs/api.js +46 -0
- package/dist/cjs/apiErrors.d.ts +9 -0
- package/dist/cjs/apiErrors.js +2 -0
- package/dist/cjs/base.d.ts +206 -0
- package/dist/cjs/base.js +176 -0
- package/dist/cjs/bridges.d.ts +34 -0
- package/dist/cjs/bridges.js +170 -0
- package/dist/cjs/chains/Chain.d.ts +15 -0
- package/dist/cjs/chains/Chain.js +8 -0
- package/dist/cjs/chains/EVMChain.d.ts +19 -0
- package/dist/cjs/chains/EVMChain.js +8 -0
- package/dist/cjs/chains/SolanaChain.d.ts +2 -0
- package/dist/cjs/chains/SolanaChain.js +2 -0
- package/dist/cjs/chains/chain.utils.d.ts +4 -0
- package/dist/cjs/chains/chain.utils.js +25 -0
- package/dist/cjs/chains/index.d.ts +5 -0
- package/dist/cjs/chains/index.js +21 -0
- package/dist/cjs/chains/supported.chains.d.ts +5 -0
- package/dist/cjs/chains/supported.chains.js +1195 -0
- package/dist/cjs/coins.d.ts +9 -0
- package/dist/cjs/coins.js +1421 -0
- package/dist/cjs/exchanges.d.ts +51 -0
- package/dist/cjs/exchanges.js +1047 -0
- package/dist/cjs/index.d.ts +8 -0
- package/dist/cjs/index.js +24 -0
- package/dist/cjs/multicall.d.ts +3 -0
- package/dist/cjs/multicall.js +67 -0
- package/dist/cjs/step.d.ts +117 -0
- package/dist/cjs/step.js +23 -0
- package/dist/coins.js +402 -391
- package/dist/exchanges.js +210 -214
- package/dist/index.js +8 -24
- package/dist/multicall.js +44 -41
- package/dist/step.d.ts +2 -0
- package/dist/step.js +5 -12
- package/package.json +26 -3
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.supportedBridges = exports.BridgeTool = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated
|
|
6
|
+
* These values are now obtainable from the LI.FI API
|
|
7
|
+
*/
|
|
8
|
+
var BridgeTool;
|
|
9
|
+
(function (BridgeTool) {
|
|
10
|
+
BridgeTool["connext"] = "connext";
|
|
11
|
+
BridgeTool["hop"] = "hop";
|
|
12
|
+
BridgeTool["multichain"] = "multichain";
|
|
13
|
+
BridgeTool["cbridge"] = "cbridge";
|
|
14
|
+
BridgeTool["hyphen"] = "hyphen";
|
|
15
|
+
BridgeTool["polygon"] = "polygon";
|
|
16
|
+
BridgeTool["arbitrum"] = "arbitrum";
|
|
17
|
+
BridgeTool["avalanche"] = "avalanche";
|
|
18
|
+
BridgeTool["optimism"] = "optimism";
|
|
19
|
+
BridgeTool["across"] = "across";
|
|
20
|
+
BridgeTool["portal"] = "portal";
|
|
21
|
+
BridgeTool["stargate"] = "stargate";
|
|
22
|
+
})(BridgeTool = exports.BridgeTool || (exports.BridgeTool = {}));
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated
|
|
25
|
+
* These values are now obtainable from the LI.FI API
|
|
26
|
+
*/
|
|
27
|
+
exports.supportedBridges = [
|
|
28
|
+
{
|
|
29
|
+
key: BridgeTool.connext,
|
|
30
|
+
name: 'Connext',
|
|
31
|
+
logoURI: 'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/bridges/connext.png',
|
|
32
|
+
bridgeUrl: 'https://xpollinate.io/',
|
|
33
|
+
discordUrl: 'https://chat.connext.network/',
|
|
34
|
+
supportUrl: 'https://www.notion.so/connext/Connext-NXTP-Support-19a357ebabdd4e888cfcd138fe3e4644',
|
|
35
|
+
docsUrl: 'https://docs.connext.network/',
|
|
36
|
+
explorerUrl: 'https://connextscan.io/',
|
|
37
|
+
analyticsUrl: 'https://connextscan.io/',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
key: BridgeTool.hop,
|
|
41
|
+
name: 'Hop',
|
|
42
|
+
logoURI: 'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/bridges/hop.png',
|
|
43
|
+
bridgeUrl: 'https://app.hop.exchange/',
|
|
44
|
+
discordUrl: 'https://discord.gg/PwCF88emV4',
|
|
45
|
+
supportUrl: 'https://help.hop.exchange/hc/en-us',
|
|
46
|
+
docsUrl: 'https://docs.hop.exchange/',
|
|
47
|
+
explorerUrl: 'https://explorer.hop.exchange/mainnet/',
|
|
48
|
+
analyticsUrl: 'https://explorer.hop.exchange/mainnet/',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
key: BridgeTool.multichain,
|
|
52
|
+
name: 'Multichain',
|
|
53
|
+
logoURI: 'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/bridges/anyswap.png',
|
|
54
|
+
bridgeUrl: 'https://app.multichain.org/',
|
|
55
|
+
// discordUrl: '',
|
|
56
|
+
supportUrl: 'https://multichain.zendesk.com/hc/en-us',
|
|
57
|
+
docsUrl: 'https://docs.multichain.org/',
|
|
58
|
+
explorerUrl: 'https://anyswap.net/',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
key: BridgeTool.cbridge,
|
|
62
|
+
name: 'cBridge',
|
|
63
|
+
logoURI: 'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/bridges/cbridge.png',
|
|
64
|
+
bridgeUrl: 'https://cbridge.celer.network/',
|
|
65
|
+
discordUrl: 'https://discord.com/invite/uGx4fjQ',
|
|
66
|
+
supportUrl: 'https://form.typeform.com/to/Q4LMjUaK',
|
|
67
|
+
docsUrl: 'https://cbridge-docs.celer.network/',
|
|
68
|
+
// explorerUrl: '',
|
|
69
|
+
analyticsUrl: 'https://cbridge-analytics.celer.network/',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
key: BridgeTool.hyphen,
|
|
73
|
+
name: 'Hyphen',
|
|
74
|
+
logoURI: 'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/bridges/hyphen.png',
|
|
75
|
+
bridgeUrl: 'https://hyphen.biconomy.io/',
|
|
76
|
+
discordUrl: 'https://discord.com/invite/HKHxgyEExQ',
|
|
77
|
+
supportUrl: 'https://discord.com/invite/HKHxgyEExQ',
|
|
78
|
+
docsUrl: 'https://docs.biconomy.io/products/hyphen-instant-cross-chain-transfers',
|
|
79
|
+
// explorerUrl: '',
|
|
80
|
+
analyticsUrl: 'https://hyphen-info.biconomy.io/',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
key: BridgeTool.polygon,
|
|
84
|
+
name: 'Polygon Bridge (PoS)',
|
|
85
|
+
logoURI: 'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/bridges/polygon.png',
|
|
86
|
+
bridgeUrl: 'https://wallet.polygon.technology/bridge',
|
|
87
|
+
// discordUrl: '',
|
|
88
|
+
supportUrl: 'https://forum.matic.network/',
|
|
89
|
+
docsUrl: 'https://docs.polygon.technology/docs/develop/ethereum-polygon/pos/getting-started',
|
|
90
|
+
// explorerUrl: '',
|
|
91
|
+
// analyticsUrl: '',
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
key: BridgeTool.arbitrum,
|
|
95
|
+
name: 'Arbitrum One Bridge',
|
|
96
|
+
logoURI: 'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/bridges/arbitrum.png',
|
|
97
|
+
bridgeUrl: 'https://bridge.arbitrum.io/',
|
|
98
|
+
discordUrl: 'https://discord.gg/ZpZuw7p',
|
|
99
|
+
supportUrl: 'https://discord.gg/ZpZuw7p',
|
|
100
|
+
docsUrl: 'https://developer.offchainlabs.com/docs/bridging_assets',
|
|
101
|
+
// explorerUrl: '',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
key: BridgeTool.avalanche,
|
|
105
|
+
name: 'AVAX Bridge',
|
|
106
|
+
logoURI: 'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/bridges/avalanche.png',
|
|
107
|
+
bridgeUrl: 'https://bridge.avax.network/',
|
|
108
|
+
discordUrl: 'https://chat.avalabs.org/',
|
|
109
|
+
supportUrl: 'https://docs.avax.network/learn/avalanche-bridge-faq/',
|
|
110
|
+
docsUrl: 'https://docs.avax.network/learn/avalanche-bridge-faq/',
|
|
111
|
+
// explorerUrl: '',
|
|
112
|
+
// analyticsUrl: '',
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
key: BridgeTool.optimism,
|
|
116
|
+
name: 'Optimism Gateway',
|
|
117
|
+
logoURI: 'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/bridges/optimism.png',
|
|
118
|
+
bridgeUrl: 'https://gateway.optimism.io/',
|
|
119
|
+
discordUrl: 'https://discord.com/invite/jrnFEvq',
|
|
120
|
+
supportUrl: 'https://discord.com/invite/jrnFEvq',
|
|
121
|
+
docsUrl: 'https://community.optimism.io/docs/developers/bridge/basics/',
|
|
122
|
+
// explorerUrl: '',
|
|
123
|
+
// analyticsUrl: '',
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
key: BridgeTool.across,
|
|
127
|
+
name: 'Across',
|
|
128
|
+
logoURI: 'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/bridges/acrossv2.png',
|
|
129
|
+
bridgeUrl: 'https://across.to/',
|
|
130
|
+
discordUrl: 'https://discord.gg/t4SZySkn',
|
|
131
|
+
supportUrl: 'https://discord.gg/t4SZySkn',
|
|
132
|
+
docsUrl: 'https://docs.across.to/',
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
key: BridgeTool.portal,
|
|
136
|
+
name: 'Wormhole Portal',
|
|
137
|
+
logoURI: 'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/bridges/wormhole_portal.png',
|
|
138
|
+
bridgeUrl: 'https://portalbridge.com/',
|
|
139
|
+
discordUrl: 'https://discord.com/invite/wormholecrypto',
|
|
140
|
+
supportUrl: 'https://discord.com/invite/wormholecrypto',
|
|
141
|
+
docsUrl: 'https://docs.wormholenetwork.com/wormhole/',
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
key: BridgeTool.stargate,
|
|
145
|
+
name: 'Stargate',
|
|
146
|
+
logoURI: 'https://raw.githubusercontent.com/lifinance/types/5685c638772f533edad80fcb210b4bb89e30a50f/src/assets/icons/bridges/stargate.png',
|
|
147
|
+
bridgeUrl: 'https://stargate.finance/',
|
|
148
|
+
discordUrl: 'https://discord.com/invite/TyjeQ45',
|
|
149
|
+
supportUrl: 'https://discord.com/invite/TyjeQ45',
|
|
150
|
+
docsUrl: 'https://stargateprotocol.gitbook.io/stargate/',
|
|
151
|
+
},
|
|
152
|
+
// {
|
|
153
|
+
// key: BridgeTool.,
|
|
154
|
+
// name: '',
|
|
155
|
+
// logoURI:
|
|
156
|
+
// 'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/bridges/.png',
|
|
157
|
+
// bridgeUrl: '',
|
|
158
|
+
// discordUrl: '',
|
|
159
|
+
// supportUrl: '',
|
|
160
|
+
// docsUrl: '',
|
|
161
|
+
// explorerUrl: '',
|
|
162
|
+
// analyticsUrl: '',
|
|
163
|
+
// },
|
|
164
|
+
// for cronos chain, we should confirm if these bridges are available to integrate
|
|
165
|
+
// https://bridge.evodefi.com/
|
|
166
|
+
// https://app.relaychain.com/#/
|
|
167
|
+
// for metis network, we should confirm these bridges as well
|
|
168
|
+
// https://bridge.metis.io/home
|
|
169
|
+
// https://apps.standard.tech/bridge
|
|
170
|
+
];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ChainKey, CoinKey } from '../base';
|
|
2
|
+
export declare enum ChainType {
|
|
3
|
+
EVM = "EVM",
|
|
4
|
+
Solana = "SOLANA"
|
|
5
|
+
}
|
|
6
|
+
export interface _Chain {
|
|
7
|
+
key: ChainKey;
|
|
8
|
+
chainType: ChainType;
|
|
9
|
+
name: string;
|
|
10
|
+
coin: CoinKey;
|
|
11
|
+
id: number;
|
|
12
|
+
mainnet: boolean;
|
|
13
|
+
logoURI?: string;
|
|
14
|
+
faucetUrls?: string[];
|
|
15
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChainType = void 0;
|
|
4
|
+
var ChainType;
|
|
5
|
+
(function (ChainType) {
|
|
6
|
+
ChainType["EVM"] = "EVM";
|
|
7
|
+
ChainType["Solana"] = "SOLANA";
|
|
8
|
+
})(ChainType = exports.ChainType || (exports.ChainType = {}));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { _Chain } from './Chain';
|
|
2
|
+
export interface EVMChain extends _Chain {
|
|
3
|
+
tokenlistUrl?: string;
|
|
4
|
+
metamask: AddEthereumChainParameter;
|
|
5
|
+
multicallAddress?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface AddEthereumChainParameter {
|
|
8
|
+
chainId: string;
|
|
9
|
+
blockExplorerUrls: string[];
|
|
10
|
+
chainName: string;
|
|
11
|
+
nativeCurrency: {
|
|
12
|
+
name: string;
|
|
13
|
+
symbol: string;
|
|
14
|
+
decimals: number;
|
|
15
|
+
};
|
|
16
|
+
rpcUrls: string[];
|
|
17
|
+
}
|
|
18
|
+
export declare const prefixChainId: (chainId: number) => string;
|
|
19
|
+
export declare type Chain = EVMChain;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.prefixChainId = void 0;
|
|
4
|
+
const ethers_1 = require("ethers");
|
|
5
|
+
const prefixChainId = (chainId) => {
|
|
6
|
+
return '0x' + ethers_1.BigNumber.from(chainId)._hex.split('0x')[1].replace(/\b0+/g, '');
|
|
7
|
+
};
|
|
8
|
+
exports.prefixChainId = prefixChainId;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getChainById = exports.getChainByKey = void 0;
|
|
4
|
+
const supported_chains_1 = require("./supported.chains");
|
|
5
|
+
const supportedChains = [
|
|
6
|
+
// This will be added in the future
|
|
7
|
+
// ...supportedSolanaChains,
|
|
8
|
+
...supported_chains_1.supportedEVMChains,
|
|
9
|
+
];
|
|
10
|
+
const getChainByKey = (chainKey) => {
|
|
11
|
+
const chain = supportedChains.find((c) => c.key === chainKey);
|
|
12
|
+
if (!chain) {
|
|
13
|
+
throw new Error('Invalid chainKey');
|
|
14
|
+
}
|
|
15
|
+
return chain;
|
|
16
|
+
};
|
|
17
|
+
exports.getChainByKey = getChainByKey;
|
|
18
|
+
const getChainById = (chainId) => {
|
|
19
|
+
const chain = supportedChains.find((c) => c.id === chainId);
|
|
20
|
+
if (!chain) {
|
|
21
|
+
throw new Error('Invalid chainId');
|
|
22
|
+
}
|
|
23
|
+
return chain;
|
|
24
|
+
};
|
|
25
|
+
exports.getChainById = getChainById;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Chain"), exports);
|
|
18
|
+
__exportStar(require("./EVMChain"), exports);
|
|
19
|
+
__exportStar(require("./SolanaChain"), exports);
|
|
20
|
+
__exportStar(require("./supported.chains"), exports);
|
|
21
|
+
__exportStar(require("./chain.utils"), exports);
|