@gearbox-protocol/sdk 14.12.0-next.74 → 14.12.0-next.76

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.
Files changed (79) hide show
  1. package/dist/cjs/plugins/accounts-counter/AccountsCounterPlugin.js +1 -1
  2. package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +85 -584
  3. package/dist/cjs/sdk/accounts/bots/AccountBotsService.js +132 -0
  4. package/dist/cjs/sdk/accounts/bots/PeripheryCompressorV310Contract.js +31 -0
  5. package/dist/cjs/sdk/accounts/bots/abi.js +19 -0
  6. package/dist/cjs/sdk/accounts/bots/index.js +6 -0
  7. package/dist/cjs/sdk/accounts/bots/types.js +1 -0
  8. package/dist/cjs/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +280 -0
  9. package/dist/cjs/sdk/accounts/credit-account-compressor/CreditAccountCompressorV310Contract.js +141 -0
  10. package/dist/cjs/sdk/accounts/credit-account-compressor/index.js +6 -0
  11. package/dist/cjs/sdk/accounts/credit-account-compressor/types.js +1 -0
  12. package/dist/cjs/sdk/accounts/index.js +10 -0
  13. package/dist/cjs/sdk/index.js +8 -0
  14. package/dist/cjs/sdk/market/ZapperRegister.js +1 -1
  15. package/dist/cjs/sdk/market/credit/CreditSuite.js +31 -0
  16. package/dist/cjs/sdk/market/oracle/PriceOracleBaseContract.js +41 -1
  17. package/dist/cjs/sdk/market/oracle/PriceOracleV310Contract.js +0 -23
  18. package/dist/cjs/sdk/market/pricefeeds/PriceFeedsRegister.js +1 -1
  19. package/dist/esm/plugins/accounts-counter/AccountsCounterPlugin.js +1 -1
  20. package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +87 -586
  21. package/dist/esm/sdk/accounts/bots/AccountBotsService.js +131 -0
  22. package/dist/esm/sdk/accounts/bots/PeripheryCompressorV310Contract.js +31 -0
  23. package/dist/esm/sdk/accounts/bots/abi.js +18 -0
  24. package/dist/esm/sdk/accounts/bots/index.js +4 -0
  25. package/dist/esm/sdk/accounts/bots/types.js +1 -0
  26. package/dist/esm/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +279 -0
  27. package/dist/esm/sdk/accounts/credit-account-compressor/CreditAccountCompressorV310Contract.js +141 -0
  28. package/dist/esm/sdk/accounts/credit-account-compressor/index.js +4 -0
  29. package/dist/esm/sdk/accounts/credit-account-compressor/types.js +1 -0
  30. package/dist/esm/sdk/accounts/index.js +7 -1
  31. package/dist/esm/sdk/index.js +5 -1
  32. package/dist/esm/sdk/market/ZapperRegister.js +1 -1
  33. package/dist/esm/sdk/market/credit/CreditSuite.js +31 -0
  34. package/dist/esm/sdk/market/oracle/PriceOracleBaseContract.js +41 -1
  35. package/dist/esm/sdk/market/oracle/PriceOracleV310Contract.js +0 -23
  36. package/dist/esm/sdk/market/pricefeeds/PriceFeedsRegister.js +1 -1
  37. package/dist/types/new-sdk/AbstractNamespace.d.ts +2 -2
  38. package/dist/types/new-sdk/opportunities/OpportunitiesNamespace.d.ts +1 -1
  39. package/dist/types/new-sdk/positions/PositionsNamespace.d.ts +1 -1
  40. package/dist/types/plugins/accounts/AccountsPlugin.d.ts +1 -1
  41. package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +17 -58
  42. package/dist/types/sdk/accounts/bots/AccountBotsService.d.ts +38 -0
  43. package/dist/types/sdk/accounts/bots/PeripheryCompressorV310Contract.d.ts +236 -0
  44. package/dist/types/sdk/accounts/bots/abi.d.ts +18 -0
  45. package/dist/types/sdk/accounts/bots/index.d.ts +4 -0
  46. package/dist/types/sdk/accounts/bots/types.d.ts +143 -0
  47. package/dist/types/sdk/accounts/credit-account-compressor/CreditAccountCompressor.d.ts +60 -0
  48. package/dist/types/sdk/accounts/credit-account-compressor/CreditAccountCompressorV310Contract.d.ts +879 -0
  49. package/dist/types/sdk/accounts/credit-account-compressor/index.d.ts +4 -0
  50. package/dist/types/sdk/accounts/credit-account-compressor/types.d.ts +164 -0
  51. package/dist/types/sdk/accounts/index.d.ts +11 -3
  52. package/dist/types/sdk/accounts/liquidations/MultichainLiquidationsService.d.ts +2 -2
  53. package/dist/types/sdk/accounts/liquidations/types.d.ts +1 -1
  54. package/dist/types/sdk/accounts/types.d.ts +13 -194
  55. package/dist/types/sdk/base/TokensMeta.d.ts +1 -1
  56. package/dist/types/sdk/base/index.d.ts +2 -2
  57. package/dist/types/sdk/base/types.d.ts +6 -1
  58. package/dist/types/sdk/index.d.ts +11 -5
  59. package/dist/types/sdk/market/MarketConfiguratorContract.d.ts +1 -1
  60. package/dist/types/sdk/market/MarketSuite.d.ts +1 -1
  61. package/dist/types/sdk/market/credit/CreditManagerV310Contract.d.ts +1 -1
  62. package/dist/types/sdk/market/credit/CreditSuite.d.ts +26 -1
  63. package/dist/types/sdk/market/credit/types.d.ts +1 -1
  64. package/dist/types/sdk/market/index.d.ts +2 -2
  65. package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +16 -5
  66. package/dist/types/sdk/market/oracle/PriceOracleV310Contract.d.ts +0 -11
  67. package/dist/types/sdk/market/oracle/index.d.ts +2 -2
  68. package/dist/types/sdk/market/oracle/types.d.ts +31 -15
  69. package/dist/types/sdk/market/pool/LinearInterestRateModelContract.d.ts +1 -1
  70. package/dist/types/sdk/market/pool/PoolQuotaKeeperV310Contract.d.ts +1 -1
  71. package/dist/types/sdk/market/pool/PoolSuite.d.ts +1 -1
  72. package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +1 -1
  73. package/dist/types/sdk/market/pool/types.d.ts +1 -1
  74. package/dist/types/sdk/market/pricefeeds/AbstractPriceFeed.d.ts +1 -1
  75. package/dist/types/sdk/market/pricefeeds/types.d.ts +1 -1
  76. package/dist/types/sdk/opportunities/MultichainOpportunitiesService.d.ts +2 -2
  77. package/dist/types/sdk/pools/types.d.ts +1 -1
  78. package/dist/types/sdk/positions/MultichainPositionsService.d.ts +2 -2
  79. package/package.json +1 -1
@@ -42,6 +42,8 @@ import { SDKConstruct } from "./base/SDKConstruct.js";
42
42
  import { PHANTOM_TOKEN_CONTRACT_TYPES, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND } from "./base/token-types.js";
43
43
  import { VotingContractStatus } from "./base/types.js";
44
44
  import "./base/index.js";
45
+ import { PeripheryCompressorV310Contract } from "./accounts/bots/PeripheryCompressorV310Contract.js";
46
+ import { AccountBotsService } from "./accounts/bots/AccountBotsService.js";
45
47
  import { PlaceholderAdapterContract } from "./market/adapters/PlaceholderAdapterContracts.js";
46
48
  import { createAdapter } from "./market/adapters/createAdapter.js";
47
49
  import { CreditConfiguratorV310Contract } from "./market/credit/CreditConfiguratorV310Contract.js";
@@ -103,6 +105,8 @@ import { SecuritizeRWAFactory } from "./market/rwa/securitize/SecuritizeRWAFacto
103
105
  import { RWARegistry } from "./market/rwa/RWARegistry.js";
104
106
  import { RWA_FACTORY_TYPES, isRWAFactory } from "./market/rwa/types.js";
105
107
  import "./market/index.js";
108
+ import { CreditAccountCompressorV310Contract } from "./accounts/credit-account-compressor/CreditAccountCompressorV310Contract.js";
109
+ import { CreditAccountCompressor } from "./accounts/credit-account-compressor/CreditAccountCompressor.js";
106
110
  import { CreditAccountsServiceV310 } from "./accounts/CreditAccountsServiceV310.js";
107
111
  import { primaryInstantOutput } from "./accounts/intents/operations/claim-delayed/index.js";
108
112
  import { CreditAccountOperationsService } from "./accounts/intents/index.js";
@@ -143,4 +147,4 @@ import { OnchainSDK, STATE_VERSION } from "./OnchainSDK.js";
143
147
  import { MultichainSDK } from "./MultichainSDK.js";
144
148
  import { attachOptionsSchema, onchainSDKOptionsSchema } from "./options.js";
145
149
  import "./types/index.js";
146
- export { ADDRESS_0X0, ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_RWA_COMPRESSOR, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AddressMap, AddressProviderV310Contract, AddressSet, AssetsMap, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, BaseContract, BasePlugin, BigIntMath, BotPermissions, BoundedPriceFeedContract, ChainContractsRegister, ChainNotConfiguredError, CompositePriceFeedContract, Construct, ContractParseError, CreditAccountOperationsService, CreditAccountsServiceV310, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DUST_THRESHOLD, Erc4626PriceFeedContract, ExternalPriceFeedContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InvalidDelayedIntentError, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LinearInterestRateModelContract, LiquidationsService, MAX_INT, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, MarketRegister, MarketSuite, MellowLRTPriceFeedContract, MidasLiquidatorContract, MissingSerializedParamsError, MultichainConstruct, MultichainLiquidationsService, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, NATIVE_ADDRESS, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainSDK, OpportunitiesService, PARTIAL_LIQUIDATION_BUFFER_BPS, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PRICE_DECIMALS, PRICE_DECIMALS_POW, PartialPriceFeedInitError, PendleTWAPPTPriceFeed, PlaceholderAdapterContract, PlaceholderContract, PluginStateVersionError, PoolService, PoolSuite, PoolV310Contract, PositionsService, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RedemptionLoggerV310Contract, RedstonePriceFeedContract, RouterV310Contract, SDKConstruct, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeLiquidatorContract, SecuritizeRWAFactory, SimulateWithPriceUpdatesError, SimulationError, TokensMeta, TypedObjectUtils, UnsupportedZapperFunctionError, VERSION_RANGE_310, VotingContractStatus, WAD, WAD_DECIMALS_POW, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WstETHPriceFeedContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, ZodAddress, ZodHex, additionalBorrowApyBps, assetsMap, attachOptionsSchema, borrowApyBps, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, abi as creditFacadeV310Abi, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, fetchPythPayloads, fetchRedstonePayloads, filterDust, filterDustUSD, findCuratorMarketConfigurator, fmtBinaryMask, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, healthFactorBps, hexEq, hydrateAddressProvider, iCreditAccountAbi, isDust, isLPPriceFeed, isPublicNetwork, isRWAFactory, isRWAToken, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, json_parse, json_stringify, maxLeverage, minSeizedAmount, mustGetDominantCollateral, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, percentFmt, positionLeverage, primaryInstantOutput, rayToBps, rayToNumber, retry, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, toAddress, toBN, toBigInt, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal, toSignificant, toWithdrawalStatus, usdToNumber, utilizationBps, watchBlocksAsync };
150
+ export { ADDRESS_0X0, ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_RWA_COMPRESSOR, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, AddressMap, AddressProviderV310Contract, AddressSet, AssetsMap, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, BaseContract, BasePlugin, BigIntMath, BotPermissions, BoundedPriceFeedContract, ChainContractsRegister, ChainNotConfiguredError, CompositePriceFeedContract, Construct, ContractParseError, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountOperationsService, CreditAccountsServiceV310, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DUST_THRESHOLD, Erc4626PriceFeedContract, ExternalPriceFeedContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InvalidDelayedIntentError, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LinearInterestRateModelContract, LiquidationsService, MAX_INT, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, MarketRegister, MarketSuite, MellowLRTPriceFeedContract, MidasLiquidatorContract, MissingSerializedParamsError, MultichainConstruct, MultichainLiquidationsService, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, NATIVE_ADDRESS, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainSDK, OpportunitiesService, PARTIAL_LIQUIDATION_BUFFER_BPS, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PRICE_DECIMALS, PRICE_DECIMALS_POW, PartialPriceFeedInitError, PendleTWAPPTPriceFeed, PeripheryCompressorV310Contract, PlaceholderAdapterContract, PlaceholderContract, PluginStateVersionError, PoolService, PoolSuite, PoolV310Contract, PositionsService, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RedemptionLoggerV310Contract, RedstonePriceFeedContract, RouterV310Contract, SDKConstruct, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeLiquidatorContract, SecuritizeRWAFactory, SimulateWithPriceUpdatesError, SimulationError, TokensMeta, TypedObjectUtils, UnsupportedZapperFunctionError, VERSION_RANGE_310, VotingContractStatus, WAD, WAD_DECIMALS_POW, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WstETHPriceFeedContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, ZodAddress, ZodHex, additionalBorrowApyBps, assetsMap, attachOptionsSchema, borrowApyBps, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, abi as creditFacadeV310Abi, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, fetchPythPayloads, fetchRedstonePayloads, filterDust, filterDustUSD, findCuratorMarketConfigurator, fmtBinaryMask, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, healthFactorBps, hexEq, hydrateAddressProvider, iCreditAccountAbi, isDust, isLPPriceFeed, isPublicNetwork, isRWAFactory, isRWAToken, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, json_parse, json_stringify, maxLeverage, minSeizedAmount, mustGetDominantCollateral, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, percentFmt, positionLeverage, primaryInstantOutput, rayToBps, rayToNumber, retry, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, toAddress, toBN, toBigInt, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal, toSignificant, toWithdrawalStatus, usdToNumber, utilizationBps, watchBlocksAsync };
@@ -1,4 +1,3 @@
1
- import { peripheryCompressorAbi } from "../../abi/compressors/peripheryCompressor.js";
2
1
  import { AddressMap } from "../utils/AddressMap.js";
3
2
  import { AP_PERIPHERY_COMPRESSOR } from "../constants/address-provider.js";
4
3
  import { VERSION_RANGE_310 } from "../constants/versions.js";
@@ -7,6 +6,7 @@ import { hexEq } from "../utils/hex.js";
7
6
  import "../utils/index.js";
8
7
  import { SDKConstruct } from "../base/SDKConstruct.js";
9
8
  import "../base/index.js";
9
+ import { peripheryCompressorAbi } from "../../abi/compressors/peripheryCompressor.js";
10
10
  import { createZapper } from "./zapper/createZapper.js";
11
11
  import "./zapper/index.js";
12
12
  //#region src/sdk/market/ZapperRegister.ts
@@ -89,6 +89,37 @@ var CreditSuite = class extends SDKConstruct {
89
89
  return this.market.configurator;
90
90
  }
91
91
  /**
92
+ * Factory that opens and manages the accounts of this suite, defined only
93
+ * for RWA markets.
94
+ */
95
+ get rwaFactory() {
96
+ return this.market.rwaFactory;
97
+ }
98
+ /**
99
+ * Builds a transaction that executes a multicall on one of this suite's
100
+ * credit accounts.
101
+ *
102
+ * @param creditAccount - Account to operate on.
103
+ * @param calls - Multicall body.
104
+ * @param rwaOptions - Factory-specific args, ignored on non-RWA markets.
105
+ */
106
+ multicallTx(creditAccount, calls, rwaOptions) {
107
+ const { rwaFactory } = this;
108
+ return rwaFactory ? rwaFactory.multicall(creditAccount, calls, rwaOptions) : this.creditFacade.multicall(creditAccount, calls);
109
+ }
110
+ /**
111
+ * Builds a transaction that opens a new credit account in this suite.
112
+ *
113
+ * @param to - Owner of the new account.
114
+ * @param calls - Multicall body executed on the new account.
115
+ * @param referralCode - Referral code, facade path only.
116
+ * @param rwaOptions - Factory-specific args, ignored on non-RWA markets.
117
+ */
118
+ openCreditAccountTx(to, calls, referralCode, rwaOptions) {
119
+ const { rwaFactory } = this;
120
+ return rwaFactory ? rwaFactory.openCreditAccount(this.creditManager.address, calls, rwaOptions) : this.creditFacade.openCreditAccount(to, calls, referralCode ?? 0n);
121
+ }
122
+ /**
92
123
  * Router configured for this credit suite.
93
124
  */
94
125
  get router() {
@@ -1,5 +1,7 @@
1
1
  import { AddressMap } from "../../utils/AddressMap.js";
2
+ import { AddressSet } from "../../utils/AddressSet.js";
2
3
  import { AP_PRICE_FEED_COMPRESSOR } from "../../constants/address-provider.js";
4
+ import "../../constants/math.js";
3
5
  import { VERSION_RANGE_310 } from "../../constants/versions.js";
4
6
  import "../../constants/index.js";
5
7
  import { formatBN } from "../../utils/formatter.js";
@@ -7,8 +9,9 @@ import "../../utils/index.js";
7
9
  import { BaseContract } from "../../base/BaseContract.js";
8
10
  import "../../base/index.js";
9
11
  import { usdToNumber } from "../math.js";
10
- import { PriceFeedRef } from "../pricefeeds/PriceFeedRef.js";
11
12
  import { priceFeedCompressorAbi } from "../../../abi/compressors/priceFeedCompressor.js";
13
+ import { PriceFeedRef } from "../pricefeeds/PriceFeedRef.js";
14
+ import { getRawPriceUpdates } from "../pricefeeds/getRawPriceUpdates.js";
12
15
  import "../pricefeeds/index.js";
13
16
  import PriceFeedAnswerMap from "./PriceFeedAnswerMap.js";
14
17
  import { stringToHex } from "viem";
@@ -58,6 +61,31 @@ var PriceOracleBaseContract = class extends BaseContract {
58
61
  return tokens.flatMap((t) => [main ? this.mainPriceFeeds.get(t)?.priceFeed : void 0, reserve ? this.reservePriceFeeds.get(t)?.priceFeed : void 0]).filter((f) => !!f);
59
62
  }
60
63
  /**
64
+ * {@inheritDoc IPriceOracleContract.priceUpdateTxsForAccount}
65
+ **/
66
+ async priceUpdateTxsForAccount(account, opts) {
67
+ return this.#priceUpdateTxsForTokens(getAccountTokens(account, opts?.extraTokens), opts);
68
+ }
69
+ /**
70
+ * {@inheritDoc IPriceOracleContract.priceUpdatesForAccount}
71
+ **/
72
+ async priceUpdatesForAccount(account, opts) {
73
+ return getRawPriceUpdates(await this.priceUpdateTxsForAccount(account, opts));
74
+ }
75
+ /**
76
+ * {@inheritDoc IPriceOracleContract.priceUpdatesForTokens}
77
+ **/
78
+ async priceUpdatesForTokens(tokens, opts) {
79
+ return getRawPriceUpdates(await this.#priceUpdateTxsForTokens(tokens, opts));
80
+ }
81
+ async #priceUpdateTxsForTokens(tokens, opts) {
82
+ const priceFeeds = this.priceFeedsForTokens(tokens, opts);
83
+ const tStr = tokens.map((t) => this.labelAddress(t)).join(", ");
84
+ const remark = opts?.reserve === false ? " main" : "";
85
+ this.logger?.debug(`generating price feed updates for ${tStr} from ${priceFeeds.length}${remark} price feeds`);
86
+ return this.sdk.priceFeeds.generatePriceFeedsUpdateTxs(priceFeeds);
87
+ }
88
+ /**
61
89
  * {@inheritDoc IPriceOracleContract.mainPrice}
62
90
  **/
63
91
  mainPrice(token) {
@@ -261,6 +289,18 @@ var PriceOracleBaseContract = class extends BaseContract {
261
289
  }
262
290
  }
263
291
  };
292
+ /**
293
+ * Tokens of an account that have to be priced: its underlying, every enabled
294
+ * token it holds a non-dust balance of, and any extra tokens the caller adds.
295
+ **/
296
+ function getAccountTokens(account, extraTokens) {
297
+ const tokens = new AddressSet([account.underlying, ...extraTokens ?? []]);
298
+ for (const t of account.tokens) {
299
+ const isEnabled = (t.mask & account.enabledTokensMask) !== 0n;
300
+ if (t.balance > 10n && isEnabled) tokens.add(t.token);
301
+ }
302
+ return tokens.asArray();
303
+ }
264
304
  function formatAnswer({ price, success, updatedAt }, raw = true) {
265
305
  if (!success) return "failed";
266
306
  let priceS = formatBN(price, 8);
@@ -1,7 +1,5 @@
1
1
  import { iPriceOracleV310Abi } from "../../../abi/310/generated.js";
2
2
  import { simulateWithPriceUpdates } from "../../utils/viem/simulateWithPriceUpdates.js";
3
- import { getRawPriceUpdates } from "../pricefeeds/getRawPriceUpdates.js";
4
- import "../pricefeeds/index.js";
5
3
  import { PriceOracleBaseContract } from "./PriceOracleBaseContract.js";
6
4
  //#region src/sdk/market/oracle/PriceOracleV310Contract.ts
7
5
  const abi = iPriceOracleV310Abi;
@@ -14,27 +12,6 @@ var PriceOracleV310Contract = class extends PriceOracleBaseContract {
14
12
  }, data);
15
13
  }
16
14
  /**
17
- * Converts previously obtained price updates into CreditFacade multicall entry
18
- * @param creditFacade
19
- * @param updates
20
- * @returns
21
- * @throws If `creditFacade` does not belong to a loaded market.
22
- */
23
- onDemandPriceUpdates(creditFacade, updates) {
24
- if (!updates) {
25
- this.logger?.debug("empty updates list");
26
- return {
27
- multicall: [],
28
- raw: []
29
- };
30
- }
31
- const raw = getRawPriceUpdates(updates);
32
- return {
33
- raw,
34
- multicall: [this.sdk.marketRegister.findCreditFacade(creditFacade).prepareOnDemandPriceUpdates(raw)]
35
- };
36
- }
37
- /**
38
15
  * {@inheritDoc IPriceOracleContract.updateAndConvert}
39
16
  **/
40
17
  async updateAndConvert(from, to, amount) {
@@ -8,6 +8,7 @@ import "../../constants/index.js";
8
8
  import "../../utils/index.js";
9
9
  import { SDKConstruct } from "../../base/SDKConstruct.js";
10
10
  import "../../base/index.js";
11
+ import { priceFeedCompressorAbi } from "../../../abi/compressors/priceFeedCompressor.js";
11
12
  import { PartialPriceFeedInitError } from "./AbstractPriceFeed.js";
12
13
  import { BalancerStablePriceFeedContract } from "./BalancerStablePriceFeed.js";
13
14
  import { BalancerWeightedPriceFeedContract } from "./BalancerWeightedPriceFeed.js";
@@ -21,7 +22,6 @@ import { ExternalPriceFeedContract } from "./ExternalPriceFeed.js";
21
22
  import { getRawPriceUpdates } from "./getRawPriceUpdates.js";
22
23
  import { MellowLRTPriceFeedContract } from "./MellowLRTPriceFeed.js";
23
24
  import { PendleTWAPPTPriceFeed } from "./PendleTWAPPTPriceFeed.js";
24
- import { priceFeedCompressorAbi } from "../../../abi/compressors/priceFeedCompressor.js";
25
25
  import { Hooks } from "../../utils/internal/Hooks.js";
26
26
  import "../../utils/internal/index.js";
27
27
  import { ConstantPriceFeedContract } from "./ConstantPriceFeed.js";
@@ -1,8 +1,8 @@
1
- import { ChainId } from "../model/primitives.js";
2
- import "../model/index.js";
3
1
  import { ILogger } from "../sdk/types/logger.js";
2
+ import { ChainId } from "../model/primitives.js";
4
3
  import { NetworkType } from "../sdk/chain/chains.js";
5
4
  import { MultichainNetworkMeta } from "../sdk/types/multichain.js";
5
+ import "../model/index.js";
6
6
  import { MultichainSDK } from "../sdk/MultichainSDK.js";
7
7
  import "../sdk/index.js";
8
8
  import { OffchainResult } from "../offchain/types.js";
@@ -1,7 +1,7 @@
1
+ import { ILogger } from "../../sdk/types/logger.js";
1
2
  import { Opportunity, OpportunityFilter, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef } from "../../model/opportunities.js";
2
3
  import { PoolHistoryMetric, StrategyHistoryMetric } from "../../model/history.js";
3
4
  import "../../model/index.js";
4
- import { ILogger } from "../../sdk/types/logger.js";
5
5
  import { MultichainSDK } from "../../sdk/MultichainSDK.js";
6
6
  import "../../sdk/index.js";
7
7
  import { GearboxAPI } from "../../offchain/GearboxAPI.js";
@@ -1,7 +1,7 @@
1
+ import { ILogger } from "../../sdk/types/logger.js";
1
2
  import { PoolPositionRef, Position, PositionFilter, StrategyPositionRef } from "../../model/positions.js";
2
3
  import { PoolPositionHistoryMetric, StrategyPositionHistoryMetric } from "../../model/history.js";
3
4
  import "../../model/index.js";
4
- import { ILogger } from "../../sdk/types/logger.js";
5
5
  import { MultichainSDK } from "../../sdk/MultichainSDK.js";
6
6
  import "../../sdk/index.js";
7
7
  import { GearboxAPI } from "../../offchain/GearboxAPI.js";
@@ -1,7 +1,7 @@
1
1
  import { CreditAccountData } from "../../sdk/base/types.js";
2
2
  import { BasePlugin } from "../../sdk/plugins/BasePlugin.js";
3
3
  import { IOnchainSDKPlugin } from "../../sdk/plugins/types.js";
4
- import { GetCreditAccountsOptions } from "../../sdk/accounts/types.js";
4
+ import { GetCreditAccountsOptions } from "../../sdk/accounts/credit-account-compressor/types.js";
5
5
  import "../../sdk/index.js";
6
6
  import { Address } from "viem";
7
7
  //#region src/plugins/accounts/AccountsPlugin.d.ts
@@ -1,13 +1,15 @@
1
+ import { RequestableWithdrawal } from "./withdrawal-compressor/types.js";
2
+ import { Asset, CreditAccountData, CreditAccountTokensSlice } from "../base/types.js";
1
3
  import { StrategyPosition } from "../../model/positions.js";
2
4
  import "../../model/index.js";
3
- import { RequestableWithdrawal } from "./withdrawal-compressor/types.js";
4
- import { Asset, CreditAccountData } from "../base/types.js";
5
5
  import { RWAOpenAccountRequirements } from "../market/rwa/types.js";
6
6
  import "../market/rwa/index.js";
7
7
  import { RouterCASlice } from "../router/types.js";
8
8
  import "../router/index.js";
9
+ import { GetCreditAccountsOptions, ListStrategyPositionsProps } from "./credit-account-compressor/types.js";
10
+ import "./credit-account-compressor/index.js";
9
11
  import "./withdrawal-compressor/index.js";
10
- import { AccountToCheck, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, ClaimFarmRewardsProps, CreditAccountOperationResult, CreditAccountTokensSlice, CreditManagerOperationResult, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsOptions, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, ICreditAccountsService, ListStrategyPositionsProps, OpenCAProps, PartiallyLiquidateProps, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, Rewards, SetBotProps } from "./types.js";
12
+ import { AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, ClaimFarmRewardsProps, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, ICreditAccountsService, OpenCAProps, PartiallyLiquidateProps, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, Rewards } from "./types.js";
11
13
  import { PriceUpdate } from "../market/pricefeeds/types.js";
12
14
  import "../market/index.js";
13
15
  import { MultiCall, RawTx } from "../types/transactions.js";
@@ -15,18 +17,10 @@ import { OnchainSDK } from "../OnchainSDK.js";
15
17
  import "../types/index.js";
16
18
  import { SDKConstruct } from "../base/SDKConstruct.js";
17
19
  import "../base/index.js";
20
+ import { AccountBotsService } from "./bots/AccountBotsService.js";
21
+ import "./bots/index.js";
18
22
  import { Address } from "viem";
19
23
  //#region src/sdk/accounts/CreditAccountsServiceV310.d.ts
20
- /**
21
- * Options for configuring the credit account service.
22
- **/
23
- interface CreditAccountServiceOptions {
24
- /**
25
- * Maximum number of credit accounts to fetch per compressor call.
26
- * When set, accounts are loaded in batches of this size until all are fetched.
27
- **/
28
- batchSize?: number;
29
- }
30
24
  /**
31
25
  * Service for querying and operating on Gearbox credit accounts.
32
26
  *
@@ -38,8 +32,11 @@ interface CreditAccountServiceOptions {
38
32
  **/
39
33
  declare class CreditAccountsServiceV310 extends SDKConstruct implements ICreditAccountsService {
40
34
  #private;
41
- constructor(sdk: OnchainSDK, options?: CreditAccountServiceOptions);
42
- setBatchSize(batchSize: number): void;
35
+ /**
36
+ * {@inheritDoc ICreditAccountsService.bots}
37
+ **/
38
+ readonly bots: AccountBotsService;
39
+ constructor(sdk: OnchainSDK);
43
40
  /**
44
41
  * {@inheritDoc ICreditAccountsService.getCreditAccountData}
45
42
  **/
@@ -60,14 +57,6 @@ declare class CreditAccountsServiceV310 extends SDKConstruct implements ICreditA
60
57
  * {@inheritDoc ICreditAccountsService.getRewards}
61
58
  **/
62
59
  getRewards(creditAccount: Address): Promise<Array<Rewards>>;
63
- /**
64
- * {@inheritDoc ICreditAccountsService.getConnectedBots}
65
- **/
66
- getConnectedBots(accountsToCheck: Array<AccountToCheck>, legacyMigrationBot: Address | undefined, additionalBots: Array<Address>): Promise<{
67
- legacy: GetConnectedBotsResult;
68
- legacyMigration: GetConnectedMigrationBotsResult;
69
- additionalBots: Array<Omit<NonNullable<GetConnectedMigrationBotsResult>, "botAddress">>;
70
- }>;
71
60
  /**
72
61
  * {@inheritDoc ICreditAccountsService.fullyLiquidate}
73
62
  **/
@@ -109,45 +98,21 @@ declare class CreditAccountsServiceV310 extends SDKConstruct implements ICreditA
109
98
  **/
110
99
  openCA(props: OpenCAProps): Promise<RawTx>;
111
100
  /**
112
- * Returns multicall entries to redeem (unwrap) RWA ERC-4626 vault shares into underlying for the given credit manager.
113
- * Used when withdrawing debt from a RWA market: redeems adapter vault shares so the underlying can be withdrawn.
114
- * Only applies when the credit manager's underlying is RWA-gated and has an ERC-4626 adapter configured.
115
- * @param amount - Number of vault shares (adapter tokens) to redeem
116
- * @param creditManager - Credit manager address
117
- * @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not RWA or no adapter is configured
101
+ * {@inheritDoc ICreditAccountsService.assembleRWAUnwrapCalls}
118
102
  */
119
103
  assembleRWAUnwrapCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
120
104
  /**
121
- * Returns multicall entries to deposit (wrap) underlying into RWA ERC-4626 vault shares for the given credit manager.
122
- * Used when adding debt on a RWA market: deposits underlying into the adapter vault so shares are minted on the account.
123
- * Only applies when the credit manager's underlying is RWA-gated and has an ERC-4626 adapter configured.
124
- * @param amount - Amount of underlying assets to deposit into the vault (in underlying decimals)
125
- * @param creditManager - Credit manager address
126
- * @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not RWA or no adapter is configured
105
+ * {@inheritDoc ICreditAccountsService.assembleRWAWrapCalls}
127
106
  */
128
107
  assembleRWAWrapCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
129
108
  /**
130
- * Returns multicall entries to call redeemDiff on the RWA ERC-4626 adapter for the given credit manager.
131
- * Redeems the leftover vault shares (e.g. after repaying debt) so the account does not hold excess RWA vault tokens.
132
- * Only applies when the credit manager's underlying is RWA-gated and has an ERC-4626 adapter configured.
133
- * @param amount - Leftover vault share amount to redeem (in adapter/vault decimals)
134
- * @param creditManager - Credit manager address
135
- * @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not RWA or no adapter is configured
109
+ * {@inheritDoc ICreditAccountsService.assembleRedeemDiffCalls}
136
110
  */
137
111
  assembleRedeemDiffCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
138
112
  /**
139
- * Returns multicall entries to call depositDiff on the RWA ERC-4626 adapter for the given credit manager.
140
- * Deposits the leftover underlying (e.g. after decreasing debt) into the vault so the account does not hold excess underlying.
141
- * Only applies when the credit manager's underlying is RWA-gated and has an ERC-4626 adapter configured.
142
- * @param amount - Leftover underlying amount to deposit into the vault (in underlying decimals)
143
- * @param creditManager - Credit manager address
144
- * @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not RWA or no adapter is configured
113
+ * {@inheritDoc ICreditAccountsService.assembleDepositDiffCalls}
145
114
  */
146
115
  assembleDepositDiffCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
147
- /**
148
- * {@inheritDoc ICreditAccountsService.setBot}
149
- */
150
- setBot({ botAddress, permissions: defaultPermissions, targetContract }: SetBotProps): Promise<CreditAccountOperationResult | CreditManagerOperationResult>;
151
116
  /**
152
117
  * {@inheritDoc ICreditAccountsService.assembleRepayCreditAccountCalls}
153
118
  */
@@ -198,13 +163,7 @@ declare class CreditAccountsServiceV310 extends SDKConstruct implements ICreditA
198
163
  * {@inheritDoc ICreditAccountsService.prepareAddCollateral}
199
164
  */
200
165
  prepareAddCollateral(creditFacade: Address, assets: Array<Asset>, permits: Record<string, PermitResult>): Array<MultiCall>;
201
- /**
202
- * Returns addresses of market configurators
203
- */
204
- private get marketConfigurators();
205
166
  private get rewardCompressor();
206
- private get peripheryCompressor();
207
- private get compressor();
208
167
  }
209
168
  //#endregion
210
- export { CreditAccountServiceOptions, CreditAccountsServiceV310 };
169
+ export { CreditAccountsServiceV310 };
@@ -0,0 +1,38 @@
1
+ import { SDKConstruct } from "../../base/SDKConstruct.js";
2
+ import "../../base/index.js";
3
+ import { AccountToCheck, GetConnectedBotsResponse, SetBotProps, SetBotResult } from "./types.js";
4
+ import { Address } from "viem";
5
+ //#region src/sdk/accounts/bots/AccountBotsService.d.ts
6
+ /**
7
+ * Bots of credit accounts.
8
+ *
9
+ * Reads which bots are connected to an account and with which permissions,
10
+ * and builds the transactions that connect or disconnect one.
11
+ **/
12
+ declare class AccountBotsService extends SDKConstruct {
13
+ #private;
14
+ /**
15
+ * Reads the bots connected to each of the given credit accounts.
16
+ *
17
+ * All reads go out as a single multicall, split into three groups: the
18
+ * periphery compressor's view of each account, the status of the legacy
19
+ * migration bot on each account, and the status of every bot in
20
+ * `additionalBots` on every account.
21
+ *
22
+ * @param accountsToCheck - Accounts to read, with their credit managers.
23
+ * @param legacyMigrationBot - Legacy migration bot to check, if any.
24
+ * @param additionalBots - Bots to check on every account.
25
+ **/
26
+ getConnectedBots(accountsToCheck: Array<AccountToCheck>, legacyMigrationBot: Address | undefined, additionalBots: Array<Address>): Promise<GetConnectedBotsResponse>;
27
+ /**
28
+ * Connects or disconnects a bot, and updates prices when the bot is set on a
29
+ * credit account.
30
+ *
31
+ * @param props - {@link SetBotProps}
32
+ * @returns Everything needed to execute the operation. Setting a bot on a
33
+ * credit manager only yields calls, since it is not a standalone transaction.
34
+ **/
35
+ setBot({ botAddress, permissions: defaultPermissions, targetContract }: SetBotProps): Promise<SetBotResult>;
36
+ }
37
+ //#endregion
38
+ export { AccountBotsService };