Class: Keoken::Backend::Trezor::Transaction

Inherits:
Base
  • Object
show all
Defined in:
lib/keoken/backend/trezor/transaction.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#bitprim_transaction, #inputs, #total_inputs_amount

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Keoken::Backend::Base

Instance Attribute Details

#to_jsonObject

Returns the value of attribute to_json


7
8
9
# File 'lib/keoken/backend/trezor/transaction.rb', line 7

def to_json
  @to_json
end

Instance Method Details

#build_for_creation(address, path, script, xpubs = []) ⇒ Keoken::Backend::Trezor::Transaction

Create the transaction to broadcast in order to create tokens.

Parameters:

  • address (String)
    Address that will contain the token.
  • path (Array)
    Address derivation path.
  • script (String)
    The token script.
  • xpubs (Array) (defaults to: [])
    The xpubs corresponding to the multisig address.

Returns:



18
19
20
21
22
23
# File 'lib/keoken/backend/trezor/transaction.rb', line 18

def build_for_creation(address, path, script, xpubs = [])
  build_inputs(address)
  total, fee = build_fee(:create)
  output_amount = total - fee.to_i
  create(@inputs, path, address, output_amount, script, xpubs)
end

#build_for_send_amount(address, address_dest, path, script, xpubs = []) ⇒ Keoken::Backend::Trezor::Transaction

Create the transaction to broadcast in order to send amount between tokens.

Parameters:

  • address (String)
    Address that will contain the token.
  • address_dest (String)
    Address to receive the tokens.
  • path (Array)
    Address derivation path.
  • script (String)
    The token script.
  • xpubs (Array) (defaults to: [])
    The xpubs corresponding to the multisig address.

Returns:



35
36
37
38
39
40
41
# File 'lib/keoken/backend/trezor/transaction.rb', line 35

def build_for_send_amount(address, address_dest, path, script, xpubs = [])
  build_inputs(address)
  total, fee = build_fee(:send)
  output_amount = total - (fee.to_i * 2)
  output_amount_to_addr2 = fee.to_i
  send(@inputs, path, output_amount, address, output_amount_to_addr2, address_dest, script, xpubs)
end