Class: TonSdk::Abi::AbiContract
- Inherits:
-
Object
- Object
- TonSdk::Abi::AbiContract
- Defined in:
- lib/ton_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.
626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 |
# File 'lib/ton_sdk_client/abi.rb', line 626 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.
624 625 626 |
# File 'lib/ton_sdk_client/abi.rb', line 624 def abi_version @abi_version end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
624 625 626 |
# File 'lib/ton_sdk_client/abi.rb', line 624 def data @data end |
#events ⇒ Object (readonly)
Returns the value of attribute events.
624 625 626 |
# File 'lib/ton_sdk_client/abi.rb', line 624 def events @events end |
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
624 625 626 |
# File 'lib/ton_sdk_client/abi.rb', line 624 def fields @fields end |
#functions ⇒ Object (readonly)
Returns the value of attribute functions.
624 625 626 |
# File 'lib/ton_sdk_client/abi.rb', line 624 def functions @functions end |
#header ⇒ Object (readonly)
Returns the value of attribute header.
624 625 626 |
# File 'lib/ton_sdk_client/abi.rb', line 624 def header @header end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
624 625 626 |
# File 'lib/ton_sdk_client/abi.rb', line 624 def version @version end |
Class Method Details
.from_json(j) ⇒ Object
657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 |
# File 'lib/ton_sdk_client/abi.rb', line 657 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
644 645 646 647 648 649 650 651 652 653 654 655 |
# File 'lib/ton_sdk_client/abi.rb', line 644 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 |