@gearbox-protocol/sdk 1.18.1 → 1.18.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/lib/apy/convexAPY.d.ts +1 -1
- package/lib/apy/lidoAPY.d.ts +1 -1
- package/lib/contracts/contracts.d.ts +1 -1
- package/lib/contracts/contractsRegister.d.ts +1 -1
- package/lib/core/chains.d.ts +15 -0
- package/lib/{utils/network.js → core/chains.js} +33 -14
- package/lib/core/constants.d.ts +0 -6
- package/lib/core/constants.js +1 -17
- package/lib/core/rewardClaimer.d.ts +1 -1
- package/lib/core/rewardConvex.d.ts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/oracles/oracles.d.ts +1 -1
- package/lib/parsers/txParser.d.ts +1 -1
- package/lib/pathfinder/pathOptions.d.ts +1 -1
- package/lib/pathfinder/pathfinder.d.ts +1 -1
- package/lib/strategies/convex.d.ts +1 -1
- package/lib/strategies/curve.d.ts +1 -1
- package/lib/strategies/lido.d.ts +1 -1
- package/lib/strategies/yearn.d.ts +1 -1
- package/lib/tokens/token.d.ts +1 -1
- package/lib/tokens/tokenData.d.ts +1 -1
- package/package.json +1 -1
- package/lib/utils/network.d.ts +0 -4
package/lib/apy/convexAPY.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BigNumber, providers } from "ethers";
|
|
2
2
|
import { ConvexPoolContract, ConvexPoolParams } from "../contracts/contracts";
|
|
3
|
-
import { NetworkType } from "../core/
|
|
3
|
+
import { NetworkType } from "../core/chains";
|
|
4
4
|
import { CurveLPToken } from "../tokens/curveLP";
|
|
5
5
|
import { SupportedToken } from "../tokens/token";
|
|
6
6
|
import { CurveAPYResult } from "./curveAPY";
|
package/lib/apy/lidoAPY.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { providers } from "ethers";
|
|
2
|
-
import { NetworkType } from "../core/
|
|
2
|
+
import { NetworkType } from "../core/chains";
|
|
3
3
|
export declare function getLidoAPY(provider: providers.Provider, networkType: NetworkType): Promise<readonly [import("ethers").BigNumber, number]>;
|
|
4
4
|
export declare const LIDO_FEE_DECIMALS = 10000;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NetworkType } from "../core/
|
|
1
|
+
import { NetworkType } from "../core/chains";
|
|
2
2
|
export declare const stEthPoolWrapper: Record<NetworkType, string>;
|
|
3
3
|
export declare const CREDIT_MANAGER_DAI_V2_MAINNET: string;
|
|
4
4
|
export declare const CREDIT_MANAGER_USDC_V2_MAINNET: string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ethers } from "ethers";
|
|
2
|
+
export declare const MAINNET_NETWORK = 1;
|
|
3
|
+
export declare const GOERLI_NETWORK = 5;
|
|
4
|
+
export declare const LOCAL_NETWORK = 1337;
|
|
5
|
+
export declare const HARDHAT_NETWORK = 31337;
|
|
6
|
+
export declare const CHAINS: {
|
|
7
|
+
readonly Mainnet: 1;
|
|
8
|
+
readonly Goerli: 5;
|
|
9
|
+
readonly Local: 1337;
|
|
10
|
+
readonly Hardhat: 31337;
|
|
11
|
+
};
|
|
12
|
+
export declare type NetworkType = "Mainnet" | "Goerli";
|
|
13
|
+
export declare const getNetworkType: (chainId: number, localAs?: NetworkType) => NetworkType;
|
|
14
|
+
export declare const isSupportedNetwork: (chainId: number | undefined) => chainId is number;
|
|
15
|
+
export declare function detectNetwork(provider: ethers.providers.Provider): Promise<NetworkType>;
|
|
@@ -35,11 +35,41 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
+
var _a;
|
|
38
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
40
|
-
var constants_1 = require("../core/constants");
|
|
40
|
+
exports.detectNetwork = exports.isSupportedNetwork = exports.getNetworkType = exports.CHAINS = exports.HARDHAT_NETWORK = exports.LOCAL_NETWORK = exports.GOERLI_NETWORK = exports.MAINNET_NETWORK = void 0;
|
|
41
41
|
var token_1 = require("../tokens/token");
|
|
42
42
|
var types_1 = require("../types");
|
|
43
|
+
var constants_1 = require("./constants");
|
|
44
|
+
exports.MAINNET_NETWORK = 1;
|
|
45
|
+
exports.GOERLI_NETWORK = 5;
|
|
46
|
+
exports.LOCAL_NETWORK = 1337;
|
|
47
|
+
exports.HARDHAT_NETWORK = 31337;
|
|
48
|
+
exports.CHAINS = {
|
|
49
|
+
Mainnet: exports.MAINNET_NETWORK,
|
|
50
|
+
Goerli: exports.GOERLI_NETWORK,
|
|
51
|
+
Local: exports.LOCAL_NETWORK,
|
|
52
|
+
Hardhat: exports.HARDHAT_NETWORK,
|
|
53
|
+
};
|
|
54
|
+
var SUPPORTED_CHAINS = (_a = {},
|
|
55
|
+
_a[exports.CHAINS.Mainnet] = "Mainnet",
|
|
56
|
+
_a[exports.CHAINS.Goerli] = "Goerli",
|
|
57
|
+
_a[exports.CHAINS.Local] = "Mainnet",
|
|
58
|
+
_a);
|
|
59
|
+
var getNetworkType = function (chainId, localAs) {
|
|
60
|
+
if (localAs === void 0) { localAs = "Mainnet"; }
|
|
61
|
+
var chainType = SUPPORTED_CHAINS[chainId];
|
|
62
|
+
if (chainId === exports.CHAINS.Local) {
|
|
63
|
+
return localAs;
|
|
64
|
+
}
|
|
65
|
+
else if (chainType) {
|
|
66
|
+
return chainType;
|
|
67
|
+
}
|
|
68
|
+
throw new Error("Unsupported network");
|
|
69
|
+
};
|
|
70
|
+
exports.getNetworkType = getNetworkType;
|
|
71
|
+
var isSupportedNetwork = function (chainId) { return chainId !== undefined && !!SUPPORTED_CHAINS[chainId]; };
|
|
72
|
+
exports.isSupportedNetwork = isSupportedNetwork;
|
|
43
73
|
function detectNetwork(provider) {
|
|
44
74
|
return __awaiter(this, void 0, void 0, function () {
|
|
45
75
|
var usdcMainnet, _a, usdcMainnet, _b;
|
|
@@ -64,7 +94,7 @@ function detectNetwork(provider) {
|
|
|
64
94
|
return [2 /*return*/, "Goerli"];
|
|
65
95
|
case 5:
|
|
66
96
|
_b = _c.sent();
|
|
67
|
-
throw new Error("
|
|
97
|
+
throw new Error("Unsupported network");
|
|
68
98
|
case 6: return [3 /*break*/, 7];
|
|
69
99
|
case 7: return [2 /*return*/];
|
|
70
100
|
}
|
|
@@ -72,14 +102,3 @@ function detectNetwork(provider) {
|
|
|
72
102
|
});
|
|
73
103
|
}
|
|
74
104
|
exports.detectNetwork = detectNetwork;
|
|
75
|
-
function getEtherscan(chainId) {
|
|
76
|
-
switch (chainId) {
|
|
77
|
-
case constants_1.MAINNET_NETWORK:
|
|
78
|
-
return "https://etherscan.io";
|
|
79
|
-
case constants_1.GOERLI_NETWORK:
|
|
80
|
-
return "https://goerli.etherscan.io";
|
|
81
|
-
default:
|
|
82
|
-
return "";
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
exports.getEtherscan = getEtherscan;
|
package/lib/core/constants.d.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { BigNumber } from "ethers";
|
|
2
2
|
export declare const MAX_INT: BigNumber;
|
|
3
|
-
export declare const MAINNET_NETWORK = 1;
|
|
4
|
-
export declare const GOERLI_NETWORK = 5;
|
|
5
|
-
export declare const LOCAL_NETWORK = 1337;
|
|
6
|
-
export declare const HARDHAT_NETWORK = 31337;
|
|
7
|
-
export declare type NetworkType = "Mainnet" | "Goerli";
|
|
8
|
-
export declare const getNetworkType: (chainId: number) => NetworkType;
|
|
9
3
|
export declare const RAY_DECIMALS_POW = 27;
|
|
10
4
|
export declare const RAY: BigNumber;
|
|
11
5
|
export declare const halfRAY: BigNumber;
|
package/lib/core/constants.js
CHANGED
|
@@ -1,24 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DUMB_ADDRESS4 = exports.DUMB_ADDRESS3 = exports.DUMB_ADDRESS2 = exports.DUMB_ADDRESS = exports.ADDRESS_0X0 = exports.SLIPPAGE_DECIMALS = exports.LEVERAGE_DECIMALS = exports.timeRanges = exports.PERCENTAGE_FACTOR = exports.PERCENTAGE_DECIMALS = exports.SECONDS_PER_YEAR = exports.PRICE_DECIMALS = exports.PRICE_DECIMALS_POW = exports.WAD = exports.WAD_DECIMALS_POW = exports.halfRAY = exports.RAY = exports.RAY_DECIMALS_POW = exports.
|
|
3
|
+
exports.DUMB_ADDRESS4 = exports.DUMB_ADDRESS3 = exports.DUMB_ADDRESS2 = exports.DUMB_ADDRESS = exports.ADDRESS_0X0 = exports.SLIPPAGE_DECIMALS = exports.LEVERAGE_DECIMALS = exports.timeRanges = exports.PERCENTAGE_FACTOR = exports.PERCENTAGE_DECIMALS = exports.SECONDS_PER_YEAR = exports.PRICE_DECIMALS = exports.PRICE_DECIMALS_POW = exports.WAD = exports.WAD_DECIMALS_POW = exports.halfRAY = exports.RAY = exports.RAY_DECIMALS_POW = exports.MAX_INT = void 0;
|
|
4
4
|
var ethers_1 = require("ethers");
|
|
5
5
|
exports.MAX_INT = ethers_1.BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
|
6
|
-
exports.MAINNET_NETWORK = 1;
|
|
7
|
-
exports.GOERLI_NETWORK = 5;
|
|
8
|
-
exports.LOCAL_NETWORK = 1337;
|
|
9
|
-
exports.HARDHAT_NETWORK = 31337;
|
|
10
|
-
var getNetworkType = function (chainId) {
|
|
11
|
-
switch (chainId) {
|
|
12
|
-
case exports.MAINNET_NETWORK:
|
|
13
|
-
case exports.LOCAL_NETWORK:
|
|
14
|
-
return "Mainnet";
|
|
15
|
-
case exports.GOERLI_NETWORK:
|
|
16
|
-
return "Goerli";
|
|
17
|
-
default:
|
|
18
|
-
throw new Error("unknown network");
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
exports.getNetworkType = getNetworkType;
|
|
22
6
|
exports.RAY_DECIMALS_POW = 27;
|
|
23
7
|
exports.RAY = ethers_1.BigNumber.from(10).pow(exports.RAY_DECIMALS_POW);
|
|
24
8
|
exports.halfRAY = exports.RAY.div(2);
|
|
@@ -2,7 +2,7 @@ import { BigNumber, providers } from "ethers";
|
|
|
2
2
|
import { SupportedContract } from "../contracts/contracts";
|
|
3
3
|
import { MultiCall } from "../pathfinder/core";
|
|
4
4
|
import { SupportedToken } from "../tokens/token";
|
|
5
|
-
import { NetworkType } from "./
|
|
5
|
+
import { NetworkType } from "./chains";
|
|
6
6
|
import { CreditAccountData } from "./creditAccount";
|
|
7
7
|
import { CreditManagerData } from "./creditManager";
|
|
8
8
|
export interface Rewards {
|
|
@@ -3,7 +3,7 @@ import { SupportedContract } from "../contracts/contracts";
|
|
|
3
3
|
import { SupportedToken } from "../tokens/token";
|
|
4
4
|
import { IConvexV1BaseRewardPoolAdapterInterface } from "../types/@gearbox-protocol/integrations-v2/contracts/interfaces/convex/IConvexV1BaseRewardPoolAdapter.sol/IConvexV1BaseRewardPoolAdapter";
|
|
5
5
|
import { MCall } from "../utils/multicall";
|
|
6
|
-
import { NetworkType } from "./
|
|
6
|
+
import { NetworkType } from "./chains";
|
|
7
7
|
import { CreditAccountData } from "./creditAccount";
|
|
8
8
|
import { CreditManagerData } from "./creditManager";
|
|
9
9
|
import { AdapterWithType, Rewards } from "./rewardClaimer";
|
package/lib/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from "./contracts/contracts";
|
|
|
2
2
|
export * from "./contracts/protocols";
|
|
3
3
|
export * from "./core/adapter";
|
|
4
4
|
export * from "./core/assets";
|
|
5
|
+
export * from "./core/chains";
|
|
5
6
|
export * from "./core/constants";
|
|
6
7
|
export * from "./core/creditAccount";
|
|
7
8
|
export * from "./core/creditManager";
|
|
@@ -58,7 +59,6 @@ export * from "./utils/errors";
|
|
|
58
59
|
export { getPoolTokens, getUnderlyingToken } from "./utils/extracter";
|
|
59
60
|
export { keyToLowercase, objectEntries, swapKeyValue } from "./utils/mappers";
|
|
60
61
|
export * from "./utils/multicall";
|
|
61
|
-
export * from "./utils/network";
|
|
62
62
|
export * from "./utils/price";
|
|
63
63
|
export { callRepeater } from "./utils/repeater";
|
|
64
64
|
export * from "./utils/types";
|
package/lib/index.js
CHANGED
|
@@ -19,6 +19,7 @@ __exportStar(require("./contracts/contracts"), exports);
|
|
|
19
19
|
__exportStar(require("./contracts/protocols"), exports);
|
|
20
20
|
__exportStar(require("./core/adapter"), exports);
|
|
21
21
|
__exportStar(require("./core/assets"), exports);
|
|
22
|
+
__exportStar(require("./core/chains"), exports);
|
|
22
23
|
__exportStar(require("./core/constants"), exports);
|
|
23
24
|
__exportStar(require("./core/creditAccount"), exports);
|
|
24
25
|
__exportStar(require("./core/creditManager"), exports);
|
|
@@ -83,7 +84,6 @@ Object.defineProperty(exports, "keyToLowercase", { enumerable: true, get: functi
|
|
|
83
84
|
Object.defineProperty(exports, "objectEntries", { enumerable: true, get: function () { return mappers_1.objectEntries; } });
|
|
84
85
|
Object.defineProperty(exports, "swapKeyValue", { enumerable: true, get: function () { return mappers_1.swapKeyValue; } });
|
|
85
86
|
__exportStar(require("./utils/multicall"), exports);
|
|
86
|
-
__exportStar(require("./utils/network"), exports);
|
|
87
87
|
__exportStar(require("./utils/price"), exports);
|
|
88
88
|
var repeater_1 = require("./utils/repeater");
|
|
89
89
|
Object.defineProperty(exports, "callRepeater", { enumerable: true, get: function () { return repeater_1.callRepeater; } });
|
package/lib/oracles/oracles.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SupportedContract } from "../contracts/contracts";
|
|
2
|
-
import { NetworkType } from "../core/
|
|
2
|
+
import { NetworkType } from "../core/chains";
|
|
3
3
|
import { SupportedToken } from "../tokens/token";
|
|
4
4
|
import { MultiCallStruct } from "../types/@gearbox-protocol/router/contracts/interfaces/IClosePathResolver";
|
|
5
5
|
import { AbstractParser } from "./abstractParser";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Provider } from "@ethersproject/abstract-provider";
|
|
2
2
|
import { BigNumberish, Signer } from "ethers";
|
|
3
|
-
import { NetworkType } from "../core/
|
|
3
|
+
import { NetworkType } from "../core/chains";
|
|
4
4
|
import { CreditAccountData } from "../core/creditAccount";
|
|
5
5
|
import { CreditManagerData } from "../core/creditManager";
|
|
6
6
|
import { SupportedToken } from "../tokens/token";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BigNumberish } from "ethers";
|
|
2
2
|
import { ConvexPoolContract } from "../contracts/contracts";
|
|
3
|
-
import { NetworkType } from "../core/
|
|
3
|
+
import { NetworkType } from "../core/chains";
|
|
4
4
|
import { CreditManagerData } from "../core/creditManager";
|
|
5
5
|
import { MultiCallStruct } from "../types/@gearbox-protocol/router/contracts/interfaces/IClosePathResolver";
|
|
6
6
|
export declare class ConvexBoosterCalls {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BigNumberish } from "ethers";
|
|
2
2
|
import { CurvePoolContract } from "../contracts/contracts";
|
|
3
|
-
import { NetworkType } from "../core/
|
|
3
|
+
import { NetworkType } from "../core/chains";
|
|
4
4
|
import { CreditManagerData } from "../core/creditManager";
|
|
5
5
|
import { MultiCallStruct } from "../types/@gearbox-protocol/router/contracts/interfaces/IClosePathResolver";
|
|
6
6
|
export declare class CurveCalls {
|
package/lib/strategies/lido.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BigNumberish } from "ethers";
|
|
2
|
-
import { NetworkType } from "../core/
|
|
2
|
+
import { NetworkType } from "../core/chains";
|
|
3
3
|
import { CreditManagerData } from "../core/creditManager";
|
|
4
4
|
import { MultiCallStruct } from "../types/@gearbox-protocol/router/contracts/interfaces/IClosePathResolver";
|
|
5
5
|
export declare class LidoCalls {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BigNumberish } from "ethers";
|
|
2
2
|
import { YearnVaultContract } from "../contracts/contracts";
|
|
3
|
-
import { NetworkType } from "../core/
|
|
3
|
+
import { NetworkType } from "../core/chains";
|
|
4
4
|
import { CreditManagerData } from "../core/creditManager";
|
|
5
5
|
import { MultiCallStruct } from "../types/@gearbox-protocol/router/contracts/interfaces/IClosePathResolver";
|
|
6
6
|
export declare class YearnV2Calls {
|
package/lib/tokens/token.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NetworkType } from "../core/
|
|
1
|
+
import { NetworkType } from "../core/chains";
|
|
2
2
|
import { ConvexLPToken, ConvexLPTokenData, ConvexPhantomTokenData, ConvexStakedPhantomToken } from "./convex";
|
|
3
3
|
import { CurveLPToken, CurveLPTokenData, MetaCurveLPTokenData } from "./curveLP";
|
|
4
4
|
import { DieselTokenData, DieselTokenTypes, GearboxToken, GearboxTokenData } from "./gear";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BigNumber } from "ethers";
|
|
2
|
-
import { NetworkType } from "../core/
|
|
2
|
+
import { NetworkType } from "../core/chains";
|
|
3
3
|
import { TokenDataPayload } from "../payload/token";
|
|
4
4
|
import { SupportedToken } from "./token";
|
|
5
5
|
declare type SymbolReplacements = Record<string, string>;
|
package/package.json
CHANGED
package/lib/utils/network.d.ts
DELETED