Class: EverSdk::Abi::AbiContract
- Inherits:
-
Object
- Object
- EverSdk::Abi::AbiContract
- Defined in:
- lib/ever_sdk_client/abi.rb
Instance Attribute Summary collapse
-
#abi_version ⇒ Object
readonly
Returns the value of attribute abi_version.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#events ⇒ Object
readonly
Returns the value of attribute events.
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
-
#functions ⇒ Object
readonly
Returns the value of attribute functions.
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(abi_version: nil, version: nil, header: [], functions: [], events: [], data: [], fields: []) ⇒ AbiContract
constructor
A new instance of AbiContract.
- #to_h ⇒ Object
Constructor Details
#initialize(abi_version: nil, version: nil, header: [], functions: [], events: [], data: [], fields: []) ⇒ AbiContract
Returns a new instance of AbiContract.
646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 |
# File 'lib/ever_sdk_client/abi.rb', line 646 def initialize( abi_version: nil, version: nil, header: [], functions: [], events: [], data: [], fields: [] ) @abi_version = abi_version @version = version @header = header @functions = functions @events = events @data = data @fields = fields end |
Instance Attribute Details
#abi_version ⇒ Object (readonly)
Returns the value of attribute abi_version.
644 645 646 |
# File 'lib/ever_sdk_client/abi.rb', line 644 def abi_version @abi_version end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
644 645 646 |
# File 'lib/ever_sdk_client/abi.rb', line 644 def data @data end |
#events ⇒ Object (readonly)
Returns the value of attribute events.
644 645 646 |
# File 'lib/ever_sdk_client/abi.rb', line 644 def events @events end |
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
644 645 646 |
# File 'lib/ever_sdk_client/abi.rb', line 644 def fields @fields end |
#functions ⇒ Object (readonly)
Returns the value of attribute functions.
644 645 646 |
# File 'lib/ever_sdk_client/abi.rb', line 644 def functions @functions end |
#header ⇒ Object (readonly)
Returns the value of attribute header.
644 645 646 |
# File 'lib/ever_sdk_client/abi.rb', line 644 def header @header end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
644 645 646 |
# File 'lib/ever_sdk_client/abi.rb', line 644 def version @version end |
Class Method Details
.from_json(j) ⇒ Object
677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 |
# File 'lib/ever_sdk_client/abi.rb', line 677 def self.from_json(j) return nil if j.nil? fn_s = if j["functions"].nil? [] else j["functions"].compact.map { |x| AbiFunction.from_json(x) } end ev_s = if j["events"].nil? [] else j["events"].compact.map { |x| AbiEvent.from_json(x) } end dt_s = if j["data"].nil? [] else j["data"].compact.map {|x| AbiData.from_json(x) } end fl_s = if j["fields"].nil? [] else j["fields"].compact.map {|x| AbiParam.from_json(x) } end self.new( abi_version: j["ABI version"], version: j["version"], header: j["header"], functions: fn_s, events: ev_s, data: dt_s, fields: fl_s ) end |
Instance Method Details
#to_h ⇒ Object
664 665 666 667 668 669 670 671 672 673 674 675 |
# File 'lib/ever_sdk_client/abi.rb', line 664 def to_h { abi_version: @abi_version, :"ABI version" => @abi_version, #TODO version: @version, header: @header, functions: @functions&.map(&:to_h), events: @events&.map(&:to_h), data: @data&.map(&:to_h), fields: @fields&.map(&:to_h) } end |