@gearbox-protocol/sdk 16.4.0-next.2 → 16.4.0-next.4
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/model/errors/index.js +1 -0
- package/dist/cjs/model/errors/operation-errors.js +9 -0
- package/dist/cjs/model/index.js +1 -0
- package/dist/cjs/onchain/accounts/intents/index.js +4 -1
- package/dist/cjs/onchain/accounts/intents/realize.js +44 -0
- package/dist/cjs/onchain/accounts/intents/utils/price-impact.js +3 -3
- package/dist/cjs/onchain/index.js +4 -0
- package/dist/cjs/onchain/market/adapters/contracts/MidasGatewayAdapterContract.js +11 -3
- package/dist/cjs/onchain/preview/index.js +2 -0
- package/dist/cjs/onchain/preview/preview/index.js +2 -0
- package/dist/cjs/onchain/preview/preview/midasGreenlistsAccount.js +17 -0
- package/dist/cjs/onchain/preview/preview/previewOpenStrategyPosition.js +3 -1
- package/dist/cjs/onchain/validation/bundles/checkMidasAccountGreenlist.js +46 -0
- package/dist/cjs/onchain/validation/bundles/checkRWAOpening.js +15 -5
- package/dist/cjs/onchain/validation/bundles/index.js +2 -0
- package/dist/cjs/onchain/validation/index.js +2 -0
- package/dist/esm/model/errors/index.js +2 -2
- package/dist/esm/model/errors/operation-errors.js +9 -1
- package/dist/esm/model/index.js +2 -2
- package/dist/esm/onchain/accounts/intents/index.js +4 -1
- package/dist/esm/onchain/accounts/intents/realize.js +44 -0
- package/dist/esm/onchain/accounts/intents/utils/price-impact.js +3 -3
- package/dist/esm/onchain/index.js +3 -1
- package/dist/esm/onchain/market/adapters/contracts/MidasGatewayAdapterContract.js +11 -3
- package/dist/esm/onchain/preview/index.js +2 -1
- package/dist/esm/onchain/preview/preview/index.js +2 -1
- package/dist/esm/onchain/preview/preview/midasGreenlistsAccount.js +16 -0
- package/dist/esm/onchain/preview/preview/previewOpenStrategyPosition.js +3 -1
- package/dist/esm/onchain/validation/bundles/checkMidasAccountGreenlist.js +45 -0
- package/dist/esm/onchain/validation/bundles/checkRWAOpening.js +15 -5
- package/dist/esm/onchain/validation/bundles/index.js +2 -1
- package/dist/esm/onchain/validation/index.js +2 -1
- package/dist/types/model/errors/index.d.ts +2 -2
- package/dist/types/model/errors/operation-errors.d.ts +14 -1
- package/dist/types/model/index.d.ts +2 -2
- package/dist/types/model/previews.d.ts +6 -0
- package/dist/types/onchain/accounts/intents/types.d.ts +10 -1
- package/dist/types/onchain/index.d.ts +4 -2
- package/dist/types/onchain/market/adapters/contracts/MidasGatewayAdapterContract.d.ts +8 -2
- package/dist/types/onchain/preview/index.d.ts +2 -1
- package/dist/types/onchain/preview/preview/index.d.ts +2 -1
- package/dist/types/onchain/preview/preview/midasGreenlistsAccount.d.ts +13 -0
- package/dist/types/onchain/validation/bundles/checkCreditOperation.d.ts +2 -2
- package/dist/types/onchain/validation/bundles/checkMidasAccountGreenlist.d.ts +23 -0
- package/dist/types/onchain/validation/bundles/checkRWAOpening.d.ts +6 -4
- package/dist/types/onchain/validation/bundles/index.d.ts +3 -2
- package/dist/types/onchain/validation/index.d.ts +3 -2
- package/package.json +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PluginsMap } from "../../plugins/types.js";
|
|
2
|
+
import { OnchainSDK } from "../../OnchainSDK.js";
|
|
3
|
+
import { InnerOperation } from "../parse/types-facades.js";
|
|
4
|
+
import "../parse/index.js";
|
|
5
|
+
import "../../index.js";
|
|
6
|
+
//#region src/onchain/preview/preview/midasGreenlistsAccount.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Whether the multicall grants the Midas greenlisted role to the credit
|
|
9
|
+
* account via `receiveGreenlist()`.
|
|
10
|
+
*/
|
|
11
|
+
declare function midasGreenlistsAccount<P extends PluginsMap>(sdk: OnchainSDK<P>, multicall: InnerOperation[]): boolean;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { midasGreenlistsAccount };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DebtOutOfRangeError, ForbiddenTokenError, InsufficientCollateralError, InsufficientPoolLiquidityError, QuotaCountExceededError, QuotaLimitReachedError, RWAOpenRequirementsError } from "../../../model/errors/operation-errors.js";
|
|
1
|
+
import { AccountNotMidasGreenlistedError, DebtOutOfRangeError, ForbiddenTokenError, InsufficientCollateralError, InsufficientPoolLiquidityError, QuotaCountExceededError, QuotaLimitReachedError, RWAOpenRequirementsError } from "../../../model/errors/operation-errors.js";
|
|
2
2
|
import { AdjustStrategyPositionPreview, OpenStrategyPositionPreview } from "../../../model/previews.js";
|
|
3
3
|
import "../../../model/index.js";
|
|
4
4
|
import { OnchainSDK } from "../../OnchainSDK.js";
|
|
@@ -8,7 +8,7 @@ import { MarketStateError } from "./checkMarket.js";
|
|
|
8
8
|
import { Address } from "viem";
|
|
9
9
|
//#region src/onchain/validation/bundles/checkCreditOperation.d.ts
|
|
10
10
|
/** {@inheritDoc checkCreditOperation} */
|
|
11
|
-
type CreditOperationError = MarketStateError | DebtOutOfRangeError | InsufficientPoolLiquidityError | ForbiddenTokenError | QuotaCountExceededError | QuotaLimitReachedError | InsufficientCollateralError | WalletFundingError | RWAOpenRequirementsError;
|
|
11
|
+
type CreditOperationError = MarketStateError | DebtOutOfRangeError | InsufficientPoolLiquidityError | ForbiddenTokenError | QuotaCountExceededError | QuotaLimitReachedError | InsufficientCollateralError | WalletFundingError | RWAOpenRequirementsError | AccountNotMidasGreenlistedError;
|
|
12
12
|
/** The two previews that carry a position for the thresholds to weigh. */
|
|
13
13
|
type CreditOperationPreview = OpenStrategyPositionPreview | AdjustStrategyPositionPreview;
|
|
14
14
|
interface CreditOperationArgs extends HealthFactorThresholds {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AccountNotMidasGreenlistedError } from "../../../model/errors/operation-errors.js";
|
|
2
|
+
import { UnexpectedFailureError } from "../../../model/errors/prepare-errors.js";
|
|
3
|
+
import { OpenStrategyPositionPreview } from "../../../model/previews.js";
|
|
4
|
+
import "../../../model/index.js";
|
|
5
|
+
import { IDegenNFT } from "../../market/rwa/types.js";
|
|
6
|
+
import { OnchainSDK } from "../../OnchainSDK.js";
|
|
7
|
+
import { Address } from "viem";
|
|
8
|
+
//#region src/onchain/validation/bundles/checkMidasAccountGreenlist.d.ts
|
|
9
|
+
interface CheckMidasAccountGreenlistInput {
|
|
10
|
+
sdk: OnchainSDK;
|
|
11
|
+
preview: OpenStrategyPositionPreview;
|
|
12
|
+
nft: IDegenNFT;
|
|
13
|
+
/** Tokens that the degen NFT lists and that are in operation. */
|
|
14
|
+
tokens: readonly Address[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Whether the credit account already holds the Midas greenlisted role
|
|
18
|
+
* this permissioned mToken requires of its holder, or the transaction
|
|
19
|
+
* grants it via `receiveGreenlist()`.
|
|
20
|
+
*/
|
|
21
|
+
declare function checkMidasAccountGreenlist(input: CheckMidasAccountGreenlistInput): Promise<(AccountNotMidasGreenlistedError | UnexpectedFailureError)[]>;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { CheckMidasAccountGreenlistInput, checkMidasAccountGreenlist };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RWAOpenRequirementsError } from "../../../model/errors/operation-errors.js";
|
|
1
|
+
import { AccountNotMidasGreenlistedError, RWAOpenRequirementsError } from "../../../model/errors/operation-errors.js";
|
|
2
2
|
import { UnexpectedFailureError } from "../../../model/errors/prepare-errors.js";
|
|
3
3
|
import { OpenStrategyPositionPreview } from "../../../model/previews.js";
|
|
4
4
|
import "../../../model/index.js";
|
|
@@ -10,10 +10,12 @@ interface CheckRWAOpeningInput {
|
|
|
10
10
|
preview: OpenStrategyPositionPreview;
|
|
11
11
|
sender: Address;
|
|
12
12
|
}
|
|
13
|
+
type RWAOpeningError = RWAOpenRequirementsError | AccountNotMidasGreenlistedError | UnexpectedFailureError;
|
|
13
14
|
/**
|
|
14
15
|
* Per KYC-gated token among `collateralAdded ∪ quotas`, whether the
|
|
15
|
-
* borrower still has to register or sign before this opening can land
|
|
16
|
+
* borrower still has to register or sign before this opening can land,
|
|
17
|
+
* and whether a Midas credit account may hold the mToken.
|
|
16
18
|
*/
|
|
17
|
-
declare function checkRWAOpening(input: CheckRWAOpeningInput): Promise<
|
|
19
|
+
declare function checkRWAOpening(input: CheckRWAOpeningInput): Promise<RWAOpeningError[]>;
|
|
18
20
|
//#endregion
|
|
19
|
-
export { CheckRWAOpeningInput, checkRWAOpening };
|
|
21
|
+
export { CheckRWAOpeningInput, RWAOpeningError, checkRWAOpening };
|
|
@@ -8,11 +8,12 @@ import { checkIncreaseDebt } from "./checkIncreaseDebt.js";
|
|
|
8
8
|
import { checkIncreaseQuota } from "./checkIncreaseQuota.js";
|
|
9
9
|
import { CheckLiquidationEligibilityInput, LiquidationEligibilityError, checkLiquidationEligibility } from "./checkLiquidationEligibility.js";
|
|
10
10
|
import { CheckLiquidationFundingInput, checkLiquidationFunding } from "./checkLiquidationFunding.js";
|
|
11
|
+
import { CheckMidasAccountGreenlistInput, checkMidasAccountGreenlist } from "./checkMidasAccountGreenlist.js";
|
|
11
12
|
import { checkObtained } from "./checkObtained.js";
|
|
12
13
|
import { CheckPoolFundingInput, checkPoolFunding } from "./checkPoolFunding.js";
|
|
13
14
|
import { PoolOperationArgs, PoolOperationError, checkPoolOperation } from "./checkPoolOperation.js";
|
|
14
|
-
import { CheckRWAOpeningInput, checkRWAOpening } from "./checkRWAOpening.js";
|
|
15
|
+
import { CheckRWAOpeningInput, RWAOpeningError, checkRWAOpening } from "./checkRWAOpening.js";
|
|
15
16
|
import { CheckRWAOpenRequirementsInput, checkRWAOpenRequirements } from "./checkRWAOpenRequirements.js";
|
|
16
17
|
import { CheckWalletAllowanceInput, checkWalletAllowance } from "./checkWalletAllowance.js";
|
|
17
18
|
import { CheckWalletBalanceInput, checkWalletBalance } from "./checkWalletBalance.js";
|
|
18
|
-
export { CheckCollateralFundingInput, CheckLiquidationEligibilityInput, CheckLiquidationFundingInput, CheckPoolFundingInput, CheckRWAOpenRequirementsInput, CheckRWAOpeningInput, CheckWalletAllowanceInput, CheckWalletBalanceInput, CheckWalletInput, CollateralFundingPreview, CreditOperationArgs, CreditOperationError, CreditOperationPreview, HealthFactorThresholds, LiquidationEligibilityError, MarketStateError, PoolOperationArgs, PoolOperationError, WalletFundingError, WeighedFactors, checkAccountQuotas, checkCollateralFunding, checkCreditOperation, checkHealthFactors, checkIncreaseDebt, checkIncreaseQuota, checkLiquidationEligibility, checkLiquidationFunding, checkMarket, checkObtained, checkPoolFunding, checkPoolOperation, checkRWAOpenRequirements, checkRWAOpening, checkWallet, checkWalletAllowance, checkWalletBalance };
|
|
19
|
+
export { CheckCollateralFundingInput, CheckLiquidationEligibilityInput, CheckLiquidationFundingInput, CheckMidasAccountGreenlistInput, CheckPoolFundingInput, CheckRWAOpenRequirementsInput, CheckRWAOpeningInput, CheckWalletAllowanceInput, CheckWalletBalanceInput, CheckWalletInput, CollateralFundingPreview, CreditOperationArgs, CreditOperationError, CreditOperationPreview, HealthFactorThresholds, LiquidationEligibilityError, MarketStateError, PoolOperationArgs, PoolOperationError, RWAOpeningError, WalletFundingError, WeighedFactors, checkAccountQuotas, checkCollateralFunding, checkCreditOperation, checkHealthFactors, checkIncreaseDebt, checkIncreaseQuota, checkLiquidationEligibility, checkLiquidationFunding, checkMarket, checkMidasAccountGreenlist, checkObtained, checkPoolFunding, checkPoolOperation, checkRWAOpenRequirements, checkRWAOpening, checkWallet, checkWalletAllowance, checkWalletBalance };
|
|
@@ -9,10 +9,11 @@ import { checkIncreaseDebt } from "./bundles/checkIncreaseDebt.js";
|
|
|
9
9
|
import { checkIncreaseQuota } from "./bundles/checkIncreaseQuota.js";
|
|
10
10
|
import { CheckLiquidationEligibilityInput, LiquidationEligibilityError, checkLiquidationEligibility } from "./bundles/checkLiquidationEligibility.js";
|
|
11
11
|
import { CheckLiquidationFundingInput, checkLiquidationFunding } from "./bundles/checkLiquidationFunding.js";
|
|
12
|
+
import { CheckMidasAccountGreenlistInput, checkMidasAccountGreenlist } from "./bundles/checkMidasAccountGreenlist.js";
|
|
12
13
|
import { checkObtained } from "./bundles/checkObtained.js";
|
|
13
14
|
import { CheckPoolFundingInput, checkPoolFunding } from "./bundles/checkPoolFunding.js";
|
|
14
15
|
import { PoolOperationArgs, PoolOperationError, checkPoolOperation } from "./bundles/checkPoolOperation.js";
|
|
15
|
-
import { CheckRWAOpeningInput, checkRWAOpening } from "./bundles/checkRWAOpening.js";
|
|
16
|
+
import { CheckRWAOpeningInput, RWAOpeningError, checkRWAOpening } from "./bundles/checkRWAOpening.js";
|
|
16
17
|
import { CheckRWAOpenRequirementsInput, checkRWAOpenRequirements } from "./bundles/checkRWAOpenRequirements.js";
|
|
17
18
|
import { CheckWalletAllowanceInput, checkWalletAllowance } from "./bundles/checkWalletAllowance.js";
|
|
18
19
|
import { CheckWalletBalanceInput, checkWalletBalance } from "./bundles/checkWalletBalance.js";
|
|
@@ -41,4 +42,4 @@ import { amountOf } from "./helpers/amount.js";
|
|
|
41
42
|
import { MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM } from "./helpers/health-factor-limits.js";
|
|
42
43
|
import { toToken, toTokenAmount } from "./helpers/token.js";
|
|
43
44
|
import "./helpers/index.js";
|
|
44
|
-
export { BorrowLimitArgs, CheckCollateralFundingInput, CheckLiquidationEligibilityInput, CheckLiquidationFundingInput, CheckLiquidationInput, CheckLiquidationOptions, CheckOperationInput, CheckOperationOptions, CheckPoolFundingInput, CheckRWAOpenRequirementsInput, CheckRWAOpeningInput, CheckSimulationInput, CheckWalletAllowanceInput, CheckWalletBalanceInput, CheckWalletInput, CollateralFundingPreview, CollateralisedArgs, CreditAccountFrozenArgs, CreditManagerPausedArgs, CreditOperationArgs, CreditOperationError, CreditOperationPreview, CreditSimulationInput, DebtLimitsArgs, EmergencyLiquidatorArgs, ForbiddenTokenArgs, HealthFactorThresholds, type IntentValidationError, LeverageArgs, LiquidationEligibilityError, LiquidationValidationError, LiquidatorEligibleArgs, MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM, MarketExpiredArgs, MarketStateError, OperationValidationError, PoolLiquidityArgs, PoolOperationArgs, PoolOperationError, PoolPausedArgs, PoolSunsetArgs, QuotaCountArgs, QuotaLimitArgs, ReservePriceLimitedArgs, SimulationValidationError, WalletFundingError, WeighedFactors, amountOf, checkAccountQuotas, checkBorrowLimit, checkCollateralFunding, checkCollateralised, checkCreditAccountFrozen, checkCreditManagerPaused, checkCreditOperation, checkDebtLimits, checkEmergencyLiquidator, checkForbiddenToken, checkHealthFactors, checkIncreaseDebt, checkIncreaseQuota, checkLeverage, checkLiquidation, checkLiquidationEligibility, checkLiquidationFunding, checkLiquidatorEligible, checkMarket, checkMarketExpired, checkObtained, checkOperation, checkPoolFunding, checkPoolLiquidity, checkPoolOperation, checkPoolPaused, checkPoolSunset, checkQuotaCount, checkQuotaLimit, checkRWAOpenRequirements, checkRWAOpening, checkReservePriceLimited, checkSimulation, checkWallet, checkWalletAllowance, checkWalletBalance, raise, toToken, toTokenAmount };
|
|
45
|
+
export { BorrowLimitArgs, CheckCollateralFundingInput, CheckLiquidationEligibilityInput, CheckLiquidationFundingInput, CheckLiquidationInput, CheckLiquidationOptions, CheckMidasAccountGreenlistInput, CheckOperationInput, CheckOperationOptions, CheckPoolFundingInput, CheckRWAOpenRequirementsInput, CheckRWAOpeningInput, CheckSimulationInput, CheckWalletAllowanceInput, CheckWalletBalanceInput, CheckWalletInput, CollateralFundingPreview, CollateralisedArgs, CreditAccountFrozenArgs, CreditManagerPausedArgs, CreditOperationArgs, CreditOperationError, CreditOperationPreview, CreditSimulationInput, DebtLimitsArgs, EmergencyLiquidatorArgs, ForbiddenTokenArgs, HealthFactorThresholds, type IntentValidationError, LeverageArgs, LiquidationEligibilityError, LiquidationValidationError, LiquidatorEligibleArgs, MIN_HEALTH_FACTOR_FACADE, MIN_HEALTH_FACTOR_FORM, MIN_HF_LIMITED, MIN_SAFE_HEALTH_FACTOR_FORM, MarketExpiredArgs, MarketStateError, OperationValidationError, PoolLiquidityArgs, PoolOperationArgs, PoolOperationError, PoolPausedArgs, PoolSunsetArgs, QuotaCountArgs, QuotaLimitArgs, RWAOpeningError, ReservePriceLimitedArgs, SimulationValidationError, WalletFundingError, WeighedFactors, amountOf, 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, raise, toToken, toTokenAmount };
|