multiversx_sdk.network_providers package

Submodules

multiversx_sdk.network_providers.account_awaiter module

class multiversx_sdk.network_providers.account_awaiter.AccountAwaiter(fetcher: IAccountFetcher, polling_interval_in_milliseconds: int | None = None, timeout_interval_in_milliseconds: int | None = None, patience_time_in_milliseconds: int | None = None)[source]

Bases: object

AccountAwaiter allows one to await until a specific event occurs on a given address.

Args:

fetcher (IAccountFetcher): Used to fetch the account of the network. polling_interval_in_milliseconds (Optional[int]): The polling interval, in milliseconds. timeout_interval_in_milliseconds (Optional[int]): The timeout, in milliseconds. patience_time_in_milliseconds (Optional[int]): The patience, an extra time (in milliseconds) to wait, after the account has reached its desired condition.

await_on_condition(address: Address, condition: Callable[[AccountOnNetwork], bool]) AccountOnNetwork[source]

Waits until the condition is satisfied.

class multiversx_sdk.network_providers.account_awaiter.IAccountFetcher(*args, **kwargs)[source]

Bases: Protocol

get_account(address: Address) AccountOnNetwork[source]

multiversx_sdk.network_providers.api_network_provider module

class multiversx_sdk.network_providers.api_network_provider.ApiNetworkProvider(url: str, address_hrp: str | None = None, config: NetworkProviderConfig | None = None)[source]

Bases: INetworkProvider

await_account_on_condition(address: Address, condition: Callable[[AccountOnNetwork], bool], options: AwaitingOptions | None = None) AccountOnNetwork[source]

Waits until an account satisfies a given condition.

await_transaction_completed(transaction_hash: str | bytes, options: AwaitingOptions | None = None) TransactionOnNetwork[source]

Waits until the transaction is completely processed.

await_transaction_on_condition(transaction_hash: str | bytes, condition: Callable[[TransactionOnNetwork], bool], options: AwaitingOptions | None = None) TransactionOnNetwork[source]

Waits until a transaction satisfies a given condition.

do_get_generic(url: str, url_parameters: dict[str, Any] | None = None) Any[source]

Does a generic GET request against the network(handles API enveloping).

do_post_generic(url: str, data: Any, url_parameters: dict[str, Any] | None = None) Any[source]

Does a generic GET request against the network(handles API enveloping).

estimate_transaction_cost(transaction: Transaction) TransactionCostResponse[source]

Estimates the cost of a transaction.

get_account(address: Address) AccountOnNetwork[source]

Fetches account information for a given address.

get_account_storage(address: Address) AccountStorage[source]

Fetches the storage (key-value pairs) of an account. When decoding the keys, the errors are ignored. Use the raw values if needed.

get_account_storage_entry(address: Address, entry_key: str) AccountStorageEntry[source]

Fetches a specific storage entry of an account.

get_block(arguments: GetBlockArguments) BlockOnNetwork[source]

Fetches a block by hash.

get_definition_of_fungible_token(token_identifier: str) FungibleTokenMetadata[source]

Fetches the definition of a fungible token.

get_definition_of_tokens_collection(collection_name: str) TokensCollectionMetadata[source]

Fetches the definition of a tokens collection.

get_fungible_tokens_of_account(address: Address) list[TokenAmountOnNetwork][source]

Fetches the balances of an account, for all fungible tokens held by the account. Pagination isn’t explicitly handled by a basic network provider, but can be achieved by using do_get_generic.

get_latest_block(shard: int | None = None) BlockOnNetwork[source]

Fetches the latest block of a shard.

get_network_config() NetworkConfig[source]

Fetches the general configuration of the network.

get_network_status(shard: int = 4294967295) NetworkStatus[source]

Fetches the current status of the network.

get_non_fungible_tokens_of_account(address: Address) list[TokenAmountOnNetwork][source]

Fetches the balances of an account, for all non-fungible tokens held by the account. Pagination isn’t explicitly handled by a basic network provider, but can be achieved by using do_get_generic.

get_token_of_account(address: Address, token: Token) TokenAmountOnNetwork[source]

Fetches the balance of an account, for a given token. Able to handle both fungible and non-fungible tokens (NFTs, SFTs, MetaESDTs).

get_transaction(transaction_hash: str | bytes) TransactionOnNetwork[source]

Fetches a transaction that was previously broadcasted (maybe already processed by the network).

query_contract(query: SmartContractQuery) SmartContractQueryResponse[source]
send_transaction(transaction: Transaction) bytes[source]

Broadcasts a transaction and returns its hash.

send_transactions(transactions: list[Transaction]) tuple[int, list[bytes]][source]

Broadcasts multiple transactions and returns a tuple of (number of accepted transactions, list of transaction hashes). In the returned list, the order of transaction hashes corresponds to the order of transactions in the input list. If a transaction is not accepted, its hash is empty in the returned list.

simulate_transaction(transaction: Transaction, check_signature: bool = False) TransactionOnNetwork[source]

Simulates a transaction.

multiversx_sdk.network_providers.config module

class multiversx_sdk.network_providers.config.NetworkProviderConfig(client_name: str | None = None, requests_options: dict[str, Any] | None = None)[source]

Bases: object

multiversx_sdk.network_providers.errors module

exception multiversx_sdk.network_providers.errors.ExpectedAccountConditionNotReachedError[source]

Bases: Exception

exception multiversx_sdk.network_providers.errors.ExpectedTransactionStatusNotReachedError[source]

Bases: Exception

exception multiversx_sdk.network_providers.errors.GenericError(url: str, data: Any)[source]

Bases: Exception

exception multiversx_sdk.network_providers.errors.TransactionFetchingError(url: str, error: Any)[source]

Bases: Exception

multiversx_sdk.network_providers.http_resources module

multiversx_sdk.network_providers.http_resources.account_from_api_response(raw_response: dict[str, Any]) AccountOnNetwork[source]
multiversx_sdk.network_providers.http_resources.account_from_proxy_response(raw_response: dict[str, Any]) AccountOnNetwork[source]
multiversx_sdk.network_providers.http_resources.account_storage_entry_from_response(raw_response: dict[str, Any], key: str) AccountStorageEntry[source]
multiversx_sdk.network_providers.http_resources.account_storage_from_response(raw_response: dict[str, Any]) AccountStorage[source]
multiversx_sdk.network_providers.http_resources.block_from_response(raw_response: dict[str, Any]) BlockOnNetwork[source]
multiversx_sdk.network_providers.http_resources.definition_of_fungible_token_from_api_response(raw_response: dict[str, Any]) FungibleTokenMetadata[source]
multiversx_sdk.network_providers.http_resources.definition_of_fungible_token_from_query_response(raw_response: list[bytes], identifier: str, address_hrp: str) FungibleTokenMetadata[source]
multiversx_sdk.network_providers.http_resources.definition_of_tokens_collection_from_api_response(raw_response: dict[str, Any]) TokensCollectionMetadata[source]
multiversx_sdk.network_providers.http_resources.definition_of_tokens_collection_from_query_response(raw_response: list[bytes], identifier: str, address_hrp: str) TokensCollectionMetadata[source]
multiversx_sdk.network_providers.http_resources.network_config_from_response(raw_response: dict[str, Any]) NetworkConfig[source]
multiversx_sdk.network_providers.http_resources.network_status_from_response(raw_response: dict[str, Any]) NetworkStatus[source]
multiversx_sdk.network_providers.http_resources.smart_contract_query_to_vm_query_request(query: SmartContractQuery) dict[str, Any][source]
multiversx_sdk.network_providers.http_resources.smart_contract_result_from_api_response(raw_response: dict[str, Any]) SmartContractResult[source]
multiversx_sdk.network_providers.http_resources.smart_contract_result_from_proxy_response(raw_response: dict[str, Any]) SmartContractResult[source]
multiversx_sdk.network_providers.http_resources.token_amount_from_api_response(raw_response: dict[str, Any]) TokenAmountOnNetwork[source]
multiversx_sdk.network_providers.http_resources.token_amount_on_network_from_proxy_response(raw_response: dict[str, Any]) TokenAmountOnNetwork[source]
multiversx_sdk.network_providers.http_resources.token_amounts_from_proxy_response(raw_response: dict[str, Any]) list[TokenAmountOnNetwork][source]
multiversx_sdk.network_providers.http_resources.transaction_cost_estimation_from_response(raw_response: dict[str, Any]) TransactionCostResponse[source]
multiversx_sdk.network_providers.http_resources.transaction_events_from_response(raw_response: dict[str, Any]) TransactionEvent[source]
multiversx_sdk.network_providers.http_resources.transaction_from_api_response(tx_hash: str, response: dict[str, Any]) TransactionOnNetwork[source]
multiversx_sdk.network_providers.http_resources.transaction_from_proxy_response(tx_hash: str, response: dict[str, Any], process_status: TransactionStatus | None = None) TransactionOnNetwork[source]
multiversx_sdk.network_providers.http_resources.transaction_from_simulate_response(original_tx: Transaction, raw_response: dict[str, Any]) TransactionOnNetwork[source]
multiversx_sdk.network_providers.http_resources.transaction_logs_from_response(raw_response: dict[str, Any]) TransactionLogs[source]
multiversx_sdk.network_providers.http_resources.transactions_from_send_multiple_response(raw_response: dict[str, Any], initial_txs_sent: int) tuple[int, list[bytes]][source]
multiversx_sdk.network_providers.http_resources.vm_query_response_to_smart_contract_query_response(raw_response: dict[str, Any], function: str) SmartContractQueryResponse[source]

multiversx_sdk.network_providers.interface module

class multiversx_sdk.network_providers.interface.INetworkProvider(*args, **kwargs)[source]

Bases: Protocol

await_account_on_condition(address: Address, condition: Callable[[AccountOnNetwork], bool], options: AwaitingOptions | None) AccountOnNetwork[source]
await_transaction_completed(transaction_hash: bytes | str, options: AwaitingOptions | None) TransactionOnNetwork[source]
await_transaction_on_condition(transaction_hash: bytes | str, condition: Callable[[TransactionOnNetwork], bool], options: AwaitingOptions | None) TransactionOnNetwork[source]
do_get_generic(url: str, url_parameters: dict[str, Any] | None) Any[source]
do_post_generic(url: str, data: Any, url_parameters: dict[str, Any] | None) Any[source]
estimate_transaction_cost(transaction: Transaction) TransactionCostResponse[source]
get_account(address: Address) AccountOnNetwork[source]
get_account_storage(address: Address) AccountStorage[source]
get_account_storage_entry(address: Address, entry_key: str) AccountStorageEntry[source]
get_block(arguments: GetBlockArguments) BlockOnNetwork[source]
get_definition_of_fungible_token(token_identifier: str) FungibleTokenMetadata[source]
get_definition_of_tokens_collection(collection_name: str) TokensCollectionMetadata[source]
get_fungible_tokens_of_account(address: Address) list[TokenAmountOnNetwork][source]
get_latest_block(shard: int) BlockOnNetwork[source]
get_network_config() NetworkConfig[source]
get_network_status(shard: int) NetworkStatus[source]
get_non_fungible_tokens_of_account(address: Address) list[TokenAmountOnNetwork][source]
get_token_of_account(address: Address, token: Token) TokenAmountOnNetwork[source]
get_transaction(transaction_hash: bytes | str) TransactionOnNetwork[source]
query_contract(query: SmartContractQuery) SmartContractQueryResponse[source]
send_transaction(transaction: Transaction) bytes[source]
send_transactions(transactions: list[Transaction]) tuple[int, list[bytes]][source]
simulate_transaction(transaction: Transaction) TransactionOnNetwork[source]

multiversx_sdk.network_providers.proxy_network_provider module

class multiversx_sdk.network_providers.proxy_network_provider.ProxyNetworkProvider(url: str, address_hrp: str | None = None, config: NetworkProviderConfig | None = None)[source]

Bases: INetworkProvider

await_account_on_condition(address: Address, condition: Callable[[AccountOnNetwork], bool], options: AwaitingOptions | None = None) AccountOnNetwork[source]

Waits until an account satisfies a given condition.

await_transaction_completed(transaction_hash: bytes | str, options: AwaitingOptions | None = None) TransactionOnNetwork[source]

Waits until the transaction is completely processed.

await_transaction_on_condition(transaction_hash: str | bytes, condition: Callable[[TransactionOnNetwork], bool], options: AwaitingOptions | None = None) TransactionOnNetwork[source]

Waits until a transaction satisfies a given condition.

do_get_generic(url: str, url_parameters: dict[str, Any] | None = None) GenericResponse[source]

Does a generic GET request against the network (handles API enveloping).

do_post_generic(url: str, data: Any, url_parameters: dict[str, Any] | None = None) GenericResponse[source]

Does a generic GET request against the network (handles API enveloping).

estimate_transaction_cost(transaction: Transaction) TransactionCostResponse[source]

Estimates the cost of a transaction.

get_account(address: Address) AccountOnNetwork[source]

Fetches account information for a given address.

get_account_storage(address: Address) AccountStorage[source]

Fetches the storage (key-value pairs) of an account. When decoding the keys, the errors are ignored. Use the raw values if needed.

get_account_storage_entry(address: Address, entry_key: str) AccountStorageEntry[source]

Fetches a specific storage entry of an account.

get_block(arguments: GetBlockArguments) BlockOnNetwork[source]

Fetches a block by nonce or by hash.

get_definition_of_fungible_token(token_identifier: str) FungibleTokenMetadata[source]

Fetches the definition of a fungible token.

get_definition_of_tokens_collection(collection_name: str) TokensCollectionMetadata[source]

Fetches the definition of a tokens collection.

get_fungible_tokens_of_account(address: Address) list[TokenAmountOnNetwork][source]

Fetches the balances of an account, for all fungible tokens held by the account. Pagination isn’t explicitly handled by a basic network provider, but can be achieved by using do_get_generic.

get_latest_block(shard: int = 4294967295) BlockOnNetwork[source]

Fetches the latest block of a shard.

get_network_config() NetworkConfig[source]

Fetches the general configuration of the network.

get_network_status(shard: int = 4294967295) NetworkStatus[source]

Fetches the current status of the network.

get_non_fungible_tokens_of_account(address: Address) list[TokenAmountOnNetwork][source]

Fetches the balances of an account, for all non-fungible tokens held by the account. Pagination isn’t explicitly handled by a basic network provider, but can be achieved by using do_get_generic.

get_token_of_account(address: Address, token: Token) TokenAmountOnNetwork[source]

Fetches the balance of an account, for a given token. Able to handle both fungible and non-fungible tokens (NFTs, SFTs, MetaESDTs).

get_transaction(transaction_hash: bytes | str) TransactionOnNetwork[source]

Fetches a transaction that was previously broadcasted (maybe already processed by the network).

get_transaction_status(tx_hash: str) TransactionStatus[source]

Fetches the status of a transaction.

query_contract(query: SmartContractQuery) SmartContractQueryResponse[source]

Queries a smart contract.

send_transaction(transaction: Transaction) bytes[source]

Broadcasts a transaction and returns its hash.

send_transactions(transactions: list[Transaction]) tuple[int, list[bytes]][source]

Broadcasts multiple transactions and returns a tuple of (number of accepted transactions, list of transaction hashes). In the returned list, the order of transaction hashes corresponds to the order of transactions in the input list. If a transaction is not accepted, its hash is empty in the returned list.

simulate_transaction(transaction: Transaction, check_signature: bool = False) TransactionOnNetwork[source]

Simulates a transaction.

multiversx_sdk.network_providers.resources module

class multiversx_sdk.network_providers.resources.AccountOnNetwork(raw: dict[str, Any], address: multiversx_sdk.core.address.Address, nonce: int, balance: int, is_guarded: bool, username: str = '', block_coordinates: multiversx_sdk.network_providers.resources.BlockCoordinates | None = None, contract_code_hash: bytes = b'', contract_code: bytes = b'', contract_developer_reward: int = 0, contract_owner_address: multiversx_sdk.core.address.Address | None = None, is_contract_upgradable: bool = False, is_contract_readable: bool = False, is_contract_payable: bool = False, is_contract_payable_by_contract: bool = False)[source]

Bases: object

address: Address
balance: int
block_coordinates: BlockCoordinates | None = None
contract_code: bytes = b''
contract_code_hash: bytes = b''
contract_developer_reward: int = 0
contract_owner_address: Address | None = None
is_contract_payable: bool = False
is_contract_payable_by_contract: bool = False
is_contract_readable: bool = False
is_contract_upgradable: bool = False
is_guarded: bool
nonce: int
raw: dict[str, Any]
username: str = ''
class multiversx_sdk.network_providers.resources.AccountStorage(raw: dict[str, Any], entries: list[multiversx_sdk.network_providers.resources.AccountStorageEntry], block_coordinates: multiversx_sdk.network_providers.resources.BlockCoordinates | None = None)[source]

Bases: object

block_coordinates: BlockCoordinates | None = None
entries: list[AccountStorageEntry]
raw: dict[str, Any]
class multiversx_sdk.network_providers.resources.AccountStorageEntry(raw: dict[str, Any], key: str, value: bytes, block_coordinates: multiversx_sdk.network_providers.resources.BlockCoordinates | None = None)[source]

Bases: object

block_coordinates: BlockCoordinates | None = None
key: str
raw: dict[str, Any]
value: bytes
class multiversx_sdk.network_providers.resources.AwaitingOptions(polling_interval_in_milliseconds: int = 6000, timeout_in_milliseconds: int = 90000, patience_in_milliseconds: int = 3000)[source]

Bases: object

patience_in_milliseconds: int = 3000
polling_interval_in_milliseconds: int = 6000
timeout_in_milliseconds: int = 90000
class multiversx_sdk.network_providers.resources.BlockCoordinates(nonce: str, hash: bytes, root_hash: bytes)[source]

Bases: object

hash: bytes
nonce: str
root_hash: bytes
class multiversx_sdk.network_providers.resources.BlockOnNetwork(raw: dict[str, Any], shard: int, nonce: int, hash: bytes, previous_hash: bytes, timestamp: int, round: int, epoch: int)[source]

Bases: object

epoch: int
hash: bytes
nonce: int
previous_hash: bytes
raw: dict[str, Any]
round: int
shard: int
timestamp: int
class multiversx_sdk.network_providers.resources.FungibleTokenMetadata(raw: dict[str, Any], identifier: str, name: str, ticker: str, owner: str, decimals: int)[source]

Bases: object

decimals: int
identifier: str
name: str
owner: str
raw: dict[str, Any]
ticker: str
class multiversx_sdk.network_providers.resources.GenericResponse(data: Any)[source]

Bases: object

get(key: str, default: Any = None) Any[source]
to_dictionary() dict[str, Any][source]
class multiversx_sdk.network_providers.resources.GetBlockArguments(shard: int | None = None, block_nonce: int | None = None, block_hash: bytes | None = None)[source]

Bases: object

block_hash: bytes | None = None
block_nonce: int | None = None
shard: int | None = None
class multiversx_sdk.network_providers.resources.NetworkConfig(raw: dict[str, Any], chain_id: str, gas_per_data_byte: int, gas_price_modifier: float, min_gas_limit: int, min_gas_price: int, extra_gas_limit_for_guarded_transactions: int, num_shards: int, round_duration: int, num_rounds_per_epoch: int, genesis_timestamp: int)[source]

Bases: object

chain_id: str
extra_gas_limit_for_guarded_transactions: int
gas_per_data_byte: int
gas_price_modifier: float
genesis_timestamp: int
min_gas_limit: int
min_gas_price: int
num_rounds_per_epoch: int
num_shards: int
raw: dict[str, Any]
round_duration: int
class multiversx_sdk.network_providers.resources.NetworkStatus(raw: dict[str, Any], block_timestamp: int, block_nonce: int, highest_final_block_nonce: int, current_round: int, current_epoch: int)[source]

Bases: object

block_nonce: int
block_timestamp: int
current_epoch: int
current_round: int
highest_final_block_nonce: int
raw: dict[str, Any]
class multiversx_sdk.network_providers.resources.TokenAmountOnNetwork(raw: dict[str, Any], token: multiversx_sdk.core.tokens.Token, amount: int, block_coordinates: multiversx_sdk.network_providers.resources.BlockCoordinates | None = None)[source]

Bases: object

amount: int
block_coordinates: BlockCoordinates | None = None
raw: dict[str, Any]
token: Token
class multiversx_sdk.network_providers.resources.TokensCollectionMetadata(raw: dict[str, Any], collection: str, type: str, name: str, ticker: str, owner: str, decimals: int)[source]

Bases: object

collection: str
decimals: int
name: str
owner: str
raw: dict[str, Any]
ticker: str
type: str
class multiversx_sdk.network_providers.resources.TransactionCostResponse(raw: dict[str, Any], gas_limit: int, status: multiversx_sdk.core.transaction_status.TransactionStatus)[source]

Bases: object

gas_limit: int
raw: dict[str, Any]
status: TransactionStatus

multiversx_sdk.network_providers.shared module

multiversx_sdk.network_providers.shared.convert_tx_hash_to_string(tx_hash: bytes | str) str[source]

multiversx_sdk.network_providers.transaction_awaiter module

class multiversx_sdk.network_providers.transaction_awaiter.ITransactionFetcher(*args, **kwargs)[source]

Bases: Protocol

get_transaction(transaction_hash: bytes | str) TransactionOnNetwork[source]
class multiversx_sdk.network_providers.transaction_awaiter.TransactionAwaiter(fetcher: ITransactionFetcher, polling_interval_in_milliseconds: int | None = None, timeout_interval_in_milliseconds: int | None = None, patience_time_in_milliseconds: int | None = None)[source]

Bases: object

TransactionAwaiter allows one to await until a specific event (such as transaction completion) occurs on a given transaction.

Args:

fetcher (ITransactionFetcher): Used to fetch the transaction of the network. polling_interval_in_milliseconds (Optional[int]): The polling interval, in milliseconds. timeout_interval_in_milliseconds (Optional[int]): The timeout, in milliseconds. patience_time_in_milliseconds (Optional[int]): The patience, an extra time (in milliseconds) to wait, after the transaction has reached its desired status. Currently there’s a delay between the moment a transaction is marked as “completed” and the moment its outcome (contract results, events and logs) is available.

await_completed(transaction_hash: str | bytes) TransactionOnNetwork[source]

Waits until the transaction is completely processed.

await_on_condition(transaction_hash: str | bytes, condition: Callable[[TransactionOnNetwork], bool]) TransactionOnNetwork[source]

Waits until the condition is satisfied.

multiversx_sdk.network_providers.transaction_decoder module

class multiversx_sdk.network_providers.transaction_decoder.TransactionDecoder[source]

Bases: object

get_esdt_transaction_metadata(metadata: TransactionMetadata) TransactionMetadata | None[source]
get_multi_transfer_metadata(metadata: TransactionMetadata) TransactionMetadata | None[source]
get_nft_transfer_metadata(metadata: TransactionMetadata) TransactionMetadata | None[source]
get_normal_transaction_metadata(transaction: TransactionOnNetwork) TransactionMetadata[source]
get_transaction_metadata(transaction: TransactionOnNetwork) TransactionMetadata[source]
hex_to_number(hex: str) int[source]
hex_to_string(hex: str) str[source]
is_address_valid(address: str) bool[source]
is_hex(value: str) bool[source]
is_smart_contract_call_argument(arg: str) bool[source]
class multiversx_sdk.network_providers.transaction_decoder.TransactionMetadata[source]

Bases: object

to_dict() dict[str, Any][source]

multiversx_sdk.network_providers.user_agent module

multiversx_sdk.network_providers.user_agent.extend_user_agent(user_agent_prefix: str, config: NetworkProviderConfig)[source]

Module contents

class multiversx_sdk.network_providers.AccountAwaiter(fetcher: IAccountFetcher, polling_interval_in_milliseconds: int | None = None, timeout_interval_in_milliseconds: int | None = None, patience_time_in_milliseconds: int | None = None)[source]

Bases: object

AccountAwaiter allows one to await until a specific event occurs on a given address.

Args:

fetcher (IAccountFetcher): Used to fetch the account of the network. polling_interval_in_milliseconds (Optional[int]): The polling interval, in milliseconds. timeout_interval_in_milliseconds (Optional[int]): The timeout, in milliseconds. patience_time_in_milliseconds (Optional[int]): The patience, an extra time (in milliseconds) to wait, after the account has reached its desired condition.

await_on_condition(address: Address, condition: Callable[[AccountOnNetwork], bool]) AccountOnNetwork[source]

Waits until the condition is satisfied.

class multiversx_sdk.network_providers.AccountOnNetwork(raw: dict[str, Any], address: multiversx_sdk.core.address.Address, nonce: int, balance: int, is_guarded: bool, username: str = '', block_coordinates: multiversx_sdk.network_providers.resources.BlockCoordinates | None = None, contract_code_hash: bytes = b'', contract_code: bytes = b'', contract_developer_reward: int = 0, contract_owner_address: multiversx_sdk.core.address.Address | None = None, is_contract_upgradable: bool = False, is_contract_readable: bool = False, is_contract_payable: bool = False, is_contract_payable_by_contract: bool = False)[source]

Bases: object

address: Address
balance: int
block_coordinates: BlockCoordinates | None = None
contract_code: bytes = b''
contract_code_hash: bytes = b''
contract_developer_reward: int = 0
contract_owner_address: Address | None = None
is_contract_payable: bool = False
is_contract_payable_by_contract: bool = False
is_contract_readable: bool = False
is_contract_upgradable: bool = False
is_guarded: bool
nonce: int
raw: dict[str, Any]
username: str = ''
class multiversx_sdk.network_providers.AccountStorage(raw: dict[str, Any], entries: list[multiversx_sdk.network_providers.resources.AccountStorageEntry], block_coordinates: multiversx_sdk.network_providers.resources.BlockCoordinates | None = None)[source]

Bases: object

block_coordinates: BlockCoordinates | None = None
entries: list[AccountStorageEntry]
raw: dict[str, Any]
class multiversx_sdk.network_providers.AccountStorageEntry(raw: dict[str, Any], key: str, value: bytes, block_coordinates: multiversx_sdk.network_providers.resources.BlockCoordinates | None = None)[source]

Bases: object

block_coordinates: BlockCoordinates | None = None
key: str
raw: dict[str, Any]
value: bytes
class multiversx_sdk.network_providers.ApiNetworkProvider(url: str, address_hrp: str | None = None, config: NetworkProviderConfig | None = None)[source]

Bases: INetworkProvider

await_account_on_condition(address: Address, condition: Callable[[AccountOnNetwork], bool], options: AwaitingOptions | None = None) AccountOnNetwork[source]

Waits until an account satisfies a given condition.

await_transaction_completed(transaction_hash: str | bytes, options: AwaitingOptions | None = None) TransactionOnNetwork[source]

Waits until the transaction is completely processed.

await_transaction_on_condition(transaction_hash: str | bytes, condition: Callable[[TransactionOnNetwork], bool], options: AwaitingOptions | None = None) TransactionOnNetwork[source]

Waits until a transaction satisfies a given condition.

do_get_generic(url: str, url_parameters: dict[str, Any] | None = None) Any[source]

Does a generic GET request against the network(handles API enveloping).

do_post_generic(url: str, data: Any, url_parameters: dict[str, Any] | None = None) Any[source]

Does a generic GET request against the network(handles API enveloping).

estimate_transaction_cost(transaction: Transaction) TransactionCostResponse[source]

Estimates the cost of a transaction.

get_account(address: Address) AccountOnNetwork[source]

Fetches account information for a given address.

get_account_storage(address: Address) AccountStorage[source]

Fetches the storage (key-value pairs) of an account. When decoding the keys, the errors are ignored. Use the raw values if needed.

get_account_storage_entry(address: Address, entry_key: str) AccountStorageEntry[source]

Fetches a specific storage entry of an account.

get_block(arguments: GetBlockArguments) BlockOnNetwork[source]

Fetches a block by hash.

get_definition_of_fungible_token(token_identifier: str) FungibleTokenMetadata[source]

Fetches the definition of a fungible token.

get_definition_of_tokens_collection(collection_name: str) TokensCollectionMetadata[source]

Fetches the definition of a tokens collection.

get_fungible_tokens_of_account(address: Address) list[TokenAmountOnNetwork][source]

Fetches the balances of an account, for all fungible tokens held by the account. Pagination isn’t explicitly handled by a basic network provider, but can be achieved by using do_get_generic.

get_latest_block(shard: int | None = None) BlockOnNetwork[source]

Fetches the latest block of a shard.

get_network_config() NetworkConfig[source]

Fetches the general configuration of the network.

get_network_status(shard: int = 4294967295) NetworkStatus[source]

Fetches the current status of the network.

get_non_fungible_tokens_of_account(address: Address) list[TokenAmountOnNetwork][source]

Fetches the balances of an account, for all non-fungible tokens held by the account. Pagination isn’t explicitly handled by a basic network provider, but can be achieved by using do_get_generic.

get_token_of_account(address: Address, token: Token) TokenAmountOnNetwork[source]

Fetches the balance of an account, for a given token. Able to handle both fungible and non-fungible tokens (NFTs, SFTs, MetaESDTs).

get_transaction(transaction_hash: str | bytes) TransactionOnNetwork[source]

Fetches a transaction that was previously broadcasted (maybe already processed by the network).

query_contract(query: SmartContractQuery) SmartContractQueryResponse[source]
send_transaction(transaction: Transaction) bytes[source]

Broadcasts a transaction and returns its hash.

send_transactions(transactions: list[Transaction]) tuple[int, list[bytes]][source]

Broadcasts multiple transactions and returns a tuple of (number of accepted transactions, list of transaction hashes). In the returned list, the order of transaction hashes corresponds to the order of transactions in the input list. If a transaction is not accepted, its hash is empty in the returned list.

simulate_transaction(transaction: Transaction, check_signature: bool = False) TransactionOnNetwork[source]

Simulates a transaction.

class multiversx_sdk.network_providers.AwaitingOptions(polling_interval_in_milliseconds: int = 6000, timeout_in_milliseconds: int = 90000, patience_in_milliseconds: int = 3000)[source]

Bases: object

patience_in_milliseconds: int = 3000
polling_interval_in_milliseconds: int = 6000
timeout_in_milliseconds: int = 90000
class multiversx_sdk.network_providers.BlockCoordinates(nonce: str, hash: bytes, root_hash: bytes)[source]

Bases: object

hash: bytes
nonce: str
root_hash: bytes
class multiversx_sdk.network_providers.BlockOnNetwork(raw: dict[str, Any], shard: int, nonce: int, hash: bytes, previous_hash: bytes, timestamp: int, round: int, epoch: int)[source]

Bases: object

epoch: int
hash: bytes
nonce: int
previous_hash: bytes
raw: dict[str, Any]
round: int
shard: int
timestamp: int
class multiversx_sdk.network_providers.FungibleTokenMetadata(raw: dict[str, Any], identifier: str, name: str, ticker: str, owner: str, decimals: int)[source]

Bases: object

decimals: int
identifier: str
name: str
owner: str
raw: dict[str, Any]
ticker: str
exception multiversx_sdk.network_providers.GenericError(url: str, data: Any)[source]

Bases: Exception

class multiversx_sdk.network_providers.GenericResponse(data: Any)[source]

Bases: object

get(key: str, default: Any = None) Any[source]
to_dictionary() dict[str, Any][source]
class multiversx_sdk.network_providers.GetBlockArguments(shard: int | None = None, block_nonce: int | None = None, block_hash: bytes | None = None)[source]

Bases: object

block_hash: bytes | None = None
block_nonce: int | None = None
shard: int | None = None
class multiversx_sdk.network_providers.NetworkConfig(raw: dict[str, Any], chain_id: str, gas_per_data_byte: int, gas_price_modifier: float, min_gas_limit: int, min_gas_price: int, extra_gas_limit_for_guarded_transactions: int, num_shards: int, round_duration: int, num_rounds_per_epoch: int, genesis_timestamp: int)[source]

Bases: object

chain_id: str
extra_gas_limit_for_guarded_transactions: int
gas_per_data_byte: int
gas_price_modifier: float
genesis_timestamp: int
min_gas_limit: int
min_gas_price: int
num_rounds_per_epoch: int
num_shards: int
raw: dict[str, Any]
round_duration: int
class multiversx_sdk.network_providers.NetworkProviderConfig(client_name: str | None = None, requests_options: dict[str, Any] | None = None)[source]

Bases: object

class multiversx_sdk.network_providers.NetworkStatus(raw: dict[str, Any], block_timestamp: int, block_nonce: int, highest_final_block_nonce: int, current_round: int, current_epoch: int)[source]

Bases: object

block_nonce: int
block_timestamp: int
current_epoch: int
current_round: int
highest_final_block_nonce: int
raw: dict[str, Any]
class multiversx_sdk.network_providers.ProxyNetworkProvider(url: str, address_hrp: str | None = None, config: NetworkProviderConfig | None = None)[source]

Bases: INetworkProvider

await_account_on_condition(address: Address, condition: Callable[[AccountOnNetwork], bool], options: AwaitingOptions | None = None) AccountOnNetwork[source]

Waits until an account satisfies a given condition.

await_transaction_completed(transaction_hash: bytes | str, options: AwaitingOptions | None = None) TransactionOnNetwork[source]

Waits until the transaction is completely processed.

await_transaction_on_condition(transaction_hash: str | bytes, condition: Callable[[TransactionOnNetwork], bool], options: AwaitingOptions | None = None) TransactionOnNetwork[source]

Waits until a transaction satisfies a given condition.

do_get_generic(url: str, url_parameters: dict[str, Any] | None = None) GenericResponse[source]

Does a generic GET request against the network (handles API enveloping).

do_post_generic(url: str, data: Any, url_parameters: dict[str, Any] | None = None) GenericResponse[source]

Does a generic GET request against the network (handles API enveloping).

estimate_transaction_cost(transaction: Transaction) TransactionCostResponse[source]

Estimates the cost of a transaction.

get_account(address: Address) AccountOnNetwork[source]

Fetches account information for a given address.

get_account_storage(address: Address) AccountStorage[source]

Fetches the storage (key-value pairs) of an account. When decoding the keys, the errors are ignored. Use the raw values if needed.

get_account_storage_entry(address: Address, entry_key: str) AccountStorageEntry[source]

Fetches a specific storage entry of an account.

get_block(arguments: GetBlockArguments) BlockOnNetwork[source]

Fetches a block by nonce or by hash.

get_definition_of_fungible_token(token_identifier: str) FungibleTokenMetadata[source]

Fetches the definition of a fungible token.

get_definition_of_tokens_collection(collection_name: str) TokensCollectionMetadata[source]

Fetches the definition of a tokens collection.

get_fungible_tokens_of_account(address: Address) list[TokenAmountOnNetwork][source]

Fetches the balances of an account, for all fungible tokens held by the account. Pagination isn’t explicitly handled by a basic network provider, but can be achieved by using do_get_generic.

get_latest_block(shard: int = 4294967295) BlockOnNetwork[source]

Fetches the latest block of a shard.

get_network_config() NetworkConfig[source]

Fetches the general configuration of the network.

get_network_status(shard: int = 4294967295) NetworkStatus[source]

Fetches the current status of the network.

get_non_fungible_tokens_of_account(address: Address) list[TokenAmountOnNetwork][source]

Fetches the balances of an account, for all non-fungible tokens held by the account. Pagination isn’t explicitly handled by a basic network provider, but can be achieved by using do_get_generic.

get_token_of_account(address: Address, token: Token) TokenAmountOnNetwork[source]

Fetches the balance of an account, for a given token. Able to handle both fungible and non-fungible tokens (NFTs, SFTs, MetaESDTs).

get_transaction(transaction_hash: bytes | str) TransactionOnNetwork[source]

Fetches a transaction that was previously broadcasted (maybe already processed by the network).

get_transaction_status(tx_hash: str) TransactionStatus[source]

Fetches the status of a transaction.

query_contract(query: SmartContractQuery) SmartContractQueryResponse[source]

Queries a smart contract.

send_transaction(transaction: Transaction) bytes[source]

Broadcasts a transaction and returns its hash.

send_transactions(transactions: list[Transaction]) tuple[int, list[bytes]][source]

Broadcasts multiple transactions and returns a tuple of (number of accepted transactions, list of transaction hashes). In the returned list, the order of transaction hashes corresponds to the order of transactions in the input list. If a transaction is not accepted, its hash is empty in the returned list.

simulate_transaction(transaction: Transaction, check_signature: bool = False) TransactionOnNetwork[source]

Simulates a transaction.

class multiversx_sdk.network_providers.TokenAmountOnNetwork(raw: dict[str, Any], token: multiversx_sdk.core.tokens.Token, amount: int, block_coordinates: multiversx_sdk.network_providers.resources.BlockCoordinates | None = None)[source]

Bases: object

amount: int
block_coordinates: BlockCoordinates | None = None
raw: dict[str, Any]
token: Token
class multiversx_sdk.network_providers.TokensCollectionMetadata(raw: dict[str, Any], collection: str, type: str, name: str, ticker: str, owner: str, decimals: int)[source]

Bases: object

collection: str
decimals: int
name: str
owner: str
raw: dict[str, Any]
ticker: str
type: str
class multiversx_sdk.network_providers.TransactionAwaiter(fetcher: ITransactionFetcher, polling_interval_in_milliseconds: int | None = None, timeout_interval_in_milliseconds: int | None = None, patience_time_in_milliseconds: int | None = None)[source]

Bases: object

TransactionAwaiter allows one to await until a specific event (such as transaction completion) occurs on a given transaction.

Args:

fetcher (ITransactionFetcher): Used to fetch the transaction of the network. polling_interval_in_milliseconds (Optional[int]): The polling interval, in milliseconds. timeout_interval_in_milliseconds (Optional[int]): The timeout, in milliseconds. patience_time_in_milliseconds (Optional[int]): The patience, an extra time (in milliseconds) to wait, after the transaction has reached its desired status. Currently there’s a delay between the moment a transaction is marked as “completed” and the moment its outcome (contract results, events and logs) is available.

await_completed(transaction_hash: str | bytes) TransactionOnNetwork[source]

Waits until the transaction is completely processed.

await_on_condition(transaction_hash: str | bytes, condition: Callable[[TransactionOnNetwork], bool]) TransactionOnNetwork[source]

Waits until the condition is satisfied.

class multiversx_sdk.network_providers.TransactionCostResponse(raw: dict[str, Any], gas_limit: int, status: multiversx_sdk.core.transaction_status.TransactionStatus)[source]

Bases: object

gas_limit: int
raw: dict[str, Any]
status: TransactionStatus
class multiversx_sdk.network_providers.TransactionDecoder[source]

Bases: object

get_esdt_transaction_metadata(metadata: TransactionMetadata) TransactionMetadata | None[source]
get_multi_transfer_metadata(metadata: TransactionMetadata) TransactionMetadata | None[source]
get_nft_transfer_metadata(metadata: TransactionMetadata) TransactionMetadata | None[source]
get_normal_transaction_metadata(transaction: TransactionOnNetwork) TransactionMetadata[source]
get_transaction_metadata(transaction: TransactionOnNetwork) TransactionMetadata[source]
hex_to_number(hex: str) int[source]
hex_to_string(hex: str) str[source]
is_address_valid(address: str) bool[source]
is_hex(value: str) bool[source]
is_smart_contract_call_argument(arg: str) bool[source]
class multiversx_sdk.network_providers.TransactionMetadata[source]

Bases: object

to_dict() dict[str, Any][source]