@gearbox-protocol/sdk 8.26.0 → 8.26.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/dist/cjs/dev/createAnvilClient.js +5 -3
- package/dist/esm/dev/createAnvilClient.js +5 -3
- package/dist/esm/sdk/accounts/AbstractCreditAccountsService.js +3 -1
- package/dist/types/dev/createAnvilClient.d.ts +3 -1
- package/dist/types/sdk/accounts/AbstractCreditAccountsService.d.ts +4 -4
- package/dist/types/sdk/router/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -27,15 +27,17 @@ module.exports = __toCommonJS(createAnvilClient_exports);
|
|
|
27
27
|
var import_viem = require("viem");
|
|
28
28
|
function createAnvilClient({
|
|
29
29
|
chain,
|
|
30
|
-
transport
|
|
30
|
+
transport,
|
|
31
|
+
cacheTime = 0,
|
|
32
|
+
pollingInterval = 50
|
|
31
33
|
}) {
|
|
32
34
|
return (0, import_viem.createTestClient)(
|
|
33
35
|
{
|
|
34
36
|
chain,
|
|
35
37
|
mode: "anvil",
|
|
36
38
|
transport,
|
|
37
|
-
cacheTime
|
|
38
|
-
pollingInterval
|
|
39
|
+
cacheTime,
|
|
40
|
+
pollingInterval
|
|
39
41
|
}
|
|
40
42
|
).extend(import_viem.publicActions).extend(import_viem.walletActions).extend((client) => ({
|
|
41
43
|
anvilNodeInfo: () => anvilNodeInfo(client),
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { createTestClient, publicActions, toHex, walletActions } from "viem";
|
|
2
2
|
function createAnvilClient({
|
|
3
3
|
chain,
|
|
4
|
-
transport
|
|
4
|
+
transport,
|
|
5
|
+
cacheTime = 0,
|
|
6
|
+
pollingInterval = 50
|
|
5
7
|
}) {
|
|
6
8
|
return createTestClient(
|
|
7
9
|
{
|
|
8
10
|
chain,
|
|
9
11
|
mode: "anvil",
|
|
10
12
|
transport,
|
|
11
|
-
cacheTime
|
|
12
|
-
pollingInterval
|
|
13
|
+
cacheTime,
|
|
14
|
+
pollingInterval
|
|
13
15
|
}
|
|
14
16
|
).extend(publicActions).extend(walletActions).extend((client) => ({
|
|
15
17
|
anvilNodeInfo: () => anvilNodeInfo(client),
|
|
@@ -18,7 +18,9 @@ import {
|
|
|
18
18
|
RAY,
|
|
19
19
|
VERSION_RANGE_310
|
|
20
20
|
} from "../constants/index.js";
|
|
21
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
assetsMap
|
|
23
|
+
} from "../router/index.js";
|
|
22
24
|
import { AddressMap, childLogger } from "../utils/index.js";
|
|
23
25
|
import { simulateWithPriceUpdates } from "../utils/viem/index.js";
|
|
24
26
|
import { stringifyGetCreditAccountsArgs } from "./utils.js";
|
|
@@ -45,8 +45,10 @@ export type AnvilClient = Prettify<{
|
|
|
45
45
|
export interface AnvilClientConfig<transport extends Transport = Transport, chain extends Chain | undefined = Chain | undefined> {
|
|
46
46
|
transport: transport;
|
|
47
47
|
chain?: chain;
|
|
48
|
+
cacheTime?: number;
|
|
49
|
+
pollingInterval?: number;
|
|
48
50
|
}
|
|
49
|
-
export declare function createAnvilClient({ chain, transport, }: AnvilClientConfig): AnvilClient;
|
|
51
|
+
export declare function createAnvilClient({ chain, transport, cacheTime, pollingInterval, }: AnvilClientConfig): AnvilClient;
|
|
50
52
|
/**
|
|
51
53
|
* View action to detect if client is an anvil client
|
|
52
54
|
* @param client
|
|
@@ -3,7 +3,7 @@ import type { CreditAccountData } from "../base/index.js";
|
|
|
3
3
|
import { SDKConstruct } from "../base/index.js";
|
|
4
4
|
import type { GearboxSDK } from "../GearboxSDK.js";
|
|
5
5
|
import type { OnDemandPriceUpdates, UpdatePriceFeedsResult } from "../market/index.js";
|
|
6
|
-
import { type Asset, type RouterCASlice } from "../router/index.js";
|
|
6
|
+
import { type Asset, type CreditAccountTokensSlice, type RouterCASlice } from "../router/index.js";
|
|
7
7
|
import type { MultiCall } from "../types/index.js";
|
|
8
8
|
import type { ClaimDelayedProps, FullyLiquidateProps, GetConnectedBotsResult, StartDelayedWithdrawalProps } from "./types";
|
|
9
9
|
import type { AddCollateralProps, ChangeDeptProps, CloseCreditAccountProps, CloseCreditAccountResult, CreditAccountOperationResult, EnableTokensProps, ExecuteSwapProps, GetCreditAccountsOptions, OpenCAProps, PermitResult, PrepareUpdateQuotasProps, Rewards, UpdateQuotasProps } from "./types.js";
|
|
@@ -178,7 +178,7 @@ export declare abstract class AbstractCreditAccountService extends SDKConstruct
|
|
|
178
178
|
* @returns
|
|
179
179
|
*/
|
|
180
180
|
getUpdateForAccounts(accounts: Array<RouterCASlice>): Promise<UpdatePriceFeedsResult>;
|
|
181
|
-
protected getUpdateForAccount(creditManager: Address, creditAccount:
|
|
181
|
+
protected getUpdateForAccount(creditManager: Address, creditAccount: CreditAccountTokensSlice | undefined, desiredQuotas: Array<Asset> | undefined): Promise<UpdatePriceFeedsResult>;
|
|
182
182
|
/**
|
|
183
183
|
* Returns account price updates that can be used in credit facade multicall or liquidator calls
|
|
184
184
|
* @param creditManager
|
|
@@ -186,7 +186,7 @@ export declare abstract class AbstractCreditAccountService extends SDKConstruct
|
|
|
186
186
|
* @param desiredQuotas
|
|
187
187
|
* @returns
|
|
188
188
|
*/
|
|
189
|
-
getOnDemandPriceUpdates(creditManager: Address, creditAccount:
|
|
189
|
+
getOnDemandPriceUpdates(creditManager: Address, creditAccount: CreditAccountTokensSlice | undefined, desiredQuotas: Array<Asset> | undefined): Promise<OnDemandPriceUpdates>;
|
|
190
190
|
/**
|
|
191
191
|
* Returns price updates in format that is accepted by various credit facade methods (multicall, close/liquidate, etc...).
|
|
192
192
|
* - If there are desiredQuotas and creditAccount update quotaBalance > 0 || (balance > 10n && isEnabled). Is used when account has both: balances and quota buys.
|
|
@@ -195,7 +195,7 @@ export declare abstract class AbstractCreditAccountService extends SDKConstruct
|
|
|
195
195
|
* @param acc
|
|
196
196
|
* @returns
|
|
197
197
|
*/
|
|
198
|
-
protected getPriceUpdatesForFacade(creditManager: Address, creditAccount:
|
|
198
|
+
protected getPriceUpdatesForFacade(creditManager: Address, creditAccount: CreditAccountTokensSlice | undefined, desiredQuotas: Array<Asset> | undefined): Promise<Array<MultiCall>>;
|
|
199
199
|
protected prepareDisableQuotas(ca: RouterCASlice): Array<MultiCall>;
|
|
200
200
|
protected prepareUpdateQuotas(creditFacade: Address, { averageQuota, minQuota }: PrepareUpdateQuotasProps): Array<MultiCall>;
|
|
201
201
|
protected prepareDecreaseDebt(ca: RouterCASlice): Array<MultiCall>;
|
|
@@ -83,6 +83,7 @@ export interface RouterCMSlice {
|
|
|
83
83
|
* Slice of credit account data required for router operations
|
|
84
84
|
*/
|
|
85
85
|
export type RouterCASlice = Pick<CreditAccountData, "tokens" | "enabledTokensMask" | "underlying" | "creditAccount" | "creditFacade" | "debt" | "creditManager">;
|
|
86
|
+
export type CreditAccountTokensSlice = Pick<CreditAccountData, "creditAccount" | "tokens" | "enabledTokensMask">;
|
|
86
87
|
export interface FindAllSwapsProps {
|
|
87
88
|
/**
|
|
88
89
|
* Minimal credit account data on which operation is performed
|