Class: EverSdk::Abi::AbiEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/ever_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.



498
499
500
501
502
# File 'lib/ever_sdk_client/abi.rb', line 498

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

Instance Attribute Details

#id_Object (readonly)

Returns the value of attribute id_.



496
497
498
# File 'lib/ever_sdk_client/abi.rb', line 496

def id_
  @id_
end

#inputsObject (readonly)

Returns the value of attribute inputs.



496
497
498
# File 'lib/ever_sdk_client/abi.rb', line 496

def inputs
  @inputs
end

#nameObject (readonly)

Returns the value of attribute name.



496
497
498
# File 'lib/ever_sdk_client/abi.rb', line 496

def name
  @name
end

Class Method Details

.from_json(j) ⇒ Object



518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
# File 'lib/ever_sdk_client/abi.rb', line 518

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



504
505
506
507
508
509
510
511
512
513
514
515
516
# File 'lib/ever_sdk_client/abi.rb', line 504

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