@0dotxyz/p0-ts-sdk 2.5.5-alpha.0 → 2.5.5-alpha.2

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.js CHANGED
@@ -70197,6 +70197,13 @@ async function buildInnerIxs(ctx, positions, isSync) {
70197
70197
  withdrawIxs.push(...legs.withdrawIxs);
70198
70198
  depositIxs.push(...legs.depositIxs);
70199
70199
  }
70200
+ const transferredKaminoPks = collateral.filter((p) => p.bank.config.assetTag === 3 /* KAMINO */).map((p) => p.bankAddress);
70201
+ const kaminoReRefreshIxs = transferredKaminoPks.length > 0 ? makeRefreshKaminoBanksIxs(
70202
+ ctx.accountA,
70203
+ ctx.bankMap,
70204
+ transferredKaminoPks,
70205
+ ctx.bankMetadataMap
70206
+ ).instructions : [];
70200
70207
  const borrowedSoFar = [];
70201
70208
  for (const position of debts) {
70202
70209
  const { bank, tokenProgram } = position;
@@ -70241,7 +70248,14 @@ async function buildInnerIxs(ctx, positions, isSync) {
70241
70248
  });
70242
70249
  repayIxs.push(...repay.instructions);
70243
70250
  }
70244
- return [...CU_IXS(), ...withdrawIxs, ...depositIxs, ...borrowIxs, ...repayIxs];
70251
+ return [
70252
+ ...CU_IXS(),
70253
+ ...withdrawIxs,
70254
+ ...kaminoReRefreshIxs,
70255
+ ...depositIxs,
70256
+ ...borrowIxs,
70257
+ ...repayIxs
70258
+ ];
70245
70259
  }
70246
70260
  async function buildTransferFlashloanTx(args) {
70247
70261
  const { program, accountA, projectedActiveBanksA, innerIxs, preIxs, blockhash, luts } = args;
@@ -70368,8 +70382,15 @@ async function makeTransferPositionsTx(params) {
70368
70382
  )
70369
70383
  );
70370
70384
  }
70385
+ const destinationOnlyBalances = accountB.balances.filter(
70386
+ (b) => b.active && !accountA.balances.some((a) => a.active && a.bankPk.equals(b.bankPk))
70387
+ );
70388
+ const crankBalanceView = {
70389
+ ...accountA,
70390
+ balances: [...accountA.balances, ...destinationOnlyBalances]
70391
+ };
70371
70392
  const { instructions: updateFeedIxs, luts: feedLuts } = await makeSmartCrankSwbFeedIx({
70372
- marginfiAccount: accountA,
70393
+ marginfiAccount: crankBalanceView,
70373
70394
  bankMap,
70374
70395
  oraclePrices,
70375
70396
  assetShareValueMultiplierByBank,