Types

Address

class Address(address: str, network: pystratis.core.networks.basenetwork.BaseNetwork)

A address model. Address is validated by the network.

address
network
static validate_values(address: str, network: pystratis.core.networks.basenetwork.BaseNetwork) bool

hexstr

class hexstr(content, *args, **kwargs)

Represents an hex string.

to_bytes() bytes

int32

class int32(value)

Represents an int32.

classmethod hex_to_int(v: Union[str, hexstr]) int
to_hex() str
validate_value(value) int
property value: int

int64

class int64(value)

Represents an int64.

classmethod hex_to_int(v: Union[str, hexstr]) int
to_hex() str
validate_value(value) int
property value: int

Money

class Money(value: Union[Money, float, decimal.Decimal, int, str])

Represents Money.

In Stratis Platform, the money is represented by STRAX coin. A satoshi is the smallest unit of a STRAX. One STRAX is equivalent to 100 millionth of a satoshis (just like in Bitcoin).

Parameters

value (Money, float, Decimal, int, str) – An amount of money. The value interpreted as a count of the STRAX coins.

Raises

ValueError – Attempt to create Money with unsupported value type. Attempt to create Money with negative value.

property value: decimal.Decimal

The amount of money, represented by fixed-point STRAX amount.

Returns

The amount of money.

Return type

Decimal

classmethod from_satoshi_units(value: int) Money

Convert satoshis to Money object. 1 STRAX is equivalent to 100 millionth of a satoshis.

Parameters

value (int) – Amount of satoshis.

Returns

The Money object.

Return type

Money

to_coin_unit() str

Represent Money object as a string.

Returns

The string contains float representation of STRAX amount. For example, 1 STRAX will be represented as ‘1.00000000’.

Return type

str

uint128

class uint128(value)

Represents an uint128.

classmethod hex_to_int(v: Union[str, hexstr]) int
to_hex() str
validate_value(value) int
property value: int

uint160

class uint160(value)

Represents an uint160.

classmethod hex_to_int(v: Union[str, hexstr]) int
to_hex() str
validate_value(value) int
property value: int

uint256

class uint256(value)

Represents an uint256.

classmethod hex_to_int(v: Union[str, hexstr]) int
to_hex() str
validate_value(value) int
property value: int

uint32

class uint32(value)

Represents an uint32.

classmethod hex_to_int(v: Union[str, hexstr]) int
to_hex() str
validate_value(value) int
property value: int

uint64

class uint64(value)

Represents an uint64.

classmethod hex_to_int(v: Union[str, hexstr]) int
to_hex() str
validate_value(value) int
property value: int