Class: Solana::Ruby::Kit::InstructionPlans::MessagePacker

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/solana/ruby/kit/instruction_plans/instruction_plan.rb

Overview

Returned by MessagePackerInstructionPlan#get_message_packer. Mirrors the TypeScript MessagePacker interface.

Instance Method Summary collapse

Constructor Details

#initialize(done_proc:, pack_proc:) ⇒ MessagePacker

Returns a new instance of MessagePacker.



70
71
72
73
# File 'lib/solana/ruby/kit/instruction_plans/instruction_plan.rb', line 70

def initialize(done_proc:, pack_proc:)
  @done_proc = T.let(done_proc, T.untyped)
  @pack_proc = T.let(pack_proc, T.untyped)
end

Instance Method Details

#done?Boolean

Returns:

  • (Boolean)


77
78
79
# File 'lib/solana/ruby/kit/instruction_plans/instruction_plan.rb', line 77

def done?
  @done_proc.call
end

#pack_message_to_capacity(message, max_instructions: nil) ⇒ Object



93
94
95
# File 'lib/solana/ruby/kit/instruction_plans/instruction_plan.rb', line 93

def pack_message_to_capacity(message, max_instructions: nil)
  @pack_proc.call(message, max_instructions)
end