API

Contracts

eosio

Helpers for creating actions on eosio contract

aioeos.contracts.eosio.buyrambytes(payer, receiver, amount, authorization=[])
Return type

EosAction

aioeos.contracts.eosio.delegatebw(from_account, receiver, stake_net_quantity, stake_cpu_quantity, transfer=False, authorization=[])
Return type

EosAction

aioeos.contracts.eosio.newaccount(creator, account_name, owner_keys, active_keys=None, authorization=[])
Return type

EosAction

aioeos.contracts.eosio.sellram(account, amount, authorization=[])
Return type

EosAction

aioeos.contracts.eosio.undelegatebw(from_account, receiver, unstake_net_quantity, unstake_cpu_quantity, authorization=[])
Return type

EosAction

eosio_token

Helpers for creating actions on eosio.token contract

aioeos.contracts.eosio_token.close(owner, symbol, authorization=[])
Return type

EosAction

aioeos.contracts.eosio_token.transfer(from_addr, to_addr, quantity, memo='', authorization=[])
Return type

EosAction

Exceptions

exception aioeos.exceptions.EosAccountDoesntExistException

Thrown by get_account where account doesn’t exist

exception aioeos.exceptions.EosAccountExistsException

Thrown by create_wallet where account with given name already exists

exception aioeos.exceptions.EosActionValidateException

Raised when action payload is invalid

exception aioeos.exceptions.EosAssertMessageException

Generic assertion error from smart contract, can mean literally anything, need to parse C++ traceback to figure out what went wrong.

exception aioeos.exceptions.EosDeadlineException

Transaction timed out

exception aioeos.exceptions.EosMissingTaposFieldsException

TAPOS fields are missing from Transaction object

exception aioeos.exceptions.EosRamUsageExceededException

Transaction requires more RAM than what’s available on the account

exception aioeos.exceptions.EosRpcException

Base EOS exception

exception aioeos.exceptions.EosSerializerAbiNameInvalidCharactersException
exception aioeos.exceptions.EosSerializerAbiNameTooLongException
exception aioeos.exceptions.EosSerializerException

Base exception class for serializer errors

exception aioeos.exceptions.EosSerializerUnsupportedTypeException

Our serializer doesn’t support provided object type

exception aioeos.exceptions.EosTxCpuUsageExceededException

Not enough EOS were staked for CPU

exception aioeos.exceptions.EosTxNetUsageExceededException

Not enough EOS were staked for NET

Keys

class aioeos.keys.EOSKey(*, private_key=None, public_key=None)

EOSKey instance.

Depends on which kwargs are given, this works in a different way: - No kwargs - generates a new private key - Only private_key - public key is being derived from private key - Only public_key - EOSKey instance has no private key

sign(digest)

Signs sha256 hash with private key. Returns signature in format: SIG_K1_{digest}

to_public()

Returns compressed, base58 encoded public key prefixed with EOS

to_pvt(key_type='K1')

Converts private key to PVT format

to_wif()

Converts private key to legacy WIF format

verify(encoded_sig, digest)

Verifies signature with private key

RPC

Serializer

class aioeos.serializer.AbiBytesSerializer

Serializer for ABI bytes type. Serialized value consists of raw bytes prefixed with payload size encoded as VarUInt.

deserialize(value)

Returns a tuple containing length of original data and deserialized value

Return type

Tuple[int, bytes]

serialize(value)

Returns byte-encoded value

Return type

bytes

class aioeos.serializer.AbiListSerializer(list_type)

Serializer for ABI List type. In binary format, it basically looks like this: [count][item 1][item 2]...

deserialize(value)

Returns a tuple containing length of original data and deserialized value

Return type

Tuple[int, List[Any]]

serialize(value)

Returns byte-encoded value

Return type

bytes

class aioeos.serializer.AbiNameSerializer

Serializer for ABI names. ABI names can only contain these characters: .12345abcdefghijklmnopqrstuvwxyz. Maximum length is 13 chars.

deserialize(value)

Returns a tuple containing length of original data and deserialized value

Return type

Tuple[int, str]

serialize(value)

Returns byte-encoded value

Return type

bytes

class aioeos.serializer.AbiObjectSerializer(abi_class)
deserialize(value)

Returns a tuple containing length of original data and deserialized value

Return type

Tuple[int, BaseAbiObject]

serialize(value)

Returns byte-encoded value

Return type

bytes

class aioeos.serializer.AbiStringSerializer

Serializer for ABI String type. String format is similar to bytes as it’s prefixed with length but it’s comprised of ASCII codes for each character packed in binary format.

deserialize(value)

Returns a tuple containing length of original data and deserialized value

Return type

Tuple[int, str]

serialize(value)

Returns byte-encoded value

Return type

bytes

class aioeos.serializer.AbiTimePointSecSerializer

Serializer for ABI TimePointSec type. It’s essentially a timestamp.

deserialize(value)

Returns a tuple containing length of original data and deserialized value

Return type

Tuple[int, datetime]

serialize(value)

Returns byte-encoded value

Return type

bytes

class aioeos.serializer.AbiTimePointSerializer

Serializer for ABI TimePoint type. Encodes timestamp with milisecond precision.

deserialize(value)

Returns a tuple containing length of original data and deserialized value

Return type

Tuple[int, datetime]

serialize(value)

Returns byte-encoded value

Return type

bytes

class aioeos.serializer.BaseSerializer
abstract deserialize(value)

Returns a tuple containing length of original data and deserialized value

Return type

Tuple[int, Any]

abstract serialize(value)

Returns byte-encoded value

Return type

bytes

class aioeos.serializer.BasicTypeSerializer(fmt='')

Serializes basic types such as integers and floats using struct module

Params fmt

format string, please refer to documentation for struct module

deserialize(value)

Returns a tuple containing length of original data and deserialized value

Return type

Tuple[int, Any]

serialize(value)

Returns byte-encoded value

Return type

bytes

class aioeos.serializer.VarUIntSerializer

Serializer for ABI VarUInt type. This type has different length based on how many bytes are required to encode given integer.

deserialize(value)

Returns a tuple containing length of original data and deserialized value

Return type

Tuple[int, int]

serialize(value)

Returns byte-encoded value

Return type

bytes

aioeos.serializer.deserialize(value, abi_class)

Deserializes ABI values from binary format

Return type

Tuple[int, Any]

aioeos.serializer.get_abi_type_serializer(abi_type)
Return type

BaseSerializer

aioeos.serializer.serialize(value, abi_type=None)

Serializes ABI values to binary format

Return type

bytes

Types

class aioeos.types.BaseAbiObject
class aioeos.types.EosAction(account, name, authorization, data)
account: Name = None
authorization: List[EosAuthorization] = None
data: AbiActionPayload = None
name: Name = None
class aioeos.types.EosAuthorization(actor, permission)
actor: Name = None
permission: Name = None
class aioeos.types.EosExtension(extension_type, data)
data: AbiBytes = None
extension_type: UInt16 = None
class aioeos.types.EosTransaction(expiration=<factory>, ref_block_num=0, ref_block_prefix=0, max_net_usage_words=0, max_cpu_usage_ms=0, delay_sec=0, context_free_actions=<factory>, actions=<factory>, transaction_extensions=<factory>)
actions: List[EosAction] = None
context_free_actions: List[EosAction] = None
delay_sec: int = 0
expiration: TimePointSec = None
max_cpu_usage_ms: int = 0
max_net_usage_words: int = 0
ref_block_num: int = 0
ref_block_prefix: int = 0
transaction_extensions: List[EosExtension] = None