Class: TonSdk::Abi::Signer
- Inherits:
-
Object
- Object
- TonSdk::Abi::Signer
- Defined in:
- lib/ton_sdk_client/abi.rb
Constant Summary collapse
- TYPES =
[:none, :external, :keys, :signing_box]
Instance Attribute Summary collapse
-
#handle ⇒ Object
readonly
Returns the value of attribute handle.
-
#keys ⇒ Object
readonly
Returns the value of attribute keys.
-
#public_key ⇒ Object
readonly
Returns the value of attribute public_key.
-
#type_ ⇒ Object
readonly
Returns the value of attribute type_.
Instance Method Summary collapse
-
#initialize(type_:, public_key: nil, keys: nil, handle: nil) ⇒ Signer
constructor
A new instance of Signer.
- #to_h ⇒ Object
Constructor Details
#initialize(type_:, public_key: nil, keys: nil, handle: nil) ⇒ Signer
Returns a new instance of Signer.
68 69 70 71 72 73 74 75 76 77 |
# File 'lib/ton_sdk_client/abi.rb', line 68 def initialize(type_:, public_key: nil, keys: nil, handle: nil) unless TYPES.include?(type_) raise ArgumentError.new("type #{type_} is unknown; known types: #{TYPES}") end @type_ = type_ @public_key = public_key @keys = keys @handle = handle end |
Instance Attribute Details
#handle ⇒ Object (readonly)
Returns the value of attribute handle.
66 67 68 |
# File 'lib/ton_sdk_client/abi.rb', line 66 def handle @handle end |
#keys ⇒ Object (readonly)
Returns the value of attribute keys.
66 67 68 |
# File 'lib/ton_sdk_client/abi.rb', line 66 def keys @keys end |
#public_key ⇒ Object (readonly)
Returns the value of attribute public_key.
66 67 68 |
# File 'lib/ton_sdk_client/abi.rb', line 66 def public_key @public_key end |
#type_ ⇒ Object (readonly)
Returns the value of attribute type_.
66 67 68 |
# File 'lib/ton_sdk_client/abi.rb', line 66 def type_ @type_ end |
Instance Method Details
#to_h ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/ton_sdk_client/abi.rb', line 79 def to_h h1 = { type: Helper.sym_to_capitalized_case_str(@type_) } h2 = case @type_ when :none { } when :external { public_key: @public_key } when :keys { keys: @keys.to_h } when :signing_box { handle: @handle } end h1.merge(h2) end |