@haven-fi/solauto-sdk 1.0.604 → 1.0.606

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.
@@ -18,8 +18,32 @@ export declare class FailedAccountDeserializationError extends ProgramError {
18
18
  readonly code: number;
19
19
  constructor(program: Program, cause?: Error);
20
20
  }
21
- /** InvalidPositionSettings: Invalid position settings provided */
22
- export declare class InvalidPositionSettingsError extends ProgramError {
21
+ /** InvalidBoostToSetting: Invalid Boost-to param */
22
+ export declare class InvalidBoostToSettingError extends ProgramError {
23
+ readonly name: string;
24
+ readonly code: number;
25
+ constructor(program: Program, cause?: Error);
26
+ }
27
+ /** InvalidBoostGapSetting: Invalid Boost gap param */
28
+ export declare class InvalidBoostGapSettingError extends ProgramError {
29
+ readonly name: string;
30
+ readonly code: number;
31
+ constructor(program: Program, cause?: Error);
32
+ }
33
+ /** InvalidRepayToSetting: Invalid repay-to param */
34
+ export declare class InvalidRepayToSettingError extends ProgramError {
35
+ readonly name: string;
36
+ readonly code: number;
37
+ constructor(program: Program, cause?: Error);
38
+ }
39
+ /** InvalidRepayGapSetting: Invalid repay gap param */
40
+ export declare class InvalidRepayGapSettingError extends ProgramError {
41
+ readonly name: string;
42
+ readonly code: number;
43
+ constructor(program: Program, cause?: Error);
44
+ }
45
+ /** InvalidRepayFromSetting: Invalid repay-from (repay-to + repay gap) */
46
+ export declare class InvalidRepayFromSettingError extends ProgramError {
23
47
  readonly name: string;
24
48
  readonly code: number;
25
49
  constructor(program: Program, cause?: Error);
@@ -1 +1 @@
1
- {"version":3,"file":"solauto.d.ts","sourceRoot":"","sources":["../../../src/generated/errors/solauto.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AASjE,2FAA2F;AAC3F,qBAAa,sBAAuB,SAAQ,YAAY;IACtD,SAAkB,IAAI,EAAE,MAAM,CAAuB;IAErD,QAAQ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EAAE,MAAM,CAA6B;IAE3D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAO;gBAEhB,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,KAAK;CAO5C;AAID,0GAA0G;AAC1G,qBAAa,yBAA0B,SAAQ,YAAY;IACzD,SAAkB,IAAI,EAAE,MAAM,CAA0B;IAExD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAO;gBAEhB,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,KAAK;CAO5C;AAID,qJAAqJ;AACrJ,qBAAa,kCAAmC,SAAQ,YAAY;IAClE,SAAkB,IAAI,EAAE,MAAM,CAAmC;IAEjE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAO;gBAEhB,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,KAAK;CAO5C;AAOD;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,EAChB,KAAK,CAAC,EAAE,KAAK,GACZ,YAAY,GAAG,IAAI,CAGrB;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,EAChB,KAAK,CAAC,EAAE,KAAK,GACZ,YAAY,GAAG,IAAI,CAGrB"}
@@ -7,7 +7,7 @@
7
7
  * @see https://github.com/metaplex-foundation/kinobi
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.NonAuthorityProvidedTargetLTVError = exports.InvalidRebalanceMadeError = exports.IncorrectDebtAdjustmentError = exports.IncorrectInstructionsError = exports.InstructionIsCPIError = exports.InvalidRebalanceConditionError = exports.InvalidAutomationDataError = exports.InvalidDCASettingsError = exports.InvalidPositionSettingsError = exports.FailedAccountDeserializationError = exports.IncorrectAccountsError = void 0;
10
+ exports.NonAuthorityProvidedTargetLTVError = exports.InvalidRebalanceMadeError = exports.IncorrectDebtAdjustmentError = exports.IncorrectInstructionsError = exports.InstructionIsCPIError = exports.InvalidRebalanceConditionError = exports.InvalidAutomationDataError = exports.InvalidDCASettingsError = exports.InvalidRepayFromSettingError = exports.InvalidRepayGapSettingError = exports.InvalidRepayToSettingError = exports.InvalidBoostGapSettingError = exports.InvalidBoostToSettingError = exports.FailedAccountDeserializationError = exports.IncorrectAccountsError = void 0;
11
11
  exports.getSolautoErrorFromCode = getSolautoErrorFromCode;
12
12
  exports.getSolautoErrorFromName = getSolautoErrorFromName;
13
13
  const umi_1 = require("@metaplex-foundation/umi");
@@ -35,104 +35,148 @@ class FailedAccountDeserializationError extends umi_1.ProgramError {
35
35
  exports.FailedAccountDeserializationError = FailedAccountDeserializationError;
36
36
  codeToErrorMap.set(0x1, FailedAccountDeserializationError);
37
37
  nameToErrorMap.set('FailedAccountDeserialization', FailedAccountDeserializationError);
38
- /** InvalidPositionSettings: Invalid position settings provided */
39
- class InvalidPositionSettingsError extends umi_1.ProgramError {
38
+ /** InvalidBoostToSetting: Invalid Boost-to param */
39
+ class InvalidBoostToSettingError extends umi_1.ProgramError {
40
40
  constructor(program, cause) {
41
- super('Invalid position settings provided', program, cause);
42
- this.name = 'InvalidPositionSettings';
41
+ super('Invalid Boost-to param', program, cause);
42
+ this.name = 'InvalidBoostToSetting';
43
43
  this.code = 0x2; // 2
44
44
  }
45
45
  }
46
- exports.InvalidPositionSettingsError = InvalidPositionSettingsError;
47
- codeToErrorMap.set(0x2, InvalidPositionSettingsError);
48
- nameToErrorMap.set('InvalidPositionSettings', InvalidPositionSettingsError);
46
+ exports.InvalidBoostToSettingError = InvalidBoostToSettingError;
47
+ codeToErrorMap.set(0x2, InvalidBoostToSettingError);
48
+ nameToErrorMap.set('InvalidBoostToSetting', InvalidBoostToSettingError);
49
+ /** InvalidBoostGapSetting: Invalid Boost gap param */
50
+ class InvalidBoostGapSettingError extends umi_1.ProgramError {
51
+ constructor(program, cause) {
52
+ super('Invalid Boost gap param', program, cause);
53
+ this.name = 'InvalidBoostGapSetting';
54
+ this.code = 0x3; // 3
55
+ }
56
+ }
57
+ exports.InvalidBoostGapSettingError = InvalidBoostGapSettingError;
58
+ codeToErrorMap.set(0x3, InvalidBoostGapSettingError);
59
+ nameToErrorMap.set('InvalidBoostGapSetting', InvalidBoostGapSettingError);
60
+ /** InvalidRepayToSetting: Invalid repay-to param */
61
+ class InvalidRepayToSettingError extends umi_1.ProgramError {
62
+ constructor(program, cause) {
63
+ super('Invalid repay-to param', program, cause);
64
+ this.name = 'InvalidRepayToSetting';
65
+ this.code = 0x4; // 4
66
+ }
67
+ }
68
+ exports.InvalidRepayToSettingError = InvalidRepayToSettingError;
69
+ codeToErrorMap.set(0x4, InvalidRepayToSettingError);
70
+ nameToErrorMap.set('InvalidRepayToSetting', InvalidRepayToSettingError);
71
+ /** InvalidRepayGapSetting: Invalid repay gap param */
72
+ class InvalidRepayGapSettingError extends umi_1.ProgramError {
73
+ constructor(program, cause) {
74
+ super('Invalid repay gap param', program, cause);
75
+ this.name = 'InvalidRepayGapSetting';
76
+ this.code = 0x5; // 5
77
+ }
78
+ }
79
+ exports.InvalidRepayGapSettingError = InvalidRepayGapSettingError;
80
+ codeToErrorMap.set(0x5, InvalidRepayGapSettingError);
81
+ nameToErrorMap.set('InvalidRepayGapSetting', InvalidRepayGapSettingError);
82
+ /** InvalidRepayFromSetting: Invalid repay-from (repay-to + repay gap) */
83
+ class InvalidRepayFromSettingError extends umi_1.ProgramError {
84
+ constructor(program, cause) {
85
+ super('Invalid repay-from (repay-to + repay gap)', program, cause);
86
+ this.name = 'InvalidRepayFromSetting';
87
+ this.code = 0x6; // 6
88
+ }
89
+ }
90
+ exports.InvalidRepayFromSettingError = InvalidRepayFromSettingError;
91
+ codeToErrorMap.set(0x6, InvalidRepayFromSettingError);
92
+ nameToErrorMap.set('InvalidRepayFromSetting', InvalidRepayFromSettingError);
49
93
  /** InvalidDCASettings: Invalid DCA configuration provided */
50
94
  class InvalidDCASettingsError extends umi_1.ProgramError {
51
95
  constructor(program, cause) {
52
96
  super('Invalid DCA configuration provided', program, cause);
53
97
  this.name = 'InvalidDCASettings';
54
- this.code = 0x3; // 3
98
+ this.code = 0x7; // 7
55
99
  }
56
100
  }
57
101
  exports.InvalidDCASettingsError = InvalidDCASettingsError;
58
- codeToErrorMap.set(0x3, InvalidDCASettingsError);
102
+ codeToErrorMap.set(0x7, InvalidDCASettingsError);
59
103
  nameToErrorMap.set('InvalidDCASettings', InvalidDCASettingsError);
60
104
  /** InvalidAutomationData: Invalid automation settings provided */
61
105
  class InvalidAutomationDataError extends umi_1.ProgramError {
62
106
  constructor(program, cause) {
63
107
  super('Invalid automation settings provided', program, cause);
64
108
  this.name = 'InvalidAutomationData';
65
- this.code = 0x4; // 4
109
+ this.code = 0x8; // 8
66
110
  }
67
111
  }
68
112
  exports.InvalidAutomationDataError = InvalidAutomationDataError;
69
- codeToErrorMap.set(0x4, InvalidAutomationDataError);
113
+ codeToErrorMap.set(0x8, InvalidAutomationDataError);
70
114
  nameToErrorMap.set('InvalidAutomationData', InvalidAutomationDataError);
71
115
  /** InvalidRebalanceCondition: Invalid position condition to rebalance */
72
116
  class InvalidRebalanceConditionError extends umi_1.ProgramError {
73
117
  constructor(program, cause) {
74
118
  super('Invalid position condition to rebalance', program, cause);
75
119
  this.name = 'InvalidRebalanceCondition';
76
- this.code = 0x5; // 5
120
+ this.code = 0x9; // 9
77
121
  }
78
122
  }
79
123
  exports.InvalidRebalanceConditionError = InvalidRebalanceConditionError;
80
- codeToErrorMap.set(0x5, InvalidRebalanceConditionError);
124
+ codeToErrorMap.set(0x9, InvalidRebalanceConditionError);
81
125
  nameToErrorMap.set('InvalidRebalanceCondition', InvalidRebalanceConditionError);
82
126
  /** InstructionIsCPI: Unable to invoke instruction through a CPI */
83
127
  class InstructionIsCPIError extends umi_1.ProgramError {
84
128
  constructor(program, cause) {
85
129
  super('Unable to invoke instruction through a CPI', program, cause);
86
130
  this.name = 'InstructionIsCPI';
87
- this.code = 0x6; // 6
131
+ this.code = 0xa; // 10
88
132
  }
89
133
  }
90
134
  exports.InstructionIsCPIError = InstructionIsCPIError;
91
- codeToErrorMap.set(0x6, InstructionIsCPIError);
135
+ codeToErrorMap.set(0xa, InstructionIsCPIError);
92
136
  nameToErrorMap.set('InstructionIsCPI', InstructionIsCPIError);
93
137
  /** IncorrectInstructions: Incorrect set of instructions or instruction data in the transaction */
94
138
  class IncorrectInstructionsError extends umi_1.ProgramError {
95
139
  constructor(program, cause) {
96
140
  super('Incorrect set of instructions or instruction data in the transaction', program, cause);
97
141
  this.name = 'IncorrectInstructions';
98
- this.code = 0x7; // 7
142
+ this.code = 0xb; // 11
99
143
  }
100
144
  }
101
145
  exports.IncorrectInstructionsError = IncorrectInstructionsError;
102
- codeToErrorMap.set(0x7, IncorrectInstructionsError);
146
+ codeToErrorMap.set(0xb, IncorrectInstructionsError);
103
147
  nameToErrorMap.set('IncorrectInstructions', IncorrectInstructionsError);
104
148
  /** IncorrectDebtAdjustment: Incorrect swap amount provided. Likely due to high price volatility */
105
149
  class IncorrectDebtAdjustmentError extends umi_1.ProgramError {
106
150
  constructor(program, cause) {
107
151
  super('Incorrect swap amount provided. Likely due to high price volatility', program, cause);
108
152
  this.name = 'IncorrectDebtAdjustment';
109
- this.code = 0x8; // 8
153
+ this.code = 0xc; // 12
110
154
  }
111
155
  }
112
156
  exports.IncorrectDebtAdjustmentError = IncorrectDebtAdjustmentError;
113
- codeToErrorMap.set(0x8, IncorrectDebtAdjustmentError);
157
+ codeToErrorMap.set(0xc, IncorrectDebtAdjustmentError);
114
158
  nameToErrorMap.set('IncorrectDebtAdjustment', IncorrectDebtAdjustmentError);
115
159
  /** InvalidRebalanceMade: Invalid rebalance was made. Target supply USD and target debt USD was not met */
116
160
  class InvalidRebalanceMadeError extends umi_1.ProgramError {
117
161
  constructor(program, cause) {
118
162
  super('Invalid rebalance was made. Target supply USD and target debt USD was not met', program, cause);
119
163
  this.name = 'InvalidRebalanceMade';
120
- this.code = 0x9; // 9
164
+ this.code = 0xd; // 13
121
165
  }
122
166
  }
123
167
  exports.InvalidRebalanceMadeError = InvalidRebalanceMadeError;
124
- codeToErrorMap.set(0x9, InvalidRebalanceMadeError);
168
+ codeToErrorMap.set(0xd, InvalidRebalanceMadeError);
125
169
  nameToErrorMap.set('InvalidRebalanceMade', InvalidRebalanceMadeError);
126
170
  /** NonAuthorityProvidedTargetLTV: Cannot provide a target liquidation utilization rate if the instruction is not signed by the position authority */
127
171
  class NonAuthorityProvidedTargetLTVError extends umi_1.ProgramError {
128
172
  constructor(program, cause) {
129
173
  super('Cannot provide a target liquidation utilization rate if the instruction is not signed by the position authority', program, cause);
130
174
  this.name = 'NonAuthorityProvidedTargetLTV';
131
- this.code = 0xa; // 10
175
+ this.code = 0xe; // 14
132
176
  }
133
177
  }
134
178
  exports.NonAuthorityProvidedTargetLTVError = NonAuthorityProvidedTargetLTVError;
135
- codeToErrorMap.set(0xa, NonAuthorityProvidedTargetLTVError);
179
+ codeToErrorMap.set(0xe, NonAuthorityProvidedTargetLTVError);
136
180
  nameToErrorMap.set('NonAuthorityProvidedTargetLTV', NonAuthorityProvidedTargetLTVError);
137
181
  /**
138
182
  * Attempts to resolve a custom program error from the provided error code.
@@ -5,7 +5,7 @@ import { Signer, TransactionBuilder, Umi } from "@metaplex-foundation/umi";
5
5
  import { TokenType } from "../../generated";
6
6
  export declare class FlProviderAggregator extends FlProviderBase {
7
7
  private marginfiFlProvider;
8
- constructor(umi: Umi, signer: Signer, supplyMint: PublicKey, debtMint: PublicKey);
8
+ constructor(umi: Umi, signer: Signer, authority: PublicKey, supplyMint: PublicKey, debtMint: PublicKey);
9
9
  initialize(): Promise<void>;
10
10
  flAccountPrereqIxs(): Promise<TransactionBuilder>;
11
11
  otherSigners(): Signer[];
@@ -1 +1 @@
1
- {"version":3,"file":"flProviderAggregator.d.ts","sourceRoot":"","sources":["../../../src/services/flashLoans/flProviderAggregator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;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,cAAc;IACtD,OAAO,CAAC,kBAAkB,CAAsB;gBAG9C,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,SAAS,EACrB,QAAQ,EAAE,SAAS;IAYf,UAAU;IAMV,kBAAkB,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAIvD,YAAY,IAAI,MAAM,EAAE;IAKxB,gBAAgB,IAAI,SAAS,EAAE;IAS/B,OAAO,CAAC,UAAU;IAKlB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM;IAI7C,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,eAAe,CAAC,EAAE,OAAO,GAAG,MAAM;IAI9D,WAAW,CACT,SAAS,EAAE,gBAAgB,EAC3B,gBAAgB,EAAE,SAAS,GAC1B,kBAAkB;IAOrB,UAAU,CAAC,SAAS,EAAE,gBAAgB,GAAG,kBAAkB;CAG5D"}
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FlProviderAggregator = void 0;
4
4
  const flProviderBase_1 = require("./flProviderBase");
5
5
  const marginfiFlProvider_1 = require("./marginfiFlProvider");
6
+ const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
6
7
  class FlProviderAggregator extends flProviderBase_1.FlProviderBase {
7
- constructor(umi, signer, supplyMint, debtMint) {
8
- super(umi, signer, supplyMint, debtMint);
9
- this.marginfiFlProvider = new marginfiFlProvider_1.MarginfiFlProvider(umi, signer, supplyMint, debtMint);
8
+ constructor(umi, signer, authority, supplyMint, debtMint) {
9
+ super(umi, signer, authority, supplyMint, debtMint);
10
+ this.marginfiFlProvider = new marginfiFlProvider_1.MarginfiFlProvider(umi, signer, authority, supplyMint, debtMint);
10
11
  }
11
12
  async initialize() {
12
13
  // TODO: PF
@@ -21,10 +22,12 @@ class FlProviderAggregator extends flProviderBase_1.FlProviderBase {
21
22
  return [...this.flSigners, ...this.marginfiFlProvider.otherSigners()];
22
23
  }
23
24
  lutAccountsToAdd() {
24
- return [
25
- ...super.lutAccountsToAdd(),
26
- ...this.marginfiFlProvider.lutAccountsToAdd(),
27
- ];
25
+ return (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey).equals(this.authority)
26
+ ? [
27
+ ...super.lutAccountsToAdd(),
28
+ ...this.marginfiFlProvider.lutAccountsToAdd(),
29
+ ]
30
+ : [];
28
31
  }
29
32
  flProvider(source) {
30
33
  // TODO: PF
@@ -5,10 +5,11 @@ import { FlashLoanDetails } from "../../types";
5
5
  export declare abstract class FlProviderBase {
6
6
  protected umi: Umi;
7
7
  protected signer: Signer;
8
+ protected authority: PublicKey;
8
9
  protected supplyMint: PublicKey;
9
10
  protected debtMint: PublicKey;
10
11
  protected flSigners: Signer[];
11
- constructor(umi: Umi, signer: Signer, supplyMint: PublicKey, debtMint: PublicKey);
12
+ constructor(umi: Umi, signer: Signer, authority: PublicKey, supplyMint: PublicKey, debtMint: PublicKey);
12
13
  abstract initialize(): Promise<void>;
13
14
  lutAccountsToAdd(): PublicKey[];
14
15
  otherSigners(): Signer[];
@@ -1 +1 @@
1
- {"version":3,"file":"flProviderBase.d.ts","sourceRoot":"","sources":["../../../src/services/flashLoans/flProviderBase.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EAEN,kBAAkB,EAClB,GAAG,EACJ,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAQ5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,8BAAsB,cAAc;IAIhC,SAAS,CAAC,GAAG,EAAE,GAAG;IAClB,SAAS,CAAC,MAAM,EAAE,MAAM;IACxB,SAAS,CAAC,UAAU,EAAE,SAAS;IAC/B,SAAS,CAAC,QAAQ,EAAE,SAAS;IAN/B,SAAS,CAAC,SAAS,EAAE,M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SAAS;IAC/B,SAAS,CAAC,QAAQ,EAAE,SAAS;IAP/B,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,CAAM;gBAGvB,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,SAAS,EACrB,QAAQ,EAAE,SAAS;IAG/B,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAEpC,gBAAgB,IAAI,SAAS,EAAE;IAI/B,YAAY,IAAI,MAAM,EAAE;IAIxB,IAAI,CAAC,MAAM,EAAE,SAAS;IAItB,QAAQ,CAAC,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM;IACtD,qBAAqB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM;IAShD,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,eAAe,CAAC,EAAE,OAAO,GAAG,MAAM;IACvE,QAAQ,CAAC,WAAW,CAClB,SAAS,EAAE,gBAAgB,EAC3B,gBAAgB,EAAE,SAAS,GAC1B,kBAAkB;IACrB,QAAQ,CAAC,UAAU,CAAC,SAAS,EAAE,gBAAgB,GAAG,kBAAkB;IAEpE,SAAS,CAAC,iBAAiB,CACzB,SAAS,EAAE,gBAAgB,EAC3B,gBAAgB,EAAE,SAAS,GAC1B,kBAAkB;CAyBtB"}
@@ -6,9 +6,10 @@ const utils_1 = require("../../utils");
6
6
  const generated_1 = require("../../generated");
7
7
  const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
8
8
  class FlProviderBase {
9
- constructor(umi, signer, supplyMint, debtMint) {
9
+ constructor(umi, signer, authority, supplyMint, debtMint) {
10
10
  this.umi = umi;
11
11
  this.signer = signer;
12
+ this.authority = authority;
12
13
  this.supplyMint = supplyMint;
13
14
  this.debtMint = debtMint;
14
15
  this.flSigners = [];
@@ -1 +1 @@
1
- {"version":3,"file":"rebalanceTxBuilder.d.ts","sourceRoot":"","sources":["../../../src/services/rebalance/rebalanceTxBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAGL,qBAAqB,EACtB,MAAM,aAAa,CAAC;AA2BrB,qBAAa,kBAAkB;IAO3B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,2BAA2B,CAAC;IAPtC,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,aAAa,CAAwB;IAC7C,OAAO,CAAC,WAAW,CAAwB;IAC3C,OAAO,CAAC,cAAc,CAAC,CAAwB;gBAGrC,MAAM,EAAE,aAAa,EACrB,2BAA2B,CAAC,EAAE,MAAM,YAAA;YAGhC,0BAA0B;IAQxC,OAAO,CAAC,kBAAkB;IAa1B,OAAO,CAAC,oBAAoB;YAyCd,qBAAqB;IAyCnC,OAAO,CAAC,mBAAmB;IAwB3B,OAAO,CAAC,gBAAgB;YAgCV,mBAAmB;YAoBnB,sBAAsB;YAyBtB,mBAAmB;IAkEpB,gBAAgB,CAC3B,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC;CAW9C"}
1
+ {"version":3,"file":"rebalanceTxBuilder.d.ts","sourceRoot":"","sources":["../../../src/services/rebalance/rebalanceTxBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAGL,qBAAqB,EACtB,MAAM,aAAa,CAAC;AA2BrB,qBAAa,kBAAkB;IAO3B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,2BAA2B,CAAC;IAPtC,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,aAAa,CAAwB;IAC7C,OAAO,CAAC,WAAW,CAAwB;IAC3C,OAAO,CAAC,cAAc,CAAC,CAAwB;gBAGrC,MAAM,EAAE,aAAa,EACrB,2BAA2B,CAAC,EAAE,MAAM,YAAA;IAG9C,OAAO,CAAC,0BAA0B;IAQlC,OAAO,CAAC,kBAAkB;IAa1B,OAAO,CAAC,oBAAoB;YAyCd,qBAAqB;IAyCnC,OAAO,CAAC,mBAAmB;IAwB3B,OAAO,CAAC,gBAAgB;YAgCV,mBAAmB;YAoBnB,sBAAsB;YAyBtB,mBAAmB;IAkEpB,gBAAgB,CAC3B,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC;CAW9C"}
@@ -14,7 +14,7 @@ class RebalanceTxBuilder {
14
14
  this.client = client;
15
15
  this.targetLiqUtilizationRateBps = targetLiqUtilizationRateBps;
16
16
  }
17
- async shouldProceedWithRebalance() {
17
+ shouldProceedWithRebalance() {
18
18
  return (this.client.pos.supplyUsd() > 0 &&
19
19
  (this.targetLiqUtilizationRateBps !== undefined ||
20
20
  this.client.pos.eligibleForRebalance()));
@@ -1 +1 @@
1
- {"version":3,"file":"solautoClient.d.ts","sourceRoot":"","sources":["../../../src/services/solauto/solautoClient.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAEL,SAAS,EAGV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,kBAAkB,EAMnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,gCAAgC,EAEhC,sBAAsB,EAGvB,MAAM,iBAAiB,CAAC;AAWzB,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE1E,MAAM,WAAW,iBAAkB,SAAQ,wBAAwB;IACjE,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,UAAU,CAA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AAQ,CAAC,EAAE,gCAAgC,EAC3C,GAAG,CAAC,EAAE,kBAAkB,GACvB,kBAAkB;IA0BrB,gBAAgB,CAAC,IAAI,EAAE,sBAAsB,GAAG,kBAAkB;IAsDlE,QAAQ,CAAC,eAAe,IAAI,kBAAkB;IAE9C,WAAW,IAAI,kBAAkB;IAgCjC,QAAQ,CAAC,SAAS,IAAI,kBAAkB;IAExC,qBAAqB,CAAC,IAAI,EAAE,iBAAiB,GAAG,kBAAkB;IAsFlE,QAAQ,CAAC,WAAW,CAClB,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,gBAAgB,GACrB,kBAAkB;CACtB"}
@@ -46,7 +46,7 @@ class SolautoClient extends referralStateManager_1.ReferralStateManager {
46
46
  !(0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.referralStateData.lookupTable).equals(web3_js_1.PublicKey.default)
47
47
  ? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.referralStateData.lookupTable)
48
48
  : undefined;
49
- this.flProvider = new flProviderAggregator_1.FlProviderAggregator(this.umi, this.signer, this.pos.supplyMint(), this.pos.debtMint());
49
+ this.flProvider = new flProviderAggregator_1.FlProviderAggregator(this.umi, this.signer, this.authority, this.pos.supplyMint(), this.pos.debtMint());
50
50
  await this.flProvider.initialize();
51
51
  this.otherSigners.push(...this.flProvider.otherSigners());
52
52
  this.log("Position state: ", this.pos.state());
@@ -1,10 +1,12 @@
1
- import { Keypair } from "@solana/web3.js";
1
+ import { Keypair, PublicKey } from "@solana/web3.js";
2
2
  import {
3
3
  buildIronforgeApiUrl,
4
4
  consoleLog,
5
5
  getClient,
6
6
  getSolanaRpcConnection,
7
7
  LendingPlatform,
8
+ PriorityFeeSetting,
9
+ RebalanceTxBuilder,
8
10
  SOLAUTO_PROD_PROGRAM,
9
11
  SOLAUTO_TEST_PROGRAM,
10
12
  TransactionItem,
@@ -14,7 +16,7 @@ import { getSecretKey } from "./shared";
14
16
  import { createSignerFromKeypair } from "@metaplex-foundation/umi";
15
17
  import { fromWeb3JsKeypair } from "@metaplex-foundation/umi-web3js-adapters";
16
18
 
17
- const payForTransaction = false;
19
+ const payForTransaction = true;
18
20
  const testProgram = true;
19
21
 
20
22
  export async function main() {
@@ -25,7 +27,7 @@ export async function main() {
25
27
 
26
28
  const signer = createSignerFromKeypair(
27
29
  umi,
28
- fromWeb3JsKeypair(Keypair.fromSecretKey(getSecretKey()))
30
+ fromWeb3JsKeypair(Keypair.fromSecretKey(getSecretKey("solauto-manager")))
29
31
  );
30
32
 
31
33
  const client = getClient(LendingPlatform.Marginfi, {
@@ -37,16 +39,16 @@ export async function main() {
37
39
 
38
40
  await client.initialize({
39
41
  positionId: 1,
42
+ authority: new PublicKey("5UqsR2PGzbP8pGPbXEeXx86Gjz2N2UFBAuFZUSVydAEe"),
40
43
  });
41
44
 
42
45
  const transactionItems: TransactionItem[] = [];
43
46
 
44
47
  transactionItems.push(
45
48
  new TransactionItem(
46
- async () => ({
47
- tx: client.closePositionIx(),
48
- }),
49
- "close position"
49
+ async (attemptNum) =>
50
+ await new RebalanceTxBuilder(client).buildRebalanceTx(attemptNum),
51
+ "rebalance"
50
52
  )
51
53
  );
52
54
 
@@ -54,7 +56,7 @@ export async function main() {
54
56
  client,
55
57
  undefined,
56
58
  payForTransaction ? "normal" : "only-simulate",
57
- undefined,
59
+ PriorityFeeSetting.Min,
58
60
  true,
59
61
  undefined,
60
62
  { totalRetries: 5 }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.604",
3
+ "version": "1.0.606",
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",
@@ -48,76 +48,128 @@ nameToErrorMap.set(
48
48
  FailedAccountDeserializationError
49
49
  );
50
50
 
51
- /** InvalidPositionSettings: Invalid position settings provided */
52
- export class InvalidPositionSettingsError extends ProgramError {
53
- override readonly name: string = 'InvalidPositionSettings';
51
+ /** InvalidBoostToSetting: Invalid Boost-to param */
52
+ export class InvalidBoostToSettingError extends ProgramError {
53
+ override readonly name: string = 'InvalidBoostToSetting';
54
54
 
55
55
  readonly code: number = 0x2; // 2
56
56
 
57
57
  constructor(program: Program, cause?: Error) {
58
- super('Invalid position settings provided', program, cause);
58
+ super('Invalid Boost-to param', program, cause);
59
59
  }
60
60
  }
61
- codeToErrorMap.set(0x2, InvalidPositionSettingsError);
62
- nameToErrorMap.set('InvalidPositionSettings', InvalidPositionSettingsError);
61
+ codeToErrorMap.set(0x2, InvalidBoostToSettingError);
62
+ nameToErrorMap.set('InvalidBoostToSetting', InvalidBoostToSettingError);
63
+
64
+ /** InvalidBoostGapSetting: Invalid Boost gap param */
65
+ export class InvalidBoostGapSettingError extends ProgramError {
66
+ override readonly name: string = 'InvalidBoostGapSetting';
67
+
68
+ readonly code: number = 0x3; // 3
69
+
70
+ constructor(program: Program, cause?: Error) {
71
+ super('Invalid Boost gap param', program, cause);
72
+ }
73
+ }
74
+ codeToErrorMap.set(0x3, InvalidBoostGapSettingError);
75
+ nameToErrorMap.set('InvalidBoostGapSetting', InvalidBoostGapSettingError);
76
+
77
+ /** InvalidRepayToSetting: Invalid repay-to param */
78
+ export class InvalidRepayToSettingError extends ProgramError {
79
+ override readonly name: string = 'InvalidRepayToSetting';
80
+
81
+ readonly code: number = 0x4; // 4
82
+
83
+ constructor(program: Program, cause?: Error) {
84
+ super('Invalid repay-to param', program, cause);
85
+ }
86
+ }
87
+ codeToErrorMap.set(0x4, InvalidRepayToSettingError);
88
+ nameToErrorMap.set('InvalidRepayToSetting', InvalidRepayToSettingError);
89
+
90
+ /** InvalidRepayGapSetting: Invalid repay gap param */
91
+ export class InvalidRepayGapSettingError extends ProgramError {
92
+ override readonly name: string = 'InvalidRepayGapSetting';
93
+
94
+ readonly code: number = 0x5; // 5
95
+
96
+ constructor(program: Program, cause?: Error) {
97
+ super('Invalid repay gap param', program, cause);
98
+ }
99
+ }
100
+ codeToErrorMap.set(0x5, InvalidRepayGapSettingError);
101
+ nameToErrorMap.set('InvalidRepayGapSetting', InvalidRepayGapSettingError);
102
+
103
+ /** InvalidRepayFromSetting: Invalid repay-from (repay-to + repay gap) */
104
+ export class InvalidRepayFromSettingError extends ProgramError {
105
+ override readonly name: string = 'InvalidRepayFromSetting';
106
+
107
+ readonly code: number = 0x6; // 6
108
+
109
+ constructor(program: Program, cause?: Error) {
110
+ super('Invalid repay-from (repay-to + repay gap)', program, cause);
111
+ }
112
+ }
113
+ codeToErrorMap.set(0x6, InvalidRepayFromSettingError);
114
+ nameToErrorMap.set('InvalidRepayFromSetting', InvalidRepayFromSettingError);
63
115
 
64
116
  /** InvalidDCASettings: Invalid DCA configuration provided */
65
117
  export class InvalidDCASettingsError extends ProgramError {
66
118
  override readonly name: string = 'InvalidDCASettings';
67
119
 
68
- readonly code: number = 0x3; // 3
120
+ readonly code: number = 0x7; // 7
69
121
 
70
122
  constructor(program: Program, cause?: Error) {
71
123
  super('Invalid DCA configuration provided', program, cause);
72
124
  }
73
125
  }
74
- codeToErrorMap.set(0x3, InvalidDCASettingsError);
126
+ codeToErrorMap.set(0x7, InvalidDCASettingsError);
75
127
  nameToErrorMap.set('InvalidDCASettings', InvalidDCASettingsError);
76
128
 
77
129
  /** InvalidAutomationData: Invalid automation settings provided */
78
130
  export class InvalidAutomationDataError extends ProgramError {
79
131
  override readonly name: string = 'InvalidAutomationData';
80
132
 
81
- readonly code: number = 0x4; // 4
133
+ readonly code: number = 0x8; // 8
82
134
 
83
135
  constructor(program: Program, cause?: Error) {
84
136
  super('Invalid automation settings provided', program, cause);
85
137
  }
86
138
  }
87
- codeToErrorMap.set(0x4, InvalidAutomationDataError);
139
+ codeToErrorMap.set(0x8, InvalidAutomationDataError);
88
140
  nameToErrorMap.set('InvalidAutomationData', InvalidAutomationDataError);
89
141
 
90
142
  /** InvalidRebalanceCondition: Invalid position condition to rebalance */
91
143
  export class InvalidRebalanceConditionError extends ProgramError {
92
144
  override readonly name: string = 'InvalidRebalanceCondition';
93
145
 
94
- readonly code: number = 0x5; // 5
146
+ readonly code: number = 0x9; // 9
95
147
 
96
148
  constructor(program: Program, cause?: Error) {
97
149
  super('Invalid position condition to rebalance', program, cause);
98
150
  }
99
151
  }
100
- codeToErrorMap.set(0x5, InvalidRebalanceConditionError);
152
+ codeToErrorMap.set(0x9, InvalidRebalanceConditionError);
101
153
  nameToErrorMap.set('InvalidRebalanceCondition', InvalidRebalanceConditionError);
102
154
 
103
155
  /** InstructionIsCPI: Unable to invoke instruction through a CPI */
104
156
  export class InstructionIsCPIError extends ProgramError {
105
157
  override readonly name: string = 'InstructionIsCPI';
106
158
 
107
- readonly code: number = 0x6; // 6
159
+ readonly code: number = 0xa; // 10
108
160
 
109
161
  constructor(program: Program, cause?: Error) {
110
162
  super('Unable to invoke instruction through a CPI', program, cause);
111
163
  }
112
164
  }
113
- codeToErrorMap.set(0x6, InstructionIsCPIError);
165
+ codeToErrorMap.set(0xa, InstructionIsCPIError);
114
166
  nameToErrorMap.set('InstructionIsCPI', InstructionIsCPIError);
115
167
 
116
168
  /** IncorrectInstructions: Incorrect set of instructions or instruction data in the transaction */
117
169
  export class IncorrectInstructionsError extends ProgramError {
118
170
  override readonly name: string = 'IncorrectInstructions';
119
171
 
120
- readonly code: number = 0x7; // 7
172
+ readonly code: number = 0xb; // 11
121
173
 
122
174
  constructor(program: Program, cause?: Error) {
123
175
  super(
@@ -127,14 +179,14 @@ export class IncorrectInstructionsError extends ProgramError {
127
179
  );
128
180
  }
129
181
  }
130
- codeToErrorMap.set(0x7, IncorrectInstructionsError);
182
+ codeToErrorMap.set(0xb, IncorrectInstructionsError);
131
183
  nameToErrorMap.set('IncorrectInstructions', IncorrectInstructionsError);
132
184
 
133
185
  /** IncorrectDebtAdjustment: Incorrect swap amount provided. Likely due to high price volatility */
134
186
  export class IncorrectDebtAdjustmentError extends ProgramError {
135
187
  override readonly name: string = 'IncorrectDebtAdjustment';
136
188
 
137
- readonly code: number = 0x8; // 8
189
+ readonly code: number = 0xc; // 12
138
190
 
139
191
  constructor(program: Program, cause?: Error) {
140
192
  super(
@@ -144,14 +196,14 @@ export class IncorrectDebtAdjustmentError extends ProgramError {
144
196
  );
145
197
  }
146
198
  }
147
- codeToErrorMap.set(0x8, IncorrectDebtAdjustmentError);
199
+ codeToErrorMap.set(0xc, IncorrectDebtAdjustmentError);
148
200
  nameToErrorMap.set('IncorrectDebtAdjustment', IncorrectDebtAdjustmentError);
149
201
 
150
202
  /** InvalidRebalanceMade: Invalid rebalance was made. Target supply USD and target debt USD was not met */
151
203
  export class InvalidRebalanceMadeError extends ProgramError {
152
204
  override readonly name: string = 'InvalidRebalanceMade';
153
205
 
154
- readonly code: number = 0x9; // 9
206
+ readonly code: number = 0xd; // 13
155
207
 
156
208
  constructor(program: Program, cause?: Error) {
157
209
  super(
@@ -161,14 +213,14 @@ export class InvalidRebalanceMadeError extends ProgramError {
161
213
  );
162
214
  }
163
215
  }
164
- codeToErrorMap.set(0x9, InvalidRebalanceMadeError);
216
+ codeToErrorMap.set(0xd, InvalidRebalanceMadeError);
165
217
  nameToErrorMap.set('InvalidRebalanceMade', InvalidRebalanceMadeError);
166
218
 
167
219
  /** NonAuthorityProvidedTargetLTV: Cannot provide a target liquidation utilization rate if the instruction is not signed by the position authority */
168
220
  export class NonAuthorityProvidedTargetLTVError extends ProgramError {
169
221
  override readonly name: string = 'NonAuthorityProvidedTargetLTV';
170
222
 
171
- readonly code: number = 0xa; // 10
223
+ readonly code: number = 0xe; // 14
172
224
 
173
225
  constructor(program: Program, cause?: Error) {
174
226
  super(
@@ -178,7 +230,7 @@ export class NonAuthorityProvidedTargetLTVError extends ProgramError {
178
230
  );
179
231
  }
180
232
  }
181
- codeToErrorMap.set(0xa, NonAuthorityProvidedTargetLTVError);
233
+ codeToErrorMap.set(0xe, NonAuthorityProvidedTargetLTVError);
182
234
  nameToErrorMap.set(
183
235
  'NonAuthorityProvidedTargetLTV',
184
236
  NonAuthorityProvidedTargetLTVError
@@ -4,6 +4,7 @@ import { FlashLoanDetails, FlashLoanRequirements } from "../../types";
4
4
  import { Signer, TransactionBuilder, Umi } from "@metaplex-foundation/umi";
5
5
  import { TokenType } from "../../generated";
6
6
  import { MarginfiFlProvider } from "./marginfiFlProvider";
7
+ import { toWeb3JsPublicKey } from "@metaplex-foundation/umi-web3js-adapters";
7
8
 
8
9
  export class FlProviderAggregator extends FlProviderBase {
9
10
  private marginfiFlProvider!: MarginfiFlProvider;
@@ -11,13 +12,15 @@ export class FlProviderAggregator extends FlProviderBase {
11
12
  constructor(
12
13
  umi: Umi,
13
14
  signer: Signer,
15
+ authority: PublicKey,
14
16
  supplyMint: PublicKey,
15
17
  debtMint: PublicKey
16
18
  ) {
17
- super(umi, signer, supplyMint, debtMint);
19
+ super(umi, signer, authority, supplyMint, debtMint);
18
20
  this.marginfiFlProvider = new MarginfiFlProvider(
19
21
  umi,
20
22
  signer,
23
+ authority,
21
24
  supplyMint,
22
25
  debtMint
23
26
  );
@@ -39,10 +42,12 @@ export class FlProviderAggregator extends FlProviderBase {
39
42
  }
40
43
 
41
44
  lutAccountsToAdd(): PublicKey[] {
42
- return [
43
- ...super.lutAccountsToAdd(),
44
- ...this.marginfiFlProvider.lutAccountsToAdd(),
45
- ];
45
+ return toWeb3JsPublicKey(this.signer.publicKey).equals(this.authority)
46
+ ? [
47
+ ...super.lutAccountsToAdd(),
48
+ ...this.marginfiFlProvider.lutAccountsToAdd(),
49
+ ]
50
+ : [];
46
51
  }
47
52
 
48
53
  private flProvider(source: TokenType): FlProviderBase {
@@ -22,6 +22,7 @@ export abstract class FlProviderBase {
22
22
  constructor(
23
23
  protected umi: Umi,
24
24
  protected signer: Signer,
25
+ protected authority: PublicKey,
25
26
  protected supplyMint: PublicKey,
26
27
  protected debtMint: PublicKey
27
28
  ) {}
@@ -41,7 +41,7 @@ export class RebalanceTxBuilder {
41
41
  private targetLiqUtilizationRateBps?: number
42
42
  ) {}
43
43
 
44
- private async shouldProceedWithRebalance() {
44
+ private shouldProceedWithRebalance() {
45
45
  return (
46
46
  this.client.pos.supplyUsd() > 0 &&
47
47
  (this.targetLiqUtilizationRateBps !== undefined ||
@@ -150,6 +150,7 @@ export abstract class SolautoClient extends ReferralStateManager {
150
150
  this.flProvider = new FlProviderAggregator(
151
151
  this.umi,
152
152
  this.signer,
153
+ this.authority,
153
154
  this.pos.supplyMint(),
154
155
  this.pos.debtMint()
155
156
  );