Skip to content

Latest commit

 

History

History
689 lines (473 loc) · 26.7 KB

File metadata and controls

689 lines (473 loc) · 26.7 KB

fireblocks.BlockchainsAssetsApi

All URIs are relative to https://api.fireblocks.io/v1

Method HTTP request Description
get_asset GET /assets/{id} Get an asset
get_blockchain GET /blockchains/{id} Get a Blockchain by ID
get_supported_assets GET /supported_assets List assets (Legacy)
list_assets GET /assets List assets
list_blockchains GET /blockchains List blockchains
register_new_asset POST /assets Register an asset
set_asset_price POST /assets/prices/{id} Set asset price
update_asset_user_metadata PATCH /assets/{id} Update the user’s metadata for an asset

get_asset

Asset get_asset(id, idempotency_key=idempotency_key)

Get an asset

Returns an asset by ID or legacyID.

Note:

  • We will continue displaying and supporting the legacy ID (API ID). Since not all Fireblocks services fully support the new Assets UUID, please use only the legacy ID until further notice.

Example

from fireblocks.models.asset import Asset
from fireblocks.client import Fireblocks
from fireblocks.client_configuration import ClientConfiguration
from fireblocks.exceptions import ApiException
from fireblocks.base_path import BasePath
from pprint import pprint

# load the secret key content from a file
with open('your_secret_key_file_path', 'r') as file:
    secret_key_value = file.read()

# build the configuration
configuration = ClientConfiguration(
        api_key="your_api_key",
        secret_key=secret_key_value,
        base_path=BasePath.Sandbox, # or set it directly to a string "https://sandbox-api.fireblocks.io/v1"
)


# Enter a context with an instance of the API client
with Fireblocks(configuration) as fireblocks:
    id = 'ETH' # str | The ID or legacyId of the asset
    idempotency_key = 'idempotency_key_example' # str | A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. (optional)

    try:
        # Get an asset
        api_response = fireblocks.blockchains_assets.get_asset(id, idempotency_key=idempotency_key).result()
        print("The response of BlockchainsAssetsApi->get_asset:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling BlockchainsAssetsApi->get_asset: %s\n" % e)

Parameters

Name Type Description Notes
id str The ID or legacyId of the asset
idempotency_key str A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. [optional]

Return type

Asset

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Asset with requested identification * X-Request-ID -
404 - Asset with specified ID or legacy ID is not found. Error code 1504 -
500 Error occurred while getting an asset -
0 Error Response * X-Request-ID -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_blockchain

BlockchainResponse get_blockchain(id)

Get a Blockchain by ID

Returns a blockchain by ID or legacyID.

Example

from fireblocks.models.blockchain_response import BlockchainResponse
from fireblocks.client import Fireblocks
from fireblocks.client_configuration import ClientConfiguration
from fireblocks.exceptions import ApiException
from fireblocks.base_path import BasePath
from pprint import pprint

# load the secret key content from a file
with open('your_secret_key_file_path', 'r') as file:
    secret_key_value = file.read()

# build the configuration
configuration = ClientConfiguration(
        api_key="your_api_key",
        secret_key=secret_key_value,
        base_path=BasePath.Sandbox, # or set it directly to a string "https://sandbox-api.fireblocks.io/v1"
)


# Enter a context with an instance of the API client
with Fireblocks(configuration) as fireblocks:
    id = 'ETH' # str | The ID or legacyId of the blockchain

    try:
        # Get a Blockchain by ID
        api_response = fireblocks.blockchains_assets.get_blockchain(id).result()
        print("The response of BlockchainsAssetsApi->get_blockchain:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling BlockchainsAssetsApi->get_blockchain: %s\n" % e)

Parameters

Name Type Description Notes
id str The ID or legacyId of the blockchain

Return type

BlockchainResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Blockchain with requested identification * X-Request-ID -
404 - Blockchain with specified ID or legacy ID is not found. Error code 1505 -
500 Error occurred while getting an blockchain -
0 Error Response * X-Request-ID -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_supported_assets

List[AssetTypeResponse] get_supported_assets()

List assets (Legacy)

This legacy endpoint has not been deprecated but it should not be used in your operations. Instead, use the new List assets endpoint for better performance and to retrieve more detailed asset information.

Retrieves all assets supported by Fireblocks in your workspace.

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

Example

from fireblocks.models.asset_type_response import AssetTypeResponse
from fireblocks.client import Fireblocks
from fireblocks.client_configuration import ClientConfiguration
from fireblocks.exceptions import ApiException
from fireblocks.base_path import BasePath
from pprint import pprint

# load the secret key content from a file
with open('your_secret_key_file_path', 'r') as file:
    secret_key_value = file.read()

# build the configuration
configuration = ClientConfiguration(
        api_key="your_api_key",
        secret_key=secret_key_value,
        base_path=BasePath.Sandbox, # or set it directly to a string "https://sandbox-api.fireblocks.io/v1"
)


# Enter a context with an instance of the API client
with Fireblocks(configuration) as fireblocks:

    try:
        # List assets (Legacy)
        api_response = fireblocks.blockchains_assets.get_supported_assets().result()
        print("The response of BlockchainsAssetsApi->get_supported_assets:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling BlockchainsAssetsApi->get_supported_assets: %s\n" % e)

Parameters

This endpoint does not need any parameter.

Return type

List[AssetTypeResponse]

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 A Transaction object * X-Request-ID -
0 Error Response * X-Request-ID -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

list_assets

ListAssetsResponse list_assets(blockchain_id=blockchain_id, asset_class=asset_class, symbol=symbol, scope=scope, deprecated=deprecated, ids=ids, page_cursor=page_cursor, page_size=page_size, idempotency_key=idempotency_key)

List assets

Retrieves a paginated list of all assets supported by Fireblocks in your workspace

Note: We will continue to support and display the legacy ID (API ID). Since not all Fireblocks services fully support the new Assets UUID, please use only the legacy ID until further notice.

Example

from fireblocks.models.asset_class import AssetClass
from fireblocks.models.asset_scope import AssetScope
from fireblocks.models.list_assets_response import ListAssetsResponse
from fireblocks.client import Fireblocks
from fireblocks.client_configuration import ClientConfiguration
from fireblocks.exceptions import ApiException
from fireblocks.base_path import BasePath
from pprint import pprint

# load the secret key content from a file
with open('your_secret_key_file_path', 'r') as file:
    secret_key_value = file.read()

# build the configuration
configuration = ClientConfiguration(
        api_key="your_api_key",
        secret_key=secret_key_value,
        base_path=BasePath.Sandbox, # or set it directly to a string "https://sandbox-api.fireblocks.io/v1"
)


# Enter a context with an instance of the API client
with Fireblocks(configuration) as fireblocks:
    blockchain_id = '0f672204-a28b-464a-b318-a387abd3d3c7' # str | Blockchain id of the assets (optional)
    asset_class = fireblocks.AssetClass() # AssetClass | Assets class (optional)
    symbol = 'ETH' # str | Assets onchain symbol (optional)
    scope = fireblocks.AssetScope() # AssetScope | Scope of the assets (optional)
    deprecated = false # bool | Are assets deprecated (optional)
    ids = ['[\"3ed32525-70df-45c8-bae3-e69ab56dc095\",\"3a3b5f06-61e7-44f0-9962-4425b55795ff\",\"SHANI5_B75VRLGX_MUPA\"]'] # List[str] | A list of asset IDs (max 100) (optional)
    page_cursor = 'MjAyMy0xMi0xMyAyMDozNjowOC4zMDI=:MTEwMA==' # str | Next page cursor to fetch (optional)
    page_size = 500 # float | Items per page (optional) (default to 500)
    idempotency_key = 'idempotency_key_example' # str | A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. (optional)

    try:
        # List assets
        api_response = fireblocks.blockchains_assets.list_assets(blockchain_id=blockchain_id, asset_class=asset_class, symbol=symbol, scope=scope, deprecated=deprecated, ids=ids, page_cursor=page_cursor, page_size=page_size, idempotency_key=idempotency_key).result()
        print("The response of BlockchainsAssetsApi->list_assets:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling BlockchainsAssetsApi->list_assets: %s\n" % e)

Parameters

Name Type Description Notes
blockchain_id str Blockchain id of the assets [optional]
asset_class AssetClass Assets class [optional]
symbol str Assets onchain symbol [optional]
scope AssetScope Scope of the assets [optional]
deprecated bool Are assets deprecated [optional]
ids List[str] A list of asset IDs (max 100) [optional]
page_cursor str Next page cursor to fetch [optional]
page_size float Items per page [optional] [default to 500]
idempotency_key str A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. [optional]

Return type

ListAssetsResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 List of assets -
500 Error occurred while listing assets -
0 Error Response * X-Request-ID -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

list_blockchains

ListBlockchainsResponse list_blockchains(protocol=protocol, deprecated=deprecated, test=test, ids=ids, page_cursor=page_cursor, page_size=page_size)

List blockchains

Returns all blockchains supported by Fireblocks.

Example

from fireblocks.models.list_blockchains_response import ListBlockchainsResponse
from fireblocks.client import Fireblocks
from fireblocks.client_configuration import ClientConfiguration
from fireblocks.exceptions import ApiException
from fireblocks.base_path import BasePath
from pprint import pprint

# load the secret key content from a file
with open('your_secret_key_file_path', 'r') as file:
    secret_key_value = file.read()

# build the configuration
configuration = ClientConfiguration(
        api_key="your_api_key",
        secret_key=secret_key_value,
        base_path=BasePath.Sandbox, # or set it directly to a string "https://sandbox-api.fireblocks.io/v1"
)


# Enter a context with an instance of the API client
with Fireblocks(configuration) as fireblocks:
    protocol = 'SOL' # str | Blockchain protocol (optional)
    deprecated = false # bool | Is blockchain deprecated (optional)
    test = false # bool | Is test blockchain (optional)
    ids = ['[\"3ed32525-70df-45c8-bae3-e69ab56dc095\",\"3a3b5f06-61e7-44f0-9962-4425b55795ff\",\"MANTRA\"]'] # List[str] | A list of blockchain IDs (max 100) (optional)
    page_cursor = 'MjAyMy0xMi0xMyAyMDozNjowOC4zMDI=:MTEwMA==' # str | Page cursor to fetch (optional)
    page_size = 500 # float | Items per page (max 500) (optional) (default to 500)

    try:
        # List blockchains
        api_response = fireblocks.blockchains_assets.list_blockchains(protocol=protocol, deprecated=deprecated, test=test, ids=ids, page_cursor=page_cursor, page_size=page_size).result()
        print("The response of BlockchainsAssetsApi->list_blockchains:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling BlockchainsAssetsApi->list_blockchains: %s\n" % e)

Parameters

Name Type Description Notes
protocol str Blockchain protocol [optional]
deprecated bool Is blockchain deprecated [optional]
test bool Is test blockchain [optional]
ids List[str] A list of blockchain IDs (max 100) [optional]
page_cursor str Page cursor to fetch [optional]
page_size float Items per page (max 500) [optional] [default to 500]

Return type

ListBlockchainsResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 List of supported blockchains -
500 Error occurred while listing blockchains -
0 Error Response * X-Request-ID -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

register_new_asset

AssetResponse register_new_asset(idempotency_key=idempotency_key, register_new_asset_request=register_new_asset_request)

Register an asset

Register a new asset to a workspace and return the newly created asset's details. Currently supported chains are:

  • EVM based chains
  • Stellar
  • Algorand
  • TRON
  • NEAR
  • Solana
  • Sui
  • TON

Example

from fireblocks.models.asset_response import AssetResponse
from fireblocks.models.register_new_asset_request import RegisterNewAssetRequest
from fireblocks.client import Fireblocks
from fireblocks.client_configuration import ClientConfiguration
from fireblocks.exceptions import ApiException
from fireblocks.base_path import BasePath
from pprint import pprint

# load the secret key content from a file
with open('your_secret_key_file_path', 'r') as file:
    secret_key_value = file.read()

# build the configuration
configuration = ClientConfiguration(
        api_key="your_api_key",
        secret_key=secret_key_value,
        base_path=BasePath.Sandbox, # or set it directly to a string "https://sandbox-api.fireblocks.io/v1"
)


# Enter a context with an instance of the API client
with Fireblocks(configuration) as fireblocks:
    idempotency_key = 'idempotency_key_example' # str | A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. (optional)
    register_new_asset_request = fireblocks.RegisterNewAssetRequest() # RegisterNewAssetRequest |  (optional)

    try:
        # Register an asset
        api_response = fireblocks.blockchains_assets.register_new_asset(idempotency_key=idempotency_key, register_new_asset_request=register_new_asset_request).result()
        print("The response of BlockchainsAssetsApi->register_new_asset:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling BlockchainsAssetsApi->register_new_asset: %s\n" % e)

Parameters

Name Type Description Notes
idempotency_key str A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. [optional]
register_new_asset_request RegisterNewAssetRequest [optional]

Return type

AssetResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 A new asset has been created successfully -
400 - Listing an asset on the requested blockchain is not supported. Error code: 1000 - The asset address is invalid. Error code: 1003 - Self serve listing an asset on the requested blockchain is currently not supported, please contact support. Error code: 1004 - Blockchain is deprecated. Error code: 1006 - The asset's standard is not supported. Error code: 1007 - Unable to get expected metadata: decimals name
403 - The asset creation quota reached. Error code: 1005 - Tenant is not allowed to create testnet assets. Error code: 1008 - Tenant is not allowed to create mainnet assets. Error code: 1009 -
404 - Invalid address, could not get asset information. Error code 1003 -
409 - The asset is already supported globally. Error code: 1001 - The asset has already been added to this workspace. Error code: 1002 -
500 Failed to create asset -
0 Error Response * X-Request-ID -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

set_asset_price

AssetPriceResponse set_asset_price(id, idempotency_key=idempotency_key, set_asset_price_request=set_asset_price_request)

Set asset price

Set asset price for the given asset id. Returns the asset price response.

Example

from fireblocks.models.asset_price_response import AssetPriceResponse
from fireblocks.models.set_asset_price_request import SetAssetPriceRequest
from fireblocks.client import Fireblocks
from fireblocks.client_configuration import ClientConfiguration
from fireblocks.exceptions import ApiException
from fireblocks.base_path import BasePath
from pprint import pprint

# load the secret key content from a file
with open('your_secret_key_file_path', 'r') as file:
    secret_key_value = file.read()

# build the configuration
configuration = ClientConfiguration(
        api_key="your_api_key",
        secret_key=secret_key_value,
        base_path=BasePath.Sandbox, # or set it directly to a string "https://sandbox-api.fireblocks.io/v1"
)


# Enter a context with an instance of the API client
with Fireblocks(configuration) as fireblocks:
    id = 'ETH' # str | The ID of the asset
    idempotency_key = 'idempotency_key_example' # str | A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. (optional)
    set_asset_price_request = fireblocks.SetAssetPriceRequest() # SetAssetPriceRequest |  (optional)

    try:
        # Set asset price
        api_response = fireblocks.blockchains_assets.set_asset_price(id, idempotency_key=idempotency_key, set_asset_price_request=set_asset_price_request).result()
        print("The response of BlockchainsAssetsApi->set_asset_price:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling BlockchainsAssetsApi->set_asset_price: %s\n" % e)

Parameters

Name Type Description Notes
id str The ID of the asset
idempotency_key str A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. [optional]
set_asset_price_request SetAssetPriceRequest [optional]

Return type

AssetPriceResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Asset price has been set successfully. -
403 - Tenant is not allowed to set rate. Error code: 1002. -
404 - Currency not found. Error code 1001 -
0 Error Response * X-Request-ID -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

update_asset_user_metadata

Asset update_asset_user_metadata(id, idempotency_key=idempotency_key, update_asset_user_metadata_request=update_asset_user_metadata_request)

Update the user’s metadata for an asset

Update the user’s metadata for an asset.

Endpoint Permission: Owner, Admin, Non-Signing Admin, NCW Admin, Signer, Editor.

Example

from fireblocks.models.asset import Asset
from fireblocks.models.update_asset_user_metadata_request import UpdateAssetUserMetadataRequest
from fireblocks.client import Fireblocks
from fireblocks.client_configuration import ClientConfiguration
from fireblocks.exceptions import ApiException
from fireblocks.base_path import BasePath
from pprint import pprint

# load the secret key content from a file
with open('your_secret_key_file_path', 'r') as file:
    secret_key_value = file.read()

# build the configuration
configuration = ClientConfiguration(
        api_key="your_api_key",
        secret_key=secret_key_value,
        base_path=BasePath.Sandbox, # or set it directly to a string "https://sandbox-api.fireblocks.io/v1"
)


# Enter a context with an instance of the API client
with Fireblocks(configuration) as fireblocks:
    id = 'ETH' # str | The ID or legacyId of the asset
    idempotency_key = 'idempotency_key_example' # str | A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. (optional)
    update_asset_user_metadata_request = fireblocks.UpdateAssetUserMetadataRequest() # UpdateAssetUserMetadataRequest |  (optional)

    try:
        # Update the user’s metadata for an asset
        api_response = fireblocks.blockchains_assets.update_asset_user_metadata(id, idempotency_key=idempotency_key, update_asset_user_metadata_request=update_asset_user_metadata_request).result()
        print("The response of BlockchainsAssetsApi->update_asset_user_metadata:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling BlockchainsAssetsApi->update_asset_user_metadata: %s\n" % e)

Parameters

Name Type Description Notes
id str The ID or legacyId of the asset
idempotency_key str A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours. [optional]
update_asset_user_metadata_request UpdateAssetUserMetadataRequest [optional]

Return type

Asset

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Updated asset user metadata * X-Request-ID -
404 - Asset with specified ID or legacy ID is not found. Error code 1504 -
500 Error occurred while updating asset user metadata -
0 Error Response * X-Request-ID -

[Back to top] [Back to API list] [Back to Model list] [Back to README]