@gearbox-protocol/sdk 7.4.0-next.1 → 7.4.0
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/dist/cjs/sdk/sdk-legacy/core/creditAccount.js +5 -4
- package/dist/cjs/sdk/sdk-legacy/core/creditManager.js +0 -4
- package/dist/cjs/sdk/sdk-legacy/core/pool.js +11 -4
- package/dist/cjs/sdk/sdk-legacy/gearboxRewards/extraAPY.js +4 -5
- package/dist/cjs/sdk/utils/viem/getLogsPaginated.js +54 -0
- package/dist/cjs/sdk/utils/viem/index.js +2 -0
- package/dist/esm/sdk/sdk-legacy/core/creditAccount.js +5 -4
- package/dist/esm/sdk/sdk-legacy/core/creditManager.js +0 -4
- package/dist/esm/sdk/sdk-legacy/core/pool.js +11 -4
- package/dist/esm/sdk/sdk-legacy/gearboxRewards/extraAPY.js +4 -5
- package/dist/esm/sdk/utils/viem/getLogsPaginated.js +30 -0
- package/dist/esm/sdk/utils/viem/index.js +1 -0
- package/dist/types/sdk/sdk-legacy/core/creditAccount.d.ts +3 -4
- package/dist/types/sdk/sdk-legacy/core/creditManager.d.ts +0 -3
- package/dist/types/sdk/sdk-legacy/core/pool.d.ts +4 -3
- package/dist/types/sdk/sdk-legacy/payload/creditAccount.d.ts +0 -3
- package/dist/types/sdk/sdk-legacy/payload/creditManager.d.ts +0 -3
- package/dist/types/sdk/sdk-legacy/payload/pool.d.ts +0 -3
- package/dist/types/sdk/utils/viem/getLogsPaginated.d.ts +13 -0
- package/dist/types/sdk/utils/viem/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -28,8 +28,6 @@ var import_price = require("../utils/price.js");
|
|
|
28
28
|
const MAX_UINT16 = 65535;
|
|
29
29
|
class CreditAccountData_Legacy {
|
|
30
30
|
isSuccessful;
|
|
31
|
-
chainId;
|
|
32
|
-
network;
|
|
33
31
|
creditAccount;
|
|
34
32
|
borrower;
|
|
35
33
|
creditManager;
|
|
@@ -40,6 +38,7 @@ class CreditAccountData_Legacy {
|
|
|
40
38
|
version;
|
|
41
39
|
enabledTokensMask;
|
|
42
40
|
healthFactor;
|
|
41
|
+
isDeleting;
|
|
43
42
|
baseBorrowRateWithoutFee;
|
|
44
43
|
borrowedAmount;
|
|
45
44
|
accruedInterest;
|
|
@@ -57,8 +56,6 @@ class CreditAccountData_Legacy {
|
|
|
57
56
|
quotedTokens = {};
|
|
58
57
|
constructor(payload) {
|
|
59
58
|
this.isSuccessful = payload.isSuccessful;
|
|
60
|
-
this.chainId = payload.chainId;
|
|
61
|
-
this.network = payload.network;
|
|
62
59
|
this.creditAccount = payload.addr.toLowerCase();
|
|
63
60
|
this.borrower = payload.borrower.toLowerCase();
|
|
64
61
|
this.creditManager = payload.creditManager.toLowerCase();
|
|
@@ -71,6 +68,7 @@ class CreditAccountData_Legacy {
|
|
|
71
68
|
(payload.healthFactor || 0n) * import_constants.PERCENTAGE_FACTOR / import_constants.WAD
|
|
72
69
|
);
|
|
73
70
|
this.enabledTokensMask = payload.enabledTokensMask;
|
|
71
|
+
this.isDeleting = false;
|
|
74
72
|
this.borrowedAmount = payload.debt;
|
|
75
73
|
this.accruedInterest = payload.accruedInterest || 0n;
|
|
76
74
|
this.accruedFees = payload.accruedFees || 0n;
|
|
@@ -109,6 +107,9 @@ class CreditAccountData_Legacy {
|
|
|
109
107
|
this.tokens[token] = balance;
|
|
110
108
|
});
|
|
111
109
|
}
|
|
110
|
+
setDeleteInProgress(d) {
|
|
111
|
+
this.isDeleting = d;
|
|
112
|
+
}
|
|
112
113
|
static sortBalances(balances, prices, tokens) {
|
|
113
114
|
return Object.entries(balances).sort(
|
|
114
115
|
([addr1, amount1], [addr2, amount2]) => {
|
|
@@ -26,8 +26,6 @@ var import_constants = require("../../constants/index.js");
|
|
|
26
26
|
var import_utils = require("../../utils/index.js");
|
|
27
27
|
class CreditManagerData_Legacy {
|
|
28
28
|
address;
|
|
29
|
-
chainId;
|
|
30
|
-
network;
|
|
31
29
|
underlyingToken;
|
|
32
30
|
pool;
|
|
33
31
|
creditFacade;
|
|
@@ -69,8 +67,6 @@ class CreditManagerData_Legacy {
|
|
|
69
67
|
quotas;
|
|
70
68
|
constructor(payload) {
|
|
71
69
|
this.address = payload.addr.toLowerCase();
|
|
72
|
-
this.chainId = payload.chainId;
|
|
73
|
-
this.network = payload.network;
|
|
74
70
|
this.underlyingToken = payload.underlying.toLowerCase();
|
|
75
71
|
this.name = payload.name;
|
|
76
72
|
this.pool = payload.pool.toLowerCase();
|
|
@@ -30,8 +30,7 @@ var import_utils = require("../../utils/index.js");
|
|
|
30
30
|
var import_formatter = require("../utils/formatter.js");
|
|
31
31
|
class PoolData_Legacy {
|
|
32
32
|
address;
|
|
33
|
-
|
|
34
|
-
network;
|
|
33
|
+
type;
|
|
35
34
|
underlyingToken;
|
|
36
35
|
dieselToken;
|
|
37
36
|
stakedDieselToken;
|
|
@@ -63,8 +62,7 @@ class PoolData_Legacy {
|
|
|
63
62
|
lastBaseInterestUpdate;
|
|
64
63
|
constructor(payload, extra) {
|
|
65
64
|
this.address = payload.addr.toLowerCase();
|
|
66
|
-
this.
|
|
67
|
-
this.network = payload.network;
|
|
65
|
+
this.type = PoolData_Legacy.getPoolType(payload.name || "");
|
|
68
66
|
this.underlyingToken = payload.underlying.toLowerCase();
|
|
69
67
|
this.dieselToken = payload.dieselToken.toLowerCase();
|
|
70
68
|
this.stakedDieselToken = (extra.stakedDieselToken || []).map(
|
|
@@ -153,6 +151,13 @@ class PoolData_Legacy {
|
|
|
153
151
|
});
|
|
154
152
|
return model.read.calcBorrowRate([expectedLiquidity, availableLiquidity]);
|
|
155
153
|
}
|
|
154
|
+
static getPoolType(name) {
|
|
155
|
+
const [identity = ""] = name.split(" ") || [];
|
|
156
|
+
const lc = identity.toLowerCase();
|
|
157
|
+
if (lc === "farm") return "farm";
|
|
158
|
+
if (lc === "trade") return "trade";
|
|
159
|
+
return "universal";
|
|
160
|
+
}
|
|
156
161
|
static calculateUtilization(expected, available) {
|
|
157
162
|
if (expected === 0n) return 0;
|
|
158
163
|
const borrowed = expected - available;
|
|
@@ -164,6 +169,7 @@ class ChartsPoolData {
|
|
|
164
169
|
address;
|
|
165
170
|
underlyingToken;
|
|
166
171
|
dieselToken;
|
|
172
|
+
type;
|
|
167
173
|
version;
|
|
168
174
|
name;
|
|
169
175
|
addLiqCount;
|
|
@@ -216,6 +222,7 @@ class ChartsPoolData {
|
|
|
216
222
|
this.address = (payload.addr || "").toLowerCase();
|
|
217
223
|
this.underlyingToken = (payload.underlyingToken || "").toLowerCase();
|
|
218
224
|
this.dieselToken = (payload.dieselToken || "").toLowerCase();
|
|
225
|
+
this.type = PoolData_Legacy.getPoolType(payload.name || "");
|
|
219
226
|
this.version = payload.version || 1;
|
|
220
227
|
this.name = payload.name || "";
|
|
221
228
|
this.earned7D = payload.earned7D || 0;
|
|
@@ -86,7 +86,7 @@ class GearboxRewardsExtraApy {
|
|
|
86
86
|
pointsInfo2
|
|
87
87
|
);
|
|
88
88
|
if (points !== null) {
|
|
89
|
-
acc2.push({ balance: points, token:
|
|
89
|
+
acc2.push({ balance: points, token: tokenBalance.token });
|
|
90
90
|
}
|
|
91
91
|
return acc2;
|
|
92
92
|
},
|
|
@@ -98,15 +98,14 @@ class GearboxRewardsExtraApy {
|
|
|
98
98
|
return r;
|
|
99
99
|
}
|
|
100
100
|
static getPoolTokenPoints(tokenBalanceInPool, pool, tokensList, pointsInfo) {
|
|
101
|
-
if (!tokenBalanceInPool
|
|
102
|
-
return null;
|
|
101
|
+
if (!tokenBalanceInPool) return null;
|
|
103
102
|
if (pool.expectedLiquidity <= 0) return 0n;
|
|
104
|
-
const { decimals = 18 } = tokensList[
|
|
103
|
+
const { decimals = 18 } = tokensList[tokenBalanceInPool.token] || {};
|
|
105
104
|
const targetFactor = 10n ** BigInt(decimals);
|
|
106
105
|
const { decimals: underlyingDecimals = 18 } = tokensList[pool.underlyingToken] || {};
|
|
107
106
|
const underlyingFactor = 10n ** BigInt(underlyingDecimals);
|
|
108
107
|
const defaultPoints = pointsInfo.amount * targetFactor / import_constants.PERCENTAGE_FACTOR;
|
|
109
|
-
const points = pointsInfo.estimation === "absolute" ? defaultPoints :
|
|
108
|
+
const points = pointsInfo.estimation === "absolute" ? defaultPoints : tokenBalanceInPool.balance * defaultPoints / (pool.expectedLiquidity * targetFactor / underlyingFactor);
|
|
110
109
|
return import_math.BigIntMath.min(points, defaultPoints);
|
|
111
110
|
}
|
|
112
111
|
static getPoolPointsTip(poolRewards, pool, token) {
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var getLogsPaginated_exports = {};
|
|
20
|
+
__export(getLogsPaginated_exports, {
|
|
21
|
+
getLogsPaginated: () => getLogsPaginated
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(getLogsPaginated_exports);
|
|
24
|
+
var import_actions = require("viem/actions");
|
|
25
|
+
async function getLogsPaginated(client, params) {
|
|
26
|
+
const from_ = params.fromBlock;
|
|
27
|
+
const to_ = params.toBlock;
|
|
28
|
+
const pageSize = params.pageSize;
|
|
29
|
+
const requests = [];
|
|
30
|
+
for (let fromBlock = from_; fromBlock < to_; fromBlock += pageSize) {
|
|
31
|
+
let toBlock = fromBlock + pageSize - 1n;
|
|
32
|
+
if (toBlock > to_) {
|
|
33
|
+
toBlock = to_;
|
|
34
|
+
}
|
|
35
|
+
requests.push({
|
|
36
|
+
...params,
|
|
37
|
+
fromBlock,
|
|
38
|
+
toBlock
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
const responses = await Promise.all(
|
|
42
|
+
requests.map(
|
|
43
|
+
(r) => (0, import_actions.getLogs)(
|
|
44
|
+
client,
|
|
45
|
+
r
|
|
46
|
+
)
|
|
47
|
+
)
|
|
48
|
+
);
|
|
49
|
+
return responses.flat();
|
|
50
|
+
}
|
|
51
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
+
0 && (module.exports = {
|
|
53
|
+
getLogsPaginated
|
|
54
|
+
});
|
|
@@ -16,6 +16,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
16
16
|
var viem_exports = {};
|
|
17
17
|
module.exports = __toCommonJS(viem_exports);
|
|
18
18
|
__reExport(viem_exports, require("./cast.js"), module.exports);
|
|
19
|
+
__reExport(viem_exports, require("./getLogsPaginated.js"), module.exports);
|
|
19
20
|
__reExport(viem_exports, require("./getLogsSafe.js"), module.exports);
|
|
20
21
|
__reExport(viem_exports, require("./sendRawTx.js"), module.exports);
|
|
21
22
|
__reExport(viem_exports, require("./simulateMulticall.js"), module.exports);
|
|
@@ -23,6 +24,7 @@ __reExport(viem_exports, require("./simulateWithPriceUpdates.js"), module.export
|
|
|
23
24
|
// Annotate the CommonJS export names for ESM import in node:
|
|
24
25
|
0 && (module.exports = {
|
|
25
26
|
...require("./cast.js"),
|
|
27
|
+
...require("./getLogsPaginated.js"),
|
|
26
28
|
...require("./getLogsSafe.js"),
|
|
27
29
|
...require("./sendRawTx.js"),
|
|
28
30
|
...require("./simulateMulticall.js"),
|
|
@@ -14,8 +14,6 @@ import { PriceUtils } from "../utils/price.js";
|
|
|
14
14
|
const MAX_UINT16 = 65535;
|
|
15
15
|
class CreditAccountData_Legacy {
|
|
16
16
|
isSuccessful;
|
|
17
|
-
chainId;
|
|
18
|
-
network;
|
|
19
17
|
creditAccount;
|
|
20
18
|
borrower;
|
|
21
19
|
creditManager;
|
|
@@ -26,6 +24,7 @@ class CreditAccountData_Legacy {
|
|
|
26
24
|
version;
|
|
27
25
|
enabledTokensMask;
|
|
28
26
|
healthFactor;
|
|
27
|
+
isDeleting;
|
|
29
28
|
baseBorrowRateWithoutFee;
|
|
30
29
|
borrowedAmount;
|
|
31
30
|
accruedInterest;
|
|
@@ -43,8 +42,6 @@ class CreditAccountData_Legacy {
|
|
|
43
42
|
quotedTokens = {};
|
|
44
43
|
constructor(payload) {
|
|
45
44
|
this.isSuccessful = payload.isSuccessful;
|
|
46
|
-
this.chainId = payload.chainId;
|
|
47
|
-
this.network = payload.network;
|
|
48
45
|
this.creditAccount = payload.addr.toLowerCase();
|
|
49
46
|
this.borrower = payload.borrower.toLowerCase();
|
|
50
47
|
this.creditManager = payload.creditManager.toLowerCase();
|
|
@@ -57,6 +54,7 @@ class CreditAccountData_Legacy {
|
|
|
57
54
|
(payload.healthFactor || 0n) * PERCENTAGE_FACTOR / WAD
|
|
58
55
|
);
|
|
59
56
|
this.enabledTokensMask = payload.enabledTokensMask;
|
|
57
|
+
this.isDeleting = false;
|
|
60
58
|
this.borrowedAmount = payload.debt;
|
|
61
59
|
this.accruedInterest = payload.accruedInterest || 0n;
|
|
62
60
|
this.accruedFees = payload.accruedFees || 0n;
|
|
@@ -95,6 +93,9 @@ class CreditAccountData_Legacy {
|
|
|
95
93
|
this.tokens[token] = balance;
|
|
96
94
|
});
|
|
97
95
|
}
|
|
96
|
+
setDeleteInProgress(d) {
|
|
97
|
+
this.isDeleting = d;
|
|
98
|
+
}
|
|
98
99
|
static sortBalances(balances, prices, tokens) {
|
|
99
100
|
return Object.entries(balances).sort(
|
|
100
101
|
([addr1, amount1], [addr2, amount2]) => {
|
|
@@ -6,8 +6,6 @@ import {
|
|
|
6
6
|
import { toBigInt } from "../../utils/index.js";
|
|
7
7
|
class CreditManagerData_Legacy {
|
|
8
8
|
address;
|
|
9
|
-
chainId;
|
|
10
|
-
network;
|
|
11
9
|
underlyingToken;
|
|
12
10
|
pool;
|
|
13
11
|
creditFacade;
|
|
@@ -49,8 +47,6 @@ class CreditManagerData_Legacy {
|
|
|
49
47
|
quotas;
|
|
50
48
|
constructor(payload) {
|
|
51
49
|
this.address = payload.addr.toLowerCase();
|
|
52
|
-
this.chainId = payload.chainId;
|
|
53
|
-
this.network = payload.network;
|
|
54
50
|
this.underlyingToken = payload.underlying.toLowerCase();
|
|
55
51
|
this.name = payload.name;
|
|
56
52
|
this.pool = payload.pool.toLowerCase();
|
|
@@ -8,8 +8,7 @@ import { toBigInt } from "../../utils/index.js";
|
|
|
8
8
|
import { rayToNumber } from "../utils/formatter.js";
|
|
9
9
|
class PoolData_Legacy {
|
|
10
10
|
address;
|
|
11
|
-
|
|
12
|
-
network;
|
|
11
|
+
type;
|
|
13
12
|
underlyingToken;
|
|
14
13
|
dieselToken;
|
|
15
14
|
stakedDieselToken;
|
|
@@ -41,8 +40,7 @@ class PoolData_Legacy {
|
|
|
41
40
|
lastBaseInterestUpdate;
|
|
42
41
|
constructor(payload, extra) {
|
|
43
42
|
this.address = payload.addr.toLowerCase();
|
|
44
|
-
this.
|
|
45
|
-
this.network = payload.network;
|
|
43
|
+
this.type = PoolData_Legacy.getPoolType(payload.name || "");
|
|
46
44
|
this.underlyingToken = payload.underlying.toLowerCase();
|
|
47
45
|
this.dieselToken = payload.dieselToken.toLowerCase();
|
|
48
46
|
this.stakedDieselToken = (extra.stakedDieselToken || []).map(
|
|
@@ -131,6 +129,13 @@ class PoolData_Legacy {
|
|
|
131
129
|
});
|
|
132
130
|
return model.read.calcBorrowRate([expectedLiquidity, availableLiquidity]);
|
|
133
131
|
}
|
|
132
|
+
static getPoolType(name) {
|
|
133
|
+
const [identity = ""] = name.split(" ") || [];
|
|
134
|
+
const lc = identity.toLowerCase();
|
|
135
|
+
if (lc === "farm") return "farm";
|
|
136
|
+
if (lc === "trade") return "trade";
|
|
137
|
+
return "universal";
|
|
138
|
+
}
|
|
134
139
|
static calculateUtilization(expected, available) {
|
|
135
140
|
if (expected === 0n) return 0;
|
|
136
141
|
const borrowed = expected - available;
|
|
@@ -142,6 +147,7 @@ class ChartsPoolData {
|
|
|
142
147
|
address;
|
|
143
148
|
underlyingToken;
|
|
144
149
|
dieselToken;
|
|
150
|
+
type;
|
|
145
151
|
version;
|
|
146
152
|
name;
|
|
147
153
|
addLiqCount;
|
|
@@ -194,6 +200,7 @@ class ChartsPoolData {
|
|
|
194
200
|
this.address = (payload.addr || "").toLowerCase();
|
|
195
201
|
this.underlyingToken = (payload.underlyingToken || "").toLowerCase();
|
|
196
202
|
this.dieselToken = (payload.dieselToken || "").toLowerCase();
|
|
203
|
+
this.type = PoolData_Legacy.getPoolType(payload.name || "");
|
|
197
204
|
this.version = payload.version || 1;
|
|
198
205
|
this.name = payload.name || "";
|
|
199
206
|
this.earned7D = payload.earned7D || 0;
|
|
@@ -53,7 +53,7 @@ class GearboxRewardsExtraApy {
|
|
|
53
53
|
pointsInfo2
|
|
54
54
|
);
|
|
55
55
|
if (points !== null) {
|
|
56
|
-
acc2.push({ balance: points, token:
|
|
56
|
+
acc2.push({ balance: points, token: tokenBalance.token });
|
|
57
57
|
}
|
|
58
58
|
return acc2;
|
|
59
59
|
},
|
|
@@ -65,15 +65,14 @@ class GearboxRewardsExtraApy {
|
|
|
65
65
|
return r;
|
|
66
66
|
}
|
|
67
67
|
static getPoolTokenPoints(tokenBalanceInPool, pool, tokensList, pointsInfo) {
|
|
68
|
-
if (!tokenBalanceInPool
|
|
69
|
-
return null;
|
|
68
|
+
if (!tokenBalanceInPool) return null;
|
|
70
69
|
if (pool.expectedLiquidity <= 0) return 0n;
|
|
71
|
-
const { decimals = 18 } = tokensList[
|
|
70
|
+
const { decimals = 18 } = tokensList[tokenBalanceInPool.token] || {};
|
|
72
71
|
const targetFactor = 10n ** BigInt(decimals);
|
|
73
72
|
const { decimals: underlyingDecimals = 18 } = tokensList[pool.underlyingToken] || {};
|
|
74
73
|
const underlyingFactor = 10n ** BigInt(underlyingDecimals);
|
|
75
74
|
const defaultPoints = pointsInfo.amount * targetFactor / PERCENTAGE_FACTOR;
|
|
76
|
-
const points = pointsInfo.estimation === "absolute" ? defaultPoints :
|
|
75
|
+
const points = pointsInfo.estimation === "absolute" ? defaultPoints : tokenBalanceInPool.balance * defaultPoints / (pool.expectedLiquidity * targetFactor / underlyingFactor);
|
|
77
76
|
return BigIntMath.min(points, defaultPoints);
|
|
78
77
|
}
|
|
79
78
|
static getPoolPointsTip(poolRewards, pool, token) {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { getLogs } from "viem/actions";
|
|
2
|
+
async function getLogsPaginated(client, params) {
|
|
3
|
+
const from_ = params.fromBlock;
|
|
4
|
+
const to_ = params.toBlock;
|
|
5
|
+
const pageSize = params.pageSize;
|
|
6
|
+
const requests = [];
|
|
7
|
+
for (let fromBlock = from_; fromBlock < to_; fromBlock += pageSize) {
|
|
8
|
+
let toBlock = fromBlock + pageSize - 1n;
|
|
9
|
+
if (toBlock > to_) {
|
|
10
|
+
toBlock = to_;
|
|
11
|
+
}
|
|
12
|
+
requests.push({
|
|
13
|
+
...params,
|
|
14
|
+
fromBlock,
|
|
15
|
+
toBlock
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
const responses = await Promise.all(
|
|
19
|
+
requests.map(
|
|
20
|
+
(r) => getLogs(
|
|
21
|
+
client,
|
|
22
|
+
r
|
|
23
|
+
)
|
|
24
|
+
)
|
|
25
|
+
);
|
|
26
|
+
return responses.flat();
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
getLogsPaginated
|
|
30
|
+
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
-
import type { NetworkType } from "../../chain/chains.js";
|
|
3
2
|
import type { Asset } from "../../router/index.js";
|
|
4
3
|
import type { TokensAPYList } from "../apy/index.js";
|
|
5
4
|
import type { CaTokenBalance, CreditAccountDataPayload } from "../payload/creditAccount.js";
|
|
@@ -104,8 +103,6 @@ export interface BotDataLegacy {
|
|
|
104
103
|
}
|
|
105
104
|
export declare class CreditAccountData_Legacy {
|
|
106
105
|
readonly isSuccessful: boolean;
|
|
107
|
-
readonly chainId: number;
|
|
108
|
-
readonly network: NetworkType;
|
|
109
106
|
readonly creditAccount: Address;
|
|
110
107
|
readonly borrower: Address;
|
|
111
108
|
readonly creditManager: Address;
|
|
@@ -116,6 +113,7 @@ export declare class CreditAccountData_Legacy {
|
|
|
116
113
|
readonly version: number;
|
|
117
114
|
readonly enabledTokensMask: bigint;
|
|
118
115
|
readonly healthFactor: number;
|
|
116
|
+
isDeleting: boolean;
|
|
119
117
|
readonly baseBorrowRateWithoutFee: number;
|
|
120
118
|
readonly borrowedAmount: bigint;
|
|
121
119
|
readonly accruedInterest: bigint;
|
|
@@ -132,9 +130,10 @@ export declare class CreditAccountData_Legacy {
|
|
|
132
130
|
readonly forbiddenTokens: Record<Address, true>;
|
|
133
131
|
readonly quotedTokens: Record<Address, true>;
|
|
134
132
|
constructor(payload: CreditAccountDataPayload);
|
|
133
|
+
setDeleteInProgress(d: boolean): void;
|
|
135
134
|
static sortBalances(balances: Record<Address, bigint>, prices: Record<Address, bigint>, tokens: Record<Address, TokenData>): Array<[Address, bigint]>;
|
|
136
135
|
static sortAssets(balances: Array<Asset>, prices: Record<Address, bigint>, tokens: Record<Address, TokenData>): Asset[];
|
|
137
|
-
static tokensAbcComparator(t1?: TokenData, t2?: TokenData): 1 |
|
|
136
|
+
static tokensAbcComparator(t1?: TokenData, t2?: TokenData): 1 | -1 | 0;
|
|
138
137
|
static amountAbcComparator(t1: bigint, t2: bigint): 1 | -1;
|
|
139
138
|
isForbidden(token: Address): boolean;
|
|
140
139
|
isQuoted(token: Address): boolean;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
-
import type { NetworkType } from "../../chain/chains.js";
|
|
3
2
|
import type { ChartsCreditManagerPayload, CreditManagerDataPayload, QuotaInfo } from "../payload/creditManager.js";
|
|
4
3
|
export declare class CreditManagerData_Legacy {
|
|
5
4
|
readonly address: Address;
|
|
6
|
-
readonly chainId: number;
|
|
7
|
-
readonly network: NetworkType;
|
|
8
5
|
readonly underlyingToken: Address;
|
|
9
6
|
readonly pool: Address;
|
|
10
7
|
readonly creditFacade: Address;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { Address, PublicClient } from "viem";
|
|
2
|
-
import type { NetworkType } from "../../chain/chains.js";
|
|
3
2
|
import type { ChartsPoolDataPayload, LinearModel, PoolDataExtraPayload, PoolDataPayload, UserPoolPayload } from "../payload/pool.js";
|
|
3
|
+
export type PoolType = "universal" | "trade" | "farm";
|
|
4
4
|
export declare class PoolData_Legacy {
|
|
5
5
|
readonly address: Address;
|
|
6
|
-
readonly
|
|
7
|
-
readonly network: NetworkType;
|
|
6
|
+
readonly type: PoolType;
|
|
8
7
|
readonly underlyingToken: Address;
|
|
9
8
|
readonly dieselToken: Address;
|
|
10
9
|
readonly stakedDieselToken: Array<Address>;
|
|
@@ -46,6 +45,7 @@ export declare class PoolData_Legacy {
|
|
|
46
45
|
readonly lastBaseInterestUpdate: bigint;
|
|
47
46
|
constructor(payload: PoolDataPayload, extra: PoolDataExtraPayload);
|
|
48
47
|
calculateBorrowRate({ provider, expectedLiquidity, availableLiquidity, }: CalculateBorrowRateProps): Promise<bigint>;
|
|
48
|
+
static getPoolType(name: string): PoolType;
|
|
49
49
|
static calculateUtilization(expected: bigint, available: bigint): number;
|
|
50
50
|
}
|
|
51
51
|
interface CalculateBorrowRateProps {
|
|
@@ -57,6 +57,7 @@ export declare class ChartsPoolData {
|
|
|
57
57
|
readonly address: Address;
|
|
58
58
|
readonly underlyingToken: Address;
|
|
59
59
|
readonly dieselToken: Address;
|
|
60
|
+
readonly type: PoolType;
|
|
60
61
|
readonly version: number;
|
|
61
62
|
readonly name: string;
|
|
62
63
|
readonly addLiqCount: number;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
-
import type { NetworkType } from "../../chain/index.js";
|
|
3
2
|
export interface CaTokenBalance {
|
|
4
3
|
success: boolean;
|
|
5
4
|
token: Address;
|
|
@@ -42,6 +41,4 @@ export interface CreditAccountDataPayload {
|
|
|
42
41
|
}[];
|
|
43
42
|
cfVersion: bigint;
|
|
44
43
|
expirationDate: number;
|
|
45
|
-
chainId: number;
|
|
46
|
-
network: NetworkType;
|
|
47
44
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
-
import type { NetworkType } from "../../chain/chains.js";
|
|
3
2
|
import type { BigNumberish } from "../utils/formatter.js";
|
|
4
3
|
import type { PoolDataPayload } from "./pool.js";
|
|
5
4
|
export interface CreditManagerDebtParamsSDK {
|
|
@@ -55,8 +54,6 @@ export interface CreditManagerDataPayload {
|
|
|
55
54
|
liquidationDiscountExpired: number;
|
|
56
55
|
quotas: PoolDataPayload["quotas"];
|
|
57
56
|
isBorrowingForbidden: boolean;
|
|
58
|
-
chainId: number;
|
|
59
|
-
network: NetworkType;
|
|
60
57
|
}
|
|
61
58
|
export interface ChartsCreditManagerPayload {
|
|
62
59
|
addr: Address;
|
|
@@ -2,7 +2,6 @@ import type { AbiParametersToPrimitiveTypes, ExtractAbiFunction } from "abitype"
|
|
|
2
2
|
import type { Address } from "viem";
|
|
3
3
|
import type { iPeripheryCompressorAbi } from "../../../abi/compressors.js";
|
|
4
4
|
import type { Unarray } from "../../base/types.js";
|
|
5
|
-
import type { NetworkType } from "../../chain/chains.js";
|
|
6
5
|
export type ZapperData = Unarray<AbiParametersToPrimitiveTypes<ExtractAbiFunction<typeof iPeripheryCompressorAbi, "getZappers">["outputs"]>>;
|
|
7
6
|
export interface ZapperDataFull extends ZapperData {
|
|
8
7
|
pool: Address;
|
|
@@ -50,8 +49,6 @@ export interface PoolDataPayload {
|
|
|
50
49
|
isActive: boolean;
|
|
51
50
|
}[];
|
|
52
51
|
zappers: readonly ZapperDataFull[];
|
|
53
|
-
chainId: number;
|
|
54
|
-
network: NetworkType;
|
|
55
52
|
}
|
|
56
53
|
export interface PoolDataExtraPayload {
|
|
57
54
|
stakedDieselToken: Array<Address>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AbiEvent } from "abitype";
|
|
2
|
+
import type { BlockNumber, Chain, Client, GetLogsParameters, GetLogsReturnType, MaybeAbiEventName, Transport } from "viem";
|
|
3
|
+
export type GetLogsPaginatedParameters<abiEvent extends AbiEvent | undefined = undefined, abiEvents extends readonly AbiEvent[] | readonly unknown[] | undefined = abiEvent extends AbiEvent ? [abiEvent] : undefined, strict extends boolean | undefined = undefined, _eventName extends string | undefined = MaybeAbiEventName<abiEvent>> = GetLogsParameters<abiEvent, abiEvents, strict, BlockNumber, BlockNumber, _eventName> & {
|
|
4
|
+
pageSize: bigint;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Get logs in pages, to avoid rate limiting
|
|
8
|
+
* Must be used with client that has batching enabled
|
|
9
|
+
* @param client
|
|
10
|
+
* @param params
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
export declare function getLogsPaginated<chain extends Chain | undefined, const abiEvent extends AbiEvent | undefined = undefined, const abiEvents extends readonly AbiEvent[] | readonly unknown[] | undefined = abiEvent extends AbiEvent ? [abiEvent] : undefined, strict extends boolean | undefined = undefined>(client: Client<Transport, chain>, params: GetLogsPaginatedParameters<abiEvent, abiEvents, strict>): Promise<GetLogsReturnType<abiEvent, abiEvents, strict, BlockNumber, BlockNumber>>;
|