@morpho-org/morpho-sdk 3.2.0 → 4.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/README.md +19 -16
- package/lib/cjs/actions/{marketV1 → blue}/borrow.d.ts +8 -8
- package/lib/cjs/actions/{marketV1 → blue}/borrow.js +8 -8
- package/lib/{esm/actions/marketV1 → cjs/actions/blue}/buildReallocationActions.d.ts +1 -1
- package/lib/cjs/actions/{marketV1 → blue}/buildReallocationActions.js +1 -1
- package/lib/{esm/actions/marketV1 → cjs/actions/blue}/refinance.d.ts +8 -8
- package/lib/cjs/actions/{marketV1 → blue}/refinance.js +8 -8
- package/lib/{esm/actions/marketV1 → cjs/actions/blue}/repay.d.ts +8 -8
- package/lib/cjs/actions/{marketV1 → blue}/repay.js +8 -8
- package/lib/{esm/actions/marketV1 → cjs/actions/blue}/repayWithdrawCollateral.d.ts +8 -8
- package/lib/cjs/actions/{marketV1 → blue}/repayWithdrawCollateral.js +8 -8
- package/lib/cjs/actions/{marketV1 → blue}/supply.d.ts +8 -8
- package/lib/cjs/actions/{marketV1 → blue}/supply.js +8 -8
- package/lib/cjs/actions/{marketV1 → blue}/supplyCollateral.d.ts +8 -8
- package/lib/cjs/actions/{marketV1 → blue}/supplyCollateral.js +8 -8
- package/lib/{esm/actions/marketV1 → cjs/actions/blue}/supplyCollateralBorrow.d.ts +8 -8
- package/lib/cjs/actions/{marketV1 → blue}/supplyCollateralBorrow.js +8 -8
- package/lib/{esm/actions/marketV1 → cjs/actions/blue}/withdraw.d.ts +11 -11
- package/lib/cjs/actions/{marketV1 → blue}/withdraw.js +10 -10
- package/lib/{esm/actions/marketV1 → cjs/actions/blue}/withdrawCollateral.d.ts +8 -8
- package/lib/cjs/actions/{marketV1 → blue}/withdrawCollateral.js +8 -8
- package/lib/cjs/actions/index.d.ts +2 -2
- package/lib/cjs/actions/index.js +1 -1
- package/lib/cjs/actions/requirements/getMorphoAuthorizationRequirement.d.ts +1 -1
- package/lib/cjs/actions/requirements/getMorphoAuthorizationRequirement.js +1 -1
- package/lib/cjs/client/index.d.ts +0 -1
- package/lib/cjs/client/index.js +0 -1
- package/lib/cjs/client/morphoViemExtension.d.ts +17 -11
- package/lib/cjs/client/morphoViemExtension.js +55 -10
- package/lib/cjs/entities/{marketV1/marketV1.d.ts → blue/blue.d.ts} +22 -22
- package/lib/cjs/entities/{marketV1/marketV1.js → blue/blue.js} +12 -12
- package/lib/cjs/entities/blue/index.d.ts +1 -0
- package/lib/cjs/entities/{marketV1 → blue}/index.js +1 -1
- package/lib/cjs/entities/index.d.ts +1 -1
- package/lib/cjs/entities/index.js +3 -3
- package/lib/cjs/entities/reallocationData.d.ts +96 -2
- package/lib/cjs/entities/reallocationData.js +112 -1
- package/lib/cjs/entities/vaultV2/vaultV2.js +1 -1
- package/lib/cjs/helpers/computeReallocations.d.ts +1 -1
- package/lib/cjs/helpers/computeReallocations.js +3 -5
- package/lib/cjs/helpers/utilization.d.ts +12 -0
- package/lib/cjs/helpers/utilization.js +17 -0
- package/lib/cjs/helpers/validate.d.ts +2 -2
- package/lib/cjs/helpers/validate.js +2 -2
- package/lib/cjs/types/action.d.ts +10 -10
- package/lib/cjs/types/client.d.ts +5 -4
- package/lib/esm/actions/{marketV1 → blue}/borrow.d.ts +8 -8
- package/lib/esm/actions/{marketV1 → blue}/borrow.js +6 -6
- package/lib/{cjs/actions/marketV1 → esm/actions/blue}/buildReallocationActions.d.ts +1 -1
- package/lib/esm/actions/{marketV1 → blue}/buildReallocationActions.js +1 -1
- package/lib/{cjs/actions/marketV1 → esm/actions/blue}/refinance.d.ts +8 -8
- package/lib/esm/actions/{marketV1 → blue}/refinance.js +6 -6
- package/lib/{cjs/actions/marketV1 → esm/actions/blue}/repay.d.ts +8 -8
- package/lib/esm/actions/{marketV1 → blue}/repay.js +6 -6
- package/lib/{cjs/actions/marketV1 → esm/actions/blue}/repayWithdrawCollateral.d.ts +8 -8
- package/lib/esm/actions/{marketV1 → blue}/repayWithdrawCollateral.js +6 -6
- package/lib/esm/actions/{marketV1 → blue}/supply.d.ts +8 -8
- package/lib/esm/actions/{marketV1 → blue}/supply.js +6 -6
- package/lib/esm/actions/{marketV1 → blue}/supplyCollateral.d.ts +8 -8
- package/lib/esm/actions/{marketV1 → blue}/supplyCollateral.js +6 -6
- package/lib/{cjs/actions/marketV1 → esm/actions/blue}/supplyCollateralBorrow.d.ts +8 -8
- package/lib/esm/actions/{marketV1 → blue}/supplyCollateralBorrow.js +6 -6
- package/lib/{cjs/actions/marketV1 → esm/actions/blue}/withdraw.d.ts +11 -11
- package/lib/esm/actions/{marketV1 → blue}/withdraw.js +8 -8
- package/lib/{cjs/actions/marketV1 → esm/actions/blue}/withdrawCollateral.d.ts +8 -8
- package/lib/esm/actions/{marketV1 → blue}/withdrawCollateral.js +6 -6
- package/lib/esm/actions/index.d.ts +2 -2
- package/lib/esm/actions/index.js +1 -1
- package/lib/esm/actions/requirements/getMorphoAuthorizationRequirement.d.ts +1 -1
- package/lib/esm/actions/requirements/getMorphoAuthorizationRequirement.js +1 -1
- package/lib/esm/client/index.d.ts +0 -1
- package/lib/esm/client/index.js +0 -1
- package/lib/esm/client/morphoViemExtension.d.ts +17 -11
- package/lib/esm/client/morphoViemExtension.js +55 -10
- package/lib/esm/entities/{marketV1/marketV1.d.ts → blue/blue.d.ts} +22 -22
- package/lib/esm/entities/{marketV1/marketV1.js → blue/blue.js} +11 -11
- package/lib/esm/entities/blue/index.d.ts +1 -0
- package/lib/esm/entities/blue/index.js +1 -0
- package/lib/esm/entities/index.d.ts +1 -1
- package/lib/esm/entities/index.js +1 -1
- package/lib/esm/entities/reallocationData.d.ts +96 -2
- package/lib/esm/entities/reallocationData.js +114 -3
- package/lib/esm/entities/vaultV2/vaultV2.js +1 -1
- package/lib/esm/helpers/computeReallocations.d.ts +1 -1
- package/lib/esm/helpers/computeReallocations.js +3 -5
- package/lib/esm/helpers/utilization.d.ts +12 -0
- package/lib/esm/helpers/utilization.js +13 -0
- package/lib/esm/helpers/validate.d.ts +2 -2
- package/lib/esm/helpers/validate.js +2 -2
- package/lib/esm/types/action.d.ts +10 -10
- package/lib/esm/types/client.d.ts +5 -4
- package/package.json +5 -5
- package/lib/cjs/client/morphoClient.d.ts +0 -152
- package/lib/cjs/client/morphoClient.js +0 -162
- package/lib/cjs/entities/marketV1/index.d.ts +0 -1
- package/lib/esm/client/morphoClient.d.ts +0 -152
- package/lib/esm/client/morphoClient.js +0 -158
- package/lib/esm/entities/marketV1/index.d.ts +0 -1
- package/lib/esm/entities/marketV1/index.js +0 -1
- /package/lib/cjs/actions/{marketV1 → blue}/index.d.ts +0 -0
- /package/lib/cjs/actions/{marketV1 → blue}/index.js +0 -0
- /package/lib/esm/actions/{marketV1 → blue}/index.d.ts +0 -0
- /package/lib/esm/actions/{marketV1 → blue}/index.js +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSupplyTargetUtilization = void 0;
|
|
4
|
+
const constant_js_1 = require("./constant.js");
|
|
5
|
+
/**
|
|
6
|
+
* Resolves the effective supply target utilization for a market: the per-market
|
|
7
|
+
* override, then the global default override, then
|
|
8
|
+
* {@link DEFAULT_SUPPLY_TARGET_UTILIZATION}.
|
|
9
|
+
*
|
|
10
|
+
* @param marketId - The market whose supply target utilization to resolve.
|
|
11
|
+
* @param options - Reallocation options carrying the per-market and default overrides.
|
|
12
|
+
* @returns The supply target utilization, scaled by WAD.
|
|
13
|
+
*/
|
|
14
|
+
const getSupplyTargetUtilization = (marketId, options) => options?.supplyTargetUtilization?.[marketId] ??
|
|
15
|
+
options?.defaultSupplyTargetUtilization ??
|
|
16
|
+
constant_js_1.DEFAULT_SUPPLY_TARGET_UTILIZATION;
|
|
17
|
+
exports.getSupplyTargetUtilization = getSupplyTargetUtilization;
|
|
@@ -122,8 +122,8 @@ export declare const validateRepayShares: (params: {
|
|
|
122
122
|
marketId: MarketId;
|
|
123
123
|
}) => void;
|
|
124
124
|
/**
|
|
125
|
-
* Validates the common repay input parameters shared by `
|
|
126
|
-
* and `
|
|
125
|
+
* Validates the common repay input parameters shared by `blueRepay`
|
|
126
|
+
* and `blueRepayWithdrawCollateral`.
|
|
127
127
|
*
|
|
128
128
|
* @param params - Validation parameters.
|
|
129
129
|
* @param params.assets - Repay assets amount (0n when repaying by shares).
|
|
@@ -212,8 +212,8 @@ const validateRepayShares = (params) => {
|
|
|
212
212
|
};
|
|
213
213
|
exports.validateRepayShares = validateRepayShares;
|
|
214
214
|
/**
|
|
215
|
-
* Validates the common repay input parameters shared by `
|
|
216
|
-
* and `
|
|
215
|
+
* Validates the common repay input parameters shared by `blueRepay`
|
|
216
|
+
* and `blueRepayWithdrawCollateral`.
|
|
217
217
|
*
|
|
218
218
|
* @param params - Validation parameters.
|
|
219
219
|
* @param params.assets - Repay assets amount (0n when repaying by shares).
|
|
@@ -81,7 +81,7 @@ export interface VaultV1MigrateToV2Action extends BaseAction<"vaultV1MigrateToV2
|
|
|
81
81
|
recipient: Address;
|
|
82
82
|
}> {
|
|
83
83
|
}
|
|
84
|
-
export interface
|
|
84
|
+
export interface BlueSupplyAction extends BaseAction<"blueSupply", {
|
|
85
85
|
market: Hex;
|
|
86
86
|
amount: bigint;
|
|
87
87
|
onBehalf: Address;
|
|
@@ -89,7 +89,7 @@ export interface MarketV1SupplyAction extends BaseAction<"marketV1Supply", {
|
|
|
89
89
|
nativeAmount?: bigint;
|
|
90
90
|
}> {
|
|
91
91
|
}
|
|
92
|
-
export interface
|
|
92
|
+
export interface BlueWithdrawAction extends BaseAction<"blueWithdraw", {
|
|
93
93
|
market: Hex;
|
|
94
94
|
assets: bigint;
|
|
95
95
|
shares: bigint;
|
|
@@ -98,14 +98,14 @@ export interface MarketV1WithdrawAction extends BaseAction<"marketV1Withdraw", {
|
|
|
98
98
|
reallocationFee: bigint;
|
|
99
99
|
}> {
|
|
100
100
|
}
|
|
101
|
-
export interface
|
|
101
|
+
export interface BlueSupplyCollateralAction extends BaseAction<"blueSupplyCollateral", {
|
|
102
102
|
market: Hex;
|
|
103
103
|
amount: bigint;
|
|
104
104
|
onBehalf: Address;
|
|
105
105
|
nativeAmount?: bigint;
|
|
106
106
|
}> {
|
|
107
107
|
}
|
|
108
|
-
export interface
|
|
108
|
+
export interface BlueBorrowAction extends BaseAction<"blueBorrow", {
|
|
109
109
|
market: Hex;
|
|
110
110
|
amount: bigint;
|
|
111
111
|
receiver: Address;
|
|
@@ -113,7 +113,7 @@ export interface MarketV1BorrowAction extends BaseAction<"marketV1Borrow", {
|
|
|
113
113
|
reallocationFee: bigint;
|
|
114
114
|
}> {
|
|
115
115
|
}
|
|
116
|
-
export interface
|
|
116
|
+
export interface BlueSupplyCollateralBorrowAction extends BaseAction<"blueSupplyCollateralBorrow", {
|
|
117
117
|
market: Hex;
|
|
118
118
|
collateralAmount: bigint;
|
|
119
119
|
borrowAmount: bigint;
|
|
@@ -124,7 +124,7 @@ export interface MarketV1SupplyCollateralBorrowAction extends BaseAction<"market
|
|
|
124
124
|
reallocationFee: bigint;
|
|
125
125
|
}> {
|
|
126
126
|
}
|
|
127
|
-
export interface
|
|
127
|
+
export interface BlueRepayAction extends BaseAction<"blueRepay", {
|
|
128
128
|
market: Hex;
|
|
129
129
|
assets: bigint;
|
|
130
130
|
shares: bigint;
|
|
@@ -134,14 +134,14 @@ export interface MarketV1RepayAction extends BaseAction<"marketV1Repay", {
|
|
|
134
134
|
maxSharePrice: bigint;
|
|
135
135
|
}> {
|
|
136
136
|
}
|
|
137
|
-
export interface
|
|
137
|
+
export interface BlueWithdrawCollateralAction extends BaseAction<"blueWithdrawCollateral", {
|
|
138
138
|
market: Hex;
|
|
139
139
|
amount: bigint;
|
|
140
140
|
onBehalf: Address;
|
|
141
141
|
receiver: Address;
|
|
142
142
|
}> {
|
|
143
143
|
}
|
|
144
|
-
export interface
|
|
144
|
+
export interface BlueRepayWithdrawCollateralAction extends BaseAction<"blueRepayWithdrawCollateral", {
|
|
145
145
|
market: Hex;
|
|
146
146
|
repayAssets: bigint;
|
|
147
147
|
repayShares: bigint;
|
|
@@ -152,7 +152,7 @@ export interface MarketV1RepayWithdrawCollateralAction extends BaseAction<"marke
|
|
|
152
152
|
receiver: Address;
|
|
153
153
|
}> {
|
|
154
154
|
}
|
|
155
|
-
export interface
|
|
155
|
+
export interface BlueRefinanceAction extends BaseAction<"blueRefinance", {
|
|
156
156
|
readonly sourceMarket: Hex;
|
|
157
157
|
readonly targetMarket: Hex;
|
|
158
158
|
readonly collateralAmount: bigint;
|
|
@@ -185,7 +185,7 @@ export interface MorphoAuthorizationAction extends BaseAction<"morphoAuthorizati
|
|
|
185
185
|
isAuthorized: boolean;
|
|
186
186
|
}> {
|
|
187
187
|
}
|
|
188
|
-
export type TransactionAction = ERC20ApprovalAction | VaultV2DepositAction | VaultV2WithdrawAction | VaultV2RedeemAction | VaultV2ForceWithdrawAction | VaultV2ForceRedeemAction | VaultV1DepositAction | VaultV1WithdrawAction | VaultV1RedeemAction | VaultV1MigrateToV2Action |
|
|
188
|
+
export type TransactionAction = ERC20ApprovalAction | VaultV2DepositAction | VaultV2WithdrawAction | VaultV2RedeemAction | VaultV2ForceWithdrawAction | VaultV2ForceRedeemAction | VaultV1DepositAction | VaultV1WithdrawAction | VaultV1RedeemAction | VaultV1MigrateToV2Action | BlueSupplyAction | BlueWithdrawAction | BlueSupplyCollateralAction | BlueBorrowAction | BlueSupplyCollateralBorrowAction | BlueRepayAction | BlueWithdrawCollateralAction | BlueRepayWithdrawCollateralAction | BlueRefinanceAction | MorphoAuthorizationAction;
|
|
189
189
|
export interface Transaction<TAction extends BaseAction = TransactionAction> {
|
|
190
190
|
readonly to: Address;
|
|
191
191
|
readonly value: bigint;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { MarketParams } from "@morpho-org/blue-sdk";
|
|
2
2
|
import type { Address, Client } from "viem";
|
|
3
|
-
import type {
|
|
3
|
+
import type { BlueActions, VaultV1Actions, VaultV2Actions } from "../actions/index.js";
|
|
4
4
|
import type { Metadata } from "./index.js";
|
|
5
5
|
/**
|
|
6
|
-
* Structural contract
|
|
7
|
-
*
|
|
6
|
+
* Structural contract the `morpho` namespace satisfies — the object exposed under `client.morpho`
|
|
7
|
+
* once a viem client is extended with {@link morphoViemExtension}. Carries the viem client, the
|
|
8
|
+
* resolved options bag, and the three entity-factory methods the SDK exposes.
|
|
8
9
|
*/
|
|
9
10
|
export interface MorphoClientType {
|
|
10
11
|
readonly viemClient: Client;
|
|
@@ -15,5 +16,5 @@ export interface MorphoClientType {
|
|
|
15
16
|
};
|
|
16
17
|
vaultV1: (vault: Address, chainId: number) => VaultV1Actions;
|
|
17
18
|
vaultV2: (vault: Address, chainId: number) => VaultV2Actions;
|
|
18
|
-
|
|
19
|
+
blue: (marketParams: MarketParams, chainId: number) => BlueActions;
|
|
19
20
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { MarketParams } from "@morpho-org/blue-sdk";
|
|
2
2
|
import type { Address } from "viem";
|
|
3
|
-
import { type
|
|
4
|
-
/** Parameters for {@link
|
|
5
|
-
export interface
|
|
3
|
+
import { type BlueBorrowAction, type Metadata, type Transaction, type VaultReallocation } from "../../types/index.js";
|
|
4
|
+
/** Parameters for {@link blueBorrow}. */
|
|
5
|
+
export interface BlueBorrowParams {
|
|
6
6
|
market: {
|
|
7
7
|
readonly chainId: number;
|
|
8
8
|
readonly marketParams: MarketParams;
|
|
@@ -36,7 +36,7 @@ export interface MarketV1BorrowParams {
|
|
|
36
36
|
* @param params.args.reallocations - Optional vault reallocations to execute before borrowing,
|
|
37
37
|
* computed by the entity layer.
|
|
38
38
|
* @param params.metadata - Optional analytics metadata attached to the bundle.
|
|
39
|
-
* @returns A deep-frozen `Transaction<
|
|
39
|
+
* @returns A deep-frozen `Transaction<BlueBorrowAction>` with `to`, `value`, `data`, and the
|
|
40
40
|
* typed `action` discriminator the simulation layer consumes.
|
|
41
41
|
* @throws {NonPositiveBorrowAmountError} when `amount <= 0n`.
|
|
42
42
|
* @throws {NonPositiveMinBorrowSharePriceError} when `minSharePrice < 0n` (negative; zero is
|
|
@@ -53,9 +53,9 @@ export interface MarketV1BorrowParams {
|
|
|
53
53
|
* reallocation withdrawals are not strictly sorted by market id.
|
|
54
54
|
* @example
|
|
55
55
|
* ```ts
|
|
56
|
-
* import {
|
|
56
|
+
* import { blueBorrow } from "@morpho-org/morpho-sdk";
|
|
57
57
|
*
|
|
58
|
-
* const tx =
|
|
58
|
+
* const tx = blueBorrow({
|
|
59
59
|
* market: { chainId: 1, marketParams },
|
|
60
60
|
* args: {
|
|
61
61
|
* amount: 1_000_000n,
|
|
@@ -63,7 +63,7 @@ export interface MarketV1BorrowParams {
|
|
|
63
63
|
* minSharePrice: 0n, // disables slippage protection — production code should compute via `computeMinBorrowSharePrice` from market state + slippage tolerance
|
|
64
64
|
* },
|
|
65
65
|
* });
|
|
66
|
-
* // tx satisfies Readonly<Transaction<
|
|
66
|
+
* // tx satisfies Readonly<Transaction<BlueBorrowAction>>
|
|
67
67
|
* ```
|
|
68
68
|
*/
|
|
69
|
-
export declare const
|
|
69
|
+
export declare const blueBorrow: ({ market: { chainId, marketParams }, args: { amount, receiver, minSharePrice, reallocations }, metadata, }: BlueBorrowParams) => Readonly<Transaction<BlueBorrowAction>>;
|
|
@@ -22,7 +22,7 @@ import { buildReallocationActions } from "./buildReallocationActions.js";
|
|
|
22
22
|
* @param params.args.reallocations - Optional vault reallocations to execute before borrowing,
|
|
23
23
|
* computed by the entity layer.
|
|
24
24
|
* @param params.metadata - Optional analytics metadata attached to the bundle.
|
|
25
|
-
* @returns A deep-frozen `Transaction<
|
|
25
|
+
* @returns A deep-frozen `Transaction<BlueBorrowAction>` with `to`, `value`, `data`, and the
|
|
26
26
|
* typed `action` discriminator the simulation layer consumes.
|
|
27
27
|
* @throws {NonPositiveBorrowAmountError} when `amount <= 0n`.
|
|
28
28
|
* @throws {NonPositiveMinBorrowSharePriceError} when `minSharePrice < 0n` (negative; zero is
|
|
@@ -39,9 +39,9 @@ import { buildReallocationActions } from "./buildReallocationActions.js";
|
|
|
39
39
|
* reallocation withdrawals are not strictly sorted by market id.
|
|
40
40
|
* @example
|
|
41
41
|
* ```ts
|
|
42
|
-
* import {
|
|
42
|
+
* import { blueBorrow } from "@morpho-org/morpho-sdk";
|
|
43
43
|
*
|
|
44
|
-
* const tx =
|
|
44
|
+
* const tx = blueBorrow({
|
|
45
45
|
* market: { chainId: 1, marketParams },
|
|
46
46
|
* args: {
|
|
47
47
|
* amount: 1_000_000n,
|
|
@@ -49,10 +49,10 @@ import { buildReallocationActions } from "./buildReallocationActions.js";
|
|
|
49
49
|
* minSharePrice: 0n, // disables slippage protection — production code should compute via `computeMinBorrowSharePrice` from market state + slippage tolerance
|
|
50
50
|
* },
|
|
51
51
|
* });
|
|
52
|
-
* // tx satisfies Readonly<Transaction<
|
|
52
|
+
* // tx satisfies Readonly<Transaction<BlueBorrowAction>>
|
|
53
53
|
* ```
|
|
54
54
|
*/
|
|
55
|
-
export const
|
|
55
|
+
export const blueBorrow = ({ market: { chainId, marketParams }, args: { amount, receiver, minSharePrice, reallocations }, metadata, }) => {
|
|
56
56
|
if (amount <= 0n) {
|
|
57
57
|
throw new NonPositiveBorrowAmountError(marketParams.id);
|
|
58
58
|
}
|
|
@@ -77,7 +77,7 @@ export const marketV1Borrow = ({ market: { chainId, marketParams }, args: { amou
|
|
|
77
77
|
return deepFreeze({
|
|
78
78
|
...tx,
|
|
79
79
|
action: {
|
|
80
|
-
type: "
|
|
80
|
+
type: "blueBorrow",
|
|
81
81
|
args: {
|
|
82
82
|
market: marketParams.id,
|
|
83
83
|
amount,
|
|
@@ -7,7 +7,7 @@ import type { VaultReallocation } from "../../types/index.js";
|
|
|
7
7
|
* Validates the reallocations, then encodes each as a `reallocateTo` action against the target
|
|
8
8
|
* market. Returns `{ actions: [], fee: 0n }` for an empty input — callers gate on
|
|
9
9
|
* `reallocations.length > 0` and skip the call entirely in that case. Internal helper —
|
|
10
|
-
* consumed only by `
|
|
10
|
+
* consumed only by `blueBorrow` and `blueSupplyCollateralBorrow`; not re-exported on the
|
|
11
11
|
* public surface.
|
|
12
12
|
*
|
|
13
13
|
* @param reallocations - The vault reallocations to encode.
|
|
@@ -5,7 +5,7 @@ import { validateReallocations } from "../../helpers/index.js";
|
|
|
5
5
|
* Validates the reallocations, then encodes each as a `reallocateTo` action against the target
|
|
6
6
|
* market. Returns `{ actions: [], fee: 0n }` for an empty input — callers gate on
|
|
7
7
|
* `reallocations.length > 0` and skip the call entirely in that case. Internal helper —
|
|
8
|
-
* consumed only by `
|
|
8
|
+
* consumed only by `blueBorrow` and `blueSupplyCollateralBorrow`; not re-exported on the
|
|
9
9
|
* public surface.
|
|
10
10
|
*
|
|
11
11
|
* @param reallocations - The vault reallocations to encode.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type MarketParams } from "@morpho-org/blue-sdk";
|
|
2
2
|
import { type Address } from "viem";
|
|
3
|
-
import { type
|
|
4
|
-
/** Parameters for {@link
|
|
5
|
-
export interface
|
|
3
|
+
import { type BlueRefinanceAction, type Metadata, type Transaction, type VaultReallocation } from "../../types/index.js";
|
|
4
|
+
/** Parameters for {@link blueRefinance}. */
|
|
5
|
+
export interface BlueRefinanceParams {
|
|
6
6
|
source: {
|
|
7
7
|
readonly chainId: number;
|
|
8
8
|
readonly marketParams: MarketParams;
|
|
@@ -78,7 +78,7 @@ export interface MarketV1RefinanceParams {
|
|
|
78
78
|
* @param params.args.maxRepaySharePrice - Maximum repay share price (ray) on the source.
|
|
79
79
|
* @param params.args.targetReallocations - PublicAllocator reallocations into the target, run before the supply leg.
|
|
80
80
|
* @param params.metadata - Optional analytics metadata appended to `tx.data`.
|
|
81
|
-
* @returns A deep-frozen `Transaction<
|
|
81
|
+
* @returns A deep-frozen `Transaction<BlueRefinanceAction>`.
|
|
82
82
|
* @remarks `borrowAssets` and `borrowShares` describe different markets (target borrow vs. source
|
|
83
83
|
* repay); in shares mode the entity passes both. Caller-facing mutual exclusivity is enforced at the entity layer.
|
|
84
84
|
* @throws {ZeroCollateralAmountError} when `collateralAmount <= 0n`.
|
|
@@ -97,9 +97,9 @@ export interface MarketV1RefinanceParams {
|
|
|
97
97
|
* @throws {UnsortedReallocationWithdrawalsError} when reallocation withdrawals are not strictly sorted by market id.
|
|
98
98
|
* @example
|
|
99
99
|
* ```ts
|
|
100
|
-
* import {
|
|
100
|
+
* import { blueRefinance } from "@morpho-org/morpho-sdk";
|
|
101
101
|
*
|
|
102
|
-
* const tx =
|
|
102
|
+
* const tx = blueRefinance({
|
|
103
103
|
* source: { chainId: 1, marketParams: sourceParams },
|
|
104
104
|
* target: { marketParams: targetParams },
|
|
105
105
|
* args: {
|
|
@@ -111,7 +111,7 @@ export interface MarketV1RefinanceParams {
|
|
|
111
111
|
* maxRepaySharePrice: 1_500_000_000_000_000_000_000_000_000n,
|
|
112
112
|
* },
|
|
113
113
|
* });
|
|
114
|
-
* // tx satisfies Readonly<Transaction<
|
|
114
|
+
* // tx satisfies Readonly<Transaction<BlueRefinanceAction>>
|
|
115
115
|
* ```
|
|
116
116
|
*/
|
|
117
|
-
export declare const
|
|
117
|
+
export declare const blueRefinance: ({ source: { chainId, marketParams: sourceParams }, target: { marketParams: targetParams }, args: { user, collateralAmount, borrowAssets, borrowShares, minBorrowSharePrice, maxRepaySharePrice, targetReallocations, }, metadata, }: BlueRefinanceParams) => Readonly<Transaction<BlueRefinanceAction>>;
|
|
@@ -53,7 +53,7 @@ import { buildReallocationActions } from "./buildReallocationActions.js";
|
|
|
53
53
|
* @param params.args.maxRepaySharePrice - Maximum repay share price (ray) on the source.
|
|
54
54
|
* @param params.args.targetReallocations - PublicAllocator reallocations into the target, run before the supply leg.
|
|
55
55
|
* @param params.metadata - Optional analytics metadata appended to `tx.data`.
|
|
56
|
-
* @returns A deep-frozen `Transaction<
|
|
56
|
+
* @returns A deep-frozen `Transaction<BlueRefinanceAction>`.
|
|
57
57
|
* @remarks `borrowAssets` and `borrowShares` describe different markets (target borrow vs. source
|
|
58
58
|
* repay); in shares mode the entity passes both. Caller-facing mutual exclusivity is enforced at the entity layer.
|
|
59
59
|
* @throws {ZeroCollateralAmountError} when `collateralAmount <= 0n`.
|
|
@@ -72,9 +72,9 @@ import { buildReallocationActions } from "./buildReallocationActions.js";
|
|
|
72
72
|
* @throws {UnsortedReallocationWithdrawalsError} when reallocation withdrawals are not strictly sorted by market id.
|
|
73
73
|
* @example
|
|
74
74
|
* ```ts
|
|
75
|
-
* import {
|
|
75
|
+
* import { blueRefinance } from "@morpho-org/morpho-sdk";
|
|
76
76
|
*
|
|
77
|
-
* const tx =
|
|
77
|
+
* const tx = blueRefinance({
|
|
78
78
|
* source: { chainId: 1, marketParams: sourceParams },
|
|
79
79
|
* target: { marketParams: targetParams },
|
|
80
80
|
* args: {
|
|
@@ -86,10 +86,10 @@ import { buildReallocationActions } from "./buildReallocationActions.js";
|
|
|
86
86
|
* maxRepaySharePrice: 1_500_000_000_000_000_000_000_000_000n,
|
|
87
87
|
* },
|
|
88
88
|
* });
|
|
89
|
-
* // tx satisfies Readonly<Transaction<
|
|
89
|
+
* // tx satisfies Readonly<Transaction<BlueRefinanceAction>>
|
|
90
90
|
* ```
|
|
91
91
|
*/
|
|
92
|
-
export const
|
|
92
|
+
export const blueRefinance = ({ source: { chainId, marketParams: sourceParams }, target: { marketParams: targetParams }, args: { user, collateralAmount, borrowAssets = 0n, borrowShares = 0n, minBorrowSharePrice, maxRepaySharePrice, targetReallocations, }, metadata, }) => {
|
|
93
93
|
if (collateralAmount <= 0n) {
|
|
94
94
|
throw new ZeroCollateralAmountError(sourceParams.id);
|
|
95
95
|
}
|
|
@@ -197,7 +197,7 @@ export const marketV1Refinance = ({ source: { chainId, marketParams: sourceParam
|
|
|
197
197
|
return deepFreeze({
|
|
198
198
|
...tx,
|
|
199
199
|
action: {
|
|
200
|
-
type: "
|
|
200
|
+
type: "blueRefinance",
|
|
201
201
|
args: {
|
|
202
202
|
sourceMarket: sourceParams.id,
|
|
203
203
|
targetMarket: targetParams.id,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type MarketParams } from "@morpho-org/blue-sdk";
|
|
2
2
|
import { type Address } from "viem";
|
|
3
|
-
import type {
|
|
4
|
-
/** Parameters for {@link
|
|
5
|
-
export interface
|
|
3
|
+
import type { BlueRepayAction, Metadata, RequirementSignature, Transaction } from "../../types/index.js";
|
|
4
|
+
/** Parameters for {@link blueRepay}. */
|
|
5
|
+
export interface BlueRepayParams {
|
|
6
6
|
market: {
|
|
7
7
|
readonly chainId: number;
|
|
8
8
|
readonly marketParams: MarketParams;
|
|
@@ -56,7 +56,7 @@ export interface MarketV1RepayParams {
|
|
|
56
56
|
* @param params.args.requirementSignature - Optional pre-signed permit/permit2 approval for the
|
|
57
57
|
* loan-token transfer.
|
|
58
58
|
* @param params.metadata - Optional analytics metadata attached to the bundle.
|
|
59
|
-
* @returns A deep-frozen `Transaction<
|
|
59
|
+
* @returns A deep-frozen `Transaction<BlueRepayAction>` with `to`, `value`, `data`, and the
|
|
60
60
|
* typed `action` discriminator the simulation layer consumes.
|
|
61
61
|
* @throws {NonPositiveRepayMaxSharePriceError} when `maxSharePrice <= 0n`.
|
|
62
62
|
* @throws {NonPositiveRepayAmountError} when either `assets` or `shares` is negative, or when
|
|
@@ -72,9 +72,9 @@ export interface MarketV1RepayParams {
|
|
|
72
72
|
* signature is missing its expiration.
|
|
73
73
|
* @example
|
|
74
74
|
* ```ts
|
|
75
|
-
* import {
|
|
75
|
+
* import { blueRepay } from "@morpho-org/morpho-sdk";
|
|
76
76
|
*
|
|
77
|
-
* const tx =
|
|
77
|
+
* const tx = blueRepay({
|
|
78
78
|
* market: { chainId: 1, marketParams },
|
|
79
79
|
* args: {
|
|
80
80
|
* assets: 500_000_000n,
|
|
@@ -85,7 +85,7 @@ export interface MarketV1RepayParams {
|
|
|
85
85
|
* maxSharePrice: 1_010_000_000_000_000_000_000_000_000n, // RAY-scaled, 1.01x
|
|
86
86
|
* },
|
|
87
87
|
* });
|
|
88
|
-
* // tx satisfies Readonly<Transaction<
|
|
88
|
+
* // tx satisfies Readonly<Transaction<BlueRepayAction>>
|
|
89
89
|
* ```
|
|
90
90
|
*/
|
|
91
|
-
export declare const
|
|
91
|
+
export declare const blueRepay: ({ market: { chainId, marketParams }, args: { assets, shares, transferAmount, onBehalf, receiver, maxSharePrice, requirementSignature, }, metadata, }: BlueRepayParams) => Readonly<Transaction<BlueRepayAction>>;
|
|
@@ -32,7 +32,7 @@ import { getRequirementsAction } from "../requirements/getRequirementsAction.js"
|
|
|
32
32
|
* @param params.args.requirementSignature - Optional pre-signed permit/permit2 approval for the
|
|
33
33
|
* loan-token transfer.
|
|
34
34
|
* @param params.metadata - Optional analytics metadata attached to the bundle.
|
|
35
|
-
* @returns A deep-frozen `Transaction<
|
|
35
|
+
* @returns A deep-frozen `Transaction<BlueRepayAction>` with `to`, `value`, `data`, and the
|
|
36
36
|
* typed `action` discriminator the simulation layer consumes.
|
|
37
37
|
* @throws {NonPositiveRepayMaxSharePriceError} when `maxSharePrice <= 0n`.
|
|
38
38
|
* @throws {NonPositiveRepayAmountError} when either `assets` or `shares` is negative, or when
|
|
@@ -48,9 +48,9 @@ import { getRequirementsAction } from "../requirements/getRequirementsAction.js"
|
|
|
48
48
|
* signature is missing its expiration.
|
|
49
49
|
* @example
|
|
50
50
|
* ```ts
|
|
51
|
-
* import {
|
|
51
|
+
* import { blueRepay } from "@morpho-org/morpho-sdk";
|
|
52
52
|
*
|
|
53
|
-
* const tx =
|
|
53
|
+
* const tx = blueRepay({
|
|
54
54
|
* market: { chainId: 1, marketParams },
|
|
55
55
|
* args: {
|
|
56
56
|
* assets: 500_000_000n,
|
|
@@ -61,10 +61,10 @@ import { getRequirementsAction } from "../requirements/getRequirementsAction.js"
|
|
|
61
61
|
* maxSharePrice: 1_010_000_000_000_000_000_000_000_000n, // RAY-scaled, 1.01x
|
|
62
62
|
* },
|
|
63
63
|
* });
|
|
64
|
-
* // tx satisfies Readonly<Transaction<
|
|
64
|
+
* // tx satisfies Readonly<Transaction<BlueRepayAction>>
|
|
65
65
|
* ```
|
|
66
66
|
*/
|
|
67
|
-
export const
|
|
67
|
+
export const blueRepay = ({ market: { chainId, marketParams }, args: { assets, shares, transferAmount, onBehalf, receiver, maxSharePrice, requirementSignature, }, metadata, }) => {
|
|
68
68
|
validateRepayParams({
|
|
69
69
|
assets,
|
|
70
70
|
shares,
|
|
@@ -114,7 +114,7 @@ export const marketV1Repay = ({ market: { chainId, marketParams }, args: { asset
|
|
|
114
114
|
return deepFreeze({
|
|
115
115
|
...tx,
|
|
116
116
|
action: {
|
|
117
|
-
type: "
|
|
117
|
+
type: "blueRepay",
|
|
118
118
|
args: {
|
|
119
119
|
market: marketParams.id,
|
|
120
120
|
assets,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type MarketParams } from "@morpho-org/blue-sdk";
|
|
2
2
|
import { type Address } from "viem";
|
|
3
|
-
import { type
|
|
4
|
-
/** Parameters for {@link
|
|
5
|
-
export interface
|
|
3
|
+
import { type BlueRepayWithdrawCollateralAction, type Metadata, type RequirementSignature, type Transaction } from "../../types/index.js";
|
|
4
|
+
/** Parameters for {@link blueRepayWithdrawCollateral}. */
|
|
5
|
+
export interface BlueRepayWithdrawCollateralParams {
|
|
6
6
|
market: {
|
|
7
7
|
readonly chainId: number;
|
|
8
8
|
readonly marketParams: MarketParams;
|
|
@@ -68,7 +68,7 @@ export interface MarketV1RepayWithdrawCollateralParams {
|
|
|
68
68
|
* @param params.args.requirementSignature - Optional pre-signed permit/permit2 approval for the
|
|
69
69
|
* loan-token transfer.
|
|
70
70
|
* @param params.metadata - Optional analytics metadata attached to the bundle.
|
|
71
|
-
* @returns A deep-frozen `Transaction<
|
|
71
|
+
* @returns A deep-frozen `Transaction<BlueRepayWithdrawCollateralAction>` with `to`,
|
|
72
72
|
* `value`, `data`, and the typed `action` discriminator the simulation layer consumes.
|
|
73
73
|
* @throws {NonPositiveRepayMaxSharePriceError} when `maxSharePrice <= 0n`.
|
|
74
74
|
* @throws {NonPositiveRepayAmountError} when either `assets` or `shares` is negative, or when
|
|
@@ -85,9 +85,9 @@ export interface MarketV1RepayWithdrawCollateralParams {
|
|
|
85
85
|
* signature is missing its expiration.
|
|
86
86
|
* @example
|
|
87
87
|
* ```ts
|
|
88
|
-
* import {
|
|
88
|
+
* import { blueRepayWithdrawCollateral } from "@morpho-org/morpho-sdk";
|
|
89
89
|
*
|
|
90
|
-
* const tx =
|
|
90
|
+
* const tx = blueRepayWithdrawCollateral({
|
|
91
91
|
* market: { chainId: 1, marketParams },
|
|
92
92
|
* args: {
|
|
93
93
|
* assets: 500_000_000n,
|
|
@@ -99,7 +99,7 @@ export interface MarketV1RepayWithdrawCollateralParams {
|
|
|
99
99
|
* maxSharePrice: 1_010_000_000_000_000_000_000_000_000n, // RAY-scaled, 1.01x
|
|
100
100
|
* },
|
|
101
101
|
* });
|
|
102
|
-
* // tx satisfies Readonly<Transaction<
|
|
102
|
+
* // tx satisfies Readonly<Transaction<BlueRepayWithdrawCollateralAction>>
|
|
103
103
|
* ```
|
|
104
104
|
*/
|
|
105
|
-
export declare const
|
|
105
|
+
export declare const blueRepayWithdrawCollateral: ({ market: { chainId, marketParams }, args: { assets, shares, transferAmount, withdrawAmount, onBehalf, receiver, maxSharePrice, requirementSignature, }, metadata, }: BlueRepayWithdrawCollateralParams) => Readonly<Transaction<BlueRepayWithdrawCollateralAction>>;
|
|
@@ -42,7 +42,7 @@ import { getRequirementsAction } from "../requirements/getRequirementsAction.js"
|
|
|
42
42
|
* @param params.args.requirementSignature - Optional pre-signed permit/permit2 approval for the
|
|
43
43
|
* loan-token transfer.
|
|
44
44
|
* @param params.metadata - Optional analytics metadata attached to the bundle.
|
|
45
|
-
* @returns A deep-frozen `Transaction<
|
|
45
|
+
* @returns A deep-frozen `Transaction<BlueRepayWithdrawCollateralAction>` with `to`,
|
|
46
46
|
* `value`, `data`, and the typed `action` discriminator the simulation layer consumes.
|
|
47
47
|
* @throws {NonPositiveRepayMaxSharePriceError} when `maxSharePrice <= 0n`.
|
|
48
48
|
* @throws {NonPositiveRepayAmountError} when either `assets` or `shares` is negative, or when
|
|
@@ -59,9 +59,9 @@ import { getRequirementsAction } from "../requirements/getRequirementsAction.js"
|
|
|
59
59
|
* signature is missing its expiration.
|
|
60
60
|
* @example
|
|
61
61
|
* ```ts
|
|
62
|
-
* import {
|
|
62
|
+
* import { blueRepayWithdrawCollateral } from "@morpho-org/morpho-sdk";
|
|
63
63
|
*
|
|
64
|
-
* const tx =
|
|
64
|
+
* const tx = blueRepayWithdrawCollateral({
|
|
65
65
|
* market: { chainId: 1, marketParams },
|
|
66
66
|
* args: {
|
|
67
67
|
* assets: 500_000_000n,
|
|
@@ -73,10 +73,10 @@ import { getRequirementsAction } from "../requirements/getRequirementsAction.js"
|
|
|
73
73
|
* maxSharePrice: 1_010_000_000_000_000_000_000_000_000n, // RAY-scaled, 1.01x
|
|
74
74
|
* },
|
|
75
75
|
* });
|
|
76
|
-
* // tx satisfies Readonly<Transaction<
|
|
76
|
+
* // tx satisfies Readonly<Transaction<BlueRepayWithdrawCollateralAction>>
|
|
77
77
|
* ```
|
|
78
78
|
*/
|
|
79
|
-
export const
|
|
79
|
+
export const blueRepayWithdrawCollateral = ({ market: { chainId, marketParams }, args: { assets, shares, transferAmount, withdrawAmount, onBehalf, receiver, maxSharePrice, requirementSignature, }, metadata, }) => {
|
|
80
80
|
validateRepayParams({
|
|
81
81
|
assets,
|
|
82
82
|
shares,
|
|
@@ -134,7 +134,7 @@ export const marketV1RepayWithdrawCollateral = ({ market: { chainId, marketParam
|
|
|
134
134
|
return deepFreeze({
|
|
135
135
|
...tx,
|
|
136
136
|
action: {
|
|
137
|
-
type: "
|
|
137
|
+
type: "blueRepayWithdrawCollateral",
|
|
138
138
|
args: {
|
|
139
139
|
market: marketParams.id,
|
|
140
140
|
repayAssets: assets,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type MarketParams } from "@morpho-org/blue-sdk";
|
|
2
2
|
import type { Address } from "viem";
|
|
3
|
-
import { type
|
|
4
|
-
/** Parameters for {@link
|
|
5
|
-
export interface
|
|
3
|
+
import { type BlueSupplyAction, type DepositAmountArgs, type Metadata, type RequirementSignature, type Transaction } from "../../types/index.js";
|
|
4
|
+
/** Parameters for {@link blueSupply}. */
|
|
5
|
+
export interface BlueSupplyParams {
|
|
6
6
|
market: {
|
|
7
7
|
readonly chainId: number;
|
|
8
8
|
readonly marketParams: MarketParams;
|
|
@@ -38,7 +38,7 @@ export interface MarketV1SupplyParams {
|
|
|
38
38
|
* absent, the bundle uses a plain `erc20TransferFrom` and assumes the user has already
|
|
39
39
|
* approved `GeneralAdapter1`.
|
|
40
40
|
* @param params.metadata - Optional analytics metadata attached to the bundle.
|
|
41
|
-
* @returns A deep-frozen `Transaction<
|
|
41
|
+
* @returns A deep-frozen `Transaction<BlueSupplyAction>` with `to`, `value`, `data`, and the
|
|
42
42
|
* typed `action` discriminator the simulation layer consumes.
|
|
43
43
|
* @throws {NegativeSupplyAmountError} when `amount < 0n`.
|
|
44
44
|
* @throws {NegativeNativeAmountError} when `nativeAmount < 0n`.
|
|
@@ -53,9 +53,9 @@ export interface MarketV1SupplyParams {
|
|
|
53
53
|
* is provided and the signed amount differs from `args.amount`.
|
|
54
54
|
* @example
|
|
55
55
|
* ```ts
|
|
56
|
-
* import {
|
|
56
|
+
* import { blueSupply } from "@morpho-org/morpho-sdk";
|
|
57
57
|
*
|
|
58
|
-
* const tx =
|
|
58
|
+
* const tx = blueSupply({
|
|
59
59
|
* market: { chainId: 1, marketParams },
|
|
60
60
|
* args: {
|
|
61
61
|
* amount: 1_000_000_000n,
|
|
@@ -63,7 +63,7 @@ export interface MarketV1SupplyParams {
|
|
|
63
63
|
* maxSharePrice: 1_010_000_000_000_000_000_000_000_000n, // RAY-scaled, 1.01x
|
|
64
64
|
* },
|
|
65
65
|
* });
|
|
66
|
-
* // tx satisfies Readonly<Transaction<
|
|
66
|
+
* // tx satisfies Readonly<Transaction<BlueSupplyAction>>
|
|
67
67
|
* ```
|
|
68
68
|
*/
|
|
69
|
-
export declare const
|
|
69
|
+
export declare const blueSupply: ({ market: { chainId, marketParams }, args: { amount, onBehalf, maxSharePrice, requirementSignature, nativeAmount, }, metadata, }: BlueSupplyParams) => Readonly<Transaction<BlueSupplyAction>>;
|
|
@@ -27,7 +27,7 @@ import { getRequirementsAction } from "../requirements/getRequirementsAction.js"
|
|
|
27
27
|
* absent, the bundle uses a plain `erc20TransferFrom` and assumes the user has already
|
|
28
28
|
* approved `GeneralAdapter1`.
|
|
29
29
|
* @param params.metadata - Optional analytics metadata attached to the bundle.
|
|
30
|
-
* @returns A deep-frozen `Transaction<
|
|
30
|
+
* @returns A deep-frozen `Transaction<BlueSupplyAction>` with `to`, `value`, `data`, and the
|
|
31
31
|
* typed `action` discriminator the simulation layer consumes.
|
|
32
32
|
* @throws {NegativeSupplyAmountError} when `amount < 0n`.
|
|
33
33
|
* @throws {NegativeNativeAmountError} when `nativeAmount < 0n`.
|
|
@@ -42,9 +42,9 @@ import { getRequirementsAction } from "../requirements/getRequirementsAction.js"
|
|
|
42
42
|
* is provided and the signed amount differs from `args.amount`.
|
|
43
43
|
* @example
|
|
44
44
|
* ```ts
|
|
45
|
-
* import {
|
|
45
|
+
* import { blueSupply } from "@morpho-org/morpho-sdk";
|
|
46
46
|
*
|
|
47
|
-
* const tx =
|
|
47
|
+
* const tx = blueSupply({
|
|
48
48
|
* market: { chainId: 1, marketParams },
|
|
49
49
|
* args: {
|
|
50
50
|
* amount: 1_000_000_000n,
|
|
@@ -52,10 +52,10 @@ import { getRequirementsAction } from "../requirements/getRequirementsAction.js"
|
|
|
52
52
|
* maxSharePrice: 1_010_000_000_000_000_000_000_000_000n, // RAY-scaled, 1.01x
|
|
53
53
|
* },
|
|
54
54
|
* });
|
|
55
|
-
* // tx satisfies Readonly<Transaction<
|
|
55
|
+
* // tx satisfies Readonly<Transaction<BlueSupplyAction>>
|
|
56
56
|
* ```
|
|
57
57
|
*/
|
|
58
|
-
export const
|
|
58
|
+
export const blueSupply = ({ market: { chainId, marketParams }, args: { amount = 0n, onBehalf, maxSharePrice, requirementSignature, nativeAmount, }, metadata, }) => {
|
|
59
59
|
if (amount < 0n) {
|
|
60
60
|
throw new NegativeSupplyAmountError(marketParams.id);
|
|
61
61
|
}
|
|
@@ -111,7 +111,7 @@ export const marketV1Supply = ({ market: { chainId, marketParams }, args: { amou
|
|
|
111
111
|
return deepFreeze({
|
|
112
112
|
...tx,
|
|
113
113
|
action: {
|
|
114
|
-
type: "
|
|
114
|
+
type: "blueSupply",
|
|
115
115
|
args: {
|
|
116
116
|
market: marketParams.id,
|
|
117
117
|
amount: totalAssets,
|