From d62d1d670a6dffe1ef0914cd6e8a0b20b150980e Mon Sep 17 00:00:00 2001 From: lukas Date: Sun, 8 Sep 2024 15:08:09 +0200 Subject: [PATCH] feat: disband --- src/main/basedbot/lib/sage/act/disband-fleet.ts | 5 +++-- src/main/basedbot/lib/sage/ix/disbanded-fleet-to-escrow.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/basedbot/lib/sage/act/disband-fleet.ts b/src/main/basedbot/lib/sage/act/disband-fleet.ts index 1f6358c..3b64556 100644 --- a/src/main/basedbot/lib/sage/act/disband-fleet.ts +++ b/src/main/basedbot/lib/sage/act/disband-fleet.ts @@ -9,6 +9,7 @@ import { disbandedFleetToEscrowIx } from '../ix/disbanded-fleet-to-escrow' import { getFleetShips } from '../state/get-fleet-ships' import { getStarbasePlayer } from '../state/starbase-player' import { Player } from '../state/user-account' +import { getName } from '../util' export const disbandFleet = async ( player: Player, @@ -46,7 +47,7 @@ export const disbandFleet = async ( starbase, starbasePlayer, programs, - shipEscrowIndex, + shipEscrowIndex === -1 ? null : shipEscrowIndex, disbandedFleetKey[0], fleet.data.fleetShips, fleetShipInfo.ship, @@ -54,7 +55,6 @@ export const disbandFleet = async ( fleetShipInfo.amount, ), ) - console.log('Pushed disbanded fleet to escrow instruction') i += 1 } @@ -66,6 +66,7 @@ export const disbandFleet = async ( fleet.data.fleetShips, ), ) + console.log(`Added ${ixs.length} ixs for disbanding fleet ${getName(fleet)}`) await sendAndConfirmInstructions(await ixReturnsToIxs(ixs, player.signer)) } diff --git a/src/main/basedbot/lib/sage/ix/disbanded-fleet-to-escrow.ts b/src/main/basedbot/lib/sage/ix/disbanded-fleet-to-escrow.ts index 69c36cd..4392489 100644 --- a/src/main/basedbot/lib/sage/ix/disbanded-fleet-to-escrow.ts +++ b/src/main/basedbot/lib/sage/ix/disbanded-fleet-to-escrow.ts @@ -12,7 +12,7 @@ export const disbandedFleetToEscrowIx = ( starbase: Starbase, starbasePlayer: StarbasePlayer, programs: StarAtlasPrograms, - shipEscrowIndex: number, + shipEscrowIndex: number | null, disbandedFleet: PublicKey, fleetShips: PublicKey, shipKey: PublicKey,