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.



598
599
600
# File 'lib/sigma/ergo_box.rb', line 598

def pointer
  @pointer
end

Class Method Details

.create(box_value:, tokens:) ⇒ ErgoBoxAssetsData

Create new instance

Parameters:

Returns:



604
605
606
607
608
# File 'lib/sigma/ergo_box.rb', line 604

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:



614
615
616
# File 'lib/sigma/ergo_box.rb', line 614

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

Instance Method Details

#==(eb_asset_data_two) ⇒ bool

Equality check

Parameters:

Returns:

  • (bool)


637
638
639
# File 'lib/sigma/ergo_box.rb', line 637

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:



628
629
630
631
632
# File 'lib/sigma/ergo_box.rb', line 628

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:



620
621
622
623
624
# File 'lib/sigma/ergo_box.rb', line 620

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