The Atom Class

Dalton API Wrapper for WAX

This is the core module of the Dalton API wrapper, providing the Atom Class, which can be used to query the various API endpoints.

class daltonapi.api.Atom(endpoint: str = '')

API Wrapper Class for AtomicAssets

__init__(endpoint: str = '')

Creates an Atom object for accessing the AtomicAssets API

Parameters

endpoint (str, optional) – Sets API endpoint. Defaults to AtomicAssets hosted API.

get_asset(asset_id: str) daltonapi.tools.atomic_classes.Asset

Gets an atomic asset by ID

Parameters

asset_id (str) – Asset ID

Raises

AtomicIDError – Raised when an incorrect asset_id is passed

Returns

Corresponding object

Return type

Asset

get_asset_history(item: Union[daltonapi.tools.atomic_classes.Asset, str], page: int = 1) List[daltonapi.tools.atomic_classes.Transfer]

Fetches transfer history of an asset

Parameters

item (Union[Asset, str]) – An Asset Object or a string with the asset id

Returns

List of transfer objects

Return type

list[Transfer]

get_assets(owner: str = '', collection: daltonapi.tools.atomic_classes.Collection = '', schema: daltonapi.tools.atomic_classes.Schema = '', template: daltonapi.tools.atomic_classes.Template = '', page: int = 1, order: str = 'desc', limit=100) List[daltonapi.tools.atomic_classes.Asset]

Get a list of assets based on critera. Must have at least 1 criteria

Parameters
  • owner (str, optional) – account name. Defaults to “”.

  • collection (str, Collection, optional) – collection name. Defaults to “”.

  • schema (str, Schema, optional) – schema name. Defaults to “”.

  • template (str, Template, optional) – template ID. Defaults to “”.

  • page (int, optional) – start page. Defaults to 1

  • order (str, optional) – ordering. (asc/desc) - Defaults to “desc”

  • limit (int, optional) – maximum number of results to return. Defaults to 100.

Raises

NoFiltersError – Raised when no filters are passed

Returns

List of Asset objects matching the criteria

Return type

list[Asset]

get_burned(owner: str = '', collection: daltonapi.tools.atomic_classes.Collection = '', schema: daltonapi.tools.atomic_classes.Schema = '', template: daltonapi.tools.atomic_classes.Template = '', limit=100) List[daltonapi.tools.atomic_classes.Asset]

Get a list of burned assets based on critera. Must have at least 1 criteria

Parameters
  • owner (str, optional) – account name. Defaults to “”.

  • collection (str, Collection, optional) – collection name. Defaults to “”.

  • schema (str, Schema, optional) – schema name. Defaults to “”.

  • template (str, Template, optional) – template ID. Defaults to “”.

  • limit (int, optional) – maximum number of results to return. Defaults to 100.

Raises

NoFiltersError – Raised when no filters are passed

Returns

List of Asset objects matching the criteria

Return type

list[Asset]

get_collection(collection_id: str, verbose: bool = False) daltonapi.tools.atomic_classes.Collection

Gets an atomic collection by ID

Parameters

collection_id (str) – Collection ID

Raises

AtomicIDError – Raised when an incorrect template_id is passed

Returns

Corresponding object

Return type

Template

get_holders(collection: daltonapi.tools.atomic_classes.Collection = '', schema: daltonapi.tools.atomic_classes.Schema = '', template: daltonapi.tools.atomic_classes.Template = '', page: int = 1, order: str = 'desc', limit: int = 100)

Returns a list of accouts holding some entity (collection, schema, template)

Parameters
  • collection (str, Collection, optional) – collection name. Defaults to “”.

  • schema (str, Schema, optional) – schema name. Defaults to “”.

  • template (str, Template, optional) – template ID. Defaults to “”.

  • page (int, optional) – start page. Defaults to 1

  • order (str, optional) – ordering. (asc/desc) - Defaults to “desc”

  • limit (int, optional) – maximum number of results to return. Defaults to 100.

Raises

NoFiltersError – Raised when no filters are passed

Returns

List of dicts containing account names and number of matching assets held.

Return type

list[dict]

get_schema(collection_id: Union[daltonapi.tools.atomic_classes.Collection, str], schema_id: str) daltonapi.tools.atomic_classes.Schema

Gets an atomic template by ID

Parameters
  • collection_id (Union[Collection, str]) – Collection ID

  • schema_id (str) – Schema ID

Raises

AtomicIDError – Raised when an incorrect schema_id is passed

Returns

Corresponding object

Return type

Schema

get_template(collection_id: Union[daltonapi.tools.atomic_classes.Collection, str], template_id: str) daltonapi.tools.atomic_classes.Template

Gets an atomic template by ID

Parameters
  • collection_id (Union[Collection, str]) – Collection ID

  • template_id (str) – Template ID

Raises

AtomicIDError – Raised when an incorrect template_id is passed

Returns

Corresponding object

Return type

Template

get_transfers(sender: str = '', recipient: str = '', collection: daltonapi.tools.atomic_classes.Collection = '', schema: daltonapi.tools.atomic_classes.Schema = '', template: daltonapi.tools.atomic_classes.Template = '', page: int = 1, order: str = 'desc', limit=100) List[daltonapi.tools.atomic_classes.Transfer]

Search for transfers fulfilling a criteria

Parameters
  • sender (str, optional) – Sender address. Defaults to “”.

  • recipient (str, optional) – Recipient address. Defaults to “”.

  • collection (str, Collection, optional) – collection name. Defaults to “”.

  • schema (str, Schema, optional) – schema name. Defaults to “”.

  • template (str, Template, optional) – template ID. Defaults to “”.

  • page (int, optional) – start page. Defaults to 1

  • order (str, optional) – ordering. (asc/desc) - Defaults to “desc”

  • limit (int, optional) – maximum number of results to return. Defaults to 100.

Raises

NoFiltersError – Raised when no criteria provided

Returns

List of Transfer objects matching the criteria

Return type

list[Transfer]

class daltonapi.api.Wax(endpoint: str = '')

Class for the WAX API

__init__(endpoint: str = '')
get_account(account_name: str)

[summary]

Parameters

account_name (str) – [description]

Returns

[description]

Return type

[type]

class daltonapi.api.WaxTable(contract: str, table: str, endpoint: str = '')

Class for WAX Tables”

__init__(contract: str, table: str, endpoint: str = '')
get_table_row(scope: str, key: str)

Returns a table row using a scope and key

Parameters
  • scope (str) – [description]

  • key (str) – [description]

Raises

RequestFailedError – When Request status code not 200

Returns

[description]

Return type

dict

get_table_rows(scope: str, search_params: dict, start_at: int = 1, limit: int = 1000)

Returns a list of table rows matching search criteria. This can be a very slow process for large tables.

Parameters
  • scope (str) – Scope of table rows

  • search_params (dict) – Dict of column_name:value pairs

  • start_at (int, optional) – Row to start searching at. Defaults to 1.

Raises

RequestFailedError – When Request status code not 200

Returns

list of dict

Return type

list