@curvefi/llamalend-api 2.0.12 → 2.0.13

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.
@@ -66,6 +66,7 @@ export class LendMarketTemplate {
66
66
  userBoost: userPosition.userBoost.bind(userPosition),
67
67
  forceUpdateUserState: userPosition.forceUpdateUserState.bind(userPosition),
68
68
  getCurrentLeverageParams: userPosition.getCurrentLeverageParams.bind(userPosition),
69
+ clearCache: userPosition.clearCache.bind(userPosition),
69
70
  };
70
71
  this.stats = {
71
72
  parameters: stats.statsParameters.bind(stats),
@@ -38,4 +38,5 @@ export interface IUserPosition {
38
38
  stateCollateral: string;
39
39
  totalDepositFromUser: string;
40
40
  }>;
41
+ clearCache: () => void;
41
42
  }
@@ -44,5 +44,7 @@ export declare class UserPositionModule implements IUserPosition {
44
44
  stateCollateral: string;
45
45
  totalDepositFromUser: string;
46
46
  }>;
47
+ /** Clears the user position cache for the current user. */
48
+ clearCache: () => void;
47
49
  forceUpdateUserState(newTx: string, userAddress?: string): Promise<void>;
48
50
  }
@@ -21,6 +21,8 @@ export class UserPositionModule {
21
21
  promise: true,
22
22
  maxAge: 10 * 1000, // 10s
23
23
  });
24
+ /** Clears the user position cache for the current user. */
25
+ this.clearCache = () => this._userState.clear();
24
26
  this.market = market;
25
27
  this.llamalend = market.getLlamalend();
26
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curvefi/llamalend-api",
3
- "version": "2.0.12",
3
+ "version": "2.0.13",
4
4
  "description": "JavaScript library for Curve Lending",
5
5
  "main": "lib/index.js",
6
6
  "author": "Macket",
@@ -163,6 +163,7 @@ export class LendMarketTemplate<V extends 'v1' | 'v2' = 'v1' | 'v2'> {
163
163
  userBoost: userPosition.userBoost.bind(userPosition),
164
164
  forceUpdateUserState: userPosition.forceUpdateUserState.bind(userPosition),
165
165
  getCurrentLeverageParams: userPosition.getCurrentLeverageParams.bind(userPosition),
166
+ clearCache: userPosition.clearCache.bind(userPosition),
166
167
  }
167
168
 
168
169
  this.stats = {
@@ -21,4 +21,5 @@ export interface IUserPosition {
21
21
  userBoost: (address?: string) => Promise<string>,
22
22
  forceUpdateUserState: (newTx: string, userAddress?: string) => Promise<void>,
23
23
  getCurrentLeverageParams: (userAddress: string) => Promise<{ stateCollateral: string, totalDepositFromUser: string }>,
24
+ clearCache: () => void,
24
25
  }
@@ -231,6 +231,9 @@ export class UserPositionModule implements IUserPosition {
231
231
  };
232
232
  }
233
233
 
234
+ /** Clears the user position cache for the current user. */
235
+ public clearCache = (): void => this._userState.clear();
236
+
234
237
  public async forceUpdateUserState(newTx: string, userAddress?: string): Promise<void> {
235
238
  const address = userAddress || this.llamalend.signerAddress;
236
239
  if (!address) throw Error("Need to connect wallet or pass address into args");