Utils

Bytom Utils.

shuttle.providers.bytom.utils.find_contract_utxo_id(tx_id, network)

Find smart contract UTXO id.

Parameters
  • tx_id (str) – Bytom transaction id or hash.

  • network (str) – Bytom network.

Returns

str – UTXO id.

>>> from shuttle.providers.bytom.utils import find_contract_utxo_id
>>> find_contract_utxo_id(bytom_transaction_id, "mainnet")
"9059cd0d03e4d4fab70a415169a45be47583f7240115c36cf298d6f261c0a1ac"
shuttle.providers.bytom.utils.decode_transaction_raw(transaction_raw)

Decode Bytom transaction raw.

Parameters

transaction_raw (str) – Bytom transaction raw.

Returns

dict – decoded Bytom transaction.

>>> from shuttle.providers.bytom.utils import decode_transaction_raw
>>> decode_transaction_raw(transaction_raw)
{...}
shuttle.providers.bytom.utils.submit_transaction_raw(transaction_raw)

Submit transaction raw to Bytom blockchain.

Parameters

transaction_raw (str) – Bytom transaction raw.

Returns

dict – Bytom transaction id, fee, type and date.

>>> from shuttle.providers.bytom.utils import submit_transaction_raw
>>> submit_transaction_raw(transaction_raw)
{...}
shuttle.providers.bytom.utils.is_address(address, network=None)

Check Bytom address.

Parameters
  • address (str) – Bytom address.

  • network (str) – Bytom network, defaults to testnet.

Returns

bool – Bytom valid/invalid address.

>>> from shuttle.providers.bytom.utils import is_address
>>> is_address(bytom_address, "testnet")
True
shuttle.providers.bytom.utils.spend_utxo_action(utxo)

Get spend UTXO action

Parameters

utxo (str) – Bytom butxo id.

Returns

dict – Bytom spend utxo action.

>>> from shuttle.providers.bytom.utils import spend_utxo_action
>>> spend_utxo_action(bytom_utxo_id)
{...}
shuttle.providers.bytom.utils.contract_arguments(amount, address)

Get contract arguments.

Parameters
  • amount (int) – Bytom amount.

  • address (str) – Bytom address.

Returns

list – Bytom contract arguments.

>>> from shuttle.providers.bytom.utils import contract_arguments
>>> contract_arguments(bytom_amount, bytom_address)
[...]
shuttle.providers.bytom.utils.spend_wallet_action(amount, asset)

Get spend wallet action.

Parameters
  • amount (int) – Bytom amount.

  • asset (str) – Bytom asset.

Returns

dict – Bytom spend wallet action.

>>> from shuttle.providers.bytom.utils import spend_wallet_action
>>> spend_wallet_action(bytom_amount, bytom_asset)
{...}
shuttle.providers.bytom.utils.spend_account_action(account, amount, asset)

Get spend account action.

Parameters
  • account (str) – Bytom account.

  • amount (int) – Bytom amount.

  • asset (str) – Bytom asset.

Returns

dict – Bytom spend account action.

>>> from shuttle.providers.bytom.utils import spend_account_action
>>> spend_account_action(bytom_account, bytom_amount, bytom_asset)
{...}
shuttle.providers.bytom.utils.control_program_action(amount, asset, control_program)

Get control program action.

Parameters
  • amount (int) – Bytom amount.

  • asset (str) – Bytom asset.

  • control_program (str) – Bytom control program.

Returns

dict – Bytom control program action.

>>> from shuttle.providers.bytom.utils import control_program_action
>>> control_program_action(bytom_amount, bytom_asset, bytom_control_program)
{...}
shuttle.providers.bytom.utils.control_address_action(amount, asset, address)

Get control address action.

Parameters
  • amount (int) – Bytom amount.

  • asset (str) – Bytom asset.

  • address (str) – Bytom address.

Returns

dict – Bytom control address action.

>>> from shuttle.providers.bytom.utils import control_address_action
>>> control_address_action(bytom_amount, bytom_asset, bytom_address)
{...}