class TonSdk::Abi::Signer

Constants

TYPES

Attributes

handle[R]
keys[R]
public_key[R]
type_[R]

Public Class Methods

new(type_:, public_key: nil, keys: nil, handle: nil) click to toggle source
# File lib/ton_sdk_client/abi.rb, line 60
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

Public Instance Methods

to_h() click to toggle source
# File lib/ton_sdk_client/abi.rb, line 71
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