Class: TonSdk::Abi::AbiEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/ton_sdk_client/abi.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, inputs:, id_:) ⇒ AbiEvent

Returns a new instance of AbiEvent.



478
479
480
481
482
# File 'lib/ton_sdk_client/abi.rb', line 478

def initialize(name:, inputs:, id_:)
  @name = name
  @inputs = inputs
  @id_ = id_
end

Instance Attribute Details

#id_Object (readonly)

Returns the value of attribute id_.



476
477
478
# File 'lib/ton_sdk_client/abi.rb', line 476

def id_
  @id_
end

#inputsObject (readonly)

Returns the value of attribute inputs.



476
477
478
# File 'lib/ton_sdk_client/abi.rb', line 476

def inputs
  @inputs
end

#nameObject (readonly)

Returns the value of attribute name.



476
477
478
# File 'lib/ton_sdk_client/abi.rb', line 476

def name
  @name
end

Class Method Details

.from_json(j) ⇒ Object



498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
# File 'lib/ton_sdk_client/abi.rb', line 498

def self.from_json(j)
  return nil if j.nil?

  inp_s = if j["inputs"].nil?
    []
  else
    j["inputs"].compact.map do |x|
      # TODO recursive parsing of AbiParam
      AbiParam.from_json(x)
    end
  end

  self.new(
    name: j["name"],
    inputs: inp_s,
    id_: j["id"],
  )
end

Instance Method Details

#to_hObject



484
485
486
487
488
489
490
491
492
493
494
495
496
# File 'lib/ton_sdk_client/abi.rb', line 484

def to_h
  in_h_s = if !@inputs.nil?
    @inputs.compact.map(&:to_h)
  else
    []
  end

  {
    name: @name,
    inputs: in_h_s,
    id: @id_
  }
end