@morpho-org/morpho-sdk 4.1.0 → 5.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 +12 -12
- package/lib/cjs/actions/blue/borrow.d.ts +12 -2
- package/lib/cjs/actions/blue/borrow.js +7 -1
- 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 +6 -5
- package/lib/cjs/actions/blue/repay.js +10 -18
- package/lib/cjs/actions/blue/repayWithdrawCollateral.d.ts +15 -6
- package/lib/cjs/actions/blue/repayWithdrawCollateral.js +16 -18
- package/lib/cjs/actions/blue/supply.d.ts +7 -7
- package/lib/cjs/actions/blue/supply.js +10 -20
- package/lib/cjs/actions/blue/supplyCollateral.d.ts +8 -8
- package/lib/cjs/actions/blue/supplyCollateral.js +11 -21
- package/lib/cjs/actions/blue/supplyCollateralBorrow.d.ts +18 -6
- package/lib/cjs/actions/blue/supplyCollateralBorrow.js +17 -19
- 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 +171 -125
- package/lib/cjs/entities/reallocationData.d.ts +12 -12
- package/lib/cjs/entities/reallocationData.js +19 -19
- 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/validate.d.ts +2 -2
- package/lib/cjs/helpers/validate.js +1 -1
- package/lib/cjs/types/action.d.ts +113 -9
- package/lib/cjs/types/action.js +79 -5
- package/lib/cjs/types/error.d.ts +73 -0
- package/lib/cjs/types/error.js +89 -4
- package/lib/cjs/types.d.ts +2 -1
- package/lib/cjs/utils.d.ts +1 -1
- package/lib/cjs/utils.js +2 -3
- package/lib/esm/actions/blue/borrow.d.ts +12 -2
- package/lib/esm/actions/blue/borrow.js +7 -1
- 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 +6 -5
- package/lib/esm/actions/blue/repay.js +10 -18
- package/lib/esm/actions/blue/repayWithdrawCollateral.d.ts +15 -6
- package/lib/esm/actions/blue/repayWithdrawCollateral.js +16 -18
- package/lib/esm/actions/blue/supply.d.ts +7 -7
- package/lib/esm/actions/blue/supply.js +10 -20
- package/lib/esm/actions/blue/supplyCollateral.d.ts +8 -8
- package/lib/esm/actions/blue/supplyCollateral.js +11 -21
- package/lib/esm/actions/blue/supplyCollateralBorrow.d.ts +18 -6
- package/lib/esm/actions/blue/supplyCollateralBorrow.js +17 -19
- 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 +173 -127
- package/lib/esm/entities/reallocationData.d.ts +12 -12
- package/lib/esm/entities/reallocationData.js +18 -18
- 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/validate.d.ts +2 -2
- package/lib/esm/helpers/validate.js +1 -1
- package/lib/esm/types/action.d.ts +113 -9
- package/lib/esm/types/action.js +75 -4
- package/lib/esm/types/error.d.ts +73 -0
- package/lib/esm/types/error.js +84 -2
- package/lib/esm/types.d.ts +2 -1
- package/lib/esm/utils.d.ts +1 -1
- package/lib/esm/utils.js +1 -1
- package/package.json +6 -6
- 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
|
@@ -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.
|
|
@@ -60,7 +60,7 @@ class MorphoBlue {
|
|
|
60
60
|
slippageTolerance,
|
|
61
61
|
});
|
|
62
62
|
return {
|
|
63
|
-
getRequirements: (params) => (0, index_js_1.
|
|
63
|
+
getRequirements: (params) => (0, index_js_1.getGeneralAdapterRequirements)(this.client.viemClient, {
|
|
64
64
|
address: this.marketParams.loanToken,
|
|
65
65
|
chainId: this.chainId,
|
|
66
66
|
supportSignature: this.client.options.supportSignature,
|
|
@@ -68,17 +68,22 @@ class MorphoBlue {
|
|
|
68
68
|
useSimplePermit: params?.useSimplePermit,
|
|
69
69
|
args: { amount, from: userAddress },
|
|
70
70
|
}),
|
|
71
|
-
buildTx: (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
71
|
+
buildTx: (signatures) => {
|
|
72
|
+
const { permit } = (0, index_js_3.selectRequirementSignatures)(signatures, {
|
|
73
|
+
permit: true,
|
|
74
|
+
});
|
|
75
|
+
return (0, index_js_1.blueSupply)({
|
|
76
|
+
market: { chainId: this.chainId, marketParams: this.marketParams },
|
|
77
|
+
args: {
|
|
78
|
+
amount,
|
|
79
|
+
nativeAmount,
|
|
80
|
+
onBehalf: userAddress,
|
|
81
|
+
maxSharePrice,
|
|
82
|
+
requirementSignature: permit,
|
|
83
|
+
},
|
|
84
|
+
metadata: this.client.options.metadata,
|
|
85
|
+
});
|
|
86
|
+
},
|
|
82
87
|
};
|
|
83
88
|
}
|
|
84
89
|
withdraw(params) {
|
|
@@ -129,24 +134,31 @@ class MorphoBlue {
|
|
|
129
134
|
});
|
|
130
135
|
return {
|
|
131
136
|
getRequirements: async () => {
|
|
132
|
-
const authTx = await (0, index_js_1.
|
|
137
|
+
const authTx = await (0, index_js_1.getBlueAuthorizationRequirement)({
|
|
133
138
|
viemClient: this.client.viemClient,
|
|
134
139
|
chainId: this.chainId,
|
|
135
140
|
userAddress,
|
|
141
|
+
supportSignature: this.client.options.supportSignature,
|
|
136
142
|
});
|
|
137
143
|
return authTx ? [authTx] : [];
|
|
138
144
|
},
|
|
139
|
-
buildTx: () =>
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
145
|
+
buildTx: (signatures) => {
|
|
146
|
+
const { authorization } = (0, index_js_3.selectRequirementSignatures)(signatures, {
|
|
147
|
+
authorization: true,
|
|
148
|
+
});
|
|
149
|
+
return (0, index_js_1.blueWithdraw)({
|
|
150
|
+
market: { chainId: this.chainId, marketParams: this.marketParams },
|
|
151
|
+
args: {
|
|
152
|
+
assets,
|
|
153
|
+
shares,
|
|
154
|
+
receiver,
|
|
155
|
+
minSharePrice,
|
|
156
|
+
reallocations,
|
|
157
|
+
authorizationSignature: authorization,
|
|
158
|
+
},
|
|
159
|
+
metadata: this.client.options.metadata,
|
|
160
|
+
});
|
|
161
|
+
},
|
|
150
162
|
};
|
|
151
163
|
}
|
|
152
164
|
supplyCollateral({ amount = 0n, userAddress, nativeAmount, }) {
|
|
@@ -165,7 +177,7 @@ class MorphoBlue {
|
|
|
165
177
|
(0, index_js_2.validateNativeAsset)(this.chainId, this.marketParams.collateralToken);
|
|
166
178
|
}
|
|
167
179
|
return {
|
|
168
|
-
getRequirements: (params) => (0, index_js_1.
|
|
180
|
+
getRequirements: (params) => (0, index_js_1.getGeneralAdapterRequirements)(this.client.viemClient, {
|
|
169
181
|
address: this.marketParams.collateralToken,
|
|
170
182
|
chainId: this.chainId,
|
|
171
183
|
supportSignature: this.client.options.supportSignature,
|
|
@@ -173,19 +185,24 @@ class MorphoBlue {
|
|
|
173
185
|
useSimplePermit: params?.useSimplePermit,
|
|
174
186
|
args: { amount, from: userAddress },
|
|
175
187
|
}),
|
|
176
|
-
buildTx: (
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
188
|
+
buildTx: (signatures) => {
|
|
189
|
+
const { permit } = (0, index_js_3.selectRequirementSignatures)(signatures, {
|
|
190
|
+
permit: true,
|
|
191
|
+
});
|
|
192
|
+
return (0, index_js_1.blueSupplyCollateral)({
|
|
193
|
+
market: {
|
|
194
|
+
chainId: this.chainId,
|
|
195
|
+
marketParams: this.marketParams,
|
|
196
|
+
},
|
|
197
|
+
args: {
|
|
198
|
+
amount,
|
|
199
|
+
nativeAmount,
|
|
200
|
+
onBehalf: userAddress,
|
|
201
|
+
requirementSignature: permit,
|
|
202
|
+
},
|
|
203
|
+
metadata: this.client.options.metadata,
|
|
204
|
+
});
|
|
205
|
+
},
|
|
189
206
|
};
|
|
190
207
|
}
|
|
191
208
|
borrow({ amount, userAddress, positionData, slippageTolerance = blue_sdk_1.DEFAULT_SLIPPAGE_TOLERANCE, reallocations, }) {
|
|
@@ -216,26 +233,33 @@ class MorphoBlue {
|
|
|
216
233
|
});
|
|
217
234
|
return {
|
|
218
235
|
getRequirements: async () => {
|
|
219
|
-
const authTx = await (0, index_js_1.
|
|
236
|
+
const authTx = await (0, index_js_1.getBlueAuthorizationRequirement)({
|
|
220
237
|
viemClient: this.client.viemClient,
|
|
221
238
|
chainId: this.chainId,
|
|
222
239
|
userAddress,
|
|
240
|
+
supportSignature: this.client.options.supportSignature,
|
|
223
241
|
});
|
|
224
242
|
return authTx ? [authTx] : [];
|
|
225
243
|
},
|
|
226
|
-
buildTx: () =>
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
244
|
+
buildTx: (signatures) => {
|
|
245
|
+
const { authorization } = (0, index_js_3.selectRequirementSignatures)(signatures, {
|
|
246
|
+
authorization: true,
|
|
247
|
+
});
|
|
248
|
+
return (0, index_js_1.blueBorrow)({
|
|
249
|
+
market: {
|
|
250
|
+
chainId: this.chainId,
|
|
251
|
+
marketParams: this.marketParams,
|
|
252
|
+
},
|
|
253
|
+
args: {
|
|
254
|
+
amount,
|
|
255
|
+
receiver: userAddress,
|
|
256
|
+
minSharePrice,
|
|
257
|
+
reallocations,
|
|
258
|
+
authorizationSignature: authorization,
|
|
259
|
+
},
|
|
260
|
+
metadata: this.client.options.metadata,
|
|
261
|
+
});
|
|
262
|
+
},
|
|
239
263
|
};
|
|
240
264
|
}
|
|
241
265
|
repay(params) {
|
|
@@ -301,7 +325,7 @@ class MorphoBlue {
|
|
|
301
325
|
slippageTolerance,
|
|
302
326
|
});
|
|
303
327
|
return {
|
|
304
|
-
getRequirements: (reqParams) => (0, index_js_1.
|
|
328
|
+
getRequirements: (reqParams) => (0, index_js_1.getGeneralAdapterRequirements)(this.client.viemClient, {
|
|
305
329
|
address: this.marketParams.loanToken,
|
|
306
330
|
chainId: this.chainId,
|
|
307
331
|
supportSignature: this.client.options.supportSignature,
|
|
@@ -309,22 +333,27 @@ class MorphoBlue {
|
|
|
309
333
|
useSimplePermit: reqParams?.useSimplePermit,
|
|
310
334
|
args: { amount: transferAmount, from: userAddress },
|
|
311
335
|
}),
|
|
312
|
-
buildTx: (
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
336
|
+
buildTx: (signatures) => {
|
|
337
|
+
const { permit } = (0, index_js_3.selectRequirementSignatures)(signatures, {
|
|
338
|
+
permit: true,
|
|
339
|
+
});
|
|
340
|
+
return (0, index_js_1.blueRepay)({
|
|
341
|
+
market: {
|
|
342
|
+
chainId: this.chainId,
|
|
343
|
+
marketParams: this.marketParams,
|
|
344
|
+
},
|
|
345
|
+
args: {
|
|
346
|
+
assets,
|
|
347
|
+
shares,
|
|
348
|
+
transferAmount,
|
|
349
|
+
onBehalf: userAddress,
|
|
350
|
+
receiver: userAddress,
|
|
351
|
+
maxSharePrice,
|
|
352
|
+
requirementSignature: permit,
|
|
353
|
+
},
|
|
354
|
+
metadata: this.client.options.metadata,
|
|
355
|
+
});
|
|
356
|
+
},
|
|
328
357
|
};
|
|
329
358
|
}
|
|
330
359
|
withdrawCollateral({ userAddress, amount, positionData, }) {
|
|
@@ -450,7 +479,7 @@ class MorphoBlue {
|
|
|
450
479
|
return {
|
|
451
480
|
getRequirements: async (reqParams) => {
|
|
452
481
|
const [erc20Requirements, authTx] = await Promise.all([
|
|
453
|
-
(0, index_js_1.
|
|
482
|
+
(0, index_js_1.getGeneralAdapterRequirements)(this.client.viemClient, {
|
|
454
483
|
address: this.marketParams.loanToken,
|
|
455
484
|
chainId: this.chainId,
|
|
456
485
|
supportSignature: this.client.options.supportSignature,
|
|
@@ -458,31 +487,36 @@ class MorphoBlue {
|
|
|
458
487
|
useSimplePermit: reqParams?.useSimplePermit,
|
|
459
488
|
args: { amount: transferAmount, from: userAddress },
|
|
460
489
|
}),
|
|
461
|
-
(0, index_js_1.
|
|
490
|
+
(0, index_js_1.getBlueAuthorizationRequirement)({
|
|
462
491
|
viemClient: this.client.viemClient,
|
|
463
492
|
chainId: this.chainId,
|
|
464
493
|
userAddress,
|
|
494
|
+
supportSignature: this.client.options.supportSignature,
|
|
465
495
|
}),
|
|
466
496
|
]);
|
|
467
497
|
return [...erc20Requirements, ...(authTx ? [authTx] : [])];
|
|
468
498
|
},
|
|
469
|
-
buildTx: (
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
499
|
+
buildTx: (signatures) => {
|
|
500
|
+
const { permit, authorization } = (0, index_js_3.selectRequirementSignatures)(signatures, { permit: true, authorization: true });
|
|
501
|
+
return (0, index_js_1.blueRepayWithdrawCollateral)({
|
|
502
|
+
market: {
|
|
503
|
+
chainId: this.chainId,
|
|
504
|
+
marketParams: this.marketParams,
|
|
505
|
+
},
|
|
506
|
+
args: {
|
|
507
|
+
assets,
|
|
508
|
+
shares,
|
|
509
|
+
transferAmount,
|
|
510
|
+
withdrawAmount,
|
|
511
|
+
onBehalf: userAddress,
|
|
512
|
+
receiver: userAddress,
|
|
513
|
+
maxSharePrice,
|
|
514
|
+
requirementSignature: permit,
|
|
515
|
+
authorizationSignature: authorization,
|
|
516
|
+
},
|
|
517
|
+
metadata: this.client.options.metadata,
|
|
518
|
+
});
|
|
519
|
+
},
|
|
486
520
|
};
|
|
487
521
|
}
|
|
488
522
|
supplyCollateralBorrow({ amount = 0n, userAddress, positionData, borrowAmount, nativeAmount, slippageTolerance = blue_sdk_1.DEFAULT_SLIPPAGE_TOLERANCE, reallocations, }) {
|
|
@@ -527,7 +561,7 @@ class MorphoBlue {
|
|
|
527
561
|
return {
|
|
528
562
|
getRequirements: async (params) => {
|
|
529
563
|
const [erc20Requirements, authTx] = await Promise.all([
|
|
530
|
-
(0, index_js_1.
|
|
564
|
+
(0, index_js_1.getGeneralAdapterRequirements)(this.client.viemClient, {
|
|
531
565
|
address: this.marketParams.collateralToken,
|
|
532
566
|
chainId: this.chainId,
|
|
533
567
|
supportSignature: this.client.options.supportSignature,
|
|
@@ -535,31 +569,36 @@ class MorphoBlue {
|
|
|
535
569
|
useSimplePermit: params?.useSimplePermit,
|
|
536
570
|
args: { amount, from: userAddress },
|
|
537
571
|
}),
|
|
538
|
-
(0, index_js_1.
|
|
572
|
+
(0, index_js_1.getBlueAuthorizationRequirement)({
|
|
539
573
|
viemClient: this.client.viemClient,
|
|
540
574
|
chainId: this.chainId,
|
|
541
575
|
userAddress,
|
|
576
|
+
supportSignature: this.client.options.supportSignature,
|
|
542
577
|
}),
|
|
543
578
|
]);
|
|
544
579
|
return [...erc20Requirements, ...(authTx ? [authTx] : [])];
|
|
545
580
|
},
|
|
546
|
-
buildTx: (
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
581
|
+
buildTx: (signatures) => {
|
|
582
|
+
const { permit, authorization } = (0, index_js_3.selectRequirementSignatures)(signatures, { permit: true, authorization: true });
|
|
583
|
+
return (0, index_js_1.blueSupplyCollateralBorrow)({
|
|
584
|
+
market: {
|
|
585
|
+
chainId: this.chainId,
|
|
586
|
+
marketParams: this.marketParams,
|
|
587
|
+
},
|
|
588
|
+
args: {
|
|
589
|
+
amount,
|
|
590
|
+
nativeAmount,
|
|
591
|
+
borrowAmount,
|
|
592
|
+
onBehalf: userAddress,
|
|
593
|
+
receiver: userAddress,
|
|
594
|
+
minSharePrice,
|
|
595
|
+
requirementSignature: permit,
|
|
596
|
+
authorizationSignature: authorization,
|
|
597
|
+
reallocations,
|
|
598
|
+
},
|
|
599
|
+
metadata: this.client.options.metadata,
|
|
600
|
+
});
|
|
601
|
+
},
|
|
563
602
|
};
|
|
564
603
|
}
|
|
565
604
|
refinance({ userAddress, positionData, target, collateralAmount, borrowAssets, borrowShares, slippageTolerance = blue_sdk_1.DEFAULT_SLIPPAGE_TOLERANCE, targetReallocations, }) {
|
|
@@ -693,30 +732,37 @@ class MorphoBlue {
|
|
|
693
732
|
: 0n;
|
|
694
733
|
return {
|
|
695
734
|
getRequirements: async () => {
|
|
696
|
-
const authTx = await (0, index_js_1.
|
|
735
|
+
const authTx = await (0, index_js_1.getBlueAuthorizationRequirement)({
|
|
697
736
|
viemClient: this.client.viemClient,
|
|
698
737
|
chainId: this.chainId,
|
|
699
738
|
userAddress,
|
|
739
|
+
supportSignature: this.client.options.supportSignature,
|
|
700
740
|
});
|
|
701
741
|
return authTx ? [authTx] : [];
|
|
702
742
|
},
|
|
703
|
-
buildTx: () =>
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
743
|
+
buildTx: (signatures) => {
|
|
744
|
+
const { authorization } = (0, index_js_3.selectRequirementSignatures)(signatures, {
|
|
745
|
+
authorization: true,
|
|
746
|
+
});
|
|
747
|
+
return (0, index_js_1.blueRefinance)({
|
|
748
|
+
source: {
|
|
749
|
+
chainId: this.chainId,
|
|
750
|
+
marketParams: this.marketParams,
|
|
751
|
+
},
|
|
752
|
+
target: { marketParams: target.marketParams },
|
|
753
|
+
args: {
|
|
754
|
+
user: userAddress,
|
|
755
|
+
collateralAmount,
|
|
756
|
+
borrowAssets: borrowAssetsAdjusted,
|
|
757
|
+
borrowShares: requestedShares,
|
|
758
|
+
minBorrowSharePrice,
|
|
759
|
+
maxRepaySharePrice,
|
|
760
|
+
targetReallocations,
|
|
761
|
+
authorizationSignature: authorization,
|
|
762
|
+
},
|
|
763
|
+
metadata: this.client.options.metadata,
|
|
764
|
+
});
|
|
765
|
+
},
|
|
720
766
|
};
|
|
721
767
|
}
|
|
722
768
|
/**
|