@morpho-org/blue-sdk 2.0.0-next.32 → 2.0.0-next.33

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.
@@ -27,7 +27,7 @@ export interface PeripheralBalance {
27
27
  */
28
28
  dstAmount: bigint;
29
29
  }
30
- export interface InputAssetBalances extends Omit<PeripheralBalance, "type"> {
30
+ export interface IAssetBalances extends Omit<PeripheralBalance, "type"> {
31
31
  }
32
32
  export declare class AssetBalances {
33
33
  /**
@@ -42,7 +42,7 @@ export declare class AssetBalances {
42
42
  } & {
43
43
  [T in Exclude<PeripheralBalanceType, "base">]?: PeripheralBalance;
44
44
  };
45
- constructor(balance: InputAssetBalances);
45
+ constructor(balance: IAssetBalances);
46
46
  add(balance: PeripheralBalance): this;
47
47
  sub(balance: PeripheralBalance): this;
48
48
  }
@@ -8,25 +8,25 @@ export interface Permit2Allowance {
8
8
  expiration: bigint;
9
9
  nonce: bigint;
10
10
  }
11
- export interface InputPermit2Allowance {
11
+ export interface IPermit2Allowance {
12
12
  amount: BigIntish;
13
13
  expiration: BigIntish;
14
14
  nonce: BigIntish;
15
15
  }
16
- export interface InputHolding {
16
+ export interface IHolding {
17
17
  user: Address;
18
18
  token: Address;
19
19
  erc20Allowances: {
20
20
  [key in Erc20AllowanceRecipient]: bigint;
21
21
  };
22
22
  permit2Allowances: {
23
- [key in Permit2AllowanceRecipient]: InputPermit2Allowance;
23
+ [key in Permit2AllowanceRecipient]: IPermit2Allowance;
24
24
  };
25
25
  erc2612Nonce?: bigint;
26
26
  canTransfer?: boolean;
27
27
  balance: bigint;
28
28
  }
29
- export declare class Holding implements InputHolding {
29
+ export declare class Holding implements IHolding {
30
30
  /**
31
31
  * The user of this holding.
32
32
  */
@@ -60,5 +60,5 @@ export declare class Holding implements InputHolding {
60
60
  * `undefined` if the token does not support ERC-2612.
61
61
  */
62
62
  erc2612Nonce?: bigint;
63
- constructor({ user, token, erc20Allowances, permit2Allowances, balance, erc2612Nonce, canTransfer, }: InputHolding);
63
+ constructor({ user, token, erc20Allowances, permit2Allowances, balance, erc2612Nonce, canTransfer, }: IHolding);
64
64
  }
@@ -26,7 +26,7 @@ export interface MaxPositionCapacities {
26
26
  supplyCollateral: CapacityLimit;
27
27
  withdrawCollateral: CapacityLimit | undefined;
28
28
  }
29
- export interface InputMarket {
29
+ export interface IMarket {
30
30
  params: MarketParams;
31
31
  totalSupplyAssets: bigint;
32
32
  totalBorrowAssets: bigint;
@@ -40,7 +40,7 @@ export interface InputMarket {
40
40
  /**
41
41
  * Represents a lending market on Morpho Blue.
42
42
  */
43
- export declare class Market implements InputMarket {
43
+ export declare class Market implements IMarket {
44
44
  /**
45
45
  * The market's params.
46
46
  */
@@ -79,7 +79,7 @@ export declare class Market implements InputMarket {
79
79
  * Undefined otherwise.
80
80
  */
81
81
  rateAtTarget?: bigint;
82
- constructor({ params, totalSupplyAssets, totalBorrowAssets, totalSupplyShares, totalBorrowShares, lastUpdate, fee, price, rateAtTarget, }: InputMarket);
82
+ constructor({ params, totalSupplyAssets, totalBorrowAssets, totalSupplyShares, totalBorrowShares, lastUpdate, fee, price, rateAtTarget, }: IMarket);
83
83
  /**
84
84
  * The market's hex-encoded id, defined as the hash of the market params.
85
85
  */
@@ -1,15 +1,16 @@
1
1
  import type { Address, BigIntish, MarketId } from "../types.js";
2
- export interface InputMarketParams {
2
+ export interface IMarketParams {
3
3
  loanToken: Address;
4
4
  collateralToken: Address;
5
5
  oracle: Address;
6
6
  irm: Address;
7
7
  lltv: BigIntish;
8
8
  }
9
+ export type InputMarketParams = Pick<MarketParams, "loanToken" | "collateralToken" | "oracle" | "irm" | "lltv">;
9
10
  /**
10
11
  * Represents a market's configuration (also called market params).
11
12
  */
12
- export declare class MarketParams implements InputMarketParams {
13
+ export declare class MarketParams implements IMarketParams {
13
14
  private static readonly _CACHE;
14
15
  /**
15
16
  * Returns the previously cached market config for the given id, if any.
@@ -48,5 +49,5 @@ export declare class MarketParams implements InputMarketParams {
48
49
  * The market's liquidation incentive factor.
49
50
  */
50
51
  readonly liquidationIncentiveFactor: bigint;
51
- constructor(params: InputMarketParams);
52
+ constructor(params: IMarketParams);
52
53
  }
@@ -1,6 +1,6 @@
1
1
  import { type RoundingDirection } from "../math/index.js";
2
2
  import type { BigIntish, MarketId } from "../types.js";
3
- import type { InputMarketParams } from "./MarketParams.js";
3
+ import type { IMarketParams } from "./MarketParams.js";
4
4
  /**
5
5
  * Namespace of utility functions to ease market-related calculations.
6
6
  */
@@ -9,7 +9,7 @@ export declare namespace MarketUtils {
9
9
  * Returns the id of a market based on its params.
10
10
  * @param market The market params.
11
11
  */
12
- function getMarketId(market: InputMarketParams): MarketId;
12
+ function getMarketId(market: IMarketParams): MarketId;
13
13
  /**
14
14
  * Returns the liquidation incentive factor for a given market params.
15
15
  * @param config The market params.
@@ -1,13 +1,13 @@
1
1
  import { Market, type MaxBorrowOptions, type MaxWithdrawCollateralOptions } from "../market/index.js";
2
2
  import type { Address, BigIntish, MarketId } from "../types.js";
3
- export interface InputPosition {
3
+ export interface IPosition {
4
4
  user: Address;
5
5
  marketId: MarketId;
6
6
  supplyShares: bigint;
7
7
  borrowShares: bigint;
8
8
  collateral: bigint;
9
9
  }
10
- export declare class Position implements InputPosition {
10
+ export declare class Position implements IPosition {
11
11
  /**
12
12
  * The user holding this position.
13
13
  */
@@ -28,16 +28,16 @@ export declare class Position implements InputPosition {
28
28
  * The amount of collateral assets held with this position.
29
29
  */
30
30
  collateral: bigint;
31
- constructor({ user, marketId, supplyShares, borrowShares, collateral, }: InputPosition);
31
+ constructor({ user, marketId, supplyShares, borrowShares, collateral, }: IPosition);
32
32
  }
33
- export interface InputAccrualPosition extends Omit<InputPosition, "marketId"> {
33
+ export interface IAccrualPosition extends Omit<IPosition, "marketId"> {
34
34
  }
35
- export declare class AccrualPosition extends Position implements InputAccrualPosition {
35
+ export declare class AccrualPosition extends Position implements IAccrualPosition {
36
36
  /**
37
37
  * The market on which this position is held.
38
38
  */
39
39
  readonly market: Market;
40
- constructor(position: InputAccrualPosition, market: Market);
40
+ constructor(position: IAccrualPosition, market: Market);
41
41
  get supplyAssets(): bigint;
42
42
  get borrowAssets(): bigint;
43
43
  /**
@@ -1,10 +1,10 @@
1
1
  import { type RoundingDirection } from "../math/index.js";
2
2
  import type { Address, BigIntish } from "../types.js";
3
- import type { InputToken } from "./Token.js";
3
+ import type { IToken } from "./Token.js";
4
4
  import { WrappedToken } from "./WrappedToken.js";
5
5
  export declare class ConstantWrappedToken extends WrappedToken {
6
6
  readonly underlyingDecimals: bigint;
7
- constructor(token: InputToken, underlying: Address, underlyingDecimals?: BigIntish);
7
+ constructor(token: IToken, underlying: Address, underlyingDecimals?: BigIntish);
8
8
  toWrappedExactAmountIn(unwrappedAmount: bigint, _slippage?: bigint, rounding?: RoundingDirection): bigint;
9
9
  /** The amount of unwrappedTokens that should be wrapped to receive `wrappedAmount` */
10
10
  toWrappedExactAmountOut(wrappedAmount: bigint, _slippage?: bigint, rounding?: RoundingDirection): bigint;
@@ -1,11 +1,11 @@
1
1
  import { type RoundingDirection } from "../math/index.js";
2
2
  import type { Address } from "../types.js";
3
- import type { InputToken } from "./Token.js";
3
+ import type { IToken } from "./Token.js";
4
4
  import { WrappedToken } from "./WrappedToken.js";
5
5
  export declare class ExchangeRateWrappedToken extends WrappedToken {
6
6
  readonly underlying: Address;
7
7
  wrappedTokenExchangeRate: bigint;
8
- constructor(token: InputToken, underlying: Address, wrappedTokenExchangeRate: bigint);
8
+ constructor(token: IToken, underlying: Address, wrappedTokenExchangeRate: bigint);
9
9
  protected _wrap(amount: bigint, rounding: RoundingDirection): bigint;
10
10
  protected _unwrap(amount: bigint, rounding: RoundingDirection): bigint;
11
11
  }
@@ -1,14 +1,14 @@
1
1
  import { type ChainId } from "../chain.js";
2
2
  import { type RoundingDirection } from "../math/index.js";
3
3
  import type { Address, BigIntish } from "../types.js";
4
- export interface InputToken {
4
+ export interface IToken {
5
5
  address: Address;
6
6
  name?: string;
7
7
  symbol?: string;
8
8
  decimals?: BigIntish;
9
9
  price?: BigIntish;
10
10
  }
11
- export declare class Token implements InputToken {
11
+ export declare class Token implements IToken {
12
12
  static native(chainId: ChainId): Token;
13
13
  /**
14
14
  * The token's address.
@@ -30,7 +30,7 @@ export declare class Token implements InputToken {
30
30
  * Price of the token in USD (scaled by WAD).
31
31
  */
32
32
  price?: bigint;
33
- constructor({ address, name, symbol, decimals, price }: InputToken);
33
+ constructor({ address, name, symbol, decimals, price }: IToken);
34
34
  /**
35
35
  * Quotes an amount in USD (scaled by WAD) in this token.
36
36
  * Returns `undefined` iff the token's price is undefined.
@@ -1,12 +1,12 @@
1
1
  import type { RoundingDirection } from "../math/index.js";
2
2
  import type { Address } from "../types.js";
3
- import type { InputVaultConfig } from "../vault/VaultConfig.js";
3
+ import type { IVaultConfig } from "../vault/VaultConfig.js";
4
4
  import { WrappedToken } from "./WrappedToken.js";
5
- export interface InputVaultToken {
5
+ export interface IVaultToken {
6
6
  totalAssets: bigint;
7
7
  totalSupply: bigint;
8
8
  }
9
- export declare class VaultToken extends WrappedToken implements InputVaultToken {
9
+ export declare class VaultToken extends WrappedToken implements IVaultToken {
10
10
  readonly asset: Address;
11
11
  readonly decimalsOffset: bigint;
12
12
  /**
@@ -17,7 +17,7 @@ export declare class VaultToken extends WrappedToken implements InputVaultToken
17
17
  * The ERC4626 vault's total assets.
18
18
  */
19
19
  totalAssets: bigint;
20
- constructor(config: InputVaultConfig, { totalAssets, totalSupply }: InputVaultToken);
20
+ constructor(config: IVaultConfig, { totalAssets, totalSupply }: IVaultToken);
21
21
  protected _wrap(amount: bigint, rounding?: RoundingDirection): bigint;
22
22
  protected _unwrap(amount: bigint, rounding?: RoundingDirection): bigint;
23
23
  }
@@ -1,9 +1,9 @@
1
1
  import { type RoundingDirection } from "../math/index.js";
2
2
  import type { Address } from "../types.js";
3
- import { type InputToken, Token } from "./Token.js";
3
+ import { type IToken, Token } from "./Token.js";
4
4
  export declare abstract class WrappedToken extends Token {
5
5
  readonly underlying: Address;
6
- constructor(token: InputToken, underlying: Address);
6
+ constructor(token: IToken, underlying: Address);
7
7
  /** The expected amount when wrapping `unwrappedAmount` */
8
8
  toWrappedExactAmountIn(unwrappedAmount: bigint, slippage?: bigint, rounding?: RoundingDirection): bigint;
9
9
  /** The amount of unwrappedTokens that should be wrapped to receive `wrappedAmount` */
@@ -2,8 +2,8 @@ import { type CapacityLimit } from "../market/index.js";
2
2
  import { type RoundingDirection } from "../math/index.js";
3
3
  import { VaultToken } from "../token/index.js";
4
4
  import type { Address, BigIntish, MarketId } from "../types.js";
5
- import type { InputVaultConfig } from "./VaultConfig.js";
6
- import { type InputVaultMarketAllocation, VaultMarketAllocation } from "./VaultMarketAllocation.js";
5
+ import type { IVaultConfig } from "./VaultConfig.js";
6
+ import { type IVaultMarketAllocation, VaultMarketAllocation } from "./VaultMarketAllocation.js";
7
7
  export interface Pending<T> {
8
8
  value: T;
9
9
  validAt: bigint;
@@ -22,7 +22,7 @@ export interface VaultPublicAllocatorConfig {
22
22
  */
23
23
  accruedFee: bigint;
24
24
  }
25
- export interface InputVault extends InputVaultConfig {
25
+ export interface IVault extends IVaultConfig {
26
26
  curator: Address;
27
27
  owner: Address;
28
28
  guardian: Address;
@@ -40,7 +40,7 @@ export interface InputVault extends InputVaultConfig {
40
40
  lastTotalAssets: bigint;
41
41
  publicAllocatorConfig?: VaultPublicAllocatorConfig;
42
42
  }
43
- export declare class Vault extends VaultToken implements InputVault {
43
+ export declare class Vault extends VaultToken implements IVault {
44
44
  /**
45
45
  * The vault's share token's name.
46
46
  */
@@ -105,7 +105,7 @@ export declare class Vault extends VaultToken implements InputVault {
105
105
  * The MetaMorpho vault's public allocator configuration.
106
106
  */
107
107
  publicAllocatorConfig?: VaultPublicAllocatorConfig;
108
- constructor({ curator, owner, guardian, publicAllocatorConfig, fee, feeRecipient, skimRecipient, pendingTimelock, pendingGuardian, pendingOwner, timelock, supplyQueue, withdrawQueue, totalSupply, totalAssets, lastTotalAssets, ...config }: InputVault);
108
+ constructor({ curator, owner, guardian, publicAllocatorConfig, fee, feeRecipient, skimRecipient, pendingTimelock, pendingGuardian, pendingOwner, timelock, supplyQueue, withdrawQueue, totalSupply, totalAssets, lastTotalAssets, ...config }: IVault);
109
109
  /**
110
110
  * The amount of interest in assets accrued since the last interaction with the vault.
111
111
  */
@@ -120,9 +120,9 @@ export interface CollateralAllocation {
120
120
  markets: Set<MarketId>;
121
121
  proportion: bigint;
122
122
  }
123
- export interface InputAccrualVault extends Omit<InputVault, "withdrawQueue" | "totalAssets"> {
123
+ export interface IAccrualVault extends Omit<IVault, "withdrawQueue" | "totalAssets"> {
124
124
  }
125
- export declare class AccrualVault extends Vault implements InputAccrualVault {
125
+ export declare class AccrualVault extends Vault implements IAccrualVault {
126
126
  /**
127
127
  * The allocation of the vault on each market enabled.
128
128
  */
@@ -131,12 +131,12 @@ export declare class AccrualVault extends Vault implements InputAccrualVault {
131
131
  * The proportion of assets of the vault supplied to markets collateralized by each collateral asset.
132
132
  */
133
133
  readonly collateralAllocations: Map<Address, CollateralAllocation>;
134
- constructor(vault: InputAccrualVault,
134
+ constructor(vault: IAccrualVault,
135
135
  /**
136
136
  * The allocation of the vault on each market of the withdraw queue,
137
137
  * in the same order as the withdraw queue.
138
138
  */
139
- allocations: Omit<InputVaultMarketAllocation, "proportion">[]);
139
+ allocations: Omit<IVaultMarketAllocation, "proportion">[]);
140
140
  /**
141
141
  * The vault's liquidity directly available from allocated markets.
142
142
  */
@@ -1,13 +1,13 @@
1
1
  import type { ChainId } from "../chain.js";
2
2
  import type { Address, BigIntish } from "../types.js";
3
- export interface InputVaultConfig {
3
+ export interface IVaultConfig {
4
4
  address: Address;
5
5
  decimalsOffset: BigIntish;
6
6
  symbol: string;
7
7
  name: string;
8
8
  asset: Address;
9
9
  }
10
- export declare class VaultConfig implements InputVaultConfig {
10
+ export declare class VaultConfig implements IVaultConfig {
11
11
  readonly chainId?: number | undefined;
12
12
  protected static readonly _CACHE: Record<number, Record<Address, VaultConfig>>;
13
13
  static get(address: Address, chainId: ChainId): VaultConfig;
@@ -17,5 +17,5 @@ export declare class VaultConfig implements InputVaultConfig {
17
17
  readonly symbol: string;
18
18
  readonly name: string;
19
19
  readonly asset: Address;
20
- constructor({ address, decimalsOffset, symbol, name, asset }: InputVaultConfig, chainId?: number | undefined);
20
+ constructor({ address, decimalsOffset, symbol, name, asset }: IVaultConfig, chainId?: number | undefined);
21
21
  }
@@ -1,10 +1,10 @@
1
1
  import type { AccrualPosition } from "../position/index.js";
2
2
  import type { VaultMarketConfig } from "./VaultMarketConfig.js";
3
- export interface InputVaultMarketAllocation {
3
+ export interface IVaultMarketAllocation {
4
4
  config: VaultMarketConfig;
5
5
  position: AccrualPosition;
6
6
  }
7
- export declare class VaultMarketAllocation implements InputVaultMarketAllocation {
7
+ export declare class VaultMarketAllocation implements IVaultMarketAllocation {
8
8
  /**
9
9
  * The vault's configuration on the corresponding market.
10
10
  */
@@ -13,7 +13,7 @@ export declare class VaultMarketAllocation implements InputVaultMarketAllocation
13
13
  * The vault's position on the corresponding market.
14
14
  */
15
15
  readonly position: AccrualPosition;
16
- constructor({ config, position }: InputVaultMarketAllocation);
16
+ constructor({ config, position }: IVaultMarketAllocation);
17
17
  get vault(): `0x${string}`;
18
18
  get marketId(): import("../types.js").MarketId;
19
19
  get utilization(): bigint;
@@ -1,7 +1,7 @@
1
1
  import type { Address, MarketId } from "../types.js";
2
2
  import type { Pending } from "./Vault.js";
3
3
  import type { VaultMarketPublicAllocatorConfig } from "./VaultMarketPublicAllocatorConfig.js";
4
- export interface InputVaultMarketConfig {
4
+ export interface IVaultMarketConfig {
5
5
  vault: Address;
6
6
  marketId: MarketId;
7
7
  cap: bigint;
@@ -10,7 +10,7 @@ export interface InputVaultMarketConfig {
10
10
  enabled: boolean;
11
11
  publicAllocatorConfig: VaultMarketPublicAllocatorConfig;
12
12
  }
13
- export declare class VaultMarketConfig implements InputVaultMarketConfig {
13
+ export declare class VaultMarketConfig implements IVaultMarketConfig {
14
14
  /**
15
15
  * The vault's address.
16
16
  */
@@ -39,5 +39,5 @@ export declare class VaultMarketConfig implements InputVaultMarketConfig {
39
39
  * The vault's PublicAllocator configuration on the corresponding market.
40
40
  */
41
41
  readonly publicAllocatorConfig: VaultMarketPublicAllocatorConfig;
42
- constructor({ vault, marketId, cap, pendingCap, removableAt, enabled, publicAllocatorConfig, }: InputVaultMarketConfig);
42
+ constructor({ vault, marketId, cap, pendingCap, removableAt, enabled, publicAllocatorConfig, }: IVaultMarketConfig);
43
43
  }
@@ -2,13 +2,13 @@ import type { Address, MarketId } from "../types.js";
2
2
  /**
3
3
  * The vault's configuration of a market on the PublicAllocator.
4
4
  */
5
- export interface InputVaultMarketPublicAllocatorConfig {
5
+ export interface IVaultMarketPublicAllocatorConfig {
6
6
  vault: Address;
7
7
  marketId: MarketId;
8
8
  maxIn: bigint;
9
9
  maxOut: bigint;
10
10
  }
11
- export declare class VaultMarketPublicAllocatorConfig implements InputVaultMarketPublicAllocatorConfig {
11
+ export declare class VaultMarketPublicAllocatorConfig implements IVaultMarketPublicAllocatorConfig {
12
12
  /**
13
13
  * The vault's address.
14
14
  */
@@ -25,5 +25,5 @@ export declare class VaultMarketPublicAllocatorConfig implements InputVaultMarke
25
25
  * The maximum amount of tokens that can be allocated out of this market by the vault via the PublicAllocator.
26
26
  */
27
27
  maxOut: bigint;
28
- constructor({ vault, marketId, maxIn, maxOut, }: InputVaultMarketPublicAllocatorConfig);
28
+ constructor({ vault, marketId, maxIn, maxOut, }: IVaultMarketPublicAllocatorConfig);
29
29
  }
@@ -1,11 +1,11 @@
1
1
  import type { Address } from "../types.js";
2
- export interface InputVaultUser {
2
+ export interface IVaultUser {
3
3
  vault: Address;
4
4
  user: Address;
5
5
  isAllocator: boolean;
6
6
  allowance: bigint;
7
7
  }
8
- export declare class VaultUser implements InputVaultUser {
8
+ export declare class VaultUser implements IVaultUser {
9
9
  /**
10
10
  * The vault's address.
11
11
  */
@@ -22,5 +22,5 @@ export declare class VaultUser implements InputVaultUser {
22
22
  * The allowance of the vault over the user's underlying assets.
23
23
  */
24
24
  allowance: bigint;
25
- constructor({ vault, user, isAllocator, allowance }: InputVaultUser);
25
+ constructor({ vault, user, isAllocator, allowance }: IVaultUser);
26
26
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@morpho-org/blue-sdk",
3
3
  "description": "Framework-agnostic package that defines Morpho-related entity classes (such as `Market`, `Token`, `Vault`).",
4
- "version": "2.0.0-next.32",
4
+ "version": "2.0.0-next.33",
5
5
  "author": "Morpho Association <contact@morpho.org>",
6
6
  "contributors": [
7
7
  "Rubilmax <rmilon@gmail.com>"
@@ -28,7 +28,7 @@
28
28
  "viem": "^2.21.54",
29
29
  "vitest": "^2.1.8",
30
30
  "@morpho-org/morpho-ts": "^2.0.0-next.16",
31
- "@morpho-org/test": "^2.0.0-next.27"
31
+ "@morpho-org/test": "^2.0.0-next.28"
32
32
  },
33
33
  "scripts": {
34
34
  "prepublish": "$npm_execpath build",