@lifi/types 1.0.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,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: 'AcrossV2',
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
+ var ethers_1 = require("ethers");
5
+ var prefixChainId = function (chainId) {
6
+ return '0x' + ethers_1.BigNumber.from(chainId)._hex.split('0x')[1].replace(/\b0+/g, '');
7
+ };
8
+ exports.prefixChainId = prefixChainId;
@@ -0,0 +1,2 @@
1
+ import { _Chain } from './Chain';
2
+ export declare type SolanaChain = _Chain;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import { ChainKey } from '../base';
2
+ import { Chain } from './EVMChain';
3
+ export declare const getChainByKey: (chainKey: ChainKey) => Chain;
4
+ export declare const getChainById: (chainId: number) => Chain;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
+ if (ar || !(i in from)) {
5
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
+ ar[i] = from[i];
7
+ }
8
+ }
9
+ return to.concat(ar || Array.prototype.slice.call(from));
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.getChainById = exports.getChainByKey = void 0;
13
+ var supported_chains_1 = require("./supported.chains");
14
+ var supportedChains = __spreadArray([], supported_chains_1.supportedEVMChains, true);
15
+ var getChainByKey = function (chainKey) {
16
+ var chain = supportedChains.find(function (c) { return c.key === chainKey; });
17
+ if (!chain) {
18
+ throw new Error('Invalid chainKey');
19
+ }
20
+ return chain;
21
+ };
22
+ exports.getChainByKey = getChainByKey;
23
+ var getChainById = function (chainId) {
24
+ var chain = supportedChains.find(function (c) { return c.id === chainId; });
25
+ if (!chain) {
26
+ throw new Error('Invalid chainId');
27
+ }
28
+ return chain;
29
+ };
30
+ exports.getChainById = getChainById;
@@ -0,0 +1,5 @@
1
+ export * from './Chain';
2
+ export * from './EVMChain';
3
+ export * from './SolanaChain';
4
+ export * from './supported.chains';
5
+ export * from './chain.utils';
@@ -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);
@@ -0,0 +1,5 @@
1
+ import { EVMChain } from './EVMChain';
2
+ import { SolanaChain } from './SolanaChain';
3
+ export declare const supportedEVMChains: EVMChain[];
4
+ export declare const supportedSolanaChains: SolanaChain[];
5
+ export declare const supportedChains: EVMChain[];