@curvefi/llamalend-api 1.0.20 → 1.0.22-beta.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/.github/workflows/publish.yml +1 -0
- package/lib/constants/aliases.js +4 -2
- package/lib/external-api.d.ts +5 -4
- package/lib/external-api.js +110 -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 +1 -2
- package/lib/llamalend.js +4 -18
- 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/constants/aliases.ts +4 -2
- package/src/external-api.ts +16 -12
- package/src/index.ts +88 -76
- package/src/lendMarkets/LendMarketTemplate.ts +348 -346
- package/src/lendMarkets/lendMarketConstructor.ts +4 -4
- package/src/llamalend.ts +35 -56
- 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/constants/aliases.js
CHANGED
|
@@ -45,8 +45,10 @@ export const ALIASES_OPTIMISM = lowerCaseValues({
|
|
|
45
45
|
"crv": "0x0994206dfE8De6Ec6920FF4D779B0d950605Fb53",
|
|
46
46
|
"one_way_factory": "0x5EA8f3D674C70b020586933A0a5b250734798BeF",
|
|
47
47
|
"gauge_controller": "0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB",
|
|
48
|
-
"
|
|
49
|
-
"
|
|
48
|
+
"gauge_factory_old": "0xabC000d88f23Bb45525E447528DBF656A9D55bf5",
|
|
49
|
+
"gauge_factory": "0x871fBD4E01012e2E8457346059e8C189d664DbA4",
|
|
50
|
+
"leverage_zap": "0x273e44B9a1841857d9360e8792bB59f9e1FfE9Da",
|
|
51
|
+
"leverage_markets_start_id": "0",
|
|
50
52
|
"gas_oracle": '0xc0d3C0d3C0d3c0D3C0D3C0d3C0d3C0D3C0D3000f',
|
|
51
53
|
"gas_oracle_blob": '0x420000000000000000000000000000000000000f',
|
|
52
54
|
});
|
package/lib/external-api.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import memoize from "memoizee";
|
|
2
|
+
import type { Llamalend } from "./llamalend.js";
|
|
2
3
|
import { IDict, IMarketData, INetworkName, IQuoteOdos } from "./interfaces";
|
|
3
|
-
export declare
|
|
4
|
+
export declare function _getUsdPricesFromApi(this: Llamalend): Promise<IDict<number>>;
|
|
4
5
|
type UserCollateral = {
|
|
5
6
|
total_deposit_precise: string;
|
|
6
7
|
total_deposit_from_user: number;
|
|
@@ -12,7 +13,7 @@ type UserCollateral = {
|
|
|
12
13
|
export declare const _getUserCollateral: ((network: INetworkName, controller: string, user: string) => Promise<UserCollateral>) & memoize.Memoized<(network: INetworkName, controller: string, user: string) => Promise<UserCollateral>>;
|
|
13
14
|
export declare const _getUserCollateralCrvUsd: ((network: INetworkName, controller: string, user: string) => Promise<string>) & memoize.Memoized<(network: INetworkName, controller: string, user: string) => Promise<string>>;
|
|
14
15
|
export declare const _getMarketsData: ((network: INetworkName) => Promise<IMarketData>) & memoize.Memoized<(network: INetworkName) => Promise<IMarketData>>;
|
|
15
|
-
export declare
|
|
16
|
-
export declare
|
|
17
|
-
export declare
|
|
16
|
+
export declare function _getQuoteOdos(this: Llamalend, fromToken: string, toToken: string, _amount: bigint, blacklist: string, pathVizImage: boolean, slippage?: number): Promise<IQuoteOdos>;
|
|
17
|
+
export declare function _getExpectedOdos(this: Llamalend, fromToken: string, toToken: string, _amount: bigint, blacklist: string): Promise<string>;
|
|
18
|
+
export declare function _assembleTxOdos(this: Llamalend, pathId: string): Promise<string>;
|
|
18
19
|
export {};
|
package/lib/external-api.js
CHANGED
|
@@ -9,7 +9,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { ethers } from "ethers";
|
|
11
11
|
import memoize from "memoizee";
|
|
12
|
-
import { llamalend } from "./llamalend.js";
|
|
13
12
|
const _getPoolsFromApi = memoize((network, poolFactory) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
13
|
const response = yield fetch(`https://api.curve.finance/api/getPools/${network}/${poolFactory}`);
|
|
15
14
|
const { data } = yield response.json();
|
|
@@ -30,83 +29,85 @@ const _getAllPoolsFromApi = (network) => __awaiter(void 0, void 0, void 0, funct
|
|
|
30
29
|
_getPoolsFromApi(network, "factory-stable-ng"),
|
|
31
30
|
]);
|
|
32
31
|
});
|
|
33
|
-
export
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
for (const
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (coin.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
32
|
+
export function _getUsdPricesFromApi() {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
var _a, _b;
|
|
35
|
+
const network = this.constants.NETWORK_NAME;
|
|
36
|
+
const allTypesExtendedPoolData = yield _getAllPoolsFromApi(network);
|
|
37
|
+
const priceDict = {};
|
|
38
|
+
const priceDictByMaxTvl = {};
|
|
39
|
+
for (const extendedPoolData of allTypesExtendedPoolData) {
|
|
40
|
+
for (const pool of extendedPoolData.poolData) {
|
|
41
|
+
const lpTokenAddress = (_a = pool.lpTokenAddress) !== null && _a !== void 0 ? _a : pool.address;
|
|
42
|
+
const totalSupply = pool.totalSupply / (Math.pow(10, 18));
|
|
43
|
+
if (lpTokenAddress.toLowerCase() in priceDict) {
|
|
44
|
+
priceDict[lpTokenAddress.toLowerCase()].push({
|
|
45
|
+
price: pool.usdTotal && totalSupply ? pool.usdTotal / totalSupply : 0,
|
|
46
|
+
tvl: pool.usdTotal,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
priceDict[lpTokenAddress.toLowerCase()] = [];
|
|
51
|
+
priceDict[lpTokenAddress.toLowerCase()].push({
|
|
52
|
+
price: pool.usdTotal && totalSupply ? pool.usdTotal / totalSupply : 0,
|
|
53
|
+
tvl: pool.usdTotal,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
for (const coin of pool.coins) {
|
|
57
|
+
if (typeof coin.usdPrice === "number") {
|
|
58
|
+
if (coin.address.toLowerCase() in priceDict) {
|
|
59
|
+
priceDict[coin.address.toLowerCase()].push({
|
|
60
|
+
price: coin.usdPrice,
|
|
61
|
+
tvl: pool.usdTotal,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
priceDict[coin.address.toLowerCase()] = [];
|
|
66
|
+
priceDict[coin.address.toLowerCase()].push({
|
|
67
|
+
price: coin.usdPrice,
|
|
68
|
+
tvl: pool.usdTotal,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
63
71
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
72
|
+
}
|
|
73
|
+
for (const coin of (_b = pool.gaugeRewards) !== null && _b !== void 0 ? _b : []) {
|
|
74
|
+
if (typeof coin.tokenPrice === "number") {
|
|
75
|
+
if (coin.tokenAddress.toLowerCase() in priceDict) {
|
|
76
|
+
priceDict[coin.tokenAddress.toLowerCase()].push({
|
|
77
|
+
price: coin.tokenPrice,
|
|
78
|
+
tvl: pool.usdTotal,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
priceDict[coin.tokenAddress.toLowerCase()] = [];
|
|
83
|
+
priceDict[coin.tokenAddress.toLowerCase()].push({
|
|
84
|
+
price: coin.tokenPrice,
|
|
85
|
+
tvl: pool.usdTotal,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
70
88
|
}
|
|
71
89
|
}
|
|
72
90
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
});
|
|
91
|
+
}
|
|
92
|
+
for (const address in priceDict) {
|
|
93
|
+
if (priceDict[address].length > 0) {
|
|
94
|
+
const maxTvlItem = priceDict[address].reduce((prev, current) => {
|
|
95
|
+
if (+current.tvl > +prev.tvl) {
|
|
96
|
+
return current;
|
|
80
97
|
}
|
|
81
98
|
else {
|
|
82
|
-
|
|
83
|
-
priceDict[coin.tokenAddress.toLowerCase()].push({
|
|
84
|
-
price: coin.tokenPrice,
|
|
85
|
-
tvl: pool.usdTotal,
|
|
86
|
-
});
|
|
99
|
+
return prev;
|
|
87
100
|
}
|
|
88
|
-
}
|
|
101
|
+
});
|
|
102
|
+
priceDictByMaxTvl[address] = maxTvlItem.price;
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
priceDictByMaxTvl[address] = 0;
|
|
89
106
|
}
|
|
90
107
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const maxTvlItem = priceDict[address].reduce((prev, current) => {
|
|
95
|
-
if (+current.tvl > +prev.tvl) {
|
|
96
|
-
return current;
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
return prev;
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
priceDictByMaxTvl[address] = maxTvlItem.price;
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
priceDictByMaxTvl[address] = 0;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return priceDictByMaxTvl;
|
|
109
|
-
});
|
|
108
|
+
return priceDictByMaxTvl;
|
|
109
|
+
});
|
|
110
|
+
}
|
|
110
111
|
export const _getUserCollateral = memoize((network, controller, user) => __awaiter(void 0, void 0, void 0, function* () {
|
|
111
112
|
const url = `https://prices.curve.finance/v1/lending/collateral_events/${network}/${controller}/${user}`;
|
|
112
113
|
const response = yield fetch(url);
|
|
@@ -144,35 +145,46 @@ export const _getMarketsData = memoize((network) => __awaiter(void 0, void 0, vo
|
|
|
144
145
|
maxAge: 10 * 1000, // 10s
|
|
145
146
|
});
|
|
146
147
|
// --- ODOS ---
|
|
147
|
-
export
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
fromToken
|
|
152
|
-
|
|
153
|
-
toToken
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
148
|
+
export function _getQuoteOdos(fromToken_1, toToken_1, _amount_1, blacklist_1, pathVizImage_1) {
|
|
149
|
+
return __awaiter(this, arguments, void 0, function* (fromToken, toToken, _amount, blacklist, pathVizImage, slippage = 0.5) {
|
|
150
|
+
if (_amount === BigInt(0))
|
|
151
|
+
return { outAmounts: ["0.0"], pathId: '', pathVizImage: '', priceImpact: 0, slippage };
|
|
152
|
+
if (ethers.getAddress(fromToken) == "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE")
|
|
153
|
+
fromToken = "0x0000000000000000000000000000000000000000";
|
|
154
|
+
if (ethers.getAddress(toToken) == "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE")
|
|
155
|
+
toToken = "0x0000000000000000000000000000000000000000";
|
|
156
|
+
const url = `https://prices.curve.finance/odos/quote?chain_id=${this.chainId}&from_address=${ethers.getAddress(fromToken)}` +
|
|
157
|
+
`&to_address=${ethers.getAddress(toToken)}&amount=${_amount.toString()}&slippage=${slippage}&pathVizImage=${pathVizImage}` +
|
|
158
|
+
`&caller_address=${ethers.getAddress(this.constants.ALIASES.leverage_zap)}&blacklist=${ethers.getAddress(blacklist)}`;
|
|
159
|
+
const response = yield fetch(url, { headers: { "accept": "application/json" } });
|
|
160
|
+
if (response.status !== 200) {
|
|
161
|
+
throw Error(`Odos quote error - ${response.status} ${response.statusText}`);
|
|
162
|
+
}
|
|
163
|
+
const data = yield response.json();
|
|
164
|
+
return Object.assign(Object.assign({}, data), { slippage });
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
export function _getExpectedOdos(fromToken, toToken, _amount, blacklist) {
|
|
168
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
169
|
+
return (yield _getQuoteOdos.call(this, fromToken, toToken, _amount, blacklist, false)).outAmounts[0];
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
const _assembleTxOdosMemoized = memoize(function (leverageZapAddress, pathId) {
|
|
173
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
174
|
+
const url = `https://prices.curve.finance/odos/assemble?user=${ethers.getAddress(leverageZapAddress)}&path_id=${pathId}`;
|
|
175
|
+
const response = yield fetch(url, { headers: { 'Content-Type': 'application/json' } });
|
|
176
|
+
if (response.status !== 200) {
|
|
177
|
+
throw Error(`Odos assemble error - ${response.status} ${response.statusText}`);
|
|
178
|
+
}
|
|
179
|
+
const { transaction } = yield response.json();
|
|
180
|
+
return transaction.data;
|
|
181
|
+
});
|
|
182
|
+
}, {
|
|
176
183
|
promise: true,
|
|
177
184
|
maxAge: 10 * 1000, // 10s
|
|
178
185
|
});
|
|
186
|
+
export function _assembleTxOdos(pathId) {
|
|
187
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
188
|
+
return _assembleTxOdosMemoized(this.constants.ALIASES.leverage_zap, pathId);
|
|
189
|
+
});
|
|
190
|
+
}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,33 +1,131 @@
|
|
|
1
1
|
import { ethers, Networkish } from "ethers";
|
|
2
2
|
import { LendMarketTemplate } from "./lendMarkets/index.js";
|
|
3
3
|
import { MintMarketTemplate } from "./mintMarkets/index.js";
|
|
4
|
-
declare function
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
signerAddress: string;
|
|
4
|
+
export declare function createLlamalend(): {
|
|
5
|
+
init(providerType: "JsonRpc" | "Web3" | "Infura" | "Alchemy", providerSettings: {
|
|
6
|
+
url?: string;
|
|
7
|
+
privateKey?: string;
|
|
8
|
+
batchMaxCount?: number;
|
|
9
|
+
} | {
|
|
10
|
+
externalProvider: ethers.Eip1193Provider;
|
|
11
|
+
} | {
|
|
12
|
+
network?: Networkish;
|
|
13
|
+
apiKey?: string;
|
|
14
|
+
}, options?: {
|
|
15
|
+
gasPrice?: number;
|
|
16
|
+
maxFeePerGas?: number;
|
|
17
|
+
maxPriorityFeePerGas?: number;
|
|
18
|
+
chainId?: number;
|
|
19
|
+
}): Promise<void>;
|
|
20
|
+
setCustomFeeData(customFeeData: {
|
|
21
|
+
gasPrice?: number;
|
|
22
|
+
maxFeePerGas?: number;
|
|
23
|
+
maxPriorityFeePerGas?: number;
|
|
24
|
+
}): void;
|
|
25
|
+
readonly chainId: number;
|
|
26
|
+
readonly signerAddress: string;
|
|
28
27
|
LendMarketTemplate: typeof LendMarketTemplate;
|
|
28
|
+
MintMarketTemplate: typeof MintMarketTemplate;
|
|
29
29
|
getLendMarket: (lendMarketId: string) => LendMarketTemplate;
|
|
30
|
+
getMintMarket: (mintMarketId: string) => MintMarketTemplate;
|
|
31
|
+
totalSupply: () => Promise<{
|
|
32
|
+
total: string;
|
|
33
|
+
minted: string;
|
|
34
|
+
pegKeepersDebt: string;
|
|
35
|
+
}>;
|
|
36
|
+
getLsdApy: ((name: "wstETH" | "sfrxETH") => Promise<{
|
|
37
|
+
apy: number;
|
|
38
|
+
baseApy: number;
|
|
39
|
+
apyMean30d: number;
|
|
40
|
+
}>) & import("memoizee").Memoized<(name: "wstETH" | "sfrxETH") => Promise<{
|
|
41
|
+
apy: number;
|
|
42
|
+
baseApy: number;
|
|
43
|
+
apyMean30d: number;
|
|
44
|
+
}>>;
|
|
45
|
+
getBalances: (coins: string[], address?: string | undefined) => Promise<string[]>;
|
|
46
|
+
getAllowance: (coins: string[], address: string, spender: string) => Promise<string[]>;
|
|
47
|
+
hasAllowance: (coins: string[], amounts: (string | number)[], address: string, spender: string) => Promise<boolean>;
|
|
48
|
+
ensureAllowance: (coins: string[], amounts: (string | number)[], spender: string, isMax?: boolean | undefined) => Promise<string[]>;
|
|
49
|
+
getUsdRate: (coin: string) => Promise<number>;
|
|
50
|
+
getGasPriceFromL1: () => Promise<number>;
|
|
51
|
+
getGasPriceFromL2: () => Promise<number>;
|
|
52
|
+
getGasInfoForL2: () => Promise<Record<string, number>>;
|
|
53
|
+
fetchStats: (amms: string[], controllers: string[], vaults: string[], borrowed_tokens: string[], collateral_tokens: string[]) => Promise<void>;
|
|
54
|
+
mintMarkets: {
|
|
55
|
+
getMarketList: () => string[];
|
|
56
|
+
};
|
|
57
|
+
lendMarkets: {
|
|
58
|
+
fetchMarkets: (useAPI?: boolean) => Promise<void>;
|
|
59
|
+
getMarketList: () => string[];
|
|
60
|
+
};
|
|
61
|
+
estimateGas: {
|
|
62
|
+
ensureAllowance: (coins: string[], amounts: (string | number)[], spender: string, isMax?: boolean | undefined) => Promise<import("./interfaces.js").TGas>;
|
|
63
|
+
};
|
|
64
|
+
st_crvUSD: {
|
|
65
|
+
convertToAssets: (shares: import("./interfaces.js").TAmount) => Promise<string>;
|
|
66
|
+
convertToShares: (assets: import("./interfaces.js").TAmount) => Promise<string>;
|
|
67
|
+
userBalances: (address?: string | undefined) => Promise<{
|
|
68
|
+
crvUSD: string;
|
|
69
|
+
st_crvUSD: string;
|
|
70
|
+
}>;
|
|
71
|
+
totalSupplyAndCrvUSDLocked: () => Promise<{
|
|
72
|
+
crvUSD: string;
|
|
73
|
+
st_crvUSD: string;
|
|
74
|
+
}>;
|
|
75
|
+
maxDeposit: (address?: string | undefined) => Promise<string>;
|
|
76
|
+
previewDeposit: (assets: import("./interfaces.js").TAmount) => Promise<string>;
|
|
77
|
+
depositIsApproved: (assets: import("./interfaces.js").TAmount) => Promise<boolean>;
|
|
78
|
+
depositAllowance: () => Promise<string[]>;
|
|
79
|
+
depositApprove: (assets: import("./interfaces.js").TAmount, isMax?: boolean | undefined) => Promise<string[]>;
|
|
80
|
+
deposit: (assets: import("./interfaces.js").TAmount) => Promise<string>;
|
|
81
|
+
maxMint: (address?: string | undefined) => Promise<string>;
|
|
82
|
+
previewMint: (shares: import("./interfaces.js").TAmount) => Promise<string>;
|
|
83
|
+
mintIsApproved: (shares: import("./interfaces.js").TAmount) => Promise<boolean>;
|
|
84
|
+
mintAllowance: () => Promise<string[]>;
|
|
85
|
+
mintApprove: (shares: import("./interfaces.js").TAmount, isMax?: boolean | undefined) => Promise<string[]>;
|
|
86
|
+
mint: (shares: import("./interfaces.js").TAmount) => Promise<string>;
|
|
87
|
+
maxWithdraw: (address?: string | undefined) => Promise<string>;
|
|
88
|
+
previewWithdraw: (assets: import("./interfaces.js").TAmount) => Promise<string>;
|
|
89
|
+
withdraw: (assets: import("./interfaces.js").TAmount) => Promise<string>;
|
|
90
|
+
maxRedeem: (address?: string | undefined) => Promise<string>;
|
|
91
|
+
previewRedeem: (shares: import("./interfaces.js").TAmount) => Promise<string>;
|
|
92
|
+
redeem: (shares: import("./interfaces.js").TAmount) => Promise<string>;
|
|
93
|
+
estimateGas: {
|
|
94
|
+
depositApprove: (assets: import("./interfaces.js").TAmount) => Promise<import("./interfaces.js").TGas>;
|
|
95
|
+
deposit: (assets: import("./interfaces.js").TAmount) => Promise<import("./interfaces.js").TGas>;
|
|
96
|
+
mintApprove: (shares: import("./interfaces.js").TAmount) => Promise<import("./interfaces.js").TGas>;
|
|
97
|
+
mint: (shares: import("./interfaces.js").TAmount) => Promise<import("./interfaces.js").TGas>;
|
|
98
|
+
withdraw: (assets: import("./interfaces.js").TAmount) => Promise<import("./interfaces.js").TGas>;
|
|
99
|
+
redeem: (shares: import("./interfaces.js").TAmount) => Promise<import("./interfaces.js").TGas>;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
declare const _default: {
|
|
104
|
+
init(providerType: "JsonRpc" | "Web3" | "Infura" | "Alchemy", providerSettings: {
|
|
105
|
+
url?: string;
|
|
106
|
+
privateKey?: string;
|
|
107
|
+
batchMaxCount?: number;
|
|
108
|
+
} | {
|
|
109
|
+
externalProvider: ethers.Eip1193Provider;
|
|
110
|
+
} | {
|
|
111
|
+
network?: Networkish;
|
|
112
|
+
apiKey?: string;
|
|
113
|
+
}, options?: {
|
|
114
|
+
gasPrice?: number;
|
|
115
|
+
maxFeePerGas?: number;
|
|
116
|
+
maxPriorityFeePerGas?: number;
|
|
117
|
+
chainId?: number;
|
|
118
|
+
}): Promise<void>;
|
|
119
|
+
setCustomFeeData(customFeeData: {
|
|
120
|
+
gasPrice?: number;
|
|
121
|
+
maxFeePerGas?: number;
|
|
122
|
+
maxPriorityFeePerGas?: number;
|
|
123
|
+
}): void;
|
|
124
|
+
readonly chainId: number;
|
|
125
|
+
readonly signerAddress: string;
|
|
126
|
+
LendMarketTemplate: typeof LendMarketTemplate;
|
|
30
127
|
MintMarketTemplate: typeof MintMarketTemplate;
|
|
128
|
+
getLendMarket: (lendMarketId: string) => LendMarketTemplate;
|
|
31
129
|
getMintMarket: (mintMarketId: string) => MintMarketTemplate;
|
|
32
130
|
totalSupply: () => Promise<{
|
|
33
131
|
total: string;
|
|
@@ -43,11 +141,10 @@ declare const llamalend: {
|
|
|
43
141
|
baseApy: number;
|
|
44
142
|
apyMean30d: number;
|
|
45
143
|
}>>;
|
|
46
|
-
|
|
47
|
-
getBalances: (coins: string[], address?: string) => Promise<string[]>;
|
|
144
|
+
getBalances: (coins: string[], address?: string | undefined) => Promise<string[]>;
|
|
48
145
|
getAllowance: (coins: string[], address: string, spender: string) => Promise<string[]>;
|
|
49
|
-
hasAllowance: (coins: string[], amounts: (
|
|
50
|
-
ensureAllowance: (coins: string[], amounts: (
|
|
146
|
+
hasAllowance: (coins: string[], amounts: (string | number)[], address: string, spender: string) => Promise<boolean>;
|
|
147
|
+
ensureAllowance: (coins: string[], amounts: (string | number)[], spender: string, isMax?: boolean | undefined) => Promise<string[]>;
|
|
51
148
|
getUsdRate: (coin: string) => Promise<number>;
|
|
52
149
|
getGasPriceFromL1: () => Promise<number>;
|
|
53
150
|
getGasPriceFromL2: () => Promise<number>;
|
|
@@ -61,35 +158,35 @@ declare const llamalend: {
|
|
|
61
158
|
getMarketList: () => string[];
|
|
62
159
|
};
|
|
63
160
|
estimateGas: {
|
|
64
|
-
ensureAllowance: (coins: string[], amounts: (
|
|
161
|
+
ensureAllowance: (coins: string[], amounts: (string | number)[], spender: string, isMax?: boolean | undefined) => Promise<import("./interfaces.js").TGas>;
|
|
65
162
|
};
|
|
66
163
|
st_crvUSD: {
|
|
67
164
|
convertToAssets: (shares: import("./interfaces.js").TAmount) => Promise<string>;
|
|
68
165
|
convertToShares: (assets: import("./interfaces.js").TAmount) => Promise<string>;
|
|
69
|
-
userBalances: (address?: string) => Promise<{
|
|
70
|
-
|
|
71
|
-
|
|
166
|
+
userBalances: (address?: string | undefined) => Promise<{
|
|
167
|
+
crvUSD: string;
|
|
168
|
+
st_crvUSD: string;
|
|
72
169
|
}>;
|
|
73
170
|
totalSupplyAndCrvUSDLocked: () => Promise<{
|
|
74
|
-
|
|
75
|
-
|
|
171
|
+
crvUSD: string;
|
|
172
|
+
st_crvUSD: string;
|
|
76
173
|
}>;
|
|
77
|
-
maxDeposit: (address?: string) => Promise<string>;
|
|
174
|
+
maxDeposit: (address?: string | undefined) => Promise<string>;
|
|
78
175
|
previewDeposit: (assets: import("./interfaces.js").TAmount) => Promise<string>;
|
|
79
176
|
depositIsApproved: (assets: import("./interfaces.js").TAmount) => Promise<boolean>;
|
|
80
177
|
depositAllowance: () => Promise<string[]>;
|
|
81
|
-
depositApprove: (assets: import("./interfaces.js").TAmount, isMax?: boolean) => Promise<string[]>;
|
|
178
|
+
depositApprove: (assets: import("./interfaces.js").TAmount, isMax?: boolean | undefined) => Promise<string[]>;
|
|
82
179
|
deposit: (assets: import("./interfaces.js").TAmount) => Promise<string>;
|
|
83
|
-
maxMint: (address?: string) => Promise<string>;
|
|
180
|
+
maxMint: (address?: string | undefined) => Promise<string>;
|
|
84
181
|
previewMint: (shares: import("./interfaces.js").TAmount) => Promise<string>;
|
|
85
182
|
mintIsApproved: (shares: import("./interfaces.js").TAmount) => Promise<boolean>;
|
|
86
183
|
mintAllowance: () => Promise<string[]>;
|
|
87
|
-
mintApprove: (shares: import("./interfaces.js").TAmount, isMax?: boolean) => Promise<string[]>;
|
|
184
|
+
mintApprove: (shares: import("./interfaces.js").TAmount, isMax?: boolean | undefined) => Promise<string[]>;
|
|
88
185
|
mint: (shares: import("./interfaces.js").TAmount) => Promise<string>;
|
|
89
|
-
maxWithdraw: (address?: string) => Promise<string>;
|
|
186
|
+
maxWithdraw: (address?: string | undefined) => Promise<string>;
|
|
90
187
|
previewWithdraw: (assets: import("./interfaces.js").TAmount) => Promise<string>;
|
|
91
188
|
withdraw: (assets: import("./interfaces.js").TAmount) => Promise<string>;
|
|
92
|
-
maxRedeem: (address?: string) => Promise<string>;
|
|
189
|
+
maxRedeem: (address?: string | undefined) => Promise<string>;
|
|
93
190
|
previewRedeem: (shares: import("./interfaces.js").TAmount) => Promise<string>;
|
|
94
191
|
redeem: (shares: import("./interfaces.js").TAmount) => Promise<string>;
|
|
95
192
|
estimateGas: {
|
|
@@ -102,4 +199,4 @@ declare const llamalend: {
|
|
|
102
199
|
};
|
|
103
200
|
};
|
|
104
201
|
};
|
|
105
|
-
export default
|
|
202
|
+
export default _default;
|