@haven-fi/solauto-sdk 1.0.71 → 1.0.72

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,6 +20,8 @@ export declare class SolautoMarginfiClient extends SolautoClient {
20
20
  marginfiGroup: PublicKey;
21
21
  marginfiSupplyAccounts: MarginfiAssetAccounts;
22
22
  marginfiDebtAccounts: MarginfiAssetAccounts;
23
+ supplyPriceOracle: PublicKey;
24
+ debtPriceOracle: PublicKey;
23
25
  intermediaryMarginfiAccountSigner?: Signer;
24
26
  intermediaryMarginfiAccountPk: PublicKey;
25
27
  intermediaryMarginfiAccount?: MarginfiAccount;
@@ -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,EACb,iBAAiB,EACjB,wBAAwB,EACxB,gCAAgC,EAKjC,MAAM,cAAc,CAAC;AAGtB,OAAO,EAEL,eAAe,EAUhB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AASnE,MAAM,WAAW,yBAA0B,SAAQ,iBAAiB;IAClE,eAAe,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IACrC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,aAAa,CAAC,EAAE,SAAS,CAAC;CAC3B;AAED,qBAAa,qBAAsB,SAAQ,aAAa;IACtD,OAAO,CAAC,WAAW,CAAkB;IAE9B,eAAe,EAAG,SAAS,CAAC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,EAAE,yBAAyB;IAkD1C,8BAA8B;IA0CpC,mBAAmB,IAAI,MAAM,EAAE;IAI/B,gBAAgB,IAAI,SAAS,EAAE;IAU/B,yBAAyB,IAAI,kBAAkB;IAS/C,YAAY,CACV,aAAa,CAAC,EAAE,gCAAgC,EAChD,GAAG,CAAC,EAAE,kBAAkB,GACvB,kBAAkB;IAMrB,OAAO,CAAC,sBAAsB;IA8C9B,OAAO,IAAI,kBAAkB;IAc7B,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,GAAG,kBAAkB;IAUhE,OAAO,CAAC,6BAA6B;IAmErC,OAAO,CAAC,oCAAoC;IA0D5C,SAAS,CACP,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;IA2DrB,WAAW,CACT,gBAAgB,EAAE,gBAAgB,EAClC,uBAAuB,EAAE,SAAS,GACjC,kBAAkB;IA2BrB,UAAU,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,kBAAkB;IAgFlE,iCAAiC,IAAI,kBAAkB;IASjD,qBAAqB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAiBlE"}
@@ -43,6 +43,15 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
43
43
  this.marginfiSupplyAccounts =
44
44
  marginfiAccounts_1.MARGINFI_ACCOUNTS[this.supplyMint.toString()];
45
45
  this.marginfiDebtAccounts = marginfiAccounts_1.MARGINFI_ACCOUNTS[this.debtMint.toString()];
46
+ // TODO: Don't dynamically pull from bank until Marginfi sorts out their price oracle issues.
47
+ // const [supplyBank, debtBank] = await safeFetchAllBank(this.umi, [
48
+ // publicKey(this.marginfiSupplyAccounts.bank),
49
+ // publicKey(this.marginfiDebtAccounts.bank),
50
+ // ]);
51
+ // this.supplyPriceOracle = toWeb3JsPublicKey(supplyBank.config.oracleKeys[0]);
52
+ // this.debtPriceOracle = toWeb3JsPublicKey(debtBank.config.oracleKeys[0]);
53
+ this.supplyPriceOracle = new web3_js_1.PublicKey(this.marginfiSupplyAccounts.priceOracle);
54
+ this.debtPriceOracle = new web3_js_1.PublicKey(this.marginfiDebtAccounts.priceOracle);
46
55
  if (!this.initialized) {
47
56
  await this.setIntermediaryMarginfiDetails();
48
57
  }
@@ -140,9 +149,9 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
140
149
  marginfiGroup: (0, umi_1.publicKey)(this.marginfiGroup),
141
150
  marginfiAccount: (0, umi_1.publicKey)(this.marginfiAccount),
142
151
  supplyBank: (0, umi_1.publicKey)(this.marginfiSupplyAccounts.bank),
143
- supplyPriceOracle: (0, umi_1.publicKey)(this.marginfiSupplyAccounts.priceOracle),
152
+ supplyPriceOracle: (0, umi_1.publicKey)(this.supplyPriceOracle),
144
153
  debtBank: (0, umi_1.publicKey)(this.marginfiDebtAccounts.bank),
145
- debtPriceOracle: (0, umi_1.publicKey)(this.marginfiDebtAccounts.priceOracle),
154
+ debtPriceOracle: (0, umi_1.publicKey)(this.debtPriceOracle),
146
155
  solautoPosition: (0, umi_1.publicKey)(this.solautoPosition),
147
156
  });
148
157
  }
@@ -231,8 +240,8 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
231
240
  let supplyPriceOracle = undefined;
232
241
  let debtPriceOracle = undefined;
233
242
  if (args.__kind === "Withdraw" || args.__kind === "Borrow") {
234
- supplyPriceOracle = (0, umi_1.publicKey)(this.marginfiSupplyAccounts.priceOracle);
235
- debtPriceOracle = (0, umi_1.publicKey)(this.marginfiDebtAccounts.priceOracle);
243
+ supplyPriceOracle = (0, umi_1.publicKey)(this.supplyPriceOracle);
244
+ debtPriceOracle = (0, umi_1.publicKey)(this.debtPriceOracle);
236
245
  }
237
246
  return (0, generated_1.marginfiProtocolInteraction)(this.umi, {
238
247
  signer: this.signer,
@@ -276,7 +285,7 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
276
285
  marginfiAccount: (0, umi_1.publicKey)(this.marginfiAccountPk),
277
286
  intermediaryTa: (0, umi_1.publicKey)((0, accountUtils_1.getTokenAccount)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), swapDetails.inputMint)),
278
287
  supplyBank: (0, umi_1.publicKey)(this.marginfiSupplyAccounts.bank),
279
- supplyPriceOracle: (0, umi_1.publicKey)(this.marginfiSupplyAccounts.priceOracle),
288
+ supplyPriceOracle: (0, umi_1.publicKey)(this.supplyPriceOracle),
280
289
  positionSupplyTa: (0, umi_1.publicKey)(this.positionSupplyTa),
281
290
  signerSupplyTa: this.selfManaged
282
291
  ? (0, umi_1.publicKey)(this.signerSupplyTa)
@@ -288,7 +297,7 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
288
297
  ? (0, umi_1.publicKey)(this.marginfiSupplyAccounts.vaultAuthority)
289
298
  : undefined,
290
299
  debtBank: (0, umi_1.publicKey)(this.marginfiDebtAccounts.bank),
291
- debtPriceOracle: (0, umi_1.publicKey)(this.marginfiDebtAccounts.priceOracle),
300
+ debtPriceOracle: (0, umi_1.publicKey)(this.debtPriceOracle),
292
301
  positionDebtTa: (0, umi_1.publicKey)(this.positionDebtTa),
293
302
  signerDebtTa: this.selfManaged ? (0, umi_1.publicKey)(this.signerDebtTa) : undefined,
294
303
  vaultDebtTa: needDebtAccounts
@@ -325,17 +334,21 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
325
334
  }));
326
335
  }
327
336
  flashRepay(flashLoanDetails) {
328
- const bank = flashLoanDetails.mint.equals(this.supplyMint)
329
- ? this.marginfiSupplyAccounts
330
- : this.marginfiDebtAccounts;
337
+ const accounts = flashLoanDetails.mint.equals(this.supplyMint)
338
+ ? { data: this.marginfiSupplyAccounts, oracle: this.supplyPriceOracle }
339
+ : { data: this.marginfiDebtAccounts, oracle: this.debtPriceOracle };
331
340
  const remainingAccounts = [];
332
341
  let includedFlashLoanToken = false;
333
342
  if (this.intermediaryMarginfiAccount) {
334
- this.intermediaryMarginfiAccount.lendingAccount.balances.forEach((x) => {
343
+ this.intermediaryMarginfiAccount.lendingAccount.balances.forEach(async (x) => {
335
344
  if (x.active) {
336
- if (x.bankPk === bank.bank) {
345
+ if (x.bankPk === accounts.data.bank) {
337
346
  includedFlashLoanToken = true;
338
347
  }
348
+ // TODO: Don't dynamically pull from bank until Marginfi sorts out their price oracle issues.
349
+ // const bankData = await safeFetchBank(this.umi, publicKey(accounts.data.bank));
350
+ // const priceOracle = bankData!.config.oracleKeys[0];
351
+ const priceOracle = (0, umi_1.publicKey)((0, marginfiUtils_1.findMarginfiAccounts)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(x.bankPk)).priceOracle);
339
352
  remainingAccounts.push(...[
340
353
  {
341
354
  pubkey: x.bankPk,
@@ -343,7 +356,7 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
343
356
  isWritable: false,
344
357
  },
345
358
  {
346
- pubkey: (0, umi_1.publicKey)((0, marginfiUtils_1.findMarginfiAccounts)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(x.bankPk)).priceOracle),
359
+ pubkey: priceOracle,
347
360
  isSigner: false,
348
361
  isWritable: false,
349
362
  },
@@ -354,12 +367,12 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
354
367
  if (!this.intermediaryMarginfiAccount || !includedFlashLoanToken) {
355
368
  remainingAccounts.push(...[
356
369
  {
357
- pubkey: (0, umi_web3js_adapters_1.fromWeb3JsPublicKey)(new web3_js_1.PublicKey(bank.bank)),
370
+ pubkey: (0, umi_web3js_adapters_1.fromWeb3JsPublicKey)(new web3_js_1.PublicKey(accounts.data.bank)),
358
371
  isSigner: false,
359
372
  isWritable: false,
360
373
  },
361
374
  {
362
- pubkey: (0, umi_web3js_adapters_1.fromWeb3JsPublicKey)(new web3_js_1.PublicKey(bank.priceOracle)),
375
+ pubkey: (0, umi_web3js_adapters_1.fromWeb3JsPublicKey)(new web3_js_1.PublicKey(accounts.oracle)),
363
376
  isSigner: false,
364
377
  isWritable: false,
365
378
  },
@@ -369,8 +382,8 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
369
382
  .add((0, marginfi_sdk_1.lendingAccountRepay)(this.umi, {
370
383
  amount: flashLoanDetails.baseUnitAmount,
371
384
  repayAll: null,
372
- bank: (0, umi_1.publicKey)(bank.bank),
373
- bankLiquidityVault: (0, umi_1.publicKey)(bank.liquidityVault),
385
+ bank: (0, umi_1.publicKey)(accounts.data.bank),
386
+ bankLiquidityVault: (0, umi_1.publicKey)(accounts.data.liquidityVault),
374
387
  marginfiAccount: (0, umi_1.publicKey)(this.intermediaryMarginfiAccountPk),
375
388
  marginfiGroup: (0, umi_1.publicKey)(marginfiAccounts_1.DEFAULT_MARGINFI_GROUP),
376
389
  signer: this.signer,
@@ -42,8 +42,8 @@ export declare class StaleProtocolDataError extends ProgramError {
42
42
  readonly code: number;
43
43
  constructor(program: Program, cause?: Error);
44
44
  }
45
- /** UnableToReposition: Unable to adjust position to the desired utilization rate */
46
- export declare class UnableToRepositionError extends ProgramError {
45
+ /** UnableToRebalance: Unable to adjust position to the desired utilization rate */
46
+ export declare class UnableToRebalanceError extends ProgramError {
47
47
  readonly name: string;
48
48
  readonly code: number;
49
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,0FAA0F;AAC1F,qBAAa,sBAAuB,SAAQ,YAAY;IACtD,SAAkB,IAAI,EAAE,MAAM,CAAuB;IAErD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAO;gBAEhB,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,KAAK;CAO5C;A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AAC,EAAE,KAAK;CAG5C;AAID;;;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.IncorrectInstructionsError = exports.RebalanceAbuseError = exports.InstructionIsCPIError = exports.InvalidRebalanceConditionError = exports.ExceededValidUtilizationRateError = exports.UnableToRepositionError = exports.StaleProtocolDataError = exports.InvalidAutomationDataError = exports.InvalidDCASettingsError = exports.InvalidPositionSettingsError = exports.FailedAccountDeserializationError = exports.IncorrectAccountsError = void 0;
10
+ exports.IncorrectInstructionsError = exports.RebalanceAbuseError = exports.InstructionIsCPIError = exports.InvalidRebalanceConditionError = exports.ExceededValidUtilizationRateError = exports.UnableToRebalanceError = exports.StaleProtocolDataError = exports.InvalidAutomationDataError = exports.InvalidDCASettingsError = exports.InvalidPositionSettingsError = 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");
@@ -79,17 +79,17 @@ class StaleProtocolDataError extends umi_1.ProgramError {
79
79
  exports.StaleProtocolDataError = StaleProtocolDataError;
80
80
  codeToErrorMap.set(0x5, StaleProtocolDataError);
81
81
  nameToErrorMap.set('StaleProtocolData', StaleProtocolDataError);
82
- /** UnableToReposition: Unable to adjust position to the desired utilization rate */
83
- class UnableToRepositionError extends umi_1.ProgramError {
82
+ /** UnableToRebalance: Unable to adjust position to the desired utilization rate */
83
+ class UnableToRebalanceError extends umi_1.ProgramError {
84
84
  constructor(program, cause) {
85
85
  super('Unable to adjust position to the desired utilization rate', program, cause);
86
- this.name = 'UnableToReposition';
86
+ this.name = 'UnableToRebalance';
87
87
  this.code = 0x6; // 6
88
88
  }
89
89
  }
90
- exports.UnableToRepositionError = UnableToRepositionError;
91
- codeToErrorMap.set(0x6, UnableToRepositionError);
92
- nameToErrorMap.set('UnableToReposition', UnableToRepositionError);
90
+ exports.UnableToRebalanceError = UnableToRebalanceError;
91
+ codeToErrorMap.set(0x6, UnableToRebalanceError);
92
+ nameToErrorMap.set('UnableToRebalance', UnableToRebalanceError);
93
93
  /** ExceededValidUtilizationRate: Desired action brought the utilization rate to an unsafe amount */
94
94
  class ExceededValidUtilizationRateError extends umi_1.ProgramError {
95
95
  constructor(program, cause) {
@@ -9,8 +9,9 @@ import { Serializer } from '@metaplex-foundation/umi/serializers';
9
9
  export declare enum OracleSetup {
10
10
  None = 0,
11
11
  PythLegacy = 1,
12
- SwitchboardV2 = 2,
13
- PythPushOracle = 3
12
+ SwitchboardLegacy = 2,
13
+ PythPushOracle = 3,
14
+ SwitchboardPull = 4
14
15
  }
15
16
  export type OracleSetupArgs = OracleSetup;
16
17
  export declare function getOracleSetupSerializer(): Serializer<OracleSetupArgs, OracleSetup>;
@@ -1 +1 @@
1
- {"version":3,"file":"oracleSetup.d.ts","sourceRoot":"","sources":["../../../src/marginfi-sdk/types/oracleSetup.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAc,MAAM,sCAAsC,CAAC;AAE9E,oBAAY,WAAW;IACrB,IAAI,IAAA;IACJ,UAAU,IAAA;IACV,aAAa,IAAA;IACb,cAAc,IAAA;CACf;AAED,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC;AAE1C,wBAAgB,wBAAwB,IAAI,UAAU,CACpD,eAAe,EACf,WAAW,CACZ,CAIA"}
1
+ {"version":3,"file":"oracleSetup.d.ts","sourceRoot":"","sources":["../../../src/marginfi-sdk/types/oracleSetup.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAc,MAAM,sCAAsC,CAAC;AAE9E,oBAAY,WAAW;IACrB,IAAI,IAAA;IACJ,UAAU,IAAA;IACV,iBAAiB,IAAA;IACjB,cAAc,IAAA;IACd,eAAe,IAAA;CAChB;AAED,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC;AAE1C,wBAAgB,wBAAwB,IAAI,UAAU,CACpD,eAAe,EACf,WAAW,CACZ,CAIA"}
@@ -14,8 +14,9 @@ var OracleSetup;
14
14
  (function (OracleSetup) {
15
15
  OracleSetup[OracleSetup["None"] = 0] = "None";
16
16
  OracleSetup[OracleSetup["PythLegacy"] = 1] = "PythLegacy";
17
- OracleSetup[OracleSetup["SwitchboardV2"] = 2] = "SwitchboardV2";
17
+ OracleSetup[OracleSetup["SwitchboardLegacy"] = 2] = "SwitchboardLegacy";
18
18
  OracleSetup[OracleSetup["PythPushOracle"] = 3] = "PythPushOracle";
19
+ OracleSetup[OracleSetup["SwitchboardPull"] = 4] = "SwitchboardPull";
19
20
  })(OracleSetup || (exports.OracleSetup = OracleSetup = {}));
20
21
  function getOracleSetupSerializer() {
21
22
  return (0, serializers_1.scalarEnum)(OracleSetup, {
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * @see https://github.com/metaplex-foundation/kinobi
7
7
  */
8
- import { Serializer } from '@metaplex-foundation/umi/serializers';
8
+ import { Serializer } from "@metaplex-foundation/umi/serializers";
9
9
  export type WrappedI80F48 = {
10
10
  value: number[];
11
11
  };
@@ -1 +1 @@
1
- {"version":3,"file":"wrappedI80F48.d.ts","sourceRoot":"","sources":["../../../src/marginfi-sdk/types/wrappedI80F48.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAqB,MAAM,sCAAsC,CAAC;AAErF,MAAM,MAAM,aAAa,GAAG;IAAE,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAEhD,MAAM,MAAM,iBAAiB,GAAG;IAAE,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAEpD,wBAAgB,0BAA0B,IAAI,UAAU,CACtD,iBAAiB,EACjB,aAAa,CACd,CAIA"}
1
+ {"version":3,"file":"wrappedI80F48.d.ts","sourceRoot":"","sources":["../../../src/marginfi-sdk/types/wrappedI80F48.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,UAAU,EAIX,MAAM,sCAAsC,CAAC;AAE9C,MAAM,MAAM,aAAa,GAAG;IAAE,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAEhD,MAAM,MAAM,iBAAiB,GAAG;IAAE,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAEpD,wBAAgB,0BAA0B,IAAI,UAAU,CACtD,iBAAiB,EACjB,aAAa,CACd,CAIA"}
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.getWrappedI80F48Serializer = getWrappedI80F48Serializer;
11
11
  const serializers_1 = require("@metaplex-foundation/umi/serializers");
12
12
  function getWrappedI80F48Serializer() {
13
- return (0, serializers_1.struct)([['value', (0, serializers_1.array)((0, serializers_1.u8)(), { size: 16 })]], {
14
- description: 'WrappedI80F48',
13
+ return (0, serializers_1.struct)([["value", (0, serializers_1.array)((0, serializers_1.u8)(), { size: 16 })]], {
14
+ description: "WrappedI80F48",
15
15
  });
16
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.71",
3
+ "version": "1.0.72",
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",
@@ -34,6 +34,7 @@ import {
34
34
  import { getMarginfiAccountPDA, getTokenAccount } from "../utils/accountUtils";
35
35
  import { generateRandomU64 } from "../utils/generalUtils";
36
36
  import {
37
+ Bank,
37
38
  MARGINFI_PROGRAM_ID,
38
39
  MarginfiAccount,
39
40
  lendingAccountBorrow,
@@ -43,7 +44,9 @@ import {
43
44
  lendingAccountStartFlashloan,
44
45
  lendingAccountWithdraw,
45
46
  marginfiAccountInitialize,
47
+ safeFetchAllBank,
46
48
  safeFetchAllMarginfiAccount,
49
+ safeFetchBank,
47
50
  safeFetchMarginfiAccount,
48
51
  } from "../marginfi-sdk";
49
52
  import { JupSwapDetails } from "../utils/jupiterUtils";
@@ -75,6 +78,9 @@ export class SolautoMarginfiClient extends SolautoClient {
75
78
  public marginfiSupplyAccounts!: MarginfiAssetAccounts;
76
79
  public marginfiDebtAccounts!: MarginfiAssetAccounts;
77
80
 
81
+ public supplyPriceOracle!: PublicKey;
82
+ public debtPriceOracle!: PublicKey;
83
+
78
84
  // For flash loans
79
85
  public intermediaryMarginfiAccountSigner?: Signer;
80
86
  public intermediaryMarginfiAccountPk!: PublicKey;
@@ -113,6 +119,17 @@ export class SolautoMarginfiClient extends SolautoClient {
113
119
  MARGINFI_ACCOUNTS[this.supplyMint.toString()]!;
114
120
  this.marginfiDebtAccounts = MARGINFI_ACCOUNTS[this.debtMint.toString()]!;
115
121
 
122
+ // TODO: Don't dynamically pull from bank until Marginfi sorts out their price oracle issues.
123
+ // const [supplyBank, debtBank] = await safeFetchAllBank(this.umi, [
124
+ // publicKey(this.marginfiSupplyAccounts.bank),
125
+ // publicKey(this.marginfiDebtAccounts.bank),
126
+ // ]);
127
+ // this.supplyPriceOracle = toWeb3JsPublicKey(supplyBank.config.oracleKeys[0]);
128
+ // this.debtPriceOracle = toWeb3JsPublicKey(debtBank.config.oracleKeys[0]);
129
+
130
+ this.supplyPriceOracle = new PublicKey(this.marginfiSupplyAccounts.priceOracle);
131
+ this.debtPriceOracle = new PublicKey(this.marginfiDebtAccounts.priceOracle);
132
+
116
133
  if (!this.initialized) {
117
134
  await this.setIntermediaryMarginfiDetails();
118
135
  }
@@ -246,9 +263,9 @@ export class SolautoMarginfiClient extends SolautoClient {
246
263
  marginfiGroup: publicKey(this.marginfiGroup),
247
264
  marginfiAccount: publicKey(this.marginfiAccount),
248
265
  supplyBank: publicKey(this.marginfiSupplyAccounts.bank),
249
- supplyPriceOracle: publicKey(this.marginfiSupplyAccounts.priceOracle),
266
+ supplyPriceOracle: publicKey(this.supplyPriceOracle),
250
267
  debtBank: publicKey(this.marginfiDebtAccounts.bank),
251
- debtPriceOracle: publicKey(this.marginfiDebtAccounts.priceOracle),
268
+ debtPriceOracle: publicKey(this.debtPriceOracle),
252
269
  solautoPosition: publicKey(this.solautoPosition),
253
270
  });
254
271
  }
@@ -364,8 +381,8 @@ export class SolautoMarginfiClient extends SolautoClient {
364
381
  let supplyPriceOracle: UmiPublicKey | undefined = undefined;
365
382
  let debtPriceOracle: UmiPublicKey | undefined = undefined;
366
383
  if (args.__kind === "Withdraw" || args.__kind === "Borrow") {
367
- supplyPriceOracle = publicKey(this.marginfiSupplyAccounts.priceOracle);
368
- debtPriceOracle = publicKey(this.marginfiDebtAccounts.priceOracle);
384
+ supplyPriceOracle = publicKey(this.supplyPriceOracle);
385
+ debtPriceOracle = publicKey(this.debtPriceOracle);
369
386
  }
370
387
 
371
388
  return marginfiProtocolInteraction(this.umi, {
@@ -427,7 +444,7 @@ export class SolautoMarginfiClient extends SolautoClient {
427
444
  )
428
445
  ),
429
446
  supplyBank: publicKey(this.marginfiSupplyAccounts.bank),
430
- supplyPriceOracle: publicKey(this.marginfiSupplyAccounts.priceOracle),
447
+ supplyPriceOracle: publicKey(this.supplyPriceOracle),
431
448
  positionSupplyTa: publicKey(this.positionSupplyTa),
432
449
  signerSupplyTa: this.selfManaged
433
450
  ? publicKey(this.signerSupplyTa)
@@ -439,7 +456,7 @@ export class SolautoMarginfiClient extends SolautoClient {
439
456
  ? publicKey(this.marginfiSupplyAccounts.vaultAuthority)
440
457
  : undefined,
441
458
  debtBank: publicKey(this.marginfiDebtAccounts.bank),
442
- debtPriceOracle: publicKey(this.marginfiDebtAccounts.priceOracle),
459
+ debtPriceOracle: publicKey(this.debtPriceOracle),
443
460
  positionDebtTa: publicKey(this.positionDebtTa),
444
461
  signerDebtTa: this.selfManaged ? publicKey(this.signerDebtTa) : undefined,
445
462
  vaultDebtTa: needDebtAccounts
@@ -485,20 +502,25 @@ export class SolautoMarginfiClient extends SolautoClient {
485
502
  }
486
503
 
487
504
  flashRepay(flashLoanDetails: FlashLoanDetails): TransactionBuilder {
488
- const bank = flashLoanDetails.mint.equals(this.supplyMint)
489
- ? this.marginfiSupplyAccounts
490
- : this.marginfiDebtAccounts;
505
+ const accounts = flashLoanDetails.mint.equals(this.supplyMint)
506
+ ? { data: this.marginfiSupplyAccounts, oracle: this.supplyPriceOracle }
507
+ : { data: this.marginfiDebtAccounts, oracle: this.debtPriceOracle };
491
508
 
492
509
  const remainingAccounts: AccountMeta[] = [];
493
510
  let includedFlashLoanToken = false;
494
511
 
495
512
  if (this.intermediaryMarginfiAccount) {
496
- this.intermediaryMarginfiAccount.lendingAccount.balances.forEach((x) => {
513
+ this.intermediaryMarginfiAccount.lendingAccount.balances.forEach(async (x) => {
497
514
  if (x.active) {
498
- if (x.bankPk === bank.bank) {
515
+ if (x.bankPk === accounts.data.bank) {
499
516
  includedFlashLoanToken = true;
500
517
  }
501
518
 
519
+ // TODO: Don't dynamically pull from bank until Marginfi sorts out their price oracle issues.
520
+ // const bankData = await safeFetchBank(this.umi, publicKey(accounts.data.bank));
521
+ // const priceOracle = bankData!.config.oracleKeys[0];
522
+ const priceOracle = publicKey(findMarginfiAccounts(toWeb3JsPublicKey(x.bankPk)).priceOracle);
523
+
502
524
  remainingAccounts.push(
503
525
  ...[
504
526
  {
@@ -507,9 +529,7 @@ export class SolautoMarginfiClient extends SolautoClient {
507
529
  isWritable: false,
508
530
  },
509
531
  {
510
- pubkey: publicKey(
511
- findMarginfiAccounts(toWeb3JsPublicKey(x.bankPk)).priceOracle
512
- ),
532
+ pubkey: priceOracle,
513
533
  isSigner: false,
514
534
  isWritable: false,
515
535
  },
@@ -522,12 +542,12 @@ export class SolautoMarginfiClient extends SolautoClient {
522
542
  remainingAccounts.push(
523
543
  ...[
524
544
  {
525
- pubkey: fromWeb3JsPublicKey(new PublicKey(bank.bank)),
545
+ pubkey: fromWeb3JsPublicKey(new PublicKey(accounts.data.bank)),
526
546
  isSigner: false,
527
547
  isWritable: false,
528
548
  },
529
549
  {
530
- pubkey: fromWeb3JsPublicKey(new PublicKey(bank.priceOracle)),
550
+ pubkey: fromWeb3JsPublicKey(new PublicKey(accounts.oracle)),
531
551
  isSigner: false,
532
552
  isWritable: false,
533
553
  },
@@ -540,8 +560,8 @@ export class SolautoMarginfiClient extends SolautoClient {
540
560
  lendingAccountRepay(this.umi, {
541
561
  amount: flashLoanDetails.baseUnitAmount,
542
562
  repayAll: null,
543
- bank: publicKey(bank.bank),
544
- bankLiquidityVault: publicKey(bank.liquidityVault),
563
+ bank: publicKey(accounts.data.bank),
564
+ bankLiquidityVault: publicKey(accounts.data.liquidityVault),
545
565
  marginfiAccount: publicKey(this.intermediaryMarginfiAccountPk),
546
566
  marginfiGroup: publicKey(DEFAULT_MARGINFI_GROUP),
547
567
  signer: this.signer,
@@ -108,9 +108,9 @@ export class StaleProtocolDataError extends ProgramError {
108
108
  codeToErrorMap.set(0x5, StaleProtocolDataError);
109
109
  nameToErrorMap.set('StaleProtocolData', StaleProtocolDataError);
110
110
 
111
- /** UnableToReposition: Unable to adjust position to the desired utilization rate */
112
- export class UnableToRepositionError extends ProgramError {
113
- override readonly name: string = 'UnableToReposition';
111
+ /** UnableToRebalance: Unable to adjust position to the desired utilization rate */
112
+ export class UnableToRebalanceError extends ProgramError {
113
+ override readonly name: string = 'UnableToRebalance';
114
114
 
115
115
  readonly code: number = 0x6; // 6
116
116
 
@@ -122,8 +122,8 @@ export class UnableToRepositionError extends ProgramError {
122
122
  );
123
123
  }
124
124
  }
125
- codeToErrorMap.set(0x6, UnableToRepositionError);
126
- nameToErrorMap.set('UnableToReposition', UnableToRepositionError);
125
+ codeToErrorMap.set(0x6, UnableToRebalanceError);
126
+ nameToErrorMap.set('UnableToRebalance', UnableToRebalanceError);
127
127
 
128
128
  /** ExceededValidUtilizationRate: Desired action brought the utilization rate to an unsafe amount */
129
129
  export class ExceededValidUtilizationRateError extends ProgramError {
@@ -11,8 +11,9 @@ import { Serializer, scalarEnum } from '@metaplex-foundation/umi/serializers';
11
11
  export enum OracleSetup {
12
12
  None,
13
13
  PythLegacy,
14
- SwitchboardV2,
14
+ SwitchboardLegacy,
15
15
  PythPushOracle,
16
+ SwitchboardPull,
16
17
  }
17
18
 
18
19
  export type OracleSetupArgs = OracleSetup;
@@ -6,7 +6,12 @@
6
6
  * @see https://github.com/metaplex-foundation/kinobi
7
7
  */
8
8
 
9
- import { Serializer, array, struct, u8 } from '@metaplex-foundation/umi/serializers';
9
+ import {
10
+ Serializer,
11
+ array,
12
+ struct,
13
+ u8,
14
+ } from "@metaplex-foundation/umi/serializers";
10
15
 
11
16
  export type WrappedI80F48 = { value: number[] };
12
17
 
@@ -16,7 +21,7 @@ export function getWrappedI80F48Serializer(): Serializer<
16
21
  WrappedI80F48Args,
17
22
  WrappedI80F48
18
23
  > {
19
- return struct<WrappedI80F48>([['value', array(u8(), { size: 16 })]], {
20
- description: 'WrappedI80F48',
24
+ return struct<WrappedI80F48>([["value", array(u8(), { size: 16 })]], {
25
+ description: "WrappedI80F48",
21
26
  }) as Serializer<WrappedI80F48Args, WrappedI80F48>;
22
27
  }
@@ -20,8 +20,8 @@ import { PublicKey } from "@solana/web3.js";
20
20
  import { USDC_MINT } from "../../src/constants";
21
21
 
22
22
  describe("Solauto Marginfi tests", async () => {
23
- const signer = setupTest();
24
- // const signer = setupTest("solauto-manager");
23
+ // const signer = setupTest();
24
+ const signer = setupTest("solauto-manager");
25
25
 
26
26
  const payForTransactions = false;
27
27
  const useJitoBundle = false;