@morpho-org/blue-sdk 3.0.0-next.6 → 3.0.0-next.8

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.
@@ -1,4 +1,4 @@
1
- import { Market, type MaxBorrowOptions, type MaxPositionCapacities, type MaxWithdrawCollateralOptions } from "../market/index.js";
1
+ import { type IMarket, Market, type MaxBorrowOptions, type MaxPositionCapacities, type MaxWithdrawCollateralOptions } from "../market/index.js";
2
2
  import type { Address, BigIntish, MarketId } from "../types.js";
3
3
  export interface IPosition {
4
4
  user: Address;
@@ -37,7 +37,7 @@ export declare class AccrualPosition extends Position implements IAccrualPositio
37
37
  * The market on which this position is held.
38
38
  */
39
39
  readonly market: Market;
40
- constructor(position: IAccrualPosition, market: Market);
40
+ constructor(position: IAccrualPosition, market: IMarket);
41
41
  get supplyAssets(): bigint;
42
42
  get borrowAssets(): bigint;
43
43
  /**
@@ -98,25 +98,11 @@ export declare class AccrualPosition extends Position implements IAccrualPositio
98
98
  * If the collateral price is 0, usage is `MaxUint256`.
99
99
  */
100
100
  get borrowCapacityUsage(): bigint | undefined;
101
- /**
102
- * Returns the maximum amount of loan assets that can be borrowed given a certain borrow position
103
- * and the reason for the limit.
104
- * Returns `undefined` iff the market's price is undefined.
105
- * @deprecated Use `getBorrowCapacityLimit` instead.
106
- */
107
- get borrowCapacityLimit(): import("../market/Market.js").CapacityLimit | undefined;
108
101
  /**
109
102
  * Returns the maximum amount of loan assets that can be withdrawn given a certain supply position
110
103
  * and a balance of loan assets, and the reason for the limit.
111
104
  */
112
105
  get withdrawCapacityLimit(): import("../market/Market.js").CapacityLimit;
113
- /**
114
- * Returns the maximum amount of collateral assets that can be withdrawn given a certain borrow position
115
- * and the reason for the limit.
116
- * Returns `undefined` iff the market's price is undefined.
117
- * @deprecated Use `getWithdrawCollateralCapacityLimit` instead.
118
- */
119
- get withdrawCollateralCapacityLimit(): import("../market/Market.js").CapacityLimit | undefined;
120
106
  /**
121
107
  * Returns a new position derived from this position, whose interest has been accrued up to the given timestamp.
122
108
  * @param timestamp The timestamp at which to accrue interest. Must be greater than or equal to the market's `lastUpdate`.
@@ -40,8 +40,9 @@ class AccrualPosition extends Position {
40
40
  */
41
41
  market;
42
42
  constructor(position, market) {
43
- super({ ...position, marketId: market.id });
44
- this.market = market;
43
+ const _market = new index_js_1.Market(market);
44
+ super({ ...position, marketId: _market.id });
45
+ this.market = _market;
45
46
  }
46
47
  get supplyAssets() {
47
48
  return this.market.toSupplyAssets(this.supplyShares);
@@ -132,15 +133,6 @@ class AccrualPosition extends Position {
132
133
  get borrowCapacityUsage() {
133
134
  return this.market.getBorrowCapacityUsage(this);
134
135
  }
135
- /**
136
- * Returns the maximum amount of loan assets that can be borrowed given a certain borrow position
137
- * and the reason for the limit.
138
- * Returns `undefined` iff the market's price is undefined.
139
- * @deprecated Use `getBorrowCapacityLimit` instead.
140
- */
141
- get borrowCapacityLimit() {
142
- return this.market.getBorrowCapacityLimit(this);
143
- }
144
136
  /**
145
137
  * Returns the maximum amount of loan assets that can be withdrawn given a certain supply position
146
138
  * and a balance of loan assets, and the reason for the limit.
@@ -148,15 +140,6 @@ class AccrualPosition extends Position {
148
140
  get withdrawCapacityLimit() {
149
141
  return this.market.getWithdrawCapacityLimit(this);
150
142
  }
151
- /**
152
- * Returns the maximum amount of collateral assets that can be withdrawn given a certain borrow position
153
- * and the reason for the limit.
154
- * Returns `undefined` iff the market's price is undefined.
155
- * @deprecated Use `getWithdrawCollateralCapacityLimit` instead.
156
- */
157
- get withdrawCollateralCapacityLimit() {
158
- return this.market.getWithdrawCollateralCapacityLimit(this);
159
- }
160
143
  /**
161
144
  * Returns a new position derived from this position, whose interest has been accrued up to the given timestamp.
162
145
  * @param timestamp The timestamp at which to accrue interest. Must be greater than or equal to the market's `lastUpdate`.