@haven-fi/solauto-sdk 1.0.36 → 1.0.38

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,6 +14,7 @@ export declare function getSolautoFeesBps(isReferred: boolean, feeType: FeeType)
14
14
  export declare function eligibileForRebalance(positionState: PositionState, positionSettings: SolautoSettingsParameters, positionDca: DCASettings): boolean;
15
15
  export declare function eligibleForRefresh(positionState: PositionState, positionSettings: SolautoSettingsParameters): boolean;
16
16
  export declare function getSolautoManagedPositions(umi: Umi, authority?: PublicKey): Promise<{
17
+ publicKey: PublicKey;
17
18
  authority: PublicKey;
18
19
  positionId: number;
19
20
  lendingPlatform: LendingPlatform;
@@ -21,6 +22,7 @@ export declare function getSolautoManagedPositions(umi: Umi, authority?: PublicK
21
22
  export declare function getAllReferralStates(umi: Umi): Promise<PublicKey[]>;
22
23
  export declare function getReferralsByUser(umi: Umi, user: PublicKey): Promise<PublicKey[]>;
23
24
  export declare function getAllPositionsByAuthority(umi: Umi, user: PublicKey): Promise<SolautoPositionDetails[]>;
25
+ export declare function positionStateWithLatestPrices(umi: Umi, state: PositionState, protocolAccount: PublicKey, lendingPlatform: LendingPlatform): Promise<PositionState | undefined>;
24
26
  type PositionAdjustment = {
25
27
  type: "supply";
26
28
  value: bigint;
@@ -1 +1 @@
1
- {"version":3,"file":"generalUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/solauto/generalUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAoB,GAAG,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAClB,OAAO,EACP,eAAe,EACf,aAAa,EAEb,yBAAyB,EACzB,gCAAgC,EAIjC,MAAM,iBAAiB,CAAC;AAczB,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAgB7D,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,kBAAkB,GAC7B,MAAM,CAKR;A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AC1B,eAAe,EAAE,eAAe,GAC/B,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAmDpC;AAED,KAAK,kBAAkB,GACnB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,gCAAgC,CAAA;CAAE,GAC7D;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,kBAAkB,CAAA;CAAE,CAAC;AAE/C,qBAAa,mBAAmB;IACvB,gBAAgB,EAAE,MAAM,CAAa;IACrC,cAAc,EAAE,MAAM,CAAa;IACnC,uBAAuB,EAAE,MAAM,CAAa;IAC5C,QAAQ,EAAE,yBAAyB,GAAG,SAAS,CAAa;IAC5D,SAAS,EAAE,WAAW,GAAG,SAAS,CAAa;IAEtD,GAAG,CAAC,MAAM,EAAE,kBAAkB;IAyD9B,KAAK;IAQL,UAAU,IAAI,OAAO;CAQtB"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LivePositionUpdates = exports.getAllPositionsByAuthority = exports.getReferralsByUser = exports.getAllReferralStates = exports.getSolautoManagedPositions = exports.eligibleForRefresh = exports.eligibileForRebalance = exports.getSolautoFeesBps = exports.getAdjustedSettingsFromAutomation = exports.getUpdatedValueFromAutomation = exports.eligibleForNextAutomationPeriod = exports.nextAutomationPeriodTimestamp = void 0;
3
+ exports.LivePositionUpdates = exports.positionStateWithLatestPrices = exports.getAllPositionsByAuthority = exports.getReferralsByUser = exports.getAllReferralStates = exports.getSolautoManagedPositions = exports.eligibleForRefresh = exports.eligibileForRebalance = exports.getSolautoFeesBps = exports.getAdjustedSettingsFromAutomation = exports.getUpdatedValueFromAutomation = exports.eligibleForNextAutomationPeriod = exports.nextAutomationPeriodTimestamp = void 0;
4
4
  const umi_1 = require("@metaplex-foundation/umi");
5
5
  const generated_1 = require("../../generated");
6
6
  const generalUtils_1 = require("../generalUtils");
@@ -133,6 +133,7 @@ async function getSolautoManagedPositions(umi, authority) {
133
133
  ...Array((0, generated_1.getSolautoPositionSize)() - x.data.length).fill(0),
134
134
  ]));
135
135
  return {
136
+ publicKey: (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(x.publicKey),
136
137
  authority: (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(position.authority),
137
138
  positionId: position.positionId[0],
138
139
  lendingPlatform: position.position.lendingPlatform,
@@ -242,6 +243,7 @@ async function positionStateWithLatestPrices(umi, state, protocolAccount, lendin
242
243
  },
243
244
  };
244
245
  }
246
+ exports.positionStateWithLatestPrices = positionStateWithLatestPrices;
245
247
  class LivePositionUpdates {
246
248
  constructor() {
247
249
  this.supplyAdjustment = BigInt(0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.36",
3
+ "version": "1.0.38",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "description": "Typescript SDK for the Solauto program on the Solana blockchain",
@@ -178,6 +178,7 @@ export async function getSolautoManagedPositions(
178
178
  authority?: PublicKey
179
179
  ): Promise<
180
180
  {
181
+ publicKey: PublicKey;
181
182
  authority: PublicKey;
182
183
  positionId: number;
183
184
  lendingPlatform: LendingPlatform;
@@ -227,6 +228,7 @@ export async function getSolautoManagedPositions(
227
228
  ])
228
229
  );
229
230
  return {
231
+ publicKey: toWeb3JsPublicKey(x.publicKey),
230
232
  authority: toWeb3JsPublicKey(position.authority),
231
233
  positionId: position.positionId[0],
232
234
  lendingPlatform: position.position.lendingPlatform,
@@ -317,7 +319,7 @@ export async function getAllPositionsByAuthority(
317
319
  return allPositions;
318
320
  }
319
321
 
320
- async function positionStateWithLatestPrices(
322
+ export async function positionStateWithLatestPrices(
321
323
  umi: Umi,
322
324
  state: PositionState,
323
325
  protocolAccount: PublicKey,