Class: Sigma::TokenAmount

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pointerObject

Returns the value of attribute pointer.



14
15
16
# File 'lib/sigma/token.rb', line 14

def pointer
  @pointer
end

Class Method Details

.with_i64(int) ⇒ TokenAmount

Create instance from 64-bit Integer with bounds check

Parameters:

  • int (Integer)

Returns:



27
28
29
30
31
32
33
# File 'lib/sigma/token.rb', line 27

def self.with_i64(int)
  ptr = FFI::MemoryPointer.new(:pointer)
  error = ergo_lib_token_amount_from_i64(int, ptr)
  Util.check_error!(error)

  init(ptr)
end

.with_raw_pointer(unread_pointer) ⇒ TokenAmount

Note:

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

Takes ownership of an existing TokenAmount Pointer.

Parameters:

  • pointer (FFI::MemoryPointer)

Returns:



20
21
22
# File 'lib/sigma/token.rb', line 20

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

Instance Method Details

#==(token_amount_two) ⇒ bool

Equality check

Parameters:

Returns:

  • (bool)


44
45
46
# File 'lib/sigma/token.rb', line 44

def ==(token_amount_two)
  ergo_lib_token_amount_eq(self.pointer, token_amount_two.pointer)
end

#to_iInteger

Get value as 64-bit integer

Returns:

  • (Integer)


37
38
39
# File 'lib/sigma/token.rb', line 37

def to_i
  ergo_lib_token_amount_as_i64(self.pointer)
end