@haven-fi/solauto-sdk 1.0.38 → 1.0.39
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/types/solauto.d.ts +2 -0
- package/dist/types/solauto.d.ts.map +1 -1
- package/dist/utils/solauto/generalUtils.d.ts +1 -6
- package/dist/utils/solauto/generalUtils.d.ts.map +1 -1
- package/dist/utils/solauto/generalUtils.js +4 -0
- package/package.json +1 -1
- package/src/types/solauto.ts +7 -5
- package/src/utils/solauto/generalUtils.ts +5 -8
package/dist/types/solauto.d.ts
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
import { PublicKey } from "@solana/web3.js";
|
2
2
|
import { LendingPlatform } from "../generated";
|
3
3
|
export interface SolautoPositionDetails {
|
4
|
+
publicKey: PublicKey;
|
5
|
+
authority: PublicKey;
|
4
6
|
positionId: number;
|
5
7
|
lendingPlatform: LendingPlatform;
|
6
8
|
protocolAccount?: PublicKey;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solauto.d.ts","sourceRoot":"","sources":["../../src/types/solauto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,WAAW,sBAAsB;
|
1
|
+
{"version":3,"file":"solauto.d.ts","sourceRoot":"","sources":["../../src/types/solauto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE,SAAS,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,eAAe,CAAC;IACjC,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB"}
|
@@ -13,12 +13,7 @@ export declare function getSolautoFeesBps(isReferred: boolean, feeType: FeeType)
|
|
13
13
|
};
|
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
|
-
export declare function getSolautoManagedPositions(umi: Umi, authority?: PublicKey): Promise<
|
17
|
-
publicKey: PublicKey;
|
18
|
-
authority: PublicKey;
|
19
|
-
positionId: number;
|
20
|
-
lendingPlatform: LendingPlatform;
|
21
|
-
}[]>;
|
16
|
+
export declare function getSolautoManagedPositions(umi: Umi, authority?: PublicKey): Promise<SolautoPositionDetails[]>;
|
22
17
|
export declare function getAllReferralStates(umi: Umi): Promise<PublicKey[]>;
|
23
18
|
export declare function getReferralsByUser(umi: Umi, user: PublicKey): Promise<PublicKey[]>;
|
24
19
|
export declare function getAllPositionsByAuthority(umi: Umi, user: PublicKey): Promise<SolautoPositionDetails[]>;
|
@@ -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;AAED,wBAAgB,+BAA+B,CAC7C,UAAU,EAAE,kBAAkB,GAC7B,OAAO,CAET;AAED,wBAAgB,6BAA6B,CAC3C,SAAS,EAAE,MAAM,EACjB,WA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,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"}
|
@@ -188,11 +188,15 @@ async function getAllPositionsByAuthority(umi, user) {
|
|
188
188
|
const allPositions = [];
|
189
189
|
const solautoManagedPositions = await getSolautoManagedPositions(umi, user);
|
190
190
|
allPositions.push(...solautoManagedPositions.map((x) => ({
|
191
|
+
publicKey: x.publicKey,
|
192
|
+
authority: user,
|
191
193
|
positionId: x.positionId,
|
192
194
|
lendingPlatform: x.lendingPlatform,
|
193
195
|
})));
|
194
196
|
const marginfiPositions = await (0, marginfiUtils_1.getAllMarginfiAccountsByAuthority)(umi, user, true);
|
195
197
|
allPositions.push(...marginfiPositions.map((x) => ({
|
198
|
+
publicKey: x.marginfiAccount,
|
199
|
+
authority: user,
|
196
200
|
positionId: 0,
|
197
201
|
lendingPlatform: generated_1.LendingPlatform.Marginfi,
|
198
202
|
protocolAccount: x.marginfiAccount,
|
package/package.json
CHANGED
package/src/types/solauto.ts
CHANGED
@@ -2,9 +2,11 @@ import { PublicKey } from "@solana/web3.js";
|
|
2
2
|
import { LendingPlatform } from "../generated";
|
3
3
|
|
4
4
|
export interface SolautoPositionDetails {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
publicKey: PublicKey;
|
6
|
+
authority: PublicKey;
|
7
|
+
positionId: number;
|
8
|
+
lendingPlatform: LendingPlatform;
|
9
|
+
protocolAccount?: PublicKey;
|
10
|
+
supplyMint?: PublicKey;
|
11
|
+
debtMint?: PublicKey;
|
10
12
|
}
|
@@ -176,14 +176,7 @@ export function eligibleForRefresh(
|
|
176
176
|
export async function getSolautoManagedPositions(
|
177
177
|
umi: Umi,
|
178
178
|
authority?: PublicKey
|
179
|
-
): Promise<
|
180
|
-
{
|
181
|
-
publicKey: PublicKey;
|
182
|
-
authority: PublicKey;
|
183
|
-
positionId: number;
|
184
|
-
lendingPlatform: LendingPlatform;
|
185
|
-
}[]
|
186
|
-
> {
|
179
|
+
): Promise<SolautoPositionDetails[]> {
|
187
180
|
// bump: [u8; 1]
|
188
181
|
// position_id: [u8; 1]
|
189
182
|
// self_managed: u8 - (1 for true, 0 for false)
|
@@ -294,6 +287,8 @@ export async function getAllPositionsByAuthority(
|
|
294
287
|
const solautoManagedPositions = await getSolautoManagedPositions(umi, user);
|
295
288
|
allPositions.push(
|
296
289
|
...solautoManagedPositions.map((x) => ({
|
290
|
+
publicKey: x.publicKey,
|
291
|
+
authority: user,
|
297
292
|
positionId: x.positionId,
|
298
293
|
lendingPlatform: x.lendingPlatform,
|
299
294
|
}))
|
@@ -306,6 +301,8 @@ export async function getAllPositionsByAuthority(
|
|
306
301
|
);
|
307
302
|
allPositions.push(
|
308
303
|
...marginfiPositions.map((x) => ({
|
304
|
+
publicKey: x.marginfiAccount,
|
305
|
+
authority: user,
|
309
306
|
positionId: 0,
|
310
307
|
lendingPlatform: LendingPlatform.Marginfi,
|
311
308
|
protocolAccount: x.marginfiAccount,
|