@morpho-org/morpho-sdk 2.1.1 → 3.1.0
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/lib/cjs/abis.d.ts +2816 -0
- package/lib/cjs/abis.js +1951 -0
- package/lib/cjs/actions/index.d.ts +3 -0
- package/lib/cjs/actions/marketV1/borrow.js +7 -10
- package/lib/cjs/actions/marketV1/buildReallocationActions.d.ts +2 -3
- package/lib/cjs/actions/marketV1/buildReallocationActions.js +1 -2
- package/lib/cjs/actions/marketV1/index.d.ts +2 -0
- package/lib/cjs/actions/marketV1/index.js +2 -0
- package/lib/cjs/actions/marketV1/repay.d.ts +2 -0
- package/lib/cjs/actions/marketV1/repay.js +7 -8
- package/lib/cjs/actions/marketV1/repayWithdrawCollateral.d.ts +2 -0
- package/lib/cjs/actions/marketV1/repayWithdrawCollateral.js +9 -10
- package/lib/cjs/actions/marketV1/supply.d.ts +69 -0
- package/lib/cjs/actions/marketV1/supply.js +128 -0
- package/lib/cjs/actions/marketV1/supplyCollateral.d.ts +3 -1
- package/lib/cjs/actions/marketV1/supplyCollateral.js +12 -13
- package/lib/cjs/actions/marketV1/supplyCollateralBorrow.d.ts +3 -1
- package/lib/cjs/actions/marketV1/supplyCollateralBorrow.js +14 -15
- package/lib/cjs/actions/marketV1/withdraw.d.ts +83 -0
- package/lib/cjs/actions/marketV1/withdraw.js +110 -0
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +2 -2
- package/lib/cjs/actions/requirements/getRequirementsAction.d.ts +1 -1
- package/lib/cjs/actions/requirements/getRequirementsApproval.js +2 -2
- package/lib/cjs/actions/vaultV1/deposit.d.ts +2 -0
- package/lib/cjs/actions/vaultV1/deposit.js +13 -14
- package/lib/cjs/actions/vaultV1/migrateToV2.d.ts +2 -0
- package/lib/cjs/actions/vaultV1/migrateToV2.js +11 -9
- package/lib/cjs/actions/vaultV2/deposit.d.ts +2 -0
- package/lib/cjs/actions/vaultV2/deposit.js +13 -14
- package/lib/cjs/addresses.d.ts +2 -0
- package/lib/cjs/addresses.js +18 -0
- package/lib/cjs/augment/AccrualPosition.d.ts +9 -0
- package/lib/cjs/augment/AccrualPosition.js +8 -0
- package/lib/cjs/augment/AccrualVault.d.ts +8 -0
- package/lib/cjs/augment/AccrualVault.js +7 -0
- package/lib/cjs/augment/Holding.d.ts +8 -0
- package/lib/cjs/augment/Holding.js +7 -0
- package/lib/cjs/augment/Market.d.ts +8 -0
- package/lib/cjs/augment/Market.js +7 -0
- package/lib/cjs/augment/MarketParams.d.ts +8 -0
- package/lib/cjs/augment/MarketParams.js +7 -0
- package/lib/cjs/augment/Position.d.ts +8 -0
- package/lib/cjs/augment/Position.js +7 -0
- package/lib/cjs/augment/Token.d.ts +8 -0
- package/lib/cjs/augment/Token.js +7 -0
- package/lib/cjs/augment/User.d.ts +8 -0
- package/lib/cjs/augment/User.js +7 -0
- package/lib/cjs/augment/Vault.d.ts +8 -0
- package/lib/cjs/augment/Vault.js +7 -0
- package/lib/cjs/augment/VaultConfig.d.ts +8 -0
- package/lib/cjs/augment/VaultConfig.js +7 -0
- package/lib/cjs/augment/VaultMarketAllocation.d.ts +8 -0
- package/lib/cjs/augment/VaultMarketAllocation.js +7 -0
- package/lib/cjs/augment/VaultMarketConfig.d.ts +8 -0
- package/lib/cjs/augment/VaultMarketConfig.js +7 -0
- package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.d.ts +8 -0
- package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.js +8 -0
- package/lib/cjs/augment/VaultUser.d.ts +8 -0
- package/lib/cjs/augment/VaultUser.js +7 -0
- package/lib/cjs/augment.d.ts +14 -0
- package/lib/cjs/augment.js +16 -0
- package/lib/cjs/bundler/actions.d.ts +637 -0
- package/lib/cjs/bundler/actions.js +1088 -0
- package/lib/cjs/bundler/index.d.ts +2 -0
- package/lib/cjs/bundler/index.js +18 -0
- package/lib/cjs/bundler/types.d.ts +200 -0
- package/lib/cjs/bundler/types.js +2 -0
- package/lib/cjs/constants.d.ts +3 -0
- package/lib/cjs/constants.js +32 -0
- package/lib/cjs/entities/index.d.ts +6 -3
- package/lib/cjs/entities/index.js +41 -17
- package/lib/cjs/entities/marketV1/marketV1.d.ts +161 -24
- package/lib/cjs/entities/marketV1/marketV1.js +166 -19
- package/lib/cjs/entities/reallocationData.d.ts +193 -0
- package/lib/cjs/entities/reallocationData.js +406 -0
- package/lib/cjs/errors.d.ts +2 -0
- package/lib/cjs/errors.js +18 -0
- package/lib/cjs/fetch.d.ts +1 -0
- package/lib/cjs/fetch.js +30 -0
- package/lib/cjs/format.d.ts +2 -0
- package/lib/cjs/format.js +22 -0
- package/lib/cjs/helpers/computeReallocations.d.ts +63 -12
- package/lib/cjs/helpers/computeReallocations.js +160 -41
- package/lib/cjs/helpers/constant.d.ts +17 -0
- package/lib/cjs/helpers/constant.js +30 -1
- package/lib/cjs/helpers/index.d.ts +3 -2
- package/lib/cjs/helpers/index.js +14 -2
- package/lib/cjs/helpers/slippage.d.ts +57 -0
- package/lib/cjs/helpers/slippage.js +82 -0
- package/lib/cjs/helpers/validate.d.ts +40 -7
- package/lib/cjs/helpers/validate.js +67 -12
- package/lib/cjs/index.d.ts +0 -1
- package/lib/cjs/index.js +0 -1
- package/lib/cjs/types/action.d.ts +27 -6
- package/lib/cjs/types/client.d.ts +1 -1
- package/lib/cjs/types/error.d.ts +155 -7
- package/lib/cjs/types/error.js +202 -11
- package/lib/cjs/types/sharedLiquidity.d.ts +43 -3
- package/lib/cjs/types.d.ts +3 -0
- package/lib/cjs/types.js +17 -0
- package/lib/cjs/utils.d.ts +9 -0
- package/lib/cjs/utils.js +65 -0
- package/lib/esm/abis.d.ts +2816 -0
- package/lib/esm/abis.js +1922 -0
- package/lib/esm/actions/index.d.ts +3 -0
- package/lib/esm/actions/marketV1/borrow.js +2 -5
- package/lib/esm/actions/marketV1/buildReallocationActions.d.ts +2 -3
- package/lib/esm/actions/marketV1/buildReallocationActions.js +1 -2
- package/lib/esm/actions/marketV1/index.d.ts +2 -0
- package/lib/esm/actions/marketV1/index.js +2 -0
- package/lib/esm/actions/marketV1/repay.d.ts +2 -0
- package/lib/esm/actions/marketV1/repay.js +4 -5
- package/lib/esm/actions/marketV1/repayWithdrawCollateral.d.ts +2 -0
- package/lib/esm/actions/marketV1/repayWithdrawCollateral.js +4 -5
- package/lib/esm/actions/marketV1/supply.d.ts +69 -0
- package/lib/esm/actions/marketV1/supply.js +124 -0
- package/lib/esm/actions/marketV1/supplyCollateral.d.ts +3 -1
- package/lib/esm/actions/marketV1/supplyCollateral.js +7 -8
- package/lib/esm/actions/marketV1/supplyCollateralBorrow.d.ts +3 -1
- package/lib/esm/actions/marketV1/supplyCollateralBorrow.js +7 -8
- package/lib/esm/actions/marketV1/withdraw.d.ts +83 -0
- package/lib/esm/actions/marketV1/withdraw.js +106 -0
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +1 -1
- package/lib/esm/actions/requirements/getRequirementsAction.d.ts +1 -1
- package/lib/esm/actions/requirements/getRequirementsApproval.js +1 -1
- package/lib/esm/actions/vaultV1/deposit.d.ts +2 -0
- package/lib/esm/actions/vaultV1/deposit.js +3 -4
- package/lib/esm/actions/vaultV1/migrateToV2.d.ts +2 -0
- package/lib/esm/actions/vaultV1/migrateToV2.js +3 -1
- package/lib/esm/actions/vaultV2/deposit.d.ts +2 -0
- package/lib/esm/actions/vaultV2/deposit.js +3 -4
- package/lib/esm/addresses.d.ts +2 -0
- package/lib/esm/addresses.js +1 -0
- package/lib/esm/augment/AccrualPosition.d.ts +9 -0
- package/lib/esm/augment/AccrualPosition.js +5 -0
- package/lib/esm/augment/AccrualVault.d.ts +8 -0
- package/lib/esm/augment/AccrualVault.js +4 -0
- package/lib/esm/augment/Holding.d.ts +8 -0
- package/lib/esm/augment/Holding.js +4 -0
- package/lib/esm/augment/Market.d.ts +8 -0
- package/lib/esm/augment/Market.js +4 -0
- package/lib/esm/augment/MarketParams.d.ts +8 -0
- package/lib/esm/augment/MarketParams.js +4 -0
- package/lib/esm/augment/Position.d.ts +8 -0
- package/lib/esm/augment/Position.js +4 -0
- package/lib/esm/augment/Token.d.ts +8 -0
- package/lib/esm/augment/Token.js +4 -0
- package/lib/esm/augment/User.d.ts +8 -0
- package/lib/esm/augment/User.js +4 -0
- package/lib/esm/augment/Vault.d.ts +8 -0
- package/lib/esm/augment/Vault.js +4 -0
- package/lib/esm/augment/VaultConfig.d.ts +8 -0
- package/lib/esm/augment/VaultConfig.js +4 -0
- package/lib/esm/augment/VaultMarketAllocation.d.ts +8 -0
- package/lib/esm/augment/VaultMarketAllocation.js +4 -0
- package/lib/esm/augment/VaultMarketConfig.d.ts +8 -0
- package/lib/esm/augment/VaultMarketConfig.js +4 -0
- package/lib/esm/augment/VaultMarketPublicAllocatorConfig.d.ts +8 -0
- package/lib/esm/augment/VaultMarketPublicAllocatorConfig.js +5 -0
- package/lib/esm/augment/VaultUser.d.ts +8 -0
- package/lib/esm/augment/VaultUser.js +4 -0
- package/lib/esm/augment.d.ts +14 -0
- package/lib/esm/augment.js +14 -0
- package/lib/esm/bundler/actions.d.ts +637 -0
- package/lib/esm/bundler/actions.js +1085 -0
- package/lib/esm/bundler/index.d.ts +2 -0
- package/lib/esm/bundler/index.js +2 -0
- package/lib/esm/bundler/types.d.ts +200 -0
- package/lib/esm/bundler/types.js +1 -0
- package/lib/esm/constants.d.ts +3 -0
- package/lib/esm/constants.js +3 -0
- package/lib/esm/entities/index.d.ts +6 -3
- package/lib/esm/entities/index.js +5 -3
- package/lib/esm/entities/marketV1/marketV1.d.ts +161 -24
- package/lib/esm/entities/marketV1/marketV1.js +170 -23
- package/lib/esm/entities/reallocationData.d.ts +193 -0
- package/lib/esm/entities/reallocationData.js +402 -0
- package/lib/esm/errors.d.ts +2 -0
- package/lib/esm/errors.js +1 -0
- package/lib/esm/fetch.d.ts +1 -0
- package/lib/esm/fetch.js +1 -0
- package/lib/esm/format.d.ts +2 -0
- package/lib/esm/format.js +1 -0
- package/lib/esm/helpers/computeReallocations.d.ts +63 -12
- package/lib/esm/helpers/computeReallocations.js +160 -41
- package/lib/esm/helpers/constant.d.ts +17 -0
- package/lib/esm/helpers/constant.js +30 -1
- package/lib/esm/helpers/index.d.ts +3 -2
- package/lib/esm/helpers/index.js +3 -2
- package/lib/esm/helpers/slippage.d.ts +57 -0
- package/lib/esm/helpers/slippage.js +80 -0
- package/lib/esm/helpers/validate.d.ts +40 -7
- package/lib/esm/helpers/validate.js +63 -11
- package/lib/esm/index.d.ts +0 -1
- package/lib/esm/index.js +0 -1
- package/lib/esm/types/action.d.ts +27 -6
- package/lib/esm/types/client.d.ts +1 -1
- package/lib/esm/types/error.d.ts +155 -7
- package/lib/esm/types/error.js +185 -9
- package/lib/esm/types/sharedLiquidity.d.ts +43 -3
- package/lib/esm/types.d.ts +3 -0
- package/lib/esm/types.js +1 -0
- package/lib/esm/utils.d.ts +9 -0
- package/lib/esm/utils.js +7 -0
- package/package.json +128 -17
- package/src/index.ts +0 -1
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { MarketParams } from "@morpho-org/blue-sdk";
|
|
2
|
+
import type { Address } from "viem";
|
|
3
|
+
import { type MarketV1WithdrawAction, type Metadata, type Transaction, type VaultReallocation } from "../../types/index.js";
|
|
4
|
+
/** Parameters for {@link marketV1Withdraw}. */
|
|
5
|
+
export interface MarketV1WithdrawParams {
|
|
6
|
+
market: {
|
|
7
|
+
readonly chainId: number;
|
|
8
|
+
readonly marketParams: MarketParams;
|
|
9
|
+
};
|
|
10
|
+
args: {
|
|
11
|
+
/** Withdraw assets amount (`0n` when withdrawing by shares). */
|
|
12
|
+
assets: bigint;
|
|
13
|
+
/** Withdraw shares amount (`0n` when withdrawing by assets). */
|
|
14
|
+
shares: bigint;
|
|
15
|
+
/** Address that receives the withdrawn assets. */
|
|
16
|
+
receiver: Address;
|
|
17
|
+
/** Minimum withdraw share price (in ray). Slippage protection. */
|
|
18
|
+
minSharePrice: bigint;
|
|
19
|
+
/**
|
|
20
|
+
* Vault reallocations to execute before withdrawing. Compute via
|
|
21
|
+
* `MorphoMarketV1.getReallocations({ operation: "withdraw", amount })` or directly via
|
|
22
|
+
* `computeReallocations({ operation: "withdraw", amount, ... })`.
|
|
23
|
+
*/
|
|
24
|
+
reallocations?: readonly VaultReallocation[];
|
|
25
|
+
};
|
|
26
|
+
metadata?: Metadata;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Prepares a loan-asset withdraw transaction for a Morpho Blue market.
|
|
30
|
+
*
|
|
31
|
+
* Routed through bundler3 via `morphoWithdraw`. Supports two modes (exactly one):
|
|
32
|
+
*
|
|
33
|
+
* - **By assets** (`assets > 0, shares = 0`): withdraws an exact asset amount.
|
|
34
|
+
* - **By shares** (`assets = 0, shares > 0`): burns an exact share count (typical for a full
|
|
35
|
+
* supplier position close; immune to interest accrual between tx construction and execution).
|
|
36
|
+
*
|
|
37
|
+
* When `reallocations` are provided, `reallocateTo` actions are prepended to the bundle, moving
|
|
38
|
+
* liquidity from other markets into this one via the PublicAllocator before withdrawing.
|
|
39
|
+
* Reallocation fees accumulate in `tx.value`. The on-chain `morphoWithdraw` sends the assets
|
|
40
|
+
* computed on-chain directly to `receiver`; no skim is required.
|
|
41
|
+
*
|
|
42
|
+
* The withdraw is performed on behalf of the transaction initiator (signer) — there is no
|
|
43
|
+
* separate `onBehalf` field; mirror `marketV1Borrow`. The entity layer keeps `receiver` aligned
|
|
44
|
+
* with the user when none is provided. Requires the user to have authorized `GeneralAdapter1`
|
|
45
|
+
* on Morpho.
|
|
46
|
+
*
|
|
47
|
+
* @param params.market.chainId - The chain the market lives on.
|
|
48
|
+
* @param params.market.marketParams - Market params (loanToken, collateralToken, oracle, irm, lltv).
|
|
49
|
+
* @param params.args.assets - Withdraw amount in loan-token assets. Set to `0n` in shares mode.
|
|
50
|
+
* @param params.args.shares - Withdraw amount in supply shares. Set to `0n` in assets mode.
|
|
51
|
+
* @param params.args.receiver - Address that receives the withdrawn assets.
|
|
52
|
+
* @param params.args.minSharePrice - Minimum acceptable withdraw share price (in ray). Slippage
|
|
53
|
+
* protection.
|
|
54
|
+
* @param params.args.reallocations - Optional vault reallocations to execute before withdrawing,
|
|
55
|
+
* computed by the entity layer.
|
|
56
|
+
* @param params.metadata - Optional analytics metadata attached to the bundle.
|
|
57
|
+
* @returns A deep-frozen `Transaction<MarketV1WithdrawAction>` with `to`, `value`, `data`, and
|
|
58
|
+
* the typed `action` discriminator the simulation layer consumes.
|
|
59
|
+
* @throws {NonPositiveWithdrawAmountError} when both `assets` and `shares` are zero, or either is negative.
|
|
60
|
+
* @throws {MutuallyExclusiveWithdrawAmountsError} when both `assets` and `shares` are non-zero.
|
|
61
|
+
* @throws {NegativeWithdrawMinSharePriceError} when `minSharePrice < 0n` (zero is allowed despite
|
|
62
|
+
* the class name — pattern preserved for symmetry with `marketV1Borrow`).
|
|
63
|
+
* @throws Reallocation errors from `buildReallocationActions` when `reallocations` is malformed
|
|
64
|
+
* (see its JSDoc: `NegativeReallocationFeeError`, `EmptyReallocationWithdrawalsError`,
|
|
65
|
+
* `NonPositiveReallocationAmountError`, `ReallocationWithdrawalOnTargetMarketError`,
|
|
66
|
+
* `UnsortedReallocationWithdrawalsError`).
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* import { marketV1Withdraw } from "@morpho-org/morpho-sdk";
|
|
70
|
+
*
|
|
71
|
+
* const tx = marketV1Withdraw({
|
|
72
|
+
* market: { chainId: 1, marketParams },
|
|
73
|
+
* args: {
|
|
74
|
+
* assets: 1_000_000_000n,
|
|
75
|
+
* shares: 0n,
|
|
76
|
+
* receiver: supplier,
|
|
77
|
+
* minSharePrice: 0n, // disables slippage protection — production code should compute via `computeMinWithdrawSharePrice` from market state + slippage tolerance
|
|
78
|
+
* },
|
|
79
|
+
* });
|
|
80
|
+
* // tx satisfies Readonly<Transaction<MarketV1WithdrawAction>>
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export declare const marketV1Withdraw: ({ market: { chainId, marketParams }, args: { assets, shares, receiver, minSharePrice, reallocations }, metadata, }: MarketV1WithdrawParams) => Readonly<Transaction<MarketV1WithdrawAction>>;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.marketV1Withdraw = void 0;
|
|
4
|
+
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
5
|
+
const index_js_1 = require("../../bundler/index.js");
|
|
6
|
+
const index_js_2 = require("../../helpers/index.js");
|
|
7
|
+
const index_js_3 = require("../../types/index.js");
|
|
8
|
+
const buildReallocationActions_js_1 = require("./buildReallocationActions.js");
|
|
9
|
+
/**
|
|
10
|
+
* Prepares a loan-asset withdraw transaction for a Morpho Blue market.
|
|
11
|
+
*
|
|
12
|
+
* Routed through bundler3 via `morphoWithdraw`. Supports two modes (exactly one):
|
|
13
|
+
*
|
|
14
|
+
* - **By assets** (`assets > 0, shares = 0`): withdraws an exact asset amount.
|
|
15
|
+
* - **By shares** (`assets = 0, shares > 0`): burns an exact share count (typical for a full
|
|
16
|
+
* supplier position close; immune to interest accrual between tx construction and execution).
|
|
17
|
+
*
|
|
18
|
+
* When `reallocations` are provided, `reallocateTo` actions are prepended to the bundle, moving
|
|
19
|
+
* liquidity from other markets into this one via the PublicAllocator before withdrawing.
|
|
20
|
+
* Reallocation fees accumulate in `tx.value`. The on-chain `morphoWithdraw` sends the assets
|
|
21
|
+
* computed on-chain directly to `receiver`; no skim is required.
|
|
22
|
+
*
|
|
23
|
+
* The withdraw is performed on behalf of the transaction initiator (signer) — there is no
|
|
24
|
+
* separate `onBehalf` field; mirror `marketV1Borrow`. The entity layer keeps `receiver` aligned
|
|
25
|
+
* with the user when none is provided. Requires the user to have authorized `GeneralAdapter1`
|
|
26
|
+
* on Morpho.
|
|
27
|
+
*
|
|
28
|
+
* @param params.market.chainId - The chain the market lives on.
|
|
29
|
+
* @param params.market.marketParams - Market params (loanToken, collateralToken, oracle, irm, lltv).
|
|
30
|
+
* @param params.args.assets - Withdraw amount in loan-token assets. Set to `0n` in shares mode.
|
|
31
|
+
* @param params.args.shares - Withdraw amount in supply shares. Set to `0n` in assets mode.
|
|
32
|
+
* @param params.args.receiver - Address that receives the withdrawn assets.
|
|
33
|
+
* @param params.args.minSharePrice - Minimum acceptable withdraw share price (in ray). Slippage
|
|
34
|
+
* protection.
|
|
35
|
+
* @param params.args.reallocations - Optional vault reallocations to execute before withdrawing,
|
|
36
|
+
* computed by the entity layer.
|
|
37
|
+
* @param params.metadata - Optional analytics metadata attached to the bundle.
|
|
38
|
+
* @returns A deep-frozen `Transaction<MarketV1WithdrawAction>` with `to`, `value`, `data`, and
|
|
39
|
+
* the typed `action` discriminator the simulation layer consumes.
|
|
40
|
+
* @throws {NonPositiveWithdrawAmountError} when both `assets` and `shares` are zero, or either is negative.
|
|
41
|
+
* @throws {MutuallyExclusiveWithdrawAmountsError} when both `assets` and `shares` are non-zero.
|
|
42
|
+
* @throws {NegativeWithdrawMinSharePriceError} when `minSharePrice < 0n` (zero is allowed despite
|
|
43
|
+
* the class name — pattern preserved for symmetry with `marketV1Borrow`).
|
|
44
|
+
* @throws Reallocation errors from `buildReallocationActions` when `reallocations` is malformed
|
|
45
|
+
* (see its JSDoc: `NegativeReallocationFeeError`, `EmptyReallocationWithdrawalsError`,
|
|
46
|
+
* `NonPositiveReallocationAmountError`, `ReallocationWithdrawalOnTargetMarketError`,
|
|
47
|
+
* `UnsortedReallocationWithdrawalsError`).
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* import { marketV1Withdraw } from "@morpho-org/morpho-sdk";
|
|
51
|
+
*
|
|
52
|
+
* const tx = marketV1Withdraw({
|
|
53
|
+
* market: { chainId: 1, marketParams },
|
|
54
|
+
* args: {
|
|
55
|
+
* assets: 1_000_000_000n,
|
|
56
|
+
* shares: 0n,
|
|
57
|
+
* receiver: supplier,
|
|
58
|
+
* minSharePrice: 0n, // disables slippage protection — production code should compute via `computeMinWithdrawSharePrice` from market state + slippage tolerance
|
|
59
|
+
* },
|
|
60
|
+
* });
|
|
61
|
+
* // tx satisfies Readonly<Transaction<MarketV1WithdrawAction>>
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
const marketV1Withdraw = ({ market: { chainId, marketParams }, args: { assets, shares, receiver, minSharePrice, reallocations }, metadata, }) => {
|
|
65
|
+
// Mutual exclusion is detected on "both values present" (either non-zero),
|
|
66
|
+
// before sign checks — otherwise `{ assets: -1n, shares: 5n }` would be
|
|
67
|
+
// misreported as a positivity error rather than the actual mode conflict.
|
|
68
|
+
if (assets !== 0n && shares !== 0n) {
|
|
69
|
+
throw new index_js_3.MutuallyExclusiveWithdrawAmountsError(marketParams.id);
|
|
70
|
+
}
|
|
71
|
+
if (assets < 0n || shares < 0n || (assets === 0n && shares === 0n)) {
|
|
72
|
+
throw new index_js_3.NonPositiveWithdrawAmountError(marketParams.id);
|
|
73
|
+
}
|
|
74
|
+
if (minSharePrice < 0n) {
|
|
75
|
+
throw new index_js_3.NegativeWithdrawMinSharePriceError(marketParams.id);
|
|
76
|
+
}
|
|
77
|
+
const actions = [];
|
|
78
|
+
let reallocationFee = 0n;
|
|
79
|
+
if (reallocations && reallocations.length > 0) {
|
|
80
|
+
const result = (0, buildReallocationActions_js_1.buildReallocationActions)(reallocations, marketParams);
|
|
81
|
+
actions.push(...result.actions);
|
|
82
|
+
reallocationFee = result.fee;
|
|
83
|
+
}
|
|
84
|
+
actions.push({
|
|
85
|
+
type: "morphoWithdraw",
|
|
86
|
+
args: [marketParams, assets, shares, minSharePrice, receiver, false],
|
|
87
|
+
});
|
|
88
|
+
let tx = {
|
|
89
|
+
...index_js_1.BundlerAction.encodeBundle(chainId, actions),
|
|
90
|
+
value: reallocationFee,
|
|
91
|
+
};
|
|
92
|
+
if (metadata) {
|
|
93
|
+
tx = (0, index_js_2.addTransactionMetadata)(tx, metadata);
|
|
94
|
+
}
|
|
95
|
+
return (0, morpho_ts_1.deepFreeze)({
|
|
96
|
+
...tx,
|
|
97
|
+
action: {
|
|
98
|
+
type: "marketV1Withdraw",
|
|
99
|
+
args: {
|
|
100
|
+
market: marketParams.id,
|
|
101
|
+
assets,
|
|
102
|
+
shares,
|
|
103
|
+
receiver,
|
|
104
|
+
minSharePrice,
|
|
105
|
+
reallocationFee,
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
exports.marketV1Withdraw = marketV1Withdraw;
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.encodeErc20Approval = void 0;
|
|
4
4
|
const blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
5
5
|
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
6
|
-
const simulation_sdk_1 = require("@morpho-org/simulation-sdk");
|
|
7
6
|
const viem_1 = require("viem");
|
|
7
|
+
const constant_js_1 = require("../../../helpers/constant.js");
|
|
8
8
|
/**
|
|
9
9
|
* Encodes a deep-frozen ERC-20 `approve(spender, amount)` transaction.
|
|
10
10
|
*
|
|
@@ -32,7 +32,7 @@ const viem_1 = require("viem");
|
|
|
32
32
|
*/
|
|
33
33
|
const encodeErc20Approval = (params) => {
|
|
34
34
|
const { token, spender, amount, chainId } = params;
|
|
35
|
-
const amountValue = blue_sdk_1.MathLib.min(amount,
|
|
35
|
+
const amountValue = blue_sdk_1.MathLib.min(amount, constant_js_1.MAX_TOKEN_APPROVALS[chainId]?.[token] ?? viem_1.maxUint256);
|
|
36
36
|
return (0, morpho_ts_1.deepFreeze)({
|
|
37
37
|
to: token,
|
|
38
38
|
data: (0, viem_1.encodeFunctionData)({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Action } from "@morpho-org/bundler-sdk-viem";
|
|
2
1
|
import { type Address } from "viem";
|
|
2
|
+
import type { Action } from "../../bundler/index.js";
|
|
3
3
|
import { type Permit2Action, type PermitAction, type PermitArgs } from "../../types/index.js";
|
|
4
4
|
interface GetRequirementsActionParams {
|
|
5
5
|
asset: Address;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getRequirementsApproval = void 0;
|
|
4
|
-
const
|
|
4
|
+
const constant_js_1 = require("../../helpers/constant.js");
|
|
5
5
|
const index_js_1 = require("../../types/index.js");
|
|
6
6
|
const encodeErc20Approval_js_1 = require("./encode/encodeErc20Approval.js");
|
|
7
7
|
/**
|
|
@@ -42,7 +42,7 @@ const getRequirementsApproval = (params) => {
|
|
|
42
42
|
}
|
|
43
43
|
const approvals = [];
|
|
44
44
|
if (allowances < spendAmount) {
|
|
45
|
-
if (
|
|
45
|
+
if (constant_js_1.APPROVE_ONLY_ONCE_TOKENS[chainId]?.includes(address) &&
|
|
46
46
|
allowances > 0n) {
|
|
47
47
|
approvals.push((0, encodeErc20Approval_js_1.encodeErc20Approval)({
|
|
48
48
|
token: address,
|
|
@@ -53,6 +53,8 @@ export interface VaultV1DepositParams {
|
|
|
53
53
|
* signature is ignored on the native-only path (`amount === 0n` with `nativeAmount > 0n`).
|
|
54
54
|
* @throws {DepositAmountMismatchError} from `getRequirementsAction` when `amount > 0n` and
|
|
55
55
|
* `requirementSignature` is provided and the signed amount differs from `args.amount`.
|
|
56
|
+
* @throws {Permit2ExpirationMissingError} from `getRequirementsAction` when `amount > 0n` and a
|
|
57
|
+
* Permit2 requirement signature is missing its expiration.
|
|
56
58
|
* @throws {ZeroDepositAmountError} when both `amount` and `nativeAmount` resolve to zero.
|
|
57
59
|
* @example
|
|
58
60
|
* ```ts
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.vaultV1Deposit = void 0;
|
|
4
4
|
const blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
5
|
-
const bundler_sdk_viem_1 = require("@morpho-org/bundler-sdk-viem");
|
|
6
5
|
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
7
6
|
const viem_1 = require("viem");
|
|
8
|
-
const index_js_1 = require("../../
|
|
9
|
-
const index_js_2 = require("../../
|
|
7
|
+
const index_js_1 = require("../../bundler/index.js");
|
|
8
|
+
const index_js_2 = require("../../helpers/index.js");
|
|
9
|
+
const index_js_3 = require("../../types/index.js");
|
|
10
10
|
const getRequirementsAction_js_1 = require("../requirements/getRequirementsAction.js");
|
|
11
11
|
/**
|
|
12
12
|
* Prepares a deposit transaction for a VaultV1 (MetaMorpho) contract.
|
|
@@ -47,6 +47,8 @@ const getRequirementsAction_js_1 = require("../requirements/getRequirementsActio
|
|
|
47
47
|
* signature is ignored on the native-only path (`amount === 0n` with `nativeAmount > 0n`).
|
|
48
48
|
* @throws {DepositAmountMismatchError} from `getRequirementsAction` when `amount > 0n` and
|
|
49
49
|
* `requirementSignature` is provided and the signed amount differs from `args.amount`.
|
|
50
|
+
* @throws {Permit2ExpirationMissingError} from `getRequirementsAction` when `amount > 0n` and a
|
|
51
|
+
* Permit2 requirement signature is missing its expiration.
|
|
50
52
|
* @throws {ZeroDepositAmountError} when both `amount` and `nativeAmount` resolve to zero.
|
|
51
53
|
* @example
|
|
52
54
|
* ```ts
|
|
@@ -65,22 +67,22 @@ const getRequirementsAction_js_1 = require("../requirements/getRequirementsActio
|
|
|
65
67
|
*/
|
|
66
68
|
const vaultV1Deposit = ({ vault: { chainId, address: vaultAddress, asset }, args: { amount = 0n, maxSharePrice, recipient, requirementSignature, nativeAmount, }, metadata, }) => {
|
|
67
69
|
if (amount < 0n) {
|
|
68
|
-
throw new
|
|
70
|
+
throw new index_js_3.NonPositiveAssetAmountError(asset);
|
|
69
71
|
}
|
|
70
72
|
if (maxSharePrice <= 0n) {
|
|
71
|
-
throw new
|
|
73
|
+
throw new index_js_3.NonPositiveMaxSharePriceError(vaultAddress);
|
|
72
74
|
}
|
|
73
75
|
const actions = [];
|
|
74
76
|
const { bundler3: { generalAdapter1, bundler3 }, wNative, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
75
77
|
if (nativeAmount) {
|
|
76
78
|
if (nativeAmount < 0n) {
|
|
77
|
-
throw new
|
|
79
|
+
throw new index_js_3.NegativeNativeAmountError(nativeAmount);
|
|
78
80
|
}
|
|
79
81
|
if (!(0, morpho_ts_1.isDefined)(wNative)) {
|
|
80
|
-
throw new
|
|
82
|
+
throw new index_js_3.ChainWNativeMissingError(chainId);
|
|
81
83
|
}
|
|
82
84
|
if (!(0, viem_1.isAddressEqual)(asset, wNative)) {
|
|
83
|
-
throw new
|
|
85
|
+
throw new index_js_3.NativeAmountOnNonWNativeVaultError(asset, wNative);
|
|
84
86
|
}
|
|
85
87
|
actions.push(
|
|
86
88
|
// Transfers native token from Bundler3 to GeneralAdapter1 for wrapping.
|
|
@@ -110,7 +112,7 @@ const vaultV1Deposit = ({ vault: { chainId, address: vaultAddress, asset }, args
|
|
|
110
112
|
}
|
|
111
113
|
const totalAssets = amount + (nativeAmount ?? 0n);
|
|
112
114
|
if (totalAssets === 0n) {
|
|
113
|
-
throw new
|
|
115
|
+
throw new index_js_3.ZeroDepositAmountError(vaultAddress);
|
|
114
116
|
}
|
|
115
117
|
actions.push({
|
|
116
118
|
type: "erc4626Deposit",
|
|
@@ -122,12 +124,9 @@ const vaultV1Deposit = ({ vault: { chainId, address: vaultAddress, asset }, args
|
|
|
122
124
|
false /* skipRevert */,
|
|
123
125
|
],
|
|
124
126
|
});
|
|
125
|
-
let tx =
|
|
126
|
-
if (nativeAmount) {
|
|
127
|
-
tx = { ...tx, value: nativeAmount };
|
|
128
|
-
}
|
|
127
|
+
let tx = index_js_1.BundlerAction.encodeBundle(chainId, actions);
|
|
129
128
|
if (metadata) {
|
|
130
|
-
tx = (0,
|
|
129
|
+
tx = (0, index_js_2.addTransactionMetadata)(tx, metadata);
|
|
131
130
|
}
|
|
132
131
|
return (0, morpho_ts_1.deepFreeze)({
|
|
133
132
|
...tx,
|
|
@@ -63,6 +63,8 @@ export interface VaultV1MigrateToV2Params {
|
|
|
63
63
|
* is provided and the signed asset differs from `vault.address` (the V1 share token).
|
|
64
64
|
* @throws {DepositAmountMismatchError} from `getRequirementsAction` when `requirementSignature`
|
|
65
65
|
* is provided and the signed amount differs from `args.shares`.
|
|
66
|
+
* @throws {Permit2ExpirationMissingError} from `getRequirementsAction` when a Permit2 requirement
|
|
67
|
+
* signature is missing its expiration.
|
|
66
68
|
* @example
|
|
67
69
|
* ```ts
|
|
68
70
|
* import { vaultV1MigrateToV2 } from "@morpho-org/morpho-sdk";
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.vaultV1MigrateToV2 = void 0;
|
|
4
4
|
const blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
5
|
-
const bundler_sdk_viem_1 = require("@morpho-org/bundler-sdk-viem");
|
|
6
5
|
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
7
6
|
const viem_1 = require("viem");
|
|
8
|
-
const index_js_1 = require("../../
|
|
9
|
-
const index_js_2 = require("../../
|
|
7
|
+
const index_js_1 = require("../../bundler/index.js");
|
|
8
|
+
const index_js_2 = require("../../helpers/index.js");
|
|
9
|
+
const index_js_3 = require("../../types/index.js");
|
|
10
10
|
const getRequirementsAction_js_1 = require("../requirements/getRequirementsAction.js");
|
|
11
11
|
/**
|
|
12
12
|
* Prepares an atomic full-migration transaction from VaultV1 to VaultV2.
|
|
@@ -46,6 +46,8 @@ const getRequirementsAction_js_1 = require("../requirements/getRequirementsActio
|
|
|
46
46
|
* is provided and the signed asset differs from `vault.address` (the V1 share token).
|
|
47
47
|
* @throws {DepositAmountMismatchError} from `getRequirementsAction` when `requirementSignature`
|
|
48
48
|
* is provided and the signed amount differs from `args.shares`.
|
|
49
|
+
* @throws {Permit2ExpirationMissingError} from `getRequirementsAction` when a Permit2 requirement
|
|
50
|
+
* signature is missing its expiration.
|
|
49
51
|
* @example
|
|
50
52
|
* ```ts
|
|
51
53
|
* import { vaultV1MigrateToV2 } from "@morpho-org/morpho-sdk";
|
|
@@ -68,16 +70,16 @@ const vaultV1MigrateToV2 = ({ vault: { chainId, address: sourceVault, asset: sou
|
|
|
68
70
|
// Both bundle legs use maxUint256: an asset mismatch leaves the redeemed
|
|
69
71
|
// source asset stranded on GA1 while the user receives only dust shares.
|
|
70
72
|
if (!(0, viem_1.isAddressEqual)(sourceAsset, targetAsset)) {
|
|
71
|
-
throw new
|
|
73
|
+
throw new index_js_3.VaultAssetMismatchError(sourceAsset, targetAsset);
|
|
72
74
|
}
|
|
73
75
|
if (shares <= 0n) {
|
|
74
|
-
throw new
|
|
76
|
+
throw new index_js_3.NonPositiveSharesAmountError(sourceVault);
|
|
75
77
|
}
|
|
76
78
|
if (minSharePriceVaultV1 < 0n) {
|
|
77
|
-
throw new
|
|
79
|
+
throw new index_js_3.NegativeMinSharePriceError(sourceVault);
|
|
78
80
|
}
|
|
79
81
|
if (maxSharePriceVaultV2 <= 0n) {
|
|
80
|
-
throw new
|
|
82
|
+
throw new index_js_3.NonPositiveMaxSharePriceError(targetVault);
|
|
81
83
|
}
|
|
82
84
|
const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
83
85
|
const actions = [];
|
|
@@ -121,9 +123,9 @@ const vaultV1MigrateToV2 = ({ vault: { chainId, address: sourceVault, asset: sou
|
|
|
121
123
|
false /* skipRevert */,
|
|
122
124
|
],
|
|
123
125
|
});
|
|
124
|
-
let tx =
|
|
126
|
+
let tx = index_js_1.BundlerAction.encodeBundle(chainId, actions);
|
|
125
127
|
if (metadata) {
|
|
126
|
-
tx = (0,
|
|
128
|
+
tx = (0, index_js_2.addTransactionMetadata)(tx, metadata);
|
|
127
129
|
}
|
|
128
130
|
return (0, morpho_ts_1.deepFreeze)({
|
|
129
131
|
...tx,
|
|
@@ -53,6 +53,8 @@ export interface VaultV2DepositParams {
|
|
|
53
53
|
* signature is ignored on the native-only path (`amount === 0n` with `nativeAmount > 0n`).
|
|
54
54
|
* @throws {DepositAmountMismatchError} from `getRequirementsAction` when `amount > 0n` and
|
|
55
55
|
* `requirementSignature` is provided and the signed amount differs from `args.amount`.
|
|
56
|
+
* @throws {Permit2ExpirationMissingError} from `getRequirementsAction` when `amount > 0n` and a
|
|
57
|
+
* Permit2 requirement signature is missing its expiration.
|
|
56
58
|
* @throws {ZeroDepositAmountError} when both `amount` and `nativeAmount` resolve to zero.
|
|
57
59
|
* @example
|
|
58
60
|
* ```ts
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.vaultV2Deposit = void 0;
|
|
4
4
|
const blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
5
|
-
const bundler_sdk_viem_1 = require("@morpho-org/bundler-sdk-viem");
|
|
6
5
|
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
7
6
|
const viem_1 = require("viem");
|
|
8
|
-
const index_js_1 = require("../../
|
|
9
|
-
const index_js_2 = require("../../
|
|
7
|
+
const index_js_1 = require("../../bundler/index.js");
|
|
8
|
+
const index_js_2 = require("../../helpers/index.js");
|
|
9
|
+
const index_js_3 = require("../../types/index.js");
|
|
10
10
|
const getRequirementsAction_js_1 = require("../requirements/getRequirementsAction.js");
|
|
11
11
|
/**
|
|
12
12
|
* Prepares a deposit transaction for a VaultV2 contract.
|
|
@@ -47,6 +47,8 @@ const getRequirementsAction_js_1 = require("../requirements/getRequirementsActio
|
|
|
47
47
|
* signature is ignored on the native-only path (`amount === 0n` with `nativeAmount > 0n`).
|
|
48
48
|
* @throws {DepositAmountMismatchError} from `getRequirementsAction` when `amount > 0n` and
|
|
49
49
|
* `requirementSignature` is provided and the signed amount differs from `args.amount`.
|
|
50
|
+
* @throws {Permit2ExpirationMissingError} from `getRequirementsAction` when `amount > 0n` and a
|
|
51
|
+
* Permit2 requirement signature is missing its expiration.
|
|
50
52
|
* @throws {ZeroDepositAmountError} when both `amount` and `nativeAmount` resolve to zero.
|
|
51
53
|
* @example
|
|
52
54
|
* ```ts
|
|
@@ -65,22 +67,22 @@ const getRequirementsAction_js_1 = require("../requirements/getRequirementsActio
|
|
|
65
67
|
*/
|
|
66
68
|
const vaultV2Deposit = ({ vault: { chainId, address: vaultAddress, asset }, args: { amount = 0n, maxSharePrice, recipient, requirementSignature, nativeAmount, }, metadata, }) => {
|
|
67
69
|
if (amount < 0n) {
|
|
68
|
-
throw new
|
|
70
|
+
throw new index_js_3.NonPositiveAssetAmountError(asset);
|
|
69
71
|
}
|
|
70
72
|
if (maxSharePrice <= 0n) {
|
|
71
|
-
throw new
|
|
73
|
+
throw new index_js_3.NonPositiveMaxSharePriceError(vaultAddress);
|
|
72
74
|
}
|
|
73
75
|
const actions = [];
|
|
74
76
|
const { bundler3: { generalAdapter1, bundler3 }, wNative, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
75
77
|
if (nativeAmount) {
|
|
76
78
|
if (nativeAmount < 0n) {
|
|
77
|
-
throw new
|
|
79
|
+
throw new index_js_3.NegativeNativeAmountError(nativeAmount);
|
|
78
80
|
}
|
|
79
81
|
if (!(0, morpho_ts_1.isDefined)(wNative)) {
|
|
80
|
-
throw new
|
|
82
|
+
throw new index_js_3.ChainWNativeMissingError(chainId);
|
|
81
83
|
}
|
|
82
84
|
if (!(0, viem_1.isAddressEqual)(asset, wNative)) {
|
|
83
|
-
throw new
|
|
85
|
+
throw new index_js_3.NativeAmountOnNonWNativeVaultError(asset, wNative);
|
|
84
86
|
}
|
|
85
87
|
actions.push(
|
|
86
88
|
// Transfers native token from Bundler3 to GeneralAdapter1 for wrapping.
|
|
@@ -110,7 +112,7 @@ const vaultV2Deposit = ({ vault: { chainId, address: vaultAddress, asset }, args
|
|
|
110
112
|
}
|
|
111
113
|
const totalAssets = amount + (nativeAmount ?? 0n);
|
|
112
114
|
if (totalAssets === 0n) {
|
|
113
|
-
throw new
|
|
115
|
+
throw new index_js_3.ZeroDepositAmountError(vaultAddress);
|
|
114
116
|
}
|
|
115
117
|
actions.push({
|
|
116
118
|
type: "erc4626Deposit",
|
|
@@ -122,12 +124,9 @@ const vaultV2Deposit = ({ vault: { chainId, address: vaultAddress, asset }, args
|
|
|
122
124
|
false /* skipRevert */,
|
|
123
125
|
],
|
|
124
126
|
});
|
|
125
|
-
let tx =
|
|
126
|
-
if (nativeAmount) {
|
|
127
|
-
tx = { ...tx, value: nativeAmount };
|
|
128
|
-
}
|
|
127
|
+
let tx = index_js_1.BundlerAction.encodeBundle(chainId, actions);
|
|
129
128
|
if (metadata) {
|
|
130
|
-
tx = (0,
|
|
129
|
+
tx = (0, index_js_2.addTransactionMetadata)(tx, metadata);
|
|
131
130
|
}
|
|
132
131
|
return (0, morpho_ts_1.deepFreeze)({
|
|
133
132
|
...tx,
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export type { AddressLabel, ChainAddresses, ChainDeployments, } from "@morpho-org/blue-sdk";
|
|
2
|
+
export { addresses, addressesRegistry, convexWrapperTokens, deployments, erc20WrapperTokens, getChainAddresses, getPermissionedCoinbaseTokens, getUnwrappedToken, NATIVE_ADDRESS, permissionedBackedTokens, permissionedCoinbaseTokens, permissionedWrapperTokens, registerCustomAddresses, unwrappedTokensMapping, } from "@morpho-org/blue-sdk";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.unwrappedTokensMapping = exports.registerCustomAddresses = exports.permissionedWrapperTokens = exports.permissionedCoinbaseTokens = exports.permissionedBackedTokens = exports.NATIVE_ADDRESS = exports.getUnwrappedToken = exports.getPermissionedCoinbaseTokens = exports.getChainAddresses = exports.erc20WrapperTokens = exports.deployments = exports.convexWrapperTokens = exports.addressesRegistry = exports.addresses = void 0;
|
|
4
|
+
var blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
5
|
+
Object.defineProperty(exports, "addresses", { enumerable: true, get: function () { return blue_sdk_1.addresses; } });
|
|
6
|
+
Object.defineProperty(exports, "addressesRegistry", { enumerable: true, get: function () { return blue_sdk_1.addressesRegistry; } });
|
|
7
|
+
Object.defineProperty(exports, "convexWrapperTokens", { enumerable: true, get: function () { return blue_sdk_1.convexWrapperTokens; } });
|
|
8
|
+
Object.defineProperty(exports, "deployments", { enumerable: true, get: function () { return blue_sdk_1.deployments; } });
|
|
9
|
+
Object.defineProperty(exports, "erc20WrapperTokens", { enumerable: true, get: function () { return blue_sdk_1.erc20WrapperTokens; } });
|
|
10
|
+
Object.defineProperty(exports, "getChainAddresses", { enumerable: true, get: function () { return blue_sdk_1.getChainAddresses; } });
|
|
11
|
+
Object.defineProperty(exports, "getPermissionedCoinbaseTokens", { enumerable: true, get: function () { return blue_sdk_1.getPermissionedCoinbaseTokens; } });
|
|
12
|
+
Object.defineProperty(exports, "getUnwrappedToken", { enumerable: true, get: function () { return blue_sdk_1.getUnwrappedToken; } });
|
|
13
|
+
Object.defineProperty(exports, "NATIVE_ADDRESS", { enumerable: true, get: function () { return blue_sdk_1.NATIVE_ADDRESS; } });
|
|
14
|
+
Object.defineProperty(exports, "permissionedBackedTokens", { enumerable: true, get: function () { return blue_sdk_1.permissionedBackedTokens; } });
|
|
15
|
+
Object.defineProperty(exports, "permissionedCoinbaseTokens", { enumerable: true, get: function () { return blue_sdk_1.permissionedCoinbaseTokens; } });
|
|
16
|
+
Object.defineProperty(exports, "permissionedWrapperTokens", { enumerable: true, get: function () { return blue_sdk_1.permissionedWrapperTokens; } });
|
|
17
|
+
Object.defineProperty(exports, "registerCustomAddresses", { enumerable: true, get: function () { return blue_sdk_1.registerCustomAddresses; } });
|
|
18
|
+
Object.defineProperty(exports, "unwrappedTokensMapping", { enumerable: true, get: function () { return blue_sdk_1.unwrappedTokensMapping; } });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AccrualPosition as BlueAccrualPosition } from "@morpho-org/blue-sdk";
|
|
2
|
+
import { fetchAccrualPosition, fetchPreLiquidationPosition } from "@morpho-org/blue-sdk-viem";
|
|
3
|
+
declare module "@morpho-org/blue-sdk" {
|
|
4
|
+
namespace AccrualPosition {
|
|
5
|
+
let fetch: typeof fetchAccrualPosition;
|
|
6
|
+
let fetchPreLiquidation: typeof fetchPreLiquidationPosition;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export { BlueAccrualPosition as AccrualPosition };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AccrualPosition = void 0;
|
|
4
|
+
const blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
5
|
+
Object.defineProperty(exports, "AccrualPosition", { enumerable: true, get: function () { return blue_sdk_1.AccrualPosition; } });
|
|
6
|
+
const blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
|
|
7
|
+
blue_sdk_1.AccrualPosition.fetch = blue_sdk_viem_1.fetchAccrualPosition;
|
|
8
|
+
blue_sdk_1.AccrualPosition.fetchPreLiquidation = blue_sdk_viem_1.fetchPreLiquidationPosition;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AccrualVault as BlueAccrualVault } from "@morpho-org/blue-sdk";
|
|
2
|
+
import { fetchAccrualVault } from "@morpho-org/blue-sdk-viem";
|
|
3
|
+
declare module "@morpho-org/blue-sdk" {
|
|
4
|
+
namespace AccrualVault {
|
|
5
|
+
let fetch: typeof fetchAccrualVault;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export { BlueAccrualVault as AccrualVault };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AccrualVault = void 0;
|
|
4
|
+
const blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
5
|
+
Object.defineProperty(exports, "AccrualVault", { enumerable: true, get: function () { return blue_sdk_1.AccrualVault; } });
|
|
6
|
+
const blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
|
|
7
|
+
blue_sdk_1.AccrualVault.fetch = blue_sdk_viem_1.fetchAccrualVault;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Holding = void 0;
|
|
4
|
+
const blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
5
|
+
Object.defineProperty(exports, "Holding", { enumerable: true, get: function () { return blue_sdk_1.Holding; } });
|
|
6
|
+
const blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
|
|
7
|
+
blue_sdk_1.Holding.fetch = blue_sdk_viem_1.fetchHolding;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Market = void 0;
|
|
4
|
+
const blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
5
|
+
Object.defineProperty(exports, "Market", { enumerable: true, get: function () { return blue_sdk_1.Market; } });
|
|
6
|
+
const blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
|
|
7
|
+
blue_sdk_1.Market.fetch = blue_sdk_viem_1.fetchMarket;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MarketParams as BlueMarketParams } from "@morpho-org/blue-sdk";
|
|
2
|
+
import { fetchMarketParams } from "@morpho-org/blue-sdk-viem";
|
|
3
|
+
declare module "@morpho-org/blue-sdk" {
|
|
4
|
+
namespace MarketParams {
|
|
5
|
+
let fetch: typeof fetchMarketParams;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export { BlueMarketParams as MarketParams };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MarketParams = void 0;
|
|
4
|
+
const blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
5
|
+
Object.defineProperty(exports, "MarketParams", { enumerable: true, get: function () { return blue_sdk_1.MarketParams; } });
|
|
6
|
+
const blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
|
|
7
|
+
blue_sdk_1.MarketParams.fetch = blue_sdk_viem_1.fetchMarketParams;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Position as BluePosition } from "@morpho-org/blue-sdk";
|
|
2
|
+
import { fetchPosition } from "@morpho-org/blue-sdk-viem";
|
|
3
|
+
declare module "@morpho-org/blue-sdk" {
|
|
4
|
+
namespace Position {
|
|
5
|
+
let fetch: typeof fetchPosition;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export { BluePosition as Position };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Position = void 0;
|
|
4
|
+
const blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
5
|
+
Object.defineProperty(exports, "Position", { enumerable: true, get: function () { return blue_sdk_1.Position; } });
|
|
6
|
+
const blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
|
|
7
|
+
blue_sdk_1.Position.fetch = blue_sdk_viem_1.fetchPosition;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Token = void 0;
|
|
4
|
+
const blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
5
|
+
Object.defineProperty(exports, "Token", { enumerable: true, get: function () { return blue_sdk_1.Token; } });
|
|
6
|
+
const blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
|
|
7
|
+
blue_sdk_1.Token.fetch = blue_sdk_viem_1.fetchToken;
|