@morpho-org/morpho-sdk 2.0.0 → 3.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/lib/cjs/abis.d.ts +2816 -0
- package/lib/cjs/abis.js +1951 -0
- package/lib/cjs/actions/index.d.ts +3 -0
- package/lib/cjs/actions/marketV1/borrow.js +7 -10
- package/lib/cjs/actions/marketV1/buildReallocationActions.d.ts +2 -3
- package/lib/cjs/actions/marketV1/buildReallocationActions.js +1 -2
- package/lib/cjs/actions/marketV1/repay.d.ts +2 -0
- package/lib/cjs/actions/marketV1/repay.js +7 -8
- package/lib/cjs/actions/marketV1/repayWithdrawCollateral.d.ts +2 -0
- package/lib/cjs/actions/marketV1/repayWithdrawCollateral.js +9 -10
- package/lib/cjs/actions/marketV1/supplyCollateral.d.ts +2 -0
- package/lib/cjs/actions/marketV1/supplyCollateral.js +11 -12
- package/lib/cjs/actions/marketV1/supplyCollateralBorrow.d.ts +2 -0
- package/lib/cjs/actions/marketV1/supplyCollateralBorrow.js +13 -14
- package/lib/cjs/actions/requirements/encode/encodeErc20Approval.js +2 -2
- package/lib/cjs/actions/requirements/getRequirementsAction.d.ts +28 -4
- package/lib/cjs/actions/requirements/getRequirementsAction.js +28 -4
- package/lib/cjs/actions/requirements/getRequirementsApproval.js +2 -2
- package/lib/cjs/actions/requirements/index.d.ts +1 -0
- package/lib/cjs/actions/requirements/index.js +1 -0
- package/lib/cjs/actions/vaultV1/deposit.d.ts +2 -0
- package/lib/cjs/actions/vaultV1/deposit.js +13 -14
- package/lib/cjs/actions/vaultV1/migrateToV2.d.ts +2 -0
- package/lib/cjs/actions/vaultV1/migrateToV2.js +11 -9
- package/lib/cjs/actions/vaultV2/deposit.d.ts +2 -0
- package/lib/cjs/actions/vaultV2/deposit.js +13 -14
- package/lib/cjs/addresses.d.ts +2 -0
- package/lib/cjs/addresses.js +18 -0
- package/lib/cjs/augment/AccrualPosition.d.ts +9 -0
- package/lib/cjs/augment/AccrualPosition.js +8 -0
- package/lib/cjs/augment/AccrualVault.d.ts +8 -0
- package/lib/cjs/augment/AccrualVault.js +7 -0
- package/lib/cjs/augment/Holding.d.ts +8 -0
- package/lib/cjs/augment/Holding.js +7 -0
- package/lib/cjs/augment/Market.d.ts +8 -0
- package/lib/cjs/augment/Market.js +7 -0
- package/lib/cjs/augment/MarketParams.d.ts +8 -0
- package/lib/cjs/augment/MarketParams.js +7 -0
- package/lib/cjs/augment/Position.d.ts +8 -0
- package/lib/cjs/augment/Position.js +7 -0
- package/lib/cjs/augment/Token.d.ts +8 -0
- package/lib/cjs/augment/Token.js +7 -0
- package/lib/cjs/augment/User.d.ts +8 -0
- package/lib/cjs/augment/User.js +7 -0
- package/lib/cjs/augment/Vault.d.ts +8 -0
- package/lib/cjs/augment/Vault.js +7 -0
- package/lib/cjs/augment/VaultConfig.d.ts +8 -0
- package/lib/cjs/augment/VaultConfig.js +7 -0
- package/lib/cjs/augment/VaultMarketAllocation.d.ts +8 -0
- package/lib/cjs/augment/VaultMarketAllocation.js +7 -0
- package/lib/cjs/augment/VaultMarketConfig.d.ts +8 -0
- package/lib/cjs/augment/VaultMarketConfig.js +7 -0
- package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.d.ts +8 -0
- package/lib/cjs/augment/VaultMarketPublicAllocatorConfig.js +8 -0
- package/lib/cjs/augment/VaultUser.d.ts +8 -0
- package/lib/cjs/augment/VaultUser.js +7 -0
- package/lib/cjs/augment.d.ts +14 -0
- package/lib/cjs/augment.js +16 -0
- package/lib/cjs/bundler/actions.d.ts +555 -0
- package/lib/cjs/bundler/actions.js +953 -0
- package/lib/cjs/bundler/index.d.ts +2 -0
- package/lib/cjs/bundler/index.js +18 -0
- package/lib/cjs/bundler/types.d.ts +181 -0
- package/lib/cjs/bundler/types.js +2 -0
- package/lib/cjs/constants.d.ts +3 -0
- package/lib/cjs/constants.js +32 -0
- package/lib/cjs/entities/index.d.ts +6 -3
- package/lib/cjs/entities/index.js +41 -17
- package/lib/cjs/entities/marketV1/marketV1.d.ts +45 -11
- package/lib/cjs/entities/marketV1/marketV1.js +45 -23
- package/lib/cjs/entities/reallocationData.d.ts +193 -0
- package/lib/cjs/entities/reallocationData.js +406 -0
- package/lib/cjs/entities/vaultV1/vaultV1.js +6 -2
- package/lib/cjs/entities/vaultV2/vaultV2.js +6 -1
- package/lib/cjs/errors.d.ts +2 -0
- package/lib/cjs/errors.js +18 -0
- package/lib/cjs/fetch.d.ts +1 -0
- package/lib/cjs/fetch.js +30 -0
- package/lib/cjs/format.d.ts +2 -0
- package/lib/cjs/format.js +22 -0
- package/lib/cjs/helpers/computeReallocations.d.ts +48 -8
- package/lib/cjs/helpers/computeReallocations.js +120 -32
- package/lib/cjs/helpers/constant.d.ts +17 -0
- package/lib/cjs/helpers/constant.js +30 -1
- package/lib/cjs/helpers/index.d.ts +1 -0
- package/lib/cjs/helpers/index.js +9 -1
- package/lib/cjs/helpers/metadata.d.ts +10 -0
- package/lib/cjs/helpers/metadata.js +20 -1
- package/lib/cjs/helpers/validate.d.ts +2 -0
- package/lib/cjs/helpers/validate.js +14 -2
- package/lib/cjs/index.d.ts +0 -1
- package/lib/cjs/index.js +0 -1
- package/lib/cjs/types/client.d.ts +1 -1
- package/lib/cjs/types/error.d.ts +91 -1
- package/lib/cjs/types/error.js +126 -1
- package/lib/cjs/types/sharedLiquidity.d.ts +43 -3
- package/lib/cjs/types.d.ts +3 -0
- package/lib/cjs/types.js +17 -0
- package/lib/cjs/utils.d.ts +9 -0
- package/lib/cjs/utils.js +65 -0
- package/lib/esm/abis.d.ts +2816 -0
- package/lib/esm/abis.js +1922 -0
- package/lib/esm/actions/index.d.ts +3 -0
- package/lib/esm/actions/marketV1/borrow.js +2 -5
- package/lib/esm/actions/marketV1/buildReallocationActions.d.ts +2 -3
- package/lib/esm/actions/marketV1/buildReallocationActions.js +1 -2
- package/lib/esm/actions/marketV1/repay.d.ts +2 -0
- package/lib/esm/actions/marketV1/repay.js +4 -5
- package/lib/esm/actions/marketV1/repayWithdrawCollateral.d.ts +2 -0
- package/lib/esm/actions/marketV1/repayWithdrawCollateral.js +4 -5
- package/lib/esm/actions/marketV1/supplyCollateral.d.ts +2 -0
- package/lib/esm/actions/marketV1/supplyCollateral.js +4 -5
- package/lib/esm/actions/marketV1/supplyCollateralBorrow.d.ts +2 -0
- package/lib/esm/actions/marketV1/supplyCollateralBorrow.js +4 -5
- package/lib/esm/actions/requirements/encode/encodeErc20Approval.js +1 -1
- package/lib/esm/actions/requirements/getRequirementsAction.d.ts +28 -4
- package/lib/esm/actions/requirements/getRequirementsAction.js +29 -5
- package/lib/esm/actions/requirements/getRequirementsApproval.js +1 -1
- package/lib/esm/actions/requirements/index.d.ts +1 -0
- package/lib/esm/actions/requirements/index.js +1 -0
- package/lib/esm/actions/vaultV1/deposit.d.ts +2 -0
- package/lib/esm/actions/vaultV1/deposit.js +3 -4
- package/lib/esm/actions/vaultV1/migrateToV2.d.ts +2 -0
- package/lib/esm/actions/vaultV1/migrateToV2.js +3 -1
- package/lib/esm/actions/vaultV2/deposit.d.ts +2 -0
- package/lib/esm/actions/vaultV2/deposit.js +3 -4
- package/lib/esm/addresses.d.ts +2 -0
- package/lib/esm/addresses.js +1 -0
- package/lib/esm/augment/AccrualPosition.d.ts +9 -0
- package/lib/esm/augment/AccrualPosition.js +5 -0
- package/lib/esm/augment/AccrualVault.d.ts +8 -0
- package/lib/esm/augment/AccrualVault.js +4 -0
- package/lib/esm/augment/Holding.d.ts +8 -0
- package/lib/esm/augment/Holding.js +4 -0
- package/lib/esm/augment/Market.d.ts +8 -0
- package/lib/esm/augment/Market.js +4 -0
- package/lib/esm/augment/MarketParams.d.ts +8 -0
- package/lib/esm/augment/MarketParams.js +4 -0
- package/lib/esm/augment/Position.d.ts +8 -0
- package/lib/esm/augment/Position.js +4 -0
- package/lib/esm/augment/Token.d.ts +8 -0
- package/lib/esm/augment/Token.js +4 -0
- package/lib/esm/augment/User.d.ts +8 -0
- package/lib/esm/augment/User.js +4 -0
- package/lib/esm/augment/Vault.d.ts +8 -0
- package/lib/esm/augment/Vault.js +4 -0
- package/lib/esm/augment/VaultConfig.d.ts +8 -0
- package/lib/esm/augment/VaultConfig.js +4 -0
- package/lib/esm/augment/VaultMarketAllocation.d.ts +8 -0
- package/lib/esm/augment/VaultMarketAllocation.js +4 -0
- package/lib/esm/augment/VaultMarketConfig.d.ts +8 -0
- package/lib/esm/augment/VaultMarketConfig.js +4 -0
- package/lib/esm/augment/VaultMarketPublicAllocatorConfig.d.ts +8 -0
- package/lib/esm/augment/VaultMarketPublicAllocatorConfig.js +5 -0
- package/lib/esm/augment/VaultUser.d.ts +8 -0
- package/lib/esm/augment/VaultUser.js +4 -0
- package/lib/esm/augment.d.ts +14 -0
- package/lib/esm/augment.js +14 -0
- package/lib/esm/bundler/actions.d.ts +555 -0
- package/lib/esm/bundler/actions.js +950 -0
- package/lib/esm/bundler/index.d.ts +2 -0
- package/lib/esm/bundler/index.js +2 -0
- package/lib/esm/bundler/types.d.ts +181 -0
- package/lib/esm/bundler/types.js +1 -0
- package/lib/esm/constants.d.ts +3 -0
- package/lib/esm/constants.js +3 -0
- package/lib/esm/entities/index.d.ts +6 -3
- package/lib/esm/entities/index.js +5 -3
- package/lib/esm/entities/marketV1/marketV1.d.ts +45 -11
- package/lib/esm/entities/marketV1/marketV1.js +46 -24
- package/lib/esm/entities/reallocationData.d.ts +193 -0
- package/lib/esm/entities/reallocationData.js +402 -0
- package/lib/esm/entities/vaultV1/vaultV1.js +6 -2
- package/lib/esm/entities/vaultV2/vaultV2.js +6 -1
- package/lib/esm/errors.d.ts +2 -0
- package/lib/esm/errors.js +1 -0
- package/lib/esm/fetch.d.ts +1 -0
- package/lib/esm/fetch.js +1 -0
- package/lib/esm/format.d.ts +2 -0
- package/lib/esm/format.js +1 -0
- package/lib/esm/helpers/computeReallocations.d.ts +48 -8
- package/lib/esm/helpers/computeReallocations.js +119 -31
- package/lib/esm/helpers/constant.d.ts +17 -0
- package/lib/esm/helpers/constant.js +30 -1
- package/lib/esm/helpers/index.d.ts +1 -0
- package/lib/esm/helpers/index.js +1 -0
- package/lib/esm/helpers/metadata.d.ts +10 -0
- package/lib/esm/helpers/metadata.js +20 -1
- package/lib/esm/helpers/validate.d.ts +2 -0
- package/lib/esm/helpers/validate.js +12 -1
- package/lib/esm/index.d.ts +0 -1
- package/lib/esm/index.js +0 -1
- package/lib/esm/types/client.d.ts +1 -1
- package/lib/esm/types/error.d.ts +91 -1
- package/lib/esm/types/error.js +118 -0
- package/lib/esm/types/sharedLiquidity.d.ts +43 -3
- package/lib/esm/types.d.ts +3 -0
- package/lib/esm/types.js +1 -0
- package/lib/esm/utils.d.ts +9 -0
- package/lib/esm/utils.js +7 -0
- package/package.json +121 -14
- package/src/index.ts +0 -1
package/lib/esm/types/error.js
CHANGED
|
@@ -1,3 +1,55 @@
|
|
|
1
|
+
import { UnknownDataError } from "@morpho-org/blue-sdk";
|
|
2
|
+
/**
|
|
3
|
+
* Typed errors thrown while encoding supported Bundler3 actions.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Import these classes through `@morpho-org/morpho-sdk` when handling
|
|
7
|
+
* failures from `BundlerAction`.
|
|
8
|
+
*/
|
|
9
|
+
export var BundlerErrors;
|
|
10
|
+
(function (BundlerErrors) {
|
|
11
|
+
/**
|
|
12
|
+
* Thrown when an action that requires an offchain signature is encoded before
|
|
13
|
+
* the signature has been attached.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { BundlerErrors } from "@morpho-org/morpho-sdk";
|
|
18
|
+
*
|
|
19
|
+
* if (error instanceof BundlerErrors.MissingSignature) {
|
|
20
|
+
* // Attach the missing permit or Permit2 signature, then encode again.
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
class MissingSignature extends Error {
|
|
25
|
+
constructor() {
|
|
26
|
+
super("missing signature");
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
BundlerErrors.MissingSignature = MissingSignature;
|
|
30
|
+
/**
|
|
31
|
+
* Thrown when an action is unsupported on the requested chain.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* import { BundlerErrors } from "@morpho-org/morpho-sdk";
|
|
36
|
+
*
|
|
37
|
+
* if (error instanceof BundlerErrors.UnexpectedAction) {
|
|
38
|
+
* // Remove or replace the action for the selected chain.
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
class UnexpectedAction extends Error {
|
|
43
|
+
/**
|
|
44
|
+
* @param type - Unsupported Bundler3 action discriminator or name.
|
|
45
|
+
* @param chainId - Chain where the action was requested.
|
|
46
|
+
*/
|
|
47
|
+
constructor(type, chainId) {
|
|
48
|
+
super(`unexpected action "${type}" on chain "${chainId}"`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
BundlerErrors.UnexpectedAction = UnexpectedAction;
|
|
52
|
+
})(BundlerErrors || (BundlerErrors = {}));
|
|
1
53
|
/** Thrown when an asset amount is required to be positive but is zero or negative. */
|
|
2
54
|
export class NonPositiveAssetAmountError extends Error {
|
|
3
55
|
constructor(origin) {
|
|
@@ -76,6 +128,12 @@ export class DepositAssetMismatchError extends Error {
|
|
|
76
128
|
super(`Deposit asset ${depositAsset} does not match requirement signature asset ${signatureAsset}`);
|
|
77
129
|
}
|
|
78
130
|
}
|
|
131
|
+
/** Thrown when a `permit2` requirement signature is missing the `expiration` field. */
|
|
132
|
+
export class Permit2ExpirationMissingError extends Error {
|
|
133
|
+
constructor() {
|
|
134
|
+
super('Requirement signature with action.type === "permit2" must include args.expiration. Re-sign using the permit2 flow.');
|
|
135
|
+
}
|
|
136
|
+
}
|
|
79
137
|
/** Thrown when a vault deposit uses `nativeAmount` but the vault asset is not the chain's wNative. */
|
|
80
138
|
export class NativeAmountOnNonWNativeVaultError extends Error {
|
|
81
139
|
constructor(vaultAsset, wNative) {
|
|
@@ -256,6 +314,16 @@ export class MissingPublicAllocatorConfigError extends Error {
|
|
|
256
314
|
super(`Vault ${vault} has no public allocator configured but was selected for reallocation`);
|
|
257
315
|
}
|
|
258
316
|
}
|
|
317
|
+
/** Thrown when a reallocation attempts to use a disabled vault market. */
|
|
318
|
+
export class DisabledReallocationMarketError extends Error {
|
|
319
|
+
vault;
|
|
320
|
+
marketId;
|
|
321
|
+
constructor(vault, marketId) {
|
|
322
|
+
super(`Vault ${vault} has disabled market ${marketId}. Remove it from reallocations or re-enable the market before reallocating.`);
|
|
323
|
+
this.vault = vault;
|
|
324
|
+
this.marketId = marketId;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
259
327
|
/**
|
|
260
328
|
* Thrown when shared liquidity selected by `computeReallocations` cannot cover
|
|
261
329
|
* the absolute borrow shortfall on the target market — the resulting
|
|
@@ -270,6 +338,56 @@ export class InsufficientSharedLiquidityError extends Error {
|
|
|
270
338
|
this.params = params;
|
|
271
339
|
}
|
|
272
340
|
}
|
|
341
|
+
/** Thrown when reallocation state does not contain a requested market. */
|
|
342
|
+
export class UnknownReallocationMarketError extends UnknownDataError {
|
|
343
|
+
marketId;
|
|
344
|
+
/**
|
|
345
|
+
* @param marketId - Missing market id.
|
|
346
|
+
*/
|
|
347
|
+
constructor(marketId) {
|
|
348
|
+
super(`unknown reallocation market "${marketId}"`);
|
|
349
|
+
this.marketId = marketId;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
/** Thrown when reallocation state does not contain a requested vault. */
|
|
353
|
+
export class UnknownReallocationVaultError extends UnknownDataError {
|
|
354
|
+
vault;
|
|
355
|
+
/**
|
|
356
|
+
* @param vault - Missing vault address.
|
|
357
|
+
*/
|
|
358
|
+
constructor(vault) {
|
|
359
|
+
super(`unknown reallocation vault "${vault}"`);
|
|
360
|
+
this.vault = vault;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
/** Thrown when reallocation state does not contain a requested vault-market config. */
|
|
364
|
+
export class UnknownReallocationVaultMarketConfigError extends UnknownDataError {
|
|
365
|
+
vault;
|
|
366
|
+
marketId;
|
|
367
|
+
/**
|
|
368
|
+
* @param vault - Vault address for the missing config.
|
|
369
|
+
* @param marketId - Market id for the missing config.
|
|
370
|
+
*/
|
|
371
|
+
constructor(vault, marketId) {
|
|
372
|
+
super(`unknown reallocation config for vault "${vault}" on market "${marketId}"`);
|
|
373
|
+
this.vault = vault;
|
|
374
|
+
this.marketId = marketId;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
/** Thrown when reallocation state does not contain a requested market position. */
|
|
378
|
+
export class UnknownReallocationPositionError extends UnknownDataError {
|
|
379
|
+
user;
|
|
380
|
+
marketId;
|
|
381
|
+
/**
|
|
382
|
+
* @param user - Position owner address.
|
|
383
|
+
* @param marketId - Market id for the missing position.
|
|
384
|
+
*/
|
|
385
|
+
constructor(user, marketId) {
|
|
386
|
+
super(`unknown reallocation position of "${user}" on market "${marketId}"`);
|
|
387
|
+
this.user = user;
|
|
388
|
+
this.marketId = marketId;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
273
391
|
/** Thrown when a market borrow's `minSharePrice` slippage bound is negative. */
|
|
274
392
|
export class NonPositiveMinBorrowSharePriceError extends Error {
|
|
275
393
|
constructor(market) {
|
|
@@ -1,9 +1,49 @@
|
|
|
1
|
-
import type { MarketId, MarketParams } from "@morpho-org/blue-sdk";
|
|
2
|
-
import type { PublicAllocatorOptions } from "@morpho-org/simulation-sdk";
|
|
1
|
+
import type { BigIntish, MarketId, MarketParams } from "@morpho-org/blue-sdk";
|
|
3
2
|
import type { Address } from "viem";
|
|
3
|
+
/**
|
|
4
|
+
* Options controlling public allocator withdrawal discovery.
|
|
5
|
+
*/
|
|
6
|
+
export interface PublicAllocatorOptions {
|
|
7
|
+
/** Whether public allocator reallocation discovery is enabled. */
|
|
8
|
+
readonly enabled?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Timestamp at which market interest and public allocator pending caps are evaluated.
|
|
11
|
+
* Defaults to the target market's last update timestamp.
|
|
12
|
+
*/
|
|
13
|
+
readonly timestamp?: BigIntish;
|
|
14
|
+
/**
|
|
15
|
+
* Vaults to consider for reallocation. They must have enabled the PublicAllocator.
|
|
16
|
+
* Defaults to all vaults present in the reallocation data.
|
|
17
|
+
*/
|
|
18
|
+
readonly reallocatableVaults?: readonly Address[];
|
|
19
|
+
/**
|
|
20
|
+
* The maximum utilization each source market may reach when withdrawing
|
|
21
|
+
* shared liquidity, scaled by WAD.
|
|
22
|
+
*/
|
|
23
|
+
readonly maxWithdrawalUtilization?: Readonly<Record<MarketId, bigint | undefined>>;
|
|
24
|
+
/**
|
|
25
|
+
* The default maximum utilization source markets may reach when withdrawing
|
|
26
|
+
* shared liquidity, scaled by WAD.
|
|
27
|
+
* @default 92% (920000000000000000n)
|
|
28
|
+
*/
|
|
29
|
+
readonly defaultMaxWithdrawalUtilization?: bigint;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A computed source-market withdrawal before it is grouped by vault.
|
|
33
|
+
*/
|
|
34
|
+
export interface PublicReallocation {
|
|
35
|
+
/** Source market id to withdraw from. */
|
|
36
|
+
readonly id: MarketId;
|
|
37
|
+
/** Vault that can perform the public allocator reallocation. */
|
|
38
|
+
readonly vault: Address;
|
|
39
|
+
/** Assets to withdraw from the source market. */
|
|
40
|
+
readonly assets: bigint;
|
|
41
|
+
}
|
|
4
42
|
/** A single withdrawal from a source market within a vault reallocation. */
|
|
5
43
|
export interface ReallocationWithdrawal {
|
|
44
|
+
/** Source market parameters to pass to the public allocator. */
|
|
6
45
|
readonly marketParams: MarketParams;
|
|
46
|
+
/** Asset amount to withdraw from the source market. */
|
|
7
47
|
readonly amount: bigint;
|
|
8
48
|
}
|
|
9
49
|
/**
|
|
@@ -31,7 +71,7 @@ export interface ReallocationComputeOptions extends PublicAllocatorOptions {
|
|
|
31
71
|
* is triggered (scaled by WAD). Overrides `defaultSupplyTargetUtilization`
|
|
32
72
|
* for the specified market.
|
|
33
73
|
*/
|
|
34
|
-
readonly supplyTargetUtilization?: Record<MarketId, bigint | undefined
|
|
74
|
+
readonly supplyTargetUtilization?: Readonly<Record<MarketId, bigint | undefined>>;
|
|
35
75
|
/**
|
|
36
76
|
* The default target utilization above which the shared liquidity algorithm
|
|
37
77
|
* is triggered (scaled by WAD).
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type { BigIntish, ChainMetadata, CollateralAllocation, Eip712Field, Erc20AllowanceRecipient, Failable, Fetchable, InputMarketParams, IPermit2Allowance, Loadable, MarketId, MaxBorrowOptions, MaxPositionCapacities, MaxWithdrawCollateralOptions, Pending, Permit2Allowance, } from "@morpho-org/blue-sdk";
|
|
2
|
+
export type { DeploylessFetchParameters, FetchParameters, } from "@morpho-org/blue-sdk-viem";
|
|
3
|
+
export * from "./types/index.js";
|
package/lib/esm/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./types/index.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type { CapacityLimit, RoundingDirection } from "@morpho-org/blue-sdk";
|
|
2
|
+
export { AdaptiveCurveIrmLib, CapacityLimitReason, MarketUtils, MathLib, SharesMath, VaultUtils, } from "@morpho-org/blue-sdk";
|
|
3
|
+
export { decodeBytes32String, getAuthorizationTypedData, getDaiPermitTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
|
|
4
|
+
export type { ArrayElementType, DeepPartial, DottedKeys, FieldType, PartialDottedKeys, WithId, WithIndex, } from "@morpho-org/morpho-ts";
|
|
5
|
+
export { bigIntComparator, createGetValue, createHasValue, deepFreeze, entries, filterDefined, fromEntries, getLast, getLastDefined, getSubdomainBaseUrl, getValue, hasValue, isDefined, isNotNull, isNotUndefined, keys, mergeEntries, retryPromiseLinearBackoff, Time, transformValue, values, } from "@morpho-org/morpho-ts";
|
|
6
|
+
export { computeReallocations } from "./helpers/computeReallocations.js";
|
|
7
|
+
export { addTransactionMetadata } from "./helpers/metadata.js";
|
|
8
|
+
export { computeMaxRepaySharePrice, computeMinBorrowSharePrice, } from "./helpers/slippage.js";
|
|
9
|
+
export { validateAccrualPosition, validateChainId, validateNativeCollateral, validatePositionHealth, validatePositionHealthAfterWithdraw, validateReallocations, validateRepayAmount, validateRepayParams, validateRepayShares, validateSlippageTolerance, validateUserAddress, } from "./helpers/validate.js";
|
package/lib/esm/utils.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { AdaptiveCurveIrmLib, CapacityLimitReason, MarketUtils, MathLib, SharesMath, VaultUtils, } from "@morpho-org/blue-sdk";
|
|
2
|
+
export { decodeBytes32String, getAuthorizationTypedData, getDaiPermitTypedData, getPermit2PermitTypedData, getPermit2TransferFromTypedData, getPermitTypedData, optionalBoolean, readContractRestructured, restructure, safeGetAddress, safeParseNumber, safeParseUnits, } from "@morpho-org/blue-sdk-viem";
|
|
3
|
+
export { bigIntComparator, createGetValue, createHasValue, deepFreeze, entries, filterDefined, fromEntries, getLast, getLastDefined, getSubdomainBaseUrl, getValue, hasValue, isDefined, isNotNull, isNotUndefined, keys, mergeEntries, retryPromiseLinearBackoff, Time, transformValue, values, } from "@morpho-org/morpho-ts";
|
|
4
|
+
export { computeReallocations } from "./helpers/computeReallocations.js";
|
|
5
|
+
export { addTransactionMetadata } from "./helpers/metadata.js";
|
|
6
|
+
export { computeMaxRepaySharePrice, computeMinBorrowSharePrice, } from "./helpers/slippage.js";
|
|
7
|
+
export { validateAccrualPosition, validateChainId, validateNativeCollateral, validatePositionHealth, validatePositionHealthAfterWithdraw, validateReallocations, validateRepayAmount, validateRepayParams, validateRepayShares, validateSlippageTolerance, validateUserAddress, } from "./helpers/validate.js";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morpho-org/morpho-sdk",
|
|
3
3
|
"description": "Abstraction layer for Morpho's complexity.",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.0.0",
|
|
5
5
|
"author": "Morpho Association <contact@morpho.org>",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Foulks-Plb <https://x.com/FoulkPlb>"
|
|
@@ -15,26 +15,140 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"type": "module",
|
|
17
17
|
"main": "src/index.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./lib/esm/index.d.ts",
|
|
21
|
+
"import": "./lib/esm/index.js",
|
|
22
|
+
"require": "./lib/cjs/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./abis": {
|
|
25
|
+
"types": "./lib/esm/abis.d.ts",
|
|
26
|
+
"import": "./lib/esm/abis.js",
|
|
27
|
+
"require": "./lib/cjs/abis.js"
|
|
28
|
+
},
|
|
29
|
+
"./addresses": {
|
|
30
|
+
"types": "./lib/esm/addresses.d.ts",
|
|
31
|
+
"import": "./lib/esm/addresses.js",
|
|
32
|
+
"require": "./lib/cjs/addresses.js"
|
|
33
|
+
},
|
|
34
|
+
"./augment": {
|
|
35
|
+
"types": "./lib/esm/augment.d.ts",
|
|
36
|
+
"import": "./lib/esm/augment.js",
|
|
37
|
+
"require": "./lib/cjs/augment.js"
|
|
38
|
+
},
|
|
39
|
+
"./augment/*": {
|
|
40
|
+
"types": "./lib/esm/augment/*.d.ts",
|
|
41
|
+
"import": "./lib/esm/augment/*.js",
|
|
42
|
+
"require": "./lib/cjs/augment/*.js"
|
|
43
|
+
},
|
|
44
|
+
"./bundler": {
|
|
45
|
+
"types": "./lib/esm/bundler/index.d.ts",
|
|
46
|
+
"import": "./lib/esm/bundler/index.js",
|
|
47
|
+
"require": "./lib/cjs/bundler/index.js"
|
|
48
|
+
},
|
|
49
|
+
"./constants": {
|
|
50
|
+
"types": "./lib/esm/constants.d.ts",
|
|
51
|
+
"import": "./lib/esm/constants.js",
|
|
52
|
+
"require": "./lib/cjs/constants.js"
|
|
53
|
+
},
|
|
54
|
+
"./entities": {
|
|
55
|
+
"types": "./lib/esm/entities/index.d.ts",
|
|
56
|
+
"import": "./lib/esm/entities/index.js",
|
|
57
|
+
"require": "./lib/cjs/entities/index.js"
|
|
58
|
+
},
|
|
59
|
+
"./errors": {
|
|
60
|
+
"types": "./lib/esm/errors.d.ts",
|
|
61
|
+
"import": "./lib/esm/errors.js",
|
|
62
|
+
"require": "./lib/cjs/errors.js"
|
|
63
|
+
},
|
|
64
|
+
"./fetch": {
|
|
65
|
+
"types": "./lib/esm/fetch.d.ts",
|
|
66
|
+
"import": "./lib/esm/fetch.js",
|
|
67
|
+
"require": "./lib/cjs/fetch.js"
|
|
68
|
+
},
|
|
69
|
+
"./format": {
|
|
70
|
+
"types": "./lib/esm/format.d.ts",
|
|
71
|
+
"import": "./lib/esm/format.js",
|
|
72
|
+
"require": "./lib/cjs/format.js"
|
|
73
|
+
},
|
|
74
|
+
"./types": {
|
|
75
|
+
"types": "./lib/esm/types.d.ts",
|
|
76
|
+
"import": "./lib/esm/types.js",
|
|
77
|
+
"require": "./lib/cjs/types.js"
|
|
78
|
+
},
|
|
79
|
+
"./utils": {
|
|
80
|
+
"types": "./lib/esm/utils.d.ts",
|
|
81
|
+
"import": "./lib/esm/utils.js",
|
|
82
|
+
"require": "./lib/cjs/utils.js"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"typesVersions": {
|
|
86
|
+
"*": {
|
|
87
|
+
"abis": [
|
|
88
|
+
"src/abis.ts"
|
|
89
|
+
],
|
|
90
|
+
"addresses": [
|
|
91
|
+
"src/addresses.ts"
|
|
92
|
+
],
|
|
93
|
+
"augment": [
|
|
94
|
+
"src/augment.ts"
|
|
95
|
+
],
|
|
96
|
+
"augment/*": [
|
|
97
|
+
"src/augment/*.ts"
|
|
98
|
+
],
|
|
99
|
+
"bundler": [
|
|
100
|
+
"src/bundler/index.ts"
|
|
101
|
+
],
|
|
102
|
+
"constants": [
|
|
103
|
+
"src/constants.ts"
|
|
104
|
+
],
|
|
105
|
+
"entities": [
|
|
106
|
+
"src/entities/index.ts"
|
|
107
|
+
],
|
|
108
|
+
"errors": [
|
|
109
|
+
"src/errors.ts"
|
|
110
|
+
],
|
|
111
|
+
"fetch": [
|
|
112
|
+
"src/fetch.ts"
|
|
113
|
+
],
|
|
114
|
+
"format": [
|
|
115
|
+
"src/format.ts"
|
|
116
|
+
],
|
|
117
|
+
"types": [
|
|
118
|
+
"src/types.ts"
|
|
119
|
+
],
|
|
120
|
+
"utils": [
|
|
121
|
+
"src/utils.ts"
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"sideEffects": [
|
|
126
|
+
"./src/augment.ts",
|
|
127
|
+
"./src/augment/*.ts",
|
|
128
|
+
"./lib/*/augment.js",
|
|
129
|
+
"./lib/*/augment/*.js"
|
|
130
|
+
],
|
|
18
131
|
"files": [
|
|
19
132
|
"lib"
|
|
20
133
|
],
|
|
21
134
|
"dependencies": {
|
|
22
135
|
"zod": "^4.4.3",
|
|
23
|
-
"@morpho-org/blue-sdk": "^
|
|
24
|
-
"@morpho-org/
|
|
25
|
-
"@morpho-org/morpho-ts": "^2.5.
|
|
26
|
-
"@morpho-org/simulation-sdk": "^3.4.4",
|
|
27
|
-
"@morpho-org/blue-sdk-viem": "^4.6.6"
|
|
136
|
+
"@morpho-org/blue-sdk": "^6.0.0",
|
|
137
|
+
"@morpho-org/blue-sdk-viem": "^5.0.0",
|
|
138
|
+
"@morpho-org/morpho-ts": "^2.5.2"
|
|
28
139
|
},
|
|
29
140
|
"peerDependencies": {
|
|
30
141
|
"viem": "^2.0.0"
|
|
31
142
|
},
|
|
32
143
|
"devDependencies": {
|
|
33
144
|
"dotenv": "^17.4.2",
|
|
145
|
+
"fast-check": "^4.8.0",
|
|
34
146
|
"typescript": "^6.0.3",
|
|
35
147
|
"viem": "^2.49.3",
|
|
36
148
|
"vitest": "^4.1.6",
|
|
37
|
-
"@morpho-org/
|
|
149
|
+
"@morpho-org/bundler-sdk-viem": "^5.0.1",
|
|
150
|
+
"@morpho-org/simulation-sdk": "^4.0.1",
|
|
151
|
+
"@morpho-org/test": "^2.8.0"
|
|
38
152
|
},
|
|
39
153
|
"scripts": {
|
|
40
154
|
"prepublish": "$npm_execpath build",
|
|
@@ -42,12 +156,5 @@
|
|
|
42
156
|
"build:cjs": "tsc --build tsconfig.build.cjs.json && echo '{\"type\":\"commonjs\"}' > lib/cjs/package.json",
|
|
43
157
|
"build:esm": "tsc --build tsconfig.build.esm.json && echo '{\"type\":\"module\"}' > lib/esm/package.json",
|
|
44
158
|
"test": "vitest --root ../.. --project morpho-sdk"
|
|
45
|
-
},
|
|
46
|
-
"exports": {
|
|
47
|
-
".": {
|
|
48
|
-
"types": "./lib/esm/index.d.ts",
|
|
49
|
-
"import": "./lib/esm/index.js",
|
|
50
|
-
"require": "./lib/cjs/index.js"
|
|
51
|
-
}
|
|
52
159
|
}
|
|
53
160
|
}
|