@morpho-org/morpho-sdk 3.2.0 → 4.0.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 +1 -1
- package/lib/cjs/entities/reallocationData.js +1 -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 +1 -1
- 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 +1 -1
- package/lib/esm/entities/reallocationData.js +1 -1
- package/lib/esm/entities/vaultV2/vaultV2.js +1 -1
- package/lib/esm/helpers/computeReallocations.d.ts +1 -1
- package/lib/esm/helpers/computeReallocations.js +1 -1
- 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 +7 -7
- 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
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
> **The abstraction layer that simplifies Morpho protocol**
|
|
11
11
|
|
|
12
|
-
Build transactions for **VaultV1** (MetaMorpho), **VaultV2**, and **
|
|
12
|
+
Build transactions for **VaultV1** (MetaMorpho), **VaultV2**, and **Blue** (Morpho Blue) on EVM-compatible chains.
|
|
13
13
|
|
|
14
14
|
## Installation
|
|
15
15
|
|
|
@@ -31,7 +31,7 @@ pnpm add @morpho-org/morpho-sdk
|
|
|
31
31
|
| **VaultV1** | `deposit` | Bundler (general adapter) | Same ERC-4626 inflation attack prevention as V2. Supports native token wrapping. |
|
|
32
32
|
| | `withdraw` | Direct vault call | No attack surface |
|
|
33
33
|
| | `redeem` | Direct vault call | No attack surface |
|
|
34
|
-
| **
|
|
34
|
+
| **Blue** | `supply` | Bundler (general adapter) | `erc20TransferFrom` + `morphoSupply` with `maxSharePrice` (inflation guard). Supports native wrapping when `loanToken === wNative`. |
|
|
35
35
|
| | `supplyCollateral` | Bundler (general adapter) | `erc20TransferFrom` + `morphoSupplyCollateral`. Supports native wrapping. |
|
|
36
36
|
| | `borrow` | Bundler (general adapter) | `morphoBorrow` with `minSharePrice` slippage protection. Requires GA1 auth. Supports reallocations. |
|
|
37
37
|
| | `supplyCollateralBorrow` | Bundler (general adapter) | Atomic supply + borrow. LLTV buffer prevents instant liquidation. Supports reallocations. |
|
|
@@ -84,7 +84,7 @@ const tx = buildTx(permitSignature);
|
|
|
84
84
|
| | `withdraw` | Direct vault call | No attack surface |
|
|
85
85
|
| | `redeem` | Direct vault call | No attack surface |
|
|
86
86
|
| | `migrateToV2` | Bundler (general adapter) | Atomic V1 → V2 migration: redeem V1 shares + deposit into V2 in one tx. Slippage-protected. |
|
|
87
|
-
| **
|
|
87
|
+
| **Blue** | `supply` | Bundler (general adapter) | `erc20TransferFrom` + `morphoSupply` with `maxSharePrice` (inflation guard). Supports native wrapping when `loanToken === wNative`. |
|
|
88
88
|
| | `supplyCollateral` | Bundler (general adapter) | `erc20TransferFrom` + `morphoSupplyCollateral`. Supports native wrapping. |
|
|
89
89
|
| | `borrow` | Bundler (general adapter) | `morphoBorrow` with `minSharePrice` slippage protection. Requires GA1 auth. Supports reallocations. |
|
|
90
90
|
| | `supplyCollateralBorrow` | Bundler (general adapter) | Atomic supply + borrow. LLTV buffer prevents instant liquidation. Supports reallocations. |
|
|
@@ -243,10 +243,13 @@ const requirements = await getRequirements();
|
|
|
243
243
|
const tx = buildTx(requirementSignature);
|
|
244
244
|
```
|
|
245
245
|
|
|
246
|
-
###
|
|
246
|
+
### Blue
|
|
247
|
+
|
|
248
|
+
Blue (Morpho Blue) is Morpho's immutable, variable-rate lending primitive: isolated markets whose
|
|
249
|
+
borrow rate floats with utilization. Each market is identified by its `MarketParams`.
|
|
247
250
|
|
|
248
251
|
```typescript
|
|
249
|
-
const market = client.morpho.
|
|
252
|
+
const market = client.morpho.blue(
|
|
250
253
|
{
|
|
251
254
|
loanToken: "0xLoan...",
|
|
252
255
|
collateralToken: "0xCollateral...",
|
|
@@ -425,8 +428,8 @@ Atomically bundles repay → withdraw collateral via bundler3. Bundle order is c
|
|
|
425
428
|
Atomically migrate a position from this market to another Morpho Blue market that shares the **same loan and collateral tokens** on the same chain — no flash loan, no upfront capital. The bundle flash-collateralizes the target via its `onMorphoSupplyCollateral` callback: inside the callback `GeneralAdapter1` borrows on the target, repays the source debt, then withdraws the source collateral to settle the deferred transfer.
|
|
426
429
|
|
|
427
430
|
```typescript
|
|
428
|
-
const source = client.morpho.
|
|
429
|
-
const target = client.morpho.
|
|
431
|
+
const source = client.morpho.blue(sourceMarketParams, 1);
|
|
432
|
+
const target = client.morpho.blue(targetMarketParams, 1);
|
|
430
433
|
|
|
431
434
|
const positionData = await source.getPositionData("0xUser...");
|
|
432
435
|
const targetPositionData = await target.getPositionData("0xUser...");
|
|
@@ -518,7 +521,7 @@ graph LR
|
|
|
518
521
|
|
|
519
522
|
MC -->|.vaultV1| MV1
|
|
520
523
|
MC -->|.vaultV2| MV2
|
|
521
|
-
MC -->|.
|
|
524
|
+
MC -->|.blue| MM1
|
|
522
525
|
|
|
523
526
|
subgraph VaultV1 Flow
|
|
524
527
|
MV1[MorphoVaultV1]
|
|
@@ -548,14 +551,14 @@ graph LR
|
|
|
548
551
|
V2FR -->|multicall| V2C
|
|
549
552
|
end
|
|
550
553
|
|
|
551
|
-
subgraph
|
|
552
|
-
MM1[
|
|
553
|
-
MM1 --> M1S[
|
|
554
|
-
MM1 --> M1SC[
|
|
555
|
-
MM1 --> M1B[
|
|
556
|
-
MM1 --> M1SCB[
|
|
557
|
-
MM1 --> M1W[
|
|
558
|
-
MM1 --> M1RF[
|
|
554
|
+
subgraph Blue Flow
|
|
555
|
+
MM1[MorphoBlue]
|
|
556
|
+
MM1 --> M1S[blueSupply]
|
|
557
|
+
MM1 --> M1SC[blueSupplyCollateral]
|
|
558
|
+
MM1 --> M1B[blueBorrow]
|
|
559
|
+
MM1 --> M1SCB[blueSupplyCollateralBorrow]
|
|
560
|
+
MM1 --> M1W[blueWithdraw]
|
|
561
|
+
MM1 --> M1RF[blueRefinance]
|
|
559
562
|
|
|
560
563
|
M1S -->|nativeWrap? + erc20TransferFrom + morphoSupply| B3[Bundler3]
|
|
561
564
|
M1SC -->|erc20TransferFrom + morphoSupplyCollateral| B3
|
|
@@ -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>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.blueBorrow = void 0;
|
|
4
4
|
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
5
5
|
const index_js_1 = require("../../bundler/index.js");
|
|
6
6
|
const index_js_2 = require("../../helpers/index.js");
|
|
@@ -25,7 +25,7 @@ const buildReallocationActions_js_1 = require("./buildReallocationActions.js");
|
|
|
25
25
|
* @param params.args.reallocations - Optional vault reallocations to execute before borrowing,
|
|
26
26
|
* computed by the entity layer.
|
|
27
27
|
* @param params.metadata - Optional analytics metadata attached to the bundle.
|
|
28
|
-
* @returns A deep-frozen `Transaction<
|
|
28
|
+
* @returns A deep-frozen `Transaction<BlueBorrowAction>` with `to`, `value`, `data`, and the
|
|
29
29
|
* typed `action` discriminator the simulation layer consumes.
|
|
30
30
|
* @throws {NonPositiveBorrowAmountError} when `amount <= 0n`.
|
|
31
31
|
* @throws {NonPositiveMinBorrowSharePriceError} when `minSharePrice < 0n` (negative; zero is
|
|
@@ -42,9 +42,9 @@ const buildReallocationActions_js_1 = require("./buildReallocationActions.js");
|
|
|
42
42
|
* reallocation withdrawals are not strictly sorted by market id.
|
|
43
43
|
* @example
|
|
44
44
|
* ```ts
|
|
45
|
-
* import {
|
|
45
|
+
* import { blueBorrow } from "@morpho-org/morpho-sdk";
|
|
46
46
|
*
|
|
47
|
-
* const tx =
|
|
47
|
+
* const tx = blueBorrow({
|
|
48
48
|
* market: { chainId: 1, marketParams },
|
|
49
49
|
* args: {
|
|
50
50
|
* amount: 1_000_000n,
|
|
@@ -52,10 +52,10 @@ const buildReallocationActions_js_1 = require("./buildReallocationActions.js");
|
|
|
52
52
|
* minSharePrice: 0n, // disables slippage protection — production code should compute via `computeMinBorrowSharePrice` from market state + slippage tolerance
|
|
53
53
|
* },
|
|
54
54
|
* });
|
|
55
|
-
* // tx satisfies Readonly<Transaction<
|
|
55
|
+
* // tx satisfies Readonly<Transaction<BlueBorrowAction>>
|
|
56
56
|
* ```
|
|
57
57
|
*/
|
|
58
|
-
const
|
|
58
|
+
const blueBorrow = ({ market: { chainId, marketParams }, args: { amount, receiver, minSharePrice, reallocations }, metadata, }) => {
|
|
59
59
|
if (amount <= 0n) {
|
|
60
60
|
throw new index_js_3.NonPositiveBorrowAmountError(marketParams.id);
|
|
61
61
|
}
|
|
@@ -80,7 +80,7 @@ const marketV1Borrow = ({ market: { chainId, marketParams }, args: { amount, rec
|
|
|
80
80
|
return (0, morpho_ts_1.deepFreeze)({
|
|
81
81
|
...tx,
|
|
82
82
|
action: {
|
|
83
|
-
type: "
|
|
83
|
+
type: "blueBorrow",
|
|
84
84
|
args: {
|
|
85
85
|
market: marketParams.id,
|
|
86
86
|
amount,
|
|
@@ -91,4 +91,4 @@ const marketV1Borrow = ({ market: { chainId, marketParams }, args: { amount, rec
|
|
|
91
91
|
},
|
|
92
92
|
});
|
|
93
93
|
};
|
|
94
|
-
exports.
|
|
94
|
+
exports.blueBorrow = blueBorrow;
|
|
@@ -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.
|
|
@@ -8,7 +8,7 @@ const index_js_1 = require("../../helpers/index.js");
|
|
|
8
8
|
* Validates the reallocations, then encodes each as a `reallocateTo` action against the target
|
|
9
9
|
* market. Returns `{ actions: [], fee: 0n }` for an empty input — callers gate on
|
|
10
10
|
* `reallocations.length > 0` and skip the call entirely in that case. Internal helper —
|
|
11
|
-
* consumed only by `
|
|
11
|
+
* consumed only by `blueBorrow` and `blueSupplyCollateralBorrow`; not re-exported on the
|
|
12
12
|
* public surface.
|
|
13
13
|
*
|
|
14
14
|
* @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>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.blueRefinance = 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
6
|
const viem_1 = require("viem");
|
|
@@ -56,7 +56,7 @@ const buildReallocationActions_js_1 = require("./buildReallocationActions.js");
|
|
|
56
56
|
* @param params.args.maxRepaySharePrice - Maximum repay share price (ray) on the source.
|
|
57
57
|
* @param params.args.targetReallocations - PublicAllocator reallocations into the target, run before the supply leg.
|
|
58
58
|
* @param params.metadata - Optional analytics metadata appended to `tx.data`.
|
|
59
|
-
* @returns A deep-frozen `Transaction<
|
|
59
|
+
* @returns A deep-frozen `Transaction<BlueRefinanceAction>`.
|
|
60
60
|
* @remarks `borrowAssets` and `borrowShares` describe different markets (target borrow vs. source
|
|
61
61
|
* repay); in shares mode the entity passes both. Caller-facing mutual exclusivity is enforced at the entity layer.
|
|
62
62
|
* @throws {ZeroCollateralAmountError} when `collateralAmount <= 0n`.
|
|
@@ -75,9 +75,9 @@ const buildReallocationActions_js_1 = require("./buildReallocationActions.js");
|
|
|
75
75
|
* @throws {UnsortedReallocationWithdrawalsError} when reallocation withdrawals are not strictly sorted by market id.
|
|
76
76
|
* @example
|
|
77
77
|
* ```ts
|
|
78
|
-
* import {
|
|
78
|
+
* import { blueRefinance } from "@morpho-org/morpho-sdk";
|
|
79
79
|
*
|
|
80
|
-
* const tx =
|
|
80
|
+
* const tx = blueRefinance({
|
|
81
81
|
* source: { chainId: 1, marketParams: sourceParams },
|
|
82
82
|
* target: { marketParams: targetParams },
|
|
83
83
|
* args: {
|
|
@@ -89,10 +89,10 @@ const buildReallocationActions_js_1 = require("./buildReallocationActions.js");
|
|
|
89
89
|
* maxRepaySharePrice: 1_500_000_000_000_000_000_000_000_000n,
|
|
90
90
|
* },
|
|
91
91
|
* });
|
|
92
|
-
* // tx satisfies Readonly<Transaction<
|
|
92
|
+
* // tx satisfies Readonly<Transaction<BlueRefinanceAction>>
|
|
93
93
|
* ```
|
|
94
94
|
*/
|
|
95
|
-
const
|
|
95
|
+
const blueRefinance = ({ source: { chainId, marketParams: sourceParams }, target: { marketParams: targetParams }, args: { user, collateralAmount, borrowAssets = 0n, borrowShares = 0n, minBorrowSharePrice, maxRepaySharePrice, targetReallocations, }, metadata, }) => {
|
|
96
96
|
if (collateralAmount <= 0n) {
|
|
97
97
|
throw new index_js_3.ZeroCollateralAmountError(sourceParams.id);
|
|
98
98
|
}
|
|
@@ -200,7 +200,7 @@ const marketV1Refinance = ({ source: { chainId, marketParams: sourceParams }, ta
|
|
|
200
200
|
return (0, morpho_ts_1.deepFreeze)({
|
|
201
201
|
...tx,
|
|
202
202
|
action: {
|
|
203
|
-
type: "
|
|
203
|
+
type: "blueRefinance",
|
|
204
204
|
args: {
|
|
205
205
|
sourceMarket: sourceParams.id,
|
|
206
206
|
targetMarket: targetParams.id,
|
|
@@ -215,4 +215,4 @@ const marketV1Refinance = ({ source: { chainId, marketParams: sourceParams }, ta
|
|
|
215
215
|
},
|
|
216
216
|
});
|
|
217
217
|
};
|
|
218
|
-
exports.
|
|
218
|
+
exports.blueRefinance = blueRefinance;
|
|
@@ -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>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.blueRepay = 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
6
|
const viem_1 = require("viem");
|
|
@@ -35,7 +35,7 @@ const getRequirementsAction_js_1 = require("../requirements/getRequirementsActio
|
|
|
35
35
|
* @param params.args.requirementSignature - Optional pre-signed permit/permit2 approval for the
|
|
36
36
|
* loan-token transfer.
|
|
37
37
|
* @param params.metadata - Optional analytics metadata attached to the bundle.
|
|
38
|
-
* @returns A deep-frozen `Transaction<
|
|
38
|
+
* @returns A deep-frozen `Transaction<BlueRepayAction>` with `to`, `value`, `data`, and the
|
|
39
39
|
* typed `action` discriminator the simulation layer consumes.
|
|
40
40
|
* @throws {NonPositiveRepayMaxSharePriceError} when `maxSharePrice <= 0n`.
|
|
41
41
|
* @throws {NonPositiveRepayAmountError} when either `assets` or `shares` is negative, or when
|
|
@@ -51,9 +51,9 @@ const getRequirementsAction_js_1 = require("../requirements/getRequirementsActio
|
|
|
51
51
|
* signature is missing its expiration.
|
|
52
52
|
* @example
|
|
53
53
|
* ```ts
|
|
54
|
-
* import {
|
|
54
|
+
* import { blueRepay } from "@morpho-org/morpho-sdk";
|
|
55
55
|
*
|
|
56
|
-
* const tx =
|
|
56
|
+
* const tx = blueRepay({
|
|
57
57
|
* market: { chainId: 1, marketParams },
|
|
58
58
|
* args: {
|
|
59
59
|
* assets: 500_000_000n,
|
|
@@ -64,10 +64,10 @@ const getRequirementsAction_js_1 = require("../requirements/getRequirementsActio
|
|
|
64
64
|
* maxSharePrice: 1_010_000_000_000_000_000_000_000_000n, // RAY-scaled, 1.01x
|
|
65
65
|
* },
|
|
66
66
|
* });
|
|
67
|
-
* // tx satisfies Readonly<Transaction<
|
|
67
|
+
* // tx satisfies Readonly<Transaction<BlueRepayAction>>
|
|
68
68
|
* ```
|
|
69
69
|
*/
|
|
70
|
-
const
|
|
70
|
+
const blueRepay = ({ market: { chainId, marketParams }, args: { assets, shares, transferAmount, onBehalf, receiver, maxSharePrice, requirementSignature, }, metadata, }) => {
|
|
71
71
|
(0, index_js_2.validateRepayParams)({
|
|
72
72
|
assets,
|
|
73
73
|
shares,
|
|
@@ -117,7 +117,7 @@ const marketV1Repay = ({ market: { chainId, marketParams }, args: { assets, shar
|
|
|
117
117
|
return (0, morpho_ts_1.deepFreeze)({
|
|
118
118
|
...tx,
|
|
119
119
|
action: {
|
|
120
|
-
type: "
|
|
120
|
+
type: "blueRepay",
|
|
121
121
|
args: {
|
|
122
122
|
market: marketParams.id,
|
|
123
123
|
assets,
|
|
@@ -130,4 +130,4 @@ const marketV1Repay = ({ market: { chainId, marketParams }, args: { assets, shar
|
|
|
130
130
|
},
|
|
131
131
|
});
|
|
132
132
|
};
|
|
133
|
-
exports.
|
|
133
|
+
exports.blueRepay = blueRepay;
|
|
@@ -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>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.blueRepayWithdrawCollateral = 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
6
|
const viem_1 = require("viem");
|
|
@@ -45,7 +45,7 @@ const getRequirementsAction_js_1 = require("../requirements/getRequirementsActio
|
|
|
45
45
|
* @param params.args.requirementSignature - Optional pre-signed permit/permit2 approval for the
|
|
46
46
|
* loan-token transfer.
|
|
47
47
|
* @param params.metadata - Optional analytics metadata attached to the bundle.
|
|
48
|
-
* @returns A deep-frozen `Transaction<
|
|
48
|
+
* @returns A deep-frozen `Transaction<BlueRepayWithdrawCollateralAction>` with `to`,
|
|
49
49
|
* `value`, `data`, and the typed `action` discriminator the simulation layer consumes.
|
|
50
50
|
* @throws {NonPositiveRepayMaxSharePriceError} when `maxSharePrice <= 0n`.
|
|
51
51
|
* @throws {NonPositiveRepayAmountError} when either `assets` or `shares` is negative, or when
|
|
@@ -62,9 +62,9 @@ const getRequirementsAction_js_1 = require("../requirements/getRequirementsActio
|
|
|
62
62
|
* signature is missing its expiration.
|
|
63
63
|
* @example
|
|
64
64
|
* ```ts
|
|
65
|
-
* import {
|
|
65
|
+
* import { blueRepayWithdrawCollateral } from "@morpho-org/morpho-sdk";
|
|
66
66
|
*
|
|
67
|
-
* const tx =
|
|
67
|
+
* const tx = blueRepayWithdrawCollateral({
|
|
68
68
|
* market: { chainId: 1, marketParams },
|
|
69
69
|
* args: {
|
|
70
70
|
* assets: 500_000_000n,
|
|
@@ -76,10 +76,10 @@ const getRequirementsAction_js_1 = require("../requirements/getRequirementsActio
|
|
|
76
76
|
* maxSharePrice: 1_010_000_000_000_000_000_000_000_000n, // RAY-scaled, 1.01x
|
|
77
77
|
* },
|
|
78
78
|
* });
|
|
79
|
-
* // tx satisfies Readonly<Transaction<
|
|
79
|
+
* // tx satisfies Readonly<Transaction<BlueRepayWithdrawCollateralAction>>
|
|
80
80
|
* ```
|
|
81
81
|
*/
|
|
82
|
-
const
|
|
82
|
+
const blueRepayWithdrawCollateral = ({ market: { chainId, marketParams }, args: { assets, shares, transferAmount, withdrawAmount, onBehalf, receiver, maxSharePrice, requirementSignature, }, metadata, }) => {
|
|
83
83
|
(0, index_js_2.validateRepayParams)({
|
|
84
84
|
assets,
|
|
85
85
|
shares,
|
|
@@ -137,7 +137,7 @@ const marketV1RepayWithdrawCollateral = ({ market: { chainId, marketParams }, ar
|
|
|
137
137
|
return (0, morpho_ts_1.deepFreeze)({
|
|
138
138
|
...tx,
|
|
139
139
|
action: {
|
|
140
|
-
type: "
|
|
140
|
+
type: "blueRepayWithdrawCollateral",
|
|
141
141
|
args: {
|
|
142
142
|
market: marketParams.id,
|
|
143
143
|
repayAssets: assets,
|
|
@@ -151,4 +151,4 @@ const marketV1RepayWithdrawCollateral = ({ market: { chainId, marketParams }, ar
|
|
|
151
151
|
},
|
|
152
152
|
});
|
|
153
153
|
};
|
|
154
|
-
exports.
|
|
154
|
+
exports.blueRepayWithdrawCollateral = blueRepayWithdrawCollateral;
|
|
@@ -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>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.blueSupply = 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
6
|
const index_js_1 = require("../../bundler/index.js");
|
|
@@ -30,7 +30,7 @@ const getRequirementsAction_js_1 = require("../requirements/getRequirementsActio
|
|
|
30
30
|
* absent, the bundle uses a plain `erc20TransferFrom` and assumes the user has already
|
|
31
31
|
* approved `GeneralAdapter1`.
|
|
32
32
|
* @param params.metadata - Optional analytics metadata attached to the bundle.
|
|
33
|
-
* @returns A deep-frozen `Transaction<
|
|
33
|
+
* @returns A deep-frozen `Transaction<BlueSupplyAction>` with `to`, `value`, `data`, and the
|
|
34
34
|
* typed `action` discriminator the simulation layer consumes.
|
|
35
35
|
* @throws {NegativeSupplyAmountError} when `amount < 0n`.
|
|
36
36
|
* @throws {NegativeNativeAmountError} when `nativeAmount < 0n`.
|
|
@@ -45,9 +45,9 @@ const getRequirementsAction_js_1 = require("../requirements/getRequirementsActio
|
|
|
45
45
|
* is provided and the signed amount differs from `args.amount`.
|
|
46
46
|
* @example
|
|
47
47
|
* ```ts
|
|
48
|
-
* import {
|
|
48
|
+
* import { blueSupply } from "@morpho-org/morpho-sdk";
|
|
49
49
|
*
|
|
50
|
-
* const tx =
|
|
50
|
+
* const tx = blueSupply({
|
|
51
51
|
* market: { chainId: 1, marketParams },
|
|
52
52
|
* args: {
|
|
53
53
|
* amount: 1_000_000_000n,
|
|
@@ -55,10 +55,10 @@ const getRequirementsAction_js_1 = require("../requirements/getRequirementsActio
|
|
|
55
55
|
* maxSharePrice: 1_010_000_000_000_000_000_000_000_000n, // RAY-scaled, 1.01x
|
|
56
56
|
* },
|
|
57
57
|
* });
|
|
58
|
-
* // tx satisfies Readonly<Transaction<
|
|
58
|
+
* // tx satisfies Readonly<Transaction<BlueSupplyAction>>
|
|
59
59
|
* ```
|
|
60
60
|
*/
|
|
61
|
-
const
|
|
61
|
+
const blueSupply = ({ market: { chainId, marketParams }, args: { amount = 0n, onBehalf, maxSharePrice, requirementSignature, nativeAmount, }, metadata, }) => {
|
|
62
62
|
if (amount < 0n) {
|
|
63
63
|
throw new index_js_3.NegativeSupplyAmountError(marketParams.id);
|
|
64
64
|
}
|
|
@@ -114,7 +114,7 @@ const marketV1Supply = ({ market: { chainId, marketParams }, args: { amount = 0n
|
|
|
114
114
|
return (0, morpho_ts_1.deepFreeze)({
|
|
115
115
|
...tx,
|
|
116
116
|
action: {
|
|
117
|
-
type: "
|
|
117
|
+
type: "blueSupply",
|
|
118
118
|
args: {
|
|
119
119
|
market: marketParams.id,
|
|
120
120
|
amount: totalAssets,
|
|
@@ -125,4 +125,4 @@ const marketV1Supply = ({ market: { chainId, marketParams }, args: { amount = 0n
|
|
|
125
125
|
},
|
|
126
126
|
});
|
|
127
127
|
};
|
|
128
|
-
exports.
|
|
128
|
+
exports.blueSupply = blueSupply;
|