Class: Fireblocks::API::Transactions

Inherits:
Object
  • Object
show all
Defined in:
lib/fireblocks/api/transactions.rb

Constant Summary collapse

VALID_TRANSACTION_KEYS =
[
    :amount,
    :assetId,
    :source,
    :destination,
    :fee,
    :gasPrice,
    :note,
    :autoStaking,
    :networkStaking,
    :cpuStaking
]

Class Method Summary collapse

Class Method Details

.create(options) ⇒ Object



18
19
20
21
# File 'lib/fireblocks/api/transactions.rb', line 18

def create(options)
  body = options.slice(*VALID_TRANSACTION_KEYS)
  Fireblocks::Request.post(body: body, path: '/v1/transactions')
end

.from_vault_to_external(amount:, asset_id:, source_id:, destination_id:, one_time_address:, tag: nil) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/fireblocks/api/transactions.rb', line 23

def from_vault_to_external(
  amount:,
  asset_id:,
  source_id:,
  destination_id:,
  one_time_address:,
  tag: nil
)
  one_time_address_hash = {
    address: one_time_address
  }
  one_time_address_hash.merge(tag: tag) if tag

  body = {
    amount: amount,
    assetId: asset_id,
    source: {
      type: 'VAULT_ACCOUNT',
      id: source_id
    },
    destination: {
      type: 'EXTERNAL_WALLET',
      id: destination_id,
      oneTimeAddress: one_time_address_hash
    }
  }
  create(body)
end