@morpho-org/morpho-sdk 4.2.0 → 5.1.1
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 +16 -16
- package/lib/cjs/actions/blue/borrow.d.ts +12 -2
- package/lib/cjs/actions/blue/borrow.js +7 -1
- package/lib/cjs/actions/blue/buildAssetFundingActions.d.ts +47 -0
- package/lib/cjs/actions/blue/buildAssetFundingActions.js +63 -0
- package/lib/cjs/actions/blue/refinance.d.ts +13 -3
- package/lib/cjs/actions/blue/refinance.js +8 -2
- package/lib/cjs/actions/blue/repay.d.ts +44 -43
- package/lib/cjs/actions/blue/repay.js +70 -59
- package/lib/cjs/actions/blue/repayWithdrawCollateral.d.ts +50 -41
- package/lib/cjs/actions/blue/repayWithdrawCollateral.js +75 -54
- package/lib/cjs/actions/blue/resolveRepayFunding.d.ts +69 -0
- package/lib/cjs/actions/blue/resolveRepayFunding.js +82 -0
- package/lib/cjs/actions/blue/supply.d.ts +8 -8
- package/lib/cjs/actions/blue/supply.js +11 -35
- package/lib/cjs/actions/blue/supplyCollateral.d.ts +9 -9
- package/lib/cjs/actions/blue/supplyCollateral.js +12 -36
- package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +19 -7
- package/lib/cjs/actions/blue/supplyCollateralBorrow.js +17 -32
- package/lib/cjs/actions/blue/withdraw.d.ts +10 -2
- package/lib/cjs/actions/blue/withdraw.js +7 -1
- package/lib/cjs/actions/index.d.ts +1 -0
- package/lib/cjs/actions/index.js +1 -0
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +49 -0
- package/lib/cjs/actions/requirements/blue/getBlueAuthorizationRequirement.js +111 -0
- package/lib/cjs/actions/requirements/blue/index.d.ts +1 -0
- package/lib/cjs/actions/requirements/blue/index.js +17 -0
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +55 -0
- package/lib/cjs/actions/requirements/encode/encodeBlueSignatureAuthorization.js +89 -0
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.d.ts +6 -5
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +17 -5
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.d.ts +9 -7
- package/lib/cjs/actions/requirements/encode/encodeErc20Permit.js +18 -4
- package/lib/cjs/actions/requirements/encode/{encodeErc20Permit2.d.ts → encodeErc20Permit2Approve.d.ts} +11 -13
- package/lib/cjs/actions/requirements/encode/{encodeErc20Permit2.js → encodeErc20Permit2Approve.js} +10 -14
- package/lib/cjs/actions/requirements/encode/index.d.ts +2 -1
- package/lib/cjs/actions/requirements/encode/index.js +2 -1
- package/lib/cjs/actions/requirements/{getRequirements.d.ts → generalAdapter/getGeneralAdapterRequirements.d.ts} +34 -20
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +151 -0
- package/lib/{esm/actions/requirements/getRequirementsPermit.d.ts → cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts} +6 -14
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +50 -0
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +57 -0
- package/lib/cjs/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +74 -0
- package/lib/cjs/actions/requirements/generalAdapter/index.d.ts +3 -0
- package/lib/cjs/actions/requirements/generalAdapter/index.js +19 -0
- package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +3 -2
- package/lib/cjs/actions/requirements/getRequirementsApproval.js +3 -2
- package/lib/cjs/actions/requirements/index.d.ts +2 -5
- package/lib/cjs/actions/requirements/index.js +2 -5
- package/lib/cjs/actions/signatures/getBlueAuthorizationAction.d.ts +29 -0
- package/lib/cjs/actions/signatures/getBlueAuthorizationAction.js +48 -0
- package/lib/{esm/actions/requirements/getRequirementsAction.d.ts → cjs/actions/signatures/getTokenRequirementActions.d.ts} +17 -17
- package/lib/cjs/actions/{requirements/getRequirementsAction.js → signatures/getTokenRequirementActions.js} +26 -13
- package/lib/cjs/actions/signatures/index.d.ts +2 -0
- package/lib/cjs/actions/signatures/index.js +18 -0
- package/lib/cjs/actions/vaultV1/deposit.d.ts +6 -8
- package/lib/cjs/actions/vaultV1/deposit.js +11 -21
- package/lib/cjs/actions/vaultV1/migrateToV2.d.ts +6 -6
- package/lib/cjs/actions/vaultV1/migrateToV2.js +12 -20
- package/lib/cjs/actions/vaultV2/deposit.d.ts +6 -8
- package/lib/cjs/actions/vaultV2/deposit.js +11 -21
- package/lib/cjs/addresses.d.ts +2 -2
- package/lib/cjs/addresses.js +2 -1
- package/lib/cjs/bundler/actions.d.ts +44 -4
- package/lib/cjs/bundler/actions.js +75 -2
- package/lib/cjs/bundler/types.d.ts +6 -0
- package/lib/cjs/constants.d.ts +2 -2
- package/lib/cjs/constants.js +3 -3
- package/lib/cjs/entities/blue/blue.d.ts +58 -33
- package/lib/cjs/entities/blue/blue.js +309 -189
- package/lib/cjs/entities/reallocationData.d.ts +0 -44
- package/lib/cjs/entities/reallocationData.js +3 -50
- package/lib/cjs/entities/vaultV1/vaultV1.d.ts +9 -9
- package/lib/cjs/entities/vaultV1/vaultV1.js +44 -34
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +6 -6
- package/lib/cjs/entities/vaultV2/vaultV2.js +21 -16
- package/lib/cjs/errors.d.ts +3 -2
- package/lib/cjs/errors.js +5 -2
- package/lib/cjs/helpers/index.d.ts +1 -1
- package/lib/cjs/helpers/index.js +1 -2
- package/lib/cjs/helpers/validate.d.ts +2 -20
- package/lib/cjs/helpers/validate.js +2 -39
- package/lib/cjs/types/action.d.ts +164 -12
- package/lib/cjs/types/action.js +79 -5
- package/lib/cjs/types/error.d.ts +97 -2
- package/lib/cjs/types/error.js +113 -7
- package/lib/cjs/types.d.ts +2 -1
- package/lib/cjs/utils.d.ts +2 -2
- package/lib/cjs/utils.js +2 -4
- package/lib/esm/actions/blue/borrow.d.ts +12 -2
- package/lib/esm/actions/blue/borrow.js +7 -1
- package/lib/esm/actions/blue/buildAssetFundingActions.d.ts +47 -0
- package/lib/esm/actions/blue/buildAssetFundingActions.js +59 -0
- package/lib/esm/actions/blue/refinance.d.ts +13 -3
- package/lib/esm/actions/blue/refinance.js +8 -2
- package/lib/esm/actions/blue/repay.d.ts +44 -43
- package/lib/esm/actions/blue/repay.js +71 -60
- package/lib/esm/actions/blue/repayWithdrawCollateral.d.ts +50 -41
- package/lib/esm/actions/blue/repayWithdrawCollateral.js +76 -55
- package/lib/esm/actions/blue/resolveRepayFunding.d.ts +69 -0
- package/lib/esm/actions/blue/resolveRepayFunding.js +78 -0
- package/lib/esm/actions/blue/supply.d.ts +8 -8
- package/lib/esm/actions/blue/supply.js +12 -36
- package/lib/esm/actions/blue/supplyCollateral.d.ts +9 -9
- package/lib/esm/actions/blue/supplyCollateral.js +13 -37
- package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +19 -7
- package/lib/esm/actions/blue/supplyCollateralBorrow.js +18 -33
- package/lib/esm/actions/blue/withdraw.d.ts +10 -2
- package/lib/esm/actions/blue/withdraw.js +7 -1
- package/lib/esm/actions/index.d.ts +1 -0
- package/lib/esm/actions/index.js +1 -0
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.d.ts +49 -0
- package/lib/esm/actions/requirements/blue/getBlueAuthorizationRequirement.js +107 -0
- package/lib/esm/actions/requirements/blue/index.d.ts +1 -0
- package/lib/esm/actions/requirements/blue/index.js +1 -0
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.d.ts +55 -0
- package/lib/esm/actions/requirements/encode/encodeBlueSignatureAuthorization.js +85 -0
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +6 -5
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +19 -7
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.d.ts +9 -7
- package/lib/esm/actions/requirements/encode/encodeErc20Permit.js +20 -6
- package/lib/esm/actions/requirements/encode/{encodeErc20Permit2.d.ts → encodeErc20Permit2Approve.d.ts} +11 -13
- package/lib/esm/actions/requirements/encode/{encodeErc20Permit2.js → encodeErc20Permit2Approve.js} +8 -12
- package/lib/esm/actions/requirements/encode/index.d.ts +2 -1
- package/lib/esm/actions/requirements/encode/index.js +2 -1
- package/lib/esm/actions/requirements/{getRequirements.d.ts → generalAdapter/getGeneralAdapterRequirements.d.ts} +34 -20
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirements.js +147 -0
- package/lib/{cjs/actions/requirements/getRequirementsPermit.d.ts → esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.d.ts} +6 -14
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit.js +46 -0
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.d.ts +57 -0
- package/lib/esm/actions/requirements/generalAdapter/getGeneralAdapterRequirementsPermit2.js +70 -0
- package/lib/esm/actions/requirements/generalAdapter/index.d.ts +3 -0
- package/lib/esm/actions/requirements/generalAdapter/index.js +3 -0
- package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +3 -2
- package/lib/esm/actions/requirements/getRequirementsApproval.js +3 -2
- package/lib/esm/actions/requirements/index.d.ts +2 -5
- package/lib/esm/actions/requirements/index.js +2 -5
- package/lib/esm/actions/signatures/getBlueAuthorizationAction.d.ts +29 -0
- package/lib/esm/actions/signatures/getBlueAuthorizationAction.js +44 -0
- package/lib/{cjs/actions/requirements/getRequirementsAction.d.ts → esm/actions/signatures/getTokenRequirementActions.d.ts} +17 -17
- package/lib/esm/actions/{requirements/getRequirementsAction.js → signatures/getTokenRequirementActions.js} +24 -11
- package/lib/esm/actions/signatures/index.d.ts +2 -0
- package/lib/esm/actions/signatures/index.js +2 -0
- package/lib/esm/actions/vaultV1/deposit.d.ts +6 -8
- package/lib/esm/actions/vaultV1/deposit.js +11 -21
- package/lib/esm/actions/vaultV1/migrateToV2.d.ts +6 -6
- package/lib/esm/actions/vaultV1/migrateToV2.js +12 -20
- package/lib/esm/actions/vaultV2/deposit.d.ts +6 -8
- package/lib/esm/actions/vaultV2/deposit.js +11 -21
- package/lib/esm/addresses.d.ts +2 -2
- package/lib/esm/addresses.js +1 -1
- package/lib/esm/bundler/actions.d.ts +44 -4
- package/lib/esm/bundler/actions.js +77 -4
- package/lib/esm/bundler/types.d.ts +6 -0
- package/lib/esm/constants.d.ts +2 -2
- package/lib/esm/constants.js +2 -2
- package/lib/esm/entities/blue/blue.d.ts +58 -33
- package/lib/esm/entities/blue/blue.js +311 -191
- package/lib/esm/entities/reallocationData.d.ts +0 -44
- package/lib/esm/entities/reallocationData.js +2 -49
- package/lib/esm/entities/vaultV1/vaultV1.d.ts +9 -9
- package/lib/esm/entities/vaultV1/vaultV1.js +46 -36
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +6 -6
- package/lib/esm/entities/vaultV2/vaultV2.js +23 -18
- package/lib/esm/errors.d.ts +3 -2
- package/lib/esm/errors.js +2 -1
- package/lib/esm/helpers/index.d.ts +1 -1
- package/lib/esm/helpers/index.js +1 -1
- package/lib/esm/helpers/validate.d.ts +2 -20
- package/lib/esm/helpers/validate.js +2 -38
- package/lib/esm/types/action.d.ts +164 -12
- package/lib/esm/types/action.js +75 -4
- package/lib/esm/types/error.d.ts +97 -2
- package/lib/esm/types/error.js +107 -5
- package/lib/esm/types.d.ts +2 -1
- package/lib/esm/utils.d.ts +2 -2
- package/lib/esm/utils.js +2 -2
- package/package.json +22 -21
- package/lib/cjs/actions/requirements/getMorphoAuthorizationRequirement.d.ts +0 -37
- package/lib/cjs/actions/requirements/getMorphoAuthorizationRequirement.js +0 -71
- package/lib/cjs/actions/requirements/getRequirements.js +0 -112
- package/lib/cjs/actions/requirements/getRequirementsPermit.js +0 -57
- package/lib/cjs/actions/requirements/getRequirementsPermit2.d.ts +0 -63
- package/lib/cjs/actions/requirements/getRequirementsPermit2.js +0 -85
- package/lib/esm/actions/requirements/getMorphoAuthorizationRequirement.d.ts +0 -37
- package/lib/esm/actions/requirements/getMorphoAuthorizationRequirement.js +0 -67
- package/lib/esm/actions/requirements/getRequirements.js +0 -108
- package/lib/esm/actions/requirements/getRequirementsPermit.js +0 -53
- package/lib/esm/actions/requirements/getRequirementsPermit2.d.ts +0 -63
- package/lib/esm/actions/requirements/getRequirementsPermit2.js +0 -81
- package/src/index.ts +0 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type InputMarketParams } from "@morpho-org/blue-sdk";
|
|
2
|
-
import { type Address, type Hex } from "viem";
|
|
3
|
-
import type { Action, InputReallocation, Permit2PermitSingle } from "./types.js";
|
|
2
|
+
import { type Address, type Hex, type Signature } from "viem";
|
|
3
|
+
import type { Action, Authorization, InputReallocation, Permit2PermitSingle } from "./types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Encoded low-level call consumed by Bundler3's `multicall`.
|
|
6
6
|
*/
|
|
@@ -211,7 +211,7 @@ export declare namespace BundlerAction {
|
|
|
211
211
|
* );
|
|
212
212
|
* ```
|
|
213
213
|
*/
|
|
214
|
-
function permit(chainId: number, owner: Address, asset: Address, amount: bigint, deadline: bigint, signature: Hex, skipRevert?: boolean): BundlerCall[];
|
|
214
|
+
function permit(chainId: number, owner: Address, asset: Address, amount: bigint, deadline: bigint, signature: Hex | Signature, skipRevert?: boolean): BundlerCall[];
|
|
215
215
|
/**
|
|
216
216
|
* Encodes a Permit2 approval for GeneralAdapter1 spending.
|
|
217
217
|
*
|
|
@@ -248,7 +248,7 @@ export declare namespace BundlerAction {
|
|
|
248
248
|
* );
|
|
249
249
|
* ```
|
|
250
250
|
*/
|
|
251
|
-
function approve2(chainId: number, owner: Address, permitSingle: Permit2PermitSingle, signature: Hex, skipRevert?: boolean): BundlerCall[];
|
|
251
|
+
function approve2(chainId: number, owner: Address, permitSingle: Permit2PermitSingle, signature: Hex | Signature, skipRevert?: boolean): BundlerCall[];
|
|
252
252
|
/**
|
|
253
253
|
* Encodes a GeneralAdapter1 Permit2 transfer.
|
|
254
254
|
*
|
|
@@ -334,6 +334,46 @@ export declare namespace BundlerAction {
|
|
|
334
334
|
* ```
|
|
335
335
|
*/
|
|
336
336
|
function erc4626Redeem(chainId: number, erc4626: Address, shares: bigint, minSharePrice: bigint, receiver: Address, owner: Address, skipRevert?: boolean): BundlerCall[];
|
|
337
|
+
/**
|
|
338
|
+
* Encodes a Morpho Blue `setAuthorizationWithSig` call that submits a signed authorization.
|
|
339
|
+
*
|
|
340
|
+
* Lets a bundle grant `authorization.authorized` (GeneralAdapter1) operator rights on Morpho
|
|
341
|
+
* on behalf of `authorization.authorizer` without a separate `setAuthorization` transaction.
|
|
342
|
+
*
|
|
343
|
+
* @param chainId - Chain where the action will execute.
|
|
344
|
+
* @param authorization - The Morpho authorization payload covered by the signature.
|
|
345
|
+
* @param signature - The owner's EIP-712 signature over the authorization typed data, as a hex
|
|
346
|
+
* string or a viem `Signature` object.
|
|
347
|
+
* @param skipRevert - Whether Bundler3 should tolerate a revert. Defaults to `true`, matching
|
|
348
|
+
* the convention for already-authorized accounts (the call reverts harmlessly).
|
|
349
|
+
* @returns Encoded Bundler3 calls.
|
|
350
|
+
* @throws {BundlerErrors.UnexpectedSignature} when `authorization.authorized` is not the chain's
|
|
351
|
+
* `GeneralAdapter1` — the only operator this bundled path may grant rights to.
|
|
352
|
+
*
|
|
353
|
+
* @example
|
|
354
|
+
* ```ts
|
|
355
|
+
* import { getChainAddresses } from "@morpho-org/blue-sdk";
|
|
356
|
+
* import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
|
|
357
|
+
*
|
|
358
|
+
* const { generalAdapter1 } = getChainAddresses(1).bundler3;
|
|
359
|
+
* const owner = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
|
|
360
|
+
* const signature =
|
|
361
|
+
* "0x111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222221b";
|
|
362
|
+
*
|
|
363
|
+
* const calls = BundlerAction.morphoSetAuthorizationWithSig(
|
|
364
|
+
* 1,
|
|
365
|
+
* {
|
|
366
|
+
* authorizer: owner,
|
|
367
|
+
* authorized: generalAdapter1,
|
|
368
|
+
* isAuthorized: true,
|
|
369
|
+
* nonce: 0n,
|
|
370
|
+
* deadline: 1_900_000_000n,
|
|
371
|
+
* },
|
|
372
|
+
* signature,
|
|
373
|
+
* );
|
|
374
|
+
* ```
|
|
375
|
+
*/
|
|
376
|
+
function morphoSetAuthorizationWithSig(chainId: number, authorization: Authorization, signature: Hex | Signature, skipRevert?: boolean): BundlerCall[];
|
|
337
377
|
/**
|
|
338
378
|
* Encodes a GeneralAdapter1 Morpho Blue supply-collateral call.
|
|
339
379
|
*
|
|
@@ -21,6 +21,12 @@ const addBundlerPrefund = (state, amount) => ({
|
|
|
21
21
|
value: state.value + amount,
|
|
22
22
|
availableBundlerValue: state.availableBundlerValue + amount,
|
|
23
23
|
});
|
|
24
|
+
/**
|
|
25
|
+
* Normalizes a raw ECDSA signature to its hex form. Integrators get a `Hex` from
|
|
26
|
+
* `signTypedData`/`signMessage` and a viem `Signature` object from the low-level
|
|
27
|
+
* `sign`; both are accepted so no manual conversion is required at the call site.
|
|
28
|
+
*/
|
|
29
|
+
const toSignatureHex = (signature) => typeof signature === "string" ? signature : (0, viem_1.serializeSignature)(signature);
|
|
24
30
|
const consumeCallValue = (state, call) => {
|
|
25
31
|
if (call.value > state.availableBundlerValue) {
|
|
26
32
|
return {
|
|
@@ -161,6 +167,12 @@ var BundlerAction;
|
|
|
161
167
|
case "erc4626Redeem": {
|
|
162
168
|
return BundlerAction.erc4626Redeem(chainId, ...args);
|
|
163
169
|
}
|
|
170
|
+
case "morphoSetAuthorizationWithSig": {
|
|
171
|
+
const [authorization, signature, skipRevert] = args;
|
|
172
|
+
if (signature == null)
|
|
173
|
+
throw new error_js_1.BundlerErrors.MissingSignature();
|
|
174
|
+
return BundlerAction.morphoSetAuthorizationWithSig(chainId, authorization, signature, skipRevert);
|
|
175
|
+
}
|
|
164
176
|
case "morphoSupplyCollateral": {
|
|
165
177
|
const [market, amount, onBehalf, onMorphoSupplyCollateral, skipRevert] = args;
|
|
166
178
|
return BundlerAction.morphoSupplyCollateral(chainId, market, amount, onBehalf, onMorphoSupplyCollateral.flatMap(BundlerAction.encode.bind(null, chainId)), skipRevert);
|
|
@@ -427,7 +439,7 @@ var BundlerAction;
|
|
|
427
439
|
// biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
|
|
428
440
|
function permit(chainId, owner, asset, amount, deadline, signature, skipRevert = true) {
|
|
429
441
|
const { bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
430
|
-
const { r, s, yParity } = (0, viem_1.parseSignature)(signature);
|
|
442
|
+
const { r, s, yParity } = (0, viem_1.parseSignature)(toSignatureHex(signature));
|
|
431
443
|
return [
|
|
432
444
|
{
|
|
433
445
|
to: asset,
|
|
@@ -497,7 +509,7 @@ var BundlerAction;
|
|
|
497
509
|
...permitSingle,
|
|
498
510
|
spender: generalAdapter1,
|
|
499
511
|
},
|
|
500
|
-
signature,
|
|
512
|
+
toSignatureHex(signature),
|
|
501
513
|
],
|
|
502
514
|
}),
|
|
503
515
|
value: 0n,
|
|
@@ -643,6 +655,67 @@ var BundlerAction;
|
|
|
643
655
|
];
|
|
644
656
|
}
|
|
645
657
|
BundlerAction.erc4626Redeem = erc4626Redeem;
|
|
658
|
+
/**
|
|
659
|
+
* Encodes a Morpho Blue `setAuthorizationWithSig` call that submits a signed authorization.
|
|
660
|
+
*
|
|
661
|
+
* Lets a bundle grant `authorization.authorized` (GeneralAdapter1) operator rights on Morpho
|
|
662
|
+
* on behalf of `authorization.authorizer` without a separate `setAuthorization` transaction.
|
|
663
|
+
*
|
|
664
|
+
* @param chainId - Chain where the action will execute.
|
|
665
|
+
* @param authorization - The Morpho authorization payload covered by the signature.
|
|
666
|
+
* @param signature - The owner's EIP-712 signature over the authorization typed data, as a hex
|
|
667
|
+
* string or a viem `Signature` object.
|
|
668
|
+
* @param skipRevert - Whether Bundler3 should tolerate a revert. Defaults to `true`, matching
|
|
669
|
+
* the convention for already-authorized accounts (the call reverts harmlessly).
|
|
670
|
+
* @returns Encoded Bundler3 calls.
|
|
671
|
+
* @throws {BundlerErrors.UnexpectedSignature} when `authorization.authorized` is not the chain's
|
|
672
|
+
* `GeneralAdapter1` — the only operator this bundled path may grant rights to.
|
|
673
|
+
*
|
|
674
|
+
* @example
|
|
675
|
+
* ```ts
|
|
676
|
+
* import { getChainAddresses } from "@morpho-org/blue-sdk";
|
|
677
|
+
* import { BundlerAction } from "@morpho-org/morpho-sdk/bundler";
|
|
678
|
+
*
|
|
679
|
+
* const { generalAdapter1 } = getChainAddresses(1).bundler3;
|
|
680
|
+
* const owner = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045";
|
|
681
|
+
* const signature =
|
|
682
|
+
* "0x111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222221b";
|
|
683
|
+
*
|
|
684
|
+
* const calls = BundlerAction.morphoSetAuthorizationWithSig(
|
|
685
|
+
* 1,
|
|
686
|
+
* {
|
|
687
|
+
* authorizer: owner,
|
|
688
|
+
* authorized: generalAdapter1,
|
|
689
|
+
* isAuthorized: true,
|
|
690
|
+
* nonce: 0n,
|
|
691
|
+
* deadline: 1_900_000_000n,
|
|
692
|
+
* },
|
|
693
|
+
* signature,
|
|
694
|
+
* );
|
|
695
|
+
* ```
|
|
696
|
+
*/
|
|
697
|
+
// biome-ignore lint/complexity/useMaxParams: TODO refactor to ≤2 params
|
|
698
|
+
function morphoSetAuthorizationWithSig(chainId, authorization, signature, skipRevert = true) {
|
|
699
|
+
const { morpho, bundler3: { generalAdapter1 }, } = (0, blue_sdk_1.getChainAddresses)(chainId);
|
|
700
|
+
const { r, s, yParity } = (0, viem_1.parseSignature)(toSignatureHex(signature));
|
|
701
|
+
if (!(0, viem_1.isAddressEqual)(authorization.authorized, generalAdapter1)) {
|
|
702
|
+
throw new error_js_1.BundlerErrors.UnexpectedSignature(authorization.authorized);
|
|
703
|
+
}
|
|
704
|
+
return [
|
|
705
|
+
{
|
|
706
|
+
to: morpho,
|
|
707
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
708
|
+
abi: blue_sdk_viem_1.blueAbi,
|
|
709
|
+
functionName: "setAuthorizationWithSig",
|
|
710
|
+
args: [authorization, { v: yParity + 27, r, s }],
|
|
711
|
+
}),
|
|
712
|
+
value: 0n,
|
|
713
|
+
skipRevert,
|
|
714
|
+
callbackHash: viem_1.zeroHash,
|
|
715
|
+
},
|
|
716
|
+
];
|
|
717
|
+
}
|
|
718
|
+
BundlerAction.morphoSetAuthorizationWithSig = morphoSetAuthorizationWithSig;
|
|
646
719
|
/**
|
|
647
720
|
* Encodes a GeneralAdapter1 Morpho Blue supply-collateral call.
|
|
648
721
|
*
|
|
@@ -113,6 +113,12 @@ export interface ActionArgs {
|
|
|
113
113
|
owner: Address,
|
|
114
114
|
skipRevert?: boolean
|
|
115
115
|
];
|
|
116
|
+
/** Morpho Blue `setAuthorizationWithSig` call submitting a signed `authorization` and its `signature`; `skipRevert` controls Bundler3 revert handling. */
|
|
117
|
+
readonly morphoSetAuthorizationWithSig: [
|
|
118
|
+
authorization: Authorization,
|
|
119
|
+
signature: Hex | null,
|
|
120
|
+
skipRevert?: boolean
|
|
121
|
+
];
|
|
116
122
|
/** Morpho Blue supply-collateral call for `market`, `assets`, `onBehalf`, and callback actions; `skipRevert` controls Bundler3 revert handling. */
|
|
117
123
|
readonly morphoSupplyCollateral: [
|
|
118
124
|
market: InputMarketParams,
|
package/lib/cjs/constants.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { BLUE_API_BASE_URL, BLUE_API_GRAPHQL_URL, CDN_BASE_URL, DOCS_BASE_URL, MORPHO_DOMAIN, OPTIMIZERS_API_BASE_URL, OPTIMIZERS_BASE_URL, REWARDS_BASE_URL, ZERO_ADDRESS, } from "@morpho-org/morpho-ts";
|
|
1
|
+
export { DEFAULT_SLIPPAGE_TOLERANCE, EIP_712_FIELDS, isMarketId, LIQUIDATION_CURSOR, MAX_LIQUIDATION_INCENTIVE_FACTOR, ORACLE_PRICE_SCALE, SECONDS_PER_YEAR, TransactionType, } from "@morpho-org/blue-sdk";
|
|
2
|
+
export { BLUE_API_BASE_URL, BLUE_API_GRAPHQL_URL, CDN_BASE_URL, ChainId, ChainUtils, DOCS_BASE_URL, MORPHO_DOMAIN, OPTIMIZERS_API_BASE_URL, OPTIMIZERS_BASE_URL, REWARDS_BASE_URL, ZERO_ADDRESS, } from "@morpho-org/morpho-ts";
|
|
3
3
|
export { APPROVE_ONLY_ONCE_TOKENS, DEFAULT_LLTV_BUFFER, DEFAULT_SUPPLY_TARGET_UTILIZATION, DEFAULT_WITHDRAWAL_TARGET_UTILIZATION, MAX_ABSOLUTE_SHARE_PRICE, MAX_SLIPPAGE_TOLERANCE, MAX_TOKEN_APPROVALS, } from "./helpers/constant.js";
|
package/lib/cjs/constants.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MAX_TOKEN_APPROVALS = exports.MAX_SLIPPAGE_TOLERANCE = exports.MAX_ABSOLUTE_SHARE_PRICE = exports.DEFAULT_WITHDRAWAL_TARGET_UTILIZATION = exports.DEFAULT_SUPPLY_TARGET_UTILIZATION = exports.DEFAULT_LLTV_BUFFER = exports.APPROVE_ONLY_ONCE_TOKENS = exports.ZERO_ADDRESS = exports.REWARDS_BASE_URL = exports.OPTIMIZERS_BASE_URL = exports.OPTIMIZERS_API_BASE_URL = exports.MORPHO_DOMAIN = exports.DOCS_BASE_URL = exports.CDN_BASE_URL = exports.BLUE_API_GRAPHQL_URL = exports.BLUE_API_BASE_URL = exports.TransactionType = exports.SECONDS_PER_YEAR = exports.ORACLE_PRICE_SCALE = exports.MAX_LIQUIDATION_INCENTIVE_FACTOR = exports.LIQUIDATION_CURSOR = exports.isMarketId = exports.EIP_712_FIELDS = exports.DEFAULT_SLIPPAGE_TOLERANCE =
|
|
3
|
+
exports.MAX_TOKEN_APPROVALS = exports.MAX_SLIPPAGE_TOLERANCE = exports.MAX_ABSOLUTE_SHARE_PRICE = exports.DEFAULT_WITHDRAWAL_TARGET_UTILIZATION = exports.DEFAULT_SUPPLY_TARGET_UTILIZATION = exports.DEFAULT_LLTV_BUFFER = exports.APPROVE_ONLY_ONCE_TOKENS = exports.ZERO_ADDRESS = exports.REWARDS_BASE_URL = exports.OPTIMIZERS_BASE_URL = exports.OPTIMIZERS_API_BASE_URL = exports.MORPHO_DOMAIN = exports.DOCS_BASE_URL = exports.ChainUtils = exports.ChainId = exports.CDN_BASE_URL = exports.BLUE_API_GRAPHQL_URL = exports.BLUE_API_BASE_URL = exports.TransactionType = exports.SECONDS_PER_YEAR = exports.ORACLE_PRICE_SCALE = exports.MAX_LIQUIDATION_INCENTIVE_FACTOR = exports.LIQUIDATION_CURSOR = exports.isMarketId = exports.EIP_712_FIELDS = exports.DEFAULT_SLIPPAGE_TOLERANCE = void 0;
|
|
4
4
|
var blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
5
|
-
Object.defineProperty(exports, "ChainId", { enumerable: true, get: function () { return blue_sdk_1.ChainId; } });
|
|
6
|
-
Object.defineProperty(exports, "ChainUtils", { enumerable: true, get: function () { return blue_sdk_1.ChainUtils; } });
|
|
7
5
|
Object.defineProperty(exports, "DEFAULT_SLIPPAGE_TOLERANCE", { enumerable: true, get: function () { return blue_sdk_1.DEFAULT_SLIPPAGE_TOLERANCE; } });
|
|
8
6
|
Object.defineProperty(exports, "EIP_712_FIELDS", { enumerable: true, get: function () { return blue_sdk_1.EIP_712_FIELDS; } });
|
|
9
7
|
Object.defineProperty(exports, "isMarketId", { enumerable: true, get: function () { return blue_sdk_1.isMarketId; } });
|
|
@@ -16,6 +14,8 @@ var morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
|
16
14
|
Object.defineProperty(exports, "BLUE_API_BASE_URL", { enumerable: true, get: function () { return morpho_ts_1.BLUE_API_BASE_URL; } });
|
|
17
15
|
Object.defineProperty(exports, "BLUE_API_GRAPHQL_URL", { enumerable: true, get: function () { return morpho_ts_1.BLUE_API_GRAPHQL_URL; } });
|
|
18
16
|
Object.defineProperty(exports, "CDN_BASE_URL", { enumerable: true, get: function () { return morpho_ts_1.CDN_BASE_URL; } });
|
|
17
|
+
Object.defineProperty(exports, "ChainId", { enumerable: true, get: function () { return morpho_ts_1.ChainId; } });
|
|
18
|
+
Object.defineProperty(exports, "ChainUtils", { enumerable: true, get: function () { return morpho_ts_1.ChainUtils; } });
|
|
19
19
|
Object.defineProperty(exports, "DOCS_BASE_URL", { enumerable: true, get: function () { return morpho_ts_1.DOCS_BASE_URL; } });
|
|
20
20
|
Object.defineProperty(exports, "MORPHO_DOMAIN", { enumerable: true, get: function () { return morpho_ts_1.MORPHO_DOMAIN; } });
|
|
21
21
|
Object.defineProperty(exports, "OPTIMIZERS_API_BASE_URL", { enumerable: true, get: function () { return morpho_ts_1.OPTIMIZERS_API_BASE_URL; } });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AccrualPosition, type Market, type MarketParams } from "@morpho-org/blue-sdk";
|
|
2
2
|
import { type Address } from "viem";
|
|
3
3
|
import type { FetchParameters } from "../../types/data.js";
|
|
4
|
-
import { type AssetsOrSharesArgs, type BlueBorrowAction, type BlueRefinanceAction, type BlueRepayAction, type BlueRepayWithdrawCollateralAction, type BlueSupplyAction, type BlueSupplyCollateralAction, type BlueSupplyCollateralBorrowAction, type BlueWithdrawAction, type BlueWithdrawCollateralAction, type DepositAmountArgs, type ERC20ApprovalAction, type
|
|
4
|
+
import { type AssetsOrSharesArgs, type BlueAuthorizationAction, type BlueBorrowAction, type BlueRefinanceAction, type BlueRepayAction, type BlueRepayWithdrawCollateralAction, type BlueSupplyAction, type BlueSupplyCollateralAction, type BlueSupplyCollateralBorrowAction, type BlueWithdrawAction, type BlueWithdrawCollateralAction, type DepositAmountArgs, type ERC20ApprovalAction, type MorphoClientType, type PermitRequirementSignature, type ReallocationComputeOptions, type RepayAmountArgs, type Requirement, type RequirementSignature, type Transaction, type VaultReallocation } from "../../types/index.js";
|
|
5
5
|
import { ReallocationData } from "../reallocationData.js";
|
|
6
6
|
export interface BlueActions {
|
|
7
7
|
/**
|
|
@@ -32,10 +32,15 @@ export interface BlueActions {
|
|
|
32
32
|
supplyCollateral: (params: {
|
|
33
33
|
userAddress: Address;
|
|
34
34
|
} & DepositAmountArgs) => {
|
|
35
|
-
buildTx: (
|
|
35
|
+
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<BlueSupplyCollateralAction>>;
|
|
36
36
|
getRequirements: (params?: {
|
|
37
|
+
/**
|
|
38
|
+
* Prefer the ERC-2612 simple-permit path when the SDK detects support.
|
|
39
|
+
* Leave unset or set to `false` to force the Permit2/classic approval fallback when
|
|
40
|
+
* a token is known to be incompatible despite passing the SDK's shallow nonce probe.
|
|
41
|
+
*/
|
|
37
42
|
useSimplePermit?: boolean;
|
|
38
|
-
}) => Promise<(Readonly<Transaction<ERC20ApprovalAction>> | Requirement)[]>;
|
|
43
|
+
}) => Promise<(Readonly<Transaction<ERC20ApprovalAction>> | Requirement<PermitRequirementSignature>)[]>;
|
|
39
44
|
};
|
|
40
45
|
/**
|
|
41
46
|
* Prepares a loan-asset supply transaction.
|
|
@@ -55,10 +60,15 @@ export interface BlueActions {
|
|
|
55
60
|
marketData: Market;
|
|
56
61
|
slippageTolerance?: bigint;
|
|
57
62
|
} & DepositAmountArgs) => {
|
|
58
|
-
buildTx: (
|
|
63
|
+
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<BlueSupplyAction>>;
|
|
59
64
|
getRequirements: (params?: {
|
|
65
|
+
/**
|
|
66
|
+
* Prefer the ERC-2612 simple-permit path when the SDK detects support.
|
|
67
|
+
* Leave unset or set to `false` to force the Permit2/classic approval fallback when
|
|
68
|
+
* a token is known to be incompatible despite passing the SDK's shallow nonce probe.
|
|
69
|
+
*/
|
|
60
70
|
useSimplePermit?: boolean;
|
|
61
|
-
}) => Promise<(Readonly<Transaction<ERC20ApprovalAction>> | Requirement)[]>;
|
|
71
|
+
}) => Promise<(Readonly<Transaction<ERC20ApprovalAction>> | Requirement<PermitRequirementSignature>)[]>;
|
|
62
72
|
};
|
|
63
73
|
/**
|
|
64
74
|
* Prepares a loan-asset withdraw transaction.
|
|
@@ -89,8 +99,8 @@ export interface BlueActions {
|
|
|
89
99
|
slippageTolerance?: bigint;
|
|
90
100
|
reallocations?: readonly VaultReallocation[];
|
|
91
101
|
} & AssetsOrSharesArgs) => {
|
|
92
|
-
buildTx: () => Readonly<Transaction<BlueWithdrawAction>>;
|
|
93
|
-
getRequirements: () => Promise<Readonly<Transaction<
|
|
102
|
+
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<BlueWithdrawAction>>;
|
|
103
|
+
getRequirements: () => Promise<(Readonly<Transaction<BlueAuthorizationAction>> | Requirement)[]>;
|
|
94
104
|
};
|
|
95
105
|
/**
|
|
96
106
|
* Prepares a borrow transaction.
|
|
@@ -117,8 +127,8 @@ export interface BlueActions {
|
|
|
117
127
|
slippageTolerance?: bigint;
|
|
118
128
|
reallocations?: readonly VaultReallocation[];
|
|
119
129
|
}) => {
|
|
120
|
-
buildTx: () => Readonly<Transaction<BlueBorrowAction>>;
|
|
121
|
-
getRequirements: () => Promise<Readonly<Transaction<
|
|
130
|
+
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<BlueBorrowAction>>;
|
|
131
|
+
getRequirements: () => Promise<(Readonly<Transaction<BlueAuthorizationAction>> | Requirement)[]>;
|
|
122
132
|
};
|
|
123
133
|
/**
|
|
124
134
|
* Prepares a repay transaction.
|
|
@@ -143,10 +153,15 @@ export interface BlueActions {
|
|
|
143
153
|
positionData: AccrualPosition;
|
|
144
154
|
slippageTolerance?: bigint;
|
|
145
155
|
} & RepayAmountArgs) => {
|
|
146
|
-
buildTx: (
|
|
156
|
+
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<BlueRepayAction>>;
|
|
147
157
|
getRequirements: (params?: {
|
|
158
|
+
/**
|
|
159
|
+
* Prefer the ERC-2612 simple-permit path when the SDK detects support.
|
|
160
|
+
* Leave unset or set to `false` to force the Permit2/classic approval fallback when
|
|
161
|
+
* a token is known to be incompatible despite passing the SDK's shallow nonce probe.
|
|
162
|
+
*/
|
|
148
163
|
useSimplePermit?: boolean;
|
|
149
|
-
}) => Promise<(Readonly<Transaction<ERC20ApprovalAction>> | Requirement)[]>;
|
|
164
|
+
}) => Promise<(Readonly<Transaction<ERC20ApprovalAction>> | Requirement<PermitRequirementSignature>)[]>;
|
|
150
165
|
};
|
|
151
166
|
/**
|
|
152
167
|
* Prepares a withdraw-collateral transaction.
|
|
@@ -192,10 +207,15 @@ export interface BlueActions {
|
|
|
192
207
|
positionData: AccrualPosition;
|
|
193
208
|
slippageTolerance?: bigint;
|
|
194
209
|
} & RepayAmountArgs) => {
|
|
195
|
-
buildTx: (
|
|
210
|
+
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<BlueRepayWithdrawCollateralAction>>;
|
|
196
211
|
getRequirements: (params?: {
|
|
212
|
+
/**
|
|
213
|
+
* Prefer the ERC-2612 simple-permit path when the SDK detects support.
|
|
214
|
+
* Leave unset or set to `false` to force the Permit2/classic approval fallback when
|
|
215
|
+
* a token is known to be incompatible despite passing the SDK's shallow nonce probe.
|
|
216
|
+
*/
|
|
197
217
|
useSimplePermit?: boolean;
|
|
198
|
-
}) => Promise<(Readonly<Transaction<ERC20ApprovalAction>> | Readonly<Transaction<
|
|
218
|
+
}) => Promise<(Readonly<Transaction<ERC20ApprovalAction>> | Readonly<Transaction<BlueAuthorizationAction>> | Requirement)[]>;
|
|
199
219
|
};
|
|
200
220
|
/**
|
|
201
221
|
* Prepares an atomic supply-collateral-and-borrow transaction.
|
|
@@ -222,10 +242,15 @@ export interface BlueActions {
|
|
|
222
242
|
slippageTolerance?: bigint;
|
|
223
243
|
reallocations?: readonly VaultReallocation[];
|
|
224
244
|
} & DepositAmountArgs) => {
|
|
225
|
-
buildTx: (
|
|
245
|
+
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<BlueSupplyCollateralBorrowAction>>;
|
|
226
246
|
getRequirements: (params?: {
|
|
247
|
+
/**
|
|
248
|
+
* Prefer the ERC-2612 simple-permit path when the SDK detects support.
|
|
249
|
+
* Leave unset or set to `false` to force the Permit2/classic approval fallback when
|
|
250
|
+
* a token is known to be incompatible despite passing the SDK's shallow nonce probe.
|
|
251
|
+
*/
|
|
227
252
|
useSimplePermit?: boolean;
|
|
228
|
-
}) => Promise<(Readonly<Transaction<ERC20ApprovalAction>> | Readonly<Transaction<
|
|
253
|
+
}) => Promise<(Readonly<Transaction<ERC20ApprovalAction>> | Readonly<Transaction<BlueAuthorizationAction>> | Requirement)[]>;
|
|
229
254
|
};
|
|
230
255
|
/**
|
|
231
256
|
* Prepares an atomic refinance migrating this market's position to another Morpho Blue market
|
|
@@ -263,8 +288,8 @@ export interface BlueActions {
|
|
|
263
288
|
slippageTolerance?: bigint;
|
|
264
289
|
targetReallocations?: readonly VaultReallocation[];
|
|
265
290
|
}) => {
|
|
266
|
-
buildTx: () => Readonly<Transaction<BlueRefinanceAction>>;
|
|
267
|
-
getRequirements: () => Promise<Readonly<Transaction<
|
|
291
|
+
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<BlueRefinanceAction>>;
|
|
292
|
+
getRequirements: () => Promise<(Readonly<Transaction<BlueAuthorizationAction>> | Requirement)[]>;
|
|
268
293
|
};
|
|
269
294
|
/**
|
|
270
295
|
* Fetches all on-chain data needed to construct a {@link ReallocationData}
|
|
@@ -347,8 +372,8 @@ export declare class MorphoBlue implements BlueActions {
|
|
|
347
372
|
} & DepositAmountArgs): {
|
|
348
373
|
getRequirements: (params?: {
|
|
349
374
|
useSimplePermit?: boolean;
|
|
350
|
-
}) => Promise<(
|
|
351
|
-
buildTx: (
|
|
375
|
+
}) => Promise<(import("../../types/action.js").Bundler3TokenSignatureRequirement | Readonly<Transaction<ERC20ApprovalAction>>)[]>;
|
|
376
|
+
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<BlueSupplyAction>>;
|
|
352
377
|
};
|
|
353
378
|
withdraw(params: {
|
|
354
379
|
userAddress: Address;
|
|
@@ -357,16 +382,16 @@ export declare class MorphoBlue implements BlueActions {
|
|
|
357
382
|
slippageTolerance?: bigint;
|
|
358
383
|
reallocations?: readonly VaultReallocation[];
|
|
359
384
|
} & AssetsOrSharesArgs): {
|
|
360
|
-
getRequirements: () => Promise<Readonly<Transaction<
|
|
361
|
-
buildTx: () => Readonly<Transaction<BlueWithdrawAction>>;
|
|
385
|
+
getRequirements: () => Promise<(Readonly<Transaction<BlueAuthorizationAction>> | Requirement<import("../../types/action.js").AuthorizationRequirementSignature>)[]>;
|
|
386
|
+
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<BlueWithdrawAction>>;
|
|
362
387
|
};
|
|
363
388
|
supplyCollateral({ amount, userAddress, nativeAmount, }: {
|
|
364
389
|
userAddress: Address;
|
|
365
390
|
} & DepositAmountArgs): {
|
|
366
391
|
getRequirements: (params?: {
|
|
367
392
|
useSimplePermit?: boolean;
|
|
368
|
-
}) => Promise<(
|
|
369
|
-
buildTx: (
|
|
393
|
+
}) => Promise<(import("../../types/action.js").Bundler3TokenSignatureRequirement | Readonly<Transaction<ERC20ApprovalAction>>)[]>;
|
|
394
|
+
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<BlueSupplyCollateralAction>>;
|
|
370
395
|
};
|
|
371
396
|
borrow({ amount, userAddress, positionData, slippageTolerance, reallocations, }: {
|
|
372
397
|
amount: bigint;
|
|
@@ -375,8 +400,8 @@ export declare class MorphoBlue implements BlueActions {
|
|
|
375
400
|
slippageTolerance?: bigint;
|
|
376
401
|
reallocations?: readonly VaultReallocation[];
|
|
377
402
|
}): {
|
|
378
|
-
getRequirements: () => Promise<Readonly<Transaction<
|
|
379
|
-
buildTx: () => Readonly<Transaction<BlueBorrowAction>>;
|
|
403
|
+
getRequirements: () => Promise<(Readonly<Transaction<BlueAuthorizationAction>> | Requirement<import("../../types/action.js").AuthorizationRequirementSignature>)[]>;
|
|
404
|
+
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<BlueBorrowAction>>;
|
|
380
405
|
};
|
|
381
406
|
repay(params: {
|
|
382
407
|
userAddress: Address;
|
|
@@ -385,8 +410,8 @@ export declare class MorphoBlue implements BlueActions {
|
|
|
385
410
|
} & RepayAmountArgs): {
|
|
386
411
|
getRequirements: (reqParams?: {
|
|
387
412
|
useSimplePermit?: boolean;
|
|
388
|
-
}) => Promise<(
|
|
389
|
-
buildTx: (
|
|
413
|
+
}) => Promise<(import("../../types/action.js").Bundler3TokenSignatureRequirement | Readonly<Transaction<ERC20ApprovalAction>>)[]>;
|
|
414
|
+
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<BlueRepayAction>>;
|
|
390
415
|
};
|
|
391
416
|
withdrawCollateral({ userAddress, amount, positionData, }: {
|
|
392
417
|
userAddress: Address;
|
|
@@ -403,8 +428,8 @@ export declare class MorphoBlue implements BlueActions {
|
|
|
403
428
|
} & RepayAmountArgs): {
|
|
404
429
|
getRequirements: (reqParams?: {
|
|
405
430
|
useSimplePermit?: boolean;
|
|
406
|
-
}) => Promise<(
|
|
407
|
-
buildTx: (
|
|
431
|
+
}) => Promise<(import("../../types/action.js").Bundler3TokenSignatureRequirement | Readonly<Transaction<ERC20ApprovalAction>> | Readonly<Transaction<BlueAuthorizationAction>> | Requirement<import("../../types/action.js").AuthorizationRequirementSignature>)[]>;
|
|
432
|
+
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<BlueRepayWithdrawCollateralAction>>;
|
|
408
433
|
};
|
|
409
434
|
supplyCollateralBorrow({ amount, userAddress, positionData, borrowAmount, nativeAmount, slippageTolerance, reallocations, }: {
|
|
410
435
|
userAddress: Address;
|
|
@@ -415,8 +440,8 @@ export declare class MorphoBlue implements BlueActions {
|
|
|
415
440
|
} & DepositAmountArgs): {
|
|
416
441
|
getRequirements: (params?: {
|
|
417
442
|
useSimplePermit?: boolean;
|
|
418
|
-
}) => Promise<(
|
|
419
|
-
buildTx: (
|
|
443
|
+
}) => Promise<(import("../../types/action.js").Bundler3TokenSignatureRequirement | Readonly<Transaction<ERC20ApprovalAction>> | Readonly<Transaction<BlueAuthorizationAction>> | Requirement<import("../../types/action.js").AuthorizationRequirementSignature>)[]>;
|
|
444
|
+
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<BlueSupplyCollateralBorrowAction>>;
|
|
420
445
|
};
|
|
421
446
|
refinance({ userAddress, positionData, target, collateralAmount, borrowAssets, borrowShares, slippageTolerance, targetReallocations, }: {
|
|
422
447
|
userAddress: Address;
|
|
@@ -431,8 +456,8 @@ export declare class MorphoBlue implements BlueActions {
|
|
|
431
456
|
slippageTolerance?: bigint;
|
|
432
457
|
targetReallocations?: readonly VaultReallocation[];
|
|
433
458
|
}): {
|
|
434
|
-
getRequirements: () => Promise<Readonly<Transaction<
|
|
435
|
-
buildTx: () => Readonly<Transaction<BlueRefinanceAction>>;
|
|
459
|
+
getRequirements: () => Promise<(Readonly<Transaction<BlueAuthorizationAction>> | Requirement<import("../../types/action.js").AuthorizationRequirementSignature>)[]>;
|
|
460
|
+
buildTx: (signatures?: readonly RequirementSignature[]) => Readonly<Transaction<BlueRefinanceAction>>;
|
|
436
461
|
};
|
|
437
462
|
/**
|
|
438
463
|
* Fetches all on-chain inputs needed to compute public allocator reallocations.
|