@gearbox-protocol/sdk 16.4.0-next.5 → 16.4.0-next.7
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/onchain/accounts/intents/borrow.js +139 -0
- package/dist/cjs/onchain/accounts/intents/{collateral-money.js → collateral-valuation.js} +7 -7
- package/dist/cjs/onchain/accounts/intents/index.js +82 -1
- package/dist/cjs/onchain/accounts/intents/leverage-band.js +2 -12
- package/dist/cjs/onchain/accounts/intents/maxBorrow.js +89 -0
- package/dist/cjs/onchain/accounts/intents/maxWithdrawCollateral.js +14 -14
- package/dist/cjs/onchain/accounts/intents/open-strategy.js +6 -45
- package/dist/cjs/onchain/accounts/intents/testing/sdk-mock.js +1 -0
- package/dist/cjs/onchain/accounts/intents/utils/common.js +19 -0
- package/dist/cjs/onchain/accounts/intents/utils/credit-account-slice.js +21 -0
- package/dist/cjs/onchain/accounts/intents/utils/index.js +2 -0
- package/dist/cjs/onchain/accounts/intents/withdraw-limits.js +8 -8
- package/dist/cjs/onchain/positions/calcHealthFactor.js +3 -3
- package/dist/cjs/onchain/preview/preview/previewOpenStrategyPosition.js +2 -1
- package/dist/cjs/sdk/execute/ExecuteApi.js +65 -5
- package/dist/cjs/sdk/prepare/PrepareApi.js +86 -12
- package/dist/esm/onchain/accounts/intents/borrow.js +137 -0
- package/dist/esm/onchain/accounts/intents/{collateral-money.js → collateral-valuation.js} +7 -7
- package/dist/esm/onchain/accounts/intents/index.js +82 -1
- package/dist/esm/onchain/accounts/intents/leverage-band.js +2 -12
- package/dist/esm/onchain/accounts/intents/maxBorrow.js +87 -0
- package/dist/esm/onchain/accounts/intents/maxWithdrawCollateral.js +14 -14
- package/dist/esm/onchain/accounts/intents/open-strategy.js +6 -45
- package/dist/esm/onchain/accounts/intents/testing/sdk-mock.js +1 -0
- package/dist/esm/onchain/accounts/intents/utils/common.js +19 -1
- package/dist/esm/onchain/accounts/intents/utils/credit-account-slice.js +21 -1
- package/dist/esm/onchain/accounts/intents/utils/index.js +3 -3
- package/dist/esm/onchain/accounts/intents/withdraw-limits.js +8 -8
- package/dist/esm/onchain/positions/calcHealthFactor.js +3 -3
- package/dist/esm/onchain/preview/preview/previewOpenStrategyPosition.js +2 -1
- package/dist/esm/sdk/execute/ExecuteApi.js +65 -5
- package/dist/esm/sdk/prepare/PrepareApi.js +86 -12
- package/dist/types/model/previews.d.ts +11 -2
- package/dist/types/onchain/accounts/index.d.ts +4 -3
- package/dist/types/onchain/accounts/intents/borrow.d.ts +141 -0
- package/dist/types/onchain/accounts/intents/{collateral-money.d.ts → collateral-valuation.d.ts} +8 -8
- package/dist/types/onchain/accounts/intents/index.d.ts +81 -2
- package/dist/types/onchain/accounts/intents/maxBorrow.d.ts +54 -0
- package/dist/types/onchain/accounts/intents/maxWithdrawCollateral.d.ts +3 -3
- package/dist/types/onchain/accounts/intents/open-strategy.d.ts +3 -17
- package/dist/types/onchain/accounts/intents/testing/sdk-mock.d.ts +2 -0
- package/dist/types/onchain/accounts/intents/tests/open-strategy.fixtures.d.ts +2 -2
- package/dist/types/onchain/accounts/intents/types.d.ts +6 -1
- package/dist/types/onchain/accounts/intents/utils/common.d.ts +15 -1
- package/dist/types/onchain/accounts/intents/utils/credit-account-slice.d.ts +14 -1
- package/dist/types/onchain/accounts/intents/utils/index.d.ts +3 -3
- package/dist/types/onchain/accounts/intents/withdraw-limits.d.ts +1 -1
- package/dist/types/onchain/index.d.ts +4 -3
- package/dist/types/sdk/execute/index.d.ts +2 -2
- package/dist/types/sdk/execute/types.d.ts +48 -6
- package/dist/types/sdk/index.d.ts +5 -4
- package/dist/types/sdk/prepare/PrepareApi.d.ts +15 -3
- package/dist/types/sdk/prepare/index.d.ts +4 -3
- package/dist/types/sdk/prepare/types.d.ts +176 -49
- package/package.json +1 -1
|
@@ -256,14 +256,15 @@ import { AccountBotsService } from "./accounts/bots/AccountBotsService.js";
|
|
|
256
256
|
import { PeripheryCompressorV310Contract } from "./accounts/bots/PeripheryCompressorV310Contract.js";
|
|
257
257
|
import { CreditAccountsServiceV310 } from "./accounts/CreditAccountsServiceV310.js";
|
|
258
258
|
import { IntentValidationError, raise } from "./validation/raise.js";
|
|
259
|
-
import { LeverageBand } from "./accounts/intents/leverage-band.js";
|
|
260
259
|
import { CalcDefaultQuotaProps, CalcQuotaUpdateProps, CalcRecommendedQuotaProps, calcDefaultQuota, calcQuotaUpdate, calcRecommendedQuota, roundUpQuota } from "./accounts/quota-utils.js";
|
|
261
260
|
import { AccountCalculatorOperation } from "./accounts/intents/operations.js";
|
|
262
261
|
import { AddCollateralIntent, AdjustLeverageIntent, ClaimRemainder, CreditAccountSlice, DelayableIntent, DelayedRoute, DelayedStart, DelayedStartResult, DepositStrategyIntent, FinishIntentProps, FinishIntentResult, InstantRoute, IntentPreviewResult, IntentRoutesResult, OperationState, PathLossRate, RepayStrategyIntent, ResumableIntent, RouteErrors, StartIntent, WithdrawAssetIntent, WithdrawCeilings, WithdrawStrategyIntent } from "./accounts/intents/types.js";
|
|
262
|
+
import { BorrowProps, BorrowState } from "./accounts/intents/borrow.js";
|
|
263
|
+
import { LeverageBand } from "./accounts/intents/leverage-band.js";
|
|
263
264
|
import { OpenStrategyProps, OpenStrategyState } from "./accounts/intents/open-strategy.js";
|
|
264
265
|
import { fetchCreditAccountSlice, toCreditAccountSlice } from "./accounts/intents/utils/credit-account-slice.js";
|
|
265
266
|
import { isPhantomToken } from "./accounts/intents/utils/pick-token.js";
|
|
266
|
-
import { CreditAccountOperationsService, OpenStrategyPreviewResult } from "./accounts/intents/index.js";
|
|
267
|
+
import { BorrowPreviewResult, CreditAccountOperationsService, EmptyAccountPreviewResult, OpenStrategyPreviewResult } from "./accounts/intents/index.js";
|
|
267
268
|
import { LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS } from "./accounts/liquidations/constants.js";
|
|
268
269
|
import { BuildLiquidationTxProps, BuildLiquidationTxPropsBase, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, LoadRWALiquidatorsProps, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, RWALiquidatorInfo } from "./accounts/liquidations/types.js";
|
|
269
270
|
import { LiquidationsService } from "./accounts/liquidations/LiquidationsService.js";
|
|
@@ -334,4 +335,4 @@ import { amountOf } from "./validation/helpers/amount.js";
|
|
|
334
335
|
import { MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM } from "./validation/helpers/health-factor-limits.js";
|
|
335
336
|
import { toToken, toTokenAmount } from "./validation/helpers/token.js";
|
|
336
337
|
import "./validation/index.js";
|
|
337
|
-
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, AbstractAdapterContract, AbstractAdapterContractOptions, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, type AccountCalculatorOperation, AccountMigratorAdapterContract, AccountSnapshot, AccountToCheck, AdapterContractStateHuman, AdapterContractType, AdapterData, AdapterFactoryArgs, AdapterOperation, AdapterOperationBase, AdapterProtocolOperation, AdapterType, type AddCollateralIntent, AddCollateralOp, AddLiquidityProps, AddressMap, AddressProviderAddresses, AddressProviderState, AddressProviderV310Contract, type AddressProviderV3StateHuman, AddressSet, type AdjustLeverageIntent, type AliasLossPolicyStateHuman, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, AssertAssignable, Asset, type AssetPriceFeedStateHuman, AssetWithAmountInTarget, AssetsMap, AttachOptions, BLOCKS_PER_WEEK_BY_NETWORK, BalanceDelta, BalancerStablePriceFeedContract, BalancerSwap, BalancerV3Pool, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, type BalancerWeightedPriceFeedStateHuman, BaseContract, BaseContractArgs, type BaseContractStateHuman, BaseParams, BasePlugin, type BasePriceFeedStateHuman, BaseState, BasicSwapCall, BigIntMath, type BlockNumberProps, BorrowLimitArgs, type BotListStateHuman, BotPermissions, BotStatusCall, BotsDirectResponse, type BoundedOracleStateHuman, BoundedPriceFeedContract, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, CalcBorrowRateProps, CalcDefaultQuotaProps, CalcHealthFactorProps, CalcLiquidationPriceForTargetProps, CalcLiquidationPriceProps, CalcQuotaUpdateProps, CalcRecommendedQuotaProps, CallTrace, CamelotPool, CamelotV3AdapterContract, ChainBlock, ChainBlockPin, ChainBlockSource, ChainConfig, ChainContractsRegister, ChainNotConfiguredError, ChainQueryOneProps, ChainQueryProps, CheckCollateralFundingInput, CheckLiquidationEligibilityInput, CheckLiquidationFundingInput, CheckLiquidationInput, CheckLiquidationOptions, CheckMidasAccountGreenlistInput, CheckOperationInput, CheckOperationOptions, CheckPoolFundingInput, CheckRWAOpenRequirementsInput, CheckRWAOpeningInput, CheckSimulationInput, CheckWalletAllowanceInput, CheckWalletBalanceInput, CheckWalletInput, ClaimFarmRewardsProps, type ClaimRemainder, ClaimableWithdrawal, ClassifyInnerOperationsProps, ClientOptions, CloseCreditAccountOperation, CloseCreditAccountResult, CloseOrRepayOperation, ClosePathBalances, CollateralFundingPreview, CollateralisedArgs, CompareBalancesOp, CompositePriceFeedContract, CompressorZapperData, ConcreteAdapterContractOptions, ConnectedBotData, ConnectedBotsCall, ConnectedBotsPerAccount, type ConstantOracleStateHuman, Construct, ConstructOptions, type ContractMethod, ContractOrInterface, ContractParseError, ContractParseErrorOptions, ConvertFn, ConvexDeposit, ConvexDepositAndStake, ConvexStake, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, ConvexWithdraw, ConvexWithdrawAndClaim, type CoreStateHuman, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountData, CreditAccountDataCall, CreditAccountDataPayload, CreditAccountFilter, CreditAccountFrozenArgs, CreditAccountOperation, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountState, CreditAccountStateProps, CreditAccountTokenQuota, CreditAccountTokensSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, CreditConfiguratorState, type CreditConfiguratorStateHuman, CreditConfiguratorV310Contract, CreditFacadeState, type CreditFacadeStateHuman, type abi as CreditFacadeV310Abi, abi as creditFacadeV310Abi, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerDebtParams, type CreditManagerDebtParamsHuman, CreditManagerFilter, CreditManagerOperationResult, CreditManagerPausedArgs, CreditManagerState, type CreditManagerStateHuman, CreditManagerV310Contract, CreditOperationArgs, CreditOperationError, CreditOperationPreview, CreditSimulationInput, CreditSuite, CreditSuiteState, type CreditSuiteStateHuman, CurrentWithdrawals, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveAddLiquidity, CurveClaims, CurveCryptoPriceFeedContract, CurveExchange, CurveRemoveLiquidity, CurveRemoveLiquidityOneCoin, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, CurveWithdrawal, DEFAULT_QUOTA_BUFFER_BPS, DEGEN_NFT_MIDAS, DEGEN_NFT_SECURITIZE, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DStokenData, DUST_THRESHOLD, DaiUsdsAdapterContract, DebtLimitsArgs, DecreaseDebtOp, type DelayableIntent, DelayedIntentExtended, type DelayedRoute, type DelayedStart, type DelayedStartResult, DelayedWithdrawalClaim, DelayedWithdrawalRequest, DelegatedMulticall, DepositMetadata, type DepositStrategyIntent, DetectedDelayedClaim, DetectedDelayedOperation, DirectTokenTransferOperation, ERC4626AdapterContract, ERC4626ReferralAdapterContract, EXECUTE_BYTES_SELECTOR, EmergencyLiquidatorArgs, EncodableCreditAccountOperation, Erc4626PriceFeedContract, EstimateRawTxGasParameters, EtherscanURLParam, ExecuteMulticallBatchesOptions, ExpectedBalanceDeltasProps, ExpectedOutput, ExternalPriceFeedContract, FacadeOperationMetadata, type FetchRedstonePayloadsOptions, FilterDustUSDOptions, FindBestClosePathProps, FindClaimAllRewardsProps, FindManyToOnePathProps, FindOneTokenPathProps, FindOpenStrategyPathProps, type FinishIntentProps, type FinishIntentResult, FluidDexAdapterContract, ForbiddenTokenArgs, FormatBNOptions, FullyLiquidateProps, FullyLiquidateResult, GaugeContract, GaugeData, GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, type GearStakingV3StateHuman, GearboxChain, type GearboxState, type GearboxStateHuman, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetCurrentWithdrawalsProps, GetCurrentWithdrawalsPropsBase, GetExternalAccountCurrentWithdrawalsProps, GetInvestorOptions, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetOpenAccountRequirementsProps, GetReward, GetWithdrawalRequestResultProps, HealthFactorThresholds, HydrateOptions, IAdapterContract, IAddressProviderContract, IBaseContract, ICreditAccountsService, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IDegenNFT, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, type ILogger, IMultichainOpportunitiesService, IMultichainPositionsService, IOnchainSDKPlugin, IOnchainSDKPluginConstructor, IPluginState, IPoolContract, IPoolsService, IPriceFeedContract, IPriceOracleContract, type IPriceUpdateTx, IRWAFactory, IRateKeeperContract, IRedemptionLoggerContract, IRouterContract, IUpdatablePriceFeedContract, IWithdrawalCompressorContract, IZapperContract, IncreaseDebtOp, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, InnerFacadeOperation, InnerOperation, type InstantRoute, type IntentPreviewResult, type IntentRoutesResult, type IntentValidationError, type InterestRateModelStateHuman, InterestRateModelType, IsDustOptions, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LPMonopolizedPoolMeta, type LPPriceFeedStateHuman, LatestUpdate, LegacyAdapterOperation, LeverageArgs, type LeverageBand, LidoSubmit, LidoV1AdapterContract, LinearInterestRateModelContract, type LinearInterestRateModelStateHuman, LiquidateCreditAccountOperation, LiquidationEligibilityError, LiquidationFees, LiquidationValidationError, LiquidationsService, LiquidatorEligibleArgs, ListPoolPositionsProps, ListPositionsProps, ListPositionsPropsBase, ListStrategyPositionsProps, LoadRWALiquidatorsProps, type LogFn, type LossPolicyStateHuman, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_UINT16, MAX_UINT256, MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_INT96, MIN_SAFE_HEALTH_FACTOR_FORM, MULTICALL_ADDRESS, MakerDeposit, MakerRedeem, MarketData, MarketExpiredArgs, MarketFilter, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, MarketStateError, type MarketStateHuman, MarketSuite, MarketType, MaxBorrowAmount, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, Methods, MidasDegenNFT, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, MissingSerializedParamsError, type MultiCall, MulticallBatch, MulticallOperation, MulticallWithFailure, MultichainAttachOptions, type MultichainChainIdsProps, MultichainConstruct, MultichainHydrateOptions, MultichainLiquidationsService, type MultichainNetworkProps, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, MultichainSDKOptions, type MultichainState, type MultichainStateHuman, MultichainSyncStateOptions, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OnchainSDK, OnchainSDKOptions, OpenCAProps, OpenCreditAccountOperation, OpenStrategyPreviewResult, type OpenStrategyProps, OpenStrategyResult, type OpenStrategyState, Operation, OperationMetadata, type OperationState, OperationValidationError, OpportunitiesService, OptimalRepaidAmountProps, OuterFacadeOperation, 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, ParsedCall, ParsedCallArgs, ParsedCallV2, ParsedZapperDeposit, ParsedZapperOperation, ParsedZapperRedeem, PartialLiquidationOperation, PartialLiquidationParams, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PartialRecord, PartiallyLiquidateProps, type PathLossRate, PendingWithdrawal, PendlePair, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PeripheryCompressorV310Contract, PeripheryContract, PermitResult, PhantomTokenContractType, PhantomTokenMeta, PickSomeRequired, PluginFactoriesMap, PluginFactory, PluginState, PluginStateVersionError, PluginStatesMap, PluginsMap, PoolDepositOperation, PoolLiquidityArgs, PoolMintOperation, PoolOperation, PoolOperationArgs, PoolOperationError, PoolPausedArgs, PoolQuotaKeeperContract, type PoolQuotaKeeperStateHuman, PoolRedeemOperation, PoolService, PoolServiceCall, PoolServiceCallResult, PoolSimulation, PoolState, type PoolStateHuman, PoolSuite, type PoolSuiteStateHuman, PoolSunsetArgs, PoolV310Contract, PoolWithdrawOperation, PositionsService, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, PreviewOperationError, PriceFeedAnswer, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, type PriceFeedStateHuman, PriceFeedTreeNode, PriceFeedUsageType, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions, PriceOracleData, type PriceOracleStateHuman, PriceOracleV310Contract, PriceUpdate, ProjectedPoolOptions, PythPriceFeed, QuotaCountArgs, QuotaKeeperState, QuotaLimitArgs, QuotaMode, type QuotaParamsHuman, QuotaSlice, QuotaState, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWACompressorCall, RWACompressorInvestorData, RWACompressorResponse, RWADefaultTokenMeta, RWAFactoryData, RWAFactoryProtocol, RWAFactoryStateHuman, RWAInvestorData, RWALiquidatorInfo, RWAMulticallOperation, RWAOnDemandLPMeta, RWAOnDemandLPMonopolizedMeta, RWAOnDemandLpContractType, RWAOnDemandTokenMeta, RWAOpenCreditAccountOperation, RWAOpeningError, RWAOperation, RWAOperationMetadata, RWARegistry, RWAState, RWAStateHuman, RWATokenMeta, RWAUnderlyingContractType, RWAUnderlyingData, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RampEvent, RateKeeperState, type RateKeeperStateHuman, RateKeeperType, type RawTx, RedemptionLog, RedemptionLoggerV310Contract, RedemptionPhantomRename, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, RelaxedBaseParams, RemoveLiquidityProps, type RepayStrategyIntent, ReplayMulticallResult, ReplayState, ReplayableOperation, RequestableWithdrawal, ReservePriceLimitedArgs, type ResumableIntent, RetryOptions, RewardInfo, Rewards, type RouteErrors, RouterCASlice, RouterCMSlice, RouterCloseResult, RouterResult, RouterRewardsResult, RouterV310Contract, SDKConstruct, SDKOptions, SECONDS_PER_YEAR, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeCreditAccountData, SecuritizeDegenNFT, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRedemptionGatewayAdapterContract, SendRawTxParameters, SetBotProps, SetBotResult, SimpleTokenMeta, SimulateCallOptions, SimulateCallParameters, SimulateCallReturnType, SimulateMulticallParameters, SimulateMulticallReturnType, SimulatePoolOperationProps, SimulateWithPriceUpdatesError, SimulateWithPriceUpdatesErrorParams, SimulateWithPriceUpdatesErrorType, SimulateWithPriceUpdatesParameters, SimulateWithPriceUpdatesReturnType, SimulationError, SimulationErrorType, SimulationValidationError, StakingRewardsAdapterContract, type StartIntent, StoreExpectedBalancesOp, StrategyCollateralProps, StrategyRateInputs, SupportedValue, Swap, SwapOperation, SyncStateOptions, type TimestampedCalldata, TokenAmount, TokenInfo, TokenMetaData, TokenTransfer, TokensMeta, TokensMetaState, TraceAdapterExt, TraderJoePool, TraderJoePoolVersion, TraderJoeRouterAdapterContract, Transfers, type TumblerStateHuman, TypedObjectUtils, Unarray, UniswapSwap, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UpdatePriceFeedsResult, UpdateQuotaOp, UpshiftVaultAdapterContract, VERSION_RANGE_310, VaultDeposit, VelodromeV2RouterAdapterContract, VersionRange, VersionedAbi, VotingContractStatus, WAD, WAD_DECIMALS_POW, WalletFundingError, WatchBlocksAsyncParameters, WatchBlocksAsyncReturnType, WeighedFactors, type WithBlock, type WithMultichain, type WithdrawAssetIntent, type WithdrawCeilings, WithdrawCollateral, WithdrawCollateralOp, type WithdrawStrategyIntent, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalMetadata, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, WstETHPriceFeedContract, WstETHUnwrap, WstETHV1AdapterContract, WstETHWrap, YearnPriceFeedContract, ZapperContract, ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, accountSnapshotFromCreditAccountData, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, amountOf, assetsMap, attachOptionsSchema, botPermissionsToString, bpsToRay, buildDelayedStrategyPositionOperationPreview, bytes32ToString, calcBorrowApy, calcBorrowRate, calcDefaultQuota, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcQuotaUpdate, calcRecommendedQuota, calcTimeToLiquidationMs, calcUtilization, calcUtilizationRaw, chains, checkAccountQuotas, checkBorrowLimit, checkCollateralFunding, checkCollateralised, checkCreditAccountFrozen, checkCreditManagerPaused, checkCreditOperation, checkDebtLimits, checkEmergencyLiquidator, checkForbiddenToken, checkHealthFactors, checkIncreaseDebt, checkIncreaseQuota, checkLeverage, checkLiquidation, checkLiquidationEligibility, checkLiquidationFunding, checkLiquidatorEligible, checkMarket, checkMarketExpired, checkMidasAccountGreenlist, checkObtained, checkOperation, checkPoolFunding, checkPoolLiquidity, checkPoolOperation, checkPoolPaused, checkPoolSunset, checkQuotaCount, checkQuotaLimit, checkRWAOpenRequirements, checkRWAOpening, checkReservePriceLimited, checkSimulation, checkWallet, checkWalletAllowance, checkWalletBalance, childLogger, classifyCloseOrRepay, classifyCurveOperation, classifyInnerOperations, collateralPriceInUnderlying, collectTraces, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, decodeDelayedIntent, detectDelayedClaim, detectDelayedOperation, detectNetwork, dominantCollateral, encodeDelayedIntent, erc4626ReferralAdapterAbi, estimateClaimableAt, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchCreditAccountSlice, fetchRedstonePayloads, filterDust, filterDustUSD, findCallTo, findCallWithInput, findCuratorMarketConfigurator, findExecuteBytes, fmtBinaryMask, fnSigToName, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAccountTargetCollateral, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getLegacyStrategyTarget, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hasAdapterDeployParamsAbi, healthFactorBps, hexEq, hydrateAddressProvider, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCreditAccountAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isCloseOrRepay, isDust, isLPPriceFeed, isPhantomToken, isPoolOperation, isPublicNetwork, isRWAFactory, isRWAOperation, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, isZeroBalance, iwstETHAbi, iwstEthv1AdapterAbi, json_parse, json_stringify, lidoV1_WETHGatewayAbi, makeReplayState, mellowDvvAdapterAbi, midasGreenlistsAccount, minSeizedAmount, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, parseAdapterAction, parseAdapterDeployParams, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parsePosNegAmount, parseRWAFactoryOperationCalldata, percentFmt, pickStrategyTargetCollateral, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, raise, rayToBps, rayToNumber, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent, resolveProtocolCall, retry, rewardsFromTransfers, roundUpQuota, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, soleNonUnderlyingCollateral, strategyName, swapFromTransfers, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toCreditAccountSlice, toNetTransfers, toPendingWithdrawal, toRequestableWithdrawal, toSignificant, toToken, toTokenAmount, toWithdrawalStatus, usdToNumber, watchBlocksAsync };
|
|
338
|
+
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, AbstractAdapterContract, AbstractAdapterContractOptions, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, type AccountCalculatorOperation, AccountMigratorAdapterContract, AccountSnapshot, AccountToCheck, AdapterContractStateHuman, AdapterContractType, AdapterData, AdapterFactoryArgs, AdapterOperation, AdapterOperationBase, AdapterProtocolOperation, AdapterType, type AddCollateralIntent, AddCollateralOp, AddLiquidityProps, AddressMap, AddressProviderAddresses, AddressProviderState, AddressProviderV310Contract, type AddressProviderV3StateHuman, AddressSet, type AdjustLeverageIntent, type AliasLossPolicyStateHuman, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, AssertAssignable, Asset, type AssetPriceFeedStateHuman, AssetWithAmountInTarget, AssetsMap, AttachOptions, BLOCKS_PER_WEEK_BY_NETWORK, BalanceDelta, BalancerStablePriceFeedContract, BalancerSwap, BalancerV3Pool, BalancerV3PoolStatus, BalancerV3RouterAdapterContract, BalancerV3WrapperAdapterContract, BalancerWeightedPriceFeedContract, type BalancerWeightedPriceFeedStateHuman, BaseContract, BaseContractArgs, type BaseContractStateHuman, BaseParams, BasePlugin, type BasePriceFeedStateHuman, BaseState, BasicSwapCall, BigIntMath, type BlockNumberProps, BorrowLimitArgs, BorrowPreviewResult, type BorrowProps, type BorrowState, type BotListStateHuman, BotPermissions, BotStatusCall, BotsDirectResponse, type BoundedOracleStateHuman, BoundedPriceFeedContract, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, CalcBorrowRateProps, CalcDefaultQuotaProps, CalcHealthFactorProps, CalcLiquidationPriceForTargetProps, CalcLiquidationPriceProps, CalcQuotaUpdateProps, CalcRecommendedQuotaProps, CallTrace, CamelotPool, CamelotV3AdapterContract, ChainBlock, ChainBlockPin, ChainBlockSource, ChainConfig, ChainContractsRegister, ChainNotConfiguredError, ChainQueryOneProps, ChainQueryProps, CheckCollateralFundingInput, CheckLiquidationEligibilityInput, CheckLiquidationFundingInput, CheckLiquidationInput, CheckLiquidationOptions, CheckMidasAccountGreenlistInput, CheckOperationInput, CheckOperationOptions, CheckPoolFundingInput, CheckRWAOpenRequirementsInput, CheckRWAOpeningInput, CheckSimulationInput, CheckWalletAllowanceInput, CheckWalletBalanceInput, CheckWalletInput, ClaimFarmRewardsProps, type ClaimRemainder, ClaimableWithdrawal, ClassifyInnerOperationsProps, ClientOptions, CloseCreditAccountOperation, CloseCreditAccountResult, CloseOrRepayOperation, ClosePathBalances, CollateralFundingPreview, CollateralisedArgs, CompareBalancesOp, CompositePriceFeedContract, CompressorZapperData, ConcreteAdapterContractOptions, ConnectedBotData, ConnectedBotsCall, ConnectedBotsPerAccount, type ConstantOracleStateHuman, Construct, ConstructOptions, type ContractMethod, ContractOrInterface, ContractParseError, ContractParseErrorOptions, ConvertFn, ConvexDeposit, ConvexDepositAndStake, ConvexStake, ConvexV1BaseRewardPoolAdapterContract, ConvexV1BoosterAdapterContract, ConvexWithdraw, ConvexWithdrawAndClaim, type CoreStateHuman, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountData, CreditAccountDataCall, CreditAccountDataPayload, CreditAccountFilter, CreditAccountFrozenArgs, CreditAccountOperation, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountState, CreditAccountStateProps, CreditAccountTokenQuota, CreditAccountTokensSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, CreditConfiguratorState, type CreditConfiguratorStateHuman, CreditConfiguratorV310Contract, CreditFacadeState, type CreditFacadeStateHuman, type abi as CreditFacadeV310Abi, abi as creditFacadeV310Abi, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerDebtParams, type CreditManagerDebtParamsHuman, CreditManagerFilter, CreditManagerOperationResult, CreditManagerPausedArgs, CreditManagerState, type CreditManagerStateHuman, CreditManagerV310Contract, CreditOperationArgs, CreditOperationError, CreditOperationPreview, CreditSimulationInput, CreditSuite, CreditSuiteState, type CreditSuiteStateHuman, CurrentWithdrawals, Curve2AssetsAdapterContract, Curve3AssetsAdapterContract, Curve4AssetsAdapterContract, CurveAddLiquidity, CurveClaims, CurveCryptoPriceFeedContract, CurveExchange, CurveRemoveLiquidity, CurveRemoveLiquidityOneCoin, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, CurveV1AdapterStETHContract, CurveV1StableNGAdapterContract, CurveWithdrawal, DEFAULT_QUOTA_BUFFER_BPS, DEGEN_NFT_MIDAS, DEGEN_NFT_SECURITIZE, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DStokenData, DUST_THRESHOLD, DaiUsdsAdapterContract, DebtLimitsArgs, DecreaseDebtOp, type DelayableIntent, DelayedIntentExtended, type DelayedRoute, type DelayedStart, type DelayedStartResult, DelayedWithdrawalClaim, DelayedWithdrawalRequest, DelegatedMulticall, DepositMetadata, type DepositStrategyIntent, DetectedDelayedClaim, DetectedDelayedOperation, DirectTokenTransferOperation, ERC4626AdapterContract, ERC4626ReferralAdapterContract, EXECUTE_BYTES_SELECTOR, EmergencyLiquidatorArgs, EmptyAccountPreviewResult, EncodableCreditAccountOperation, Erc4626PriceFeedContract, EstimateRawTxGasParameters, EtherscanURLParam, ExecuteMulticallBatchesOptions, ExpectedBalanceDeltasProps, ExpectedOutput, ExternalPriceFeedContract, FacadeOperationMetadata, type FetchRedstonePayloadsOptions, FilterDustUSDOptions, FindBestClosePathProps, FindClaimAllRewardsProps, FindManyToOnePathProps, FindOneTokenPathProps, FindOpenStrategyPathProps, type FinishIntentProps, type FinishIntentResult, FluidDexAdapterContract, ForbiddenTokenArgs, FormatBNOptions, FullyLiquidateProps, FullyLiquidateResult, GaugeContract, GaugeData, GaugeParams, type GaugeParamsHuman, type GaugeStateHuman, type GearStakingV3StateHuman, GearboxChain, type GearboxState, type GearboxStateHuman, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetCurrentWithdrawalsProps, GetCurrentWithdrawalsPropsBase, GetExternalAccountCurrentWithdrawalsProps, GetInvestorOptions, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetOpenAccountRequirementsProps, GetReward, GetWithdrawalRequestResultProps, HealthFactorThresholds, HydrateOptions, IAdapterContract, IAddressProviderContract, IBaseContract, ICreditAccountsService, ICreditConfiguratorContract, ICreditFacadeContract, ICreditManagerContract, IDegenNFT, IERC20ZapperContract, IETHZapperContract, IInterestRateModelContract, type ILogger, IMultichainOpportunitiesService, IMultichainPositionsService, IOnchainSDKPlugin, IOnchainSDKPluginConstructor, IPluginState, IPoolContract, IPoolsService, IPriceFeedContract, IPriceOracleContract, type IPriceUpdateTx, IRWAFactory, IRateKeeperContract, IRedemptionLoggerContract, IRouterContract, IUpdatablePriceFeedContract, IWithdrawalCompressorContract, IZapperContract, IncreaseDebtOp, InfinifiGatewayAdapterContract, InfinifiUnwindingGatewayAdapterContract, InnerFacadeOperation, InnerOperation, type InstantRoute, type IntentPreviewResult, type IntentRoutesResult, type IntentValidationError, type InterestRateModelStateHuman, InterestRateModelType, IsDustOptions, KelpLRTDepositPoolAdapterContract, KelpLRTWithdrawalManagerAdapterContract, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LPMonopolizedPoolMeta, type LPPriceFeedStateHuman, LatestUpdate, LegacyAdapterOperation, LeverageArgs, type LeverageBand, LidoSubmit, LidoV1AdapterContract, LinearInterestRateModelContract, type LinearInterestRateModelStateHuman, LiquidateCreditAccountOperation, LiquidationEligibilityError, LiquidationFees, LiquidationValidationError, LiquidationsService, LiquidatorEligibleArgs, ListPoolPositionsProps, ListPositionsProps, ListPositionsPropsBase, ListStrategyPositionsProps, LoadRWALiquidatorsProps, type LogFn, type LossPolicyStateHuman, MAX_INT, MAX_LEVERAGE_BUFFER_BPS, MAX_UINT16, MAX_UINT256, MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_INT96, MIN_SAFE_HEALTH_FACTOR_FORM, MULTICALL_ADDRESS, MakerDeposit, MakerRedeem, MarketData, MarketExpiredArgs, MarketFilter, MarketRegister, MarketRegistryState, MarketRegistryStateHuman, MarketStateError, type MarketStateHuman, MarketSuite, MarketType, MaxBorrowAmount, MellowClaimerAdapterContract, MellowDVVAdapterContract, MellowERC4626VaultAdapterContract, MellowLRTPriceFeedContract, MellowWrapperAdapterContract, Methods, MidasDegenNFT, MidasGatewayAdapterContract, MidasIssuanceVaultAdapterContract, MidasLiquidatorContract, MidasRedemptionVaultAdapterContract, MissingSerializedParamsError, type MultiCall, MulticallBatch, MulticallOperation, MulticallWithFailure, MultichainAttachOptions, type MultichainChainIdsProps, MultichainConstruct, MultichainHydrateOptions, MultichainLiquidationsService, type MultichainNetworkProps, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, MultichainSDKOptions, type MultichainState, type MultichainStateHuman, MultichainSyncStateOptions, NATIVE_ADDRESS, NON_STRATEGY_PHANTOM_TOKEN_TYPES, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OnchainSDK, OnchainSDKOptions, OpenCAProps, OpenCreditAccountOperation, OpenStrategyPreviewResult, type OpenStrategyProps, OpenStrategyResult, type OpenStrategyState, Operation, OperationMetadata, type OperationState, OperationValidationError, OpportunitiesService, OptimalRepaidAmountProps, OuterFacadeOperation, 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, ParsedCall, ParsedCallArgs, ParsedCallV2, ParsedZapperDeposit, ParsedZapperOperation, ParsedZapperRedeem, PartialLiquidationOperation, PartialLiquidationParams, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PartialRecord, PartiallyLiquidateProps, type PathLossRate, PendingWithdrawal, PendlePair, PendlePairStatus, PendleRouterAdapterContract, PendleTWAPPTPriceFeed, PendleTokenType, PeripheryCompressorV310Contract, PeripheryContract, PermitResult, PhantomTokenContractType, PhantomTokenMeta, PickSomeRequired, PluginFactoriesMap, PluginFactory, PluginState, PluginStateVersionError, PluginStatesMap, PluginsMap, PoolDepositOperation, PoolLiquidityArgs, PoolMintOperation, PoolOperation, PoolOperationArgs, PoolOperationError, PoolPausedArgs, PoolQuotaKeeperContract, type PoolQuotaKeeperStateHuman, PoolRedeemOperation, PoolService, PoolServiceCall, PoolServiceCallResult, PoolSimulation, PoolState, type PoolStateHuman, PoolSuite, type PoolSuiteStateHuman, PoolSunsetArgs, PoolV310Contract, PoolWithdrawOperation, PositionsService, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, PreviewOperationError, PriceFeedAnswer, PriceFeedConstructorArgs, PriceFeedContractType, PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, PriceFeedRegisterHooks, PriceFeedRegisterOptions, type PriceFeedStateHuman, PriceFeedTreeNode, PriceFeedUsageType, PriceFeedsForAccountOptions, PriceFeedsForTokensOptions, PriceOracleData, type PriceOracleStateHuman, PriceOracleV310Contract, PriceUpdate, ProjectedPoolOptions, PythPriceFeed, QuotaCountArgs, QuotaKeeperState, QuotaLimitArgs, QuotaMode, type QuotaParamsHuman, QuotaSlice, QuotaState, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWACompressorCall, RWACompressorInvestorData, RWACompressorResponse, RWADefaultTokenMeta, RWAFactoryData, RWAFactoryProtocol, RWAFactoryStateHuman, RWAInvestorData, RWALiquidatorInfo, RWAMulticallOperation, RWAOnDemandLPMeta, RWAOnDemandLPMonopolizedMeta, RWAOnDemandLpContractType, RWAOnDemandTokenMeta, RWAOpenCreditAccountOperation, RWAOpeningError, RWAOperation, RWAOperationMetadata, RWARegistry, RWAState, RWAStateHuman, RWATokenMeta, RWAUnderlyingContractType, RWAUnderlyingData, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RampEvent, RateKeeperState, type RateKeeperStateHuman, RateKeeperType, type RawTx, RedemptionLog, RedemptionLoggerV310Contract, RedemptionPhantomRename, RedstonePriceFeedContract, type RedstonePriceFeedStateHuman, RelaxedBaseParams, RemoveLiquidityProps, type RepayStrategyIntent, ReplayMulticallResult, ReplayState, ReplayableOperation, RequestableWithdrawal, ReservePriceLimitedArgs, type ResumableIntent, RetryOptions, RewardInfo, Rewards, type RouteErrors, RouterCASlice, RouterCMSlice, RouterCloseResult, RouterResult, RouterRewardsResult, RouterV310Contract, SDKConstruct, SDKOptions, SECONDS_PER_YEAR, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkRWADataNotLoadedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeCreditAccountData, SecuritizeDegenNFT, SecuritizeInvestorData, SecuritizeLiquidatorContract, SecuritizeOnRampAdapterContract, SecuritizeRWAFactory, SecuritizeRWAFactoryStateHuman, SecuritizeRedemptionGatewayAdapterContract, SendRawTxParameters, SetBotProps, SetBotResult, SimpleTokenMeta, SimulateCallOptions, SimulateCallParameters, SimulateCallReturnType, SimulateMulticallParameters, SimulateMulticallReturnType, SimulatePoolOperationProps, SimulateWithPriceUpdatesError, SimulateWithPriceUpdatesErrorParams, SimulateWithPriceUpdatesErrorType, SimulateWithPriceUpdatesParameters, SimulateWithPriceUpdatesReturnType, SimulationError, SimulationErrorType, SimulationValidationError, StakingRewardsAdapterContract, type StartIntent, StoreExpectedBalancesOp, StrategyCollateralProps, StrategyRateInputs, SupportedValue, Swap, SwapOperation, SyncStateOptions, type TimestampedCalldata, TokenAmount, TokenInfo, TokenMetaData, TokenTransfer, TokensMeta, TokensMetaState, TraceAdapterExt, TraderJoePool, TraderJoePoolVersion, TraderJoeRouterAdapterContract, Transfers, type TumblerStateHuman, TypedObjectUtils, Unarray, UniswapSwap, UniswapV2AdapterContract, UniswapV3AdapterContract, UniswapV4AdapterContract, UpdatePriceFeedsResult, UpdateQuotaOp, UpshiftVaultAdapterContract, VERSION_RANGE_310, VaultDeposit, VelodromeV2RouterAdapterContract, VersionRange, VersionedAbi, VotingContractStatus, WAD, WAD_DECIMALS_POW, WalletFundingError, WatchBlocksAsyncParameters, WatchBlocksAsyncReturnType, WeighedFactors, type WithBlock, type WithMultichain, type WithdrawAssetIntent, type WithdrawCeilings, WithdrawCollateral, WithdrawCollateralOp, type WithdrawStrategyIntent, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalMetadata, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, WstETHPriceFeedContract, WstETHUnwrap, WstETHV1AdapterContract, WstETHWrap, YearnPriceFeedContract, ZapperContract, ZapperData, type ZapperStateHuman, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, accountSnapshotFromCreditAccountData, adapterActionAbi, adapterActionSelectors, adapterActionSignatures, adapterConstructorAbi, allTransfersAsTokenAmounts, amountOf, assetsMap, attachOptionsSchema, botPermissionsToString, bpsToRay, buildDelayedStrategyPositionOperationPreview, bytes32ToString, calcBorrowApy, calcBorrowRate, calcDefaultQuota, calcEffectiveBorrowApy, calcHealthFactor, calcLiquidationPrice, calcLiquidationPriceForTarget, calcMaxLeverage, calcNetStrategyApy, calcPositionLeverage, calcQuotaRate, calcQuotaUpdate, calcRecommendedQuota, calcTimeToLiquidationMs, calcUtilization, calcUtilizationRaw, chains, checkAccountQuotas, checkBorrowLimit, checkCollateralFunding, checkCollateralised, checkCreditAccountFrozen, checkCreditManagerPaused, checkCreditOperation, checkDebtLimits, checkEmergencyLiquidator, checkForbiddenToken, checkHealthFactors, checkIncreaseDebt, checkIncreaseQuota, checkLeverage, checkLiquidation, checkLiquidationEligibility, checkLiquidationFunding, checkLiquidatorEligible, checkMarket, checkMarketExpired, checkMidasAccountGreenlist, checkObtained, checkOperation, checkPoolFunding, checkPoolLiquidity, checkPoolOperation, checkPoolPaused, checkPoolSunset, checkQuotaCount, checkQuotaLimit, checkRWAOpenRequirements, checkRWAOpening, checkReservePriceLimited, checkSimulation, checkWallet, checkWalletAllowance, checkWalletBalance, childLogger, classifyCloseOrRepay, classifyCurveOperation, classifyInnerOperations, collateralPriceInUnderlying, collectTraces, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, curveAddLiquidityFromTransfers, curveRemoveLiquidityFromTransfers, decodeDelayedIntent, detectDelayedClaim, detectDelayedOperation, detectNetwork, dominantCollateral, encodeDelayedIntent, erc4626ReferralAdapterAbi, estimateClaimableAt, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, executeMulticallBatches, expectedBalanceDeltas, fetchCreditAccountSlice, fetchRedstonePayloads, filterDust, filterDustUSD, findCallTo, findCallWithInput, findCuratorMarketConfigurator, findExecuteBytes, fmtBinaryMask, fnSigToName, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAccountTargetCollateral, getAdapterActionAbi, getAdapterDeployParamsAbi, getAdapterType, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getLegacyStrategyTarget, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, hasAdapterDeployParamsAbi, healthFactorBps, hexEq, hydrateAddressProvider, iBalancerV3RouterAbi, iBalancerV3RouterAdapterAbi, iBalancerV3WrapperAbi, iBalancerV3WrapperAdapterAbi, iBaseOnRampAbi, iBaseRewardPoolAbi, iBoosterAbi, iCamelotV3AdapterAbi, iCamelotV3RouterAbi, iConvexV1BaseRewardPoolAdapterAbi, iConvexV1BoosterAdapterAbi, iCreditAccountAbi, iCurvePoolAbi, iCurvePoolStableNGAbi, iCurvePool_2Abi, iCurvePool_3Abi, iCurvePool_4Abi, iCurveV1StableNgAdapterAbi, iCurveV1_2AssetsAdapterAbi, iCurveV1_3AssetsAdapterAbi, iCurveV1_4AssetsAdapterAbi, iDaiUsdsAbi, iDaiUsdsAdapterAbi, iERC4626Abi, iERC4626ReferralAbi, iFluidDexAbi, iFluidDexAdapterAbi, iInfinifiGatewayAbi, iInfinifiGatewayAdapterAbi, iInfinifiUnwindingGatewayAbi, iInfinifiUnwindingGatewayAdapterAbi, iKelpLRTDepositPoolGatewayAbi, iKelpLRTWithdrawalManagerGatewayAbi, iKelpLrtDepositPoolAdapterAbi, iKelpLrtDepositPoolGatewayAbi, iKelpLrtWithdrawalManagerAdapterAbi, iKelpLrtWithdrawalManagerGatewayAbi, iLidoV1AdapterAbi, iMellow4626VaultAdapterAbi, iMellowClaimerAbi, iMellowClaimerAdapterAbi, iMellowWrapperAbi, iMellowWrapperAdapterAbi, iMidasGatewayAdapterV311Abi, iMidasGatewayV311Abi, iMidasIssuanceVaultAdapterV310Abi, iMidasIssuanceVaultV310Abi, iMidasRedemptionVaultAdapterV310Abi, iMidasRedemptionVaultGatewayV310Abi, iPendleRouterAbi, iPendleRouterAdapterAbi, iSecuritizeOnRampAbi, iSecuritizeOnRampAdapterV310Abi, iSecuritizeRedemptionGatewayAdapterV311Abi, iSecuritizeRedemptionGatewayV311Abi, iStakingRewardsAbi, iStakingRewardsAdapterAbi, iTraderJoeRouterAbi, iTraderJoeRouterAdapterAbi, iUniswapV2AdapterAbi, iUniswapV2Router02Abi, iUniswapV3Abi, iUniswapV3AdapterAbi, iUniswapV4AdapterAbi, iUniswapV4GatewayAbi, iUpshiftVaultAdapterAbi, iUpshiftVaultGatewayAbi, iVelodromeV2RouterAbi, iVelodromeV2RouterAdapterAbi, isCloseOrRepay, isDust, isLPPriceFeed, isPhantomToken, isPoolOperation, isPublicNetwork, isRWAFactory, isRWAOperation, isRWAToken, isStrategyCollateral, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, isZeroBalance, iwstETHAbi, iwstEthv1AdapterAbi, json_parse, json_stringify, lidoV1_WETHGatewayAbi, makeReplayState, mellowDvvAdapterAbi, midasGreenlistsAccount, minSeizedAmount, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, parseAdapterAction, parseAdapterDeployParams, parseFacadeOperationCalldata, parseOperationCalldata, parsePoolOperationCalldata, parsePosNegAmount, parseRWAFactoryOperationCalldata, percentFmt, pickStrategyTargetCollateral, previewAdjustStrategyPosition, previewExitOrRepayStrategyPosition, previewOperation, raise, rayToBps, rayToNumber, replayInnerOperations, replayMulticall, resolveDelayedClaimIntent, resolveProtocolCall, retry, rewardsFromTransfers, roundUpQuota, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, soleNonUnderlyingCollateral, strategyName, swapFromTransfers, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toCreditAccountSlice, toNetTransfers, toPendingWithdrawal, toRequestableWithdrawal, toSignificant, toToken, toTokenAmount, toWithdrawalStatus, usdToNumber, watchBlocksAsync };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { AccountPrepareRequest, IOpportunitiesExecute, OpenPrepareRequest, PoolPrepareRequest, PrepareRequest } from "./types.js";
|
|
1
|
+
import { AccountPrepareRequest, BorrowPrepareRequest, IOpportunitiesExecute, OpenEmptyPrepareRequest, OpenPrepareRequest, PoolPrepareRequest, PrepareRequest } from "./types.js";
|
|
2
2
|
import { ExecuteApi } from "./ExecuteApi.js";
|
|
3
|
-
export { AccountPrepareRequest, ExecuteApi, IOpportunitiesExecute, OpenPrepareRequest, PoolPrepareRequest, PrepareRequest };
|
|
3
|
+
export { AccountPrepareRequest, BorrowPrepareRequest, ExecuteApi, IOpportunitiesExecute, OpenEmptyPrepareRequest, OpenPrepareRequest, PoolPrepareRequest, PrepareRequest };
|
|
@@ -5,7 +5,7 @@ import "../../model/index.js";
|
|
|
5
5
|
import { Asset } from "../../onchain/base/types.js";
|
|
6
6
|
import { RawTx } from "../../onchain/types/transactions.js";
|
|
7
7
|
import "../../onchain/index.js";
|
|
8
|
-
import { LpResult, OpenStrategyResult, StrategyResult } from "../prepare/types.js";
|
|
8
|
+
import { BorrowResult, EmptyCreditAccountResult, LpResult, OpenStrategyResult, StrategyResult } from "../prepare/types.js";
|
|
9
9
|
import "../prepare/index.js";
|
|
10
10
|
import { Address } from "viem";
|
|
11
11
|
//#region src/sdk/execute/types.d.ts
|
|
@@ -51,6 +51,47 @@ interface OpenPrepareRequest {
|
|
|
51
51
|
**/
|
|
52
52
|
signaturesToCache?: SecuritizeRegisterMessage[];
|
|
53
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Taking a loan, from a viable {@link IOpportunitiesPrepare.borrow} result.
|
|
56
|
+
*
|
|
57
|
+
* Goes through the same `openCA` as an opening, with the payout named as the
|
|
58
|
+
* token to withdraw — everything else the transaction needs, the collateral
|
|
59
|
+
* included, is already on the prepared state.
|
|
60
|
+
**/
|
|
61
|
+
interface BorrowPrepareRequest {
|
|
62
|
+
kind: "borrow";
|
|
63
|
+
chainId: ChainId;
|
|
64
|
+
creditManager: Address;
|
|
65
|
+
wallet: Address;
|
|
66
|
+
sim: SDKResult<BorrowResult>;
|
|
67
|
+
/** Native value to attach when the collateral is paid in the coin. */
|
|
68
|
+
ethAmount: bigint;
|
|
69
|
+
/**
|
|
70
|
+
* {@inheritDoc OpenPrepareRequest.signaturesToCache}
|
|
71
|
+
**/
|
|
72
|
+
signaturesToCache?: SecuritizeRegisterMessage[];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Opening an account that holds nothing, from a viable
|
|
76
|
+
* {@link IOpportunitiesPrepare.openEmptyCreditAccount} result.
|
|
77
|
+
*
|
|
78
|
+
* The market and the wallet are the whole request. Nothing is put up, drawn or
|
|
79
|
+
* routed, so there is nothing for a caller to hand over and nothing for the
|
|
80
|
+
* preparation to carry — which is also why this is its own kind rather than an
|
|
81
|
+
* `open` with empty arguments: a collateral passed by mistake has nowhere to
|
|
82
|
+
* land.
|
|
83
|
+
**/
|
|
84
|
+
interface OpenEmptyPrepareRequest {
|
|
85
|
+
kind: "openEmpty";
|
|
86
|
+
chainId: ChainId;
|
|
87
|
+
creditManager: Address;
|
|
88
|
+
wallet: Address;
|
|
89
|
+
/**
|
|
90
|
+
* The preparation this is built from. It carries no numbers; what it says is
|
|
91
|
+
* that the market took the request at the block it names.
|
|
92
|
+
**/
|
|
93
|
+
sim: SDKResult<EmptyCreditAccountResult>;
|
|
94
|
+
}
|
|
54
95
|
/**
|
|
55
96
|
* Any of the five operations on an existing account, from a viable
|
|
56
97
|
* {@link StrategyResult}: the facade multicall is the result's `calls`.
|
|
@@ -67,7 +108,7 @@ interface AccountPrepareRequest {
|
|
|
67
108
|
* `prepare` result plus the few facts about the wallet the preparation does not
|
|
68
109
|
* carry.
|
|
69
110
|
**/
|
|
70
|
-
type PrepareRequest = PoolPrepareRequest | OpenPrepareRequest | AccountPrepareRequest;
|
|
111
|
+
type PrepareRequest = PoolPrepareRequest | OpenPrepareRequest | OpenEmptyPrepareRequest | BorrowPrepareRequest | AccountPrepareRequest;
|
|
71
112
|
/**
|
|
72
113
|
* The write side of the opportunities namespace: turns what `prepare`
|
|
73
114
|
* answered into the transaction to sign. Sending, and whatever the wallet has
|
|
@@ -77,9 +118,10 @@ type PrepareRequest = PoolPrepareRequest | OpenPrepareRequest | AccountPrepareRe
|
|
|
77
118
|
interface IOpportunitiesExecute {
|
|
78
119
|
/**
|
|
79
120
|
* The transaction to sign, from a `prepare` result. No second round of math:
|
|
80
|
-
* `account` requests submit the result's own multicall, `open`
|
|
81
|
-
* the state's router path and quotas to `openCA`, `
|
|
82
|
-
*
|
|
121
|
+
* `account` requests submit the result's own multicall, `open` and `borrow`
|
|
122
|
+
* requests hand the state's router path and quotas to `openCA`, `openEmpty`
|
|
123
|
+
* requests open on nothing at all, and `pool` requests encode the deposit /
|
|
124
|
+
* redeem the result priced.
|
|
83
125
|
*
|
|
84
126
|
* @throws on a refused `prepare` result; when a `pool` request names a route
|
|
85
127
|
* the pool has no metadata for, or one the pool does not accept a transaction
|
|
@@ -88,4 +130,4 @@ interface IOpportunitiesExecute {
|
|
|
88
130
|
buildTx(request: PrepareRequest): Promise<RawTx>;
|
|
89
131
|
}
|
|
90
132
|
//#endregion
|
|
91
|
-
export { AccountPrepareRequest, IOpportunitiesExecute, OpenPrepareRequest, PoolPrepareRequest, PrepareRequest };
|
|
133
|
+
export { AccountPrepareRequest, BorrowPrepareRequest, IOpportunitiesExecute, OpenEmptyPrepareRequest, OpenPrepareRequest, PoolPrepareRequest, PrepareRequest };
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { CreditAccountNotEmptyError, CreditAccountNotFoundError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, UnexpectedFailureError, UnsupportedCollateralTokenError, UnsupportedTokenPairError, WithdrawalInProgressError, creditAccountNotEmpty, creditAccountNotFound, noStrategyTargetCollateral, unexpectedFailure } from "../model/errors/prepare-errors.js";
|
|
2
|
-
import { LeverageBand } from "../onchain/accounts/intents/leverage-band.js";
|
|
3
2
|
import { OperationState, PathLossRate, RouteErrors, WithdrawCeilings } from "../onchain/accounts/intents/types.js";
|
|
3
|
+
import { BorrowState } from "../onchain/accounts/intents/borrow.js";
|
|
4
|
+
import { LeverageBand } from "../onchain/accounts/intents/leverage-band.js";
|
|
4
5
|
import { PoolOperationError } from "../onchain/validation/bundles/checkPoolOperation.js";
|
|
5
6
|
import { IAnalytics, IAnalyticsByMode } from "./analytics/types.js";
|
|
6
7
|
import { ILiquidations, ILiquidationsByMode } from "./liquidations/types.js";
|
|
7
|
-
import { AccountFlowError, AddCollateralParams, AdjustLeverageParams, DelayedStrategyResult, DepositStrategyParams, FinalizeParams, FinalizeResult, IOpportunitiesPrepare, LpParams, LpRedeemParams, LpResult, LpState,
|
|
8
|
+
import { AccountFlowError, AddCollateralParams, AdjustLeverageParams, BorrowParams, BorrowResult, DelayedStrategyResult, DepositStrategyParams, EmptyCreditAccountResult, FinalizeParams, FinalizeResult, IOpportunitiesPrepare, LpParams, LpRedeemParams, LpResult, LpState, MaxBorrowParams, OpenFlowError, OpenStrategyParams, OpenStrategyResult, PoolInput, PositionInput, PrepareOptions, RepayStrategyParams, StrategyInput, StrategyResult, StrategyRoutesResult, WithRouteErrors, WithdrawCollateralParams, WithdrawStrategyParams } from "./prepare/types.js";
|
|
8
9
|
import { ChainOf, PrepareApi } from "./prepare/PrepareApi.js";
|
|
9
10
|
import "./prepare/index.js";
|
|
10
|
-
import { AccountPrepareRequest, IOpportunitiesExecute, OpenPrepareRequest, PoolPrepareRequest, PrepareRequest } from "./execute/types.js";
|
|
11
|
+
import { AccountPrepareRequest, BorrowPrepareRequest, IOpportunitiesExecute, OpenEmptyPrepareRequest, OpenPrepareRequest, PoolPrepareRequest, PrepareRequest } from "./execute/types.js";
|
|
11
12
|
import { ExecuteApi } from "./execute/ExecuteApi.js";
|
|
12
13
|
import "./execute/index.js";
|
|
13
14
|
import { EntityMerger, FilterResult, ListMerger, MergeListResult } from "./utils/types.js";
|
|
@@ -38,4 +39,4 @@ import { SourceUnavailableError } from "./errors/SourceUnavailableError.js";
|
|
|
38
39
|
import { assertSameChains } from "./errors/assertSameChains.js";
|
|
39
40
|
import { everyChainFailed } from "./errors/everyChainFailed.js";
|
|
40
41
|
import "./errors/index.js";
|
|
41
|
-
export { AbstractNamespace, AccountFlowError, AccountPrepareRequest, AddCollateralParams, AdjustLeverageParams, AllSourcesFailedError, AnalyticsNamespace, ChainOf, ChainRef, CheckOperationProps, type CreditAccountNotEmptyError, type CreditAccountNotFoundError, DEFAULT_MAX_OFFCHAIN_LAG, DEFAULT_MAX_STATE_AGE, DelayedStrategyResult, DepositStrategyParams, EnsureFreshChains, type EntityMerger, ExecuteApi, type FilterResult, FinalizeParams, FinalizeResult, GearboxSDK, GearboxSDKOptions, IAnalytics, IAnalyticsByMode, IGearboxSDK, ILiquidations, ILiquidationsByMode, INotices, INoticesByMode, IOpportunities, IOpportunitiesBase, IOpportunitiesByMode, IOpportunitiesExecute, IOpportunitiesOffchainBranch, IOpportunitiesOffchainOnly, IOpportunitiesOnchainBranch, IOpportunitiesOnchainOnly, IOpportunitiesPrepare, IOpportunityMergers, IPositionMergers, IPositions, IPositionsBase, IPositionsByMode, IPositionsOffchainBranch, IPositionsOffchainOnly, IPositionsOnchainBranch, IPositionsOnchainOnly, IPreview, IPreviewByMode, type LeverageBand, LiquidationsNamespace, type ListMerger, LpParams, LpRedeemParams, LpResult, LpState, type MergeListResult, MergedQuery, MissingSourceError, Mode, type MultipleDelayedWithdrawalsError, NamespaceOptions, type NoDelayedRouteError, type NoRecordedIntentError, NoSourceServedError, type NoStrategyTargetCollateralError, OffchainByMode, OffchainSource, OnchainByMode, OnchainSource, OpenFlowError, OpenPrepareRequest,
|
|
42
|
+
export { AbstractNamespace, AccountFlowError, AccountPrepareRequest, AddCollateralParams, AdjustLeverageParams, AllSourcesFailedError, AnalyticsNamespace, BorrowParams, BorrowPrepareRequest, BorrowResult, type BorrowState, ChainOf, ChainRef, CheckOperationProps, type CreditAccountNotEmptyError, type CreditAccountNotFoundError, DEFAULT_MAX_OFFCHAIN_LAG, DEFAULT_MAX_STATE_AGE, DelayedStrategyResult, DepositStrategyParams, EmptyCreditAccountResult, EnsureFreshChains, type EntityMerger, ExecuteApi, type FilterResult, FinalizeParams, FinalizeResult, GearboxSDK, GearboxSDKOptions, IAnalytics, IAnalyticsByMode, IGearboxSDK, ILiquidations, ILiquidationsByMode, INotices, INoticesByMode, IOpportunities, IOpportunitiesBase, IOpportunitiesByMode, IOpportunitiesExecute, IOpportunitiesOffchainBranch, IOpportunitiesOffchainOnly, IOpportunitiesOnchainBranch, IOpportunitiesOnchainOnly, IOpportunitiesPrepare, IOpportunityMergers, IPositionMergers, IPositions, IPositionsBase, IPositionsByMode, IPositionsOffchainBranch, IPositionsOffchainOnly, IPositionsOnchainBranch, IPositionsOnchainOnly, IPreview, IPreviewByMode, type LeverageBand, LiquidationsNamespace, type ListMerger, LpParams, LpRedeemParams, LpResult, LpState, MaxBorrowParams, type MergeListResult, MergedQuery, MissingSourceError, Mode, type MultipleDelayedWithdrawalsError, NamespaceOptions, type NoDelayedRouteError, type NoRecordedIntentError, NoSourceServedError, type NoStrategyTargetCollateralError, OffchainByMode, OffchainSource, OnchainByMode, OnchainSource, OpenEmptyPrepareRequest, OpenFlowError, OpenPrepareRequest, OpenStrategyParams, OpenStrategyResult, type OperationState, OpportunitiesNamespace, type PathLossRate, PlainMultichainSDKOptions, PoolInput, type PoolOperationError, PoolPrepareRequest, PositionInput, PositionsNamespace, PrepareApi, PrepareOptions, PrepareRequest, PreviewNamespace, RepayStrategyParams, type RouteErrors, SourceChainMismatchError, SourceUnavailableError, StrategyInput, StrategyResult, StrategyRoutesResult, type UnexpectedFailureError, type UnsupportedCollateralTokenError, type UnsupportedTokenPairError, WithRouteErrors, type WithdrawCeilings, WithdrawCollateralParams, WithdrawStrategyParams, type WithdrawalInProgressError, assertSameChains, creditAccountNotEmpty, creditAccountNotFound, everyChainFailed, filterResponse, mergeChainList, mergeChainOne, noStrategyTargetCollateral, unexpectedFailure };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Bps, ChainId } from "../../model/primitives.js";
|
|
2
|
-
import { DebtOutOfRangeError, InsufficientPoolLiquidityError, LeverageOutOfRangeError } from "../../model/errors/operation-errors.js";
|
|
2
|
+
import { CreditManagerPausedError, DebtOutOfRangeError, InsufficientPoolLiquidityError, LeverageOutOfRangeError, MarketExpiredError } from "../../model/errors/operation-errors.js";
|
|
3
3
|
import { CreditAccountNotEmptyError, CreditAccountNotFoundError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, UnexpectedFailureError, UnsupportedCollateralTokenError, UnsupportedTokenPairError, WithdrawalInProgressError } from "../../model/errors/prepare-errors.js";
|
|
4
4
|
import { PositionCollateral, StrategyPosition } from "../../model/positions.js";
|
|
5
5
|
import { SDKReturn } from "../../model/result.js";
|
|
@@ -8,11 +8,11 @@ import { Asset } from "../../onchain/base/types.js";
|
|
|
8
8
|
import { OnchainSDK } from "../../onchain/OnchainSDK.js";
|
|
9
9
|
import { MultichainSDK } from "../../onchain/MultichainSDK.js";
|
|
10
10
|
import { MultichainConstruct } from "../../onchain/base/MultichainConstruct.js";
|
|
11
|
-
import { LeverageBand } from "../../onchain/accounts/intents/leverage-band.js";
|
|
12
11
|
import { WithdrawCeilings } from "../../onchain/accounts/intents/types.js";
|
|
12
|
+
import { LeverageBand } from "../../onchain/accounts/intents/leverage-band.js";
|
|
13
13
|
import { PoolOperationError } from "../../onchain/validation/bundles/checkPoolOperation.js";
|
|
14
14
|
import "../../onchain/index.js";
|
|
15
|
-
import { AccountFlowError, AddCollateralParams, AdjustLeverageParams, DepositStrategyParams, FinalizeParams, FinalizeResult, IOpportunitiesPrepare, LpParams, LpRedeemParams, LpResult, OpenFlowError, OpenStrategyParams, OpenStrategyResult, PoolInput, PositionInput, RepayStrategyParams, StrategyInput, StrategyResult, StrategyRoutesResult, WithRouteErrors, WithdrawCollateralParams, WithdrawStrategyParams } from "./types.js";
|
|
15
|
+
import { AccountFlowError, AddCollateralParams, AdjustLeverageParams, BorrowParams, BorrowResult, DepositStrategyParams, EmptyCreditAccountResult, FinalizeParams, FinalizeResult, IOpportunitiesPrepare, LpParams, LpRedeemParams, LpResult, MaxBorrowParams, OpenFlowError, OpenStrategyParams, OpenStrategyResult, PoolInput, PositionInput, RepayStrategyParams, StrategyInput, StrategyResult, StrategyRoutesResult, WithRouteErrors, WithdrawCollateralParams, WithdrawStrategyParams } from "./types.js";
|
|
16
16
|
import { EnsureFreshChains } from "../types.js";
|
|
17
17
|
import { Address } from "viem";
|
|
18
18
|
//#region src/sdk/prepare/PrepareApi.d.ts
|
|
@@ -64,10 +64,18 @@ declare class PrepareApi extends MultichainConstruct implements IOpportunitiesPr
|
|
|
64
64
|
* {@inheritDoc IOpportunitiesPrepare.redeem}
|
|
65
65
|
**/
|
|
66
66
|
redeem(pool: PoolInput, params: LpRedeemParams): Promise<SDKReturn<LpResult, UnsupportedTokenPairError | UnexpectedFailureError | PoolOperationError>>;
|
|
67
|
+
/**
|
|
68
|
+
* {@inheritDoc IOpportunitiesPrepare.openEmptyCreditAccount}
|
|
69
|
+
**/
|
|
70
|
+
openEmptyCreditAccount(strategy: StrategyInput): Promise<SDKReturn<EmptyCreditAccountResult, CreditManagerPausedError | MarketExpiredError | UnexpectedFailureError>>;
|
|
67
71
|
/**
|
|
68
72
|
* {@inheritDoc IOpportunitiesPrepare.openNewStrategy}
|
|
69
73
|
**/
|
|
70
74
|
openNewStrategy(strategy: StrategyInput, params: OpenStrategyParams): Promise<SDKReturn<OpenStrategyResult, OpenFlowError | DebtOutOfRangeError | LeverageOutOfRangeError | UnsupportedTokenPairError | InsufficientPoolLiquidityError | NoStrategyTargetCollateralError | CreditAccountNotFoundError | CreditAccountNotEmptyError>>;
|
|
75
|
+
/**
|
|
76
|
+
* {@inheritDoc IOpportunitiesPrepare.borrow}
|
|
77
|
+
**/
|
|
78
|
+
borrow(strategy: StrategyInput, params: BorrowParams): Promise<SDKReturn<BorrowResult, OpenFlowError | DebtOutOfRangeError | UnsupportedCollateralTokenError | UnsupportedTokenPairError | InsufficientPoolLiquidityError | CreditAccountNotFoundError | CreditAccountNotEmptyError>>;
|
|
71
79
|
/**
|
|
72
80
|
* {@inheritDoc IOpportunitiesPrepare.depositStrategy}
|
|
73
81
|
**/
|
|
@@ -112,6 +120,10 @@ declare class PrepareApi extends MultichainConstruct implements IOpportunitiesPr
|
|
|
112
120
|
* {@inheritDoc IOpportunitiesPrepare.maxWithdrawCollateral}
|
|
113
121
|
**/
|
|
114
122
|
maxWithdrawCollateral(position: PositionInput, token: Address, targetHF?: bigint): Promise<bigint>;
|
|
123
|
+
/**
|
|
124
|
+
* {@inheritDoc IOpportunitiesPrepare.maxBorrow}
|
|
125
|
+
**/
|
|
126
|
+
maxBorrow(strategy: StrategyInput, params: MaxBorrowParams): bigint;
|
|
115
127
|
}
|
|
116
128
|
//#endregion
|
|
117
129
|
export { ChainOf, PrepareApi };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { CreditAccountNotEmptyError, CreditAccountNotFoundError, MultipleDelayedWithdrawalsError, NoDelayedRouteError, NoRecordedIntentError, NoStrategyTargetCollateralError, UnexpectedFailureError, UnsupportedCollateralTokenError, UnsupportedTokenPairError, WithdrawalInProgressError, creditAccountNotEmpty, creditAccountNotFound, noStrategyTargetCollateral, unexpectedFailure } from "../../model/errors/prepare-errors.js";
|
|
2
2
|
import "../../model/index.js";
|
|
3
|
-
import { LeverageBand } from "../../onchain/accounts/intents/leverage-band.js";
|
|
4
3
|
import { OperationState, PathLossRate, RouteErrors, WithdrawCeilings } from "../../onchain/accounts/intents/types.js";
|
|
4
|
+
import { BorrowState } from "../../onchain/accounts/intents/borrow.js";
|
|
5
|
+
import { LeverageBand } from "../../onchain/accounts/intents/leverage-band.js";
|
|
5
6
|
import { PoolOperationError } from "../../onchain/validation/bundles/checkPoolOperation.js";
|
|
6
|
-
import { AccountFlowError, AddCollateralParams, AdjustLeverageParams, DelayedStrategyResult, DepositStrategyParams, FinalizeParams, FinalizeResult, IOpportunitiesPrepare, LpParams, LpRedeemParams, LpResult, LpState,
|
|
7
|
+
import { AccountFlowError, AddCollateralParams, AdjustLeverageParams, BorrowParams, BorrowResult, DelayedStrategyResult, DepositStrategyParams, EmptyCreditAccountResult, FinalizeParams, FinalizeResult, IOpportunitiesPrepare, LpParams, LpRedeemParams, LpResult, LpState, MaxBorrowParams, OpenFlowError, OpenStrategyParams, OpenStrategyResult, PoolInput, PositionInput, PrepareOptions, RepayStrategyParams, StrategyInput, StrategyResult, StrategyRoutesResult, WithRouteErrors, WithdrawCollateralParams, WithdrawStrategyParams } from "./types.js";
|
|
7
8
|
import { ChainOf, PrepareApi } from "./PrepareApi.js";
|
|
8
|
-
export { AccountFlowError, AddCollateralParams, AdjustLeverageParams, ChainOf, type CreditAccountNotEmptyError, type CreditAccountNotFoundError, DelayedStrategyResult, DepositStrategyParams, FinalizeParams, FinalizeResult, IOpportunitiesPrepare, type LeverageBand, LpParams, LpRedeemParams, LpResult, LpState, type MultipleDelayedWithdrawalsError, type NoDelayedRouteError, type NoRecordedIntentError, type NoStrategyTargetCollateralError, OpenFlowError,
|
|
9
|
+
export { AccountFlowError, AddCollateralParams, AdjustLeverageParams, BorrowParams, BorrowResult, type BorrowState, ChainOf, type CreditAccountNotEmptyError, type CreditAccountNotFoundError, DelayedStrategyResult, DepositStrategyParams, EmptyCreditAccountResult, FinalizeParams, FinalizeResult, IOpportunitiesPrepare, type LeverageBand, LpParams, LpRedeemParams, LpResult, LpState, MaxBorrowParams, type MultipleDelayedWithdrawalsError, type NoDelayedRouteError, type NoRecordedIntentError, type NoStrategyTargetCollateralError, OpenFlowError, OpenStrategyParams, OpenStrategyResult, type OperationState, type PathLossRate, PoolInput, type PoolOperationError, PositionInput, PrepareApi, PrepareOptions, RepayStrategyParams, type RouteErrors, StrategyInput, StrategyResult, StrategyRoutesResult, type UnexpectedFailureError, type UnsupportedCollateralTokenError, type UnsupportedTokenPairError, WithRouteErrors, type WithdrawCeilings, WithdrawCollateralParams, WithdrawStrategyParams, type WithdrawalInProgressError, creditAccountNotEmpty, creditAccountNotFound, noStrategyTargetCollateral, unexpectedFailure };
|
|
@@ -10,9 +10,10 @@ import "../../model/index.js";
|
|
|
10
10
|
import { Asset } from "../../onchain/base/types.js";
|
|
11
11
|
import { MultiCall } from "../../onchain/types/transactions.js";
|
|
12
12
|
import { PoolSimulation } from "../../onchain/pools/types.js";
|
|
13
|
-
import { LeverageBand } from "../../onchain/accounts/intents/leverage-band.js";
|
|
14
13
|
import { AccountCalculatorOperation } from "../../onchain/accounts/intents/operations.js";
|
|
15
14
|
import { ClaimRemainder, DelayedStart, OperationState, PathLossRate, ResumableIntent, RouteErrors, WithdrawCeilings } from "../../onchain/accounts/intents/types.js";
|
|
15
|
+
import { BorrowState } from "../../onchain/accounts/intents/borrow.js";
|
|
16
|
+
import { LeverageBand } from "../../onchain/accounts/intents/leverage-band.js";
|
|
16
17
|
import { OpenStrategyState } from "../../onchain/accounts/intents/open-strategy.js";
|
|
17
18
|
import { PoolOperationError } from "../../onchain/validation/bundles/checkPoolOperation.js";
|
|
18
19
|
import "../../onchain/index.js";
|
|
@@ -227,6 +228,41 @@ interface OpenStrategyResult {
|
|
|
227
228
|
/** Unix seconds of {@link blockNumber}. */
|
|
228
229
|
timestamp: Timestamp;
|
|
229
230
|
}
|
|
231
|
+
/**
|
|
232
|
+
* What taking a loan against collateral comes to.
|
|
233
|
+
*
|
|
234
|
+
* Shaped like {@link OpenStrategyResult} — a borrow opens its account too, so
|
|
235
|
+
* there is no chain of steps to report — with the whole projection on the
|
|
236
|
+
* state rather than two branches of balances, see {@link BorrowState}.
|
|
237
|
+
**/
|
|
238
|
+
interface BorrowResult {
|
|
239
|
+
/**
|
|
240
|
+
* Everything the loan arrives at: the collateral and the debt it backs, the
|
|
241
|
+
* payout expected and its floor, the position metrics a screen shows beside
|
|
242
|
+
* them, and the router path `openCA` is handed.
|
|
243
|
+
**/
|
|
244
|
+
state: BorrowState;
|
|
245
|
+
/** Block of the chain state this result was computed from. */
|
|
246
|
+
blockNumber: number;
|
|
247
|
+
/** Unix seconds of {@link blockNumber}. */
|
|
248
|
+
timestamp: Timestamp;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* What opening an account that holds nothing comes to: the block it was
|
|
252
|
+
* cleared at, and nothing else.
|
|
253
|
+
*
|
|
254
|
+
* The one prepared operation with no state to report. Every other result
|
|
255
|
+
* describes where the account lands, but this one lands it holding nothing and
|
|
256
|
+
* owing nothing — there is no collateral to value, no debt to weigh and no
|
|
257
|
+
* health factor to read. What the preparation is for is the refusal it can
|
|
258
|
+
* answer with instead: a market that takes no multicall.
|
|
259
|
+
**/
|
|
260
|
+
interface EmptyCreditAccountResult {
|
|
261
|
+
/** Block of the chain state this result was computed from. */
|
|
262
|
+
blockNumber: number;
|
|
263
|
+
/** Unix seconds of {@link blockNumber}. */
|
|
264
|
+
timestamp: Timestamp;
|
|
265
|
+
}
|
|
230
266
|
/**
|
|
231
267
|
* Shared knobs. Both default to the SDK's own defaults when omitted.
|
|
232
268
|
**/
|
|
@@ -338,15 +374,7 @@ interface WithdrawCollateralParams extends PrepareOptions {
|
|
|
338
374
|
/** Wallet receiving the tokens. */
|
|
339
375
|
to: Address;
|
|
340
376
|
}
|
|
341
|
-
|
|
342
|
-
* Opening a position, in one of the two shapes an opening comes in.
|
|
343
|
-
*
|
|
344
|
-
* The union is the check: an empty opening names nothing to open with, so
|
|
345
|
-
* collateral it meant to spend or an account it meant to reuse cannot be
|
|
346
|
-
* silently dropped — those arguments do not typecheck against `empty: true`.
|
|
347
|
-
**/
|
|
348
|
-
type OpenStrategyParams = OpenStrategyFundedParams | OpenStrategyEmptyParams;
|
|
349
|
-
interface OpenStrategyFundedParams extends PrepareOptions {
|
|
377
|
+
interface OpenStrategyParams extends PrepareOptions {
|
|
350
378
|
/** Collateral coming from the wallet, in their own tokens. */
|
|
351
379
|
collateral: Asset[];
|
|
352
380
|
/**
|
|
@@ -363,43 +391,80 @@ interface OpenStrategyFundedParams extends PrepareOptions {
|
|
|
363
391
|
/**
|
|
364
392
|
* Existing credit account to open the position on, instead of creating one.
|
|
365
393
|
*
|
|
366
|
-
*
|
|
367
|
-
*
|
|
368
|
-
*
|
|
369
|
-
*
|
|
370
|
-
|
|
394
|
+
* Any account of `strategy.creditManager` that carries no debt and no
|
|
395
|
+
* quotas qualifies. The projection is identical either way; only the
|
|
396
|
+
* transaction differs, and `execute.buildTx` reads which one to build off
|
|
397
|
+
* the result's own `state.creditAccount`.
|
|
398
|
+
**/
|
|
399
|
+
creditAccount?: Address;
|
|
400
|
+
}
|
|
401
|
+
interface BorrowParams extends PrepareOptions {
|
|
402
|
+
/**
|
|
403
|
+
* Token the wallet puts up as collateral. Must be a collateral token of the
|
|
404
|
+
* market, and cannot be {@link borrowToken} — the payout is swept off the
|
|
405
|
+
* account, and a sweep takes the whole balance of the token it names.
|
|
406
|
+
**/
|
|
407
|
+
collateralToken: Address;
|
|
408
|
+
/** Amount of {@link collateralToken} that leaves the wallet. */
|
|
409
|
+
collateralAmount: bigint;
|
|
410
|
+
/**
|
|
411
|
+
* Token the wallet is paid the loan in. The market underlying is handed over
|
|
412
|
+
* as it is borrowed; anything else the router has a path to is bought with
|
|
413
|
+
* the borrowed underlying first, and then {@link BorrowResult} reports both
|
|
414
|
+
* what that trade is expected to return and its floor.
|
|
415
|
+
*
|
|
416
|
+
* An RWA market is paid in the asset its underlying wraps — `USDC`, not the
|
|
417
|
+
* `dcUSDC` the pool lends — because the wrapper cannot leave the account.
|
|
418
|
+
* The two convert one for one through the market's vault, so that payout is
|
|
419
|
+
* exact like the underlying's. Naming the wrapper is refused with
|
|
420
|
+
* `unsupportedCollateralToken`.
|
|
421
|
+
**/
|
|
422
|
+
borrowToken: Address;
|
|
423
|
+
/**
|
|
424
|
+
* Amount of {@link borrowToken} the wallet asks for. It is the debt exactly
|
|
425
|
+
* when `borrowToken` is the market underlying, and the same amount in the
|
|
426
|
+
* underlying's own decimals when it is the asset an RWA market unwraps into;
|
|
427
|
+
* otherwise the debt is what the oracle prices that much of it at, and what
|
|
428
|
+
* actually arrives is the router's answer.
|
|
429
|
+
**/
|
|
430
|
+
borrowAmount: bigint;
|
|
431
|
+
/**
|
|
432
|
+
* Existing credit account to draw the loan on, instead of opening one.
|
|
433
|
+
*
|
|
434
|
+
* Any account of `strategy.creditManager` that carries no debt and no
|
|
435
|
+
* quotas qualifies. Only the transaction differs; `execute.buildTx` reads
|
|
436
|
+
* which one to build off the result's own `state.creditAccount`.
|
|
437
|
+
*
|
|
438
|
+
* Balances already sitting on it are left where they are and are **not**
|
|
439
|
+
* counted towards the health factor, so the loan this allows is the one the
|
|
440
|
+
* named collateral alone carries. The exception is a balance in
|
|
441
|
+
* {@link borrowToken}: the payout sweep takes the whole balance of the token
|
|
442
|
+
* it names, so that one leaves with the loan.
|
|
371
443
|
**/
|
|
372
444
|
creditAccount?: Address;
|
|
373
|
-
empty?: false;
|
|
374
445
|
}
|
|
375
446
|
/**
|
|
376
|
-
*
|
|
377
|
-
*
|
|
378
|
-
* an opening that names it as
|
|
379
|
-
* {@link OpenStrategyFundedParams.creditAccount}.
|
|
380
|
-
*
|
|
381
|
-
* The market is the whole request. There is nothing else to say: with no
|
|
382
|
-
* collateral the debt is zero at any leverage, and there is nothing to route
|
|
383
|
-
* anywhere — so leverage and a target token are not merely ignored here, they
|
|
384
|
-
* cannot be named.
|
|
447
|
+
* What a borrow form knows before it knows the amount: everything
|
|
448
|
+
* {@link BorrowParams} carries except the loan itself, which is the answer.
|
|
385
449
|
**/
|
|
386
|
-
interface
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
450
|
+
interface MaxBorrowParams {
|
|
451
|
+
/** Token the wallet would put up, as in {@link BorrowParams}. */
|
|
452
|
+
collateralToken: Address;
|
|
453
|
+
/** Amount of {@link collateralToken} that would leave the wallet. */
|
|
454
|
+
collateralAmount: bigint;
|
|
455
|
+
/** Token the loan would be paid in; the ceiling comes back in its units. */
|
|
456
|
+
borrowToken: Address;
|
|
457
|
+
/**
|
|
458
|
+
* Health factor the loan should leave the account at, in basis points.
|
|
459
|
+
* Omitted, the SDK holds it to the threshold a form would.
|
|
460
|
+
**/
|
|
461
|
+
targetHF?: bigint;
|
|
462
|
+
/**
|
|
463
|
+
* Extra quota headroom in PERCENTAGE_FORMAT. Pass what the borrow itself
|
|
464
|
+
* will pass: a quota short of the collateral's weighted value is what caps
|
|
465
|
+
* the loan, so a different reserve here answers about a different loan.
|
|
466
|
+
**/
|
|
467
|
+
quotaReserve?: number;
|
|
403
468
|
}
|
|
404
469
|
interface LpParams {
|
|
405
470
|
/**
|
|
@@ -472,11 +537,11 @@ interface FinalizeParams extends PrepareOptions {
|
|
|
472
537
|
* throws: a chain that cannot be reached or a crash on the way arrives as
|
|
473
538
|
* `unexpectedFailure` with the cause attached.
|
|
474
539
|
*
|
|
475
|
-
* The bare readers stay outside the envelope
|
|
476
|
-
* number and throw on an account or chain the SDK does not hold
|
|
477
|
-
* synchronous
|
|
478
|
-
* weigh state already loaded and say "nothing available"
|
|
479
|
-
* an empty list
|
|
540
|
+
* The bare readers stay outside the envelope. The ones that read an account
|
|
541
|
+
* answer their number and throw on an account or chain the SDK does not hold;
|
|
542
|
+
* the synchronous ones ({@link leverageBand}, {@link withdrawableCollaterals},
|
|
543
|
+
* {@link maxBorrow}) weigh state already loaded and say "nothing available"
|
|
544
|
+
* with `undefined`, an empty list or `0n`.
|
|
480
545
|
**/
|
|
481
546
|
interface IOpportunitiesPrepare {
|
|
482
547
|
/**
|
|
@@ -503,10 +568,41 @@ interface IOpportunitiesPrepare {
|
|
|
503
568
|
/**
|
|
504
569
|
* Opening a leveraged position from wallet collateral.
|
|
505
570
|
*
|
|
506
|
-
*
|
|
571
|
+
* There is no account to walk yet, so the result carries no operation list —
|
|
507
572
|
* it feeds `sdk.accounts.openCA` instead.
|
|
573
|
+
*
|
|
574
|
+
* `creditAccount` puts the position on an account the wallet already holds
|
|
575
|
+
* rather than creating one.
|
|
508
576
|
**/
|
|
509
577
|
openNewStrategy(strategy: StrategyInput, params: OpenStrategyParams): Promise<SDKReturn<OpenStrategyResult, OpenFlowError | DebtOutOfRangeError | LeverageOutOfRangeError | UnsupportedTokenPairError | InsufficientPoolLiquidityError | NoStrategyTargetCollateralError | CreditAccountNotFoundError | CreditAccountNotEmptyError>>;
|
|
578
|
+
/**
|
|
579
|
+
* Handing a wallet an account that holds nothing: no collateral, no debt, no
|
|
580
|
+
* quotas and no route quoted. It exists so a wallet can hold an account
|
|
581
|
+
* ahead of having a use for one, and so the two flows that put something on
|
|
582
|
+
* an account have one to name as their `creditAccount`.
|
|
583
|
+
*
|
|
584
|
+
* The market is the whole request, and the only thing that can refuse it is
|
|
585
|
+
* the market itself: a facade that is paused or past its expiration takes no
|
|
586
|
+
* multicall, so an account cannot be opened there either.
|
|
587
|
+
**/
|
|
588
|
+
openEmptyCreditAccount(strategy: StrategyInput): Promise<SDKReturn<EmptyCreditAccountResult, CreditManagerPausedError | MarketExpiredError | UnexpectedFailureError>>;
|
|
589
|
+
/**
|
|
590
|
+
* Borrowing against collateral: one transaction opens an account, puts the
|
|
591
|
+
* collateral on it, draws the loan and pays it out to the wallet.
|
|
592
|
+
*
|
|
593
|
+
* The account is left holding the collateral and owing the debt, and nothing
|
|
594
|
+
* else — which is what tells this apart from {@link openNewStrategy}, where
|
|
595
|
+
* the borrowed funds stay on the account as part of the position. There is
|
|
596
|
+
* no leverage to name for the same reason: the loan is the amount asked for.
|
|
597
|
+
*
|
|
598
|
+
* The payout leaves the account, so the market weighs what is left at safe
|
|
599
|
+
* prices, and a loan the remaining collateral cannot carry there comes back
|
|
600
|
+
* as `insufficientCollateral` rather than reverting on arrival.
|
|
601
|
+
*
|
|
602
|
+
* `creditAccount` draws the loan on an account the wallet already holds
|
|
603
|
+
* instead of opening another, as {@link openNewStrategy} does.
|
|
604
|
+
**/
|
|
605
|
+
borrow(strategy: StrategyInput, params: BorrowParams): Promise<SDKReturn<BorrowResult, OpenFlowError | DebtOutOfRangeError | UnsupportedCollateralTokenError | UnsupportedTokenPairError | InsufficientPoolLiquidityError | CreditAccountNotFoundError | CreditAccountNotEmptyError>>;
|
|
510
606
|
/**
|
|
511
607
|
* Growing a position: collateral in, debt drawn on top, both converted into
|
|
512
608
|
* the position token.
|
|
@@ -670,6 +766,37 @@ interface IOpportunitiesPrepare {
|
|
|
670
766
|
* the SDK does not hold.
|
|
671
767
|
**/
|
|
672
768
|
maxWithdrawCollateral(position: PositionInput, token: Address, targetHF?: bigint): Promise<bigint>;
|
|
769
|
+
/**
|
|
770
|
+
* Largest loan {@link borrow} can draw against a given collateral while the
|
|
771
|
+
* account stays safely collateralised, in the payout token's units — the
|
|
772
|
+
* ceiling a borrow form should offer.
|
|
773
|
+
*
|
|
774
|
+
* The loan leaves the account, so the collateral alone backs the debt and
|
|
775
|
+
* the market weighs it at safe prices, under its liquidation threshold and
|
|
776
|
+
* capped by the quota the borrow buys for it. The answer is then held to
|
|
777
|
+
* what the market will actually lend: the pool's free liquidity, the
|
|
778
|
+
* manager's own allowance and the facade's `maxDebt`.
|
|
779
|
+
*
|
|
780
|
+
* `targetHF` names the health factor to land at, in basis points; omitted,
|
|
781
|
+
* the SDK holds it to the threshold a form would.
|
|
782
|
+
*
|
|
783
|
+
* Synchronous, like {@link leverageBand} and for the same reason: the
|
|
784
|
+
* account does not exist yet, so there is nothing to read and a form can ask
|
|
785
|
+
* on every keystroke.
|
|
786
|
+
*
|
|
787
|
+
* It is a ceiling and not a verdict: the facade's `minDebt` is a floor, and
|
|
788
|
+
* holding the answer to it would tell a form `0` for collateral that does
|
|
789
|
+
* carry a loan, only a smaller one than this market lends. So a Max offered
|
|
790
|
+
* from here can still be refused by {@link borrow} with `debtOutOfRange`,
|
|
791
|
+
* which names the floor the amount fell short of.
|
|
792
|
+
*
|
|
793
|
+
* `0n` where this market funds no loan of this shape at any size — a
|
|
794
|
+
* collateral worth nothing at safe prices, a payout token equal to the
|
|
795
|
+
* collateral, a market with nothing left to lend, or a manager the SDK does
|
|
796
|
+
* not hold. Not the same as "any amount works", and a caller must not offer
|
|
797
|
+
* a Max for it.
|
|
798
|
+
**/
|
|
799
|
+
maxBorrow(strategy: StrategyInput, params: MaxBorrowParams): bigint;
|
|
673
800
|
/**
|
|
674
801
|
* The tail of a delayed route: claim the matured withdrawal, then whatever the
|
|
675
802
|
* operation that requested it still owes — repaying debt and paying the wallet
|
|
@@ -695,4 +822,4 @@ interface IOpportunitiesPrepare {
|
|
|
695
822
|
finalize(position: PositionInput, params: FinalizeParams): Promise<SDKReturn<FinalizeResult, AccountFlowError | NoRecordedIntentError | NoDelayedRouteError | WithdrawalInProgressError | UnsupportedTokenPairError>>;
|
|
696
823
|
}
|
|
697
824
|
//#endregion
|
|
698
|
-
export { AccountFlowError, AddCollateralParams, AdjustLeverageParams, type CreditAccountNotEmptyError, type CreditAccountNotFoundError, DelayedStrategyResult, DepositStrategyParams, FinalizeParams, FinalizeResult, IOpportunitiesPrepare, type LeverageBand, LpParams, LpRedeemParams, LpResult, LpState, type MultipleDelayedWithdrawalsError, type NoDelayedRouteError, type NoRecordedIntentError, type NoStrategyTargetCollateralError, OpenFlowError,
|
|
825
|
+
export { AccountFlowError, AddCollateralParams, AdjustLeverageParams, BorrowParams, BorrowResult, type BorrowState, type CreditAccountNotEmptyError, type CreditAccountNotFoundError, DelayedStrategyResult, DepositStrategyParams, EmptyCreditAccountResult, FinalizeParams, FinalizeResult, IOpportunitiesPrepare, type LeverageBand, LpParams, LpRedeemParams, LpResult, LpState, MaxBorrowParams, type MultipleDelayedWithdrawalsError, type NoDelayedRouteError, type NoRecordedIntentError, type NoStrategyTargetCollateralError, OpenFlowError, OpenStrategyParams, OpenStrategyResult, type OperationState, type PathLossRate, PoolInput, type PoolOperationError, PositionInput, PrepareOptions, RepayStrategyParams, type RouteErrors, StrategyInput, StrategyResult, StrategyRoutesResult, type UnexpectedFailureError, type UnsupportedCollateralTokenError, type UnsupportedTokenPairError, WithRouteErrors, type WithdrawCeilings, WithdrawCollateralParams, WithdrawStrategyParams, type WithdrawalInProgressError };
|