MessagePacker
The message packer returned by the MessagePackerInstructionPlan.
It offers a packMessageToCapacity(transactionMessage) method that packs as many instructions
as possible into the provided transaction message, while still being able to fit into the
transaction size limit and the default or configured instruction-count limit. It returns the updated
transaction message with the packed instructions or throws an error if the current transaction
message cannot accommodate this plan.
The done() method checks whether there are more instructions to pack into
transaction messages.
Custom message packers can rely on resolveMaxInstructionsPerTransaction, assertMaxInstructionsPerTransaction and assertMessageCanAccommodateSize to enforce the instruction-count and size limits, and may throw SOLANA_ERROR__INSTRUCTION_PLANS__MESSAGE_REJECTED_BY_PACKER to refuse a message for any other reason. Consumers can use isMessagePackerErrorThatRequiresNewCandidate to identify errors that call for a new transaction message.