@morpho-org/morpho-sdk 5.4.1 → 5.5.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 +15 -1
- package/lib/cjs/abis.d.ts +313 -0
- package/lib/cjs/abis.js +167 -1
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.d.ts +1 -1
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +9 -2
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.d.ts +64 -0
- package/lib/cjs/actions/requirements/encode/encodeVaultSharesPermit.js +131 -0
- package/lib/cjs/actions/requirements/encode/index.d.ts +1 -0
- package/lib/cjs/actions/requirements/encode/index.js +1 -0
- package/lib/cjs/actions/requirements/getRequirementsApproval.d.ts +3 -2
- package/lib/cjs/actions/requirements/getRequirementsApproval.js +3 -2
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +52 -0
- package/lib/cjs/actions/signatures/getVaultExitBundlesV1PermitStruct.js +91 -0
- package/lib/cjs/actions/signatures/index.d.ts +1 -0
- package/lib/cjs/actions/signatures/index.js +1 -0
- package/lib/cjs/actions/vaultV1/inKindRedeem.d.ts +54 -0
- package/lib/cjs/actions/vaultV1/inKindRedeem.js +96 -0
- package/lib/cjs/actions/vaultV1/index.d.ts +1 -0
- package/lib/cjs/actions/vaultV1/index.js +1 -0
- package/lib/cjs/actions/vaultV2/inKindRedeem.d.ts +56 -0
- package/lib/cjs/actions/vaultV2/inKindRedeem.js +97 -0
- package/lib/cjs/actions/vaultV2/index.d.ts +1 -0
- package/lib/cjs/actions/vaultV2/index.js +1 -0
- package/lib/cjs/bundler/actions.d.ts +1 -2
- package/lib/cjs/bundler/actions.js +1 -2
- package/lib/cjs/entities/blue/blue.d.ts +8 -8
- package/lib/cjs/entities/reallocationData.d.ts +1 -2
- package/lib/cjs/entities/reallocationData.js +1 -2
- package/lib/cjs/entities/vaultV1/vaultV1.d.ts +82 -4
- package/lib/cjs/entities/vaultV1/vaultV1.js +164 -0
- package/lib/cjs/entities/vaultV2/vaultV2.d.ts +89 -3
- package/lib/cjs/entities/vaultV2/vaultV2.js +181 -0
- package/lib/cjs/helpers/index.d.ts +1 -0
- package/lib/cjs/helpers/index.js +3 -1
- package/lib/cjs/helpers/previewVaultV2InKindRedeem.d.ts +49 -0
- package/lib/cjs/helpers/previewVaultV2InKindRedeem.js +73 -0
- package/lib/cjs/helpers/validate.d.ts +1 -1
- package/lib/cjs/helpers/validateRequirementSpender.d.ts +1 -1
- package/lib/cjs/helpers/validateRequirementSpender.js +2 -1
- package/lib/cjs/types/action.d.ts +21 -1
- package/lib/cjs/types/error.d.ts +139 -0
- package/lib/cjs/types/error.js +189 -2
- package/lib/esm/abis.d.ts +313 -0
- package/lib/esm/abis.js +166 -0
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.d.ts +1 -1
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +9 -2
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.d.ts +64 -0
- package/lib/esm/actions/requirements/encode/encodeVaultSharesPermit.js +127 -0
- package/lib/esm/actions/requirements/encode/index.d.ts +1 -0
- package/lib/esm/actions/requirements/encode/index.js +1 -0
- package/lib/esm/actions/requirements/getRequirementsApproval.d.ts +3 -2
- package/lib/esm/actions/requirements/getRequirementsApproval.js +3 -2
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.d.ts +52 -0
- package/lib/esm/actions/signatures/getVaultExitBundlesV1PermitStruct.js +87 -0
- package/lib/esm/actions/signatures/index.d.ts +1 -0
- package/lib/esm/actions/signatures/index.js +1 -0
- package/lib/esm/actions/vaultV1/inKindRedeem.d.ts +54 -0
- package/lib/esm/actions/vaultV1/inKindRedeem.js +92 -0
- package/lib/esm/actions/vaultV1/index.d.ts +1 -0
- package/lib/esm/actions/vaultV1/index.js +1 -0
- package/lib/esm/actions/vaultV2/inKindRedeem.d.ts +56 -0
- package/lib/esm/actions/vaultV2/inKindRedeem.js +93 -0
- package/lib/esm/actions/vaultV2/index.d.ts +1 -0
- package/lib/esm/actions/vaultV2/index.js +1 -0
- package/lib/esm/bundler/actions.d.ts +1 -2
- package/lib/esm/bundler/actions.js +1 -2
- package/lib/esm/entities/blue/blue.d.ts +5 -5
- package/lib/esm/entities/reallocationData.d.ts +1 -2
- package/lib/esm/entities/reallocationData.js +1 -2
- package/lib/esm/entities/vaultV1/vaultV1.d.ts +80 -2
- package/lib/esm/entities/vaultV1/vaultV1.js +170 -6
- package/lib/esm/entities/vaultV2/vaultV2.d.ts +88 -2
- package/lib/esm/entities/vaultV2/vaultV2.js +187 -6
- package/lib/esm/helpers/index.d.ts +1 -0
- package/lib/esm/helpers/index.js +1 -0
- package/lib/esm/helpers/previewVaultV2InKindRedeem.d.ts +49 -0
- package/lib/esm/helpers/previewVaultV2InKindRedeem.js +70 -0
- package/lib/esm/helpers/validate.d.ts +1 -1
- package/lib/esm/helpers/validateRequirementSpender.d.ts +1 -1
- package/lib/esm/helpers/validateRequirementSpender.js +2 -1
- package/lib/esm/types/action.d.ts +21 -1
- package/lib/esm/types/error.d.ts +139 -0
- package/lib/esm/types/error.js +175 -0
- package/package.json +9 -11
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.encodeVaultSharesPermit = void 0;
|
|
4
|
+
const blue_sdk_1 = require("@morpho-org/blue-sdk");
|
|
5
|
+
const blue_sdk_viem_1 = require("@morpho-org/blue-sdk-viem");
|
|
6
|
+
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
7
|
+
const viem_1 = require("viem");
|
|
8
|
+
const signAndVerifyTypedData_js_1 = require("../../../helpers/signAndVerifyTypedData.js");
|
|
9
|
+
const validate_js_1 = require("../../../helpers/validate.js");
|
|
10
|
+
const validateRequirementSpender_js_1 = require("../../../helpers/validateRequirementSpender.js");
|
|
11
|
+
/**
|
|
12
|
+
* Builds the bounded ERC-2612 shares-permit requirement used by an in-kind vault exit.
|
|
13
|
+
*
|
|
14
|
+
* Vault V1 uses the standard token permit domain. Vault V2 uses its protocol-specific domain with
|
|
15
|
+
* only `chainId` and `verifyingContract`.
|
|
16
|
+
*
|
|
17
|
+
* @param params.vault - Vault share token, including V1 permit-domain metadata when available.
|
|
18
|
+
* @param params.version - Vault generation selecting the standard V1 or two-field V2 domain.
|
|
19
|
+
* @param params.spender - Registered VaultExitBundlesV1 spender.
|
|
20
|
+
* @param params.owner - Account that owns and authorizes spending of the vault shares.
|
|
21
|
+
* @param params.chainId - Chain on which the vault and spender are deployed.
|
|
22
|
+
* @param params.nonce - Current vault permit nonce for the owner.
|
|
23
|
+
* @param params.amount - Vault-share allowance to authorize.
|
|
24
|
+
* @param params.deadline - Shared permit and bundle deadline.
|
|
25
|
+
* @returns A requirement whose `sign()` result can be embedded in VaultExitBundlesV1 calldata.
|
|
26
|
+
* @throws {UnsupportedChainIdError} when no address registry exists for `chainId`.
|
|
27
|
+
* @throws {UnsupportedErc20ApprovalSpenderError} when `spender` is not the registered VaultExitBundlesV1.
|
|
28
|
+
* @throws {MissingClientPropertyError} from `sign()` when the wallet has no account.
|
|
29
|
+
* @throws {AddressMismatchError} from `sign()` when the wallet account differs from `owner`.
|
|
30
|
+
* @throws {ChainIdMismatchError} from `sign()` when the wallet targets another chain.
|
|
31
|
+
* @throws {InvalidSignatureError} from `sign()` when signature recovery fails.
|
|
32
|
+
* @throws {InvalidPermitDomainChainIdError} from `sign()` when a Vault V1 permit domain targets another chain or omits `chainId`.
|
|
33
|
+
* @throws {InvalidPermitDomainVerifyingContractError} from `sign()` when a Vault V1 permit domain targets another token or omits `verifyingContract`.
|
|
34
|
+
* @throws {UnsupportedPermitDomainExtensionsError} from `sign()` when a Vault V1 permit domain advertises unsupported extensions.
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* import { encodeVaultSharesPermit } from "@morpho-org/morpho-sdk";
|
|
38
|
+
*
|
|
39
|
+
* const requirement = encodeVaultSharesPermit({
|
|
40
|
+
* vault: vaultData,
|
|
41
|
+
* version: "vaultV2",
|
|
42
|
+
* spender: vaultExitBundlesV1,
|
|
43
|
+
* owner,
|
|
44
|
+
* chainId: 1,
|
|
45
|
+
* nonce: 0n,
|
|
46
|
+
* amount: 1_000_000n,
|
|
47
|
+
* deadline,
|
|
48
|
+
* });
|
|
49
|
+
* const signature = await requirement.sign(walletClient, owner);
|
|
50
|
+
* // signature satisfies PermitRequirementSignature
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
const encodeVaultSharesPermit = (params) => {
|
|
54
|
+
const { vault: inputVault, version, spender, owner, chainId, nonce, amount, deadline, } = params;
|
|
55
|
+
const inputDomain = inputVault.eip5267Domain;
|
|
56
|
+
const vault = new blue_sdk_1.Token({
|
|
57
|
+
address: inputVault.address,
|
|
58
|
+
name: inputVault.name,
|
|
59
|
+
eip5267Domain: version === "vaultV2"
|
|
60
|
+
? new blue_sdk_1.Eip5267Domain({
|
|
61
|
+
// Only the bitmap-selected fields enter Vault V2's domain separator.
|
|
62
|
+
fields: "0x0c",
|
|
63
|
+
name: "",
|
|
64
|
+
version: "",
|
|
65
|
+
chainId: BigInt(chainId),
|
|
66
|
+
verifyingContract: inputVault.address,
|
|
67
|
+
salt: viem_1.zeroHash,
|
|
68
|
+
extensions: [],
|
|
69
|
+
})
|
|
70
|
+
: inputDomain == null
|
|
71
|
+
? undefined
|
|
72
|
+
: new blue_sdk_1.Eip5267Domain({
|
|
73
|
+
fields: inputDomain.fields,
|
|
74
|
+
name: inputDomain.name,
|
|
75
|
+
version: inputDomain.version,
|
|
76
|
+
chainId: inputDomain.chainId,
|
|
77
|
+
verifyingContract: inputDomain.verifyingContract,
|
|
78
|
+
salt: inputDomain.salt,
|
|
79
|
+
extensions: [...inputDomain.extensions],
|
|
80
|
+
}),
|
|
81
|
+
});
|
|
82
|
+
// Bind the permit to the standalone vault-exit deployment for this chain.
|
|
83
|
+
(0, validateRequirementSpender_js_1.validateRequirementSpender)({
|
|
84
|
+
chainId,
|
|
85
|
+
spender,
|
|
86
|
+
allowed: ["vaultExitBundlesV1"],
|
|
87
|
+
});
|
|
88
|
+
const action = {
|
|
89
|
+
type: "permit",
|
|
90
|
+
args: {
|
|
91
|
+
spender,
|
|
92
|
+
amount,
|
|
93
|
+
deadline,
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
return {
|
|
97
|
+
action,
|
|
98
|
+
async sign(client, userAddress) {
|
|
99
|
+
// The bundle spends msg.sender's shares, so another signer cannot authorize this exit.
|
|
100
|
+
(0, validate_js_1.validateUserAddress)(userAddress, owner);
|
|
101
|
+
const permit = {
|
|
102
|
+
owner,
|
|
103
|
+
spender,
|
|
104
|
+
allowance: amount,
|
|
105
|
+
nonce,
|
|
106
|
+
deadline,
|
|
107
|
+
};
|
|
108
|
+
const typedData = (0, blue_sdk_viem_1.getPermitTypedData)({
|
|
109
|
+
...permit,
|
|
110
|
+
erc20: vault,
|
|
111
|
+
}, chainId);
|
|
112
|
+
const signature = await (0, signAndVerifyTypedData_js_1.signAndVerifyTypedData)({
|
|
113
|
+
client,
|
|
114
|
+
userAddress,
|
|
115
|
+
typedData,
|
|
116
|
+
});
|
|
117
|
+
return (0, morpho_ts_1.deepFreeze)({
|
|
118
|
+
args: {
|
|
119
|
+
owner,
|
|
120
|
+
signature,
|
|
121
|
+
deadline,
|
|
122
|
+
amount,
|
|
123
|
+
asset: vault.address,
|
|
124
|
+
nonce,
|
|
125
|
+
},
|
|
126
|
+
action,
|
|
127
|
+
});
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
exports.encodeVaultSharesPermit = encodeVaultSharesPermit;
|
|
@@ -18,3 +18,4 @@ __exportStar(require("./encodeBlueSignatureAuthorization.js"), exports);
|
|
|
18
18
|
__exportStar(require("./encodeErc20Approval.js"), exports);
|
|
19
19
|
__exportStar(require("./encodeErc20Permit.js"), exports);
|
|
20
20
|
__exportStar(require("./encodeErc20Permit2Approve.js"), exports);
|
|
21
|
+
__exportStar(require("./encodeVaultSharesPermit.js"), exports);
|
|
@@ -5,7 +5,8 @@ import { type ERC20ApprovalAction, type Transaction } from "../../types/index.js
|
|
|
5
5
|
* allowance.
|
|
6
6
|
*
|
|
7
7
|
* The spender is validated by {@link encodeErc20Approval}. Supported spenders are the chain's
|
|
8
|
-
* GeneralAdapter1, Permit2, Midnight, and
|
|
8
|
+
* GeneralAdapter1, Permit2, Midnight, MidnightBundles, and VaultExitBundlesV1 addresses when
|
|
9
|
+
* configured.
|
|
9
10
|
*
|
|
10
11
|
* Returns an empty array when the allowance already covers `spendAmount`. When the token is in
|
|
11
12
|
* `APPROVE_ONLY_ONCE_TOKENS` (e.g. USDT) and the existing allowance is non-zero, prepends a
|
|
@@ -19,7 +20,7 @@ import { type ERC20ApprovalAction, type Transaction } from "../../types/index.js
|
|
|
19
20
|
* @param params.args.approvalAmount - The amount to approve (often equal to `spendAmount`, but
|
|
20
21
|
* may be `MAX_UINT_160` for Permit2 prerequisites).
|
|
21
22
|
* @param params.args.spender - Address that will be granted the approval. Must be GeneralAdapter1,
|
|
22
|
-
* Permit2, Midnight, or
|
|
23
|
+
* Permit2, Midnight, MidnightBundles, or VaultExitBundlesV1 for `chainId`.
|
|
23
24
|
* @param params.allowances - The user's current allowance of `address` for `spender`.
|
|
24
25
|
* @returns Up to two deep-frozen `Transaction<ERC20ApprovalAction>` entries: an optional reset
|
|
25
26
|
* followed by the new approval. Empty when no approval is needed.
|
|
@@ -9,7 +9,8 @@ const encodeErc20Approval_js_1 = require("./encode/encodeErc20Approval.js");
|
|
|
9
9
|
* allowance.
|
|
10
10
|
*
|
|
11
11
|
* The spender is validated by {@link encodeErc20Approval}. Supported spenders are the chain's
|
|
12
|
-
* GeneralAdapter1, Permit2, Midnight, and
|
|
12
|
+
* GeneralAdapter1, Permit2, Midnight, MidnightBundles, and VaultExitBundlesV1 addresses when
|
|
13
|
+
* configured.
|
|
13
14
|
*
|
|
14
15
|
* Returns an empty array when the allowance already covers `spendAmount`. When the token is in
|
|
15
16
|
* `APPROVE_ONLY_ONCE_TOKENS` (e.g. USDT) and the existing allowance is non-zero, prepends a
|
|
@@ -23,7 +24,7 @@ const encodeErc20Approval_js_1 = require("./encode/encodeErc20Approval.js");
|
|
|
23
24
|
* @param params.args.approvalAmount - The amount to approve (often equal to `spendAmount`, but
|
|
24
25
|
* may be `MAX_UINT_160` for Permit2 prerequisites).
|
|
25
26
|
* @param params.args.spender - Address that will be granted the approval. Must be GeneralAdapter1,
|
|
26
|
-
* Permit2, Midnight, or
|
|
27
|
+
* Permit2, Midnight, MidnightBundles, or VaultExitBundlesV1 for `chainId`.
|
|
27
28
|
* @param params.allowances - The user's current allowance of `address` for `spender`.
|
|
28
29
|
* @returns Up to two deep-frozen `Transaction<ERC20ApprovalAction>` entries: an optional reset
|
|
29
30
|
* followed by the new approval. Empty when no approval is needed.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type Address, type Hex } from "viem";
|
|
2
|
+
import { type PermitRequirementSignature } from "../../types/index.js";
|
|
3
|
+
/** Permit tuple consumed by VaultExitBundlesV1. */
|
|
4
|
+
export interface VaultExitBundlesV1PermitStruct {
|
|
5
|
+
/** Vault-share allowance authorized by the permit. */
|
|
6
|
+
readonly value: bigint;
|
|
7
|
+
/** Vault permit nonce signed by the owner. */
|
|
8
|
+
readonly nonce: bigint;
|
|
9
|
+
/** Timestamp after which the permit is invalid. */
|
|
10
|
+
readonly deadline: bigint;
|
|
11
|
+
/** ECDSA recovery identifier, or zero for the empty-permit sentinel. */
|
|
12
|
+
readonly v: number;
|
|
13
|
+
/** ECDSA signature `r`, or zero for the empty-permit sentinel. */
|
|
14
|
+
readonly r: Hex;
|
|
15
|
+
/** ECDSA signature `s`, or zero for the empty-permit sentinel. */
|
|
16
|
+
readonly s: Hex;
|
|
17
|
+
}
|
|
18
|
+
/** Parameters for {@link getVaultExitBundlesV1PermitStruct}. */
|
|
19
|
+
export interface GetVaultExitBundlesV1PermitStructParams {
|
|
20
|
+
/** Vault share token authorized by the permit. */
|
|
21
|
+
readonly vault: Address;
|
|
22
|
+
/** Bundle deadline used by the empty-permit sentinel. */
|
|
23
|
+
readonly deadline: bigint;
|
|
24
|
+
/** Optional signed bounded ERC-2612 requirement. */
|
|
25
|
+
readonly requirementSignature?: PermitRequirementSignature;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Returns the permit struct consumed by VaultExitBundlesV1 from an optional vault-share
|
|
29
|
+
* requirement signature.
|
|
30
|
+
*
|
|
31
|
+
* Without a signature, returns the contract's empty-permit sentinel. With a signature, validates
|
|
32
|
+
* the ERC-2612 kind and vault asset before splitting the serialized signature.
|
|
33
|
+
* Owner, spender, deadline, nonce, and cryptographic validity are verified onchain by the vault.
|
|
34
|
+
*
|
|
35
|
+
* @param params.vault - Vault share token authorized by the permit.
|
|
36
|
+
* @param params.deadline - Bundle deadline used by the empty-permit sentinel.
|
|
37
|
+
* @param params.requirementSignature - Optional signed bounded ERC-2612 requirement.
|
|
38
|
+
* @returns The VaultExitBundlesV1 permit tuple.
|
|
39
|
+
* @throws {VaultExitBundlesV1PermitMismatchError} when the requirement has the wrong permit kind, asset, or signature encoding.
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* import { getVaultExitBundlesV1PermitStruct } from "@morpho-org/morpho-sdk";
|
|
43
|
+
*
|
|
44
|
+
* const permit = getVaultExitBundlesV1PermitStruct({
|
|
45
|
+
* vault,
|
|
46
|
+
* deadline,
|
|
47
|
+
* requirementSignature,
|
|
48
|
+
* });
|
|
49
|
+
* // permit satisfies VaultExitBundlesV1PermitStruct
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare const getVaultExitBundlesV1PermitStruct: (params: GetVaultExitBundlesV1PermitStructParams) => VaultExitBundlesV1PermitStruct;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getVaultExitBundlesV1PermitStruct = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
const index_js_1 = require("../../types/index.js");
|
|
6
|
+
/**
|
|
7
|
+
* Returns the permit struct consumed by VaultExitBundlesV1 from an optional vault-share
|
|
8
|
+
* requirement signature.
|
|
9
|
+
*
|
|
10
|
+
* Without a signature, returns the contract's empty-permit sentinel. With a signature, validates
|
|
11
|
+
* the ERC-2612 kind and vault asset before splitting the serialized signature.
|
|
12
|
+
* Owner, spender, deadline, nonce, and cryptographic validity are verified onchain by the vault.
|
|
13
|
+
*
|
|
14
|
+
* @param params.vault - Vault share token authorized by the permit.
|
|
15
|
+
* @param params.deadline - Bundle deadline used by the empty-permit sentinel.
|
|
16
|
+
* @param params.requirementSignature - Optional signed bounded ERC-2612 requirement.
|
|
17
|
+
* @returns The VaultExitBundlesV1 permit tuple.
|
|
18
|
+
* @throws {VaultExitBundlesV1PermitMismatchError} when the requirement has the wrong permit kind, asset, or signature encoding.
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { getVaultExitBundlesV1PermitStruct } from "@morpho-org/morpho-sdk";
|
|
22
|
+
*
|
|
23
|
+
* const permit = getVaultExitBundlesV1PermitStruct({
|
|
24
|
+
* vault,
|
|
25
|
+
* deadline,
|
|
26
|
+
* requirementSignature,
|
|
27
|
+
* });
|
|
28
|
+
* // permit satisfies VaultExitBundlesV1PermitStruct
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
const getVaultExitBundlesV1PermitStruct = (params) => {
|
|
32
|
+
const { requirementSignature } = params;
|
|
33
|
+
if (requirementSignature == null) {
|
|
34
|
+
return {
|
|
35
|
+
value: 0n,
|
|
36
|
+
nonce: 0n,
|
|
37
|
+
deadline: params.deadline,
|
|
38
|
+
v: 0,
|
|
39
|
+
r: viem_1.zeroHash,
|
|
40
|
+
s: viem_1.zeroHash,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
if (requirementSignature.action.type !== "permit") {
|
|
44
|
+
throw new index_js_1.VaultExitBundlesV1PermitMismatchError({
|
|
45
|
+
field: "type",
|
|
46
|
+
expected: "permit",
|
|
47
|
+
actual: requirementSignature.action.type,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (!(0, viem_1.isAddressEqual)(requirementSignature.args.asset, params.vault)) {
|
|
51
|
+
throw new index_js_1.VaultExitBundlesV1PermitMismatchError({
|
|
52
|
+
field: "asset",
|
|
53
|
+
expected: params.vault,
|
|
54
|
+
actual: requirementSignature.args.asset,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
const signature = (() => {
|
|
58
|
+
try {
|
|
59
|
+
const serializedSignature = requirementSignature.args.signature;
|
|
60
|
+
return (0, viem_1.size)(serializedSignature) === 64
|
|
61
|
+
? (0, viem_1.compactSignatureToSignature)((0, viem_1.parseCompactSignature)(serializedSignature))
|
|
62
|
+
: (0, viem_1.parseSignature)(serializedSignature);
|
|
63
|
+
}
|
|
64
|
+
catch (cause) {
|
|
65
|
+
throw new index_js_1.VaultExitBundlesV1PermitMismatchError({
|
|
66
|
+
field: "signature",
|
|
67
|
+
expected: "a 64-byte compact or 65-byte serialized ECDSA signature",
|
|
68
|
+
actual: requirementSignature.args.signature,
|
|
69
|
+
cause,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
})();
|
|
73
|
+
const { r, s, v, yParity } = signature;
|
|
74
|
+
const normalizedV = v ?? (yParity == null ? undefined : BigInt(yParity + 27));
|
|
75
|
+
if (normalizedV == null) {
|
|
76
|
+
throw new index_js_1.VaultExitBundlesV1PermitMismatchError({
|
|
77
|
+
field: "signature",
|
|
78
|
+
expected: "a signature containing v or yParity",
|
|
79
|
+
actual: requirementSignature.args.signature,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
value: requirementSignature.args.amount,
|
|
84
|
+
nonce: requirementSignature.args.nonce,
|
|
85
|
+
deadline: requirementSignature.args.deadline,
|
|
86
|
+
v: Number(normalizedV),
|
|
87
|
+
r,
|
|
88
|
+
s,
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
exports.getVaultExitBundlesV1PermitStruct = getVaultExitBundlesV1PermitStruct;
|
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./getBlueAuthorizationAction.js"), exports);
|
|
18
18
|
__exportStar(require("./getTokenRequirementActions.js"), exports);
|
|
19
|
+
__exportStar(require("./getVaultExitBundlesV1PermitStruct.js"), exports);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { InputMarketParams } from "@morpho-org/blue-sdk";
|
|
2
|
+
import { type Address } from "viem";
|
|
3
|
+
import { type Metadata, type PermitRequirementSignature, type Transaction, type VaultV1InKindRedeemAction } from "../../types/index.js";
|
|
4
|
+
/** Parameters for {@link vaultV1InKindRedeem}. */
|
|
5
|
+
export interface VaultV1InKindRedeemParams {
|
|
6
|
+
readonly vault: {
|
|
7
|
+
readonly chainId: number;
|
|
8
|
+
readonly address: Address;
|
|
9
|
+
};
|
|
10
|
+
readonly args: {
|
|
11
|
+
readonly amount: bigint;
|
|
12
|
+
readonly marketParamsList: readonly InputMarketParams[];
|
|
13
|
+
readonly userAddress: Address;
|
|
14
|
+
readonly deadline: bigint;
|
|
15
|
+
readonly requirementSignature?: PermitRequirementSignature;
|
|
16
|
+
};
|
|
17
|
+
readonly metadata?: Metadata;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Prepares a Vault V1 in-kind redemption into Morpho Blue supply positions.
|
|
21
|
+
*
|
|
22
|
+
* The transaction calls VaultExitBundlesV1 directly. Without a signature it embeds the contract's
|
|
23
|
+
* empty-permit sentinel; the user must first approve enough shares for the exit.
|
|
24
|
+
*
|
|
25
|
+
* @param params - In-kind redemption parameters.
|
|
26
|
+
* @param params.vault.chainId - Chain containing the target Vault V1 and VaultExitBundlesV1.
|
|
27
|
+
* @param params.vault.address - Target Vault V1 address.
|
|
28
|
+
* @param params.args.amount - Asset-denominated amount to exit.
|
|
29
|
+
* @param params.args.marketParamsList - Ordered markets consumed greedily by the contract.
|
|
30
|
+
* @param params.args.userAddress - Expected transaction sender, recorded in action metadata only.
|
|
31
|
+
* VaultExitBundlesV1 burns `msg.sender`'s vault shares, so the submitting account must equal this
|
|
32
|
+
* address.
|
|
33
|
+
* @param params.args.deadline - Permit and bundle deadline.
|
|
34
|
+
* @param params.args.requirementSignature - Optional bounded Vault V1 shares permit.
|
|
35
|
+
* @param params.metadata - Optional analytics metadata.
|
|
36
|
+
* @returns A deep-frozen `Readonly<Transaction<VaultV1InKindRedeemAction>>` with `to`, `value`,
|
|
37
|
+
* `data`, and the typed action discriminator.
|
|
38
|
+
* @throws {NonPositiveInputError} when `amount` or `deadline` is not positive.
|
|
39
|
+
* @throws {EmptyMarketParamsListError} when no markets are supplied.
|
|
40
|
+
* @throws {UnsupportedChainIdError} when no address registry exists for the target chain.
|
|
41
|
+
* @throws {UnknownAddressError} when VaultExitBundlesV1 is not registered on the target chain.
|
|
42
|
+
* @throws {VaultExitBundlesV1PermitMismatchError} when the requirement has the wrong permit kind, asset, or signature encoding.
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* import { vaultV1InKindRedeem } from "@morpho-org/morpho-sdk";
|
|
46
|
+
*
|
|
47
|
+
* const tx = vaultV1InKindRedeem({
|
|
48
|
+
* vault: { chainId: 1, address: vault },
|
|
49
|
+
* args: { amount: 1_000_000n, marketParamsList, userAddress, deadline },
|
|
50
|
+
* });
|
|
51
|
+
* // tx satisfies Readonly<Transaction<VaultV1InKindRedeemAction>>
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare const vaultV1InKindRedeem: ({ vault, args, metadata, }: VaultV1InKindRedeemParams) => Readonly<Transaction<VaultV1InKindRedeemAction>>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.vaultV1InKindRedeem = void 0;
|
|
4
|
+
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
5
|
+
const viem_1 = require("viem");
|
|
6
|
+
const abis_js_1 = require("../../abis.js");
|
|
7
|
+
const index_js_1 = require("../../helpers/index.js");
|
|
8
|
+
const index_js_2 = require("../../types/index.js");
|
|
9
|
+
const getVaultExitBundlesV1PermitStruct_js_1 = require("../signatures/getVaultExitBundlesV1PermitStruct.js");
|
|
10
|
+
/**
|
|
11
|
+
* Prepares a Vault V1 in-kind redemption into Morpho Blue supply positions.
|
|
12
|
+
*
|
|
13
|
+
* The transaction calls VaultExitBundlesV1 directly. Without a signature it embeds the contract's
|
|
14
|
+
* empty-permit sentinel; the user must first approve enough shares for the exit.
|
|
15
|
+
*
|
|
16
|
+
* @param params - In-kind redemption parameters.
|
|
17
|
+
* @param params.vault.chainId - Chain containing the target Vault V1 and VaultExitBundlesV1.
|
|
18
|
+
* @param params.vault.address - Target Vault V1 address.
|
|
19
|
+
* @param params.args.amount - Asset-denominated amount to exit.
|
|
20
|
+
* @param params.args.marketParamsList - Ordered markets consumed greedily by the contract.
|
|
21
|
+
* @param params.args.userAddress - Expected transaction sender, recorded in action metadata only.
|
|
22
|
+
* VaultExitBundlesV1 burns `msg.sender`'s vault shares, so the submitting account must equal this
|
|
23
|
+
* address.
|
|
24
|
+
* @param params.args.deadline - Permit and bundle deadline.
|
|
25
|
+
* @param params.args.requirementSignature - Optional bounded Vault V1 shares permit.
|
|
26
|
+
* @param params.metadata - Optional analytics metadata.
|
|
27
|
+
* @returns A deep-frozen `Readonly<Transaction<VaultV1InKindRedeemAction>>` with `to`, `value`,
|
|
28
|
+
* `data`, and the typed action discriminator.
|
|
29
|
+
* @throws {NonPositiveInputError} when `amount` or `deadline` is not positive.
|
|
30
|
+
* @throws {EmptyMarketParamsListError} when no markets are supplied.
|
|
31
|
+
* @throws {UnsupportedChainIdError} when no address registry exists for the target chain.
|
|
32
|
+
* @throws {UnknownAddressError} when VaultExitBundlesV1 is not registered on the target chain.
|
|
33
|
+
* @throws {VaultExitBundlesV1PermitMismatchError} when the requirement has the wrong permit kind, asset, or signature encoding.
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* import { vaultV1InKindRedeem } from "@morpho-org/morpho-sdk";
|
|
37
|
+
*
|
|
38
|
+
* const tx = vaultV1InKindRedeem({
|
|
39
|
+
* vault: { chainId: 1, address: vault },
|
|
40
|
+
* args: { amount: 1_000_000n, marketParamsList, userAddress, deadline },
|
|
41
|
+
* });
|
|
42
|
+
* // tx satisfies Readonly<Transaction<VaultV1InKindRedeemAction>>
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
const vaultV1InKindRedeem = ({ vault, args, metadata, }) => {
|
|
46
|
+
if (args.amount <= 0n)
|
|
47
|
+
throw new index_js_2.NonPositiveInputError("amount", args.amount);
|
|
48
|
+
if (args.deadline <= 0n)
|
|
49
|
+
throw new index_js_2.NonPositiveInputError("deadline", args.deadline);
|
|
50
|
+
if (args.marketParamsList.length === 0)
|
|
51
|
+
throw new index_js_2.EmptyMarketParamsListError();
|
|
52
|
+
const to = (0, morpho_ts_1.getChainAddress)(vault.chainId, "bundles.vaultExitBundlesV1");
|
|
53
|
+
const marketParamsList = args.marketParamsList.map((marketParams) => ({
|
|
54
|
+
loanToken: marketParams.loanToken,
|
|
55
|
+
collateralToken: marketParams.collateralToken,
|
|
56
|
+
oracle: marketParams.oracle,
|
|
57
|
+
irm: marketParams.irm,
|
|
58
|
+
lltv: marketParams.lltv,
|
|
59
|
+
}));
|
|
60
|
+
const sharesPermit = (0, getVaultExitBundlesV1PermitStruct_js_1.getVaultExitBundlesV1PermitStruct)({
|
|
61
|
+
vault: vault.address,
|
|
62
|
+
deadline: args.deadline,
|
|
63
|
+
requirementSignature: args.requirementSignature,
|
|
64
|
+
});
|
|
65
|
+
let tx = {
|
|
66
|
+
to,
|
|
67
|
+
value: 0n,
|
|
68
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
69
|
+
abi: abis_js_1.vaultExitBundlesV1Abi,
|
|
70
|
+
functionName: "vaultExitBundlesV1InKindRedemptionVaultV1",
|
|
71
|
+
args: [
|
|
72
|
+
vault.address,
|
|
73
|
+
marketParamsList,
|
|
74
|
+
args.amount,
|
|
75
|
+
sharesPermit,
|
|
76
|
+
args.deadline,
|
|
77
|
+
],
|
|
78
|
+
}),
|
|
79
|
+
};
|
|
80
|
+
if (metadata)
|
|
81
|
+
tx = (0, index_js_1.addTransactionMetadata)(tx, metadata);
|
|
82
|
+
return (0, morpho_ts_1.deepFreeze)({
|
|
83
|
+
...tx,
|
|
84
|
+
action: {
|
|
85
|
+
type: "vaultV1InKindRedeem",
|
|
86
|
+
args: {
|
|
87
|
+
vault: vault.address,
|
|
88
|
+
amount: args.amount,
|
|
89
|
+
marketParamsList,
|
|
90
|
+
onBehalf: args.userAddress,
|
|
91
|
+
deadline: args.deadline,
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
exports.vaultV1InKindRedeem = vaultV1InKindRedeem;
|
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./deposit.js"), exports);
|
|
18
|
+
__exportStar(require("./inKindRedeem.js"), exports);
|
|
18
19
|
__exportStar(require("./migrateToV2.js"), exports);
|
|
19
20
|
__exportStar(require("./redeem.js"), exports);
|
|
20
21
|
__exportStar(require("./withdraw.js"), exports);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { InputMarketParams } from "@morpho-org/blue-sdk";
|
|
2
|
+
import { type Address } from "viem";
|
|
3
|
+
import { type Metadata, type PermitRequirementSignature, type Transaction, type VaultV2InKindRedeemAction } from "../../types/index.js";
|
|
4
|
+
/** Parameters for {@link vaultV2InKindRedeem}. */
|
|
5
|
+
export interface VaultV2InKindRedeemParams {
|
|
6
|
+
readonly vault: {
|
|
7
|
+
readonly chainId: number;
|
|
8
|
+
readonly address: Address;
|
|
9
|
+
};
|
|
10
|
+
readonly args: {
|
|
11
|
+
readonly adapter: Address;
|
|
12
|
+
readonly amount: bigint;
|
|
13
|
+
readonly marketParamsList: readonly InputMarketParams[];
|
|
14
|
+
readonly userAddress: Address;
|
|
15
|
+
readonly deadline: bigint;
|
|
16
|
+
readonly requirementSignature?: PermitRequirementSignature;
|
|
17
|
+
};
|
|
18
|
+
readonly metadata?: Metadata;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Prepares a Vault V2 in-kind redemption into idle assets and Morpho Blue supply positions.
|
|
22
|
+
*
|
|
23
|
+
* `amount` includes the Vault V2 force-deallocation penalty. Without a signature this embeds the
|
|
24
|
+
* empty-permit sentinel and requires a sufficient share approval to VaultExitBundlesV1.
|
|
25
|
+
*
|
|
26
|
+
* @param params - In-kind redemption parameters.
|
|
27
|
+
* @param params.vault.chainId - Chain containing the target Vault V2 and VaultExitBundlesV1.
|
|
28
|
+
* @param params.vault.address - Target Vault V2 address.
|
|
29
|
+
* @param params.args.adapter - Vault's sole MorphoMarketV1AdapterV2.
|
|
30
|
+
* @param params.args.amount - Penalty-inclusive, asset-denominated amount to exit.
|
|
31
|
+
* @param params.args.marketParamsList - Ordered markets consumed greedily after idle assets. May be
|
|
32
|
+
* empty when the vault's idle balance covers `amount`.
|
|
33
|
+
* @param params.args.userAddress - Expected transaction sender, recorded in action metadata only.
|
|
34
|
+
* VaultExitBundlesV1 burns `msg.sender`'s vault shares, so the submitting account must equal this
|
|
35
|
+
* address.
|
|
36
|
+
* @param params.args.deadline - Permit and bundle deadline.
|
|
37
|
+
* @param params.args.requirementSignature - Optional bounded Vault V2 shares permit.
|
|
38
|
+
* @param params.metadata - Optional analytics metadata.
|
|
39
|
+
* @returns A deep-frozen `Readonly<Transaction<VaultV2InKindRedeemAction>>` with `to`, `value`,
|
|
40
|
+
* `data`, and the typed action discriminator.
|
|
41
|
+
* @throws {NonPositiveInputError} when `amount` or `deadline` is not positive.
|
|
42
|
+
* @throws {UnsupportedChainIdError} when no address registry exists for the target chain.
|
|
43
|
+
* @throws {UnknownAddressError} when VaultExitBundlesV1 is not registered on the target chain.
|
|
44
|
+
* @throws {VaultExitBundlesV1PermitMismatchError} when the requirement has the wrong permit kind, asset, or signature encoding.
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* import { vaultV2InKindRedeem } from "@morpho-org/morpho-sdk";
|
|
48
|
+
*
|
|
49
|
+
* const tx = vaultV2InKindRedeem({
|
|
50
|
+
* vault: { chainId: 1, address: vault },
|
|
51
|
+
* args: { adapter, amount: 1_000_000n, marketParamsList, userAddress, deadline },
|
|
52
|
+
* });
|
|
53
|
+
* // tx satisfies Readonly<Transaction<VaultV2InKindRedeemAction>>
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare const vaultV2InKindRedeem: ({ vault, args, metadata, }: VaultV2InKindRedeemParams) => Readonly<Transaction<VaultV2InKindRedeemAction>>;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.vaultV2InKindRedeem = void 0;
|
|
4
|
+
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
5
|
+
const viem_1 = require("viem");
|
|
6
|
+
const abis_js_1 = require("../../abis.js");
|
|
7
|
+
const index_js_1 = require("../../helpers/index.js");
|
|
8
|
+
const index_js_2 = require("../../types/index.js");
|
|
9
|
+
const getVaultExitBundlesV1PermitStruct_js_1 = require("../signatures/getVaultExitBundlesV1PermitStruct.js");
|
|
10
|
+
/**
|
|
11
|
+
* Prepares a Vault V2 in-kind redemption into idle assets and Morpho Blue supply positions.
|
|
12
|
+
*
|
|
13
|
+
* `amount` includes the Vault V2 force-deallocation penalty. Without a signature this embeds the
|
|
14
|
+
* empty-permit sentinel and requires a sufficient share approval to VaultExitBundlesV1.
|
|
15
|
+
*
|
|
16
|
+
* @param params - In-kind redemption parameters.
|
|
17
|
+
* @param params.vault.chainId - Chain containing the target Vault V2 and VaultExitBundlesV1.
|
|
18
|
+
* @param params.vault.address - Target Vault V2 address.
|
|
19
|
+
* @param params.args.adapter - Vault's sole MorphoMarketV1AdapterV2.
|
|
20
|
+
* @param params.args.amount - Penalty-inclusive, asset-denominated amount to exit.
|
|
21
|
+
* @param params.args.marketParamsList - Ordered markets consumed greedily after idle assets. May be
|
|
22
|
+
* empty when the vault's idle balance covers `amount`.
|
|
23
|
+
* @param params.args.userAddress - Expected transaction sender, recorded in action metadata only.
|
|
24
|
+
* VaultExitBundlesV1 burns `msg.sender`'s vault shares, so the submitting account must equal this
|
|
25
|
+
* address.
|
|
26
|
+
* @param params.args.deadline - Permit and bundle deadline.
|
|
27
|
+
* @param params.args.requirementSignature - Optional bounded Vault V2 shares permit.
|
|
28
|
+
* @param params.metadata - Optional analytics metadata.
|
|
29
|
+
* @returns A deep-frozen `Readonly<Transaction<VaultV2InKindRedeemAction>>` with `to`, `value`,
|
|
30
|
+
* `data`, and the typed action discriminator.
|
|
31
|
+
* @throws {NonPositiveInputError} when `amount` or `deadline` is not positive.
|
|
32
|
+
* @throws {UnsupportedChainIdError} when no address registry exists for the target chain.
|
|
33
|
+
* @throws {UnknownAddressError} when VaultExitBundlesV1 is not registered on the target chain.
|
|
34
|
+
* @throws {VaultExitBundlesV1PermitMismatchError} when the requirement has the wrong permit kind, asset, or signature encoding.
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* import { vaultV2InKindRedeem } from "@morpho-org/morpho-sdk";
|
|
38
|
+
*
|
|
39
|
+
* const tx = vaultV2InKindRedeem({
|
|
40
|
+
* vault: { chainId: 1, address: vault },
|
|
41
|
+
* args: { adapter, amount: 1_000_000n, marketParamsList, userAddress, deadline },
|
|
42
|
+
* });
|
|
43
|
+
* // tx satisfies Readonly<Transaction<VaultV2InKindRedeemAction>>
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
const vaultV2InKindRedeem = ({ vault, args, metadata, }) => {
|
|
47
|
+
if (args.amount <= 0n)
|
|
48
|
+
throw new index_js_2.NonPositiveInputError("amount", args.amount);
|
|
49
|
+
if (args.deadline <= 0n)
|
|
50
|
+
throw new index_js_2.NonPositiveInputError("deadline", args.deadline);
|
|
51
|
+
const to = (0, morpho_ts_1.getChainAddress)(vault.chainId, "bundles.vaultExitBundlesV1");
|
|
52
|
+
const marketParamsList = args.marketParamsList.map((marketParams) => ({
|
|
53
|
+
loanToken: marketParams.loanToken,
|
|
54
|
+
collateralToken: marketParams.collateralToken,
|
|
55
|
+
oracle: marketParams.oracle,
|
|
56
|
+
irm: marketParams.irm,
|
|
57
|
+
lltv: marketParams.lltv,
|
|
58
|
+
}));
|
|
59
|
+
const sharesPermit = (0, getVaultExitBundlesV1PermitStruct_js_1.getVaultExitBundlesV1PermitStruct)({
|
|
60
|
+
vault: vault.address,
|
|
61
|
+
deadline: args.deadline,
|
|
62
|
+
requirementSignature: args.requirementSignature,
|
|
63
|
+
});
|
|
64
|
+
let tx = {
|
|
65
|
+
to,
|
|
66
|
+
value: 0n,
|
|
67
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
68
|
+
abi: abis_js_1.vaultExitBundlesV1Abi,
|
|
69
|
+
functionName: "vaultExitBundlesV1InKindRedemptionVaultV2",
|
|
70
|
+
args: [
|
|
71
|
+
vault.address,
|
|
72
|
+
args.adapter,
|
|
73
|
+
marketParamsList,
|
|
74
|
+
args.amount,
|
|
75
|
+
sharesPermit,
|
|
76
|
+
args.deadline,
|
|
77
|
+
],
|
|
78
|
+
}),
|
|
79
|
+
};
|
|
80
|
+
if (metadata)
|
|
81
|
+
tx = (0, index_js_1.addTransactionMetadata)(tx, metadata);
|
|
82
|
+
return (0, morpho_ts_1.deepFreeze)({
|
|
83
|
+
...tx,
|
|
84
|
+
action: {
|
|
85
|
+
type: "vaultV2InKindRedeem",
|
|
86
|
+
args: {
|
|
87
|
+
vault: vault.address,
|
|
88
|
+
adapter: args.adapter,
|
|
89
|
+
amount: args.amount,
|
|
90
|
+
marketParamsList,
|
|
91
|
+
onBehalf: args.userAddress,
|
|
92
|
+
deadline: args.deadline,
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
exports.vaultV2InKindRedeem = vaultV2InKindRedeem;
|