FireblocksSdk.Api.Transaction (FireblocksSdk v0.2.1)

Copy Markdown View Source

Summary

Functions

Cancels a transaction by ID.

Creates a new transaction with the specified options

Drops a stuck ETH transaction and creates a replacement transaction.

Estimates the transaction fee for a transaction request.

Freezes a transaction by ID.

Returns a transaction by ID.

Gets the estimated required fee for an asset. Fireblocks fetches, calculates and caches the result every 30 seconds.

Returns transaction by external transaction ID.

List all transactions

Overrides the required number of confirmations for transaction completion by transaction ID.

Unfreezes a transaction by ID and makes the transaction available again.

Functions

cancel(txId, idempotencyKey \\ "")

Cancels a transaction by ID.

  • txId: Fireblocks transaction id

create(transaction, idempotent_key \\ "")

Creates a new transaction with the specified options

FireblocksSdk.Api.Transaction.create([
  assetId: "ETH",
  operation: :transfer, # :mint | :burn | :raw
  source: %{
    type: :vault_account,
    id: "1"
  },
  destination: %{
    type: :vault_account,
    id: "2"
  },
  amount: "0.005",
  note: "donation!"
])

Supported options:

  • :assetId (String.t/0)

  • :source (map/0)

    • :type - one of :vault_account, :exchange_account, :internal_wallet, :external_wallet, :unknown, :network_connection, :fiat_account, :compound, :one_time_address, :oec_partner

    • :id (String.t/0)

    • :virtualId (String.t/0)

    • :virtualType

    • :address (String.t/0)

  • :destination (map/0)

    • :type - one of :vault_account, :exchange_account, :internal_wallet, :external_wallet, :unknown, :network_connection, :fiat_account, :compound, :one_time_address, :oec_partner

    • :id (String.t/0)

    • :virtualId (String.t/0)

    • :virtualType

    • :oneTimeAddress (map/0)

  • :amount (String.t/0) - For TRANSFER operations, the requested amount to transfer, in the asset's unit.

  • :operation - available value :transfer, :mint, :burn, :contract_call, :program_call, :raw, :typed_message, :approve, :enable_asset

  • :fee (String.t/0)

  • :feeLevel - For UTXO or EVM-based blockchains only. Defines the blockchain fee level which will be payed for the transaction. Alternatively, specific fee estimation parameters exist below.

  • :failOnLowFee (boolean/0)

  • :maxFee (String.t/0)

  • :priorityFee (String.t/0)

  • :gasPrice (String.t/0) - For non-EIP-1559, EVM-based transactions. Price per gas unit (in Ethereum this is specified in Gwei).

    Note: Only two of the three arguments can be specified in a single transaction: gasLimit, gasPrice and networkFee. Fireblocks recommends using a numeric string for accurate precision. Although a number input exists, it is deprecated.

  • :gasLimit (String.t/0)

  • :note (String.t/0)

  • :cpuStaking (integer/0)

  • :networkStaking (integer/0)

  • :autoStaking (boolean/0)

  • :customerRefId (String.t/0)

  • :extraParameters (map/0)

  • :destinations (map/0)

  • :replaceTxByHash (String.t/0) - For EVM-based blockchains only. In case a transaction is stuck, specify the hash of the stuck transaction to replace it by this transaction with a higher fee, or to replace it with this transaction with a zero fee and drop it from the blockchain.

  • :externalTxId (String.t/0)

  • :treatAsGrossAmount (boolean/0) - When set to true, the fee will be deducted from the requested amount.

    Note: This parameter can only be considered if a transaction's asset is a base asset, such as ETH or MATIC. If the asset can't be used for transaction fees, like USDC, this parameter is ignored and the fee is deducted from the relevant base asset wallet in the source account.

  • :forceSweep (boolean/0) - For Polkadot, Kusama and Westend transactions only. When set to true, Fireblocks will empty the asset wallet.

    Note: If set to true when the source account is exactly 1 DOT, the transaction will fail. Any amount more or less than 1 DOT succeeds. This is a Polkadot blockchain limitation.

  • :feePayerInfo (map/0)

  • :travelRuleMessageId (String.t/0)

  • :useGasless (boolean/0)

drop(tx_drop_req, idempotencyKey \\ "")

Drops a stuck ETH transaction and creates a replacement transaction.

  FireblocksSdk.Api.Transaction.drop([
    txId: "fireblock-tx-id",
    feeLevel: :medium,
    gasFee: ""
  ])

Options:

estimate_fee(transaction, idempotent_key \\ "")

Estimates the transaction fee for a transaction request.

Note: Supports all Fireblocks assets except ZCash (ZEC).

freeze(txId, idempotencyKey \\ "")

Freezes a transaction by ID.

  • txId: Fireblocks transaction id

get(txId)

Returns a transaction by ID.

  • txId: Fireblocks transaction id

get_asset_fee(asset)

Gets the estimated required fee for an asset. Fireblocks fetches, calculates and caches the result every 30 seconds.

Customers should query this API while taking the caching interval into consideration.

Options:

  • asset: The asset for which to estimate the fee

Notes:

  • The networkFee parameter is the gasPrice with a given delta added, multiplied by the gasLimit plus the delta. - The estimation provided depends on the asset type.

  • For UTXO-based assets, the response contains the feePerByte parameter

  • For ETH-based and all EVM based assets, the response will contain gasPrice parameter. This is calculated by adding the baseFee to the actualPriority based on the latest 12 blocks. The response for ETH-based contains the baseFee, gasPrice, and priorityFee parameters.

  • For ADA-based assets, the response will contain the parameter networkFee and feePerByte parameters.

  • For XRP and XLM, the response will contain the transaction fee.

  • For other assets, the response will contain the networkFee parameter.

Learn more about Fireblocks Fee Management in the following guide.

Endpoint Permission: Admin, Non-Signing Admin, Signer, Approver, Editor.

get_external_tx_id(exteralTxId)

Returns transaction by external transaction ID.

  • externalTxId: The external ID of the transaction to return

list(filter)

List all transactions

FireblocksSdk.Api.Transaction.list([
  status: :rejected,
  sourceType: :vault_account,
  sourceId: "1",
  limit: 10
])

Options:

  • :before (String.t/0) - Unix timestamp in milliseconds. Returns only transactions created before the specified date

  • :after (String.t/0) - Unix timestamp in milliseconds. Returns only transactions created after the specified date

  • :status - available values :submitted, :queued, :pending_signature, :pending_authorization, :pending_3rd_party_manual_approval, :pending_3rd_party, :broadcasting, :confirming, :completed, :pending_aml_screening, :partially_completed, :cancelling, :cancelled, :rejected, :failed, :timeout, :blocked

  • :orderBy - available values :createdAt, :lastUpdated

  • :sort - one of :asc or :desc

  • :limit (integer/0) - Limits the number of results. If not provided, a limit of 200 will be used. The maximum allowed limit is 500

  • :txHash (String.t/0) - Returns only results with a specified txHash

  • :assets (String.t/0) - A list of assets to filter by, seperated by commas

  • :sourceType - one of :vault_account, :exchange_account, :internal_wallet, :external_wallet, :unknown, :network_connection, :fiat_account, :compound, :one_time_address, :oec_partner

  • :destType - one of :vault_account, :exchange_account, :internal_wallet, :external_wallet, :unknown, :network_connection, :fiat_account, :compound, :one_time_address, :oec_partner

  • :sourceId (String.t/0)

  • :destId (String.t/0) - The destination ID of the transaction

  • :sourceWalletId (String.t/0) - Returns only results where the source is a specific end user wallet

  • :destWalletId (String.t/0) - Returns only results where the destination is a specific end user wallet

  • :next (String.t/0) - Retrieve the next page of results

  • :prev (String.t/0) - Retrieve the previous page of results

set_confirmation_threshold(threshold, idempotencyKey \\ "")

Overrides the required number of confirmations for transaction completion by transaction ID.

Options:

  • :type - available value :txId, :txHash

  • :id (String.t/0) - Fireblocks transaction id or blockchain transaction hash

  • :numOfConfirmations (integer/0) - The default value is 0.

unfreeze(txId, idempotencyKey \\ "")

Unfreezes a transaction by ID and makes the transaction available again.

  • txId: Fireblocks transaction id