@curvefi/llamalend-api 1.0.3 → 1.0.6
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/.github/workflows/lint.yml +2 -2
- package/.github/workflows/publish.yml +11 -7
- package/eslint.config.mjs +87 -0
- package/lib/cache/index.js +18 -19
- package/lib/constants/L2Networks.js +1 -1
- package/lib/constants/abis/crvUSD/controller_v2.json +979 -0
- package/lib/constants/aliases.js +34 -34
- package/lib/constants/coins.js +16 -16
- package/lib/constants/llammas.js +1 -1
- package/lib/constants/utils.js +8 -10
- package/lib/external-api.d.ts +8 -6
- package/lib/external-api.js +136 -397
- package/lib/index.d.ts +9 -10
- package/lib/index.js +46 -81
- package/lib/interfaces.d.ts +2 -20
- package/lib/lendMarkets/LendMarketTemplate.js +2438 -4419
- package/lib/lendMarkets/lendMarketConstructor.js +2 -2
- package/lib/llamalend.js +511 -696
- package/lib/mintMarkets/MintMarketTemplate.js +1469 -2799
- package/lib/mintMarkets/mintMarketConstructor.js +1 -1
- package/lib/st-crvUSD.js +172 -488
- package/lib/utils.d.ts +2 -2
- package/lib/utils.js +318 -548
- package/package.json +21 -16
- package/src/cache/index.ts +1 -0
- package/src/constants/abis/crvUSD/controller_v2.json +979 -0
- package/src/constants/aliases.ts +7 -7
- package/src/external-api.ts +25 -148
- package/src/interfaces.ts +2 -21
- package/src/lendMarkets/LendMarketTemplate.ts +31 -6
- package/src/llamalend.ts +36 -6
- package/src/mintMarkets/MintMarketTemplate.ts +2 -2
- package/src/utils.ts +8 -8
- package/tsconfig.json +1 -1
- package/.eslintrc.json +0 -40
package/lib/index.js
CHANGED
|
@@ -7,77 +7,42 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
10
|
import { LendMarketTemplate, getLendMarket } from "./lendMarkets/index.js";
|
|
38
11
|
import { MintMarketTemplate, getMintMarket } from "./mintMarkets/index.js";
|
|
39
12
|
import { llamalend as _llamalend } from "./llamalend.js";
|
|
40
13
|
import { getBalances, getAllowance, hasAllowance, ensureAllowanceEstimateGas, ensureAllowance, getUsdRate, getGasPriceFromL2, getGasInfoForL2, getGasPriceFromL1, totalSupply, getLsdApy, } from "./utils.js";
|
|
41
14
|
import { convertToAssets, convertToShares, userBalances, totalSupplyAndCrvUSDLocked, maxDeposit, previewDeposit, depositIsApproved, depositAllowance, depositApproveEstimateGas, depositApprove, depositEstimateGas, deposit, maxMint, previewMint, mintIsApproved, mintAllowance, mintApproveEstimateGas, mintApprove, mintEstimateGas, mint, maxWithdraw, previewWithdraw, withdrawEstimateGas, withdraw, maxRedeem, previewRedeem, redeemEstimateGas, redeem, } from "./st-crvUSD.js";
|
|
42
|
-
function init(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
_a.sent();
|
|
50
|
-
// @ts-ignore
|
|
51
|
-
this.signerAddress = _llamalend.signerAddress;
|
|
52
|
-
// @ts-ignore
|
|
53
|
-
this.chainId = _llamalend.chainId;
|
|
54
|
-
return [2 /*return*/];
|
|
55
|
-
}
|
|
56
|
-
});
|
|
15
|
+
function init(providerType_1, providerSettings_1) {
|
|
16
|
+
return __awaiter(this, arguments, void 0, function* (providerType, providerSettings, options = {}) {
|
|
17
|
+
yield _llamalend.init(providerType, providerSettings, options);
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
this.signerAddress = _llamalend.signerAddress;
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
this.chainId = _llamalend.chainId;
|
|
57
22
|
});
|
|
58
23
|
}
|
|
59
24
|
function setCustomFeeData(customFeeData) {
|
|
60
25
|
_llamalend.setCustomFeeData(customFeeData);
|
|
61
26
|
}
|
|
62
|
-
|
|
63
|
-
init
|
|
27
|
+
const llamalend = {
|
|
28
|
+
init,
|
|
64
29
|
chainId: 0,
|
|
65
30
|
signerAddress: '',
|
|
66
|
-
LendMarketTemplate
|
|
67
|
-
getLendMarket
|
|
68
|
-
MintMarketTemplate
|
|
69
|
-
getMintMarket
|
|
70
|
-
totalSupply
|
|
71
|
-
getLsdApy
|
|
72
|
-
setCustomFeeData
|
|
73
|
-
getBalances
|
|
74
|
-
getAllowance
|
|
75
|
-
hasAllowance
|
|
76
|
-
ensureAllowance
|
|
77
|
-
getUsdRate
|
|
78
|
-
getGasPriceFromL1
|
|
79
|
-
getGasPriceFromL2
|
|
80
|
-
getGasInfoForL2
|
|
31
|
+
LendMarketTemplate,
|
|
32
|
+
getLendMarket,
|
|
33
|
+
MintMarketTemplate,
|
|
34
|
+
getMintMarket,
|
|
35
|
+
totalSupply,
|
|
36
|
+
getLsdApy,
|
|
37
|
+
setCustomFeeData,
|
|
38
|
+
getBalances,
|
|
39
|
+
getAllowance,
|
|
40
|
+
hasAllowance,
|
|
41
|
+
ensureAllowance,
|
|
42
|
+
getUsdRate,
|
|
43
|
+
getGasPriceFromL1,
|
|
44
|
+
getGasPriceFromL2,
|
|
45
|
+
getGasInfoForL2,
|
|
81
46
|
fetchStats: _llamalend.fetchStats,
|
|
82
47
|
getLlammaList: _llamalend.getMintMarketList,
|
|
83
48
|
lendMarkets: {
|
|
@@ -88,28 +53,28 @@ var llamalend = {
|
|
|
88
53
|
ensureAllowance: ensureAllowanceEstimateGas,
|
|
89
54
|
},
|
|
90
55
|
st_crvUSD: {
|
|
91
|
-
convertToAssets
|
|
92
|
-
convertToShares
|
|
93
|
-
userBalances
|
|
94
|
-
totalSupplyAndCrvUSDLocked
|
|
95
|
-
maxDeposit
|
|
96
|
-
previewDeposit
|
|
97
|
-
depositIsApproved
|
|
98
|
-
depositAllowance
|
|
99
|
-
depositApprove
|
|
100
|
-
deposit
|
|
101
|
-
maxMint
|
|
102
|
-
previewMint
|
|
103
|
-
mintIsApproved
|
|
104
|
-
mintAllowance
|
|
105
|
-
mintApprove
|
|
106
|
-
mint
|
|
107
|
-
maxWithdraw
|
|
108
|
-
previewWithdraw
|
|
109
|
-
withdraw
|
|
110
|
-
maxRedeem
|
|
111
|
-
previewRedeem
|
|
112
|
-
redeem
|
|
56
|
+
convertToAssets,
|
|
57
|
+
convertToShares,
|
|
58
|
+
userBalances,
|
|
59
|
+
totalSupplyAndCrvUSDLocked,
|
|
60
|
+
maxDeposit,
|
|
61
|
+
previewDeposit,
|
|
62
|
+
depositIsApproved,
|
|
63
|
+
depositAllowance,
|
|
64
|
+
depositApprove,
|
|
65
|
+
deposit,
|
|
66
|
+
maxMint,
|
|
67
|
+
previewMint,
|
|
68
|
+
mintIsApproved,
|
|
69
|
+
mintAllowance,
|
|
70
|
+
mintApprove,
|
|
71
|
+
mint,
|
|
72
|
+
maxWithdraw,
|
|
73
|
+
previewWithdraw,
|
|
74
|
+
withdraw,
|
|
75
|
+
maxRedeem,
|
|
76
|
+
previewRedeem,
|
|
77
|
+
redeem,
|
|
113
78
|
estimateGas: {
|
|
114
79
|
depositApprove: depositApproveEstimateGas,
|
|
115
80
|
deposit: depositEstimateGas,
|
package/lib/interfaces.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { Contract as MulticallContract, Provider as MulticallProvider } from "@c
|
|
|
3
3
|
export interface IDict<T> {
|
|
4
4
|
[index: string]: T;
|
|
5
5
|
}
|
|
6
|
-
export type INetworkName = "ethereum" | "optimism" | "bsc" | "xdai" | "polygon" | "x-layer" | "fantom" | "fraxtal" | "zksync" | "moonbeam" | "kava" | "mantle" | "base" | "arbitrum" | "celo" | "avalanche" | "aurora";
|
|
7
|
-
export type IChainId = 1 | 10 | 56 | 100 | 137 | 196 | 250 | 252 | 324 | 1284 | 2222 | 5000 | 8453 | 42161 | 42220 | 43114 | 1313161554;
|
|
6
|
+
export type INetworkName = "ethereum" | "optimism" | "bsc" | "xdai" | "polygon" | 'sonic' | "x-layer" | "fantom" | "fraxtal" | "zksync" | "moonbeam" | "kava" | "mantle" | "base" | "arbitrum" | "celo" | "avalanche" | "aurora";
|
|
7
|
+
export type IChainId = 1 | 10 | 56 | 100 | 137 | 146 | 196 | 250 | 252 | 324 | 1284 | 2222 | 5000 | 8453 | 42161 | 42220 | 43114 | 1313161554;
|
|
8
8
|
export type IPoolFactory = "main" | "crypto" | "factory" | "factory-crvusd" | "factory-crypto" | "factory-twocrypto" | "factory-tricrypto" | "factory-stable-ng";
|
|
9
9
|
export interface ICurveContract {
|
|
10
10
|
contract: Contract;
|
|
@@ -125,24 +125,6 @@ export interface IReward {
|
|
|
125
125
|
symbol: string;
|
|
126
126
|
apy: number;
|
|
127
127
|
}
|
|
128
|
-
export type T1inchRouteStep = {
|
|
129
|
-
name: string;
|
|
130
|
-
part: number;
|
|
131
|
-
fromTokenAddress: string;
|
|
132
|
-
toTokenAddress: string;
|
|
133
|
-
}[];
|
|
134
|
-
export interface I1inchRoute {
|
|
135
|
-
part: number;
|
|
136
|
-
hops: T1inchRouteStep[];
|
|
137
|
-
}
|
|
138
|
-
export interface I1inchSwapData {
|
|
139
|
-
tx: {
|
|
140
|
-
data: string;
|
|
141
|
-
};
|
|
142
|
-
dstAmount: string;
|
|
143
|
-
protocols: I1inchRoute[];
|
|
144
|
-
slippage: number;
|
|
145
|
-
}
|
|
146
128
|
interface Rates {
|
|
147
129
|
borrowApr: number;
|
|
148
130
|
borrowApy: number;
|