@curvefi/llamalend-api 1.0.22-beta.1 → 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 -1
- package/lib/external-api.d.ts +1 -0
- package/lib/external-api.js +6 -0
- package/lib/llamalend.d.ts +1 -0
- package/lib/llamalend.js +8 -2
- package/package.json +1 -1
- package/src/external-api.ts +10 -0
- package/src/llamalend.ts +7 -2
package/lib/external-api.d.ts
CHANGED
|
@@ -16,4 +16,5 @@ export declare const _getMarketsData: ((network: INetworkName) => Promise<IMarke
|
|
|
16
16
|
export declare function _getQuoteOdos(this: Llamalend, fromToken: string, toToken: string, _amount: bigint, blacklist: string, pathVizImage: boolean, slippage?: number): Promise<IQuoteOdos>;
|
|
17
17
|
export declare function _getExpectedOdos(this: Llamalend, fromToken: string, toToken: string, _amount: bigint, blacklist: string): Promise<string>;
|
|
18
18
|
export declare function _assembleTxOdos(this: Llamalend, pathId: string): Promise<string>;
|
|
19
|
+
export declare const _getHiddenPools: (() => Promise<IDict<string[]>>) & memoize.Memoized<() => Promise<IDict<string[]>>>;
|
|
19
20
|
export {};
|
package/lib/external-api.js
CHANGED
|
@@ -188,3 +188,9 @@ export function _assembleTxOdos(pathId) {
|
|
|
188
188
|
return _assembleTxOdosMemoized(this.constants.ALIASES.leverage_zap, pathId);
|
|
189
189
|
});
|
|
190
190
|
}
|
|
191
|
+
export const _getHiddenPools = memoize(() => fetch(`https://api.curve.finance/api/getHiddenPools`)
|
|
192
|
+
.then((r) => (r.json()))
|
|
193
|
+
.then((json) => json.data), {
|
|
194
|
+
promise: true,
|
|
195
|
+
maxAge: 5 * 60 * 1000, // 5m
|
|
196
|
+
});
|
package/lib/llamalend.d.ts
CHANGED
|
@@ -76,5 +76,6 @@ declare class Llamalend implements ILlamalend {
|
|
|
76
76
|
formatUnits(value: BigNumberish, unit?: string | Numeric): string;
|
|
77
77
|
parseUnits(value: string, unit?: string | Numeric): bigint;
|
|
78
78
|
updateFeeData(): Promise<void>;
|
|
79
|
+
_filterHiddenPools(pools: IDict<ILlamma>): Promise<IDict<ILlamma>>;
|
|
79
80
|
}
|
|
80
81
|
export { Llamalend };
|
package/lib/llamalend.js
CHANGED
|
@@ -42,7 +42,7 @@ import { LLAMMAS } from "./constants/llammas";
|
|
|
42
42
|
import { L2Networks } from "./constants/L2Networks.js";
|
|
43
43
|
import { createCall, handleMultiCallResponse } from "./utils.js";
|
|
44
44
|
import { cacheKey, cacheStats } from "./cache/index.js";
|
|
45
|
-
import { _getMarketsData } from "./external-api.js";
|
|
45
|
+
import { _getHiddenPools, _getMarketsData } from "./external-api.js";
|
|
46
46
|
import { extractDecimals } from "./constants/utils.js";
|
|
47
47
|
export const NETWORK_CONSTANTS = {
|
|
48
48
|
1: {
|
|
@@ -388,7 +388,7 @@ class Llamalend {
|
|
|
388
388
|
this.options = {};
|
|
389
389
|
this.constants = {
|
|
390
390
|
ONE_WAY_MARKETS: {},
|
|
391
|
-
LLAMMAS:
|
|
391
|
+
LLAMMAS: yield this._filterHiddenPools(LLAMMAS),
|
|
392
392
|
COINS: {},
|
|
393
393
|
DECIMALS: {},
|
|
394
394
|
NETWORK_NAME: 'ethereum',
|
|
@@ -676,5 +676,11 @@ class Llamalend {
|
|
|
676
676
|
}
|
|
677
677
|
});
|
|
678
678
|
}
|
|
679
|
+
_filterHiddenPools(pools) {
|
|
680
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
681
|
+
const hiddenPools = (yield _getHiddenPools())[this.constants.NETWORK_NAME] || [];
|
|
682
|
+
return Object.fromEntries(Object.entries(pools).filter(([id]) => !hiddenPools.includes(id)));
|
|
683
|
+
});
|
|
684
|
+
}
|
|
679
685
|
}
|
|
680
686
|
export { Llamalend };
|
package/package.json
CHANGED
package/src/external-api.ts
CHANGED
|
@@ -209,3 +209,13 @@ const _assembleTxOdosMemoized = memoize(
|
|
|
209
209
|
export async function _assembleTxOdos(this: Llamalend, pathId: string): Promise<string> {
|
|
210
210
|
return _assembleTxOdosMemoized(this.constants.ALIASES.leverage_zap, pathId);
|
|
211
211
|
}
|
|
212
|
+
|
|
213
|
+
export const _getHiddenPools = memoize(
|
|
214
|
+
() => fetch(`https://api.curve.finance/api/getHiddenPools`)
|
|
215
|
+
.then((r) => (r.json()))
|
|
216
|
+
.then((json) => (json as {data: IDict<string[]>}).data),
|
|
217
|
+
{
|
|
218
|
+
promise: true,
|
|
219
|
+
maxAge: 5 * 60 * 1000, // 5m
|
|
220
|
+
}
|
|
221
|
+
)
|
package/src/llamalend.ts
CHANGED
|
@@ -79,7 +79,7 @@ import {LLAMMAS} from "./constants/llammas";
|
|
|
79
79
|
import {L2Networks} from "./constants/L2Networks.js";
|
|
80
80
|
import {createCall, handleMultiCallResponse} from "./utils.js";
|
|
81
81
|
import {cacheKey, cacheStats} from "./cache/index.js";
|
|
82
|
-
import {_getMarketsData} from "./external-api.js";
|
|
82
|
+
import {_getHiddenPools, _getMarketsData} from "./external-api.js";
|
|
83
83
|
import {extractDecimals} from "./constants/utils.js";
|
|
84
84
|
|
|
85
85
|
export const NETWORK_CONSTANTS: { [index: number]: any } = {
|
|
@@ -244,7 +244,7 @@ class Llamalend implements ILlamalend {
|
|
|
244
244
|
this.options = {};
|
|
245
245
|
this.constants = {
|
|
246
246
|
ONE_WAY_MARKETS: {},
|
|
247
|
-
LLAMMAS:
|
|
247
|
+
LLAMMAS: await this._filterHiddenPools(LLAMMAS),
|
|
248
248
|
COINS: {},
|
|
249
249
|
DECIMALS: {},
|
|
250
250
|
NETWORK_NAME: 'ethereum',
|
|
@@ -797,6 +797,11 @@ class Llamalend implements ILlamalend {
|
|
|
797
797
|
feeData.maxPriorityFeePerGas;
|
|
798
798
|
}
|
|
799
799
|
}
|
|
800
|
+
|
|
801
|
+
async _filterHiddenPools(pools: IDict<ILlamma>): Promise<IDict<ILlamma>> {
|
|
802
|
+
const hiddenPools = (await _getHiddenPools())[this.constants.NETWORK_NAME] || [];
|
|
803
|
+
return Object.fromEntries(Object.entries(pools).filter(([id]) => !hiddenPools.includes(id))) as IDict<ILlamma>;
|
|
804
|
+
}
|
|
800
805
|
}
|
|
801
806
|
|
|
802
807
|
export { Llamalend };
|