@curvefi/llamalend-api 1.0.21 → 1.0.22-beta.2
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/publish.yml +1 -0
- package/lib/external-api.d.ts +6 -4
- package/lib/external-api.js +116 -98
- package/lib/index.d.ts +138 -41
- package/lib/index.js +80 -75
- package/lib/lendMarkets/LendMarketTemplate.d.ts +3 -1
- package/lib/lendMarkets/LendMarketTemplate.js +333 -333
- package/lib/lendMarkets/lendMarketConstructor.d.ts +2 -1
- package/lib/lendMarkets/lendMarketConstructor.js +3 -4
- package/lib/llamalend.d.ts +2 -2
- package/lib/llamalend.js +12 -20
- package/lib/mintMarkets/MintMarketTemplate.d.ts +3 -1
- package/lib/mintMarkets/MintMarketTemplate.js +204 -204
- package/lib/mintMarkets/mintMarketConstructor.d.ts +2 -1
- package/lib/mintMarkets/mintMarketConstructor.js +2 -2
- package/lib/st-crvUSD.d.ts +29 -28
- package/lib/st-crvUSD.js +237 -173
- package/lib/utils.d.ts +20 -19
- package/lib/utils.js +290 -256
- package/package.json +14 -14
- package/src/external-api.ts +25 -11
- package/src/index.ts +88 -76
- package/src/lendMarkets/LendMarketTemplate.ts +348 -346
- package/src/lendMarkets/lendMarketConstructor.ts +4 -4
- package/src/llamalend.ts +42 -58
- package/src/mintMarkets/MintMarketTemplate.ts +206 -204
- package/src/mintMarkets/mintMarketConstructor.ts +3 -2
- package/src/st-crvUSD.ts +97 -96
- package/src/utils.ts +85 -82
package/lib/index.js
CHANGED
|
@@ -9,82 +9,87 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { LendMarketTemplate, getLendMarket } from "./lendMarkets/index.js";
|
|
11
11
|
import { MintMarketTemplate, getMintMarket } from "./mintMarkets/index.js";
|
|
12
|
-
import {
|
|
12
|
+
import { Llamalend } from "./llamalend.js";
|
|
13
13
|
import { getBalances, getAllowance, hasAllowance, ensureAllowanceEstimateGas, ensureAllowance, getUsdRate, getGasPriceFromL2, getGasInfoForL2, getGasPriceFromL1, totalSupply, getLsdApy, } from "./utils.js";
|
|
14
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";
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
st_crvUSD: {
|
|
58
|
-
convertToAssets,
|
|
59
|
-
convertToShares,
|
|
60
|
-
userBalances,
|
|
61
|
-
totalSupplyAndCrvUSDLocked,
|
|
62
|
-
maxDeposit,
|
|
63
|
-
previewDeposit,
|
|
64
|
-
depositIsApproved,
|
|
65
|
-
depositAllowance,
|
|
66
|
-
depositApprove,
|
|
67
|
-
deposit,
|
|
68
|
-
maxMint,
|
|
69
|
-
previewMint,
|
|
70
|
-
mintIsApproved,
|
|
71
|
-
mintAllowance,
|
|
72
|
-
mintApprove,
|
|
73
|
-
mint,
|
|
74
|
-
maxWithdraw,
|
|
75
|
-
previewWithdraw,
|
|
76
|
-
withdraw,
|
|
77
|
-
maxRedeem,
|
|
78
|
-
previewRedeem,
|
|
79
|
-
redeem,
|
|
15
|
+
export function createLlamalend() {
|
|
16
|
+
const llamalend = new Llamalend();
|
|
17
|
+
return {
|
|
18
|
+
// Init and config
|
|
19
|
+
init(providerType_1, providerSettings_1) {
|
|
20
|
+
return __awaiter(this, arguments, void 0, function* (providerType, providerSettings, options = {}) {
|
|
21
|
+
yield llamalend.init(providerType, providerSettings, options);
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
setCustomFeeData(customFeeData) {
|
|
25
|
+
llamalend.setCustomFeeData(customFeeData);
|
|
26
|
+
},
|
|
27
|
+
get chainId() { return llamalend.chainId; },
|
|
28
|
+
get signerAddress() { return llamalend.signerAddress; },
|
|
29
|
+
// Market templates
|
|
30
|
+
LendMarketTemplate,
|
|
31
|
+
MintMarketTemplate,
|
|
32
|
+
// Market constructors
|
|
33
|
+
getLendMarket: getLendMarket.bind(llamalend),
|
|
34
|
+
getMintMarket: getMintMarket.bind(llamalend),
|
|
35
|
+
// Utility functions
|
|
36
|
+
totalSupply: totalSupply.bind(llamalend),
|
|
37
|
+
getLsdApy: getLsdApy.bind(llamalend),
|
|
38
|
+
getBalances: getBalances.bind(llamalend),
|
|
39
|
+
getAllowance: getAllowance.bind(llamalend),
|
|
40
|
+
hasAllowance: hasAllowance.bind(llamalend),
|
|
41
|
+
ensureAllowance: ensureAllowance.bind(llamalend),
|
|
42
|
+
getUsdRate: getUsdRate.bind(llamalend),
|
|
43
|
+
getGasPriceFromL1: getGasPriceFromL1.bind(llamalend),
|
|
44
|
+
getGasPriceFromL2: getGasPriceFromL2.bind(llamalend),
|
|
45
|
+
getGasInfoForL2: getGasInfoForL2.bind(llamalend),
|
|
46
|
+
// Core methods
|
|
47
|
+
fetchStats: llamalend.fetchStats.bind(llamalend),
|
|
48
|
+
// Market lists
|
|
49
|
+
mintMarkets: {
|
|
50
|
+
getMarketList: llamalend.getMintMarketList.bind(llamalend),
|
|
51
|
+
},
|
|
52
|
+
lendMarkets: {
|
|
53
|
+
fetchMarkets: llamalend.fetchLendMarkets.bind(llamalend),
|
|
54
|
+
getMarketList: llamalend.getLendMarketList.bind(llamalend),
|
|
55
|
+
},
|
|
56
|
+
// Gas estimation
|
|
80
57
|
estimateGas: {
|
|
81
|
-
|
|
82
|
-
deposit: depositEstimateGas,
|
|
83
|
-
mintApprove: mintApproveEstimateGas,
|
|
84
|
-
mint: mintEstimateGas,
|
|
85
|
-
withdraw: withdrawEstimateGas,
|
|
86
|
-
redeem: redeemEstimateGas,
|
|
58
|
+
ensureAllowance: ensureAllowanceEstimateGas.bind(llamalend),
|
|
87
59
|
},
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
60
|
+
// st-crvUSD methods
|
|
61
|
+
st_crvUSD: {
|
|
62
|
+
convertToAssets: convertToAssets.bind(llamalend),
|
|
63
|
+
convertToShares: convertToShares.bind(llamalend),
|
|
64
|
+
userBalances: userBalances.bind(llamalend),
|
|
65
|
+
totalSupplyAndCrvUSDLocked: totalSupplyAndCrvUSDLocked.bind(llamalend),
|
|
66
|
+
maxDeposit: maxDeposit.bind(llamalend),
|
|
67
|
+
previewDeposit: previewDeposit.bind(llamalend),
|
|
68
|
+
depositIsApproved: depositIsApproved.bind(llamalend),
|
|
69
|
+
depositAllowance: depositAllowance.bind(llamalend),
|
|
70
|
+
depositApprove: depositApprove.bind(llamalend),
|
|
71
|
+
deposit: deposit.bind(llamalend),
|
|
72
|
+
maxMint: maxMint.bind(llamalend),
|
|
73
|
+
previewMint: previewMint.bind(llamalend),
|
|
74
|
+
mintIsApproved: mintIsApproved.bind(llamalend),
|
|
75
|
+
mintAllowance: mintAllowance.bind(llamalend),
|
|
76
|
+
mintApprove: mintApprove.bind(llamalend),
|
|
77
|
+
mint: mint.bind(llamalend),
|
|
78
|
+
maxWithdraw: maxWithdraw.bind(llamalend),
|
|
79
|
+
previewWithdraw: previewWithdraw.bind(llamalend),
|
|
80
|
+
withdraw: withdraw.bind(llamalend),
|
|
81
|
+
maxRedeem: maxRedeem.bind(llamalend),
|
|
82
|
+
previewRedeem: previewRedeem.bind(llamalend),
|
|
83
|
+
redeem: redeem.bind(llamalend),
|
|
84
|
+
estimateGas: {
|
|
85
|
+
depositApprove: depositApproveEstimateGas.bind(llamalend),
|
|
86
|
+
deposit: depositEstimateGas.bind(llamalend),
|
|
87
|
+
mintApprove: mintApproveEstimateGas.bind(llamalend),
|
|
88
|
+
mint: mintEstimateGas.bind(llamalend),
|
|
89
|
+
withdraw: withdrawEstimateGas.bind(llamalend),
|
|
90
|
+
redeem: redeemEstimateGas.bind(llamalend),
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
export default createLlamalend();
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import memoize from "memoizee";
|
|
2
|
+
import type { Llamalend } from "../llamalend.js";
|
|
2
3
|
import { IDict, TGas, TAmount, IReward, IQuoteOdos, IOneWayMarket } from "../interfaces.js";
|
|
3
4
|
export declare class LendMarketTemplate {
|
|
5
|
+
private llamalend;
|
|
4
6
|
id: string;
|
|
5
7
|
name: string;
|
|
6
8
|
addresses: {
|
|
@@ -248,7 +250,7 @@ export declare class LendMarketTemplate {
|
|
|
248
250
|
repay: (stateCollateral: TAmount, userCollateral: TAmount, userBorrowed: TAmount, slippage?: number) => Promise<number>;
|
|
249
251
|
};
|
|
250
252
|
};
|
|
251
|
-
constructor(id: string, marketData: IOneWayMarket);
|
|
253
|
+
constructor(id: string, marketData: IOneWayMarket, llamalend: Llamalend);
|
|
252
254
|
private _getMarketId;
|
|
253
255
|
private vaultMaxDeposit;
|
|
254
256
|
private vaultPreviewDeposit;
|