@gearbox-protocol/sdk 1.12.4 → 1.13.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.
|
@@ -6,6 +6,10 @@ export interface CreditManagerUpdate {
|
|
|
6
6
|
updated: Array<CreditAccountHash>;
|
|
7
7
|
deleted: Array<CreditAccountHash>;
|
|
8
8
|
}
|
|
9
|
+
interface BatchCreditAccountLoadOptions {
|
|
10
|
+
atBlock?: number;
|
|
11
|
+
chunkSize?: number;
|
|
12
|
+
}
|
|
9
13
|
export declare class CreditAccountWatcher {
|
|
10
14
|
static IERC20: import("../types/@openzeppelin/contracts/token/ERC20/IERC20").IERC20Interface;
|
|
11
15
|
static creditManagerInterface: import("../types/@gearbox-protocol/core-v2/contracts/interfaces/ICreditManagerV2.sol/ICreditManagerV2").ICreditManagerV2Interface;
|
|
@@ -18,7 +22,7 @@ export declare class CreditAccountWatcher {
|
|
|
18
22
|
* @returns Arrays of hashes for opened accounts
|
|
19
23
|
*/
|
|
20
24
|
static getOpenAccounts(creditManager: CreditManagerData, provider: providers.Provider | Signer, toBlock?: number): Promise<Array<CreditAccountHash>>;
|
|
21
|
-
static batchCreditAccountLoad(accs: Array<CreditAccountHash>, dataCompressor: string, signer: Signer | providers.Provider,
|
|
25
|
+
static batchCreditAccountLoad(accs: Array<CreditAccountHash>, dataCompressor: string, signer: Signer | providers.Provider, options?: BatchCreditAccountLoadOptions | number): Promise<Array<CreditAccountData>>;
|
|
22
26
|
/**
|
|
23
27
|
* Tracks block logs and detects whichj acccounts were changed (created / modified) and which were deleted
|
|
24
28
|
* @param logs Logs from last N blocks
|
|
@@ -28,3 +32,4 @@ export declare class CreditAccountWatcher {
|
|
|
28
32
|
static detectChanges(logs: Array<providers.Log>, creditManagers: Array<CreditManagerData>): CreditManagerUpdate;
|
|
29
33
|
static trackDirectTransfers(freshLogs: Array<providers.Log>, tokensToTrack: Array<string>, accounts: Array<CreditAccountData>): Array<CreditAccountHash>;
|
|
30
34
|
}
|
|
35
|
+
export {};
|
|
@@ -108,14 +108,22 @@ var CreditAccountWatcher = /** @class */ (function () {
|
|
|
108
108
|
});
|
|
109
109
|
});
|
|
110
110
|
};
|
|
111
|
-
CreditAccountWatcher.batchCreditAccountLoad = function (accs, dataCompressor, signer,
|
|
111
|
+
CreditAccountWatcher.batchCreditAccountLoad = function (accs, dataCompressor, signer, options) {
|
|
112
|
+
var _a;
|
|
112
113
|
return __awaiter(this, void 0, void 0, function () {
|
|
113
|
-
var
|
|
114
|
-
return __generator(this, function (
|
|
115
|
-
switch (
|
|
114
|
+
var chunkSize, atBlock, dcmc, calls, i, chunk, data;
|
|
115
|
+
return __generator(this, function (_b) {
|
|
116
|
+
switch (_b.label) {
|
|
116
117
|
case 0:
|
|
117
|
-
dcmc = new multicall_1.MultiCallContract(dataCompressor, types_1.IDataCompressor__factory.createInterface(), signer);
|
|
118
118
|
chunkSize = 1000;
|
|
119
|
+
if (typeof options === "object") {
|
|
120
|
+
atBlock = options.atBlock;
|
|
121
|
+
chunkSize = (_a = options.chunkSize) !== null && _a !== void 0 ? _a : 1000;
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
atBlock = options;
|
|
125
|
+
}
|
|
126
|
+
dcmc = new multicall_1.MultiCallContract(dataCompressor, types_1.IDataCompressor__factory.createInterface(), signer);
|
|
119
127
|
calls = [];
|
|
120
128
|
for (i = 0; i < accs.length; i++) {
|
|
121
129
|
chunk = accs.slice(i * chunkSize, (i + 1) * chunkSize);
|
|
@@ -128,7 +136,7 @@ var CreditAccountWatcher = /** @class */ (function () {
|
|
|
128
136
|
}
|
|
129
137
|
return [4 /*yield*/, Promise.all(calls.map(function (c) { return dcmc.call(c, { blockTag: atBlock }); }))];
|
|
130
138
|
case 1:
|
|
131
|
-
data =
|
|
139
|
+
data = _b.sent();
|
|
132
140
|
return [2 /*return*/, data.flat().map(function (c) { return new creditAccount_1.CreditAccountData(c); })];
|
|
133
141
|
}
|
|
134
142
|
});
|