transaction_utils

class algofipy.transaction_utils.TransactionGroup(transactions)

Bases: object

length()

Get length of the transaction group.

Returns:

length of transactiong group

Return type:

int

sign_with_private_key(private_key)

Signs the transactions with specified private key and saves to class state :param private_key: private key of user :type private_key: string

sign_with_private_keys(private_keys, is_logic_sig=None)

Signs the transactions with specified private key and saves to class state :param private_keys: private key of user :type private_keys: string :param is_logic_sig: if given “pkey” is a logicsig :type is_logic_sig: list

submit(algod, wait=False)

Submit algorand transaction group and optionally wait for confirmation.

Parameters:
  • algod (AlgodClient) – Algorand algod client

  • wait (bool, optional) – whether to wait for transaction confirmation from network

Returns:

length of transactiong group

Return type:

int

algofipy.transaction_utils.create_asset_transaction(algod, sender, total, decimals, default_frozen, manager, reserve, freeze, clawback, unit_name, asset_name, url)

Get an asset creation txn object.

Parameters:
  • algod (AlgodClient) – algod client

  • sender (str) – sender

  • total (int) – total amount of asset in base units

  • decimals (int) – number of decimals for asset

  • default_frozen (boolean) – asset is defaulted to frozen on launch

  • manager (str) – manager address

  • reserve (str) – reserve address

  • freeze (str) – freeze address

  • unit_name (str) – unit name

  • asset_name (str) – asset name

  • url (str) – url for asset

Returns:

asset creation transaction object

Return type:

AssetCreateTxn

algofipy.transaction_utils.get_default_params(algod)

Get default params for an Algorand transaction with fee = 1000, flat_fee = True.

Parameters:

algod (AlgodClient) – Algorand algod client

Returns:

suggested params object

Return type:

class:SuggestedParams

algofipy.transaction_utils.get_payment_txn(sender, params, receiver, amount, asset_id=1)

Get a payment transaction object.

Parameters:
  • sender (str) – sender address

  • params (SuggestedParams) – transaction params object

  • receiver (str) – receiver address

  • amount (int) – amount to send in microALGOs

Returns:

payment / asset transaction transaction

Return type:

PaymentTxn or AssetTransferTxn

algofipy.transaction_utils.wait_for_confirmation(algod, txid)

Wait for confirmation from network for transaction with given id.

Parameters:
  • algod (AlgodClient) – Algorand algod node

  • txid (str) – transaction id

Returns:

transaction information dict

Return type:

dict