@haven-fi/solauto-sdk 1.0.284 → 1.0.286

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.
@@ -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,EA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AAC;CACxB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,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 })],
@@ -1 +1 @@
1
- {"version":3,"file":"transactionsManager.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionsManager.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAMzD,OAAO,EACL,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,kBAAkB,EAElB,qBA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rC,OAAO,CAAC,YAAY;YA6CN,aAAa;IAoB3B,OAAO,CAAC,4BAA4B;IAUpC,OAAO,CAAC,mBAAmB;YAMb,SAAS;IAgBV,UAAU,CACrB,YAAY,EAAE,eAAe,EAAE,GAC9B,OAAO,CAAC,0BAA0B,CAAC;IA+DzB,IAAI,CACf,KAAK,EAAE,eAAe,EAAE,GACvB,OAAO,CAAC,0BAA0B,CAAC;YA+BxB,qBAAqB;YAuDrB,cAAc;YAqCd,eAAe;CAmD9B"}
@@ -105,10 +105,7 @@ class TransactionSet {
105
105
  const transactions = this.items
106
106
  .filter((x) => x.tx && x.tx.getInstructions().length > 0)
107
107
  .map((x) => x.tx);
108
- const txSpecificLuts = this.lutAddresses();
109
- this.txHandler.log("Tx-specific LUTs: ", txSpecificLuts.map(x => x.toString()));
110
108
  const lutInputs = await this.lookupTables.getLutInputs(this.lutAddresses());
111
- this.txHandler.log("Lut inputs:", lutInputs);
112
109
  return (0, umi_1.transactionBuilder)()
113
110
  .add(transactions)
114
111
  .setAddressLookupTables(lutInputs);
@@ -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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0LpC;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":"solanaUtils.d.ts","sourceRoot":"","sources":["../../src/utils/solanaUtils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,uBAAuB,EACvB,MAAM,EACN,kBAAkB,EAClB,GAAG,EACH,kBAAkB,EAGnB,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EAKL,UAAU,EACV,SAAS,EAKT,sBAAsB,EAEvB,MAAM,iBAAiB,CAAC;AAgBzB,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAIlE,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,UAErD;AAED,wBAAgB,oBAAoB,CAAC,eAAe,EAAE,MAAM,UAE3D;AAED,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,SAAS,GAAE,SAAgC,GAC1C,CAAC,UAAU,EAAE,GAAG,CAAC,CAQnB;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,sBAAsB,GACzB,kBAAkB,CAMpB;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,MAAM,GACtB,kBAAkB,CAOpB;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,QAAQ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EAAE,SAAS,EACvB,SAAS,EAAE,SAAS,GACnB,kBAAkB,CAKpB;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,SAAS,EACf,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,GACb,kBAAkB,CAKpB;AAED,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,GAAG,EACR,oBAAoB,EAAE,MAAM,EAAE,GAC7B,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAkBpC;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,kBAAkB,EAC/B,gBAAgB,CAAC,EAAE,MAAM,EACzB,gBAAgB,CAAC,EAAE,MAAM,sBAa1B;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,kBAAkB,EAC/B,gBAAgB,CAAC,EAAE,MAAM,EACzB,gBAAgB,CAAC,EAAE,MAAM,sBA2D1B;AAuBD,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,kBAAkB,EACtB,eAAe,EAAE,kBAAkB,GAClC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAsB7B;AAiDD,wBAAsB,8BAA8B,CAClD,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,kBAAkB,EACtB,MAAM,CAAC,EAAE,kBAAkB,EAC3B,eAAe,GAAE,kBAA2C,EAC5D,cAAc,CAAC,EAAE,MAAM,IAAI,GAC1B,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CA0DjC"}
@@ -138,13 +138,7 @@ function assembleFinalTransaction(signer, transaction, computeUnitPrice, compute
138
138
  return tx;
139
139
  }
140
140
  async function simulateTransaction(umi, connection, transaction) {
141
- (0, generalUtils_1.consoleLog)("TRANSACTION SIZE", transaction.getTransactionSize(umi));
142
- (0, generalUtils_1.consoleLog)("TRANSACTION SIZE", transaction.useV0().getTransactionSize(umi));
143
- const tx = (0, umi_web3js_adapters_1.toWeb3JsTransaction)(transaction.build(umi));
144
- (0, generalUtils_1.consoleLog)("TRANSACTIONS REQUIRED", transaction.minimumTransactionsRequired(umi));
145
- (0, generalUtils_1.consoleLog)("TRANSACTION SIZE", transaction.getTransactionSize(umi));
146
- (0, generalUtils_1.consoleLog)("FITS IN ONE TX", transaction.fitsInOneTransaction(umi));
147
- const simulationResult = await connection.simulateTransaction(tx, {
141
+ const simulationResult = await connection.simulateTransaction((0, umi_web3js_adapters_1.toWeb3JsTransaction)(transaction.build(umi)), {
148
142
  sigVerify: false,
149
143
  commitment: "processed",
150
144
  });
@@ -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,wBAAgB,+BAA+B,CAC7C,UAAU,EAAE,kBAAkB,EAC9B,eAAe,EAAE,MAAM,GACtB,OAAO,CAET;AAED,wBAAgB,6BAA6B,CAC3C,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,kBAAkB,EAC9B,oBAAoB,EAAE,MAAM,UAY7B;AAED,wBAAgB,iCAAi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K,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
  }
@@ -83,7 +83,7 @@ function getRebalanceValues(state, settings, dca, currentUnixTime, supplyPrice,
83
83
  const { targetRateBps, amountToDcaIn } = getTargetRateAndDcaAmount(state, settings, dca, currentUnixTime, targetLiqUtilizationRateBps);
84
84
  const amountUsdToDcaIn = (0, numberUtils_1.fromBaseUnit)(BigInt(Math.round(amountToDcaIn ?? 0)), state.debt.decimals) *
85
85
  (dca?.tokenType === generated_1.TokenType.Debt ? debtPrice : supplyPrice);
86
- const rebalanceDirection = amountUsdToDcaIn > 0 || state.liqUtilizationRateBps < targetRateBps ? generated_1.RebalanceDirection.Boost : generated_1.RebalanceDirection.Repay;
86
+ const rebalanceDirection = amountUsdToDcaIn > 0 || state.liqUtilizationRateBps <= targetRateBps ? generated_1.RebalanceDirection.Boost : generated_1.RebalanceDirection.Repay;
87
87
  const adjustmentFeeBps = (0, numberUtils_1.getSolautoFeesBps)(false, targetLiqUtilizationRateBps, (0, numberUtils_1.fromBaseUnit)(state.netWorth.baseAmountUsdValue, generalAccounts_1.USD_DECIMALS), rebalanceDirection).total;
88
88
  const supplyUsd = (0, numberUtils_1.fromBaseUnit)(state.supply.amountUsed.baseAmountUsdValue, generalAccounts_1.USD_DECIMALS) +
89
89
  amountUsdToDcaIn;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.284",
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",
7
7
  "author": "Chelioso",
8
8
  "license": "MIT",
9
9
  "scripts": {
10
- "build": "rm -r dist && npx tsc",
10
+ "build": "rm -rf dist && npx tsc",
11
11
  "test:txs": "ts-mocha -p ./tsconfig.json -t 1000000 tests/transactions/**/*.ts",
12
12
  "test:unit": "ts-mocha -p ./tsconfig.json -t 1000000 tests/unit/**/*.ts",
13
13
  "test:all": "pnpm test:unit && pnpm test:txs",
@@ -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 })],
@@ -161,10 +161,7 @@ class TransactionSet {
161
161
  .filter((x) => x.tx && x.tx.getInstructions().length > 0)
162
162
  .map((x) => x.tx!);
163
163
 
164
- const txSpecificLuts = this.lutAddresses();
165
- this.txHandler.log("Tx-specific LUTs: ", txSpecificLuts.map(x => x.toString()));
166
164
  const lutInputs = await this.lookupTables.getLutInputs(this.lutAddresses());
167
- this.txHandler.log("Lut inputs:", lutInputs);
168
165
  return transactionBuilder()
169
166
  .add(transactions)
170
167
  .setAddressLookupTables(lutInputs);
@@ -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
  }
@@ -270,19 +270,13 @@ async function simulateTransaction(
270
270
  connection: Connection,
271
271
  transaction: TransactionBuilder
272
272
  ): Promise<RpcResponseAndContext<SimulatedTransactionResponse>> {
273
- consoleLog("TRANSACTION SIZE", transaction.getTransactionSize(umi));
274
- consoleLog("TRANSACTION SIZE", transaction.useV0().getTransactionSize(umi));
275
- const tx = toWeb3JsTransaction(transaction.build(umi));
276
- consoleLog(
277
- "TRANSACTIONS REQUIRED",
278
- transaction.minimumTransactionsRequired(umi)
273
+ const simulationResult = await connection.simulateTransaction(
274
+ toWeb3JsTransaction(transaction.build(umi)),
275
+ {
276
+ sigVerify: false,
277
+ commitment: "processed",
278
+ }
279
279
  );
280
- consoleLog("TRANSACTION SIZE", transaction.getTransactionSize(umi));
281
- consoleLog("FITS IN ONE TX", transaction.fitsInOneTransaction(umi));
282
- const simulationResult = await connection.simulateTransaction(tx, {
283
- sigVerify: false,
284
- commitment: "processed",
285
- });
286
280
  if (simulationResult.value.err) {
287
281
  simulationResult.value.logs?.forEach((x: any) => {
288
282
  consoleLog(x);
@@ -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;
@@ -190,7 +190,7 @@ export function getRebalanceValues(
190
190
  fromBaseUnit(BigInt(Math.round(amountToDcaIn ?? 0)), state.debt.decimals) *
191
191
  (dca?.tokenType === TokenType.Debt ? debtPrice : supplyPrice);
192
192
 
193
- const rebalanceDirection = amountUsdToDcaIn > 0 || state.liqUtilizationRateBps < targetRateBps ? RebalanceDirection.Boost : RebalanceDirection.Repay;
193
+ const rebalanceDirection = amountUsdToDcaIn > 0 || state.liqUtilizationRateBps <= targetRateBps ? RebalanceDirection.Boost : RebalanceDirection.Repay;
194
194
  const adjustmentFeeBps = getSolautoFeesBps(
195
195
  false,
196
196
  targetLiqUtilizationRateBps,