@haven-fi/solauto-sdk 1.0.285 → 1.0.286

Sign up to get free protection for your applications and to get access to all the features.
@@ -31,15 +31,15 @@ class SolautoClient extends referralStateManager_1.ReferralStateManager {
31
31
  this.liqThresholdBps = undefined;
32
32
  this.supplyMint =
33
33
  args.supplyMint ??
34
- (this.solautoPositionData
35
- ? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.solautoPositionData.position.supplyMint)
34
+ (this.solautoPositionData && !this.selfManaged
35
+ ? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.solautoPositionData.state.supply.mint)
36
36
  : web3_js_1.PublicKey.default);
37
37
  this.positionSupplyTa = (0, accountUtils_1.getTokenAccount)(this.solautoPosition, this.supplyMint);
38
38
  this.signerSupplyTa = (0, accountUtils_1.getTokenAccount)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), this.supplyMint);
39
39
  this.debtMint =
40
40
  args.debtMint ??
41
- (this.solautoPositionData
42
- ? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.solautoPositionData.position.debtMint)
41
+ (this.solautoPositionData && !this.selfManaged
42
+ ? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.solautoPositionData.state.debt.mint)
43
43
  : web3_js_1.PublicKey.default);
44
44
  this.positionDebtTa = (0, accountUtils_1.getTokenAccount)(this.solautoPosition, this.debtMint);
45
45
  this.signerDebtTa = (0, accountUtils_1.getTokenAccount)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), this.debtMint);
@@ -29,7 +29,7 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
29
29
  else {
30
30
  this.marginfiAccountSeedIdx = (0, generalUtils_1.generateRandomU64)();
31
31
  this.marginfiAccount = this.solautoPositionData
32
- ? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.solautoPositionData.position.protocolAccount)
32
+ ? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.solautoPositionData.position.protocolUserAccount)
33
33
  : (0, accountUtils_1.getMarginfiAccountPDA)(this.solautoPosition, this.marginfiAccountSeedIdx, this.programId);
34
34
  }
35
35
  this.marginfiAccountPk =
@@ -11,9 +11,9 @@ import { DCASettings, DCASettingsArgs, LendingPlatform, LendingPlatformArgs, Sol
11
11
  export type PositionData = {
12
12
  lendingPlatform: LendingPlatform;
13
13
  padding1: Array<number>;
14
- protocolAccount: PublicKey;
15
- supplyMint: PublicKey;
16
- debtMint: PublicKey;
14
+ protocolUserAccount: PublicKey;
15
+ protocolSupplyAccount: PublicKey;
16
+ protocolDebtAccount: PublicKey;
17
17
  settingParams: SolautoSettingsParameters;
18
18
  dca: DCASettings;
19
19
  padding: Array<number>;
@@ -21,9 +21,9 @@ export type PositionData = {
21
21
  export type PositionDataArgs = {
22
22
  lendingPlatform: LendingPlatformArgs;
23
23
  padding1: Array<number>;
24
- protocolAccount: PublicKey;
25
- supplyMint: PublicKey;
26
- debtMint: PublicKey;
24
+ protocolUserAccount: PublicKey;
25
+ protocolSupplyAccount: PublicKey;
26
+ protocolDebtAccount: PublicKey;
27
27
  settingParams: SolautoSettingsParametersArgs;
28
28
  dca: DCASettingsArgs;
29
29
  padding: Array<number>;
@@ -1 +1 @@
1
- {"version":3,"file":"positionData.d.ts","sourceRoot":"","sources":["../../../src/generated/types/positionData.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EACL,UAAU,EAMX,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,WAAW,EACX,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,yBAAyB,EACzB,6BAA6B,EAI9B,MAAM,GAAG,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG;IACzB,eAAe,EAAE,eAAe,CAAC;IACjC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACxB,eAAe,EAAE,SAAS,CAAC;IAC3B,UAAU,EAAE,SAAS,CAAC;IACtB,QA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,eAAe,EAAE,mBAAmB,CAAC;IACrC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACxB,mBAAmB,EAAE,SAAS,CAAC;IAC/B,qBAAqB,EAAE,SAAS,CAAC;IACjC,mBAAmB,EAAE,SAAS,CAAC;IAC/B,aAAa,EAAE,6BAA6B,CAAC;IAC7C,GAAG,EAAE,eAAe,CAAC;IACrB,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACxB,CAAC;AAEF,wBAAgB,yBAAyB,IAAI,UAAU,CACrD,gBAAgB,EAChB,YAAY,CACb,CAcA"}
@@ -14,9 +14,9 @@ function getPositionDataSerializer() {
14
14
  return (0, serializers_1.struct)([
15
15
  ['lendingPlatform', (0, _1.getLendingPlatformSerializer)()],
16
16
  ['padding1', (0, serializers_1.array)((0, serializers_1.u8)(), { size: 7 })],
17
- ['protocolAccount', (0, serializers_1.publicKey)()],
18
- ['supplyMint', (0, serializers_1.publicKey)()],
19
- ['debtMint', (0, serializers_1.publicKey)()],
17
+ ['protocolUserAccount', (0, serializers_1.publicKey)()],
18
+ ['protocolSupplyAccount', (0, serializers_1.publicKey)()],
19
+ ['protocolDebtAccount', (0, serializers_1.publicKey)()],
20
20
  ['settingParams', (0, _1.getSolautoSettingsParametersSerializer)()],
21
21
  ['dca', (0, _1.getDCASettingsSerializer)()],
22
22
  ['padding', (0, serializers_1.array)((0, serializers_1.u32)(), { size: 4 })],
@@ -4,7 +4,10 @@ import { Bank, MarginfiAccount } from "../marginfi-sdk";
4
4
  import { MarginfiAssetAccounts } from "../types/accounts";
5
5
  import { PositionState } from "../generated";
6
6
  import { LivePositionUpdates } from "./solauto/generalUtils";
7
- export declare function findMarginfiAccounts(bank: PublicKey): MarginfiAssetAccounts;
7
+ interface AllMarginfiAssetAccounts extends MarginfiAssetAccounts {
8
+ mint: PublicKey;
9
+ }
10
+ export declare function findMarginfiAccounts(bank: PublicKey): AllMarginfiAssetAccounts;
8
11
  export declare function marginfiMaxLtvAndLiqThresholdBps(supplyBank: Bank, debtBank: Bank, supplyPrice: number): [number, number];
9
12
  export declare function getMaxLtvAndLiqThreshold(umi: Umi, marginfiGroup: PublicKey, supply: {
10
13
  mint: PublicKey;
@@ -1 +1 @@
1
- {"version":3,"file":"marginfiUtils.d.ts","sourceRoot":"","sources":["../../src/utils/marginfiUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAa,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EACL,IAAI,EAGJ,eAAe,EAGhB,MAAM,iBAAiB,CAAC;AAiBzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAsB,MAAM,cAAc,CAAC;AAEjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAG7D,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,SAAS,GAAG,qBAAqB,CAY3E;AAED,wBAAgB,gCAAgC,CAC9C,UAAU,EAAE,IAAI,EAChB,QAAQ,EAAE,IAAI,EACd,WAAW,EAAE,MAAM,GAClB,CAAC,MAAM,EAAE,MAAM,CAAC,CA6BlB;AAED,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,SAAS,EACxB,MAAM,EAAE;IACN,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACpB,EACD,IAAI,EAAE;IACJ,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACpB,EACD,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAwC3B;AAED,wBAAsB,iCAAiC,CACrD,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,SAAS,EACpB,qBAAqB,CAAC,EAAE,OAA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,EAAE,EAAE,SAAS,CAAC;IAAC,IAAI,CAAC,EAAE,eAAe,CAAA;CAAE,EAC1D,aAAa,CAAC,EAAE,SAAS,EACzB,MAAM,CAAC,EAAE,aAAa,EACtB,IAAI,CAAC,EAAE,aAAa,EACpB,mBAAmB,CAAC,EAAE,mBAAmB,GACxC,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CA0LpC;AA+DD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,oBAU7C;AAED,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAgB3B"}
@@ -21,7 +21,7 @@ function findMarginfiAccounts(bank) {
21
21
  for (const key in marginfiAccounts_1.MARGINFI_ACCOUNTS[group]) {
22
22
  const account = marginfiAccounts_1.MARGINFI_ACCOUNTS[group][key];
23
23
  if (account.bank.toString().toLowerCase() === bank.toString().toLowerCase()) {
24
- return account;
24
+ return { ...account, mint: new web3_js_1.PublicKey(key) };
25
25
  }
26
26
  }
27
27
  }
@@ -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,OAAO,EAAa,GAAG,EAAE,MAAM,0BAA0B,CAAC;AACrF,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAElB,aAAa,EACb,YAAY,EACZ,yBAAyB,EACzB,gCAAgC,EAChC,SAAS,EAMV,MAAM,iBAAiB,CAAC;AAezB,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE9E,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAczE;AAgBD,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,kBAAkB,GAC7B,MAAM,CAKR;AAED,wB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EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,kBAAkB,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,SAAS,CAAA;KAAE,CAAA;CAAE,GACzE;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAEhD,qBAAa,mBAAmB;IACvB,gBAAgB,SAAa;IAC7B,cAAc,SAAa;IAC3B,QAAQ,EAAE,yBAAyB,GAAG,SAAS,CAAa;IAC5D,SAAS,EAAE,WAAW,GAAG,SAAS,CAAa;IAC/C,YAAY,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,SAAS,CAAA;KAAE,CAAa;IACpE,aAAa,EAAE,SAAS,GAAG,SAAS,CAAa;IAExD,GAAG,CAAC,MAAM,EAAE,kBAAkB;IA6B9B,KAAK;IASL,UAAU,IAAI,OAAO;CAStB"}
@@ -26,7 +26,7 @@ const constants_1 = require("../../constants");
26
26
  const marginfiUtils_1 = require("../marginfiUtils");
27
27
  function createDynamicSolautoProgram(programId) {
28
28
  return {
29
- name: 'solauto',
29
+ name: "solauto",
30
30
  publicKey: (0, umi_1.publicKey)(programId),
31
31
  getErrorFromCode(code, cause) {
32
32
  return (0, generated_1.getSolautoErrorFromCode)(code, this, cause);
@@ -86,10 +86,12 @@ function eligibleForRebalance(positionState, positionSettings, positionDca, curr
86
86
  : positionSettings.boostToBps;
87
87
  const repayFrom = positionSettings.repayToBps + positionSettings.repayGap;
88
88
  const boostFrom = boostToBps - positionSettings.boostGap;
89
- if (Math.max(0, positionState.liqUtilizationRateBps - boostFrom) <= bpsDistanceThreshold) {
89
+ if (Math.max(0, positionState.liqUtilizationRateBps - boostFrom) <=
90
+ bpsDistanceThreshold) {
90
91
  return "boost";
91
92
  }
92
- else if (Math.max(0, repayFrom - positionState.liqUtilizationRateBps) <= bpsDistanceThreshold) {
93
+ else if (Math.max(0, repayFrom - positionState.liqUtilizationRateBps) <=
94
+ bpsDistanceThreshold) {
93
95
  return "repay";
94
96
  }
95
97
  return undefined;
@@ -141,14 +143,16 @@ async function getSolautoManagedPositions(umi, authority, positionTypeFilter) {
141
143
  },
142
144
  ]
143
145
  : []),
144
- ...(positionTypeFilter !== undefined ? [
145
- {
146
- memcmp: {
147
- bytes: new Uint8Array(positionTypeFilter),
148
- offset: 3
149
- }
150
- }
151
- ] : [])
146
+ ...(positionTypeFilter !== undefined
147
+ ? [
148
+ {
149
+ memcmp: {
150
+ bytes: new Uint8Array(positionTypeFilter),
151
+ offset: 3,
152
+ },
153
+ },
154
+ ]
155
+ : []),
152
156
  ],
153
157
  });
154
158
  return accounts.map((x) => {
@@ -156,15 +160,23 @@ async function getSolautoManagedPositions(umi, authority, positionTypeFilter) {
156
160
  ...x.data,
157
161
  ...Array((0, generated_1.getSolautoPositionSize)() - x.data.length).fill(0),
158
162
  ]));
163
+ let tokens;
164
+ if (position.position.lendingPlatform === generated_1.LendingPlatform.Marginfi) {
165
+ tokens = [
166
+ (0, marginfiUtils_1.findMarginfiAccounts)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(position.position.protocolSupplyAccount)).mint,
167
+ (0, marginfiUtils_1.findMarginfiAccounts)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(position.position.protocolDebtAccount)).mint,
168
+ ];
169
+ }
170
+ // TODO: PK
159
171
  return {
160
172
  publicKey: (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(x.publicKey),
161
173
  authority: (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(position.authority),
162
174
  positionId: position.positionId[0],
163
175
  lendingPlatform: position.position.lendingPlatform,
164
176
  positionType: position.positionType,
165
- protocolAccount: (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(position.position.protocolAccount),
166
- supplyMint: (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(position.position.supplyMint),
167
- debtMint: (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(position.position.debtMint),
177
+ protocolAccount: (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(position.position.protocolUserAccount),
178
+ supplyMint: tokens[0],
179
+ debtMint: tokens[1],
168
180
  };
169
181
  });
170
182
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.285",
3
+ "version": "1.0.286",
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",
@@ -113,8 +113,8 @@ export abstract class SolautoClient extends ReferralStateManager {
113
113
 
114
114
  this.supplyMint =
115
115
  args.supplyMint ??
116
- (this.solautoPositionData
117
- ? toWeb3JsPublicKey(this.solautoPositionData!.position.supplyMint)
116
+ (this.solautoPositionData && !this.selfManaged
117
+ ? toWeb3JsPublicKey(this.solautoPositionData!.state.supply.mint)
118
118
  : PublicKey.default);
119
119
  this.positionSupplyTa = getTokenAccount(
120
120
  this.solautoPosition,
@@ -127,8 +127,8 @@ export abstract class SolautoClient extends ReferralStateManager {
127
127
 
128
128
  this.debtMint =
129
129
  args.debtMint ??
130
- (this.solautoPositionData
131
- ? toWeb3JsPublicKey(this.solautoPositionData!.position.debtMint)
130
+ (this.solautoPositionData && !this.selfManaged
131
+ ? toWeb3JsPublicKey(this.solautoPositionData!.state.debt.mint)
132
132
  : PublicKey.default);
133
133
  this.positionDebtTa = getTokenAccount(this.solautoPosition, this.debtMint);
134
134
  this.signerDebtTa = getTokenAccount(
@@ -104,7 +104,7 @@ export class SolautoMarginfiClient extends SolautoClient {
104
104
  } else {
105
105
  this.marginfiAccountSeedIdx = generateRandomU64();
106
106
  this.marginfiAccount = this.solautoPositionData
107
- ? toWeb3JsPublicKey(this.solautoPositionData.position.protocolAccount)
107
+ ? toWeb3JsPublicKey(this.solautoPositionData.position.protocolUserAccount)
108
108
  : getMarginfiAccountPDA(
109
109
  this.solautoPosition,
110
110
  this.marginfiAccountSeedIdx,
@@ -30,9 +30,9 @@ import {
30
30
  export type PositionData = {
31
31
  lendingPlatform: LendingPlatform;
32
32
  padding1: Array<number>;
33
- protocolAccount: PublicKey;
34
- supplyMint: PublicKey;
35
- debtMint: PublicKey;
33
+ protocolUserAccount: PublicKey;
34
+ protocolSupplyAccount: PublicKey;
35
+ protocolDebtAccount: PublicKey;
36
36
  settingParams: SolautoSettingsParameters;
37
37
  dca: DCASettings;
38
38
  padding: Array<number>;
@@ -41,9 +41,9 @@ export type PositionData = {
41
41
  export type PositionDataArgs = {
42
42
  lendingPlatform: LendingPlatformArgs;
43
43
  padding1: Array<number>;
44
- protocolAccount: PublicKey;
45
- supplyMint: PublicKey;
46
- debtMint: PublicKey;
44
+ protocolUserAccount: PublicKey;
45
+ protocolSupplyAccount: PublicKey;
46
+ protocolDebtAccount: PublicKey;
47
47
  settingParams: SolautoSettingsParametersArgs;
48
48
  dca: DCASettingsArgs;
49
49
  padding: Array<number>;
@@ -57,9 +57,9 @@ export function getPositionDataSerializer(): Serializer<
57
57
  [
58
58
  ['lendingPlatform', getLendingPlatformSerializer()],
59
59
  ['padding1', array(u8(), { size: 7 })],
60
- ['protocolAccount', publicKeySerializer()],
61
- ['supplyMint', publicKeySerializer()],
62
- ['debtMint', publicKeySerializer()],
60
+ ['protocolUserAccount', publicKeySerializer()],
61
+ ['protocolSupplyAccount', publicKeySerializer()],
62
+ ['protocolDebtAccount', publicKeySerializer()],
63
63
  ['settingParams', getSolautoSettingsParametersSerializer()],
64
64
  ['dca', getDCASettingsSerializer()],
65
65
  ['padding', array(u32(), { size: 4 })],
@@ -31,14 +31,18 @@ import { USD_DECIMALS } from "../constants/generalAccounts";
31
31
  import { LivePositionUpdates } from "./solauto/generalUtils";
32
32
  import { TOKEN_INFO } from "../constants";
33
33
 
34
- export function findMarginfiAccounts(bank: PublicKey): MarginfiAssetAccounts {
34
+ interface AllMarginfiAssetAccounts extends MarginfiAssetAccounts {
35
+ mint: PublicKey;
36
+ }
37
+
38
+ export function findMarginfiAccounts(bank: PublicKey): AllMarginfiAssetAccounts {
35
39
  for (const group in MARGINFI_ACCOUNTS) {
36
40
  for (const key in MARGINFI_ACCOUNTS[group]) {
37
41
  const account = MARGINFI_ACCOUNTS[group][key];
38
42
  if (
39
43
  account.bank.toString().toLowerCase() === bank.toString().toLowerCase()
40
44
  ) {
41
- return account;
45
+ return { ...account, mint: new PublicKey(key) };
42
46
  }
43
47
  }
44
48
  }
@@ -1,5 +1,11 @@
1
1
  import { PublicKey } from "@solana/web3.js";
2
- import { isOption, isSome, Program, publicKey, Umi } from "@metaplex-foundation/umi";
2
+ import {
3
+ isOption,
4
+ isSome,
5
+ Program,
6
+ publicKey,
7
+ Umi,
8
+ } from "@metaplex-foundation/umi";
3
9
  import {
4
10
  AutomationSettings,
5
11
  DCASettings,
@@ -29,12 +35,15 @@ import {
29
35
  TOKEN_INFO,
30
36
  USD_DECIMALS,
31
37
  } from "../../constants";
32
- import { getAllMarginfiAccountsByAuthority } from "../marginfiUtils";
38
+ import {
39
+ findMarginfiAccounts,
40
+ getAllMarginfiAccountsByAuthority,
41
+ } from "../marginfiUtils";
33
42
  import { RebalanceAction, SolautoPositionDetails } from "../../types/solauto";
34
43
 
35
44
  export function createDynamicSolautoProgram(programId: PublicKey): Program {
36
45
  return {
37
- name: 'solauto',
46
+ name: "solauto",
38
47
  publicKey: publicKey(programId),
39
48
  getErrorFromCode(code: number, cause?: Error) {
40
49
  return getSolautoErrorFromCode(code, this, cause);
@@ -149,9 +158,15 @@ export function eligibleForRebalance(
149
158
  const repayFrom = positionSettings.repayToBps + positionSettings.repayGap;
150
159
  const boostFrom = boostToBps - positionSettings.boostGap;
151
160
 
152
- if (Math.max(0, positionState.liqUtilizationRateBps - boostFrom) <= bpsDistanceThreshold) {
161
+ if (
162
+ Math.max(0, positionState.liqUtilizationRateBps - boostFrom) <=
163
+ bpsDistanceThreshold
164
+ ) {
153
165
  return "boost";
154
- } else if (Math.max(0, repayFrom - positionState.liqUtilizationRateBps) <= bpsDistanceThreshold) {
166
+ } else if (
167
+ Math.max(0, repayFrom - positionState.liqUtilizationRateBps) <=
168
+ bpsDistanceThreshold
169
+ ) {
155
170
  return "repay";
156
171
  }
157
172
 
@@ -193,42 +208,47 @@ export async function getSolautoManagedPositions(
193
208
  // supply mint: pubkey
194
209
  // debt mint: pubkey
195
210
 
196
- const accounts = await umi.rpc.getProgramAccounts(umi.programs.get("solauto").publicKey, {
197
- commitment: "confirmed",
198
- dataSlice: {
199
- offset: 0,
200
- length: 1 + 1 + 1 + 1 + 4 + 32 + 1 + 7 + 32 + 32 + 32, // bump + position_id + self_managed + position_type + padding (4) + authority (pubkey) + lending_platform + padding (7) + protocol account (pubkey) + supply mint (pubkey) + debt mint (pubkey)
201
- },
202
- filters: [
203
- {
204
- dataSize: getSolautoPositionSize(),
211
+ const accounts = await umi.rpc.getProgramAccounts(
212
+ umi.programs.get("solauto").publicKey,
213
+ {
214
+ commitment: "confirmed",
215
+ dataSlice: {
216
+ offset: 0,
217
+ length: 1 + 1 + 1 + 1 + 4 + 32 + 1 + 7 + 32 + 32 + 32, // bump + position_id + self_managed + position_type + padding (4) + authority (pubkey) + lending_platform + padding (7) + protocol account (pubkey) + supply mint (pubkey) + debt mint (pubkey)
205
218
  },
206
- {
207
- memcmp: {
208
- bytes: new Uint8Array([0]),
209
- offset: 2,
219
+ filters: [
220
+ {
221
+ dataSize: getSolautoPositionSize(),
210
222
  },
211
- },
212
- ...(authority
213
- ? [
214
- {
215
- memcmp: {
216
- bytes: new Uint8Array(authority.toBuffer()),
217
- offset: 8,
218
- },
219
- },
220
- ]
221
- : []),
222
- ...(positionTypeFilter !== undefined ? [
223
223
  {
224
224
  memcmp: {
225
- bytes: new Uint8Array(positionTypeFilter),
226
- offset: 3
227
- }
228
- }
229
- ] : [])
230
- ],
231
- });
225
+ bytes: new Uint8Array([0]),
226
+ offset: 2,
227
+ },
228
+ },
229
+ ...(authority
230
+ ? [
231
+ {
232
+ memcmp: {
233
+ bytes: new Uint8Array(authority.toBuffer()),
234
+ offset: 8,
235
+ },
236
+ },
237
+ ]
238
+ : []),
239
+ ...(positionTypeFilter !== undefined
240
+ ? [
241
+ {
242
+ memcmp: {
243
+ bytes: new Uint8Array(positionTypeFilter),
244
+ offset: 3,
245
+ },
246
+ },
247
+ ]
248
+ : []),
249
+ ],
250
+ }
251
+ );
232
252
 
233
253
  return accounts.map((x) => {
234
254
  const [position, _] = getSolautoPositionAccountDataSerializer().deserialize(
@@ -237,32 +257,49 @@ export async function getSolautoManagedPositions(
237
257
  ...Array(getSolautoPositionSize() - x.data.length).fill(0),
238
258
  ])
239
259
  );
260
+
261
+ let tokens: [PublicKey, PublicKey] | undefined;
262
+ if (position.position.lendingPlatform === LendingPlatform.Marginfi) {
263
+ tokens = [
264
+ findMarginfiAccounts(
265
+ toWeb3JsPublicKey(position.position.protocolSupplyAccount)
266
+ ).mint,
267
+ findMarginfiAccounts(
268
+ toWeb3JsPublicKey(position.position.protocolDebtAccount)
269
+ ).mint,
270
+ ];
271
+ }
272
+ // TODO: PK
273
+
240
274
  return {
241
275
  publicKey: toWeb3JsPublicKey(x.publicKey),
242
276
  authority: toWeb3JsPublicKey(position.authority),
243
277
  positionId: position.positionId[0],
244
278
  lendingPlatform: position.position.lendingPlatform,
245
279
  positionType: position.positionType,
246
- protocolAccount: toWeb3JsPublicKey(position.position.protocolAccount),
247
- supplyMint: toWeb3JsPublicKey(position.position.supplyMint),
248
- debtMint: toWeb3JsPublicKey(position.position.debtMint),
280
+ protocolAccount: toWeb3JsPublicKey(position.position.protocolUserAccount),
281
+ supplyMint: tokens![0],
282
+ debtMint: tokens![1],
249
283
  };
250
284
  });
251
285
  }
252
286
 
253
287
  export async function getAllReferralStates(umi: Umi): Promise<PublicKey[]> {
254
- const accounts = await umi.rpc.getProgramAccounts(umi.programs.get("solauto").publicKey, {
255
- commitment: "confirmed",
256
- dataSlice: {
257
- offset: 0,
258
- length: 0,
259
- },
260
- filters: [
261
- {
262
- dataSize: getReferralStateSize(),
288
+ const accounts = await umi.rpc.getProgramAccounts(
289
+ umi.programs.get("solauto").publicKey,
290
+ {
291
+ commitment: "confirmed",
292
+ dataSlice: {
293
+ offset: 0,
294
+ length: 0,
263
295
  },
264
- ],
265
- });
296
+ filters: [
297
+ {
298
+ dataSize: getReferralStateSize(),
299
+ },
300
+ ],
301
+ }
302
+ );
266
303
 
267
304
  return accounts.map((x) => toWeb3JsPublicKey(x.publicKey));
268
305
  }
@@ -277,7 +314,10 @@ export async function getReferralsByUser(
277
314
  // referred_by_state: Pubkey,
278
315
 
279
316
  const programId = umi.programs.get("solauto").publicKey;
280
- const userReferralState = getReferralState(user, toWeb3JsPublicKey(programId));
317
+ const userReferralState = getReferralState(
318
+ user,
319
+ toWeb3JsPublicKey(programId)
320
+ );
281
321
  const accounts = await umi.rpc.getProgramAccounts(programId, {
282
322
  commitment: "confirmed",
283
323
  dataSlice: {
@@ -513,17 +553,17 @@ type PositionAdjustment =
513
553
  | { type: "debt"; value: bigint }
514
554
  | { type: "settings"; value: SolautoSettingsParametersInpArgs }
515
555
  | { type: "dca"; value: DCASettingsInpArgs }
516
- | { type: "dcaInBalance"; value: { amount: bigint; tokenType: TokenType; } }
517
- | { type: "cancellingDca"; value: TokenType; };
556
+ | { type: "dcaInBalance"; value: { amount: bigint; tokenType: TokenType } }
557
+ | { type: "cancellingDca"; value: TokenType };
518
558
 
519
559
  export class LivePositionUpdates {
520
560
  public supplyAdjustment = BigInt(0);
521
561
  public debtAdjustment = BigInt(0);
522
562
  public settings: SolautoSettingsParameters | undefined = undefined;
523
563
  public activeDca: DCASettings | undefined = undefined;
524
- public dcaInBalance?: { amount: bigint; tokenType: TokenType; } = undefined;
564
+ public dcaInBalance?: { amount: bigint; tokenType: TokenType } = undefined;
525
565
  public cancellingDca: TokenType | undefined = undefined;
526
-
566
+
527
567
  new(update: PositionAdjustment) {
528
568
  if (update.type === "supply") {
529
569
  this.supplyAdjustment += update.value;