@curvefi/api 2.58.0 → 2.58.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/lib/curve.d.ts +2 -0
- package/lib/curve.js +5 -3
- package/lib/utils.d.ts +2 -2
- package/lib/utils.js +2 -4
- package/package.json +1 -1
package/lib/curve.d.ts
CHANGED
|
@@ -79,6 +79,8 @@ declare class Curve implements ICurve {
|
|
|
79
79
|
maxPriorityFeePerGas?: number;
|
|
80
80
|
chainId?: number;
|
|
81
81
|
}): Promise<void>;
|
|
82
|
+
initContract: (address: string, abi: any, provider: ethers.BrowserProvider | ethers.JsonRpcProvider | ethers.Signer) => ethers.Contract;
|
|
83
|
+
initMulticallContract: (address: string, abi: any) => MulticallContract;
|
|
82
84
|
setContract(address: string, abi: any): void;
|
|
83
85
|
_filterHiddenPools(pools: IDict<IPoolData>): Promise<IDict<IPoolData>>;
|
|
84
86
|
_updateDecimalsAndGauges(pools: IDict<IPoolData>): void;
|
package/lib/curve.js
CHANGED
|
@@ -112,7 +112,7 @@ import { lowerCasePoolDataAddresses, extractDecimals, extractGauges } from "./co
|
|
|
112
112
|
import { _getAllGauges, _getHiddenPools } from "./external-api.js";
|
|
113
113
|
import { L2Networks } from "./constants/L2Networks.js";
|
|
114
114
|
import { getTwocryptoFactoryPoolData } from "./factory/factory-twocrypto.js";
|
|
115
|
-
import {
|
|
115
|
+
import { memoizedContract, memoizedMulticallContract } from "./utils.js";
|
|
116
116
|
var _killGauges = function (poolsData) { return __awaiter(void 0, void 0, void 0, function () {
|
|
117
117
|
var gaugeData, isKilled, gaugeStatuses, poolId;
|
|
118
118
|
return __generator(this, function (_a) {
|
|
@@ -403,6 +403,8 @@ export var NETWORK_CONSTANTS = {
|
|
|
403
403
|
var Curve = /** @class */ (function () {
|
|
404
404
|
function Curve() {
|
|
405
405
|
var _this = this;
|
|
406
|
+
this.initContract = memoizedContract();
|
|
407
|
+
this.initMulticallContract = memoizedMulticallContract();
|
|
406
408
|
this.fetchFactoryPools = function (useApi) {
|
|
407
409
|
if (useApi === void 0) { useApi = true; }
|
|
408
410
|
return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -1202,10 +1204,10 @@ var Curve = /** @class */ (function () {
|
|
|
1202
1204
|
var proxyHandler = {
|
|
1203
1205
|
get: function (target, name) {
|
|
1204
1206
|
if (name === 'contract') {
|
|
1205
|
-
return initContract(target['address'], target['abi'], curveInstance.signer || curveInstance.provider);
|
|
1207
|
+
return curveInstance.initContract(target['address'], target['abi'], curveInstance.signer || curveInstance.provider);
|
|
1206
1208
|
}
|
|
1207
1209
|
else if (name === 'multicallContract') {
|
|
1208
|
-
return initMulticallContract(target['address'], target['abi']);
|
|
1210
|
+
return curveInstance.initMulticallContract(target['address'], target['abi']);
|
|
1209
1211
|
}
|
|
1210
1212
|
else {
|
|
1211
1213
|
return target[name];
|
package/lib/utils.d.ts
CHANGED
|
@@ -66,5 +66,5 @@ export declare const getPoolName: (name: string) => string;
|
|
|
66
66
|
export declare const isStableNgPool: (name: string) => boolean;
|
|
67
67
|
export declare const assetTypeNameHandler: (assetTypeName: string) => REFERENCE_ASSET;
|
|
68
68
|
export declare const getBasePools: () => Promise<IBasePoolShortItem[]>;
|
|
69
|
-
export declare const
|
|
70
|
-
export declare const
|
|
69
|
+
export declare const memoizedContract: () => (address: string, abi: any, provider: BrowserProvider | JsonRpcProvider | Signer) => Contract;
|
|
70
|
+
export declare const memoizedMulticallContract: () => (address: string, abi: any) => MulticallContract;
|
package/lib/utils.js
CHANGED
|
@@ -1006,7 +1006,7 @@ export var getBasePools = function () { return __awaiter(void 0, void 0, void 0,
|
|
|
1006
1006
|
}
|
|
1007
1007
|
});
|
|
1008
1008
|
}); };
|
|
1009
|
-
var memoizedContract = function () {
|
|
1009
|
+
export var memoizedContract = function () {
|
|
1010
1010
|
var cache = {};
|
|
1011
1011
|
return function (address, abi, provider) {
|
|
1012
1012
|
if (address in cache) {
|
|
@@ -1019,7 +1019,7 @@ var memoizedContract = function () {
|
|
|
1019
1019
|
}
|
|
1020
1020
|
};
|
|
1021
1021
|
};
|
|
1022
|
-
var memoizedMulticallContract = function () {
|
|
1022
|
+
export var memoizedMulticallContract = function () {
|
|
1023
1023
|
var cache = {};
|
|
1024
1024
|
return function (address, abi) {
|
|
1025
1025
|
if (address in cache) {
|
|
@@ -1032,5 +1032,3 @@ var memoizedMulticallContract = function () {
|
|
|
1032
1032
|
}
|
|
1033
1033
|
};
|
|
1034
1034
|
};
|
|
1035
|
-
export var initContract = memoizedContract();
|
|
1036
|
-
export var initMulticallContract = memoizedMulticallContract();
|