@lifi/types 1.5.0 → 1.5.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/CHANGELOG.md +2 -0
- package/dist/api.js +6 -15
- package/dist/apiErrors.js +1 -2
- package/dist/base.js +6 -9
- package/dist/bridges.js +3 -6
- 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 +250 -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 +204 -0
- package/dist/cjs/base.js +174 -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 +1172 -0
- package/dist/cjs/coins.d.ts +9 -0
- package/dist/cjs/coins.js +1403 -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 +66 -0
- package/dist/cjs/step.d.ts +115 -0
- package/dist/cjs/step.js +23 -0
- package/dist/coins.js +384 -391
- package/dist/exchanges.js +210 -214
- package/dist/index.js +8 -24
- package/dist/multicall.js +43 -41
- package/dist/step.js +5 -12
- package/package.json +26 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.5.1](https://github.com/lifinance/types/compare/v1.5.0...v1.5.1) (2022-08-19)
|
|
6
|
+
|
|
5
7
|
## [1.5.0](https://github.com/lifinance/types/compare/v1.4.1...v1.5.0) (2022-08-10)
|
|
6
8
|
|
|
7
9
|
|
package/dist/api.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.isSubstatusDone = exports.isSubstatusPending = exports.Orders = void 0;
|
|
4
|
-
exports.Orders = ['RECOMMENDED', 'FASTEST', 'CHEAPEST', 'SAFEST'];
|
|
5
|
-
var _StatusMessage = [
|
|
1
|
+
export const Orders = ['RECOMMENDED', 'FASTEST', 'CHEAPEST', 'SAFEST'];
|
|
2
|
+
const _StatusMessage = [
|
|
6
3
|
// The transaction was not found -- likely not mined yet
|
|
7
4
|
'NOT_FOUND',
|
|
8
5
|
// A third party service is not available
|
|
@@ -14,7 +11,7 @@ var _StatusMessage = [
|
|
|
14
11
|
// The transfer failed
|
|
15
12
|
'FAILED',
|
|
16
13
|
];
|
|
17
|
-
|
|
14
|
+
const _SubstatusPending = [
|
|
18
15
|
// The bridge is waiting for additional confirmations
|
|
19
16
|
'WAIT_SOURCE_CONFIRMATIONS',
|
|
20
17
|
// The off-chain logic is in progress, waiting for the destination tx to be mined
|
|
@@ -30,7 +27,7 @@ var _SubstatusPending = [
|
|
|
30
27
|
// We cannot determine the status of the transfer
|
|
31
28
|
'UNKNOWN_ERROR',
|
|
32
29
|
];
|
|
33
|
-
|
|
30
|
+
const _SubstatusDone = [
|
|
34
31
|
// The transfer was successful
|
|
35
32
|
'COMPLETED',
|
|
36
33
|
// The transfer was partially successful
|
|
@@ -40,11 +37,5 @@ var _SubstatusDone = [
|
|
|
40
37
|
// The transfer was not successful but it has been refunded
|
|
41
38
|
'REFUNDED',
|
|
42
39
|
];
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
};
|
|
46
|
-
exports.isSubstatusPending = isSubstatusPending;
|
|
47
|
-
var isSubstatusDone = function (substatus) {
|
|
48
|
-
return _SubstatusDone.includes(substatus);
|
|
49
|
-
};
|
|
50
|
-
exports.isSubstatusDone = isSubstatusDone;
|
|
40
|
+
export const isSubstatusPending = (substatus) => _SubstatusPending.includes(substatus);
|
|
41
|
+
export const isSubstatusDone = (substatus) => _SubstatusDone.includes(substatus);
|
package/dist/apiErrors.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/base.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ChainId = exports.ChainKey = exports.CoinKey = void 0;
|
|
4
|
-
var CoinKey;
|
|
1
|
+
export var CoinKey;
|
|
5
2
|
(function (CoinKey) {
|
|
6
3
|
CoinKey["ETH"] = "ETH";
|
|
7
4
|
CoinKey["MATIC"] = "MATIC";
|
|
@@ -49,8 +46,8 @@ var CoinKey;
|
|
|
49
46
|
CoinKey["MCB"] = "MCB";
|
|
50
47
|
CoinKey["CELR"] = "CELR";
|
|
51
48
|
CoinKey["IF"] = "IF";
|
|
52
|
-
})(CoinKey
|
|
53
|
-
var ChainKey;
|
|
49
|
+
})(CoinKey || (CoinKey = {}));
|
|
50
|
+
export var ChainKey;
|
|
54
51
|
(function (ChainKey) {
|
|
55
52
|
ChainKey["ETH"] = "eth";
|
|
56
53
|
ChainKey["POL"] = "pol";
|
|
@@ -110,8 +107,8 @@ var ChainKey;
|
|
|
110
107
|
ChainKey["EVMT"] = "evmt";
|
|
111
108
|
ChainKey["MORT"] = "mort";
|
|
112
109
|
ChainKey["FTMT"] = "ftmt";
|
|
113
|
-
})(ChainKey
|
|
114
|
-
var ChainId;
|
|
110
|
+
})(ChainKey || (ChainKey = {}));
|
|
111
|
+
export var ChainId;
|
|
115
112
|
(function (ChainId) {
|
|
116
113
|
ChainId[ChainId["ETH"] = 1] = "ETH";
|
|
117
114
|
ChainId[ChainId["POL"] = 137] = "POL";
|
|
@@ -171,4 +168,4 @@ var ChainId;
|
|
|
171
168
|
ChainId[ChainId["EVMT"] = 9000] = "EVMT";
|
|
172
169
|
ChainId[ChainId["MORT"] = 1287] = "MORT";
|
|
173
170
|
ChainId[ChainId["FTMT"] = 4002] = "FTMT";
|
|
174
|
-
})(ChainId
|
|
171
|
+
})(ChainId || (ChainId = {}));
|
package/dist/bridges.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.supportedBridges = exports.BridgeTool = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* @deprecated
|
|
6
3
|
* These values are now obtainable from the LI.FI API
|
|
7
4
|
*/
|
|
8
|
-
var BridgeTool;
|
|
5
|
+
export var BridgeTool;
|
|
9
6
|
(function (BridgeTool) {
|
|
10
7
|
BridgeTool["connext"] = "connext";
|
|
11
8
|
BridgeTool["hop"] = "hop";
|
|
@@ -19,12 +16,12 @@ var BridgeTool;
|
|
|
19
16
|
BridgeTool["across"] = "across";
|
|
20
17
|
BridgeTool["portal"] = "portal";
|
|
21
18
|
BridgeTool["stargate"] = "stargate";
|
|
22
|
-
})(BridgeTool
|
|
19
|
+
})(BridgeTool || (BridgeTool = {}));
|
|
23
20
|
/**
|
|
24
21
|
* @deprecated
|
|
25
22
|
* These values are now obtainable from the LI.FI API
|
|
26
23
|
*/
|
|
27
|
-
|
|
24
|
+
export const supportedBridges = [
|
|
28
25
|
{
|
|
29
26
|
key: BridgeTool.connext,
|
|
30
27
|
name: 'Connext',
|
package/dist/chains/Chain.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ChainType = void 0;
|
|
4
|
-
var ChainType;
|
|
1
|
+
export var ChainType;
|
|
5
2
|
(function (ChainType) {
|
|
6
3
|
ChainType["EVM"] = "EVM";
|
|
7
4
|
ChainType["Solana"] = "SOLANA";
|
|
8
|
-
})(ChainType
|
|
5
|
+
})(ChainType || (ChainType = {}));
|
package/dist/chains/EVMChain.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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, '');
|
|
1
|
+
import { BigNumber } from 'ethers';
|
|
2
|
+
export const prefixChainId = (chainId) => {
|
|
3
|
+
return '0x' + BigNumber.from(chainId)._hex.split('0x')[1].replace(/\b0+/g, '');
|
|
7
4
|
};
|
|
8
|
-
exports.prefixChainId = prefixChainId;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,30 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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; });
|
|
1
|
+
import { supportedEVMChains } from './supported.chains';
|
|
2
|
+
const supportedChains = [
|
|
3
|
+
// This will be added in the future
|
|
4
|
+
// ...supportedSolanaChains,
|
|
5
|
+
...supportedEVMChains,
|
|
6
|
+
];
|
|
7
|
+
export const getChainByKey = (chainKey) => {
|
|
8
|
+
const chain = supportedChains.find((c) => c.key === chainKey);
|
|
17
9
|
if (!chain) {
|
|
18
10
|
throw new Error('Invalid chainKey');
|
|
19
11
|
}
|
|
20
12
|
return chain;
|
|
21
13
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var chain = supportedChains.find(function (c) { return c.id === chainId; });
|
|
14
|
+
export const getChainById = (chainId) => {
|
|
15
|
+
const chain = supportedChains.find((c) => c.id === chainId);
|
|
25
16
|
if (!chain) {
|
|
26
17
|
throw new Error('Invalid chainId');
|
|
27
18
|
}
|
|
28
19
|
return chain;
|
|
29
20
|
};
|
|
30
|
-
exports.getChainById = getChainById;
|
package/dist/chains/index.js
CHANGED
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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);
|
|
1
|
+
export * from './Chain';
|
|
2
|
+
export * from './EVMChain';
|
|
3
|
+
export * from './SolanaChain';
|
|
4
|
+
export * from './supported.chains';
|
|
5
|
+
export * from './chain.utils';
|