Unity3D

Unity3D

class Unity3D(**kwargs)

Implements the unity3dapi endpoints.

addressindexer_tip(**kwargs) → pystratis.api.blockstore.responsemodels.addressindexertipmodel.AddressIndexerTipModel

Retrieves the address indexer tip.

Parameters:**kwargs – Extra keyword arguments.
Returns:The address indexer tip hash and height.
Return type:AddressIndexerTipModel
Raises:APIError – Error thrown by node API. See message for details.
block(block_hash: Union[pystratis.core.types.uint256.uint256, str], show_transaction_details: bool = True, output_json: bool = True, **kwargs) → Union[pystratis.api.global_responsemodels.blockmodel.BlockModel, pystratis.api.global_responsemodels.blocktransactiondetailsmodel.BlockTransactionDetailsModel, pystratis.core.types.hexstr.hexstr, str]

Retrieves the block which matches the supplied block hash.

Parameters:
  • block_hash (uint256, str) – The hash of the required block.
  • show_transaction_details (bool, optional) – A flag that indicates whether to return each block transaction complete with details or simply return transaction hashes. Default=True.
  • output_json (bool) – Output json or hex block. Default=True.
  • **kwargs – Extra keyword arguments.
Returns:

The representation of the block.

Return type:

(BlockModel, BlockTransactionDetailsModel, hexstr, str)

Raises:

APIError – Error thrown by node API. See message for details.

get_address_balance(address: Union[str, pystratis.core.types.address.Address], **kwargs) → pystratis.core.types.money.Money

Provides balance of the given address confirmed with at least 1 confirmation.

Parameters:
  • address (str, Address) – The address.
  • **kwargs – Extra keyword arguments.
Returns:

The amount in the address.

Return type:

Money

Raises:

APIError – Error thrown by node API. See message for details.

get_blockheader(block_hash: Union[str, pystratis.core.types.uint256.uint256], is_json_format: bool = True, **kwargs) → pystratis.api.node.responsemodels.blockheadermodel.BlockHeaderModel

Gets the specified block header.

Parameters:
  • block_hash (str, uint256) – The specified block hash.
  • is_json_format (bool, optional) – If block header should be returned as json. Default=True.
  • **kwargs – Extra keyword arguments.
Returns:

The block headers.

Return type:

BlockHeaderModel

Raises:

APIError – Error thrown by node API. See message for details.

get_raw_transaction(trxid: Union[pystratis.core.types.uint256.uint256, str], verbose: bool = False, **kwargs) → Union[pystratis.core.types.hexstr.hexstr, pystratis.api.global_responsemodels.transactionmodel.TransactionModel]

Gets a raw transaction from a transaction id.

Requires txindex=1 in node configuration.

Parameters:
  • trxid (uint256, str) – The transaction hash.
  • verbose (bool, optional) – If output should include verbose transaction data. Default=False.
  • **kwargs – Extra keyword arguments.
Returns:

A raw transaction.

Return type:

Union[hexstr, TransactionModel]

Raises:

APIError – Error thrown by node API. See message for details.

get_utxos_for_address(address: Union[str, pystratis.core.types.address.Address], **kwargs) → pystratis.api.unity3d.responsemodels.getutxomodel.GetUTXOModel

Gets UTXOs for specified address.

Parameters:
  • address (str, Address) – The address.
  • **kwargs – Extra keyword arguments.
Returns:

UTXOs for the specified address.

Return type:

GetUTXOModel

Raises:

APIError – Error thrown by node API. See message for details.

local_call(contract_address: Union[pystratis.core.types.address.Address, str], method_name: str, amount: Union[pystratis.core.types.money.Money, int, float, decimal.Decimal], gas_price: int, gas_limit: int, sender: Union[pystratis.core.types.address.Address, str], block_height: int = None, parameters: List[Union[str, pystratis.core.smartcontractparameter.SmartContractParameter]] = None, **kwargs) → pystratis.api.smartcontracts.responsemodels.localexecutionresultmodel.LocalExecutionResultModel

Makes a local call to a method on a smart contract that has been successfully deployed. The purpose is to query and test methods.

Parameters:
  • contract_address (Address, str) – The smart contract address being called.
  • method_name (str) – The smart contract method being called.
  • amount (Money, int, float, Decimal) – The amount being sent.
  • gas_price (int) – The amount of gas being used in satoshis.
  • gas_limit (int) – The maximum amount of gas that can be used in satoshis.
  • sender (Address, str) – The address of the sending address.
  • block_height (int, optional) – The height at which to query the contract’s state. If unset, will default to the current chain tip.
  • parameters (List[Union[SmartContractParameter, str]], optional) – A list of parameters for the smart contract.
  • **kwargs – Extra keyword arguments.
Returns:

The results of a local contract execution.

Return type:

LocalExecutionResultModel

Raises:

APIError – Error thrown by node API. See message for details.

receipt(tx_hash: Union[pystratis.core.types.uint256.uint256, str], **kwargs) → pystratis.api.smartcontracts.responsemodels.receiptmodel.ReceiptModel

Gets a smart contract transaction receipt.

Parameters:
  • tx_hash (uint256, str) – The transaction hash of the smart contract receipt.
  • **kwargs – Extra keyword arguments.
Returns:

The smart contract transaction receipt.

Return type:

ReceiptModel

Raises:

APIError – Error thrown by node API. See message for details.

send_transaction(transaction_hex: Union[str, pystratis.core.types.hexstr.hexstr], **kwargs) → pystratis.api.global_responsemodels.walletsendtransactionmodel.WalletSendTransactionModel

Sends a transaction that has already been built.

Parameters:
  • transaction_hex (hexstr, str) – The hexified transaction.
  • **kwargs – Extra keyword arguments.
Returns:

Information about a sent transaction.

Return type:

WalletSendTransactionModel

Raises:

APIError – Error thrown by node API. See message for details.

validate_address(address: str, **kwargs) → pystratis.api.node.responsemodels.validateaddressmodel.ValidateAddressModel

Validate an address

Parameters:
  • address (str) – The address to validate.
  • **kwargs – Extra keyword arguments.
Returns:

Information on the validity of the provided address, and if valid, if it is a witness or script address.

Return type:

ValidateAddressModel

Raises:

APIError – Error thrown by node API. See message for details.

GetUTXOModel

class GetUTXOModel

A pydantic model for the unity3d getuxtosforaddress endpoint.

UTXOModel

class UTXOModel

A pydantic model for a utxo.