@gearbox-protocol/sdk 3.0.0-vfour.28 → 3.0.0-vfour.29
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/index.cjs +16 -24
- package/dist/cjs/sdk/index.d.ts +6 -11
- package/dist/esm/sdk/index.d.mts +6 -11
- package/dist/esm/sdk/index.mjs +16 -24
- package/package.json +1 -1
package/dist/cjs/sdk/index.cjs
CHANGED
|
@@ -13370,17 +13370,14 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
13370
13370
|
* @param account
|
|
13371
13371
|
* @returns
|
|
13372
13372
|
*/
|
|
13373
|
-
async getCreditAccountData(account
|
|
13374
|
-
const blockNumber = options?.blockNumber;
|
|
13373
|
+
async getCreditAccountData(account) {
|
|
13375
13374
|
let raw;
|
|
13376
13375
|
try {
|
|
13377
13376
|
raw = await this.provider.publicClient.readContract({
|
|
13378
13377
|
abi: iCreditAccountCompressorAbi,
|
|
13379
13378
|
address: this.#compressor,
|
|
13380
13379
|
functionName: "getCreditAccountData",
|
|
13381
|
-
args: [account]
|
|
13382
|
-
blockNumber
|
|
13383
|
-
// TODO: we should cache price updates for block to speed up optimistic liquidator
|
|
13380
|
+
args: [account]
|
|
13384
13381
|
});
|
|
13385
13382
|
} catch (e) {
|
|
13386
13383
|
return void 0;
|
|
@@ -13402,9 +13399,8 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
13402
13399
|
],
|
|
13403
13400
|
allowFailure: false,
|
|
13404
13401
|
gas: 550000000n,
|
|
13405
|
-
batchSize: 0
|
|
13402
|
+
batchSize: 0
|
|
13406
13403
|
// we cannot have price updates and compressor request in different batches
|
|
13407
|
-
blockNumber
|
|
13408
13404
|
});
|
|
13409
13405
|
const cad = resp.pop();
|
|
13410
13406
|
return cad;
|
|
@@ -13419,7 +13415,7 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
13419
13415
|
* @param args
|
|
13420
13416
|
* @returns returned credit accounts are sorted by health factor in ascending order
|
|
13421
13417
|
*/
|
|
13422
|
-
async getCreditAccounts(args
|
|
13418
|
+
async getCreditAccounts(args) {
|
|
13423
13419
|
const {
|
|
13424
13420
|
creditManager,
|
|
13425
13421
|
includeZeroDebt = false,
|
|
@@ -13446,8 +13442,7 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
13446
13442
|
do {
|
|
13447
13443
|
const [accounts, newOffset] = await this.#getCreditAccounts(
|
|
13448
13444
|
[arg0, { ...caFilter, reverting }, offset],
|
|
13449
|
-
priceUpdateTxs
|
|
13450
|
-
options
|
|
13445
|
+
priceUpdateTxs
|
|
13451
13446
|
);
|
|
13452
13447
|
allCAs.push(...accounts);
|
|
13453
13448
|
offset = newOffset;
|
|
@@ -13514,10 +13509,11 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
13514
13509
|
}
|
|
13515
13510
|
/**
|
|
13516
13511
|
* Internal wrapper for CreditAccountCompressor.getCreditAccounts + price updates wrapped into multicall
|
|
13517
|
-
* @param
|
|
13512
|
+
* @param args
|
|
13513
|
+
* @param priceUpdateTxs
|
|
13518
13514
|
* @returns
|
|
13519
13515
|
*/
|
|
13520
|
-
async #getCreditAccounts(args, priceUpdateTxs
|
|
13516
|
+
async #getCreditAccounts(args, priceUpdateTxs) {
|
|
13521
13517
|
if (priceUpdateTxs?.length) {
|
|
13522
13518
|
const resp = await simulateMulticall(this.provider.publicClient, {
|
|
13523
13519
|
account: this.provider.account,
|
|
@@ -13532,9 +13528,8 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
13532
13528
|
],
|
|
13533
13529
|
allowFailure: false,
|
|
13534
13530
|
gas: 550000000n,
|
|
13535
|
-
batchSize: 0
|
|
13531
|
+
batchSize: 0
|
|
13536
13532
|
// we cannot have price updates and compressor request in different batches
|
|
13537
|
-
blockNumber: options?.blockNumber
|
|
13538
13533
|
});
|
|
13539
13534
|
const getCreditAccountsResp = resp.pop();
|
|
13540
13535
|
return getCreditAccountsResp;
|
|
@@ -13543,8 +13538,7 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
13543
13538
|
abi: iCreditAccountCompressorAbi,
|
|
13544
13539
|
address: this.#compressor,
|
|
13545
13540
|
functionName: "getCreditAccounts",
|
|
13546
|
-
args
|
|
13547
|
-
blockNumber: options?.blockNumber
|
|
13541
|
+
args
|
|
13548
13542
|
});
|
|
13549
13543
|
}
|
|
13550
13544
|
/**
|
|
@@ -13552,7 +13546,7 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
13552
13546
|
* @param accounts
|
|
13553
13547
|
* @returns
|
|
13554
13548
|
*/
|
|
13555
|
-
async getUpdateForAccounts(accounts
|
|
13549
|
+
async getUpdateForAccounts(accounts) {
|
|
13556
13550
|
const tokensByPool = /* @__PURE__ */ new Map();
|
|
13557
13551
|
const oracleByPool = /* @__PURE__ */ new Map();
|
|
13558
13552
|
for (const acc of accounts) {
|
|
@@ -13579,25 +13573,23 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
13579
13573
|
/**
|
|
13580
13574
|
* Returns account price updates in a non-encoded format
|
|
13581
13575
|
* @param acc
|
|
13582
|
-
* @param blockNumber
|
|
13583
13576
|
* @returns
|
|
13584
13577
|
*/
|
|
13585
|
-
async getOnDemandPriceUpdates(acc
|
|
13578
|
+
async getOnDemandPriceUpdates(acc) {
|
|
13586
13579
|
const market = this.sdk.marketRegister.findByCreditManager(
|
|
13587
13580
|
acc.creditManager
|
|
13588
13581
|
);
|
|
13589
|
-
const update = await this.getUpdateForAccounts([acc]
|
|
13582
|
+
const update = await this.getUpdateForAccounts([acc]);
|
|
13590
13583
|
return market.priceOracle.onDemandPriceUpdates(update);
|
|
13591
13584
|
}
|
|
13592
13585
|
/**
|
|
13593
13586
|
* Returns price updates in format that is accepted by various credit facade methods (multicall, close/liquidate, etc...)
|
|
13594
13587
|
* @param acc
|
|
13595
|
-
* @param blockNumber
|
|
13596
13588
|
* @returns
|
|
13597
13589
|
*/
|
|
13598
|
-
async getPriceUpdatesForFacade(acc
|
|
13590
|
+
async getPriceUpdatesForFacade(acc) {
|
|
13599
13591
|
const cm = this.sdk.marketRegister.findCreditManager(acc.creditManager);
|
|
13600
|
-
const updates = await this.getOnDemandPriceUpdates(acc
|
|
13592
|
+
const updates = await this.getOnDemandPriceUpdates(acc);
|
|
13601
13593
|
return updates.map(({ token, reserve, data }) => ({
|
|
13602
13594
|
target: cm.creditFacade.address,
|
|
13603
13595
|
callData: viem.encodeFunctionData({
|
|
@@ -15422,7 +15414,7 @@ var MarketFactory = class {
|
|
|
15422
15414
|
this.priceOracle = new PriceOracleContract(
|
|
15423
15415
|
sdk,
|
|
15424
15416
|
marketData.priceOracleData,
|
|
15425
|
-
marketData.underlying
|
|
15417
|
+
marketData.pool.underlying
|
|
15426
15418
|
);
|
|
15427
15419
|
}
|
|
15428
15420
|
get state() {
|
package/dist/cjs/sdk/index.d.ts
CHANGED
|
@@ -14714,9 +14714,6 @@ interface MultiCall {
|
|
|
14714
14714
|
target: Address;
|
|
14715
14715
|
callData: Hex;
|
|
14716
14716
|
}
|
|
14717
|
-
interface ReadContractOptions {
|
|
14718
|
-
blockNumber?: bigint;
|
|
14719
|
-
}
|
|
14720
14717
|
|
|
14721
14718
|
interface TVL {
|
|
14722
14719
|
tvl: bigint;
|
|
@@ -17222,7 +17219,7 @@ declare class CreditAccountsService extends SDKConstruct {
|
|
|
17222
17219
|
* @param account
|
|
17223
17220
|
* @returns
|
|
17224
17221
|
*/
|
|
17225
|
-
getCreditAccountData(account: Address
|
|
17222
|
+
getCreditAccountData(account: Address): Promise<CreditAccountData | undefined>;
|
|
17226
17223
|
/**
|
|
17227
17224
|
* Methods to get all credit accounts with some optional filtering
|
|
17228
17225
|
* Performs all necessary price feed updates under the hood
|
|
@@ -17233,7 +17230,7 @@ declare class CreditAccountsService extends SDKConstruct {
|
|
|
17233
17230
|
* @param args
|
|
17234
17231
|
* @returns returned credit accounts are sorted by health factor in ascending order
|
|
17235
17232
|
*/
|
|
17236
|
-
getCreditAccounts(args?: CreditAccountFilter
|
|
17233
|
+
getCreditAccounts(args?: CreditAccountFilter): Promise<CreditAccountData[]>;
|
|
17237
17234
|
/**
|
|
17238
17235
|
* Generates transaction to liquidate credit account
|
|
17239
17236
|
* @param account
|
|
@@ -17257,21 +17254,19 @@ declare class CreditAccountsService extends SDKConstruct {
|
|
|
17257
17254
|
* @param accounts
|
|
17258
17255
|
* @returns
|
|
17259
17256
|
*/
|
|
17260
|
-
getUpdateForAccounts(accounts: CreditAccountData[]
|
|
17257
|
+
getUpdateForAccounts(accounts: CreditAccountData[]): Promise<UpdatePriceFeedsResult>;
|
|
17261
17258
|
/**
|
|
17262
17259
|
* Returns account price updates in a non-encoded format
|
|
17263
17260
|
* @param acc
|
|
17264
|
-
* @param blockNumber
|
|
17265
17261
|
* @returns
|
|
17266
17262
|
*/
|
|
17267
|
-
getOnDemandPriceUpdates(acc: CreditAccountData
|
|
17263
|
+
getOnDemandPriceUpdates(acc: CreditAccountData): Promise<OnDemandPriceUpdate[]>;
|
|
17268
17264
|
/**
|
|
17269
17265
|
* Returns price updates in format that is accepted by various credit facade methods (multicall, close/liquidate, etc...)
|
|
17270
17266
|
* @param acc
|
|
17271
|
-
* @param blockNumber
|
|
17272
17267
|
* @returns
|
|
17273
17268
|
*/
|
|
17274
|
-
getPriceUpdatesForFacade(acc: CreditAccountData
|
|
17269
|
+
getPriceUpdatesForFacade(acc: CreditAccountData): Promise<MultiCall[]>;
|
|
17275
17270
|
/**
|
|
17276
17271
|
* Returns addresses of pools of attached markets
|
|
17277
17272
|
*/
|
|
@@ -17377,4 +17372,4 @@ type MulticallErrorType = GetChainContractAddressErrorType | ReadContractErrorTy
|
|
|
17377
17372
|
*/
|
|
17378
17373
|
declare function simulateMulticall<const contracts extends readonly unknown[], chain extends Chain | undefined, allowFailure extends boolean = true>(client: Client<Transport, chain>, parameters: MulticallParameters<contracts, allowFailure>): Promise<MulticallReturnType<contracts, allowFailure>>;
|
|
17379
17374
|
|
|
17380
|
-
export { type ACLState, type ACLStateHuman, ADDRESS_0X0, ADDRESS_PROVIDER, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DEGEN_DISTRIBUTOR, AP_DEGEN_NFT, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, type AccountFactoryStateHuman, AddressLabeller, AddressMap, AddressProviderContractV3_1, type AddressProviderV3State, type AddressProviderV3StateHuman, type Asset, type AssetPriceFeedState, type AssetPriceFeedStateHuman, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, BaseContract, type BaseContractOptions, type BaseContractState, type BaseContractStateHuman, type BasePriceFeedState, type BasePriceFeedStateHuman, BotListContract, type BotListState, type BotListStateHuman, BotPermissions, type BoundedOracleState, type BoundedOracleStateHuman, BoundedPriceFeedContract, ChainlinkPriceFeedContract, CompositePriceFeedContract, type ContractMethod, type ContractsRegisterState, type ContractsRegisterStateHuman, type ControllerTimelockV3State, type ControllerTimelockV3StateHuman, type CoreState, type CoreStateHuman, type CreditAccountData, type CreditAccountFilter, CreditAccountsService, CreditConfiguratorContract, type CreditConfiguratorState, type CreditConfiguratorStateHuman, CreditFacadeContract, type CreditFacadeState, type CreditFacadeStateHuman, CreditFactory, type CreditFactoryState, type CreditFactoryStateHuman, CreditManagerContract, type CreditManagerData, type CreditManagerDebtParams, type CreditManagerDebtParamsHuman, type CreditManagerDebtParamsStruct, type CreditManagerState, type CreditManagerStateHuman, CurveCryptoPriceFeedContract, type CurvePoolStruct, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, type DataCompressorV3State, type DegenDistributorState, type DegenDistributorStateHuman, type DegenNFT2State, type DegenNFT2StateHuman, Erc4626PriceFeedContract, type EtherscanURLParam, type FindClosePathInput, GaugeContract, type GaugeParams, type GaugeParamsHuman, type GaugeState, type GaugeStateHuman, GearStakingContract, type GearStakingV3State, type GearStakingV3StateHuman, GearboxSDK, type GearboxState, type GearboxStateHuman, type ILPPriceFeedContract, type ILogger, type IPriceFeedContract, LinearModelContract, type LinearModelState, type LinearModelStateHuman, type LogFn, MAX_UINT256, MIN_INT96, type MarketData, MarketFactory, MarketRegister, type MarketState, type MarketStateHuman, MellowLRTPriceFeedContract, type MultiCall, type MultiPauseState, type MulticallErrorType, type MulticallParameters, type MulticallReturnType, NOT_DEPLOYED, NO_VERSION, type NetworkType, type OnDemandPriceUpdate, type OpenStrategyResult, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, type PathOption, type PathOptionSerie, type PeripheryState, type PeripheryStateHuman, type PolicyStruct, type PolicyStructHuman, PoolContract, type PoolData, PoolFactory, type PoolFactoryState, type PoolFactoryStateHuman, PoolQuotaKeeperContract, type PoolQuotaKeeperData, type PoolQuotaKeeperState, type PoolQuotaKeeperStateHuman, type PoolState, type PoolStateHuman, type PriceFactoryStateHuman, type PriceFeedConstructorArgs, type PriceFeedContractType, type PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, type PriceFeedRegisterHooks, type PriceFeedState, type PriceFeedStateHuman, type PriceFeedTreeNode, type PriceFeedUsageType, PriceOracleContract, type PriceOracleData, type PriceOracleState, type PriceOracleV3State, type PriceOracleV3StateHuman, Provider, type ProviderOptions, type QuotaParams, type QuotaParamsHuman, RAY, RAY_DECIMALS_POW, type RateKeeperData, type RawTx,
|
|
17375
|
+
export { type ACLState, type ACLStateHuman, ADDRESS_0X0, ADDRESS_PROVIDER, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DEGEN_DISTRIBUTOR, AP_DEGEN_NFT, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, type AccountFactoryStateHuman, AddressLabeller, AddressMap, AddressProviderContractV3_1, type AddressProviderV3State, type AddressProviderV3StateHuman, type Asset, type AssetPriceFeedState, type AssetPriceFeedStateHuman, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, BaseContract, type BaseContractOptions, type BaseContractState, type BaseContractStateHuman, type BasePriceFeedState, type BasePriceFeedStateHuman, BotListContract, type BotListState, type BotListStateHuman, BotPermissions, type BoundedOracleState, type BoundedOracleStateHuman, BoundedPriceFeedContract, ChainlinkPriceFeedContract, CompositePriceFeedContract, type ContractMethod, type ContractsRegisterState, type ContractsRegisterStateHuman, type ControllerTimelockV3State, type ControllerTimelockV3StateHuman, type CoreState, type CoreStateHuman, type CreditAccountData, type CreditAccountFilter, CreditAccountsService, CreditConfiguratorContract, type CreditConfiguratorState, type CreditConfiguratorStateHuman, CreditFacadeContract, type CreditFacadeState, type CreditFacadeStateHuman, CreditFactory, type CreditFactoryState, type CreditFactoryStateHuman, CreditManagerContract, type CreditManagerData, type CreditManagerDebtParams, type CreditManagerDebtParamsHuman, type CreditManagerDebtParamsStruct, type CreditManagerState, type CreditManagerStateHuman, CurveCryptoPriceFeedContract, type CurvePoolStruct, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, type DataCompressorV3State, type DegenDistributorState, type DegenDistributorStateHuman, type DegenNFT2State, type DegenNFT2StateHuman, Erc4626PriceFeedContract, type EtherscanURLParam, type FindClosePathInput, GaugeContract, type GaugeParams, type GaugeParamsHuman, type GaugeState, type GaugeStateHuman, GearStakingContract, type GearStakingV3State, type GearStakingV3StateHuman, GearboxSDK, type GearboxState, type GearboxStateHuman, type ILPPriceFeedContract, type ILogger, type IPriceFeedContract, LinearModelContract, type LinearModelState, type LinearModelStateHuman, type LogFn, MAX_UINT256, MIN_INT96, type MarketData, MarketFactory, MarketRegister, type MarketState, type MarketStateHuman, MellowLRTPriceFeedContract, type MultiCall, type MultiPauseState, type MulticallErrorType, type MulticallParameters, type MulticallReturnType, NOT_DEPLOYED, NO_VERSION, type NetworkType, type OnDemandPriceUpdate, type OpenStrategyResult, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, type PathOption, type PathOptionSerie, type PeripheryState, type PeripheryStateHuman, type PolicyStruct, type PolicyStructHuman, PoolContract, type PoolData, PoolFactory, type PoolFactoryState, type PoolFactoryStateHuman, PoolQuotaKeeperContract, type PoolQuotaKeeperData, type PoolQuotaKeeperState, type PoolQuotaKeeperStateHuman, type PoolState, type PoolStateHuman, type PriceFactoryStateHuman, type PriceFeedConstructorArgs, type PriceFeedContractType, type PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, type PriceFeedRegisterHooks, type PriceFeedState, type PriceFeedStateHuman, type PriceFeedTreeNode, type PriceFeedUsageType, PriceOracleContract, type PriceOracleData, type PriceOracleState, type PriceOracleV3State, type PriceOracleV3StateHuman, Provider, type ProviderOptions, type QuotaParams, type QuotaParamsHuman, RAY, RAY_DECIMALS_POW, type RateKeeperData, type RawTx, RedstonePriceFeedContract, type RedstonePriceFeedState, type RedstonePriceFeedStateHuman, type RouterCloseResult, type RouterComponentRegisterHuman, type RouterHooks, type RouterResult, type RouterState, type RouterStateHuman, RouterV3Contract, type RouterV3ContractState, type RouterV3ContractStateHuman, type SDKAttachOptions, SDKConstruct, SUPPORTED_CHAINS, type SwapOperation, type SwapTask, TIMELOCK, type TVL, type TokenMetaData, type TokenTypeToResolverHuman, USDC, type UpdatePriceFeedsResult, VotingContractStatus, WAD, WAD_DECIMALS_POW, WstETHPriceFeedContract, YearnPriceFeedContract, type ZapperInfo, type ZapperInfoHuman, type ZapperRegisterState, type ZapperRegisterStateHuman, ZeroPriceFeedContract, botPermissionsToString, bytes32ToString, chains, childLogger, convertBaseContractState, convertCoreStateToHuman, convertCreditFactoryStateToHuman, convertGaugeStateToHuman, convertGearboxStateToHuman, convertGearboxStateToHumanLA, convertLinearModelStateToHuman, convertPeripheryStateToHuman, convertPoolFactoryStateToHuman, convertPoolQuotaKeeperStateToHuman, convertPoolStateToHuman, convertPriceFeedStateToHuman, convertPriceOracleStateToHuman, convertRouterStateToHuman, convertRouterV3StateToHuman, convertZapperRegisterStateToHuman, createRawTx, detectNetwork, etherscanUrl, filterDust, fmtBinaryMask, formatBN, formatBNvalue, formatBn4dig, formatDuration, formatNumberToString_, halfRAY, json_parse, json_stringify, numberWithCommas, percentFmt, simulateMulticall, toHumanFormat };
|
package/dist/esm/sdk/index.d.mts
CHANGED
|
@@ -14714,9 +14714,6 @@ interface MultiCall {
|
|
|
14714
14714
|
target: Address;
|
|
14715
14715
|
callData: Hex;
|
|
14716
14716
|
}
|
|
14717
|
-
interface ReadContractOptions {
|
|
14718
|
-
blockNumber?: bigint;
|
|
14719
|
-
}
|
|
14720
14717
|
|
|
14721
14718
|
interface TVL {
|
|
14722
14719
|
tvl: bigint;
|
|
@@ -17222,7 +17219,7 @@ declare class CreditAccountsService extends SDKConstruct {
|
|
|
17222
17219
|
* @param account
|
|
17223
17220
|
* @returns
|
|
17224
17221
|
*/
|
|
17225
|
-
getCreditAccountData(account: Address
|
|
17222
|
+
getCreditAccountData(account: Address): Promise<CreditAccountData | undefined>;
|
|
17226
17223
|
/**
|
|
17227
17224
|
* Methods to get all credit accounts with some optional filtering
|
|
17228
17225
|
* Performs all necessary price feed updates under the hood
|
|
@@ -17233,7 +17230,7 @@ declare class CreditAccountsService extends SDKConstruct {
|
|
|
17233
17230
|
* @param args
|
|
17234
17231
|
* @returns returned credit accounts are sorted by health factor in ascending order
|
|
17235
17232
|
*/
|
|
17236
|
-
getCreditAccounts(args?: CreditAccountFilter
|
|
17233
|
+
getCreditAccounts(args?: CreditAccountFilter): Promise<CreditAccountData[]>;
|
|
17237
17234
|
/**
|
|
17238
17235
|
* Generates transaction to liquidate credit account
|
|
17239
17236
|
* @param account
|
|
@@ -17257,21 +17254,19 @@ declare class CreditAccountsService extends SDKConstruct {
|
|
|
17257
17254
|
* @param accounts
|
|
17258
17255
|
* @returns
|
|
17259
17256
|
*/
|
|
17260
|
-
getUpdateForAccounts(accounts: CreditAccountData[]
|
|
17257
|
+
getUpdateForAccounts(accounts: CreditAccountData[]): Promise<UpdatePriceFeedsResult>;
|
|
17261
17258
|
/**
|
|
17262
17259
|
* Returns account price updates in a non-encoded format
|
|
17263
17260
|
* @param acc
|
|
17264
|
-
* @param blockNumber
|
|
17265
17261
|
* @returns
|
|
17266
17262
|
*/
|
|
17267
|
-
getOnDemandPriceUpdates(acc: CreditAccountData
|
|
17263
|
+
getOnDemandPriceUpdates(acc: CreditAccountData): Promise<OnDemandPriceUpdate[]>;
|
|
17268
17264
|
/**
|
|
17269
17265
|
* Returns price updates in format that is accepted by various credit facade methods (multicall, close/liquidate, etc...)
|
|
17270
17266
|
* @param acc
|
|
17271
|
-
* @param blockNumber
|
|
17272
17267
|
* @returns
|
|
17273
17268
|
*/
|
|
17274
|
-
getPriceUpdatesForFacade(acc: CreditAccountData
|
|
17269
|
+
getPriceUpdatesForFacade(acc: CreditAccountData): Promise<MultiCall[]>;
|
|
17275
17270
|
/**
|
|
17276
17271
|
* Returns addresses of pools of attached markets
|
|
17277
17272
|
*/
|
|
@@ -17377,4 +17372,4 @@ type MulticallErrorType = GetChainContractAddressErrorType | ReadContractErrorTy
|
|
|
17377
17372
|
*/
|
|
17378
17373
|
declare function simulateMulticall<const contracts extends readonly unknown[], chain extends Chain | undefined, allowFailure extends boolean = true>(client: Client<Transport, chain>, parameters: MulticallParameters<contracts, allowFailure>): Promise<MulticallReturnType<contracts, allowFailure>>;
|
|
17379
17374
|
|
|
17380
|
-
export { type ACLState, type ACLStateHuman, ADDRESS_0X0, ADDRESS_PROVIDER, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DEGEN_DISTRIBUTOR, AP_DEGEN_NFT, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, type AccountFactoryStateHuman, AddressLabeller, AddressMap, AddressProviderContractV3_1, type AddressProviderV3State, type AddressProviderV3StateHuman, type Asset, type AssetPriceFeedState, type AssetPriceFeedStateHuman, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, BaseContract, type BaseContractOptions, type BaseContractState, type BaseContractStateHuman, type BasePriceFeedState, type BasePriceFeedStateHuman, BotListContract, type BotListState, type BotListStateHuman, BotPermissions, type BoundedOracleState, type BoundedOracleStateHuman, BoundedPriceFeedContract, ChainlinkPriceFeedContract, CompositePriceFeedContract, type ContractMethod, type ContractsRegisterState, type ContractsRegisterStateHuman, type ControllerTimelockV3State, type ControllerTimelockV3StateHuman, type CoreState, type CoreStateHuman, type CreditAccountData, type CreditAccountFilter, CreditAccountsService, CreditConfiguratorContract, type CreditConfiguratorState, type CreditConfiguratorStateHuman, CreditFacadeContract, type CreditFacadeState, type CreditFacadeStateHuman, CreditFactory, type CreditFactoryState, type CreditFactoryStateHuman, CreditManagerContract, type CreditManagerData, type CreditManagerDebtParams, type CreditManagerDebtParamsHuman, type CreditManagerDebtParamsStruct, type CreditManagerState, type CreditManagerStateHuman, CurveCryptoPriceFeedContract, type CurvePoolStruct, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, type DataCompressorV3State, type DegenDistributorState, type DegenDistributorStateHuman, type DegenNFT2State, type DegenNFT2StateHuman, Erc4626PriceFeedContract, type EtherscanURLParam, type FindClosePathInput, GaugeContract, type GaugeParams, type GaugeParamsHuman, type GaugeState, type GaugeStateHuman, GearStakingContract, type GearStakingV3State, type GearStakingV3StateHuman, GearboxSDK, type GearboxState, type GearboxStateHuman, type ILPPriceFeedContract, type ILogger, type IPriceFeedContract, LinearModelContract, type LinearModelState, type LinearModelStateHuman, type LogFn, MAX_UINT256, MIN_INT96, type MarketData, MarketFactory, MarketRegister, type MarketState, type MarketStateHuman, MellowLRTPriceFeedContract, type MultiCall, type MultiPauseState, type MulticallErrorType, type MulticallParameters, type MulticallReturnType, NOT_DEPLOYED, NO_VERSION, type NetworkType, type OnDemandPriceUpdate, type OpenStrategyResult, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, type PathOption, type PathOptionSerie, type PeripheryState, type PeripheryStateHuman, type PolicyStruct, type PolicyStructHuman, PoolContract, type PoolData, PoolFactory, type PoolFactoryState, type PoolFactoryStateHuman, PoolQuotaKeeperContract, type PoolQuotaKeeperData, type PoolQuotaKeeperState, type PoolQuotaKeeperStateHuman, type PoolState, type PoolStateHuman, type PriceFactoryStateHuman, type PriceFeedConstructorArgs, type PriceFeedContractType, type PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, type PriceFeedRegisterHooks, type PriceFeedState, type PriceFeedStateHuman, type PriceFeedTreeNode, type PriceFeedUsageType, PriceOracleContract, type PriceOracleData, type PriceOracleState, type PriceOracleV3State, type PriceOracleV3StateHuman, Provider, type ProviderOptions, type QuotaParams, type QuotaParamsHuman, RAY, RAY_DECIMALS_POW, type RateKeeperData, type RawTx,
|
|
17375
|
+
export { type ACLState, type ACLStateHuman, ADDRESS_0X0, ADDRESS_PROVIDER, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DEGEN_DISTRIBUTOR, AP_DEGEN_NFT, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, type AccountFactoryStateHuman, AddressLabeller, AddressMap, AddressProviderContractV3_1, type AddressProviderV3State, type AddressProviderV3StateHuman, type Asset, type AssetPriceFeedState, type AssetPriceFeedStateHuman, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, BaseContract, type BaseContractOptions, type BaseContractState, type BaseContractStateHuman, type BasePriceFeedState, type BasePriceFeedStateHuman, BotListContract, type BotListState, type BotListStateHuman, BotPermissions, type BoundedOracleState, type BoundedOracleStateHuman, BoundedPriceFeedContract, ChainlinkPriceFeedContract, CompositePriceFeedContract, type ContractMethod, type ContractsRegisterState, type ContractsRegisterStateHuman, type ControllerTimelockV3State, type ControllerTimelockV3StateHuman, type CoreState, type CoreStateHuman, type CreditAccountData, type CreditAccountFilter, CreditAccountsService, CreditConfiguratorContract, type CreditConfiguratorState, type CreditConfiguratorStateHuman, CreditFacadeContract, type CreditFacadeState, type CreditFacadeStateHuman, CreditFactory, type CreditFactoryState, type CreditFactoryStateHuman, CreditManagerContract, type CreditManagerData, type CreditManagerDebtParams, type CreditManagerDebtParamsHuman, type CreditManagerDebtParamsStruct, type CreditManagerState, type CreditManagerStateHuman, CurveCryptoPriceFeedContract, type CurvePoolStruct, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, type DataCompressorV3State, type DegenDistributorState, type DegenDistributorStateHuman, type DegenNFT2State, type DegenNFT2StateHuman, Erc4626PriceFeedContract, type EtherscanURLParam, type FindClosePathInput, GaugeContract, type GaugeParams, type GaugeParamsHuman, type GaugeState, type GaugeStateHuman, GearStakingContract, type GearStakingV3State, type GearStakingV3StateHuman, GearboxSDK, type GearboxState, type GearboxStateHuman, type ILPPriceFeedContract, type ILogger, type IPriceFeedContract, LinearModelContract, type LinearModelState, type LinearModelStateHuman, type LogFn, MAX_UINT256, MIN_INT96, type MarketData, MarketFactory, MarketRegister, type MarketState, type MarketStateHuman, MellowLRTPriceFeedContract, type MultiCall, type MultiPauseState, type MulticallErrorType, type MulticallParameters, type MulticallReturnType, NOT_DEPLOYED, NO_VERSION, type NetworkType, type OnDemandPriceUpdate, type OpenStrategyResult, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, type PathOption, type PathOptionSerie, type PeripheryState, type PeripheryStateHuman, type PolicyStruct, type PolicyStructHuman, PoolContract, type PoolData, PoolFactory, type PoolFactoryState, type PoolFactoryStateHuman, PoolQuotaKeeperContract, type PoolQuotaKeeperData, type PoolQuotaKeeperState, type PoolQuotaKeeperStateHuman, type PoolState, type PoolStateHuman, type PriceFactoryStateHuman, type PriceFeedConstructorArgs, type PriceFeedContractType, type PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, type PriceFeedRegisterHooks, type PriceFeedState, type PriceFeedStateHuman, type PriceFeedTreeNode, type PriceFeedUsageType, PriceOracleContract, type PriceOracleData, type PriceOracleState, type PriceOracleV3State, type PriceOracleV3StateHuman, Provider, type ProviderOptions, type QuotaParams, type QuotaParamsHuman, RAY, RAY_DECIMALS_POW, type RateKeeperData, type RawTx, RedstonePriceFeedContract, type RedstonePriceFeedState, type RedstonePriceFeedStateHuman, type RouterCloseResult, type RouterComponentRegisterHuman, type RouterHooks, type RouterResult, type RouterState, type RouterStateHuman, RouterV3Contract, type RouterV3ContractState, type RouterV3ContractStateHuman, type SDKAttachOptions, SDKConstruct, SUPPORTED_CHAINS, type SwapOperation, type SwapTask, TIMELOCK, type TVL, type TokenMetaData, type TokenTypeToResolverHuman, USDC, type UpdatePriceFeedsResult, VotingContractStatus, WAD, WAD_DECIMALS_POW, WstETHPriceFeedContract, YearnPriceFeedContract, type ZapperInfo, type ZapperInfoHuman, type ZapperRegisterState, type ZapperRegisterStateHuman, ZeroPriceFeedContract, botPermissionsToString, bytes32ToString, chains, childLogger, convertBaseContractState, convertCoreStateToHuman, convertCreditFactoryStateToHuman, convertGaugeStateToHuman, convertGearboxStateToHuman, convertGearboxStateToHumanLA, convertLinearModelStateToHuman, convertPeripheryStateToHuman, convertPoolFactoryStateToHuman, convertPoolQuotaKeeperStateToHuman, convertPoolStateToHuman, convertPriceFeedStateToHuman, convertPriceOracleStateToHuman, convertRouterStateToHuman, convertRouterV3StateToHuman, convertZapperRegisterStateToHuman, createRawTx, detectNetwork, etherscanUrl, filterDust, fmtBinaryMask, formatBN, formatBNvalue, formatBn4dig, formatDuration, formatNumberToString_, halfRAY, json_parse, json_stringify, numberWithCommas, percentFmt, simulateMulticall, toHumanFormat };
|
package/dist/esm/sdk/index.mjs
CHANGED
|
@@ -13368,17 +13368,14 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
13368
13368
|
* @param account
|
|
13369
13369
|
* @returns
|
|
13370
13370
|
*/
|
|
13371
|
-
async getCreditAccountData(account
|
|
13372
|
-
const blockNumber = options?.blockNumber;
|
|
13371
|
+
async getCreditAccountData(account) {
|
|
13373
13372
|
let raw;
|
|
13374
13373
|
try {
|
|
13375
13374
|
raw = await this.provider.publicClient.readContract({
|
|
13376
13375
|
abi: iCreditAccountCompressorAbi,
|
|
13377
13376
|
address: this.#compressor,
|
|
13378
13377
|
functionName: "getCreditAccountData",
|
|
13379
|
-
args: [account]
|
|
13380
|
-
blockNumber
|
|
13381
|
-
// TODO: we should cache price updates for block to speed up optimistic liquidator
|
|
13378
|
+
args: [account]
|
|
13382
13379
|
});
|
|
13383
13380
|
} catch (e) {
|
|
13384
13381
|
return void 0;
|
|
@@ -13400,9 +13397,8 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
13400
13397
|
],
|
|
13401
13398
|
allowFailure: false,
|
|
13402
13399
|
gas: 550000000n,
|
|
13403
|
-
batchSize: 0
|
|
13400
|
+
batchSize: 0
|
|
13404
13401
|
// we cannot have price updates and compressor request in different batches
|
|
13405
|
-
blockNumber
|
|
13406
13402
|
});
|
|
13407
13403
|
const cad = resp.pop();
|
|
13408
13404
|
return cad;
|
|
@@ -13417,7 +13413,7 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
13417
13413
|
* @param args
|
|
13418
13414
|
* @returns returned credit accounts are sorted by health factor in ascending order
|
|
13419
13415
|
*/
|
|
13420
|
-
async getCreditAccounts(args
|
|
13416
|
+
async getCreditAccounts(args) {
|
|
13421
13417
|
const {
|
|
13422
13418
|
creditManager,
|
|
13423
13419
|
includeZeroDebt = false,
|
|
@@ -13444,8 +13440,7 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
13444
13440
|
do {
|
|
13445
13441
|
const [accounts, newOffset] = await this.#getCreditAccounts(
|
|
13446
13442
|
[arg0, { ...caFilter, reverting }, offset],
|
|
13447
|
-
priceUpdateTxs
|
|
13448
|
-
options
|
|
13443
|
+
priceUpdateTxs
|
|
13449
13444
|
);
|
|
13450
13445
|
allCAs.push(...accounts);
|
|
13451
13446
|
offset = newOffset;
|
|
@@ -13512,10 +13507,11 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
13512
13507
|
}
|
|
13513
13508
|
/**
|
|
13514
13509
|
* Internal wrapper for CreditAccountCompressor.getCreditAccounts + price updates wrapped into multicall
|
|
13515
|
-
* @param
|
|
13510
|
+
* @param args
|
|
13511
|
+
* @param priceUpdateTxs
|
|
13516
13512
|
* @returns
|
|
13517
13513
|
*/
|
|
13518
|
-
async #getCreditAccounts(args, priceUpdateTxs
|
|
13514
|
+
async #getCreditAccounts(args, priceUpdateTxs) {
|
|
13519
13515
|
if (priceUpdateTxs?.length) {
|
|
13520
13516
|
const resp = await simulateMulticall(this.provider.publicClient, {
|
|
13521
13517
|
account: this.provider.account,
|
|
@@ -13530,9 +13526,8 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
13530
13526
|
],
|
|
13531
13527
|
allowFailure: false,
|
|
13532
13528
|
gas: 550000000n,
|
|
13533
|
-
batchSize: 0
|
|
13529
|
+
batchSize: 0
|
|
13534
13530
|
// we cannot have price updates and compressor request in different batches
|
|
13535
|
-
blockNumber: options?.blockNumber
|
|
13536
13531
|
});
|
|
13537
13532
|
const getCreditAccountsResp = resp.pop();
|
|
13538
13533
|
return getCreditAccountsResp;
|
|
@@ -13541,8 +13536,7 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
13541
13536
|
abi: iCreditAccountCompressorAbi,
|
|
13542
13537
|
address: this.#compressor,
|
|
13543
13538
|
functionName: "getCreditAccounts",
|
|
13544
|
-
args
|
|
13545
|
-
blockNumber: options?.blockNumber
|
|
13539
|
+
args
|
|
13546
13540
|
});
|
|
13547
13541
|
}
|
|
13548
13542
|
/**
|
|
@@ -13550,7 +13544,7 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
13550
13544
|
* @param accounts
|
|
13551
13545
|
* @returns
|
|
13552
13546
|
*/
|
|
13553
|
-
async getUpdateForAccounts(accounts
|
|
13547
|
+
async getUpdateForAccounts(accounts) {
|
|
13554
13548
|
const tokensByPool = /* @__PURE__ */ new Map();
|
|
13555
13549
|
const oracleByPool = /* @__PURE__ */ new Map();
|
|
13556
13550
|
for (const acc of accounts) {
|
|
@@ -13577,25 +13571,23 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
13577
13571
|
/**
|
|
13578
13572
|
* Returns account price updates in a non-encoded format
|
|
13579
13573
|
* @param acc
|
|
13580
|
-
* @param blockNumber
|
|
13581
13574
|
* @returns
|
|
13582
13575
|
*/
|
|
13583
|
-
async getOnDemandPriceUpdates(acc
|
|
13576
|
+
async getOnDemandPriceUpdates(acc) {
|
|
13584
13577
|
const market = this.sdk.marketRegister.findByCreditManager(
|
|
13585
13578
|
acc.creditManager
|
|
13586
13579
|
);
|
|
13587
|
-
const update = await this.getUpdateForAccounts([acc]
|
|
13580
|
+
const update = await this.getUpdateForAccounts([acc]);
|
|
13588
13581
|
return market.priceOracle.onDemandPriceUpdates(update);
|
|
13589
13582
|
}
|
|
13590
13583
|
/**
|
|
13591
13584
|
* Returns price updates in format that is accepted by various credit facade methods (multicall, close/liquidate, etc...)
|
|
13592
13585
|
* @param acc
|
|
13593
|
-
* @param blockNumber
|
|
13594
13586
|
* @returns
|
|
13595
13587
|
*/
|
|
13596
|
-
async getPriceUpdatesForFacade(acc
|
|
13588
|
+
async getPriceUpdatesForFacade(acc) {
|
|
13597
13589
|
const cm = this.sdk.marketRegister.findCreditManager(acc.creditManager);
|
|
13598
|
-
const updates = await this.getOnDemandPriceUpdates(acc
|
|
13590
|
+
const updates = await this.getOnDemandPriceUpdates(acc);
|
|
13599
13591
|
return updates.map(({ token, reserve, data }) => ({
|
|
13600
13592
|
target: cm.creditFacade.address,
|
|
13601
13593
|
callData: encodeFunctionData({
|
|
@@ -15420,7 +15412,7 @@ var MarketFactory = class {
|
|
|
15420
15412
|
this.priceOracle = new PriceOracleContract(
|
|
15421
15413
|
sdk,
|
|
15422
15414
|
marketData.priceOracleData,
|
|
15423
|
-
marketData.underlying
|
|
15415
|
+
marketData.pool.underlying
|
|
15424
15416
|
);
|
|
15425
15417
|
}
|
|
15426
15418
|
get state() {
|