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.



58
59
60
61
# File 'lib/solana/ruby/kit/instruction_plans/instruction_plan.rb', line 58

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)


65
66
67
# File 'lib/solana/ruby/kit/instruction_plans/instruction_plan.rb', line 65

def done?
  @done_proc.call
end

#pack_message_to_capacity(message, max_instructions: nil) ⇒ Object



81
82
83
# File 'lib/solana/ruby/kit/instruction_plans/instruction_plan.rb', line 81

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