FireblocksSdk.Api.Contract (FireblocksSdk v0.2.0)

Copy Markdown View Source

Summary

Functions

Adds an asset to an existing contract.

Creates a new contract.

Decode a function call data, error, or event log from a deployed contract by blockchain native asset id and contract address.

Delete a contract

Delete a contract asset

Returns a contract asset by ID.

Returns a contract by id.

Return deployed contract's ABI by blockchain native asset id and contract address

Retrieve the transaction receipt by blockchain native asset ID and transaction hash

Gets a list of contracts.

Return deployed contract's ABI by blockchain native asset id and contract address

Call a write function on a deployed contract by blockchain native asset id and contract address. This creates an onchain transaction, thus it is an async operation. It returns a transaction id that can be polled for status check

Functions

add_asset(contract_asset, idempotent_key \\ "")

Adds an asset to an existing contract.

  FireblocksSdk.Api.Contract.add_asset([
    contractId: "CONTRACT_ID",
    assetId: "ASSET_ID",
    address: "ADDRESS",
  ])

Options:

create(name, idempotent_key \\ "")

Creates a new contract.

decode(options, idempotentKey \\ "")

Decode a function call data, error, or event log from a deployed contract by blockchain native asset id and contract address.

Options:

  • :baseAssetId (String.t/0) - Required. Base assetId e.g ETH, ETH_TEST5

  • :contractAddress (String.t/0) - Required.

  • :dataType - Available values: :error, :log, :function

  • :data (map/0) - The data to decode, which can be a string or an object containing the data and its type.

  • :abi (list of map/0) - The abi of the function/error/log to decode.

delete(contract_id)

Delete a contract

delete_asset(contract_id, asset_id)

Delete a contract asset

find_contract_asset(contract_id, asset_id)

Returns a contract asset by ID.

get(contract_id)

Returns a contract by id.

get_functions(options)

Return deployed contract's ABI by blockchain native asset id and contract address

Options:

  • :baseAssetId (String.t/0) - Required. Base assetId e.g ETH, ETH_TEST5

  • :contractAddress (String.t/0) - Required.

get_transaction_receipt(receipt)

Retrieve the transaction receipt by blockchain native asset ID and transaction hash

Options:

  • :baseAssetId (String.t/0) - Required. Base assetId e.g ETH, ETH_TEST5

  • :txHash (String.t/0) - Required. Transaction hash

list()

Gets a list of contracts.

read(options, idempotentKey \\ "")

Return deployed contract's ABI by blockchain native asset id and contract address

Options:

  • :baseAssetId (String.t/0) - Required. Base assetId e.g ETH, ETH_TEST5

  • :contractAddress (String.t/0) - Required.

  • :abiFunction (map/0)

write(options, idempotentKey \\ "")

Call a write function on a deployed contract by blockchain native asset id and contract address. This creates an onchain transaction, thus it is an async operation. It returns a transaction id that can be polled for status check

Options:

  • :baseAssetId (String.t/0) - Required. Base assetId e.g ETH, ETH_TEST5

  • :contractAddress (String.t/0) - Required.

  • :vaultId (String.t/0) - Required. The vault account id this contract was deploy from

  • :abiFunction (map/0)

  • :amount (String.t/0) - Amount in base asset. Being used in payable functions

  • :feeLevel - Fee level for the write function transaction. interchangeable with the 'fee' field The default value is :medium.

  • :fee (String.t/0) - Max fee amount for the write function transaction. interchangeable with the 'feeLevel' field

  • :note (String.t/0) - Custom note, not sent to the blockchain, that describes the transaction at your Fireblocks workspace

  • :useGasless (boolean/0) - The default value is false.

  • :externalId (String.t/0) - External id that can be used to identify the transaction in your system. The unique identifier of the transaction outside of Fireblocks with max length of 255 characters