Class: Sigma::ErgoBoxAssetsData

Inherits:
Object
  • Object
show all
Extended by:
FFI::Library
Defined in:
lib/sigma/ergo_box.rb

Overview

Pair of (value, tokens) for a box

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pointerObject

Returns the value of attribute pointer.



602
603
604
# File 'lib/sigma/ergo_box.rb', line 602

def pointer
  @pointer
end

Class Method Details

.create(box_value:, tokens:) ⇒ ErgoBoxAssetsData

Create new instance

Parameters:

Returns:



608
609
610
611
612
# File 'lib/sigma/ergo_box.rb', line 608

def self.create(box_value:, tokens:)
  pointer = FFI::MemoryPointer.new(:pointer)
  ergo_lib_ergo_box_assets_data_new(box_value.pointer, tokens.pointer, pointer)
  init(pointer)
end

.with_raw_pointer(pointer) ⇒ ErgoBoxAssetsData

Note:

A user of sigma_rb generally does not need to call this function

Takes ownership of an existing ErgoBoxAssetsData Pointer.

Parameters:

  • pointer (FFI::MemoryPointer)

Returns:



618
619
620
# File 'lib/sigma/ergo_box.rb', line 618

def self.with_raw_pointer(pointer)
  init(pointer)
end

Instance Method Details

#==(eb_asset_data_two) ⇒ bool

Equality check

Parameters:

Returns:

  • (bool)


641
642
643
# File 'lib/sigma/ergo_box.rb', line 641

def ==(eb_asset_data_two)
  ergo_lib_ergo_box_assets_data_eq(self.pointer, eb_asset_data_two.pointer)
end

#get_box_tokensTokens

get box tokens

Returns:



632
633
634
635
636
# File 'lib/sigma/ergo_box.rb', line 632

def get_box_tokens
  pointer = FFI::MemoryPointer.new(:pointer)
  ergo_lib_ergo_box_assets_data_tokens(self.pointer, pointer)
  Sigma::Tokens.with_raw_pointer(pointer)
end

#get_box_valueBoxValue

get box value

Returns:



624
625
626
627
628
# File 'lib/sigma/ergo_box.rb', line 624

def get_box_value
  pointer = FFI::MemoryPointer.new(:pointer)
  ergo_lib_ergo_box_assets_data_value(self.pointer, pointer)
  Sigma::BoxValue.with_raw_pointer(pointer)
end