pub struct FinalizeSettle<'a> {
pub program_id: Pubkey,
pub state_pda: Pubkey,
pub begin_ix_index: u16,
pub only_token_program: Option<TokenProgram>,
pub source_buffers: &'a [Pubkey],
pub destinations: &'a [Pubkey],
pub mints: &'a [Option<Pubkey>],
pub bumps: &'a [u8],
pub amounts: &'a [u64],
}Expand description
Builder for a FinalizeSettle instruction pushing the funds described by the
parallel lists:
source_buffers[i]is the account the funds come from: the buffer token account of the order’s buy mint, or the native SOL buffer for an order buying native SOL,destinations[i]is the account the funds go to (an order’s buy token account),mints[i]is the buy mint if the push usesTransferChecked, orNonefor plainTransferand for native SOL pushes, which ignore it,bumps[i]is the canonical bump ofsource_buffers[i], so the program re-derives that PDA with one hash instead of searching,amounts[i]is the amount to push, in the buy mint’s units or in lamports for a native SOL push.
This instruction comes in pair with a BeginSettle instruction. The slices
are assumed to be built in parallel with the order information specified in
BeginSettle. Notably, (1) the source buffer is the one corresponding to
the order’s buy token, and (2) the destinations must be the buy token
accounts specified in the corresponding order.
The slices are assumed to have the same length but this is not enforced by
the builder.
Wire format (with n total pushes):
[discriminator=1][begin_ix_index: u16 LE][bump: u8 ×n][amount: u64 LE ×n].
Required accounts:
[instructions_sysvar (R), state_pda (R), spl_token_program (R), token_2022_program (R)] followed, per push, by [source_buffer (W), destination (W), mint (R)]. The two token programs are the slots
TokenProgram::ALL describes, there to name the programs this
instruction’s pushes are issued against; the matching BeginSettle carries
the ones its pulls need.
A mint holding MINT_PLACEHOLDER makes the push a
plain Transfer; any other mint makes it a TransferChecked.
FinalizeSettle only executes the transfers. Every push is validated by
BeginSettle, which reads this instruction through introspection.
Fields§
§program_id: Pubkey§state_pda: Pubkey§begin_ix_index: u16§only_token_program: Option<TokenProgram>The only token program this settlement’s transfers are issued against,
or None to name every supported one; see TokenProgram::ALL.
source_buffers: &'a [Pubkey]§destinations: &'a [Pubkey]§mints: &'a [Option<Pubkey>]§bumps: &'a [u8]§amounts: &'a [u64]