@gearbox-protocol/sdk 3.0.0-vfour.60 → 3.0.0-vfour.62
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 +28 -4
- package/dist/cjs/sdk/index.d.ts +9 -3
- package/dist/esm/sdk/index.d.mts +9 -3
- package/dist/esm/sdk/index.mjs +28 -5
- package/package.json +1 -1
package/dist/cjs/sdk/index.cjs
CHANGED
|
@@ -19097,6 +19097,12 @@ var ADDRESS_PROVIDER = {
|
|
|
19097
19097
|
Optimism: "0x3761ca4BFAcFCFFc1B8034e69F19116dD6756726",
|
|
19098
19098
|
Base: NOT_DEPLOYED
|
|
19099
19099
|
};
|
|
19100
|
+
var ADDRESS_PROVIDER_BLOCK = {
|
|
19101
|
+
Mainnet: 18433056n,
|
|
19102
|
+
Arbitrum: 184650310n,
|
|
19103
|
+
Optimism: 118410666n,
|
|
19104
|
+
Base: 0n
|
|
19105
|
+
};
|
|
19100
19106
|
|
|
19101
19107
|
// src/sdk/constants/bot-permissions.ts
|
|
19102
19108
|
var BotPermissions = /* @__PURE__ */ ((BotPermissions2) => {
|
|
@@ -19622,6 +19628,13 @@ var TokensMeta = class extends AddressMap {
|
|
|
19622
19628
|
findBySymbol(symbol) {
|
|
19623
19629
|
return this.values().find((v) => v.symbol === symbol);
|
|
19624
19630
|
}
|
|
19631
|
+
mustFindBySymbol(symbol) {
|
|
19632
|
+
const meta = this.findBySymbol(symbol);
|
|
19633
|
+
if (!meta) {
|
|
19634
|
+
throw new Error(`cannot find token meta for symbol '${symbol}'`);
|
|
19635
|
+
}
|
|
19636
|
+
return meta;
|
|
19637
|
+
}
|
|
19625
19638
|
};
|
|
19626
19639
|
|
|
19627
19640
|
// src/sdk/base/types.ts
|
|
@@ -22479,9 +22492,11 @@ var AddressProviderContractV3_1 = class extends BaseContract {
|
|
|
22479
22492
|
|
|
22480
22493
|
// src/sdk/core/BotListV3Contract.ts
|
|
22481
22494
|
var BotListContract = class extends BaseContract {
|
|
22482
|
-
approvedCreditManagers
|
|
22495
|
+
#approvedCreditManagers;
|
|
22496
|
+
#currentBlock;
|
|
22483
22497
|
constructor(sdk, address) {
|
|
22484
22498
|
super(sdk, { addr: address, name: "BotListV3", abi: botListV3Abi });
|
|
22499
|
+
this.#currentBlock = ADDRESS_PROVIDER_BLOCK[sdk.provider.networkType];
|
|
22485
22500
|
}
|
|
22486
22501
|
parseFunctionParams(params) {
|
|
22487
22502
|
switch (params.functionName) {
|
|
@@ -22501,14 +22516,15 @@ var BotListContract = class extends BaseContract {
|
|
|
22501
22516
|
return void 0;
|
|
22502
22517
|
}
|
|
22503
22518
|
}
|
|
22504
|
-
async
|
|
22519
|
+
async syncState(toBlock) {
|
|
22505
22520
|
const logs = await this.provider.publicClient.getContractEvents({
|
|
22506
22521
|
address: this.address,
|
|
22507
22522
|
abi: this.abi,
|
|
22508
|
-
fromBlock:
|
|
22523
|
+
fromBlock: this.#currentBlock,
|
|
22509
22524
|
toBlock
|
|
22510
22525
|
});
|
|
22511
22526
|
logs.forEach((e) => this.processLog(e));
|
|
22527
|
+
this.#currentBlock = toBlock;
|
|
22512
22528
|
}
|
|
22513
22529
|
processLog(log) {
|
|
22514
22530
|
switch (log.eventName) {
|
|
@@ -22531,6 +22547,14 @@ var BotListContract = class extends BaseContract {
|
|
|
22531
22547
|
break;
|
|
22532
22548
|
}
|
|
22533
22549
|
}
|
|
22550
|
+
get approvedCreditManagers() {
|
|
22551
|
+
if (!this.#approvedCreditManagers) {
|
|
22552
|
+
throw new Error(
|
|
22553
|
+
"BotListContract state needs to be synced to load approvedCreditManagers"
|
|
22554
|
+
);
|
|
22555
|
+
}
|
|
22556
|
+
return this.#approvedCreditManagers;
|
|
22557
|
+
}
|
|
22534
22558
|
stateHuman(raw = true) {
|
|
22535
22559
|
return super.stateHuman(raw);
|
|
22536
22560
|
}
|
|
@@ -22975,7 +22999,6 @@ var GearboxSDK = class _GearboxSDK {
|
|
|
22975
22999
|
await this.#addressProvider.fetchState(this.currentBlock);
|
|
22976
23000
|
const botListAddress = this.#addressProvider.getAddress(AP_BOT_LIST, 300);
|
|
22977
23001
|
this.#botListContract = new BotListContract(this, botListAddress);
|
|
22978
|
-
await this.#botListContract.fetchState(this.currentBlock);
|
|
22979
23002
|
this.#gear = this.#addressProvider.getAddress(AP_GEAR_TOKEN);
|
|
22980
23003
|
const gearStakingAddress = this.#addressProvider.getAddress(
|
|
22981
23004
|
AP_GEAR_STAKING,
|
|
@@ -23134,6 +23157,7 @@ var GearboxSDK = class _GearboxSDK {
|
|
|
23134
23157
|
|
|
23135
23158
|
exports.ADDRESS_0X0 = ADDRESS_0X0;
|
|
23136
23159
|
exports.ADDRESS_PROVIDER = ADDRESS_PROVIDER;
|
|
23160
|
+
exports.ADDRESS_PROVIDER_BLOCK = ADDRESS_PROVIDER_BLOCK;
|
|
23137
23161
|
exports.AP_ACCOUNT_FACTORY = AP_ACCOUNT_FACTORY;
|
|
23138
23162
|
exports.AP_ACL = AP_ACL;
|
|
23139
23163
|
exports.AP_ADAPTER_COMPRESSOR = AP_ADAPTER_COMPRESSOR;
|
package/dist/cjs/sdk/index.d.ts
CHANGED
|
@@ -24433,11 +24433,12 @@ declare class AddressProviderContractV3_1 extends BaseContract<abi$3> {
|
|
|
24433
24433
|
|
|
24434
24434
|
type abi$2 = typeof botListV3Abi;
|
|
24435
24435
|
declare class BotListContract extends BaseContract<abi$2> {
|
|
24436
|
-
|
|
24436
|
+
#private;
|
|
24437
24437
|
constructor(sdk: GearboxSDK, address: Address);
|
|
24438
24438
|
parseFunctionParams(params: DecodeFunctionDataReturnType<abi$2>): Array<string> | undefined;
|
|
24439
|
-
|
|
24439
|
+
syncState(toBlock: bigint): Promise<void>;
|
|
24440
24440
|
processLog(log: Log<bigint, number, false, undefined, undefined, abi$2, ContractEventName<abi$2>>): void;
|
|
24441
|
+
get approvedCreditManagers(): Set<Address>;
|
|
24441
24442
|
stateHuman(raw?: boolean): BotListStateHuman;
|
|
24442
24443
|
}
|
|
24443
24444
|
|
|
@@ -24752,6 +24753,7 @@ declare class TokensMeta extends AddressMap<TokenMetaData> {
|
|
|
24752
24753
|
symbol(token: Address): string;
|
|
24753
24754
|
decimals(token: Address): number;
|
|
24754
24755
|
findBySymbol(symbol: string): TokenMetaData | undefined;
|
|
24756
|
+
mustFindBySymbol(symbol: string): TokenMetaData;
|
|
24755
24757
|
}
|
|
24756
24758
|
|
|
24757
24759
|
interface ReadContractOptions {
|
|
@@ -24860,6 +24862,10 @@ declare const AP_DELEVERAGE_BOT_PEGGED = "DELEVERAGE_BOT_PEGGED";
|
|
|
24860
24862
|
declare const AP_DELEVERAGE_BOT_LV = "DELEVERAGE_BOT_LV";
|
|
24861
24863
|
declare const AP_DELEVERAGE_BOT_HV = "DELEVERAGE_BOT_HV";
|
|
24862
24864
|
declare const ADDRESS_PROVIDER: Record<NetworkType, Address>;
|
|
24865
|
+
/**
|
|
24866
|
+
* Block number when address provider was deployed
|
|
24867
|
+
*/
|
|
24868
|
+
declare const ADDRESS_PROVIDER_BLOCK: Record<NetworkType, bigint>;
|
|
24863
24869
|
|
|
24864
24870
|
/**
|
|
24865
24871
|
* Address 0x0000000000000000000000000000000000000000
|
|
@@ -24932,4 +24938,4 @@ type MulticallErrorType = GetChainContractAddressErrorType | ReadContractErrorTy
|
|
|
24932
24938
|
*/
|
|
24933
24939
|
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>>;
|
|
24934
24940
|
|
|
24935
|
-
export { ADDRESS_0X0, ADDRESS_PROVIDER, AP_ACCOUNT_FACTORY, AP_ACL, AP_ADAPTER_COMPRESSOR, 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_MARKET_CONFIGURATOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, type AdapterContractType, type AdapterData, AddressLabeller, AddressMap, AddressProviderContractV3_1, type AddressProviderV3StateHuman, type Asset, type AssetPriceFeedStateHuman, BalancerStablePriceFeedContract, BalancerV2VaultAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, type BaseContractOptions, type BaseContractStateHuman, type BaseParams, type BasePriceFeedStateHuman, BotListContract, type BotListStateHuman, BotPermissions, type BoundedOracleStateHuman, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainlinkPriceFeedContract, CompositePriceFeedContract, type ConnectionOptions, type ContractMethod, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, type CoreStateHuman, type CreditAccountData, type CreditAccountFilter, CreditAccountsService, CreditConfiguratorContract, type CreditConfiguratorState, type CreditConfiguratorStateHuman, type CreditFacadeState, type CreditFacadeStateHuman, CreditFacadeV300Contract, CreditFacadeV310Contract, CreditFactory, type CreditFactoryStateHuman, CreditManagerContract, type CreditManagerData, type CreditManagerDebtParams, type CreditManagerDebtParamsHuman, type CreditManagerState, type CreditManagerStateHuman, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, type CurvePoolStruct, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1AdapterStableNGContract, ERC4626AdapterContract, Erc4626PriceFeedContract, type EtherscanURLParam, type FindClosePathInput, GaugeContract, type GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, GearStakingContract, type GearStakingV3StateHuman, GearboxSDK, type GearboxStateHuman, type IAdapterContract, type IBaseContract, type ILPPriceFeedContract, type ILogger, type IPriceFeedContract, LinearModelContract, type LinearModelStateHuman, type LogFn, MAX_UINT16, MAX_UINT256, MIN_INT96, type MarketData, MarketFactory, MarketRegister, type MarketStateHuman, MellowLRTPriceFeedContract, type MultiCall, type MulticallErrorType, type MulticallParameters, type MulticallReturnType, NOT_DEPLOYED, NO_VERSION, type NetworkOptions, type NetworkType, type OnDemandPriceUpdate, type OpenStrategyResult, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, type PathOption, type PathOptionSerie, PoolContract, type PoolData, PoolFactory, type PoolFactoryStateHuman, PoolQuotaKeeperContract, type PoolQuotaKeeperData, type PoolQuotaKeeperStateHuman, type PoolStateHuman, type PriceFeedConstructorArgs, type PriceFeedContractType, type PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, type PriceFeedRegisterHooks, type PriceFeedStateHuman, type PriceFeedTreeNode, type PriceFeedUsageType, PriceOracleContract, type PriceOracleData, type PriceOracleV3StateHuman, Provider, type QuotaParamsHuman, type QuotaState, RAY, RAY_DECIMALS_POW, type RateKeeperData, type RawTx, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, type RouterCloseResult, type RouterHooks, type RouterResult, RouterV3Contract, SDKConstruct, type SDKOptions, SUPPORTED_CHAINS, type SwapOperation, type SwapTask, type SyncStateOptions, TIMELOCK, type TVL, type TokenMetaData, TokensMeta, type TransportOptions, USDC, UniswapV2AdapterContract, UniswapV3AdapterContract, type UpdatePriceFeedsResult, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, YearnV2RouterAdapterContract, ZeroPriceFeedContract, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createRawTx, createTransport, detectNetwork, etherscanUrl, filterDust, fmtBinaryMask, formatBN, formatBNvalue, formatBn4dig, formatDuration, formatNumberToString_, halfRAY, json_parse, json_stringify, numberWithCommas, percentFmt, rawTxToMulticallPriceUpdate, simulateMulticall, toHumanFormat };
|
|
24941
|
+
export { ADDRESS_0X0, ADDRESS_PROVIDER, ADDRESS_PROVIDER_BLOCK, AP_ACCOUNT_FACTORY, AP_ACL, AP_ADAPTER_COMPRESSOR, 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_MARKET_CONFIGURATOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, type AdapterContractType, type AdapterData, AddressLabeller, AddressMap, AddressProviderContractV3_1, type AddressProviderV3StateHuman, type Asset, type AssetPriceFeedStateHuman, BalancerStablePriceFeedContract, BalancerV2VaultAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, type BaseContractOptions, type BaseContractStateHuman, type BaseParams, type BasePriceFeedStateHuman, BotListContract, type BotListStateHuman, BotPermissions, type BoundedOracleStateHuman, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainlinkPriceFeedContract, CompositePriceFeedContract, type ConnectionOptions, type ContractMethod, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, type CoreStateHuman, type CreditAccountData, type CreditAccountFilter, CreditAccountsService, CreditConfiguratorContract, type CreditConfiguratorState, type CreditConfiguratorStateHuman, type CreditFacadeState, type CreditFacadeStateHuman, CreditFacadeV300Contract, CreditFacadeV310Contract, CreditFactory, type CreditFactoryStateHuman, CreditManagerContract, type CreditManagerData, type CreditManagerDebtParams, type CreditManagerDebtParamsHuman, type CreditManagerState, type CreditManagerStateHuman, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, type CurvePoolStruct, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1AdapterStableNGContract, ERC4626AdapterContract, Erc4626PriceFeedContract, type EtherscanURLParam, type FindClosePathInput, GaugeContract, type GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, GearStakingContract, type GearStakingV3StateHuman, GearboxSDK, type GearboxStateHuman, type IAdapterContract, type IBaseContract, type ILPPriceFeedContract, type ILogger, type IPriceFeedContract, LinearModelContract, type LinearModelStateHuman, type LogFn, MAX_UINT16, MAX_UINT256, MIN_INT96, type MarketData, MarketFactory, MarketRegister, type MarketStateHuman, MellowLRTPriceFeedContract, type MultiCall, type MulticallErrorType, type MulticallParameters, type MulticallReturnType, NOT_DEPLOYED, NO_VERSION, type NetworkOptions, type NetworkType, type OnDemandPriceUpdate, type OpenStrategyResult, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, type PathOption, type PathOptionSerie, PoolContract, type PoolData, PoolFactory, type PoolFactoryStateHuman, PoolQuotaKeeperContract, type PoolQuotaKeeperData, type PoolQuotaKeeperStateHuman, type PoolStateHuman, type PriceFeedConstructorArgs, type PriceFeedContractType, type PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, type PriceFeedRegisterHooks, type PriceFeedStateHuman, type PriceFeedTreeNode, type PriceFeedUsageType, PriceOracleContract, type PriceOracleData, type PriceOracleV3StateHuman, Provider, type QuotaParamsHuman, type QuotaState, RAY, RAY_DECIMALS_POW, type RateKeeperData, type RawTx, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, type RouterCloseResult, type RouterHooks, type RouterResult, RouterV3Contract, SDKConstruct, type SDKOptions, SUPPORTED_CHAINS, type SwapOperation, type SwapTask, type SyncStateOptions, TIMELOCK, type TVL, type TokenMetaData, TokensMeta, type TransportOptions, USDC, UniswapV2AdapterContract, UniswapV3AdapterContract, type UpdatePriceFeedsResult, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, YearnV2RouterAdapterContract, ZeroPriceFeedContract, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createRawTx, createTransport, detectNetwork, etherscanUrl, filterDust, fmtBinaryMask, formatBN, formatBNvalue, formatBn4dig, formatDuration, formatNumberToString_, halfRAY, json_parse, json_stringify, numberWithCommas, percentFmt, rawTxToMulticallPriceUpdate, simulateMulticall, toHumanFormat };
|
package/dist/esm/sdk/index.d.mts
CHANGED
|
@@ -24433,11 +24433,12 @@ declare class AddressProviderContractV3_1 extends BaseContract<abi$3> {
|
|
|
24433
24433
|
|
|
24434
24434
|
type abi$2 = typeof botListV3Abi;
|
|
24435
24435
|
declare class BotListContract extends BaseContract<abi$2> {
|
|
24436
|
-
|
|
24436
|
+
#private;
|
|
24437
24437
|
constructor(sdk: GearboxSDK, address: Address);
|
|
24438
24438
|
parseFunctionParams(params: DecodeFunctionDataReturnType<abi$2>): Array<string> | undefined;
|
|
24439
|
-
|
|
24439
|
+
syncState(toBlock: bigint): Promise<void>;
|
|
24440
24440
|
processLog(log: Log<bigint, number, false, undefined, undefined, abi$2, ContractEventName<abi$2>>): void;
|
|
24441
|
+
get approvedCreditManagers(): Set<Address>;
|
|
24441
24442
|
stateHuman(raw?: boolean): BotListStateHuman;
|
|
24442
24443
|
}
|
|
24443
24444
|
|
|
@@ -24752,6 +24753,7 @@ declare class TokensMeta extends AddressMap<TokenMetaData> {
|
|
|
24752
24753
|
symbol(token: Address): string;
|
|
24753
24754
|
decimals(token: Address): number;
|
|
24754
24755
|
findBySymbol(symbol: string): TokenMetaData | undefined;
|
|
24756
|
+
mustFindBySymbol(symbol: string): TokenMetaData;
|
|
24755
24757
|
}
|
|
24756
24758
|
|
|
24757
24759
|
interface ReadContractOptions {
|
|
@@ -24860,6 +24862,10 @@ declare const AP_DELEVERAGE_BOT_PEGGED = "DELEVERAGE_BOT_PEGGED";
|
|
|
24860
24862
|
declare const AP_DELEVERAGE_BOT_LV = "DELEVERAGE_BOT_LV";
|
|
24861
24863
|
declare const AP_DELEVERAGE_BOT_HV = "DELEVERAGE_BOT_HV";
|
|
24862
24864
|
declare const ADDRESS_PROVIDER: Record<NetworkType, Address>;
|
|
24865
|
+
/**
|
|
24866
|
+
* Block number when address provider was deployed
|
|
24867
|
+
*/
|
|
24868
|
+
declare const ADDRESS_PROVIDER_BLOCK: Record<NetworkType, bigint>;
|
|
24863
24869
|
|
|
24864
24870
|
/**
|
|
24865
24871
|
* Address 0x0000000000000000000000000000000000000000
|
|
@@ -24932,4 +24938,4 @@ type MulticallErrorType = GetChainContractAddressErrorType | ReadContractErrorTy
|
|
|
24932
24938
|
*/
|
|
24933
24939
|
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>>;
|
|
24934
24940
|
|
|
24935
|
-
export { ADDRESS_0X0, ADDRESS_PROVIDER, AP_ACCOUNT_FACTORY, AP_ACL, AP_ADAPTER_COMPRESSOR, 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_MARKET_CONFIGURATOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, type AdapterContractType, type AdapterData, AddressLabeller, AddressMap, AddressProviderContractV3_1, type AddressProviderV3StateHuman, type Asset, type AssetPriceFeedStateHuman, BalancerStablePriceFeedContract, BalancerV2VaultAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, type BaseContractOptions, type BaseContractStateHuman, type BaseParams, type BasePriceFeedStateHuman, BotListContract, type BotListStateHuman, BotPermissions, type BoundedOracleStateHuman, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainlinkPriceFeedContract, CompositePriceFeedContract, type ConnectionOptions, type ContractMethod, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, type CoreStateHuman, type CreditAccountData, type CreditAccountFilter, CreditAccountsService, CreditConfiguratorContract, type CreditConfiguratorState, type CreditConfiguratorStateHuman, type CreditFacadeState, type CreditFacadeStateHuman, CreditFacadeV300Contract, CreditFacadeV310Contract, CreditFactory, type CreditFactoryStateHuman, CreditManagerContract, type CreditManagerData, type CreditManagerDebtParams, type CreditManagerDebtParamsHuman, type CreditManagerState, type CreditManagerStateHuman, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, type CurvePoolStruct, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1AdapterStableNGContract, ERC4626AdapterContract, Erc4626PriceFeedContract, type EtherscanURLParam, type FindClosePathInput, GaugeContract, type GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, GearStakingContract, type GearStakingV3StateHuman, GearboxSDK, type GearboxStateHuman, type IAdapterContract, type IBaseContract, type ILPPriceFeedContract, type ILogger, type IPriceFeedContract, LinearModelContract, type LinearModelStateHuman, type LogFn, MAX_UINT16, MAX_UINT256, MIN_INT96, type MarketData, MarketFactory, MarketRegister, type MarketStateHuman, MellowLRTPriceFeedContract, type MultiCall, type MulticallErrorType, type MulticallParameters, type MulticallReturnType, NOT_DEPLOYED, NO_VERSION, type NetworkOptions, type NetworkType, type OnDemandPriceUpdate, type OpenStrategyResult, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, type PathOption, type PathOptionSerie, PoolContract, type PoolData, PoolFactory, type PoolFactoryStateHuman, PoolQuotaKeeperContract, type PoolQuotaKeeperData, type PoolQuotaKeeperStateHuman, type PoolStateHuman, type PriceFeedConstructorArgs, type PriceFeedContractType, type PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, type PriceFeedRegisterHooks, type PriceFeedStateHuman, type PriceFeedTreeNode, type PriceFeedUsageType, PriceOracleContract, type PriceOracleData, type PriceOracleV3StateHuman, Provider, type QuotaParamsHuman, type QuotaState, RAY, RAY_DECIMALS_POW, type RateKeeperData, type RawTx, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, type RouterCloseResult, type RouterHooks, type RouterResult, RouterV3Contract, SDKConstruct, type SDKOptions, SUPPORTED_CHAINS, type SwapOperation, type SwapTask, type SyncStateOptions, TIMELOCK, type TVL, type TokenMetaData, TokensMeta, type TransportOptions, USDC, UniswapV2AdapterContract, UniswapV3AdapterContract, type UpdatePriceFeedsResult, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, YearnV2RouterAdapterContract, ZeroPriceFeedContract, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createRawTx, createTransport, detectNetwork, etherscanUrl, filterDust, fmtBinaryMask, formatBN, formatBNvalue, formatBn4dig, formatDuration, formatNumberToString_, halfRAY, json_parse, json_stringify, numberWithCommas, percentFmt, rawTxToMulticallPriceUpdate, simulateMulticall, toHumanFormat };
|
|
24941
|
+
export { ADDRESS_0X0, ADDRESS_PROVIDER, ADDRESS_PROVIDER_BLOCK, AP_ACCOUNT_FACTORY, AP_ACL, AP_ADAPTER_COMPRESSOR, 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_MARKET_CONFIGURATOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, type AdapterContractType, type AdapterData, AddressLabeller, AddressMap, AddressProviderContractV3_1, type AddressProviderV3StateHuman, type Asset, type AssetPriceFeedStateHuman, BalancerStablePriceFeedContract, BalancerV2VaultAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, type BaseContractOptions, type BaseContractStateHuman, type BaseParams, type BasePriceFeedStateHuman, BotListContract, type BotListStateHuman, BotPermissions, type BoundedOracleStateHuman, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainlinkPriceFeedContract, CompositePriceFeedContract, type ConnectionOptions, type ContractMethod, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, type CoreStateHuman, type CreditAccountData, type CreditAccountFilter, CreditAccountsService, CreditConfiguratorContract, type CreditConfiguratorState, type CreditConfiguratorStateHuman, type CreditFacadeState, type CreditFacadeStateHuman, CreditFacadeV300Contract, CreditFacadeV310Contract, CreditFactory, type CreditFactoryStateHuman, CreditManagerContract, type CreditManagerData, type CreditManagerDebtParams, type CreditManagerDebtParamsHuman, type CreditManagerState, type CreditManagerStateHuman, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, type CurvePoolStruct, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1AdapterStableNGContract, ERC4626AdapterContract, Erc4626PriceFeedContract, type EtherscanURLParam, type FindClosePathInput, GaugeContract, type GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, GearStakingContract, type GearStakingV3StateHuman, GearboxSDK, type GearboxStateHuman, type IAdapterContract, type IBaseContract, type ILPPriceFeedContract, type ILogger, type IPriceFeedContract, LinearModelContract, type LinearModelStateHuman, type LogFn, MAX_UINT16, MAX_UINT256, MIN_INT96, type MarketData, MarketFactory, MarketRegister, type MarketStateHuman, MellowLRTPriceFeedContract, type MultiCall, type MulticallErrorType, type MulticallParameters, type MulticallReturnType, NOT_DEPLOYED, NO_VERSION, type NetworkOptions, type NetworkType, type OnDemandPriceUpdate, type OpenStrategyResult, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, type PathOption, type PathOptionSerie, PoolContract, type PoolData, PoolFactory, type PoolFactoryStateHuman, PoolQuotaKeeperContract, type PoolQuotaKeeperData, type PoolQuotaKeeperStateHuman, type PoolStateHuman, type PriceFeedConstructorArgs, type PriceFeedContractType, type PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, type PriceFeedRegisterHooks, type PriceFeedStateHuman, type PriceFeedTreeNode, type PriceFeedUsageType, PriceOracleContract, type PriceOracleData, type PriceOracleV3StateHuman, Provider, type QuotaParamsHuman, type QuotaState, RAY, RAY_DECIMALS_POW, type RateKeeperData, type RawTx, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, type RouterCloseResult, type RouterHooks, type RouterResult, RouterV3Contract, SDKConstruct, type SDKOptions, SUPPORTED_CHAINS, type SwapOperation, type SwapTask, type SyncStateOptions, TIMELOCK, type TVL, type TokenMetaData, TokensMeta, type TransportOptions, USDC, UniswapV2AdapterContract, UniswapV3AdapterContract, type UpdatePriceFeedsResult, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, YearnV2RouterAdapterContract, ZeroPriceFeedContract, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createRawTx, createTransport, detectNetwork, etherscanUrl, filterDust, fmtBinaryMask, formatBN, formatBNvalue, formatBn4dig, formatDuration, formatNumberToString_, halfRAY, json_parse, json_stringify, numberWithCommas, percentFmt, rawTxToMulticallPriceUpdate, simulateMulticall, toHumanFormat };
|
package/dist/esm/sdk/index.mjs
CHANGED
|
@@ -19095,6 +19095,12 @@ var ADDRESS_PROVIDER = {
|
|
|
19095
19095
|
Optimism: "0x3761ca4BFAcFCFFc1B8034e69F19116dD6756726",
|
|
19096
19096
|
Base: NOT_DEPLOYED
|
|
19097
19097
|
};
|
|
19098
|
+
var ADDRESS_PROVIDER_BLOCK = {
|
|
19099
|
+
Mainnet: 18433056n,
|
|
19100
|
+
Arbitrum: 184650310n,
|
|
19101
|
+
Optimism: 118410666n,
|
|
19102
|
+
Base: 0n
|
|
19103
|
+
};
|
|
19098
19104
|
|
|
19099
19105
|
// src/sdk/constants/bot-permissions.ts
|
|
19100
19106
|
var BotPermissions = /* @__PURE__ */ ((BotPermissions2) => {
|
|
@@ -19620,6 +19626,13 @@ var TokensMeta = class extends AddressMap {
|
|
|
19620
19626
|
findBySymbol(symbol) {
|
|
19621
19627
|
return this.values().find((v) => v.symbol === symbol);
|
|
19622
19628
|
}
|
|
19629
|
+
mustFindBySymbol(symbol) {
|
|
19630
|
+
const meta = this.findBySymbol(symbol);
|
|
19631
|
+
if (!meta) {
|
|
19632
|
+
throw new Error(`cannot find token meta for symbol '${symbol}'`);
|
|
19633
|
+
}
|
|
19634
|
+
return meta;
|
|
19635
|
+
}
|
|
19623
19636
|
};
|
|
19624
19637
|
|
|
19625
19638
|
// src/sdk/base/types.ts
|
|
@@ -22477,9 +22490,11 @@ var AddressProviderContractV3_1 = class extends BaseContract {
|
|
|
22477
22490
|
|
|
22478
22491
|
// src/sdk/core/BotListV3Contract.ts
|
|
22479
22492
|
var BotListContract = class extends BaseContract {
|
|
22480
|
-
approvedCreditManagers
|
|
22493
|
+
#approvedCreditManagers;
|
|
22494
|
+
#currentBlock;
|
|
22481
22495
|
constructor(sdk, address) {
|
|
22482
22496
|
super(sdk, { addr: address, name: "BotListV3", abi: botListV3Abi });
|
|
22497
|
+
this.#currentBlock = ADDRESS_PROVIDER_BLOCK[sdk.provider.networkType];
|
|
22483
22498
|
}
|
|
22484
22499
|
parseFunctionParams(params) {
|
|
22485
22500
|
switch (params.functionName) {
|
|
@@ -22499,14 +22514,15 @@ var BotListContract = class extends BaseContract {
|
|
|
22499
22514
|
return void 0;
|
|
22500
22515
|
}
|
|
22501
22516
|
}
|
|
22502
|
-
async
|
|
22517
|
+
async syncState(toBlock) {
|
|
22503
22518
|
const logs = await this.provider.publicClient.getContractEvents({
|
|
22504
22519
|
address: this.address,
|
|
22505
22520
|
abi: this.abi,
|
|
22506
|
-
fromBlock:
|
|
22521
|
+
fromBlock: this.#currentBlock,
|
|
22507
22522
|
toBlock
|
|
22508
22523
|
});
|
|
22509
22524
|
logs.forEach((e) => this.processLog(e));
|
|
22525
|
+
this.#currentBlock = toBlock;
|
|
22510
22526
|
}
|
|
22511
22527
|
processLog(log) {
|
|
22512
22528
|
switch (log.eventName) {
|
|
@@ -22529,6 +22545,14 @@ var BotListContract = class extends BaseContract {
|
|
|
22529
22545
|
break;
|
|
22530
22546
|
}
|
|
22531
22547
|
}
|
|
22548
|
+
get approvedCreditManagers() {
|
|
22549
|
+
if (!this.#approvedCreditManagers) {
|
|
22550
|
+
throw new Error(
|
|
22551
|
+
"BotListContract state needs to be synced to load approvedCreditManagers"
|
|
22552
|
+
);
|
|
22553
|
+
}
|
|
22554
|
+
return this.#approvedCreditManagers;
|
|
22555
|
+
}
|
|
22532
22556
|
stateHuman(raw = true) {
|
|
22533
22557
|
return super.stateHuman(raw);
|
|
22534
22558
|
}
|
|
@@ -22973,7 +22997,6 @@ var GearboxSDK = class _GearboxSDK {
|
|
|
22973
22997
|
await this.#addressProvider.fetchState(this.currentBlock);
|
|
22974
22998
|
const botListAddress = this.#addressProvider.getAddress(AP_BOT_LIST, 300);
|
|
22975
22999
|
this.#botListContract = new BotListContract(this, botListAddress);
|
|
22976
|
-
await this.#botListContract.fetchState(this.currentBlock);
|
|
22977
23000
|
this.#gear = this.#addressProvider.getAddress(AP_GEAR_TOKEN);
|
|
22978
23001
|
const gearStakingAddress = this.#addressProvider.getAddress(
|
|
22979
23002
|
AP_GEAR_STAKING,
|
|
@@ -23130,4 +23153,4 @@ var GearboxSDK = class _GearboxSDK {
|
|
|
23130
23153
|
}
|
|
23131
23154
|
};
|
|
23132
23155
|
|
|
23133
|
-
export { ADDRESS_0X0, ADDRESS_PROVIDER, AP_ACCOUNT_FACTORY, AP_ACL, AP_ADAPTER_COMPRESSOR, 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_MARKET_CONFIGURATOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, AddressLabeller, AddressMap, AddressProviderContractV3_1, BalancerStablePriceFeedContract, BalancerV2VaultAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, BotListContract, BotPermissions, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainlinkPriceFeedContract, CompositePriceFeedContract, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditAccountsService, CreditConfiguratorContract, CreditFacadeV300Contract, CreditFacadeV310Contract, CreditFactory, CreditManagerContract, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1AdapterStableNGContract, ERC4626AdapterContract, Erc4626PriceFeedContract, GaugeContract, GearStakingContract, GearboxSDK, LinearModelContract, MAX_UINT16, MAX_UINT256, MIN_INT96, MarketFactory, MarketRegister, MellowLRTPriceFeedContract, NOT_DEPLOYED, NO_VERSION, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, PoolContract, PoolFactory, PoolQuotaKeeperContract, PriceFeedRef, PriceFeedRegister, PriceOracleContract, Provider, RAY, RAY_DECIMALS_POW, RedstonePriceFeedContract, RouterV3Contract, SDKConstruct, SUPPORTED_CHAINS, TIMELOCK, TokensMeta, USDC, UniswapV2AdapterContract, UniswapV3AdapterContract, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, YearnV2RouterAdapterContract, ZeroPriceFeedContract, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createRawTx, createTransport, detectNetwork, etherscanUrl, filterDust, fmtBinaryMask, formatBN, formatBNvalue, formatBn4dig, formatDuration, formatNumberToString_, halfRAY, json_parse, json_stringify, numberWithCommas, percentFmt, rawTxToMulticallPriceUpdate, simulateMulticall, toHumanFormat };
|
|
23156
|
+
export { ADDRESS_0X0, ADDRESS_PROVIDER, ADDRESS_PROVIDER_BLOCK, AP_ACCOUNT_FACTORY, AP_ACL, AP_ADAPTER_COMPRESSOR, 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_MARKET_CONFIGURATOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, AddressLabeller, AddressMap, AddressProviderContractV3_1, BalancerStablePriceFeedContract, BalancerV2VaultAdapterContract, BalancerWeightedPriceFeedContract, BaseContract, BotListContract, BotPermissions, BoundedPriceFeedContract, CamelotV3AdapterContract, ChainlinkPriceFeedContract, CompositePriceFeedContract, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, CreditAccountsService, CreditConfiguratorContract, CreditFacadeV300Contract, CreditFacadeV310Contract, CreditFactory, CreditManagerContract, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1AdapterStableNGContract, ERC4626AdapterContract, Erc4626PriceFeedContract, GaugeContract, GearStakingContract, GearboxSDK, LinearModelContract, MAX_UINT16, MAX_UINT256, MIN_INT96, MarketFactory, MarketRegister, MellowLRTPriceFeedContract, NOT_DEPLOYED, NO_VERSION, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, PoolContract, PoolFactory, PoolQuotaKeeperContract, PriceFeedRef, PriceFeedRegister, PriceOracleContract, Provider, RAY, RAY_DECIMALS_POW, RedstonePriceFeedContract, RouterV3Contract, SDKConstruct, SUPPORTED_CHAINS, TIMELOCK, TokensMeta, USDC, UniswapV2AdapterContract, UniswapV3AdapterContract, VelodromeV2RouterAdapterContract, VotingContractStatus, WAD, WAD_DECIMALS_POW, WstETHPriceFeedContract, WstETHV1AdapterContract, YearnPriceFeedContract, YearnV2RouterAdapterContract, ZeroPriceFeedContract, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createRawTx, createTransport, detectNetwork, etherscanUrl, filterDust, fmtBinaryMask, formatBN, formatBNvalue, formatBn4dig, formatDuration, formatNumberToString_, halfRAY, json_parse, json_stringify, numberWithCommas, percentFmt, rawTxToMulticallPriceUpdate, simulateMulticall, toHumanFormat };
|