@0dotxyz/p0-ts-sdk 3.0.0-next.3 → 3.0.1-alpha.0

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.
package/dist/index.d.cts CHANGED
@@ -1197,6 +1197,12 @@ interface AppendPremiumRefreshParams extends MakePremiumRefreshIxsParams {
1197
1197
  }
1198
1198
  interface MakeDepositTxParams extends MakeDepositIxParams, ActionTxParams, PremiumRefreshParams, OrderChangesParams {
1199
1199
  bankMetadataMap: BankIntegrationMetadataMap;
1200
+ /**
1201
+ * Put in the deposit transaction ahead of the deposit's own instructions (after any order
1202
+ * closes), e.g. `makeCreateAccountIx` to open `marginfiAccount` (built with
1203
+ * `makeCreateAccountIxWithProjection`) and fund it in one transaction.
1204
+ */
1205
+ prependedIxs?: Instruction[];
1200
1206
  }
1201
1207
  interface MakeRepayIxOpts extends WrapSolOpts {
1202
1208
  /** Transaction builders only: don't add `pulse_health` (see {@link PremiumRefreshParams}) */
@@ -1520,6 +1526,7 @@ interface MakeLoopTxParams extends SwapFlowTxParams {
1520
1526
  tokenProgram: Address;
1521
1527
  marketPrice: number;
1522
1528
  };
1529
+ /** Put first in the prelude transactions, which land before the flashloan transactions. */
1523
1530
  additionalIxs?: Instruction[];
1524
1531
  /**
1525
1532
  * Places a take-profit / stop-loss order with this trigger on the loop's pair (deposit bank as
@@ -1682,6 +1689,7 @@ interface MakeSwapDebtTxParams extends SwapFlowTxParams {
1682
1689
  tokenProgram: Address;
1683
1690
  marketPrice: number;
1684
1691
  };
1692
+ /** Put first in the prelude transactions, which land before the flashloan transactions. */
1685
1693
  additionalIxs?: Instruction[];
1686
1694
  }
1687
1695
  interface MakeCreateMissingAtaIxsParams {
package/dist/index.d.ts CHANGED
@@ -1197,6 +1197,12 @@ interface AppendPremiumRefreshParams extends MakePremiumRefreshIxsParams {
1197
1197
  }
1198
1198
  interface MakeDepositTxParams extends MakeDepositIxParams, ActionTxParams, PremiumRefreshParams, OrderChangesParams {
1199
1199
  bankMetadataMap: BankIntegrationMetadataMap;
1200
+ /**
1201
+ * Put in the deposit transaction ahead of the deposit's own instructions (after any order
1202
+ * closes), e.g. `makeCreateAccountIx` to open `marginfiAccount` (built with
1203
+ * `makeCreateAccountIxWithProjection`) and fund it in one transaction.
1204
+ */
1205
+ prependedIxs?: Instruction[];
1200
1206
  }
1201
1207
  interface MakeRepayIxOpts extends WrapSolOpts {
1202
1208
  /** Transaction builders only: don't add `pulse_health` (see {@link PremiumRefreshParams}) */
@@ -1520,6 +1526,7 @@ interface MakeLoopTxParams extends SwapFlowTxParams {
1520
1526
  tokenProgram: Address;
1521
1527
  marketPrice: number;
1522
1528
  };
1529
+ /** Put first in the prelude transactions, which land before the flashloan transactions. */
1523
1530
  additionalIxs?: Instruction[];
1524
1531
  /**
1525
1532
  * Places a take-profit / stop-loss order with this trigger on the loop's pair (deposit bank as
@@ -1682,6 +1689,7 @@ interface MakeSwapDebtTxParams extends SwapFlowTxParams {
1682
1689
  tokenProgram: Address;
1683
1690
  marketPrice: number;
1684
1691
  };
1692
+ /** Put first in the prelude transactions, which land before the flashloan transactions. */
1685
1693
  additionalIxs?: Instruction[];
1686
1694
  }
1687
1695
  interface MakeCreateMissingAtaIxsParams {
package/dist/index.js CHANGED
@@ -17899,7 +17899,7 @@ async function makeDepositIx2({
17899
17899
  return depositIxs;
17900
17900
  }
17901
17901
  async function makeDepositTx(params) {
17902
- const { rpc, txFormat, latestBlockhash, bankMap, ...depositIxParams } = params;
17902
+ const { rpc, txFormat, latestBlockhash, bankMap, prependedIxs = [], ...depositIxParams } = params;
17903
17903
  const { bank, bankMetadataMap } = params;
17904
17904
  if (exceedsCostlyPositionLimit(params.marginfiAccount.balances, bankMap, bank)) {
17905
17905
  throw TransactionBuildingError.costlyPositionLimitExceeded(bank.address);
@@ -17910,7 +17910,7 @@ async function makeDepositTx(params) {
17910
17910
  const refreshIxs = kaminoAccounts && reserve ? makeRefreshingIxs(kaminoAccounts.kaminoReserve, reserve, kaminoAccounts.kaminoObligation) : [];
17911
17911
  const actionIxs = await prependOrderCloses({
17912
17912
  ...params,
17913
- actionIxs: [...refreshIxs, ...depositIxs],
17913
+ actionIxs: [...prependedIxs, ...refreshIxs, ...depositIxs],
17914
17914
  txFormat: selectLutsForBanks(txFormat, [bank])
17915
17915
  });
17916
17916
  const { instructions: txIxs, txFormat: selectedFormat } = await appendPremiumRefresh({