@haven-fi/solauto-sdk 1.0.25 → 1.0.27

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. package/dist/clients/solautoClient.d.ts +4 -4
  2. package/dist/clients/solautoClient.d.ts.map +1 -1
  3. package/dist/clients/solautoClient.js +25 -23
  4. package/dist/clients/solautoMarginfiClient.d.ts +1 -0
  5. package/dist/clients/solautoMarginfiClient.d.ts.map +1 -1
  6. package/dist/clients/solautoMarginfiClient.js +84 -23
  7. package/dist/generated/instructions/closePosition.d.ts +4 -4
  8. package/dist/generated/instructions/closePosition.d.ts.map +1 -1
  9. package/dist/generated/instructions/closePosition.js +8 -8
  10. package/dist/generated/instructions/marginfiProtocolInteraction.d.ts +2 -2
  11. package/dist/generated/instructions/marginfiProtocolInteraction.d.ts.map +1 -1
  12. package/dist/generated/instructions/marginfiProtocolInteraction.js +4 -4
  13. package/dist/generated/instructions/marginfiRebalance.d.ts +2 -0
  14. package/dist/generated/instructions/marginfiRebalance.d.ts.map +1 -1
  15. package/dist/generated/instructions/marginfiRebalance.js +17 -7
  16. package/dist/transactions/transactionUtils.d.ts.map +1 -1
  17. package/dist/transactions/transactionUtils.js +111 -21
  18. package/dist/transactions/transactionsManager.d.ts.map +1 -1
  19. package/dist/transactions/transactionsManager.js +6 -2
  20. package/dist/types/solauto.d.ts +13 -0
  21. package/dist/types/solauto.d.ts.map +1 -0
  22. package/dist/types/solauto.js +2 -0
  23. package/dist/utils/jupiterUtils.d.ts.map +1 -1
  24. package/dist/utils/jupiterUtils.js +1 -0
  25. package/dist/utils/marginfiUtils.d.ts +5 -1
  26. package/dist/utils/marginfiUtils.d.ts.map +1 -1
  27. package/dist/utils/marginfiUtils.js +8 -2
  28. package/dist/utils/solauto/generalUtils.d.ts +1 -5
  29. package/dist/utils/solauto/generalUtils.d.ts.map +1 -1
  30. package/dist/utils/solauto/generalUtils.js +6 -2
  31. package/dist/utils/solauto/rebalanceUtils.js +2 -1
  32. package/package.json +1 -1
  33. package/src/clients/solautoClient.ts +33 -31
  34. package/src/clients/solautoMarginfiClient.ts +89 -31
  35. package/src/generated/instructions/closePosition.ts +12 -12
  36. package/src/generated/instructions/marginfiProtocolInteraction.ts +6 -6
  37. package/src/generated/instructions/marginfiRebalance.ts +19 -7
  38. package/src/transactions/transactionUtils.ts +140 -36
  39. package/src/transactions/transactionsManager.ts +8 -6
  40. package/src/types/solauto.ts +14 -0
  41. package/src/utils/jupiterUtils.ts +1 -0
  42. package/src/utils/marginfiUtils.ts +11 -3
  43. package/src/utils/solauto/generalUtils.ts +21 -12
  44. package/src/utils/solauto/rebalanceUtils.ts +2 -2
  45. package/tests/transactions/solautoMarginfi.ts +44 -25
  46. package/tests/unit/lookupTables.ts +4 -3
@@ -30,11 +30,11 @@ export declare abstract class SolautoClient {
30
30
  solautoPositionData: SolautoPosition | null;
31
31
  solautoPositionState: PositionState | undefined;
32
32
  supplyMint: PublicKey;
33
- positionSupplyLiquidityTa: PublicKey;
34
- signerSupplyLiquidityTa: PublicKey;
33
+ positionSupplyTa: PublicKey;
34
+ signerSupplyTa: PublicKey;
35
35
  debtMint: PublicKey;
36
- positionDebtLiquidityTa: PublicKey;
37
- signerDebtLiquidityTa: PublicKey;
36
+ positionDebtTa: PublicKey;
37
+ signerDebtTa: PublicKey;
38
38
  authorityReferralState: PublicKey;
39
39
  authorityReferralStateData: ReferralState | null;
40
40
  authorityReferralFeesDestMint: PublicKey;
@@ -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;AAGlC,OAAO,EACL,aAAa,EAEd,MAAM,iDAAiD,CAAC;AACzD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,aAAa,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B;IAEf,qBAAqB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAYlE"}
@@ -46,13 +46,13 @@ class SolautoClient {
46
46
  this.supplyMint =
47
47
  args.supplyMint ??
48
48
  (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.solautoPositionData.position.supplyMint);
49
- this.positionSupplyLiquidityTa = (0, accountUtils_1.getTokenAccount)(this.solautoPosition, this.supplyMint);
50
- this.signerSupplyLiquidityTa = (0, accountUtils_1.getTokenAccount)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), this.supplyMint);
49
+ this.positionSupplyTa = (0, accountUtils_1.getTokenAccount)(this.solautoPosition, this.supplyMint);
50
+ this.signerSupplyTa = (0, accountUtils_1.getTokenAccount)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), this.supplyMint);
51
51
  this.debtMint =
52
52
  args.debtMint ??
53
53
  (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.solautoPositionData.position.debtMint);
54
- this.positionDebtLiquidityTa = (0, accountUtils_1.getTokenAccount)(this.solautoPosition, this.debtMint);
55
- this.signerDebtLiquidityTa = (0, accountUtils_1.getTokenAccount)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), this.debtMint);
54
+ this.positionDebtTa = (0, accountUtils_1.getTokenAccount)(this.solautoPosition, this.debtMint);
55
+ this.signerDebtTa = (0, accountUtils_1.getTokenAccount)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), this.debtMint);
56
56
  this.authorityReferralState = await (0, accountUtils_1.getReferralState)(this.authority);
57
57
  this.authorityReferralStateData = await (0, generated_1.safeFetchReferralState)(this.umi, (0, umi_1.publicKey)(this.authorityReferralState));
58
58
  this.authorityReferralFeesDestMint = args.referralFeesDestMint
@@ -123,14 +123,14 @@ class SolautoClient {
123
123
  return [
124
124
  this.authority,
125
125
  ...(this.signer.publicKey.toString() === this.authority.toString()
126
- ? [this.signerSupplyLiquidityTa]
126
+ ? [this.signerSupplyTa]
127
127
  : []),
128
128
  ...(this.signer.publicKey.toString() === this.authority.toString()
129
- ? [this.signerDebtLiquidityTa]
129
+ ? [this.signerDebtTa]
130
130
  : []),
131
131
  this.solautoPosition,
132
- this.positionSupplyLiquidityTa,
133
- this.positionDebtLiquidityTa,
132
+ this.positionSupplyTa,
133
+ this.positionDebtTa,
134
134
  this.authorityReferralState,
135
135
  ...(this.referredBySupplyTa ? [this.referredBySupplyTa] : []),
136
136
  ];
@@ -151,7 +151,6 @@ class SolautoClient {
151
151
  .includes(element.toString().toLowerCase()))) {
152
152
  return undefined;
153
153
  }
154
- this.log("Updating authority lookup table...");
155
154
  let tx = (0, umi_1.transactionBuilder)();
156
155
  if (this.authorityLutAddress === undefined) {
157
156
  const [createLookupTableInst, lookupTableAddress] = web3_js_1.AddressLookupTableProgram.createLookupTable({
@@ -174,9 +173,12 @@ class SolautoClient {
174
173
  addresses: accountsToAdd,
175
174
  })));
176
175
  }
177
- const addingReferredBy = accountsToAdd.length === 1 &&
178
- accountsToAdd[0].toString().toLowerCase() ===
179
- this.referredBySupplyTa?.toString().toLowerCase();
176
+ const addingReferredBy = accountsToAdd.length === 1;
177
+ // && accountsToAdd[0].toString().toLowerCase() ===
178
+ // this.referredBySupplyTa?.toString().toLowerCase();
179
+ if (tx.getInstructions().length > 0) {
180
+ this.log("Updating authority lookup table...");
181
+ }
180
182
  return { updateLutTx: tx, needsToBeIsolated: !addingReferredBy };
181
183
  }
182
184
  solautoPositionSettings() {
@@ -243,8 +245,8 @@ class SolautoClient {
243
245
  let signerDebtTa = undefined;
244
246
  if ((0, umi_1.isOption)(args.dca) && (0, umi_1.isSome)(args.dca)) {
245
247
  debtMint = (0, umi_1.publicKey)(this.debtMint);
246
- positionDebtTa = (0, umi_1.publicKey)(this.positionDebtLiquidityTa);
247
- signerDebtTa = (0, umi_1.publicKey)(this.signerDebtLiquidityTa);
248
+ positionDebtTa = (0, umi_1.publicKey)(this.positionDebtTa);
249
+ signerDebtTa = (0, umi_1.publicKey)(this.signerDebtTa);
248
250
  let addingToPos = false;
249
251
  if ((0, umi_1.isOption)(args.dca) &&
250
252
  (0, umi_1.isSome)(args.dca) &&
@@ -289,10 +291,10 @@ class SolautoClient {
289
291
  return (0, generated_1.closePosition)(this.umi, {
290
292
  signer: this.signer,
291
293
  solautoPosition: (0, umi_1.publicKey)(this.solautoPosition),
292
- signerSupplyLiquidityTa: (0, umi_1.publicKey)(this.signerSupplyLiquidityTa),
293
- positionSupplyLiquidityTa: (0, umi_1.publicKey)(this.positionSupplyLiquidityTa),
294
- positionDebtLiquidityTa: (0, umi_1.publicKey)(this.positionDebtLiquidityTa),
295
- signerDebtLiquidityTa: (0, umi_1.publicKey)(this.signerDebtLiquidityTa),
294
+ signerSupplyTa: (0, umi_1.publicKey)(this.signerSupplyTa),
295
+ positionSupplyTa: (0, umi_1.publicKey)(this.positionSupplyTa),
296
+ positionDebtTa: (0, umi_1.publicKey)(this.positionDebtTa),
297
+ signerDebtTa: (0, umi_1.publicKey)(this.signerDebtTa),
296
298
  });
297
299
  }
298
300
  cancelDCAIx() {
@@ -303,8 +305,8 @@ class SolautoClient {
303
305
  const positionData = this.solautoPositionData.position;
304
306
  if (positionData.dca.debtToAddBaseUnit) {
305
307
  debtMint = (0, umi_1.publicKey)(this.debtMint);
306
- positionDebtTa = (0, umi_1.publicKey)(this.positionDebtLiquidityTa);
307
- signerDebtTa = (0, umi_1.publicKey)(this.signerDebtLiquidityTa);
308
+ positionDebtTa = (0, umi_1.publicKey)(this.positionDebtTa);
309
+ signerDebtTa = (0, umi_1.publicKey)(this.signerDebtTa);
308
310
  this.livePositionUpdates.new({
309
311
  type: "debtDcaIn",
310
312
  value: positionData.dca.debtToAddBaseUnit * BigInt(-1),
@@ -323,14 +325,14 @@ class SolautoClient {
323
325
  let tx = (0, umi_1.transactionBuilder)();
324
326
  if (!this.selfManaged) {
325
327
  if (args.__kind === "Deposit") {
326
- tx = tx.add((0, solanaUtils_1.splTokenTransferUmiIx)(this.signer, this.signerSupplyLiquidityTa, this.positionSupplyLiquidityTa, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), BigInt(args.fields[0])));
328
+ tx = tx.add((0, solanaUtils_1.splTokenTransferUmiIx)(this.signer, this.signerSupplyTa, this.positionSupplyTa, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), BigInt(args.fields[0])));
327
329
  }
328
330
  else if (args.__kind === "Repay") {
329
331
  if (args.fields[0].__kind === "Some") {
330
- tx = tx.add((0, solanaUtils_1.splTokenTransferUmiIx)(this.signer, this.signerDebtLiquidityTa, this.positionDebtLiquidityTa, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), BigInt(args.fields[0].fields[0])));
332
+ tx = tx.add((0, solanaUtils_1.splTokenTransferUmiIx)(this.signer, this.signerDebtTa, this.positionDebtTa, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), BigInt(args.fields[0].fields[0])));
331
333
  }
332
334
  else {
333
- tx = tx.add((0, solanaUtils_1.splTokenTransferUmiIx)(this.signer, this.signerDebtLiquidityTa, this.positionDebtLiquidityTa, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), BigInt(Math.round(Number(this.solautoPositionState.debt.amountUsed.baseUnit) *
335
+ tx = tx.add((0, solanaUtils_1.splTokenTransferUmiIx)(this.signer, this.signerDebtTa, this.positionDebtTa, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), BigInt(Math.round(Number(this.solautoPositionState.debt.amountUsed.baseUnit) *
334
336
  1.01))));
335
337
  }
336
338
  }
@@ -32,6 +32,7 @@ export declare class SolautoMarginfiClient extends SolautoClient {
32
32
  refresh(): TransactionBuilder;
33
33
  protocolInteraction(args: SolautoActionArgs): TransactionBuilder;
34
34
  private marginfiProtocolInteractionIx;
35
+ private marginfiSolautoProtocolInteractionIx;
35
36
  rebalance(rebalanceStep: "A" | "B", swapDetails: JupSwapDetails, rebalanceType: SolautoRebalanceTypeArgs, targetLiqUtilizationRateBps?: number, limitGapBps?: number): TransactionBuilder;
36
37
  flashBorrow(flashLoanDetails: FlashLoanDetails, destinationTokenAccount: PublicKey): TransactionBuilder;
37
38
  flashRepay(flashLoanDetails: FlashLoanDetails): TransactionBuilder;
@@ -1 +1 @@
1
- {"version":3,"file":"solautoMarginfiClient.d.ts","sourceRoot":"","sources":["../../src/clients/solautoMarginfiClient.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,MAAM,EACN,kBAAkB,EAOnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEL,SAAS,EAEV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAK1D,OAAO,EACL,kBAAkB,EAElB,aAAa,EACb,iBAAiB,EACjB,wBAAwB,EACxB,gCAAgC,EAKjC,MAAM,cAAc,CAAC;AAGtB,OAAO,EAEL,eAAe,EAQhB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAOnE,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAEhF,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,wBAAgB,8BAA8B,CAC5C,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,MAAM,EAAE,aAAa,GAAG,SAAS,EACjC,UAAU,EAAE,SAAS,EACrB,QAAQ,EAAE,SAAS,EACnB,mBAAmB,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qBAAqB,CAAC;IACnD,wBAAwB,EAAG,qBAAqB,CAAC;IAGjD,iCAAiC,CAAC,EAAE,MAAM,CAAC;IAC3C,6BAA6B,EAAG,SAAS,CAAC;IAC1C,2BAA2B,CAAC,EAAE,eAAe,CAAC;IAE/C,UAAU,CAAC,IAAI,EAAE,yBAAyB;IAoEhD,mBAAmB,IAAI,MAAM,EAAE;IAI/B,gBAAgB,IAAI,SAAS,EAAE;IAQ/B,YAAY,CACV,aAAa,CAAC,EAAE,gCAAgC,EAChD,GAAG,CAAC,EAAE,kBAAkB,GACvB,kBAAkB;IAMrB,OAAO,CAAC,sBAAsB;IA2C9B,OAAO,IAAI,kBAAkB;IAc7B,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,GAAG,kBAAkB;IAUhE,OAAO,CAAC,6BAA6B;IAsDrC,OAAO,CAAC,oCAAoC;IA8D5C,SAAS,CACP,aAAa,EAAE,GAAG,GAAG,GAAG,EACxB,WAAW,EAAE,cAAc,EAC3B,aAAa,EAAE,wBAAwB,EACvC,2BAA2B,CAAC,EAAE,MAAM,EACpC,WAAW,CAAC,EAAE,MAAM,GACnB,kBAAkB;IA8CrB,WAAW,CACT,gBAAgB,EAAE,gBAAgB,EAClC,uBAAuB,EAAE,SAAS,GACjC,kBAAkB;IA2BrB,UAAU,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,kBAAkB;IA8ElE,iCAAiC,IAAI,kBAAkB;IASjD,qBAAqB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAiBlE"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SolautoMarginfiClient = exports.newSolautoMarginfiPositionArgs = void 0;
4
4
  const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
5
5
  const umi_1 = require("@metaplex-foundation/umi");
6
+ const umi_bundle_defaults_1 = require("@metaplex-foundation/umi-bundle-defaults");
6
7
  const web3_js_1 = require("@solana/web3.js");
7
8
  const solautoClient_1 = require("./solautoClient");
8
9
  const marginfiAccounts_1 = require("../constants/marginfiAccounts");
@@ -13,12 +14,13 @@ const marginfi_sdk_1 = require("../marginfi-sdk");
13
14
  const marginfiUtils_1 = require("../utils/marginfiUtils");
14
15
  const numberUtils_1 = require("../utils/numberUtils");
15
16
  function newSolautoMarginfiPositionArgs(positionId, signer, wallet, supplyMint, debtMint, referredByAuthority) {
17
+ const umi = (0, umi_bundle_defaults_1.createUmi)((0, web3_js_1.clusterApiUrl)("mainnet-beta"));
16
18
  return {
17
19
  positionId,
18
20
  signer,
19
21
  wallet,
20
22
  marginfiAccount: positionId === 0
21
- ? (0, umi_1.createSignerFromKeypair)((0, umi_1.createUmi)(), (0, umi_web3js_adapters_1.fromWeb3JsKeypair)(web3_js_1.Keypair.generate()))
23
+ ? (0, umi_1.createSignerFromKeypair)(umi, umi.eddsa.generateKeypair())
22
24
  : undefined,
23
25
  marginfiAccountSeedIdx: positionId > 0 ? (0, generalUtils_1.generateRandomU64)() : undefined,
24
26
  supplyMint: supplyMint,
@@ -54,13 +56,13 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
54
56
  mint: this.debtMint.toString(),
55
57
  });
56
58
  const existingMarginfiAccounts = await (0, marginfiUtils_1.getAllMarginfiAccountsByAuthority)(this.umi, (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), false);
57
- const emptyMarginfiAccounts = (await (0, marginfi_sdk_1.safeFetchAllMarginfiAccount)(this.umi, existingMarginfiAccounts.map((x) => (0, umi_1.publicKey)(x)))).filter((x) => x.lendingAccount.balances.find((y) => y.bankPk.toString() !== web3_js_1.PublicKey.default.toString() &&
59
+ const emptyMarginfiAccounts = (await (0, marginfi_sdk_1.safeFetchAllMarginfiAccount)(this.umi, existingMarginfiAccounts.map((x) => (0, umi_1.publicKey)(x.marginfiAccount)))).filter((x) => x.lendingAccount.balances.find((y) => y.bankPk.toString() !== web3_js_1.PublicKey.default.toString() &&
58
60
  (Math.round((0, numberUtils_1.bytesToI80F48)(y.assetShares.value)) != 0 ||
59
61
  Math.round((0, numberUtils_1.bytesToI80F48)(y.liabilityShares.value)) != 0)) === undefined);
60
62
  this.intermediaryMarginfiAccountSigner =
61
63
  emptyMarginfiAccounts.length > 0
62
64
  ? undefined
63
- : (0, umi_1.createSignerFromKeypair)(this.umi, (0, umi_web3js_adapters_1.fromWeb3JsKeypair)(web3_js_1.Keypair.generate()));
65
+ : (0, umi_1.createSignerFromKeypair)(this.umi, this.umi.eddsa.generateKeypair());
64
66
  this.intermediaryMarginfiAccountPk =
65
67
  emptyMarginfiAccounts.length > 0
66
68
  ? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(emptyMarginfiAccounts[0].publicKey)
@@ -84,9 +86,9 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
84
86
  .add(this.marginfiOpenPositionIx(settingParams, dca));
85
87
  }
86
88
  marginfiOpenPositionIx(settingParams, dca) {
87
- let signerDebtLiquidityTa = undefined;
89
+ let signerDebtTa = undefined;
88
90
  if (dca) {
89
- signerDebtLiquidityTa = (0, umi_1.publicKey)(this.signerDebtLiquidityTa);
91
+ signerDebtTa = (0, umi_1.publicKey)(this.signerDebtTa);
90
92
  }
91
93
  return (0, generated_1.marginfiOpenPosition)(this.umi, {
92
94
  signer: this.signer,
@@ -107,11 +109,11 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
107
109
  : this.marginfiAccount,
108
110
  supplyMint: (0, umi_1.publicKey)(this.supplyMint),
109
111
  supplyBank: (0, umi_1.publicKey)(this.marginfiSupplyBankAccounts.bank),
110
- positionSupplyTa: (0, umi_1.publicKey)(this.positionSupplyLiquidityTa),
112
+ positionSupplyTa: (0, umi_1.publicKey)(this.positionSupplyTa),
111
113
  debtMint: (0, umi_1.publicKey)(this.debtMint),
112
114
  debtBank: (0, umi_1.publicKey)(this.marginfiDebtBankAccounts.bank),
113
- positionDebtTa: (0, umi_1.publicKey)(this.positionDebtLiquidityTa),
114
- signerDebtTa: signerDebtLiquidityTa,
115
+ positionDebtTa: (0, umi_1.publicKey)(this.positionDebtTa),
116
+ signerDebtTa: signerDebtTa,
115
117
  positionData: {
116
118
  positionId: this.positionId,
117
119
  settingParams: settingParams ?? null,
@@ -134,28 +136,85 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
134
136
  });
135
137
  }
136
138
  protocolInteraction(args) {
137
- return super
138
- .protocolInteraction(args)
139
- .add(this.marginfiProtocolInteractionIx(args));
139
+ let tx = super.protocolInteraction(args);
140
+ if (this.selfManaged) {
141
+ return tx.add(this.marginfiProtocolInteractionIx(args));
142
+ }
143
+ else {
144
+ return tx.add(this.marginfiSolautoProtocolInteractionIx(args));
145
+ }
140
146
  }
141
147
  marginfiProtocolInteractionIx(args) {
142
- let sourceSupplyTa = undefined;
148
+ switch (args.__kind) {
149
+ case "Deposit": {
150
+ console.log(args.fields[0]);
151
+ return (0, marginfi_sdk_1.lendingAccountDeposit)(this.umi, {
152
+ amount: args.fields[0],
153
+ signer: this.signer,
154
+ signerTokenAccount: (0, umi_1.publicKey)(this.signerSupplyTa),
155
+ marginfiAccount: (0, umi_1.publicKey)(this.marginfiAccountPk),
156
+ marginfiGroup: (0, umi_1.publicKey)(this.marginfiGroup),
157
+ bank: (0, umi_1.publicKey)(this.marginfiSupplyBankAccounts.bank),
158
+ bankLiquidityVault: (0, umi_1.publicKey)(this.marginfiSupplyBankAccounts.liquidityVault),
159
+ });
160
+ }
161
+ case "Borrow": {
162
+ return (0, marginfi_sdk_1.lendingAccountBorrow)(this.umi, {
163
+ amount: args.fields[0],
164
+ signer: this.signer,
165
+ destinationTokenAccount: (0, umi_1.publicKey)(this.signerDebtTa),
166
+ marginfiAccount: (0, umi_1.publicKey)(this.marginfiAccountPk),
167
+ marginfiGroup: (0, umi_1.publicKey)(this.marginfiGroup),
168
+ bank: (0, umi_1.publicKey)(this.marginfiDebtBankAccounts.bank),
169
+ bankLiquidityVault: (0, umi_1.publicKey)(this.marginfiDebtBankAccounts.liquidityVault),
170
+ bankLiquidityVaultAuthority: (0, umi_1.publicKey)(this.marginfiDebtBankAccounts.vaultAuthority),
171
+ });
172
+ }
173
+ case "Repay": {
174
+ return (0, marginfi_sdk_1.lendingAccountRepay)(this.umi, {
175
+ amount: args.fields[0].__kind === "Some" ? args.fields[0].fields[0] : 0,
176
+ repayAll: args.fields[0].__kind === "All" ? true : false,
177
+ signer: this.signer,
178
+ signerTokenAccount: (0, umi_1.publicKey)(this.signerDebtTa),
179
+ marginfiAccount: (0, umi_1.publicKey)(this.marginfiAccountPk),
180
+ marginfiGroup: (0, umi_1.publicKey)(this.marginfiGroup),
181
+ bank: (0, umi_1.publicKey)(this.marginfiDebtBankAccounts.bank),
182
+ bankLiquidityVault: (0, umi_1.publicKey)(this.marginfiDebtBankAccounts.liquidityVault),
183
+ });
184
+ }
185
+ case "Withdraw": {
186
+ return (0, marginfi_sdk_1.lendingAccountWithdraw)(this.umi, {
187
+ amount: args.fields[0].__kind === "Some" ? args.fields[0].fields[0] : 0,
188
+ withdrawAll: args.fields[0].__kind === "All" ? true : false,
189
+ signer: this.signer,
190
+ destinationTokenAccount: (0, umi_1.publicKey)(this.signerSupplyTa),
191
+ marginfiAccount: (0, umi_1.publicKey)(this.marginfiAccountPk),
192
+ marginfiGroup: (0, umi_1.publicKey)(this.marginfiGroup),
193
+ bank: (0, umi_1.publicKey)(this.marginfiSupplyBankAccounts.bank),
194
+ bankLiquidityVault: (0, umi_1.publicKey)(this.marginfiSupplyBankAccounts.liquidityVault),
195
+ bankLiquidityVaultAuthority: (0, umi_1.publicKey)(this.marginfiSupplyBankAccounts.vaultAuthority),
196
+ });
197
+ }
198
+ }
199
+ }
200
+ marginfiSolautoProtocolInteractionIx(args) {
201
+ let positionSupplyTa = undefined;
143
202
  let vaultSupplyTa = undefined;
144
203
  let supplyVaultAuthority = undefined;
145
204
  if (args.__kind === "Deposit" || args.__kind === "Withdraw") {
146
- sourceSupplyTa = (0, umi_1.publicKey)(args.__kind === "Withdraw" || this.selfManaged
147
- ? this.signerSupplyLiquidityTa
148
- : this.positionSupplyLiquidityTa);
205
+ positionSupplyTa = (0, umi_1.publicKey)(args.__kind === "Withdraw" || this.selfManaged
206
+ ? this.signerSupplyTa
207
+ : this.positionSupplyTa);
149
208
  vaultSupplyTa = (0, umi_1.publicKey)(this.marginfiSupplyBankAccounts.liquidityVault);
150
209
  supplyVaultAuthority = (0, umi_1.publicKey)(this.marginfiSupplyBankAccounts.vaultAuthority);
151
210
  }
152
- let sourceDebtTa = undefined;
211
+ let positionDebtTa = undefined;
153
212
  let vaultDebtTa = undefined;
154
213
  let debtVaultAuthority = undefined;
155
214
  if (args.__kind === "Borrow" || args.__kind === "Repay") {
156
- sourceDebtTa = (0, umi_1.publicKey)(args.__kind === "Borrow" || this.selfManaged
157
- ? this.signerDebtLiquidityTa
158
- : this.positionDebtLiquidityTa);
215
+ positionDebtTa = (0, umi_1.publicKey)(args.__kind === "Borrow" || this.selfManaged
216
+ ? this.signerDebtTa
217
+ : this.positionDebtTa);
159
218
  vaultDebtTa = (0, umi_1.publicKey)(this.marginfiDebtBankAccounts.liquidityVault);
160
219
  debtVaultAuthority = (0, umi_1.publicKey)(this.marginfiDebtBankAccounts.vaultAuthority);
161
220
  }
@@ -173,12 +232,12 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
173
232
  marginfiAccount: (0, umi_1.publicKey)(this.marginfiAccountPk),
174
233
  supplyBank: (0, umi_1.publicKey)(this.marginfiSupplyBankAccounts.bank),
175
234
  supplyPriceOracle,
176
- sourceSupplyTa,
235
+ positionSupplyTa,
177
236
  vaultSupplyTa,
178
237
  supplyVaultAuthority,
179
238
  debtBank: (0, umi_1.publicKey)(this.marginfiDebtBankAccounts.bank),
180
239
  debtPriceOracle,
181
- sourceDebtTa,
240
+ positionDebtTa,
182
241
  vaultDebtTa,
183
242
  debtVaultAuthority,
184
243
  solautoAction: args,
@@ -202,12 +261,14 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
202
261
  intermediaryTa: (0, umi_1.publicKey)((0, accountUtils_1.getTokenAccount)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), swapDetails.inputMint)),
203
262
  supplyBank: (0, umi_1.publicKey)(this.marginfiSupplyBankAccounts.bank),
204
263
  supplyPriceOracle: (0, umi_1.publicKey)(this.marginfiSupplyBankAccounts.priceOracle),
205
- positionSupplyTa: (0, umi_1.publicKey)(this.positionSupplyLiquidityTa),
264
+ positionSupplyTa: (0, umi_1.publicKey)(this.positionSupplyTa),
265
+ signerSupplyTa: this.selfManaged ? (0, umi_1.publicKey)(this.signerSupplyTa) : undefined,
206
266
  vaultSupplyTa: (0, umi_1.publicKey)(this.marginfiSupplyBankAccounts.liquidityVault),
207
267
  supplyVaultAuthority: (0, umi_1.publicKey)(this.marginfiSupplyBankAccounts.vaultAuthority),
208
268
  debtBank: (0, umi_1.publicKey)(this.marginfiDebtBankAccounts.bank),
209
269
  debtPriceOracle: (0, umi_1.publicKey)(this.marginfiDebtBankAccounts.priceOracle),
210
- positionDebtTa: (0, umi_1.publicKey)(this.positionDebtLiquidityTa),
270
+ positionDebtTa: (0, umi_1.publicKey)(this.positionDebtTa),
271
+ signerDebtTa: this.selfManaged ? (0, umi_1.publicKey)(this.signerDebtTa) : undefined,
211
272
  vaultDebtTa: (0, umi_1.publicKey)(this.marginfiDebtBankAccounts.liquidityVault),
212
273
  debtVaultAuthority: (0, umi_1.publicKey)(this.marginfiDebtBankAccounts.vaultAuthority),
213
274
  rebalanceType,
@@ -13,11 +13,11 @@ export type ClosePositionInstructionAccounts = {
13
13
  tokenProgram?: PublicKey | Pda;
14
14
  ataProgram?: PublicKey | Pda;
15
15
  solautoPosition: PublicKey | Pda;
16
- signerSupplyLiquidityTa: PublicKey | Pda;
17
- positionSupplyLiquidityTa: PublicKey | Pda;
16
+ signerSupplyTa: PublicKey | Pda;
17
+ positionSupplyTa: PublicKey | Pda;
18
18
  positionSupplyCollateralTa?: PublicKey | Pda;
19
- positionDebtLiquidityTa: PublicKey | Pda;
20
- signerDebtLiquidityTa: PublicKey | Pda;
19
+ positionDebtTa: PublicKey | Pda;
20
+ signerDebtTa: PublicKey | Pda;
21
21
  };
22
22
  export type ClosePositionInstructionData = {
23
23
  discriminator: number;
@@ -1 +1 @@
1
- {"version":3,"file":"closePosition.d.ts","sourceRoot":"","sources":["../../../src/generated/instructions/closePosition.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,OAAO,EACP,GAAG,EACH,SAAS,EACT,MAAM,EACN,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EAIX,MAAM,sCAAsC,CAAC;AAQ9C,MAAM,MAAM,gCAAgC,GAAG;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAChC,YAAY,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,UAAU,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC7B,eAAe,EAAE,SAAS,GAAG,GAAG,CAAC;IACjC,uBAAuB,EAAE,SAAS,GAAG,GAAG,CAAC;IACzC,yBAAyB,EAAE,SAAS,GAAG,GAAG,CAAC;IAC3C,0BAA0B,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC7C,uBAAuB,EAAE,SAAS,GAAG,GAAG,CAAC;IACzC,qBAAqB,EAAE,SAAS,GAAG,GAAG,CAAC;CACxC,CAAC;AAGF,MAAM,MAAM,4BAA4B,GAAG;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC;AAErE,MAAM,MAAM,gCAAgC,GAAG,EAAE,CAAC;AAElD,wBAAgB,yCAAyC,IAAI,UAAU,CACrE,gCAAgC,EAChC,4BAA4B,CAC7B,CAcA;AAGD,wBAAgB,aAAa,CAC3B,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,EAClC,KAAK,EAAE,gCAAgC,GACtC,kBAAkB,CAyGpB"}
1
+ {"version":3,"file":"closePosition.d.ts","sourceRoot":"","sources":["../../../src/generated/instructions/closePosition.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,OAAO,EACP,GAAG,EACH,SAAS,EACT,MAAM,EACN,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EAIX,MAAM,sCAAsC,CAAC;AAQ9C,MAAM,MAAM,gCAAgC,GAAG;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAChC,YAAY,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,UAAU,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC7B,eAAe,EAAE,SAAS,GAAG,GAAG,CAAC;IACjC,cAAc,EAAE,SAAS,GAAG,GAAG,CAAC;IAChC,gBAAgB,EAAE,SAAS,GAAG,GAAG,CAAC;IAClC,0BAA0B,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC7C,cAAc,EAAE,SAAS,GAAG,GAAG,CAAC;IAChC,YAAY,EAAE,SAAS,GAAG,GAAG,CAAC;CAC/B,CAAC;AAGF,MAAM,MAAM,4BAA4B,GAAG;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC;AAErE,MAAM,MAAM,gCAAgC,GAAG,EAAE,CAAC;AAElD,wBAAgB,yCAAyC,IAAI,UAAU,CACrE,gCAAgC,EAChC,4BAA4B,CAC7B,CAcA;AAGD,wBAAgB,aAAa,CAC3B,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,EAClC,KAAK,EAAE,gCAAgC,GACtC,kBAAkB,CAyGpB"}
@@ -48,30 +48,30 @@ function closePosition(context, input) {
48
48
  isWritable: true,
49
49
  value: input.solautoPosition ?? null,
50
50
  },
51
- signerSupplyLiquidityTa: {
51
+ signerSupplyTa: {
52
52
  index: 5,
53
53
  isWritable: true,
54
- value: input.signerSupplyLiquidityTa ?? null,
54
+ value: input.signerSupplyTa ?? null,
55
55
  },
56
- positionSupplyLiquidityTa: {
56
+ positionSupplyTa: {
57
57
  index: 6,
58
58
  isWritable: true,
59
- value: input.positionSupplyLiquidityTa ?? null,
59
+ value: input.positionSupplyTa ?? null,
60
60
  },
61
61
  positionSupplyCollateralTa: {
62
62
  index: 7,
63
63
  isWritable: true,
64
64
  value: input.positionSupplyCollateralTa ?? null,
65
65
  },
66
- positionDebtLiquidityTa: {
66
+ positionDebtTa: {
67
67
  index: 8,
68
68
  isWritable: true,
69
- value: input.positionDebtLiquidityTa ?? null,
69
+ value: input.positionDebtTa ?? null,
70
70
  },
71
- signerDebtLiquidityTa: {
71
+ signerDebtTa: {
72
72
  index: 9,
73
73
  isWritable: true,
74
- value: input.signerDebtLiquidityTa ?? null,
74
+ value: input.signerDebtTa ?? null,
75
75
  },
76
76
  };
77
77
  // Default values.
@@ -20,12 +20,12 @@ export type MarginfiProtocolInteractionInstructionAccounts = {
20
20
  marginfiAccount: PublicKey | Pda;
21
21
  supplyBank: PublicKey | Pda;
22
22
  supplyPriceOracle?: PublicKey | Pda;
23
- sourceSupplyTa?: PublicKey | Pda;
23
+ positionSupplyTa?: PublicKey | Pda;
24
24
  vaultSupplyTa?: PublicKey | Pda;
25
25
  supplyVaultAuthority?: PublicKey | Pda;
26
26
  debtBank: PublicKey | Pda;
27
27
  debtPriceOracle?: PublicKey | Pda;
28
- sourceDebtTa?: PublicKey | Pda;
28
+ positionDebtTa?: PublicKey | Pda;
29
29
  vaultDebtTa?: PublicKey | Pda;
30
30
  debtVaultAuthority?: PublicKey | Pda;
31
31
  };
@@ -1 +1 @@
1
- {"version":3,"file":"marginfiProtocolInteraction.d.ts","sourceRoot":"","sources":["../../../src/generated/instructions/marginfiProtocolInteraction.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,OAAO,EACP,GAAG,EACH,SAAS,EACT,MAAM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,iBAAiB,CAAC;CAClC,CAAC;AAEF,wBAAgB,uDAAuD,IAAI,UAAU,CACnF,8CAA8C,EAC9C,0CAA0C,CAC3C,CAkBA;AAGD,MAAM,MAAM,0CAA0C,GACpD,8CAA8C,CAAC;AAGjD,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,EAClC,KAAK,EAAE,8CAA8C,GACnD,0CAA0C,GAC3C,kBAAkB,CA6JpB"}
1
+ {"version":3,"file":"marginfiProtocolInteraction.d.ts","sourceRoot":"","sources":["../../../src/generated/instructions/marginfiProtocolInteraction.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;AAM9C,OAAO,EACL,aAAa,EACb,iBAAiB,EAElB,MAAM,UAAU,CAAC;AAGlB,MAAM,MAAM,8CAA8C,GAAG;IAC3D,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,SAAS,GAAG,GAAG,CAAC;IACjC,aAAa,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAChC,YAAY,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,UAAU,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC7B,IAAI,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACvB,eAAe,EAAE,SAAS,GAAG,GAAG,CAAC;IACjC,aAAa,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,eAAe,EAAE,SAAS,GAAG,GAAG,CAAC;IACjC,UAAU,EAAE,SAAS,GAAG,GAAG,CAAC;IAC5B,iBAAiB,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACpC,gBAAgB,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACnC,aAAa,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAChC,oBAAoB,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACvC,QAAQ,EAAE,SAAS,GAAG,GAAG,CAAC;IAC1B,eAAe,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAClC,cAAc,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACjC,WAAW,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC9B,kBAAkB,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;CACtC,CAAC;AAGF,MAAM,MAAM,0CAA0C,GAAG;IACvD,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,aAAa,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,8CAA8C,GAAG;IAC3D,aAAa,EAAE,iBAAiB,CAAC;CAClC,CAAC;AAEF,wBAAgB,uDAAuD,IAAI,UAAU,CACnF,8CAA8C,EAC9C,0CAA0C,CAC3C,CAkBA;AAGD,MAAM,MAAM,0CAA0C,GACpD,8CAA8C,CAAC;AAGjD,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,EAClC,KAAK,EAAE,8CAA8C,GACnD,0CAA0C,GAC3C,kBAAkB,CA6JpB"}
@@ -76,10 +76,10 @@ function marginfiProtocolInteraction(context, input) {
76
76
  isWritable: false,
77
77
  value: input.supplyPriceOracle ?? null,
78
78
  },
79
- sourceSupplyTa: {
79
+ positionSupplyTa: {
80
80
  index: 11,
81
81
  isWritable: true,
82
- value: input.sourceSupplyTa ?? null,
82
+ value: input.positionSupplyTa ?? null,
83
83
  },
84
84
  vaultSupplyTa: {
85
85
  index: 12,
@@ -101,10 +101,10 @@ function marginfiProtocolInteraction(context, input) {
101
101
  isWritable: false,
102
102
  value: input.debtPriceOracle ?? null,
103
103
  },
104
- sourceDebtTa: {
104
+ positionDebtTa: {
105
105
  index: 16,
106
106
  isWritable: true,
107
- value: input.sourceDebtTa ?? null,
107
+ value: input.positionDebtTa ?? null,
108
108
  },
109
109
  vaultDebtTa: {
110
110
  index: 17,
@@ -24,11 +24,13 @@ export type MarginfiRebalanceInstructionAccounts = {
24
24
  supplyBank: PublicKey | Pda;
25
25
  supplyPriceOracle?: PublicKey | Pda;
26
26
  positionSupplyTa: PublicKey | Pda;
27
+ signerSupplyTa?: PublicKey | Pda;
27
28
  vaultSupplyTa?: PublicKey | Pda;
28
29
  supplyVaultAuthority?: PublicKey | Pda;
29
30
  debtBank: PublicKey | Pda;
30
31
  debtPriceOracle?: PublicKey | Pda;
31
32
  positionDebtTa: PublicKey | Pda;
33
+ signerDebtTa?: PublicKey | Pda;
32
34
  vaultDebtTa?: PublicKey | Pda;
33
35
  debtVaultAuthority?: PublicKey | Pda;
34
36
  };
@@ -1 +1 @@
1
- {"version":3,"file":"marginfiRebalance.d.ts","sourceRoot":"","sources":["../../../src/generated/instructions/marginfiRebalance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,OAAO,EACP,MAAM,EACN,gBAAgB,EAChB,GAAG,EACH,SAAS,EACT,MAAM,EACN,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EAMX,MAAM,sCAAsC,CAAC;AAM9C,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EAEzB,MAAM,UAAU,CAAC;AAGlB,MAAM,MAAM,oCAAoC,GAAG;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,SAAS,GAAG,GAAG,CAAC;IACjC,aAAa,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAChC,YAAY,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,SAAS,EAAE,SAAS,GAAG,GAAG,CAAC;IAC3B,mBAAmB,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACtC,sBAAsB,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACzC,kBAAkB,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACrC,e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E,UAAU,CAAC,EAClC,KAAK,EAAE,oCAAoC,GAAG,gCAAgC,GAC7E,kBAAkB,CAmKpB"}
1
+ {"version":3,"file":"marginfiRebalance.d.ts","sourceRoot":"","sources":["../../../src/generated/instructions/marginfiRebalance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,OAAO,EACP,MAAM,EACN,gBAAgB,EAChB,GAAG,EACH,SAAS,EACT,MAAM,EACN,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EAMX,MAAM,sCAAsC,CAAC;AAM9C,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EAEzB,MAAM,UAAU,CAAC;AAGlB,MAAM,MAAM,oCAAoC,GAAG;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,SAAS,GAAG,GAAG,CAAC;IACjC,aAAa,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAChC,YAAY,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,SAAS,EAAE,SAAS,GAAG,GAAG,CAAC;IAC3B,mBAAmB,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACtC,sBAAsB,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACzC,kBAAkB,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACrC,eAAe,EAAE,SAAS,GAAG,GAAG,CAAC;IACjC,aAAa,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,eAAe,EAAE,SAAS,GAAG,GAAG,CAAC;IACjC,cAAc,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACjC,UAAU,EAAE,SAAS,GAAG,GAAG,CAAC;IAC5B,iBAAiB,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACpC,gBAAgB,EAAE,SAAS,GAAG,GAAG,CAAC;IAClC,cAAc,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACjC,aAAa,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAChC,oBAAoB,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACvC,QAAQ,EAAE,SAAS,GAAG,GAAG,CAAC;IAC1B,eAAe,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAClC,cAAc,EAAE,SAAS,GAAG,GAAG,CAAC;IAChC,YAAY,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,WAAW,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC9B,kBAAkB,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;CACtC,CAAC;AAGF,MAAM,MAAM,gCAAgC,GAAG;IAC7C,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,oBAAoB,CAAC;IACpC,2BAA2B,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5C,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG;IACjD,aAAa,EAAE,wBAAwB,CAAC;IACxC,2BAA2B,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACtD,WAAW,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;CACvC,CAAC;AAEF,wBAAgB,6CAA6C,IAAI,UAAU,CACzE,oCAAoC,EACpC,gCAAgC,CACjC,CAoBA;AAGD,MAAM,MAAM,gCAAgC,GAC1C,oCAAoC,CAAC;AAGvC,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,EAClC,KAAK,EAAE,oCAAoC,GAAG,gCAAgC,GAC7E,kBAAkB,CA6KpB"}
@@ -102,38 +102,48 @@ function marginfiRebalance(context, input) {
102
102
  isWritable: true,
103
103
  value: input.positionSupplyTa ?? null,
104
104
  },
105
- vaultSupplyTa: {
105
+ signerSupplyTa: {
106
106
  index: 15,
107
107
  isWritable: true,
108
+ value: input.signerSupplyTa ?? null,
109
+ },
110
+ vaultSupplyTa: {
111
+ index: 16,
112
+ isWritable: true,
108
113
  value: input.vaultSupplyTa ?? null,
109
114
  },
110
115
  supplyVaultAuthority: {
111
- index: 16,
116
+ index: 17,
112
117
  isWritable: true,
113
118
  value: input.supplyVaultAuthority ?? null,
114
119
  },
115
120
  debtBank: {
116
- index: 17,
121
+ index: 18,
117
122
  isWritable: true,
118
123
  value: input.debtBank ?? null,
119
124
  },
120
125
  debtPriceOracle: {
121
- index: 18,
126
+ index: 19,
122
127
  isWritable: false,
123
128
  value: input.debtPriceOracle ?? null,
124
129
  },
125
130
  positionDebtTa: {
126
- index: 19,
131
+ index: 20,
127
132
  isWritable: true,
128
133
  value: input.positionDebtTa ?? null,
129
134
  },
135
+ signerDebtTa: {
136
+ index: 21,
137
+ isWritable: true,
138
+ value: input.signerDebtTa ?? null,
139
+ },
130
140
  vaultDebtTa: {
131
- index: 20,
141
+ index: 22,
132
142
  isWritable: true,
133
143
  value: input.vaultDebtTa ?? null,
134
144
  },
135
145
  debtVaultAuthority: {
136
- index: 21,
146
+ index: 23,
137
147
  isWritable: true,
138
148
  value: input.debtVaultAuthority ?? null,
139
149
  },
@@ -1 +1 @@
1
- {"version":3,"file":"transactionUtils.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,EAClB,GAAG,EAGJ,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAGL,OAAO,IAAI,eAAe,EAC3B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEL,aAAa,EAQd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAgLzD,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,GACrB,OAAO,CAAC,kBAAkB,CAAC,CAsE7B;AA0DD,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,GACrB,OAAO,CAAC,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC,CA0BnD;AAED,wBAAsB,gCAAgC,CACpD,MAAM,EAAE,aAAa,EACrB,2BAA2B,CAAC,EAAE,MAAM,EACpC,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CACN;IACE,EAAE,EAAE,kBAAkB,CAAC;IACvB,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAChC,GACD,SAAS,CACZ,CA2GA;AAED,wBAAsB,gCAAgC,CACpD,GAAG,EAAE,GAAG,EACR,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,eAAe,GAC5B,OAAO,CAAC,CAAC,kBAAkB,EAAE,MAAM,EAAE,CAAC,CAAC,CA8BzC"}
1
+ {"version":3,"file":"transactionUtils.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,EAClB,GAAG,EAGJ,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAGL,OAAO,IAAI,eAAe,EAC3B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEL,aAAa,EAQd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAwLzD,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,GACrB,OAAO,CAAC,kBAAkB,CAAC,CAgE7B;AAgKD,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,GACrB,OAAO,CAAC,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC,CA0BnD;AAED,wBAAsB,gCAAgC,CACpD,MAAM,EAAE,aAAa,EACrB,2BAA2B,CAAC,EAAE,MAAM,EACpC,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CACN;IACE,EAAE,EAAE,kBAAkB,CAAC;IACvB,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAChC,GACD,SAAS,CACZ,CA2GA;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