@haven-fi/solauto-sdk 1.0.79 → 1.0.81

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"solautoClient.d.ts","sourceRoot":"","sources":["../../src/clients/solautoClient.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAEL,UAAU,EACV,SAAS,EACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,MAAM,EACN,kBAAkB,EAClB,GAAG,EAQJ,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,aAAa,EAEd,MAAM,iDAAiD,CAAC;AACzD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,wBAAwB,EACxB,yBAAyB,EACzB,gCAAgC,EAChC,sBAAsB,EASvB,MAAM,cAAc,CAAC;AAStB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAMvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAOnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEpE,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,aAAa,CAAC;IAEvB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB,oBAAoB,CAAC,EAAE,SAAS,CAAC;IACjC,mBAAmB,CAAC,EAAE,SAAS,CAAC;CACjC;AAED,8BAAsB,aAAa;IAyCxB,SAAS,CAAC,EAAE,OAAO;IAxCrB,GAAG,EAAG,GAAG,CAAC;IACV,UAAU,EAAG,UAAU,CAAC;IACxB,eAAe,EAAG,eAAe,CAAC;IAElC,SAAS,EAAG,SAAS,CAAC;IACtB,MAAM,EAAG,MAAM,CAAC;IAE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;IA4BjC,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,WAAW,EAAE,cAAc,EAC3B,aAAa,EAAE,wBAAwB,EACvC,SAAS,CAAC,EAAE,gBAAgB,EAC5B,2BAA2B,CAAC,EAAE,MAAM,EACpC,WAAW,CAAC,EAAE,MAAM,GACnB,kBAAkB;IAEf,qBAAqB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAYlE"}
@@ -208,6 +208,8 @@ class SolautoClient {
208
208
  : undefined;
209
209
  return (0, generated_1.claimReferralFees)(this.umi, {
210
210
  signer: this.signer,
211
+ signerWsolTa: (0, umi_1.publicKey)((0, accountUtils_1.getTokenAccount)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), spl_token_1.NATIVE_MINT)),
212
+ referralAuthority: (0, umi_1.publicKey)(this.authorityReferralStateData.authority),
211
213
  referralState: (0, umi_1.publicKey)(this.authorityReferralState),
212
214
  referralFeesDestTa: (0, umi_1.publicKey)(this.authorityReferralDestTa),
213
215
  referralFeesDestMint: (0, umi_1.publicKey)(this.authorityReferralFeesDestMint),
@@ -3,6 +3,7 @@ export declare const B_SOL = "bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1";
3
3
  export declare const JUP = "JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN";
4
4
  export declare const ALL_SUPPORTED_TOKENS: string[];
5
5
  interface TokenInfo {
6
+ ticker: string;
6
7
  decimals: number;
7
8
  isStableCoin?: boolean;
8
9
  isLST?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"tokenConstants.d.ts","sourceRoot":"","sources":["../../src/constants/tokenConstants.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,SAAS,iDAAiD,CAAC;AACxE,eAAO,MAAM,KAAK,gDAAgD,CAAC;AACnE,eAAO,MAAM,GAAG,gDAAgD,CAAC;AAGjE,eAAO,MAAM,oBAAoB,UAKhC,CAAC;AAEF,UAAU,SAAS;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,UAAU,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAkBlD,CAAC"}
1
+ {"version":3,"file":"tokenConstants.d.ts","sourceRoot":"","sources":["../../src/constants/tokenConstants.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,SAAS,iDAAiD,CAAC;AACxE,eAAO,MAAM,KAAK,gDAAgD,CAAC;AACnE,eAAO,MAAM,GAAG,gDAAgD,CAAC;AAGjE,eAAO,MAAM,oBAAoB,UAKhC,CAAC;AAEF,UAAU,SAAS;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,UAAU,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAuBlD,CAAC"}
@@ -15,20 +15,25 @@ exports.ALL_SUPPORTED_TOKENS = [
15
15
  ];
16
16
  exports.TOKEN_INFO = {
17
17
  [web3_js_1.PublicKey.default.toString()]: {
18
+ ticker: "",
18
19
  decimals: 1
19
20
  },
20
21
  [spl_token_1.NATIVE_MINT.toString()]: {
22
+ ticker: "SOL",
21
23
  decimals: 9,
22
24
  },
23
25
  [exports.USDC_MINT]: {
26
+ ticker: "USDC",
24
27
  decimals: 6,
25
28
  isStableCoin: true
26
29
  },
27
30
  [exports.B_SOL]: {
31
+ ticker: "BSOL",
28
32
  decimals: 9,
29
33
  isLST: true
30
34
  },
31
35
  [exports.JUP]: {
36
+ ticker: "JUP",
32
37
  decimals: 6
33
38
  }
34
39
  };
@@ -9,12 +9,14 @@ import { Context, Pda, PublicKey, Signer, TransactionBuilder } from '@metaplex-f
9
9
  import { Serializer } from '@metaplex-foundation/umi/serializers';
10
10
  export type ClaimReferralFeesInstructionAccounts = {
11
11
  signer: Signer;
12
+ signerWsolTa?: PublicKey | Pda;
12
13
  systemProgram?: PublicKey | Pda;
13
14
  tokenProgram?: PublicKey | Pda;
14
15
  rent?: PublicKey | Pda;
15
16
  referralState: PublicKey | Pda;
16
17
  referralFeesDestTa: PublicKey | Pda;
17
18
  referralFeesDestMint: PublicKey | Pda;
19
+ referralAuthority?: PublicKey | Pda;
18
20
  feesDestinationTa?: PublicKey | Pda;
19
21
  };
20
22
  export type ClaimReferralFeesInstructionData = {
@@ -1 +1 @@
1
- {"version":3,"file":"claimReferralFees.d.ts","sourceRoot":"","sources":["../../../src/generated/instructions/claimReferralFees.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,OAAO,EACP,GAAG,EACH,SAAS,EACT,MAAM,EACN,kBAAkB,EAGnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EAIX,MAAM,sCAAsC,CAAC;AAQ9C,MAAM,MAAM,oCAAoC,GAAG;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAChC,YAAY,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,IAAI,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACvB,aAAa,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,kBAAkB,EAAE,SAAS,GAAG,GAAG,CAAC;IACpC,oBAAoB,EAAE,SAAS,GAAG,GAAG,CAAC;IACtC,iBAAiB,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;CACrC,CAAC;AAGF,MAAM,MAAM,gCAAgC,GAAG;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzE,MAAM,MAAM,oCAAoC,GAAG,EAAE,CAAC;AAEtD,wBAAgB,6CAA6C,IAAI,UAAU,CACzE,oCAAoC,EACpC,gCAAgC,CACjC,CAcA;AAGD,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,EAClC,KAAK,EAAE,oCAAoC,GAC1C,kBAAkB,CAyFpB"}
1
+ {"version":3,"file":"claimReferralFees.d.ts","sourceRoot":"","sources":["../../../src/generated/instructions/claimReferralFees.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,OAAO,EACP,GAAG,EACH,SAAS,EACT,MAAM,EACN,kBAAkB,EAGnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EAIX,MAAM,sCAAsC,CAAC;AAQ9C,MAAM,MAAM,oCAAoC,GAAG;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,aAAa,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAChC,YAAY,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,IAAI,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACvB,aAAa,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,kBAAkB,EAAE,SAAS,GAAG,GAAG,CAAC;IACpC,oBAAoB,EAAE,SAAS,GAAG,GAAG,CAAC;IACtC,iBAAiB,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACpC,iBAAiB,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;CACrC,CAAC;AAGF,MAAM,MAAM,gCAAgC,GAAG;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzE,MAAM,MAAM,oCAAoC,GAAG,EAAE,CAAC;AAEtD,wBAAgB,6CAA6C,IAAI,UAAU,CACzE,oCAAoC,EACpC,gCAAgC,CACjC,CAcA;AAGD,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,EAClC,KAAK,EAAE,oCAAoC,GAC1C,kBAAkB,CAmGpB"}
@@ -28,34 +28,44 @@ function claimReferralFees(context, input) {
28
28
  isWritable: false,
29
29
  value: input.signer ?? null,
30
30
  },
31
- systemProgram: {
31
+ signerWsolTa: {
32
32
  index: 1,
33
+ isWritable: true,
34
+ value: input.signerWsolTa ?? null,
35
+ },
36
+ systemProgram: {
37
+ index: 2,
33
38
  isWritable: false,
34
39
  value: input.systemProgram ?? null,
35
40
  },
36
41
  tokenProgram: {
37
- index: 2,
42
+ index: 3,
38
43
  isWritable: false,
39
44
  value: input.tokenProgram ?? null,
40
45
  },
41
- rent: { index: 3, isWritable: false, value: input.rent ?? null },
46
+ rent: { index: 4, isWritable: false, value: input.rent ?? null },
42
47
  referralState: {
43
- index: 4,
48
+ index: 5,
44
49
  isWritable: false,
45
50
  value: input.referralState ?? null,
46
51
  },
47
52
  referralFeesDestTa: {
48
- index: 5,
53
+ index: 6,
49
54
  isWritable: true,
50
55
  value: input.referralFeesDestTa ?? null,
51
56
  },
52
57
  referralFeesDestMint: {
53
- index: 6,
58
+ index: 7,
54
59
  isWritable: false,
55
60
  value: input.referralFeesDestMint ?? null,
56
61
  },
62
+ referralAuthority: {
63
+ index: 8,
64
+ isWritable: true,
65
+ value: input.referralAuthority ?? null,
66
+ },
57
67
  feesDestinationTa: {
58
- index: 7,
68
+ index: 9,
59
69
  isWritable: true,
60
70
  value: input.feesDestinationTa ?? null,
61
71
  },
@@ -13,7 +13,7 @@ export declare function getSolautoFeesBps(isReferred: boolean, feeType: FeeType,
13
13
  total: number;
14
14
  };
15
15
  export declare function getMaxLiqUtilizationRateBps(maxLtvBps: number, liqThresholdBps: number, offsetFromMaxLtv: number): number;
16
- export declare function maxBoostToBps(maxLtvBps: number, liqThresholdBps: number): number;
17
16
  export declare function maxRepayFromBps(maxLtvBps: number, liqThresholdBps: number): number;
18
17
  export declare function maxRepayToBps(maxLtvBps: number, liqThresholdBps: number): number;
18
+ export declare function maxBoostToBps(maxLtvBps: number, liqThresholdBps: number): number;
19
19
  //# sourceMappingURL=numberUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"numberUtils.d.ts","sourceRoot":"","sources":["../../src/utils/numberUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,eAAe,EAAE,MAAM,GACtB,MAAM,CAMR;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAElE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAqBrD;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAejE;AAED,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,MAAM,EACvB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,2BAA2B,EAAE,MAAM,EACnC,gBAAgB,CAAC,EAAE,MAAM,UAW1B;AAED,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,OAAO,EACnB,OAAO,EAAE,OAAO,EAChB,mBAAmB,EAAE,MAAM,GAC1B;IACD,O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,gBAAgB,CAAC,EAAE,MAAM,UAW1B;AAED,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,OAAO,EACnB,OAAO,EAAE,OAAO,EAChB,mBAAmB,EAAE,MAAM,GAC1B;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf,CA8BA;AAED,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,gBAAgB,EAAE,MAAM,GACvB,MAAM,CAER;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,UAKzE;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,UAKvE;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,UAKvE"}
@@ -10,9 +10,9 @@ exports.uint8ArrayToBigInt = uint8ArrayToBigInt;
10
10
  exports.getDebtAdjustmentUsd = getDebtAdjustmentUsd;
11
11
  exports.getSolautoFeesBps = getSolautoFeesBps;
12
12
  exports.getMaxLiqUtilizationRateBps = getMaxLiqUtilizationRateBps;
13
- exports.maxBoostToBps = maxBoostToBps;
14
13
  exports.maxRepayFromBps = maxRepayFromBps;
15
14
  exports.maxRepayToBps = maxRepayToBps;
15
+ exports.maxBoostToBps = maxBoostToBps;
16
16
  const constants_1 = require("../constants");
17
17
  const generated_1 = require("../generated");
18
18
  function getLiqUtilzationRateBps(supplyUsd, debtUsd, liqThresholdBps) {
@@ -100,12 +100,12 @@ function getSolautoFeesBps(isReferred, feeType, positionNetWorthUsd) {
100
100
  function getMaxLiqUtilizationRateBps(maxLtvBps, liqThresholdBps, offsetFromMaxLtv) {
101
101
  return toBps((fromBps(maxLtvBps) - offsetFromMaxLtv) / fromBps(liqThresholdBps)) - 1; // -1 to account for any rounding issues
102
102
  }
103
- function maxBoostToBps(maxLtvBps, liqThresholdBps) {
104
- return getMaxLiqUtilizationRateBps(maxLtvBps, liqThresholdBps, 0.015);
105
- }
106
103
  function maxRepayFromBps(maxLtvBps, liqThresholdBps) {
107
104
  return Math.min(9000, getMaxLiqUtilizationRateBps(maxLtvBps, liqThresholdBps - 1000, 0.005));
108
105
  }
109
106
  function maxRepayToBps(maxLtvBps, liqThresholdBps) {
110
107
  return Math.min(maxRepayFromBps(maxLtvBps, liqThresholdBps) - constants_1.MIN_REPAY_GAP_BPS, getMaxLiqUtilizationRateBps(maxLtvBps, liqThresholdBps, 0.005));
111
108
  }
109
+ function maxBoostToBps(maxLtvBps, liqThresholdBps) {
110
+ return Math.min(maxRepayToBps(maxLtvBps, liqThresholdBps), getMaxLiqUtilizationRateBps(maxLtvBps, liqThresholdBps, 0.015));
111
+ }
@@ -2,6 +2,7 @@ import { PublicKey } from "@solana/web3.js";
2
2
  import { Umi } from "@metaplex-foundation/umi";
3
3
  import { AutomationSettings, DCASettings, DCASettingsInpArgs, PositionState, SolautoSettingsParameters, SolautoSettingsParametersInpArgs } from "../../generated";
4
4
  import { RebalanceAction, SolautoPositionDetails } from "../../types/solauto";
5
+ export declare function findMintByTicker(ticker: string): PublicKey;
5
6
  export declare function nextAutomationPeriodTimestamp(automation: AutomationSettings): number;
6
7
  export declare function eligibleForNextAutomationPeriod(automation: AutomationSettings, currentUnixTime: number): boolean;
7
8
  export declare function getUpdatedValueFromAutomation(currValue: number, targetValue: number, automation: AutomationSettings, currentUnixTimestamp: number): number;
@@ -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,EAA+B,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAElB,aAAa,EAEb,yBAAyB,EACzB,gCAA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,CAAa;IAC5C,QAAQ,EAAE,yBAAyB,GAAG,SAAS,CAAa;IAC5D,SAAS,EAAE,WAAW,GAAG,SAAS,CAAa;IAEtD,GAAG,CAAC,MAAM,EAAE,kBAAkB;IA0B9B,KAAK;IAQL,UAAU,IAAI,OAAO;CAQtB"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LivePositionUpdates = void 0;
4
+ exports.findMintByTicker = findMintByTicker;
4
5
  exports.nextAutomationPeriodTimestamp = nextAutomationPeriodTimestamp;
5
6
  exports.eligibleForNextAutomationPeriod = eligibleForNextAutomationPeriod;
6
7
  exports.getUpdatedValueFromAutomation = getUpdatedValueFromAutomation;
@@ -23,6 +24,15 @@ const accountUtils_1 = require("../accountUtils");
23
24
  const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
24
25
  const constants_1 = require("../../constants");
25
26
  const marginfiUtils_1 = require("../marginfiUtils");
27
+ function findMintByTicker(ticker) {
28
+ for (const key in constants_1.TOKEN_INFO) {
29
+ const account = constants_1.TOKEN_INFO[key];
30
+ if (account.ticker.toString().toLowerCase() === ticker.toString().toLowerCase()) {
31
+ return new web3_js_1.PublicKey(key);
32
+ }
33
+ }
34
+ throw new Error(`Token mint not found by the ticker: ${ticker}`);
35
+ }
26
36
  function newPeriodsPassed(automation, currentUnixTimestamp) {
27
37
  return Math.min(automation.targetPeriods, automation.periodsPassed +
28
38
  Math.floor((currentUnixTimestamp - Number(automation.unixStartDate)) /
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.79",
3
+ "version": "1.0.81",
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",
@@ -405,6 +405,8 @@ export abstract class SolautoClient {
405
405
  : undefined;
406
406
  return claimReferralFees(this.umi, {
407
407
  signer: this.signer,
408
+ signerWsolTa: publicKey(getTokenAccount(toWeb3JsPublicKey(this.signer.publicKey), NATIVE_MINT)),
409
+ referralAuthority: publicKey(this.authorityReferralStateData!.authority),
408
410
  referralState: publicKey(this.authorityReferralState),
409
411
  referralFeesDestTa: publicKey(this.authorityReferralDestTa),
410
412
  referralFeesDestMint: publicKey(this.authorityReferralFeesDestMint),
@@ -15,6 +15,7 @@ export const ALL_SUPPORTED_TOKENS = [
15
15
  ];
16
16
 
17
17
  interface TokenInfo {
18
+ ticker: string;
18
19
  decimals: number;
19
20
  isStableCoin?: boolean;
20
21
  isLST?: boolean;
@@ -22,20 +23,25 @@ interface TokenInfo {
22
23
 
23
24
  export const TOKEN_INFO: { [key: string]: TokenInfo } = {
24
25
  [PublicKey.default.toString()]: {
26
+ ticker: "",
25
27
  decimals: 1
26
28
  },
27
29
  [NATIVE_MINT.toString()]: {
30
+ ticker: "SOL",
28
31
  decimals: 9,
29
32
  },
30
33
  [USDC_MINT]: {
34
+ ticker: "USDC",
31
35
  decimals: 6,
32
36
  isStableCoin: true
33
37
  },
34
38
  [B_SOL]: {
39
+ ticker: "BSOL",
35
40
  decimals: 9,
36
41
  isLST: true
37
42
  },
38
43
  [JUP]: {
44
+ ticker: "JUP",
39
45
  decimals: 6
40
46
  }
41
47
  };
@@ -30,12 +30,14 @@ import {
30
30
  // Accounts.
31
31
  export type ClaimReferralFeesInstructionAccounts = {
32
32
  signer: Signer;
33
+ signerWsolTa?: PublicKey | Pda;
33
34
  systemProgram?: PublicKey | Pda;
34
35
  tokenProgram?: PublicKey | Pda;
35
36
  rent?: PublicKey | Pda;
36
37
  referralState: PublicKey | Pda;
37
38
  referralFeesDestTa: PublicKey | Pda;
38
39
  referralFeesDestMint: PublicKey | Pda;
40
+ referralAuthority?: PublicKey | Pda;
39
41
  feesDestinationTa?: PublicKey | Pda;
40
42
  };
41
43
 
@@ -81,34 +83,44 @@ export function claimReferralFees(
81
83
  isWritable: false as boolean,
82
84
  value: input.signer ?? null,
83
85
  },
84
- systemProgram: {
86
+ signerWsolTa: {
85
87
  index: 1,
88
+ isWritable: true as boolean,
89
+ value: input.signerWsolTa ?? null,
90
+ },
91
+ systemProgram: {
92
+ index: 2,
86
93
  isWritable: false as boolean,
87
94
  value: input.systemProgram ?? null,
88
95
  },
89
96
  tokenProgram: {
90
- index: 2,
97
+ index: 3,
91
98
  isWritable: false as boolean,
92
99
  value: input.tokenProgram ?? null,
93
100
  },
94
- rent: { index: 3, isWritable: false as boolean, value: input.rent ?? null },
101
+ rent: { index: 4, isWritable: false as boolean, value: input.rent ?? null },
95
102
  referralState: {
96
- index: 4,
103
+ index: 5,
97
104
  isWritable: false as boolean,
98
105
  value: input.referralState ?? null,
99
106
  },
100
107
  referralFeesDestTa: {
101
- index: 5,
108
+ index: 6,
102
109
  isWritable: true as boolean,
103
110
  value: input.referralFeesDestTa ?? null,
104
111
  },
105
112
  referralFeesDestMint: {
106
- index: 6,
113
+ index: 7,
107
114
  isWritable: false as boolean,
108
115
  value: input.referralFeesDestMint ?? null,
109
116
  },
117
+ referralAuthority: {
118
+ index: 8,
119
+ isWritable: true as boolean,
120
+ value: input.referralAuthority ?? null,
121
+ },
110
122
  feesDestinationTa: {
111
- index: 7,
123
+ index: 9,
112
124
  isWritable: true as boolean,
113
125
  value: input.feesDestinationTa ?? null,
114
126
  },
@@ -135,10 +135,6 @@ export function getMaxLiqUtilizationRateBps(
135
135
  return toBps((fromBps(maxLtvBps) - offsetFromMaxLtv) / fromBps(liqThresholdBps)) - 1; // -1 to account for any rounding issues
136
136
  }
137
137
 
138
- export function maxBoostToBps(maxLtvBps: number, liqThresholdBps: number) {
139
- return getMaxLiqUtilizationRateBps(maxLtvBps, liqThresholdBps, 0.015);
140
- }
141
-
142
138
  export function maxRepayFromBps(maxLtvBps: number, liqThresholdBps: number) {
143
139
  return Math.min(
144
140
  9000,
@@ -152,3 +148,10 @@ export function maxRepayToBps(maxLtvBps: number, liqThresholdBps: number) {
152
148
  getMaxLiqUtilizationRateBps(maxLtvBps, liqThresholdBps, 0.005)
153
149
  );
154
150
  }
151
+
152
+ export function maxBoostToBps(maxLtvBps: number, liqThresholdBps: number) {
153
+ return Math.min(
154
+ maxRepayToBps(maxLtvBps, liqThresholdBps),
155
+ getMaxLiqUtilizationRateBps(maxLtvBps, liqThresholdBps, 0.015)
156
+ );
157
+ }
@@ -29,6 +29,18 @@ import {
29
29
  import { getAllMarginfiAccountsByAuthority } from "../marginfiUtils";
30
30
  import { RebalanceAction, SolautoPositionDetails } from "../../types/solauto";
31
31
 
32
+ export function findMintByTicker(ticker: string): PublicKey {
33
+ for (const key in TOKEN_INFO) {
34
+ const account = TOKEN_INFO[key];
35
+ if (
36
+ account.ticker.toString().toLowerCase() === ticker.toString().toLowerCase()
37
+ ) {
38
+ return new PublicKey(key);
39
+ }
40
+ }
41
+ throw new Error(`Token mint not found by the ticker: ${ticker}`);
42
+ }
43
+
32
44
  function newPeriodsPassed(
33
45
  automation: AutomationSettings,
34
46
  currentUnixTimestamp: number