Class: TonSdkRuby::CommonMsgInfo

Inherits:
Object
  • Object
show all
Extended by:
TonSdkRuby
Includes:
TonSdkRuby
Defined in:
lib/ton-sdk-ruby/types/block.rb

Constant Summary

Constants included from TonSdkRuby

DEPTH_BITS, FLAG_BOUNCEABLE, FLAG_NON_BOUNCEABLE, FLAG_TEST_ONLY, HASH_BITS, INT32_MAX, INT32_MIN, LEAN_BOC_MAGIC_PREFIX, LEAN_BOC_MAGIC_PREFIX_CRC, REACH_BOC_MAGIC_PREFIX, VERSION

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from TonSdkRuby

augment, base64_to_bytes, bits_to_big_int, bits_to_big_uint, bits_to_bytes, bits_to_hex, bits_to_int_uint, breadth_first_sort, bytes_compare, bytes_needed_for_words_bip39, bytes_to_base64, bytes_to_bits, bytes_to_data_string, bytes_to_hex, bytes_to_string, bytes_to_uint, crc16, crc16_bytes_be, crc32c, crc32c_bytes_le, depth_first_sort, deserialize, deserialize_cell, deserialize_fift, deserialize_header, generate_words_bip39, get_mapper, hex_to_bits, hex_to_bytes, hex_to_data_string, read_json_from_link, read_post_json_from_link, require_type, rollback, serialize, serialize_cell, sha256, sha512, sign_cell, slice_into_chunks, string_to_bytes, uint_to_hex, validate_library_reference, validate_merkle_proof, validate_merkle_update, validate_ordinary, validate_pruned_branch

Constructor Details

#initialize(data) ⇒ CommonMsgInfo

Returns a new instance of CommonMsgInfo.



175
176
177
178
179
180
181
182
183
184
# File 'lib/ton-sdk-ruby/types/block.rb', line 175

def initialize(data)
  case data.tag
  when 'int_msg_info'
    int_msg_info(data)
  when 'ext_in_msg_info'
    ext_in_msg_info(data)
  else
    raise 'OutAction: unexpected tag'
  end
end

Instance Attribute Details

#cellObject (readonly)

Returns the value of attribute cell.



173
174
175
# File 'lib/ton-sdk-ruby/types/block.rb', line 173

def cell
  @cell
end

#dataObject (readonly)

Returns the value of attribute data.



173
174
175
# File 'lib/ton-sdk-ruby/types/block.rb', line 173

def data
  @data
end

Class Method Details

.parse(cs) ⇒ Object



220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# File 'lib/ton-sdk-ruby/types/block.rb', line 220

def self.parse(cs)
  frst = cs.load_bit

  if frst == 1
    scnd = cs.load_bit
    raise 'CommonMsgInfo: ext_out_msg_info unimplemented' if scnd == 1

    return new(ExtInMsgInfo.new(
      tag: 'ext_in_msg_info',
      src: cs.load_address,
      dest: cs.load_address,
      import_fee: cs.load_coins
    ))
  end

  if frst == 0
    data = IntMsgInfo.new({
                            tag: 'int_msg_info',
                            ihr_disabled: cs.load_bit == 1,
                            bounce: cs.load_bit == 1,
                            bounced: cs.load_bit == 1,
                            src: cs.load_address,
                            dest: cs.load_address,
                            value: cs.load_coins
                          })

    # TODO: support with ExtraCurrencyCollection
    cs.skip_bits(1)

    data.ihr_fee = cs.load_coins
    data.fwd_fee = cs.load_coins
    data.created_lt = cs.load_uint(64)
    data.created_at = cs.load_uint(32)

    return new(data)
  end

  raise 'CommonMsgInfo: invalid tag'
end