@haven-fi/solauto-sdk 1.0.197 → 1.0.199

Sign up to get free protection for your applications and to get access to all the features.
@@ -42,7 +42,7 @@ export declare abstract class SolautoClient extends TxHandler {
42
42
  solautoFeesSupplyTa: PublicKey;
43
43
  authorityLutAddress?: PublicKey;
44
44
  livePositionUpdates: LivePositionUpdates;
45
- constructor(heliusApiUrl: string, localTest?: boolean);
45
+ constructor(rpcUrl: string, localTest?: boolean);
46
46
  initialize(args: SolautoClientArgs, lendingPlatform: LendingPlatform): Promise<void>;
47
47
  setReferredBy(referredBy: PublicKey): void;
48
48
  resetLiveTxUpdates(success?: boolean): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"solautoClient.d.ts","sourceRoot":"","sources":["../../src/clients/solautoClient.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAA6B,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EACL,MAAM,EACN,kBAAkB,EAOnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,aAAa,EAEd,MAAM,iDAAiD,CAAC;AACzD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,wBAAwB,EACxB,yBAAyB,EACzB,gCAAgC,EAEhC,sBAAsB,EAMvB,MAAM,cAAc,CAAC;AAYtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAMnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;I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a,CAAC,EAAE,gCAAgC,EAChD,GAAG,CAAC,EAAE,kBAAkB,GACvB,kBAAkB;IA0BrB,gBAAgB,CAAC,IAAI,EAAE,sBAAsB,GAAG,kBAAkB;IAwDlE,eAAe,IAAI,kBAAkB;IAYrC,WAAW,IAAI,kBAAkB;IAgCjC,QAAQ,CAAC,OAAO,IAAI,kBAAkB;IAEtC,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,GAAG,kBAAkB;IAuFhE,QAAQ,CAAC,WAAW,CAClB,gBAAgB,EAAE,gBAAgB,EAClC,uBAAuB,EAAE,SAAS,GACjC,kBAAkB;IAErB,QAAQ,CAAC,UAAU,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,kBAAkB;IAE3E,QAAQ,CAAC,SAAS,CAChB,aAAa,EAAE,GAAG,GAAG,GAAG,EACxB,QAAQ,EAAE,aAAa,EACvB,aAAa,EAAE,wBAAwB,EACvC,SAAS,CAAC,EAAE,gBAAgB,EAC5B,2BAA2B,CAAC,EAAE,MAAM,GACnC,kBAAkB;IAEf,qBAAqB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAalE"}
@@ -16,8 +16,8 @@ const generalUtils_2 = require("../utils/solauto/generalUtils");
16
16
  const referralStateManager_1 = require("./referralStateManager");
17
17
  const txHandler_1 = require("./txHandler");
18
18
  class SolautoClient extends txHandler_1.TxHandler {
19
- constructor(heliusApiUrl, localTest) {
20
- super(heliusApiUrl, localTest);
19
+ constructor(rpcUrl, localTest) {
20
+ super(rpcUrl, localTest);
21
21
  this.livePositionUpdates = new generalUtils_2.LivePositionUpdates();
22
22
  this.umi = this.umi.use({
23
23
  install(umi) {
@@ -40,6 +40,8 @@ class SolautoClient extends txHandler_1.TxHandler {
40
40
  this.solautoPosition = (0, accountUtils_1.getSolautoPositionAccount)(this.authority, this.positionId);
41
41
  this.solautoPositionData = await (0, generated_1.safeFetchSolautoPosition)(this.umi, (0, umi_1.publicKey)(this.solautoPosition), { commitment: "confirmed" });
42
42
  this.solautoPositionState = this.solautoPositionData?.state;
43
+ this.maxLtvBps = undefined;
44
+ this.liqThresholdBps = undefined;
43
45
  this.supplyMint =
44
46
  args.supplyMint ??
45
47
  (this.solautoPositionData
@@ -54,7 +56,7 @@ class SolautoClient extends txHandler_1.TxHandler {
54
56
  : web3_js_1.PublicKey.default);
55
57
  this.positionDebtTa = (0, accountUtils_1.getTokenAccount)(this.solautoPosition, this.debtMint);
56
58
  this.signerDebtTa = (0, accountUtils_1.getTokenAccount)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), this.debtMint);
57
- this.referralStateManager = new referralStateManager_1.ReferralStateManager(this.heliusApiUrl);
59
+ this.referralStateManager = new referralStateManager_1.ReferralStateManager(this.rpcUrl);
58
60
  await this.referralStateManager.initialize({
59
61
  referralAuthority: this.authority,
60
62
  signer: args.signer,
@@ -1 +1 @@
1
- {"version":3,"file":"solautoMarginfiClient.d.ts","sourceRoot":"","sources":["../../src/clients/solautoMarginfiClient.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,MAAM,EACN,kBAAkB,EAMnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,SAAS,EAA8B,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAM1D,OAAO,EACL,kBAAkB,EAElB,aAAa,EAEb,iBAAiB,EACjB,wBAAwB,EACxB,gCAAgC,EAKjC,MAAM,cAAc,CAAC;AAGtB,OAAO,EAEL,eAAe,EAUhB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AASnE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,WAAW,yBAA0B,SAAQ,iBAAiB;IAClE,eAAe,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IACrC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
@@ -39,12 +39,11 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
39
39
  const marginfiAccountData = await (0, marginfi_sdk_1.safeFetchMarginfiAccount)(this.umi, (0, umi_1.publicKey)(this.marginfiAccountPk), { commitment: "confirmed" });
40
40
  this.marginfiGroup = new web3_js_1.PublicKey(marginfiAccountData
41
41
  ? marginfiAccountData.group.toString()
42
- : args.marginfiGroup ??
43
- marginfiAccounts_1.MARGINFI_ACCOUNTS[this.supplyMint.toString()].marginfiGroup ??
44
- marginfiAccounts_1.DEFAULT_MARGINFI_GROUP);
42
+ : (args.marginfiGroup ?? marginfiAccounts_1.DEFAULT_MARGINFI_GROUP));
45
43
  this.marginfiSupplyAccounts =
46
- marginfiAccounts_1.MARGINFI_ACCOUNTS[this.supplyMint.toString()];
47
- this.marginfiDebtAccounts = marginfiAccounts_1.MARGINFI_ACCOUNTS[this.debtMint.toString()];
44
+ marginfiAccounts_1.MARGINFI_ACCOUNTS[this.marginfiGroup.toString()][this.supplyMint.toString()];
45
+ this.marginfiDebtAccounts =
46
+ marginfiAccounts_1.MARGINFI_ACCOUNTS[this.marginfiGroup.toString()][this.debtMint.toString()];
48
47
  // TODO: Don't dynamically pull from bank until Marginfi sorts out their price oracle issues.
49
48
  // const [supplyBank, debtBank] = await safeFetchAllBank(this.umi, [
50
49
  // publicKey(this.marginfiSupplyAccounts.bank),
@@ -108,7 +107,7 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
108
107
  return [0, 0];
109
108
  }
110
109
  else {
111
- const [maxLtv, liqThreshold] = await (0, marginfiUtils_1.getMaxLtvAndLiqThreshold)(this.umi, {
110
+ const [maxLtv, liqThreshold] = await (0, marginfiUtils_1.getMaxLtvAndLiqThreshold)(this.umi, this.marginfiGroup, {
112
111
  mint: this.supplyMint,
113
112
  }, {
114
113
  mint: this.debtMint,
@@ -291,8 +290,8 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
291
290
  });
292
291
  }
293
292
  rebalance(rebalanceStep, jupQuote, rebalanceType, flashLoan, targetLiqUtilizationRateBps) {
294
- const inputIsSupply = (new web3_js_1.PublicKey(jupQuote.inputMint)).equals(this.supplyMint);
295
- const outputIsSupply = (new web3_js_1.PublicKey(jupQuote.outputMint)).equals(this.supplyMint);
293
+ const inputIsSupply = new web3_js_1.PublicKey(jupQuote.inputMint).equals(this.supplyMint);
294
+ const outputIsSupply = new web3_js_1.PublicKey(jupQuote.outputMint).equals(this.supplyMint);
296
295
  const needSupplyAccounts = (inputIsSupply && rebalanceStep === "A") ||
297
296
  (outputIsSupply && rebalanceStep === "B") ||
298
297
  (inputIsSupply && flashLoan !== undefined && rebalanceStep == "B");
@@ -434,7 +433,7 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
434
433
  if (state) {
435
434
  return state;
436
435
  }
437
- const freshState = await (0, marginfiUtils_1.getMarginfiAccountPositionState)(this.umi, this.marginfiAccountPk, !this.selfManaged && this.solautoPositionData === null
436
+ const freshState = await (0, marginfiUtils_1.getMarginfiAccountPositionState)(this.umi, this.marginfiAccountPk, this.marginfiGroup, !this.selfManaged && this.solautoPositionData === null
438
437
  ? this.supplyMint
439
438
  : undefined, !this.selfManaged && this.solautoPositionData === null
440
439
  ? this.debtMint
@@ -1,10 +1,10 @@
1
1
  import { Umi } from "@metaplex-foundation/umi";
2
2
  import { Connection } from "@solana/web3.js";
3
3
  export declare abstract class TxHandler {
4
- heliusApiUrl: string;
4
+ rpcUrl: string;
5
5
  umi: Umi;
6
6
  connection: Connection;
7
- constructor(heliusApiUrl: string, localTest?: boolean);
7
+ constructor(rpcUrl: string, localTest?: boolean);
8
8
  log(...args: any[]): void;
9
9
  abstract defaultLookupTables(): string[];
10
10
  abstract resetLiveTxUpdates(success?: boolean): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"txHandler.d.ts","sourceRoot":"","sources":["../../src/clients/txHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,8BAAsB,SAAS;IACtB,YAAY,EAAG,MAAM,CAAC;IACtB,GAAG,EAAG,GAAG,CAAC;IACV,UAAU,EAAG,UAAU,CAAC;gBAG7B,YAAY,EAAE,MAAM,EACpB,SAAS,CAAC,EAAE,OAAO;IAYrB,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAIzB,QAAQ,CAAC,mBAAmB,IAAI,MAAM,EAAE;IAExC,QAAQ,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAC9D"}
1
+ {"version":3,"file":"txHandler.d.ts","sourceRoot":"","sources":["../../src/clients/txHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,8BAAsB,SAAS;IACtB,MAAM,EAAG,MAAM,CAAC;IAChB,GAAG,EAAG,GAAG,CAAC;IACV,UAAU,EAAG,UAAU,CAAC;gBAG7B,MAAM,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,OAAO;IAYrB,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAIzB,QAAQ,CAAC,mBAAmB,IAAI,MAAM,EAAE;IAExC,QAAQ,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAC9D"}
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TxHandler = void 0;
4
4
  const utils_1 = require("../utils");
5
5
  class TxHandler {
6
- constructor(heliusApiUrl, localTest) {
7
- this.heliusApiUrl = heliusApiUrl;
8
- const [connection, umi] = (0, utils_1.getSolanaRpcConnection)(this.heliusApiUrl);
6
+ constructor(rpcUrl, localTest) {
7
+ this.rpcUrl = rpcUrl;
8
+ const [connection, umi] = (0, utils_1.getSolanaRpcConnection)(this.rpcUrl);
9
9
  this.connection = connection;
10
10
  this.umi = umi;
11
11
  if (!globalThis.LOCAL_TEST && localTest) {
@@ -2,7 +2,9 @@ import { MarginfiAssetAccounts } from "../types/accounts";
2
2
  export declare const DEFAULT_MARGINFI_GROUP = "4qp6Fx6tnZkY5Wropq9wUYgtFxXKwE6viZxFHg3rdAG8";
3
3
  export declare const DEFAULT_PUBKEY: string;
4
4
  export declare const MARGINFI_ACCOUNTS: {
5
- [key: string]: MarginfiAssetAccounts;
5
+ [group: string]: {
6
+ [token: string]: MarginfiAssetAccounts;
7
+ };
6
8
  };
7
9
  export declare const MARGINFI_ACCOUNTS_LOOKUP_TABLE = "GAjmWmBPcH5Gxbiykasydj6RsCEaCLyHEvK6kHdFigc6";
8
10
  //# sourceMappingURL=marginfiAccounts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"marginfiAccounts.d.ts","sourceRoot":"","sources":["../../src/constants/marginfiAccounts.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,eAAO,MAAM,sBAAsB,iDAAiD,CAAC;AAErF,eAAO,MAAM,cAAc,QAA+B,CAAC;AAC3D,eAAO,MAAM,iBAAiB,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,qBAAqB,CAAA;CA+BrE,CAAC;AAEF,eAAO,MAAM,8BAA8B,iDAAiD,CAAC"}
1
+ {"version":3,"file":"marginfiAccounts.d.ts","sourceRoot":"","sources":["../../src/constants/marginfiAccounts.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,eAAO,MAAM,sBAAsB,iDAAiD,CAAC;AAErF,eAAO,MAAM,cAAc,QAA+B,CAAC;AAE3D,eAAO,MAAM,iBAAiB,EAAE;IAAE,CAAC,KAAK,EAAE,MAAM,GAAG;QAAE,CAAC,KAAK,EAAE,MAAM,GAAG,qBAAqB,CAAA;KAAE,CAAA;CA2B5F,CAAC;AAEF,eAAO,MAAM,8BAA8B,iDAAiD,CAAC"}
@@ -7,35 +7,31 @@ const web3_js_1 = require("@solana/web3.js");
7
7
  exports.DEFAULT_MARGINFI_GROUP = "4qp6Fx6tnZkY5Wropq9wUYgtFxXKwE6viZxFHg3rdAG8";
8
8
  exports.DEFAULT_PUBKEY = web3_js_1.PublicKey.default.toString();
9
9
  exports.MARGINFI_ACCOUNTS = {
10
- [exports.DEFAULT_PUBKEY]: {
11
- bank: exports.DEFAULT_PUBKEY,
12
- liquidityVault: exports.DEFAULT_PUBKEY,
13
- vaultAuthority: exports.DEFAULT_PUBKEY,
14
- priceOracle: exports.DEFAULT_PUBKEY,
15
- },
16
- [spl_token_1.NATIVE_MINT.toString()]: {
17
- bank: "CCKtUs6Cgwo4aaQUmBPmyoApH2gUDErxNZCAntD6LYGh",
18
- liquidityVault: "2eicbpitfJXDwqCuFAmPgDP7t2oUotnAzbGzRKLMgSLe",
19
- vaultAuthority: "DD3AeAssFvjqTvRTrRAtpfjkBF8FpVKnFuwnMLN9haXD",
20
- priceOracle: "7UVimffxr9ow1uXYxsr4LHAcV58mLzhmwaeKvJ1pjLiE"
21
- },
22
- [tokenConstants_1.USDC_MINT]: {
23
- bank: "2s37akK2eyBbp8DZgCm7RtsaEz8eJP3Nxd4urLHQv7yB",
24
- liquidityVault: "7jaiZR5Sk8hdYN9MxTpczTcwbWpb5WEoxSANuUwveuat",
25
- vaultAuthority: "3uxNepDbmkDNq6JhRja5Z8QwbTrfmkKP8AKZV5chYDGG",
26
- priceOracle: "Dpw1EAVrSB1ibxiDQyTAW6Zip3J4Btk2x4SgApQCeFbX"
27
- },
28
- [tokenConstants_1.B_SOL]: {
29
- bank: "6hS9i46WyTq1KXcoa2Chas2Txh9TJAVr6n1t3tnrE23K",
30
- liquidityVault: "2WMipeKDB2CENxbzdmnVrRbsxCA2LY6kCtBe6AAqDP9p",
31
- vaultAuthority: "8RcZHucpVHkHWRRdMhJZsxBK9mqKSYnMKGqtF84U8YEo",
32
- priceOracle: "5cN76Xm2Dtx9MnrQqBDeZZRsWruTTcw37UruznAdSvvE",
33
- },
34
- [tokenConstants_1.JUP]: {
35
- bank: "Guu5uBc8k1WK1U2ihGosNaCy57LSgCkpWAabtzQqrQf8",
36
- liquidityVault: "4w49W4fNDn778wsBa6TNq9hvebZKU17ymsptrEZ8zrsm",
37
- vaultAuthority: "2MBwwAhL3c73Jy7HkWd9ofzh1bU39JBabrZCFQR2tUof",
38
- priceOracle: "7dbob1psH1iZBS7qPsm3Kwbf5DzSXK8Jyg31CTgTnxH5",
39
- },
10
+ [exports.DEFAULT_MARGINFI_GROUP.toString()]: {
11
+ [spl_token_1.NATIVE_MINT.toString()]: {
12
+ bank: "CCKtUs6Cgwo4aaQUmBPmyoApH2gUDErxNZCAntD6LYGh",
13
+ liquidityVault: "2eicbpitfJXDwqCuFAmPgDP7t2oUotnAzbGzRKLMgSLe",
14
+ vaultAuthority: "DD3AeAssFvjqTvRTrRAtpfjkBF8FpVKnFuwnMLN9haXD",
15
+ priceOracle: "7UVimffxr9ow1uXYxsr4LHAcV58mLzhmwaeKvJ1pjLiE"
16
+ },
17
+ [tokenConstants_1.USDC_MINT]: {
18
+ bank: "2s37akK2eyBbp8DZgCm7RtsaEz8eJP3Nxd4urLHQv7yB",
19
+ liquidityVault: "7jaiZR5Sk8hdYN9MxTpczTcwbWpb5WEoxSANuUwveuat",
20
+ vaultAuthority: "3uxNepDbmkDNq6JhRja5Z8QwbTrfmkKP8AKZV5chYDGG",
21
+ priceOracle: "Dpw1EAVrSB1ibxiDQyTAW6Zip3J4Btk2x4SgApQCeFbX"
22
+ },
23
+ [tokenConstants_1.B_SOL]: {
24
+ bank: "6hS9i46WyTq1KXcoa2Chas2Txh9TJAVr6n1t3tnrE23K",
25
+ liquidityVault: "2WMipeKDB2CENxbzdmnVrRbsxCA2LY6kCtBe6AAqDP9p",
26
+ vaultAuthority: "8RcZHucpVHkHWRRdMhJZsxBK9mqKSYnMKGqtF84U8YEo",
27
+ priceOracle: "5cN76Xm2Dtx9MnrQqBDeZZRsWruTTcw37UruznAdSvvE",
28
+ },
29
+ [tokenConstants_1.JUP]: {
30
+ bank: "Guu5uBc8k1WK1U2ihGosNaCy57LSgCkpWAabtzQqrQf8",
31
+ liquidityVault: "4w49W4fNDn778wsBa6TNq9hvebZKU17ymsptrEZ8zrsm",
32
+ vaultAuthority: "2MBwwAhL3c73Jy7HkWd9ofzh1bU39JBabrZCFQR2tUof",
33
+ priceOracle: "7dbob1psH1iZBS7qPsm3Kwbf5DzSXK8Jyg31CTgTnxH5",
34
+ }
35
+ }
40
36
  };
41
37
  exports.MARGINFI_ACCOUNTS_LOOKUP_TABLE = "GAjmWmBPcH5Gxbiykasydj6RsCEaCLyHEvK6kHdFigc6";
@@ -3,6 +3,5 @@ export interface MarginfiAssetAccounts {
3
3
  liquidityVault: string;
4
4
  vaultAuthority: string;
5
5
  priceOracle: string;
6
- marginfiGroup?: string;
7
6
  }
8
7
  //# sourceMappingURL=accounts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../src/types/accounts.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
1
+ {"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../src/types/accounts.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;CACrB"}
@@ -5,7 +5,7 @@ import { MarginfiAssetAccounts } from "../types/accounts";
5
5
  import { PositionState } from "../generated";
6
6
  import { LivePositionUpdates } from "./solauto/generalUtils";
7
7
  export declare function findMarginfiAccounts(bank: PublicKey): MarginfiAssetAccounts;
8
- export declare function getMaxLtvAndLiqThreshold(umi: Umi, supply: {
8
+ export declare function getMaxLtvAndLiqThreshold(umi: Umi, marginfiGroup: PublicKey, supply: {
9
9
  mint: PublicKey;
10
10
  bank?: Bank | null;
11
11
  }, debt: {
@@ -17,6 +17,6 @@ export declare function getAllMarginfiAccountsByAuthority(umi: Umi, authority: P
17
17
  supplyMint?: PublicKey;
18
18
  debtMint?: PublicKey;
19
19
  }[]>;
20
- export declare function getMarginfiAccountPositionState(umi: Umi, marginfiAccountPk: PublicKey, supplyMint?: PublicKey, debtMint?: PublicKey, livePositionUpdates?: LivePositionUpdates): Promise<PositionState | undefined>;
20
+ export declare function getMarginfiAccountPositionState(umi: Umi, marginfiAccountPk: PublicKey, marginfiGroup?: PublicKey, supplyMint?: PublicKey, debtMint?: PublicKey, livePositionUpdates?: LivePositionUpdates): Promise<PositionState | undefined>;
21
21
  export declare function getUpToDateShareValues(umi: Umi, bank: Bank): Promise<[number, number]>;
22
22
  //# sourceMappingURL=marginfiUtils.d.ts.map
@@ -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,EAKL,MAAM,iBAAiB,CAAC;AAczB,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,GA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../constants/marginfiAccounts");
15
15
  const generalAccounts_1 = require("../constants/generalAccounts");
16
16
  const constants_1 = require("../constants");
17
17
  function findMarginfiAccounts(bank) {
18
- for (const key in marginfiAccounts_1.MARGINFI_ACCOUNTS) {
19
- const account = marginfiAccounts_1.MARGINFI_ACCOUNTS[key];
20
- if (account.bank.toString().toLowerCase() === bank.toString().toLowerCase()) {
21
- return account;
18
+ for (const group in marginfiAccounts_1.MARGINFI_ACCOUNTS) {
19
+ for (const key in marginfiAccounts_1.MARGINFI_ACCOUNTS[group]) {
20
+ const account = marginfiAccounts_1.MARGINFI_ACCOUNTS[group][key];
21
+ if (account.bank.toString().toLowerCase() === bank.toString().toLowerCase()) {
22
+ return account;
23
+ }
22
24
  }
23
25
  }
24
26
  throw new Error(`Marginfi accounts not found by the bank: ${bank}`);
25
27
  }
26
- async function getMaxLtvAndLiqThreshold(umi, supply, debt, supplyPrice) {
28
+ async function getMaxLtvAndLiqThreshold(umi, marginfiGroup, supply, debt, supplyPrice) {
27
29
  if (!supply.bank && supply.mint.equals(web3_js_1.PublicKey.default)) {
28
30
  return [0, 0];
29
31
  }
30
32
  if (!supply.bank || supply.bank === null) {
31
- supply.bank = await (0, marginfi_sdk_1.safeFetchBank)(umi, (0, umi_1.publicKey)(marginfiAccounts_1.MARGINFI_ACCOUNTS[supply.mint.toString()].bank), { commitment: "confirmed" });
33
+ supply.bank = await (0, marginfi_sdk_1.safeFetchBank)(umi, (0, umi_1.publicKey)(marginfiAccounts_1.MARGINFI_ACCOUNTS[marginfiGroup.toString()][supply.mint.toString()].bank), { commitment: "confirmed" });
32
34
  }
33
35
  if ((!debt.bank || debt.bank === null) &&
34
36
  !debt.mint.equals(web3_js_1.PublicKey.default)) {
35
- debt.bank = await (0, marginfi_sdk_1.safeFetchBank)(umi, (0, umi_1.publicKey)(marginfiAccounts_1.MARGINFI_ACCOUNTS[debt.mint.toString()].bank), { commitment: "confirmed" });
37
+ debt.bank = await (0, marginfi_sdk_1.safeFetchBank)(umi, (0, umi_1.publicKey)(marginfiAccounts_1.MARGINFI_ACCOUNTS[marginfiGroup.toString()][debt.mint.toString()].bank), { commitment: "confirmed" });
36
38
  }
37
39
  if (!supplyPrice) {
38
40
  const [price] = await (0, generalUtils_1.fetchTokenPrices)([
@@ -136,13 +138,16 @@ async function getTokenUsage(umi, bank, isAsset, shares, amountUsedAdjustment) {
136
138
  padding: new Uint8Array([]),
137
139
  };
138
140
  }
139
- async function getMarginfiAccountPositionState(umi, marginfiAccountPk, supplyMint, debtMint, livePositionUpdates) {
141
+ async function getMarginfiAccountPositionState(umi, marginfiAccountPk, marginfiGroup, supplyMint, debtMint, livePositionUpdates) {
140
142
  let marginfiAccount = await (0, marginfi_sdk_1.safeFetchMarginfiAccount)(umi, (0, umi_1.publicKey)(marginfiAccountPk), { commitment: "confirmed" });
143
+ if (!marginfiGroup && marginfiAccount) {
144
+ marginfiGroup = (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(marginfiAccount.group);
145
+ }
141
146
  let supplyBank = supplyMint && supplyMint !== web3_js_1.PublicKey.default
142
- ? await (0, marginfi_sdk_1.safeFetchBank)(umi, (0, umi_1.publicKey)(marginfiAccounts_1.MARGINFI_ACCOUNTS[supplyMint.toString()].bank), { commitment: "confirmed" })
147
+ ? await (0, marginfi_sdk_1.safeFetchBank)(umi, (0, umi_1.publicKey)(marginfiAccounts_1.MARGINFI_ACCOUNTS[marginfiGroup?.toString() ?? ""][supplyMint.toString()].bank), { commitment: "confirmed" })
143
148
  : null;
144
149
  let debtBank = debtMint && debtMint !== web3_js_1.PublicKey.default
145
- ? await (0, marginfi_sdk_1.safeFetchBank)(umi, (0, umi_1.publicKey)(marginfiAccounts_1.MARGINFI_ACCOUNTS[debtMint.toString()].bank), { commitment: "confirmed" })
150
+ ? await (0, marginfi_sdk_1.safeFetchBank)(umi, (0, umi_1.publicKey)(marginfiAccounts_1.MARGINFI_ACCOUNTS[marginfiGroup?.toString() ?? ""][debtMint.toString()].bank), { commitment: "confirmed" })
146
151
  : null;
147
152
  let supplyUsage = undefined;
148
153
  let debtUsage = undefined;
@@ -195,7 +200,7 @@ async function getMarginfiAccountPositionState(umi, marginfiAccountPk, supplyMin
195
200
  debtUsage = await getTokenUsage(umi, debtBank, false, 0, livePositionUpdates?.debtAdjustment);
196
201
  }
197
202
  const supplyPrice = (0, generalUtils_1.safeGetPrice)(supplyMint);
198
- let [maxLtv, liqThreshold] = await getMaxLtvAndLiqThreshold(umi, {
203
+ let [maxLtv, liqThreshold] = await getMaxLtvAndLiqThreshold(umi, marginfiGroup ?? new web3_js_1.PublicKey(marginfiAccounts_1.DEFAULT_MARGINFI_GROUP), {
199
204
  mint: (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(supplyBank.mint),
200
205
  bank: supplyBank,
201
206
  }, {
@@ -10,18 +10,20 @@ import { updateLookupTable } from "./shared";
10
10
  const LOOKUP_TABLE_ADDRESS = new PublicKey(MARGINFI_ACCOUNTS_LOOKUP_TABLE);
11
11
 
12
12
  async function addBanks() {
13
- for (const key in MARGINFI_ACCOUNTS) {
14
- const accounts = MARGINFI_ACCOUNTS[key];
15
- await updateLookupTable(
16
- [
17
- key,
18
- accounts.bank,
19
- accounts.liquidityVault,
20
- accounts.vaultAuthority,
21
- accounts.priceOracle,
22
- ],
23
- LOOKUP_TABLE_ADDRESS
24
- );
13
+ for (const group in MARGINFI_ACCOUNTS) {
14
+ for (const key in MARGINFI_ACCOUNTS[group]) {
15
+ const accounts = MARGINFI_ACCOUNTS[group][key];
16
+ await updateLookupTable(
17
+ [
18
+ key,
19
+ accounts.bank,
20
+ accounts.liquidityVault,
21
+ accounts.vaultAuthority,
22
+ accounts.priceOracle,
23
+ ],
24
+ LOOKUP_TABLE_ADDRESS
25
+ );
26
+ }
25
27
  }
26
28
  }
27
29
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.197",
3
+ "version": "1.0.199",
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",
@@ -22,6 +22,7 @@
22
22
  "@metaplex-foundation/umi-web3js-adapters": "^0.9.1",
23
23
  "@solana/spl-token": "^0.4.0",
24
24
  "@solana/web3.js": "^1.92.1",
25
+ "@sqds/multisig": "^2.1.3",
25
26
  "@types/node": "^20.14.8",
26
27
  "bs58": "^5.0.0",
27
28
  "cross-fetch": "^4.0.0",
@@ -103,8 +103,8 @@ export abstract class SolautoClient extends TxHandler {
103
103
 
104
104
  public livePositionUpdates: LivePositionUpdates = new LivePositionUpdates();
105
105
 
106
- constructor(heliusApiUrl: string, localTest?: boolean) {
107
- super(heliusApiUrl, localTest);
106
+ constructor(rpcUrl: string, localTest?: boolean) {
107
+ super(rpcUrl, localTest);
108
108
 
109
109
  this.umi = this.umi.use({
110
110
  install(umi) {
@@ -140,6 +140,9 @@ export abstract class SolautoClient extends TxHandler {
140
140
  );
141
141
  this.solautoPositionState = this.solautoPositionData?.state;
142
142
 
143
+ this.maxLtvBps = undefined;
144
+ this.liqThresholdBps = undefined;
145
+
143
146
  this.supplyMint =
144
147
  args.supplyMint ??
145
148
  (this.solautoPositionData
@@ -165,7 +168,7 @@ export abstract class SolautoClient extends TxHandler {
165
168
  this.debtMint
166
169
  );
167
170
 
168
- this.referralStateManager = new ReferralStateManager(this.heliusApiUrl);
171
+ this.referralStateManager = new ReferralStateManager(this.rpcUrl);
169
172
  await this.referralStateManager.initialize({
170
173
  referralAuthority: this.authority,
171
174
  signer: args.signer,
@@ -47,7 +47,6 @@ import {
47
47
  safeFetchAllMarginfiAccount,
48
48
  safeFetchMarginfiAccount,
49
49
  } from "../marginfi-sdk";
50
- import { JupSwapDetails } from "../utils/jupiterUtils";
51
50
  import { FlashLoanDetails } from "../utils/solauto/rebalanceUtils";
52
51
  import {
53
52
  findMarginfiAccounts,
@@ -115,14 +114,17 @@ export class SolautoMarginfiClient extends SolautoClient {
115
114
  this.marginfiGroup = new PublicKey(
116
115
  marginfiAccountData
117
116
  ? marginfiAccountData.group.toString()
118
- : args.marginfiGroup ??
119
- MARGINFI_ACCOUNTS[this.supplyMint.toString()].marginfiGroup ??
120
- DEFAULT_MARGINFI_GROUP
117
+ : (args.marginfiGroup ?? DEFAULT_MARGINFI_GROUP)
121
118
  );
122
119
 
123
120
  this.marginfiSupplyAccounts =
124
- MARGINFI_ACCOUNTS[this.supplyMint.toString()]!;
125
- this.marginfiDebtAccounts = MARGINFI_ACCOUNTS[this.debtMint.toString()]!;
121
+ MARGINFI_ACCOUNTS[this.marginfiGroup.toString()][
122
+ this.supplyMint.toString()
123
+ ]!;
124
+ this.marginfiDebtAccounts =
125
+ MARGINFI_ACCOUNTS[this.marginfiGroup.toString()][
126
+ this.debtMint.toString()
127
+ ]!;
126
128
 
127
129
  // TODO: Don't dynamically pull from bank until Marginfi sorts out their price oracle issues.
128
130
  // const [supplyBank, debtBank] = await safeFetchAllBank(this.umi, [
@@ -225,6 +227,7 @@ export class SolautoMarginfiClient extends SolautoClient {
225
227
  } else {
226
228
  const [maxLtv, liqThreshold] = await getMaxLtvAndLiqThreshold(
227
229
  this.umi,
230
+ this.marginfiGroup,
228
231
  {
229
232
  mint: this.supplyMint,
230
233
  },
@@ -458,8 +461,12 @@ export class SolautoMarginfiClient extends SolautoClient {
458
461
  flashLoan?: FlashLoanDetails,
459
462
  targetLiqUtilizationRateBps?: number
460
463
  ): TransactionBuilder {
461
- const inputIsSupply = (new PublicKey(jupQuote.inputMint)).equals(this.supplyMint);
462
- const outputIsSupply = (new PublicKey(jupQuote.outputMint)).equals(this.supplyMint);
464
+ const inputIsSupply = new PublicKey(jupQuote.inputMint).equals(
465
+ this.supplyMint
466
+ );
467
+ const outputIsSupply = new PublicKey(jupQuote.outputMint).equals(
468
+ this.supplyMint
469
+ );
463
470
  const needSupplyAccounts =
464
471
  (inputIsSupply && rebalanceStep === "A") ||
465
472
  (outputIsSupply && rebalanceStep === "B") ||
@@ -517,7 +524,8 @@ export class SolautoMarginfiClient extends SolautoClient {
517
524
  : undefined,
518
525
  rebalanceType,
519
526
  targetLiqUtilizationRateBps: targetLiqUtilizationRateBps ?? null,
520
- targetInAmountBaseUnit: rebalanceStep === "A" ? parseInt(jupQuote.inAmount) : null,
527
+ targetInAmountBaseUnit:
528
+ rebalanceStep === "A" ? parseInt(jupQuote.inAmount) : null,
521
529
  });
522
530
  }
523
531
 
@@ -653,6 +661,7 @@ export class SolautoMarginfiClient extends SolautoClient {
653
661
  const freshState = await getMarginfiAccountPositionState(
654
662
  this.umi,
655
663
  this.marginfiAccountPk,
664
+ this.marginfiGroup,
656
665
  !this.selfManaged && this.solautoPositionData === null
657
666
  ? this.supplyMint
658
667
  : undefined,
@@ -3,16 +3,16 @@ import { Connection } from "@solana/web3.js";
3
3
  import { consoleLog, getSolanaRpcConnection } from "../utils";
4
4
 
5
5
  export abstract class TxHandler {
6
- public heliusApiUrl!: string;
6
+ public rpcUrl!: string;
7
7
  public umi!: Umi;
8
8
  public connection!: Connection;
9
9
 
10
10
  constructor(
11
- heliusApiUrl: string,
11
+ rpcUrl: string,
12
12
  localTest?: boolean
13
13
  ) {
14
- this.heliusApiUrl = heliusApiUrl;
15
- const [connection, umi] = getSolanaRpcConnection(this.heliusApiUrl);
14
+ this.rpcUrl = rpcUrl;
15
+ const [connection, umi] = getSolanaRpcConnection(this.rpcUrl);
16
16
  this.connection = connection;
17
17
  this.umi = umi;
18
18
 
@@ -6,37 +6,34 @@ import { PublicKey } from "@solana/web3.js";
6
6
  export const DEFAULT_MARGINFI_GROUP = "4qp6Fx6tnZkY5Wropq9wUYgtFxXKwE6viZxFHg3rdAG8";
7
7
 
8
8
  export const DEFAULT_PUBKEY = PublicKey.default.toString();
9
- export const MARGINFI_ACCOUNTS: { [key: string]: MarginfiAssetAccounts } = {
10
- [DEFAULT_PUBKEY]: {
11
- bank: DEFAULT_PUBKEY,
12
- liquidityVault: DEFAULT_PUBKEY,
13
- vaultAuthority: DEFAULT_PUBKEY,
14
- priceOracle: DEFAULT_PUBKEY,
15
- },
16
- [NATIVE_MINT.toString()]: {
17
- bank: "CCKtUs6Cgwo4aaQUmBPmyoApH2gUDErxNZCAntD6LYGh",
18
- liquidityVault: "2eicbpitfJXDwqCuFAmPgDP7t2oUotnAzbGzRKLMgSLe",
19
- vaultAuthority: "DD3AeAssFvjqTvRTrRAtpfjkBF8FpVKnFuwnMLN9haXD",
20
- priceOracle: "7UVimffxr9ow1uXYxsr4LHAcV58mLzhmwaeKvJ1pjLiE"
21
- },
22
- [USDC_MINT]: {
23
- bank: "2s37akK2eyBbp8DZgCm7RtsaEz8eJP3Nxd4urLHQv7yB",
24
- liquidityVault: "7jaiZR5Sk8hdYN9MxTpczTcwbWpb5WEoxSANuUwveuat",
25
- vaultAuthority: "3uxNepDbmkDNq6JhRja5Z8QwbTrfmkKP8AKZV5chYDGG",
26
- priceOracle: "Dpw1EAVrSB1ibxiDQyTAW6Zip3J4Btk2x4SgApQCeFbX"
27
- },
28
- [B_SOL]: {
29
- bank: "6hS9i46WyTq1KXcoa2Chas2Txh9TJAVr6n1t3tnrE23K",
30
- liquidityVault: "2WMipeKDB2CENxbzdmnVrRbsxCA2LY6kCtBe6AAqDP9p",
31
- vaultAuthority: "8RcZHucpVHkHWRRdMhJZsxBK9mqKSYnMKGqtF84U8YEo",
32
- priceOracle: "5cN76Xm2Dtx9MnrQqBDeZZRsWruTTcw37UruznAdSvvE",
33
- },
34
- [JUP]: {
35
- bank: "Guu5uBc8k1WK1U2ihGosNaCy57LSgCkpWAabtzQqrQf8",
36
- liquidityVault: "4w49W4fNDn778wsBa6TNq9hvebZKU17ymsptrEZ8zrsm",
37
- vaultAuthority: "2MBwwAhL3c73Jy7HkWd9ofzh1bU39JBabrZCFQR2tUof",
38
- priceOracle: "7dbob1psH1iZBS7qPsm3Kwbf5DzSXK8Jyg31CTgTnxH5",
39
- },
9
+
10
+ export const MARGINFI_ACCOUNTS: { [group: string]: { [token: string]: MarginfiAssetAccounts } } = {
11
+ [DEFAULT_MARGINFI_GROUP.toString()]: {
12
+ [NATIVE_MINT.toString()]: {
13
+ bank: "CCKtUs6Cgwo4aaQUmBPmyoApH2gUDErxNZCAntD6LYGh",
14
+ liquidityVault: "2eicbpitfJXDwqCuFAmPgDP7t2oUotnAzbGzRKLMgSLe",
15
+ vaultAuthority: "DD3AeAssFvjqTvRTrRAtpfjkBF8FpVKnFuwnMLN9haXD",
16
+ priceOracle: "7UVimffxr9ow1uXYxsr4LHAcV58mLzhmwaeKvJ1pjLiE"
17
+ },
18
+ [USDC_MINT]: {
19
+ bank: "2s37akK2eyBbp8DZgCm7RtsaEz8eJP3Nxd4urLHQv7yB",
20
+ liquidityVault: "7jaiZR5Sk8hdYN9MxTpczTcwbWpb5WEoxSANuUwveuat",
21
+ vaultAuthority: "3uxNepDbmkDNq6JhRja5Z8QwbTrfmkKP8AKZV5chYDGG",
22
+ priceOracle: "Dpw1EAVrSB1ibxiDQyTAW6Zip3J4Btk2x4SgApQCeFbX"
23
+ },
24
+ [B_SOL]: {
25
+ bank: "6hS9i46WyTq1KXcoa2Chas2Txh9TJAVr6n1t3tnrE23K",
26
+ liquidityVault: "2WMipeKDB2CENxbzdmnVrRbsxCA2LY6kCtBe6AAqDP9p",
27
+ vaultAuthority: "8RcZHucpVHkHWRRdMhJZsxBK9mqKSYnMKGqtF84U8YEo",
28
+ priceOracle: "5cN76Xm2Dtx9MnrQqBDeZZRsWruTTcw37UruznAdSvvE",
29
+ },
30
+ [JUP]: {
31
+ bank: "Guu5uBc8k1WK1U2ihGosNaCy57LSgCkpWAabtzQqrQf8",
32
+ liquidityVault: "4w49W4fNDn778wsBa6TNq9hvebZKU17ymsptrEZ8zrsm",
33
+ vaultAuthority: "2MBwwAhL3c73Jy7HkWd9ofzh1bU39JBabrZCFQR2tUof",
34
+ priceOracle: "7dbob1psH1iZBS7qPsm3Kwbf5DzSXK8Jyg31CTgTnxH5",
35
+ }
36
+ }
40
37
  };
41
38
 
42
39
  export const MARGINFI_ACCOUNTS_LOOKUP_TABLE = "GAjmWmBPcH5Gxbiykasydj6RsCEaCLyHEvK6kHdFigc6";
@@ -3,5 +3,4 @@ export interface MarginfiAssetAccounts {
3
3
  liquidityVault: string;
4
4
  vaultAuthority: string;
5
5
  priceOracle: string;
6
- marginfiGroup?: string;
7
6
  }
@@ -28,12 +28,14 @@ import { LivePositionUpdates } from "./solauto/generalUtils";
28
28
  import { TOKEN_INFO } from "../constants";
29
29
 
30
30
  export function findMarginfiAccounts(bank: PublicKey): MarginfiAssetAccounts {
31
- for (const key in MARGINFI_ACCOUNTS) {
32
- const account = MARGINFI_ACCOUNTS[key];
33
- if (
34
- account.bank.toString().toLowerCase() === bank.toString().toLowerCase()
35
- ) {
36
- return account;
31
+ for (const group in MARGINFI_ACCOUNTS) {
32
+ for (const key in MARGINFI_ACCOUNTS[group]) {
33
+ const account = MARGINFI_ACCOUNTS[group][key];
34
+ if (
35
+ account.bank.toString().toLowerCase() === bank.toString().toLowerCase()
36
+ ) {
37
+ return account;
38
+ }
37
39
  }
38
40
  }
39
41
  throw new Error(`Marginfi accounts not found by the bank: ${bank}`);
@@ -41,6 +43,7 @@ export function findMarginfiAccounts(bank: PublicKey): MarginfiAssetAccounts {
41
43
 
42
44
  export async function getMaxLtvAndLiqThreshold(
43
45
  umi: Umi,
46
+ marginfiGroup: PublicKey,
44
47
  supply: {
45
48
  mint: PublicKey;
46
49
  bank?: Bank | null;
@@ -58,7 +61,7 @@ export async function getMaxLtvAndLiqThreshold(
58
61
  if (!supply.bank || supply.bank === null) {
59
62
  supply.bank = await safeFetchBank(
60
63
  umi,
61
- publicKey(MARGINFI_ACCOUNTS[supply.mint.toString()].bank),
64
+ publicKey(MARGINFI_ACCOUNTS[marginfiGroup.toString()][supply.mint.toString()].bank),
62
65
  { commitment: "confirmed" }
63
66
  );
64
67
  }
@@ -69,7 +72,7 @@ export async function getMaxLtvAndLiqThreshold(
69
72
  ) {
70
73
  debt.bank = await safeFetchBank(
71
74
  umi,
72
- publicKey(MARGINFI_ACCOUNTS[debt.mint.toString()].bank),
75
+ publicKey(MARGINFI_ACCOUNTS[marginfiGroup.toString()][debt.mint.toString()].bank),
73
76
  { commitment: "confirmed" }
74
77
  );
75
78
  }
@@ -244,6 +247,7 @@ async function getTokenUsage(
244
247
  export async function getMarginfiAccountPositionState(
245
248
  umi: Umi,
246
249
  marginfiAccountPk: PublicKey,
250
+ marginfiGroup?: PublicKey,
247
251
  supplyMint?: PublicKey,
248
252
  debtMint?: PublicKey,
249
253
  livePositionUpdates?: LivePositionUpdates
@@ -254,11 +258,15 @@ export async function getMarginfiAccountPositionState(
254
258
  { commitment: "confirmed" }
255
259
  );
256
260
 
261
+ if (!marginfiGroup && marginfiAccount) {
262
+ marginfiGroup = toWeb3JsPublicKey(marginfiAccount.group);
263
+ }
264
+
257
265
  let supplyBank: Bank | null =
258
266
  supplyMint && supplyMint !== PublicKey.default
259
267
  ? await safeFetchBank(
260
268
  umi,
261
- publicKey(MARGINFI_ACCOUNTS[supplyMint.toString()].bank),
269
+ publicKey(MARGINFI_ACCOUNTS[marginfiGroup?.toString() ?? ""][supplyMint.toString()].bank),
262
270
  { commitment: "confirmed" }
263
271
  )
264
272
  : null;
@@ -266,7 +274,7 @@ export async function getMarginfiAccountPositionState(
266
274
  debtMint && debtMint !== PublicKey.default
267
275
  ? await safeFetchBank(
268
276
  umi,
269
- publicKey(MARGINFI_ACCOUNTS[debtMint.toString()].bank),
277
+ publicKey(MARGINFI_ACCOUNTS[marginfiGroup?.toString() ?? ""][debtMint.toString()].bank),
270
278
  { commitment: "confirmed" }
271
279
  )
272
280
  : null;
@@ -368,6 +376,7 @@ export async function getMarginfiAccountPositionState(
368
376
  const supplyPrice = safeGetPrice(supplyMint!)!;
369
377
  let [maxLtv, liqThreshold] = await getMaxLtvAndLiqThreshold(
370
378
  umi,
379
+ marginfiGroup ?? new PublicKey(DEFAULT_MARGINFI_GROUP),
371
380
  {
372
381
  mint: toWeb3JsPublicKey(supplyBank.mint),
373
382
  bank: supplyBank,
@@ -0,0 +1,32 @@
1
+ import { describe, it } from "mocha";
2
+ import {
3
+ ALL_SUPPORTED_TOKENS,
4
+ TOKEN_INFO,
5
+ } from "../../src/constants/tokenConstants";
6
+ import {
7
+ buildHeliusApiUrl,
8
+ getSolanaRpcConnection,
9
+ } from "../../src/utils/solanaUtils";
10
+ import { publicKey } from "@metaplex-foundation/umi";
11
+ import { assert } from "chai";
12
+
13
+ describe("Assert Solauto fee token accounts are created", async () => {
14
+ it("all Solauto fee token accounts created", async () => {
15
+ let [_, umi] = getSolanaRpcConnection(
16
+ buildHeliusApiUrl(process.env.HELIUS_API_KEY!)
17
+ );
18
+
19
+ const tokenAccounts = await umi.rpc.getAccounts(
20
+ ALL_SUPPORTED_TOKENS.map((x) => publicKey(x))
21
+ );
22
+ for (let i = 0; i < tokenAccounts.length; i++) {
23
+ if (!tokenAccounts[i].exists) {
24
+ console.log(
25
+ "Missing Solauto fees TA for ",
26
+ TOKEN_INFO[ALL_SUPPORTED_TOKENS[i].toString()].ticker
27
+ );
28
+ }
29
+ }
30
+ assert(tokenAccounts.filter((x) => !x.exists).length === 0);
31
+ });
32
+ });
@@ -1,4 +1,4 @@
1
- import { describe, it } from 'mocha';
1
+ import { describe, it } from "mocha";
2
2
  import { clusterApiUrl, Connection, PublicKey } from "@solana/web3.js";
3
3
  import {
4
4
  DEFAULT_PUBKEY,
@@ -20,22 +20,24 @@ describe("Assert lookup tables up-to-date", async () => {
20
20
  const existingAccounts =
21
21
  lookupTable.value?.state.addresses.map((x) => x.toString()) ?? [];
22
22
 
23
- for (const key in MARGINFI_ACCOUNTS) {
24
- if (key === DEFAULT_PUBKEY) {
25
- continue;
26
- }
23
+ for (const group in MARGINFI_ACCOUNTS) {
24
+ for (const key in MARGINFI_ACCOUNTS[group]) {
25
+ if (key === DEFAULT_PUBKEY) {
26
+ continue;
27
+ }
27
28
 
28
- const tokenAccounts = MARGINFI_ACCOUNTS[key];
29
- const addresses = [
30
- new PublicKey(key),
31
- tokenAccounts.bank,
32
- tokenAccounts.liquidityVault,
33
- tokenAccounts.vaultAuthority,
34
- tokenAccounts.priceOracle,
35
- ];
29
+ const tokenAccounts = MARGINFI_ACCOUNTS[key];
30
+ const addresses = [
31
+ new PublicKey(key),
32
+ tokenAccounts.bank,
33
+ tokenAccounts.liquidityVault,
34
+ tokenAccounts.vaultAuthority,
35
+ tokenAccounts.priceOracle,
36
+ ];
36
37
 
37
- if (addresses.find((x) => !existingAccounts.includes(x.toString()))) {
38
- throw new Error("Marginfi accounts lookup table missing an account");
38
+ if (addresses.find((x) => !existingAccounts.includes(x.toString()))) {
39
+ throw new Error("Marginfi accounts lookup table missing an account");
40
+ }
39
41
  }
40
42
  }
41
43
  });
@@ -10,6 +10,7 @@ import { SolautoClient } from "../../src/clients/solautoClient";
10
10
  import {
11
11
  DCASettings,
12
12
  LendingPlatform,
13
+ PositionType,
13
14
  SolautoRebalanceType,
14
15
  SolautoSettingsParameters,
15
16
  TokenType,
@@ -175,11 +176,11 @@ async function getFakePosition(
175
176
  rebalanceType: SolautoRebalanceType.Regular,
176
177
  targetLiqUtilizationRateBps: 0,
177
178
  flashLoanAmount: BigInt(0),
178
- priceSlippageBps: 0,
179
179
  padding1: [],
180
180
  padding2: [],
181
181
  padding: new Uint8Array([]),
182
182
  },
183
+ positionType: PositionType.Leverage,
183
184
  padding1: [],
184
185
  padding: [],
185
186
  publicKey: publicKey(PublicKey.default),