@defisaver/positions-sdk 2.1.8 → 2.1.9
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/.mocharc.json +4 -4
- package/.nvmrc +1 -1
- package/CLAUDE.md +32 -0
- package/README.md +64 -64
- package/cjs/fluid/index.js +40 -12
- package/cjs/helpers/morphoBlueHelpers/index.js +66 -66
- package/cjs/markets/fluid/index.d.ts +4 -0
- package/cjs/markets/fluid/index.js +4 -0
- package/cjs/types/fluid.d.ts +7 -3
- package/cjs/types/fluid.js +4 -0
- package/esm/fluid/index.js +40 -12
- package/esm/helpers/morphoBlueHelpers/index.js +66 -66
- package/esm/markets/fluid/index.d.ts +4 -0
- package/esm/markets/fluid/index.js +4 -0
- package/esm/types/fluid.d.ts +7 -3
- package/esm/types/fluid.js +4 -0
- package/package.json +47 -47
- package/src/aaveV2/index.ts +240 -240
- package/src/aaveV3/index.ts +614 -614
- package/src/aaveV3/merit.ts +97 -97
- package/src/aaveV3/merkl.ts +74 -74
- package/src/claiming/aaveV3.ts +154 -154
- package/src/claiming/compV3.ts +22 -22
- package/src/claiming/index.ts +12 -12
- package/src/claiming/king.ts +66 -66
- package/src/claiming/morphoBlue.ts +118 -118
- package/src/claiming/spark.ts +225 -225
- package/src/compoundV2/index.ts +244 -244
- package/src/compoundV3/index.ts +274 -274
- package/src/config/contracts.ts +1251 -1251
- package/src/constants/index.ts +10 -10
- package/src/contracts.ts +120 -120
- package/src/curveUsd/index.ts +254 -254
- package/src/eulerV2/index.ts +324 -324
- package/src/exchange/index.ts +25 -25
- package/src/fluid/index.ts +1668 -1638
- package/src/helpers/aaveHelpers/index.ts +187 -187
- package/src/helpers/compoundHelpers/index.ts +283 -283
- package/src/helpers/curveUsdHelpers/index.ts +40 -40
- package/src/helpers/eulerHelpers/index.ts +222 -222
- package/src/helpers/fluidHelpers/index.ts +326 -326
- package/src/helpers/index.ts +10 -10
- package/src/helpers/liquityV2Helpers/index.ts +82 -82
- package/src/helpers/llamaLendHelpers/index.ts +53 -53
- package/src/helpers/makerHelpers/index.ts +52 -52
- package/src/helpers/morphoBlueHelpers/index.ts +396 -396
- package/src/helpers/sparkHelpers/index.ts +155 -155
- package/src/index.ts +47 -47
- package/src/liquity/index.ts +159 -159
- package/src/liquityV2/index.ts +657 -657
- package/src/llamaLend/index.ts +305 -305
- package/src/maker/index.ts +223 -223
- package/src/markets/aave/index.ts +116 -116
- package/src/markets/aave/marketAssets.ts +54 -54
- package/src/markets/compound/index.ts +238 -238
- package/src/markets/compound/marketsAssets.ts +97 -97
- package/src/markets/curveUsd/index.ts +69 -69
- package/src/markets/euler/index.ts +26 -26
- package/src/markets/fluid/index.ts +2460 -2456
- package/src/markets/index.ts +25 -25
- package/src/markets/liquityV2/index.ts +102 -102
- package/src/markets/llamaLend/contractAddresses.ts +141 -141
- package/src/markets/llamaLend/index.ts +235 -235
- package/src/markets/morphoBlue/index.ts +895 -895
- package/src/markets/spark/index.ts +29 -29
- package/src/markets/spark/marketAssets.ts +12 -12
- package/src/moneymarket/moneymarketCommonService.ts +80 -80
- package/src/morphoBlue/index.ts +274 -274
- package/src/portfolio/index.ts +570 -570
- package/src/services/priceService.ts +159 -159
- package/src/services/utils.ts +115 -115
- package/src/services/viem.ts +34 -34
- package/src/setup.ts +8 -8
- package/src/spark/index.ts +445 -445
- package/src/staking/eligibility.ts +53 -53
- package/src/staking/index.ts +1 -1
- package/src/staking/staking.ts +170 -170
- package/src/types/aave.ts +189 -189
- package/src/types/claiming.ts +109 -109
- package/src/types/common.ts +107 -107
- package/src/types/compound.ts +136 -136
- package/src/types/curveUsd.ts +123 -123
- package/src/types/euler.ts +175 -175
- package/src/types/fluid.ts +452 -448
- package/src/types/index.ts +13 -13
- package/src/types/liquity.ts +30 -30
- package/src/types/liquityV2.ts +126 -126
- package/src/types/llamaLend.ts +159 -159
- package/src/types/maker.ts +63 -63
- package/src/types/merit.ts +1 -1
- package/src/types/merkl.ts +70 -70
- package/src/types/morphoBlue.ts +194 -194
- package/src/types/portfolio.ts +60 -60
- package/src/types/spark.ts +135 -135
- package/src/umbrella/index.ts +69 -69
- package/src/umbrella/umbrellaUtils.ts +29 -29
|
@@ -118,73 +118,73 @@ export const getApyAfterValuesEstimation = (selectedMarket, actions, provider, n
|
|
|
118
118
|
return { borrowRate, supplyRate };
|
|
119
119
|
});
|
|
120
120
|
const API_URL = 'https://blue-api.morpho.org/graphql';
|
|
121
|
-
const MARKET_QUERY = `
|
|
122
|
-
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
123
|
-
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
124
|
-
reallocatableLiquidityAssets
|
|
125
|
-
targetBorrowUtilization
|
|
126
|
-
loanAsset {
|
|
127
|
-
address
|
|
128
|
-
decimals
|
|
129
|
-
priceUsd
|
|
130
|
-
}
|
|
131
|
-
state {
|
|
132
|
-
liquidityAssets
|
|
133
|
-
borrowAssets
|
|
134
|
-
supplyAssets
|
|
135
|
-
}
|
|
136
|
-
publicAllocatorSharedLiquidity {
|
|
137
|
-
assets
|
|
138
|
-
vault {
|
|
139
|
-
address
|
|
140
|
-
name
|
|
141
|
-
}
|
|
142
|
-
allocationMarket {
|
|
143
|
-
uniqueKey
|
|
144
|
-
loanAsset {
|
|
145
|
-
address
|
|
146
|
-
}
|
|
147
|
-
collateralAsset {
|
|
148
|
-
address
|
|
149
|
-
}
|
|
150
|
-
irmAddress
|
|
151
|
-
oracle {
|
|
152
|
-
address
|
|
153
|
-
}
|
|
154
|
-
lltv
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
loanAsset {
|
|
158
|
-
address
|
|
159
|
-
}
|
|
160
|
-
collateralAsset {
|
|
161
|
-
address
|
|
162
|
-
}
|
|
163
|
-
oracle {
|
|
164
|
-
address
|
|
165
|
-
}
|
|
166
|
-
irmAddress
|
|
167
|
-
lltv
|
|
168
|
-
}
|
|
169
|
-
}
|
|
121
|
+
const MARKET_QUERY = `
|
|
122
|
+
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
123
|
+
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
124
|
+
reallocatableLiquidityAssets
|
|
125
|
+
targetBorrowUtilization
|
|
126
|
+
loanAsset {
|
|
127
|
+
address
|
|
128
|
+
decimals
|
|
129
|
+
priceUsd
|
|
130
|
+
}
|
|
131
|
+
state {
|
|
132
|
+
liquidityAssets
|
|
133
|
+
borrowAssets
|
|
134
|
+
supplyAssets
|
|
135
|
+
}
|
|
136
|
+
publicAllocatorSharedLiquidity {
|
|
137
|
+
assets
|
|
138
|
+
vault {
|
|
139
|
+
address
|
|
140
|
+
name
|
|
141
|
+
}
|
|
142
|
+
allocationMarket {
|
|
143
|
+
uniqueKey
|
|
144
|
+
loanAsset {
|
|
145
|
+
address
|
|
146
|
+
}
|
|
147
|
+
collateralAsset {
|
|
148
|
+
address
|
|
149
|
+
}
|
|
150
|
+
irmAddress
|
|
151
|
+
oracle {
|
|
152
|
+
address
|
|
153
|
+
}
|
|
154
|
+
lltv
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
loanAsset {
|
|
158
|
+
address
|
|
159
|
+
}
|
|
160
|
+
collateralAsset {
|
|
161
|
+
address
|
|
162
|
+
}
|
|
163
|
+
oracle {
|
|
164
|
+
address
|
|
165
|
+
}
|
|
166
|
+
irmAddress
|
|
167
|
+
lltv
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
170
|
`;
|
|
171
|
-
const REWARDS_QUERY = `
|
|
172
|
-
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
173
|
-
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
174
|
-
uniqueKey
|
|
175
|
-
state {
|
|
176
|
-
rewards {
|
|
177
|
-
amountPerSuppliedToken
|
|
178
|
-
supplyApr
|
|
179
|
-
amountPerBorrowedToken
|
|
180
|
-
borrowApr
|
|
181
|
-
asset {
|
|
182
|
-
address
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
171
|
+
const REWARDS_QUERY = `
|
|
172
|
+
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
173
|
+
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
174
|
+
uniqueKey
|
|
175
|
+
state {
|
|
176
|
+
rewards {
|
|
177
|
+
amountPerSuppliedToken
|
|
178
|
+
supplyApr
|
|
179
|
+
amountPerBorrowedToken
|
|
180
|
+
borrowApr
|
|
181
|
+
asset {
|
|
182
|
+
address
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
188
|
`;
|
|
189
189
|
/**
|
|
190
190
|
* Get reallocatable liquidity to a given market and target borrow utilization
|
|
@@ -244,17 +244,21 @@ export declare const FluidFTokens: (networkId: NetworkNumber) => {
|
|
|
244
244
|
wstETH: string;
|
|
245
245
|
GHO: string;
|
|
246
246
|
sUSDS: string;
|
|
247
|
+
USDtb: string;
|
|
247
248
|
} | {
|
|
248
249
|
ETH: string;
|
|
249
250
|
USDC: string;
|
|
250
251
|
USDT: string;
|
|
251
252
|
wstETH: string;
|
|
252
253
|
ARB: string;
|
|
254
|
+
GHO: string;
|
|
255
|
+
sUSDS: string;
|
|
253
256
|
} | {
|
|
254
257
|
ETH: string;
|
|
255
258
|
USDC: string;
|
|
256
259
|
EURC: string;
|
|
257
260
|
wstETH: string;
|
|
258
261
|
sUSDS: string;
|
|
262
|
+
GHO: string;
|
|
259
263
|
};
|
|
260
264
|
export declare const getFTokenAddress: (token: string, networkId: NetworkNumber) => any;
|
|
@@ -2290,6 +2290,7 @@ const FluidMainnetFTokenAddresses = {
|
|
|
2290
2290
|
[FluidMainnetDepositToken.wstETH]: '0x2411802D8BEA09be0aF8fD8D08314a63e706b29C',
|
|
2291
2291
|
[FluidMainnetDepositToken.GHO]: '0x6A29A46E21C730DcA1d8b23d637c101cec605C5B',
|
|
2292
2292
|
[FluidMainnetDepositToken.sUSDS]: '0x2BBE31d63E6813E3AC858C04dae43FB2a72B0D11',
|
|
2293
|
+
[FluidMainnetDepositToken.USDtb]: '0x15e8c742614b5D8Db4083A41Df1A14F5D2bFB400',
|
|
2293
2294
|
};
|
|
2294
2295
|
const FluidArbitrumFTokenAddresses = {
|
|
2295
2296
|
[FluidArbitrumDepositToken.ETH]: '0x45Df0656F8aDf017590009d2f1898eeca4F0a205',
|
|
@@ -2297,6 +2298,8 @@ const FluidArbitrumFTokenAddresses = {
|
|
|
2297
2298
|
[FluidArbitrumDepositToken.USDT]: '0x4A03F37e7d3fC243e3f99341d36f4b829BEe5E03',
|
|
2298
2299
|
[FluidArbitrumDepositToken.wstETH]: '0x66C25Cd75EBdAA7E04816F643d8E46cecd3183c9',
|
|
2299
2300
|
[FluidArbitrumDepositToken.ARB]: '0xbE3860FD4c3facDf8ad57Aa8c1A36D6dc4390a49',
|
|
2301
|
+
[FluidArbitrumDepositToken.GHO]: '0x037dFf1C12805707d7c29F163E0F09fC9102657A',
|
|
2302
|
+
[FluidArbitrumDepositToken.sUSDS]: '0x3459fcc94390C3372c0F7B4cD3F8795F0E5aFE96',
|
|
2300
2303
|
};
|
|
2301
2304
|
const FluidBaseFTokenAddresses = {
|
|
2302
2305
|
[FluidBaseDepositToken.ETH]: '0x9272D6153133175175Bc276512B2336BE3931CE9',
|
|
@@ -2304,6 +2307,7 @@ const FluidBaseFTokenAddresses = {
|
|
|
2304
2307
|
[FluidBaseDepositToken.EURC]: '0x1943FA26360f038230442525Cf1B9125b5DCB401',
|
|
2305
2308
|
[FluidBaseDepositToken.wstETH]: '0x896E39f0E9af61ECA9dD2938E14543506ef2c2b5',
|
|
2306
2309
|
[FluidBaseDepositToken.sUSDS]: '0xf62e339f21d8018940f188F6987Bcdf02A849619',
|
|
2310
|
+
[FluidBaseDepositToken.GHO]: '0x8DdbfFA3CFda2355a23d6B11105AC624BDbE3631',
|
|
2307
2311
|
};
|
|
2308
2312
|
export const FluidFTokens = (networkId) => {
|
|
2309
2313
|
switch (networkId) {
|
package/esm/types/fluid.d.ts
CHANGED
|
@@ -149,21 +149,25 @@ export declare enum FluidMainnetDepositToken {
|
|
|
149
149
|
USDC = "USDC",
|
|
150
150
|
USDT = "USDT",
|
|
151
151
|
GHO = "GHO",
|
|
152
|
-
sUSDS = "sUSDS"
|
|
152
|
+
sUSDS = "sUSDS",
|
|
153
|
+
USDtb = "USDtb"
|
|
153
154
|
}
|
|
154
155
|
export declare enum FluidArbitrumDepositToken {
|
|
155
156
|
ETH = "ETH",
|
|
156
157
|
wstETH = "wstETH",
|
|
157
158
|
USDC = "USDC",
|
|
158
159
|
USDT = "USDT",
|
|
159
|
-
ARB = "ARB"
|
|
160
|
+
ARB = "ARB",
|
|
161
|
+
GHO = "GHO",
|
|
162
|
+
sUSDS = "sUSDS"
|
|
160
163
|
}
|
|
161
164
|
export declare enum FluidBaseDepositToken {
|
|
162
165
|
ETH = "ETH",
|
|
163
166
|
USDC = "USDC",
|
|
164
167
|
wstETH = "wstETH",
|
|
165
168
|
EURC = "EURC",
|
|
166
|
-
sUSDS = "sUSDS"
|
|
169
|
+
sUSDS = "sUSDS",
|
|
170
|
+
GHO = "GHO"
|
|
167
171
|
}
|
|
168
172
|
export type FluidDepositTokenByNetwork = {
|
|
169
173
|
[NetworkNumber.Eth]: FluidMainnetDepositToken;
|
package/esm/types/fluid.js
CHANGED
|
@@ -133,6 +133,7 @@ export var FluidMainnetDepositToken;
|
|
|
133
133
|
FluidMainnetDepositToken["USDT"] = "USDT";
|
|
134
134
|
FluidMainnetDepositToken["GHO"] = "GHO";
|
|
135
135
|
FluidMainnetDepositToken["sUSDS"] = "sUSDS";
|
|
136
|
+
FluidMainnetDepositToken["USDtb"] = "USDtb";
|
|
136
137
|
})(FluidMainnetDepositToken || (FluidMainnetDepositToken = {}));
|
|
137
138
|
export var FluidArbitrumDepositToken;
|
|
138
139
|
(function (FluidArbitrumDepositToken) {
|
|
@@ -141,6 +142,8 @@ export var FluidArbitrumDepositToken;
|
|
|
141
142
|
FluidArbitrumDepositToken["USDC"] = "USDC";
|
|
142
143
|
FluidArbitrumDepositToken["USDT"] = "USDT";
|
|
143
144
|
FluidArbitrumDepositToken["ARB"] = "ARB";
|
|
145
|
+
FluidArbitrumDepositToken["GHO"] = "GHO";
|
|
146
|
+
FluidArbitrumDepositToken["sUSDS"] = "sUSDS";
|
|
144
147
|
})(FluidArbitrumDepositToken || (FluidArbitrumDepositToken = {}));
|
|
145
148
|
export var FluidBaseDepositToken;
|
|
146
149
|
(function (FluidBaseDepositToken) {
|
|
@@ -149,6 +152,7 @@ export var FluidBaseDepositToken;
|
|
|
149
152
|
FluidBaseDepositToken["wstETH"] = "wstETH";
|
|
150
153
|
FluidBaseDepositToken["EURC"] = "EURC";
|
|
151
154
|
FluidBaseDepositToken["sUSDS"] = "sUSDS";
|
|
155
|
+
FluidBaseDepositToken["GHO"] = "GHO";
|
|
152
156
|
})(FluidBaseDepositToken || (FluidBaseDepositToken = {}));
|
|
153
157
|
export var FluidVaultType;
|
|
154
158
|
(function (FluidVaultType) {
|
package/package.json
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@defisaver/positions-sdk",
|
|
3
|
-
"version": "2.1.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "./cjs/index.js",
|
|
6
|
-
"module": "./esm/index.js",
|
|
7
|
-
"types": "./esm/index.d.ts",
|
|
8
|
-
"scripts": {
|
|
9
|
-
"build:esm": "rm -rf esm && tsc -p tsconfig.esm.json",
|
|
10
|
-
"build:cjs": "rm -rf cjs && tsc -p tsconfig.cjs.json",
|
|
11
|
-
"build": "npm run lint && npm run build:cjs && npm run build:esm",
|
|
12
|
-
"dev": "tsc -p tsconfig.json --watch",
|
|
13
|
-
"lint": "eslint src/ --fix",
|
|
14
|
-
"lint-check": "eslint src/",
|
|
15
|
-
"test": "mocha tests/*",
|
|
16
|
-
"test-single": "mocha ./tests/$npm_config_name.ts",
|
|
17
|
-
"test:debugger": "mocha --inspect-brk tests/*",
|
|
18
|
-
"version-bump": "git commit -am \"Version bump to $(npm version patch | cut -c 2-)\""
|
|
19
|
-
},
|
|
20
|
-
"keywords": [],
|
|
21
|
-
"author": "",
|
|
22
|
-
"license": "ISC",
|
|
23
|
-
"dependencies": {
|
|
24
|
-
"@defisaver/tokens": "^1.7.5",
|
|
25
|
-
"@types/lodash": "^4.17.15",
|
|
26
|
-
"@types/memoizee": "^0.4.12",
|
|
27
|
-
"decimal.js": "^10.6.0",
|
|
28
|
-
"lodash": "^4.17.21",
|
|
29
|
-
"memoizee": "^0.4.17",
|
|
30
|
-
"viem": "^2.37.9"
|
|
31
|
-
},
|
|
32
|
-
"devDependencies": {
|
|
33
|
-
"@defisaver/eslint-config": "^1.0.1",
|
|
34
|
-
"@metamask/eth-json-rpc-middleware": "^15.0.1",
|
|
35
|
-
"@metamask/eth-json-rpc-provider": "^4.1.6",
|
|
36
|
-
"@types/chai": "^5.0.0",
|
|
37
|
-
"@types/mocha": "^10.0.9",
|
|
38
|
-
"chai": "^4.3.8",
|
|
39
|
-
"dotenv": "^16.3.1",
|
|
40
|
-
"eslint": "^8.49.0",
|
|
41
|
-
"eslint-plugin-import": "^2.31.0",
|
|
42
|
-
"mocha": "^10.2.0",
|
|
43
|
-
"nock": "^14.0.0",
|
|
44
|
-
"ts-node": "^10.9.2",
|
|
45
|
-
"typescript": "^5.2.2"
|
|
46
|
-
}
|
|
47
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@defisaver/positions-sdk",
|
|
3
|
+
"version": "2.1.9",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./cjs/index.js",
|
|
6
|
+
"module": "./esm/index.js",
|
|
7
|
+
"types": "./esm/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build:esm": "rm -rf esm && tsc -p tsconfig.esm.json",
|
|
10
|
+
"build:cjs": "rm -rf cjs && tsc -p tsconfig.cjs.json",
|
|
11
|
+
"build": "npm run lint && npm run build:cjs && npm run build:esm",
|
|
12
|
+
"dev": "tsc -p tsconfig.json --watch",
|
|
13
|
+
"lint": "eslint src/ --fix",
|
|
14
|
+
"lint-check": "eslint src/",
|
|
15
|
+
"test": "mocha tests/*",
|
|
16
|
+
"test-single": "mocha ./tests/$npm_config_name.ts",
|
|
17
|
+
"test:debugger": "mocha --inspect-brk tests/*",
|
|
18
|
+
"version-bump": "git commit -am \"Version bump to $(npm version patch | cut -c 2-)\""
|
|
19
|
+
},
|
|
20
|
+
"keywords": [],
|
|
21
|
+
"author": "",
|
|
22
|
+
"license": "ISC",
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@defisaver/tokens": "^1.7.5",
|
|
25
|
+
"@types/lodash": "^4.17.15",
|
|
26
|
+
"@types/memoizee": "^0.4.12",
|
|
27
|
+
"decimal.js": "^10.6.0",
|
|
28
|
+
"lodash": "^4.17.21",
|
|
29
|
+
"memoizee": "^0.4.17",
|
|
30
|
+
"viem": "^2.37.9"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@defisaver/eslint-config": "^1.0.1",
|
|
34
|
+
"@metamask/eth-json-rpc-middleware": "^15.0.1",
|
|
35
|
+
"@metamask/eth-json-rpc-provider": "^4.1.6",
|
|
36
|
+
"@types/chai": "^5.0.0",
|
|
37
|
+
"@types/mocha": "^10.0.9",
|
|
38
|
+
"chai": "^4.3.8",
|
|
39
|
+
"dotenv": "^16.3.1",
|
|
40
|
+
"eslint": "^8.49.0",
|
|
41
|
+
"eslint-plugin-import": "^2.31.0",
|
|
42
|
+
"mocha": "^10.2.0",
|
|
43
|
+
"nock": "^14.0.0",
|
|
44
|
+
"ts-node": "^10.9.2",
|
|
45
|
+
"typescript": "^5.2.2"
|
|
46
|
+
}
|
|
47
|
+
}
|