@morpho-org/blue-sdk 6.0.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/addresses.d.ts +105 -0
- package/lib/cjs/addresses.js +74 -0
- package/lib/cjs/chain.d.ts +84 -1
- package/lib/cjs/chain.js +78 -0
- package/lib/cjs/errors.d.ts +34 -0
- package/lib/cjs/errors.js +28 -0
- package/lib/cjs/holding/AssetBalances.d.ts +3 -0
- package/lib/cjs/holding/AssetBalances.js +1 -0
- package/lib/cjs/holding/Holding.d.ts +6 -0
- package/lib/cjs/holding/Holding.js +2 -0
- package/lib/cjs/market/Market.d.ts +4 -0
- package/lib/cjs/market/MarketParams.d.ts +3 -0
- package/lib/cjs/market/MarketParams.js +1 -0
- package/lib/cjs/market/MarketUtils.d.ts +397 -0
- package/lib/cjs/market/MarketUtils.js +397 -2
- package/lib/cjs/math/AdaptiveCurveIrmLib.d.ts +51 -1
- package/lib/cjs/math/AdaptiveCurveIrmLib.js +51 -1
- package/lib/cjs/math/MathLib.d.ts +152 -4
- package/lib/cjs/math/MathLib.js +151 -4
- package/lib/cjs/math/SharesMath.d.ts +34 -0
- package/lib/cjs/math/SharesMath.js +34 -0
- package/lib/cjs/position/Position.d.ts +4 -0
- package/lib/cjs/position/Position.js +2 -0
- package/lib/cjs/position/PreLiquidationPosition.d.ts +4 -0
- package/lib/cjs/position/PreLiquidationPosition.js +2 -0
- package/lib/cjs/preLiquidation.d.ts +16 -0
- package/lib/cjs/preLiquidation.js +16 -0
- package/lib/cjs/token/ConstantWrappedToken.d.ts +1 -0
- package/lib/cjs/token/ConstantWrappedToken.js +1 -0
- package/lib/cjs/token/Eip5267Domain.d.ts +4 -0
- package/lib/cjs/token/Eip5267Domain.js +2 -0
- package/lib/cjs/token/ExchangeRateWrappedToken.d.ts +1 -0
- package/lib/cjs/token/ExchangeRateWrappedToken.js +1 -0
- package/lib/cjs/token/Token.d.ts +2 -0
- package/lib/cjs/token/Token.js +1 -0
- package/lib/cjs/token/VaultToken.d.ts +2 -0
- package/lib/cjs/token/VaultToken.js +1 -0
- package/lib/cjs/token/WrappedToken.d.ts +1 -0
- package/lib/cjs/token/WrappedToken.js +1 -0
- package/lib/cjs/types.d.ts +17 -0
- package/lib/cjs/types.js +13 -0
- package/lib/cjs/user/User.d.ts +1 -0
- package/lib/cjs/user/User.js +1 -0
- package/lib/cjs/utils.d.ts +2 -0
- package/lib/cjs/utils.js +1 -0
- package/lib/cjs/vault/Vault.d.ts +7 -0
- package/lib/cjs/vault/Vault.js +2 -0
- package/lib/cjs/vault/VaultConfig.d.ts +2 -0
- package/lib/cjs/vault/VaultConfig.js +1 -0
- package/lib/cjs/vault/VaultMarketAllocation.d.ts +2 -0
- package/lib/cjs/vault/VaultMarketAllocation.js +1 -0
- package/lib/cjs/vault/VaultMarketConfig.d.ts +2 -0
- package/lib/cjs/vault/VaultMarketConfig.js +1 -0
- package/lib/cjs/vault/VaultMarketPublicAllocatorConfig.d.ts +1 -0
- package/lib/cjs/vault/VaultMarketPublicAllocatorConfig.js +1 -0
- package/lib/cjs/vault/VaultUser.d.ts +2 -0
- package/lib/cjs/vault/VaultUser.js +1 -0
- package/lib/cjs/vault/VaultUtils.d.ts +49 -0
- package/lib/cjs/vault/VaultUtils.js +49 -0
- package/lib/cjs/vault/v2/VaultV2.d.ts +5 -0
- package/lib/cjs/vault/v2/VaultV2.js +2 -0
- package/lib/cjs/vault/v2/VaultV2Adapter.d.ts +3 -0
- package/lib/cjs/vault/v2/VaultV2Adapter.js +1 -0
- package/lib/cjs/vault/v2/VaultV2MorphoMarketV1Adapter.d.ts +4 -0
- package/lib/cjs/vault/v2/VaultV2MorphoMarketV1Adapter.js +2 -0
- package/lib/cjs/vault/v2/VaultV2MorphoMarketV1AdapterV2.d.ts +4 -0
- package/lib/cjs/vault/v2/VaultV2MorphoMarketV1AdapterV2.js +2 -0
- package/lib/cjs/vault/v2/VaultV2MorphoVaultV1Adapter.d.ts +4 -0
- package/lib/cjs/vault/v2/VaultV2MorphoVaultV1Adapter.js +2 -0
- package/lib/esm/addresses.d.ts +105 -0
- package/lib/esm/addresses.js +74 -0
- package/lib/esm/chain.d.ts +84 -1
- package/lib/esm/chain.js +78 -0
- package/lib/esm/errors.d.ts +34 -0
- package/lib/esm/errors.js +28 -0
- package/lib/esm/holding/AssetBalances.d.ts +3 -0
- package/lib/esm/holding/AssetBalances.js +1 -0
- package/lib/esm/holding/Holding.d.ts +6 -0
- package/lib/esm/holding/Holding.js +2 -0
- package/lib/esm/market/Market.d.ts +4 -0
- package/lib/esm/market/MarketParams.d.ts +3 -0
- package/lib/esm/market/MarketParams.js +1 -0
- package/lib/esm/market/MarketUtils.d.ts +397 -0
- package/lib/esm/market/MarketUtils.js +397 -2
- package/lib/esm/math/AdaptiveCurveIrmLib.d.ts +51 -1
- package/lib/esm/math/AdaptiveCurveIrmLib.js +51 -1
- package/lib/esm/math/MathLib.d.ts +152 -4
- package/lib/esm/math/MathLib.js +151 -4
- package/lib/esm/math/SharesMath.d.ts +34 -0
- package/lib/esm/math/SharesMath.js +34 -0
- package/lib/esm/position/Position.d.ts +4 -0
- package/lib/esm/position/Position.js +2 -0
- package/lib/esm/position/PreLiquidationPosition.d.ts +4 -0
- package/lib/esm/position/PreLiquidationPosition.js +2 -0
- package/lib/esm/preLiquidation.d.ts +16 -0
- package/lib/esm/preLiquidation.js +16 -0
- package/lib/esm/token/ConstantWrappedToken.d.ts +1 -0
- package/lib/esm/token/ConstantWrappedToken.js +1 -0
- package/lib/esm/token/Eip5267Domain.d.ts +4 -0
- package/lib/esm/token/Eip5267Domain.js +2 -0
- package/lib/esm/token/ExchangeRateWrappedToken.d.ts +1 -0
- package/lib/esm/token/ExchangeRateWrappedToken.js +1 -0
- package/lib/esm/token/Token.d.ts +2 -0
- package/lib/esm/token/Token.js +1 -0
- package/lib/esm/token/VaultToken.d.ts +2 -0
- package/lib/esm/token/VaultToken.js +1 -0
- package/lib/esm/token/WrappedToken.d.ts +1 -0
- package/lib/esm/token/WrappedToken.js +1 -0
- package/lib/esm/types.d.ts +17 -0
- package/lib/esm/types.js +13 -0
- package/lib/esm/user/User.d.ts +1 -0
- package/lib/esm/user/User.js +1 -0
- package/lib/esm/utils.d.ts +2 -0
- package/lib/esm/utils.js +1 -0
- package/lib/esm/vault/Vault.d.ts +7 -0
- package/lib/esm/vault/Vault.js +2 -0
- package/lib/esm/vault/VaultConfig.d.ts +2 -0
- package/lib/esm/vault/VaultConfig.js +1 -0
- package/lib/esm/vault/VaultMarketAllocation.d.ts +2 -0
- package/lib/esm/vault/VaultMarketAllocation.js +1 -0
- package/lib/esm/vault/VaultMarketConfig.d.ts +2 -0
- package/lib/esm/vault/VaultMarketConfig.js +1 -0
- package/lib/esm/vault/VaultMarketPublicAllocatorConfig.d.ts +1 -0
- package/lib/esm/vault/VaultMarketPublicAllocatorConfig.js +1 -0
- package/lib/esm/vault/VaultUser.d.ts +2 -0
- package/lib/esm/vault/VaultUser.js +1 -0
- package/lib/esm/vault/VaultUtils.d.ts +49 -0
- package/lib/esm/vault/VaultUtils.js +49 -0
- package/lib/esm/vault/v2/VaultV2.d.ts +5 -0
- package/lib/esm/vault/v2/VaultV2.js +2 -0
- package/lib/esm/vault/v2/VaultV2Adapter.d.ts +3 -0
- package/lib/esm/vault/v2/VaultV2Adapter.js +1 -0
- package/lib/esm/vault/v2/VaultV2MorphoMarketV1Adapter.d.ts +4 -0
- package/lib/esm/vault/v2/VaultV2MorphoMarketV1Adapter.js +2 -0
- package/lib/esm/vault/v2/VaultV2MorphoMarketV1AdapterV2.d.ts +4 -0
- package/lib/esm/vault/v2/VaultV2MorphoMarketV1AdapterV2.js +2 -0
- package/lib/esm/vault/v2/VaultV2MorphoVaultV1Adapter.d.ts +4 -0
- package/lib/esm/vault/v2/VaultV2MorphoVaultV1Adapter.js +2 -0
- package/package.json +10 -6
package/lib/cjs/errors.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.UnknownOfFactory = exports.UnknownFactory = exports.VaultV2Errors = exports.BlueErrors = exports.UnsupportedVaultV2AdapterError = exports.UnsupportedPreLiquidationParamsError = exports.UnsupportedChainIdError = exports.UnknownVaultConfigError = exports.UnknownMarketParamsError = exports.UnknownTokenPriceError = exports.UnknownTokenError = exports.UnknownDataError = exports.InvalidMarketParamsError = void 0;
|
|
4
4
|
exports._try = _try;
|
|
5
5
|
const viem_1 = require("viem");
|
|
6
|
+
/** Error thrown when bytes cannot be decoded into valid Morpho Blue market params. */
|
|
6
7
|
class InvalidMarketParamsError extends Error {
|
|
7
8
|
data;
|
|
8
9
|
constructor(data) {
|
|
@@ -11,9 +12,11 @@ class InvalidMarketParamsError extends Error {
|
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
14
|
exports.InvalidMarketParamsError = InvalidMarketParamsError;
|
|
15
|
+
/** Base error for optional data lookups that were not available. */
|
|
14
16
|
class UnknownDataError extends Error {
|
|
15
17
|
}
|
|
16
18
|
exports.UnknownDataError = UnknownDataError;
|
|
19
|
+
/** Error thrown when token metadata is unavailable for an address. */
|
|
17
20
|
class UnknownTokenError extends UnknownDataError {
|
|
18
21
|
address;
|
|
19
22
|
constructor(address) {
|
|
@@ -22,6 +25,7 @@ class UnknownTokenError extends UnknownDataError {
|
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
27
|
exports.UnknownTokenError = UnknownTokenError;
|
|
28
|
+
/** Error thrown when a token price is unavailable for an address. */
|
|
25
29
|
class UnknownTokenPriceError extends UnknownDataError {
|
|
26
30
|
address;
|
|
27
31
|
constructor(address) {
|
|
@@ -30,6 +34,7 @@ class UnknownTokenPriceError extends UnknownDataError {
|
|
|
30
34
|
}
|
|
31
35
|
}
|
|
32
36
|
exports.UnknownTokenPriceError = UnknownTokenPriceError;
|
|
37
|
+
/** Error thrown when market params are unavailable for a market id. */
|
|
33
38
|
class UnknownMarketParamsError extends UnknownDataError {
|
|
34
39
|
marketId;
|
|
35
40
|
constructor(marketId) {
|
|
@@ -38,6 +43,7 @@ class UnknownMarketParamsError extends UnknownDataError {
|
|
|
38
43
|
}
|
|
39
44
|
}
|
|
40
45
|
exports.UnknownMarketParamsError = UnknownMarketParamsError;
|
|
46
|
+
/** Error thrown when vault config is unavailable for a vault address. */
|
|
41
47
|
class UnknownVaultConfigError extends UnknownDataError {
|
|
42
48
|
vault;
|
|
43
49
|
constructor(vault) {
|
|
@@ -46,6 +52,7 @@ class UnknownVaultConfigError extends UnknownDataError {
|
|
|
46
52
|
}
|
|
47
53
|
}
|
|
48
54
|
exports.UnknownVaultConfigError = UnknownVaultConfigError;
|
|
55
|
+
/** Error thrown when a chain id has no configured SDK registry entry. */
|
|
49
56
|
class UnsupportedChainIdError extends Error {
|
|
50
57
|
chainId;
|
|
51
58
|
constructor(chainId) {
|
|
@@ -54,6 +61,7 @@ class UnsupportedChainIdError extends Error {
|
|
|
54
61
|
}
|
|
55
62
|
}
|
|
56
63
|
exports.UnsupportedChainIdError = UnsupportedChainIdError;
|
|
64
|
+
/** Error thrown when no default pre-liquidation params exist for an LLTV. */
|
|
57
65
|
class UnsupportedPreLiquidationParamsError extends Error {
|
|
58
66
|
lltv;
|
|
59
67
|
constructor(lltv) {
|
|
@@ -62,6 +70,7 @@ class UnsupportedPreLiquidationParamsError extends Error {
|
|
|
62
70
|
}
|
|
63
71
|
}
|
|
64
72
|
exports.UnsupportedPreLiquidationParamsError = UnsupportedPreLiquidationParamsError;
|
|
73
|
+
/** Error thrown when a Vault V2 adapter address is not supported by the SDK. */
|
|
65
74
|
class UnsupportedVaultV2AdapterError extends Error {
|
|
66
75
|
address;
|
|
67
76
|
constructor(address) {
|
|
@@ -70,8 +79,10 @@ class UnsupportedVaultV2AdapterError extends Error {
|
|
|
70
79
|
}
|
|
71
80
|
}
|
|
72
81
|
exports.UnsupportedVaultV2AdapterError = UnsupportedVaultV2AdapterError;
|
|
82
|
+
/** Morpho Blue protocol simulation errors. */
|
|
73
83
|
var BlueErrors;
|
|
74
84
|
(function (BlueErrors) {
|
|
85
|
+
/** Error thrown when a value that must be set once is already set. */
|
|
75
86
|
class AlreadySet extends Error {
|
|
76
87
|
name;
|
|
77
88
|
value;
|
|
@@ -82,6 +93,7 @@ var BlueErrors;
|
|
|
82
93
|
}
|
|
83
94
|
}
|
|
84
95
|
BlueErrors.AlreadySet = AlreadySet;
|
|
96
|
+
/** Error thrown when market interest accrual is requested before `lastUpdate`. */
|
|
85
97
|
class InvalidInterestAccrual extends Error {
|
|
86
98
|
marketId;
|
|
87
99
|
timestamp;
|
|
@@ -95,6 +107,7 @@ var BlueErrors;
|
|
|
95
107
|
}
|
|
96
108
|
}
|
|
97
109
|
BlueErrors.InvalidInterestAccrual = InvalidInterestAccrual;
|
|
110
|
+
/** Error thrown when asset and share inputs describe inconsistent values. */
|
|
98
111
|
class InconsistentInput extends Error {
|
|
99
112
|
assets;
|
|
100
113
|
shares;
|
|
@@ -105,6 +118,7 @@ var BlueErrors;
|
|
|
105
118
|
}
|
|
106
119
|
}
|
|
107
120
|
BlueErrors.InconsistentInput = InconsistentInput;
|
|
121
|
+
/** Error thrown when a market has insufficient liquidity for an operation. */
|
|
108
122
|
class InsufficientLiquidity extends Error {
|
|
109
123
|
marketId;
|
|
110
124
|
constructor(marketId) {
|
|
@@ -113,6 +127,7 @@ var BlueErrors;
|
|
|
113
127
|
}
|
|
114
128
|
}
|
|
115
129
|
BlueErrors.InsufficientLiquidity = InsufficientLiquidity;
|
|
130
|
+
/** Error thrown when a market oracle price is unavailable. */
|
|
116
131
|
class UnknownOraclePrice extends Error {
|
|
117
132
|
marketId;
|
|
118
133
|
constructor(marketId) {
|
|
@@ -121,6 +136,7 @@ var BlueErrors;
|
|
|
121
136
|
}
|
|
122
137
|
}
|
|
123
138
|
BlueErrors.UnknownOraclePrice = UnknownOraclePrice;
|
|
139
|
+
/** Error thrown when a user position is too small for an operation. */
|
|
124
140
|
class InsufficientPosition extends Error {
|
|
125
141
|
user;
|
|
126
142
|
marketId;
|
|
@@ -131,6 +147,7 @@ var BlueErrors;
|
|
|
131
147
|
}
|
|
132
148
|
}
|
|
133
149
|
BlueErrors.InsufficientPosition = InsufficientPosition;
|
|
150
|
+
/** Error thrown when a user position lacks required collateral. */
|
|
134
151
|
class InsufficientCollateral extends Error {
|
|
135
152
|
user;
|
|
136
153
|
marketId;
|
|
@@ -141,6 +158,7 @@ var BlueErrors;
|
|
|
141
158
|
}
|
|
142
159
|
}
|
|
143
160
|
BlueErrors.InsufficientCollateral = InsufficientCollateral;
|
|
161
|
+
/** Error thrown when a signature deadline has expired. */
|
|
144
162
|
class ExpiredSignature extends Error {
|
|
145
163
|
deadline;
|
|
146
164
|
constructor(deadline) {
|
|
@@ -150,8 +168,10 @@ var BlueErrors;
|
|
|
150
168
|
}
|
|
151
169
|
BlueErrors.ExpiredSignature = ExpiredSignature;
|
|
152
170
|
})(BlueErrors || (exports.BlueErrors = BlueErrors = {}));
|
|
171
|
+
/** Morpho Vault V2 simulation errors. */
|
|
153
172
|
var VaultV2Errors;
|
|
154
173
|
(function (VaultV2Errors) {
|
|
174
|
+
/** Error thrown when vault interest accrual is requested before `lastUpdate`. */
|
|
155
175
|
class InvalidInterestAccrual extends Error {
|
|
156
176
|
vault;
|
|
157
177
|
timestamp;
|
|
@@ -165,6 +185,7 @@ var VaultV2Errors;
|
|
|
165
185
|
}
|
|
166
186
|
}
|
|
167
187
|
VaultV2Errors.InvalidInterestAccrual = InvalidInterestAccrual;
|
|
188
|
+
/** Error thrown when a Vault V2 liquidity adapter is not supported by the SDK. */
|
|
168
189
|
class UnsupportedLiquidityAdapter extends Error {
|
|
169
190
|
address;
|
|
170
191
|
constructor(address) {
|
|
@@ -174,12 +195,14 @@ var VaultV2Errors;
|
|
|
174
195
|
}
|
|
175
196
|
VaultV2Errors.UnsupportedLiquidityAdapter = UnsupportedLiquidityAdapter;
|
|
176
197
|
})(VaultV2Errors || (exports.VaultV2Errors = VaultV2Errors = {}));
|
|
198
|
+
/** Error thrown when a factory address is unavailable. */
|
|
177
199
|
class UnknownFactory extends Error {
|
|
178
200
|
constructor() {
|
|
179
201
|
super(`unknown factory`);
|
|
180
202
|
}
|
|
181
203
|
}
|
|
182
204
|
exports.UnknownFactory = UnknownFactory;
|
|
205
|
+
/** Error thrown when an address is not deployed by the expected factory. */
|
|
183
206
|
class UnknownOfFactory extends Error {
|
|
184
207
|
factory;
|
|
185
208
|
address;
|
|
@@ -190,6 +213,11 @@ class UnknownOfFactory extends Error {
|
|
|
190
213
|
}
|
|
191
214
|
}
|
|
192
215
|
exports.UnknownOfFactory = UnknownOfFactory;
|
|
216
|
+
/**
|
|
217
|
+
* Runs an accessor and returns `undefined` for expected lookup errors.
|
|
218
|
+
*
|
|
219
|
+
* @internal
|
|
220
|
+
*/
|
|
193
221
|
function _try(accessor, ...errorClasses) {
|
|
194
222
|
const maybeCatchError = (error) => {
|
|
195
223
|
if (errorClasses.length === 0 ||
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Token } from "../token/Token.js";
|
|
2
|
+
/** Balance conversion category for a requested token and related peripheral tokens. */
|
|
2
3
|
export type PeripheralBalanceType = "base" | "wrapped" | "staked-wrapped" | "vault" | "wrapped-vault" | "unwrapped-staked-wrapped";
|
|
3
4
|
/**
|
|
4
5
|
* Represents the balance of a requested token and the balance quoted in the corresponding source token:
|
|
@@ -27,8 +28,10 @@ export interface PeripheralBalance {
|
|
|
27
28
|
*/
|
|
28
29
|
dstAmount: bigint;
|
|
29
30
|
}
|
|
31
|
+
/** Constructor input for `AssetBalances`. */
|
|
30
32
|
export interface IAssetBalances extends Omit<PeripheralBalance, "type"> {
|
|
31
33
|
}
|
|
34
|
+
/** Aggregates balances across a requested token and related peripheral tokens. */
|
|
32
35
|
export declare class AssetBalances {
|
|
33
36
|
/**
|
|
34
37
|
* The total balance of all types of related tokens.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AssetBalances = void 0;
|
|
4
|
+
/** Aggregates balances across a requested token and related peripheral tokens. */
|
|
4
5
|
class AssetBalances {
|
|
5
6
|
/**
|
|
6
7
|
* The total balance of all types of related tokens.
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import type { Address, BigIntish } from "../types.js";
|
|
2
|
+
/** Address registry labels that may receive ERC-20 allowances from a user. */
|
|
2
3
|
export declare const ERC20_ALLOWANCE_RECIPIENTS: readonly ["morpho", "permit2", "bundler3.generalAdapter1"];
|
|
4
|
+
/** Address registry label that may receive an ERC-20 allowance from a user. */
|
|
3
5
|
export type Erc20AllowanceRecipient = (typeof ERC20_ALLOWANCE_RECIPIENTS)[number];
|
|
6
|
+
/** Normalized Permit2 allowance values. */
|
|
4
7
|
export interface Permit2Allowance {
|
|
5
8
|
amount: bigint;
|
|
6
9
|
expiration: bigint;
|
|
7
10
|
nonce: bigint;
|
|
8
11
|
}
|
|
12
|
+
/** Input shape for Permit2 allowance values before bigint normalization. */
|
|
9
13
|
export interface IPermit2Allowance {
|
|
10
14
|
amount: BigIntish;
|
|
11
15
|
expiration: BigIntish;
|
|
12
16
|
nonce: BigIntish;
|
|
13
17
|
}
|
|
18
|
+
/** Input shape for a user's token holding and allowance state. */
|
|
14
19
|
export interface IHolding {
|
|
15
20
|
user: Address;
|
|
16
21
|
token: Address;
|
|
@@ -22,6 +27,7 @@ export interface IHolding {
|
|
|
22
27
|
canTransfer?: boolean;
|
|
23
28
|
balance: bigint;
|
|
24
29
|
}
|
|
30
|
+
/** Represents a user's balance and allowance state for one token. */
|
|
25
31
|
export declare class Holding implements IHolding {
|
|
26
32
|
/**
|
|
27
33
|
* The user of this holding.
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Holding = exports.ERC20_ALLOWANCE_RECIPIENTS = void 0;
|
|
4
4
|
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
5
|
+
/** Address registry labels that may receive ERC-20 allowances from a user. */
|
|
5
6
|
exports.ERC20_ALLOWANCE_RECIPIENTS = [
|
|
6
7
|
"morpho",
|
|
7
8
|
"permit2",
|
|
8
9
|
"bundler3.generalAdapter1",
|
|
9
10
|
];
|
|
11
|
+
/** Represents a user's balance and allowance state for one token. */
|
|
10
12
|
class Holding {
|
|
11
13
|
/**
|
|
12
14
|
* The user of this holding.
|
|
@@ -2,12 +2,15 @@ import { type RoundingDirection } from "../math/index.js";
|
|
|
2
2
|
import type { BigIntish } from "../types.js";
|
|
3
3
|
import { type CapacityLimit } from "../utils.js";
|
|
4
4
|
import { type IMarketParams, MarketParams } from "./MarketParams.js";
|
|
5
|
+
/** Options for max borrow capacity calculations. */
|
|
5
6
|
export interface MaxBorrowOptions {
|
|
6
7
|
maxLtv?: bigint;
|
|
7
8
|
}
|
|
9
|
+
/** Options for max withdraw collateral capacity calculations. */
|
|
8
10
|
export interface MaxWithdrawCollateralOptions {
|
|
9
11
|
maxLtv?: bigint;
|
|
10
12
|
}
|
|
13
|
+
/** Capacity limits for each market operation available to a position. */
|
|
11
14
|
export interface MaxPositionCapacities {
|
|
12
15
|
supply: CapacityLimit;
|
|
13
16
|
withdraw: CapacityLimit;
|
|
@@ -16,6 +19,7 @@ export interface MaxPositionCapacities {
|
|
|
16
19
|
supplyCollateral: CapacityLimit;
|
|
17
20
|
withdrawCollateral: CapacityLimit | undefined;
|
|
18
21
|
}
|
|
22
|
+
/** Plain input shape for a Morpho Blue market. */
|
|
19
23
|
export interface IMarket {
|
|
20
24
|
params: IMarketParams;
|
|
21
25
|
totalSupplyAssets: bigint;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Hex } from "viem";
|
|
2
2
|
import type { Address, BigIntish, MarketId } from "../types.js";
|
|
3
|
+
/** Plain input shape for Morpho Blue market params. */
|
|
3
4
|
export interface IMarketParams {
|
|
4
5
|
loanToken: Address;
|
|
5
6
|
collateralToken: Address;
|
|
@@ -7,7 +8,9 @@ export interface IMarketParams {
|
|
|
7
8
|
irm: Address;
|
|
8
9
|
lltv: BigIntish;
|
|
9
10
|
}
|
|
11
|
+
/** Minimal market params shape accepted by SDK constructors and helpers. */
|
|
10
12
|
export type InputMarketParams = Pick<MarketParams, "loanToken" | "collateralToken" | "oracle" | "irm" | "lltv">;
|
|
13
|
+
/** ABI tuple definition for Morpho Blue market params. */
|
|
11
14
|
export declare const marketParamsAbi: {
|
|
12
15
|
readonly type: "tuple";
|
|
13
16
|
readonly components: readonly [{
|
|
@@ -5,6 +5,7 @@ const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
|
5
5
|
const viem_1 = require("viem");
|
|
6
6
|
const errors_js_1 = require("../errors.js");
|
|
7
7
|
const MarketUtils_js_1 = require("./MarketUtils.js");
|
|
8
|
+
/** ABI tuple definition for Morpho Blue market params. */
|
|
8
9
|
exports.marketParamsAbi = {
|
|
9
10
|
type: "tuple",
|
|
10
11
|
components: [
|