multiversx_sdk.smart_contracts package

Submodules

multiversx_sdk.smart_contracts.errors module

exception multiversx_sdk.smart_contracts.errors.ArgumentSerializationError(message: str = 'Unable to encode arguments: unsupported format or missing ABI file')[source]

Bases: Exception

exception multiversx_sdk.smart_contracts.errors.SmartContractQueryError(return_code: str, message: str)[source]

Bases: Exception

multiversx_sdk.smart_contracts.smart_contract_controller module

class multiversx_sdk.smart_contracts.smart_contract_controller.INetworkProvider(*args, **kwargs)[source]

Bases: Protocol

await_transaction_completed(transaction_hash: str | bytes, options: AwaitingOptions | None = None) TransactionOnNetwork[source]
query_contract(query: SmartContractQuery) SmartContractQueryResponse[source]
class multiversx_sdk.smart_contracts.smart_contract_controller.SmartContractController(chain_id: str, network_provider: INetworkProvider, abi: Abi | None = None)[source]

Bases: object

await_completed_deploy(transaction_hash: str | bytes) SmartContractDeployOutcome[source]
await_completed_execute(transaction_hash: str | bytes) ParsedSmartContractCallOutcome[source]
create_query(contract: Address, function: str, arguments: list[Any], caller: Address | None = None, value: int | None = None) SmartContractQuery[source]
create_transaction_for_deploy(sender: IAccount, nonce: int, bytecode: Path | bytes, gas_limit: int, arguments: Sequence[Any] = [], native_transfer_amount: int = 0, is_upgradeable: bool = True, is_readable: bool = True, is_payable: bool = False, is_payable_by_sc: bool = True, guardian: Address | None = None, relayer: Address | None = None) Transaction[source]
create_transaction_for_execute(sender: IAccount, nonce: int, contract: Address, gas_limit: int, function: str, arguments: Sequence[Any] = [], native_transfer_amount: int = 0, token_transfers: list[TokenTransfer] = [], guardian: Address | None = None, relayer: Address | None = None) Transaction[source]
create_transaction_for_upgrade(sender: IAccount, nonce: int, contract: Address, bytecode: Path | bytes, gas_limit: int, arguments: Sequence[Any] = [], native_transfer_amount: int = 0, is_upgradeable: bool = True, is_readable: bool = True, is_payable: bool = False, is_payable_by_sc: bool = True, guardian: Address | None = None, relayer: Address | None = None) Transaction[source]
parse_deploy(transaction_on_network: TransactionOnNetwork) SmartContractDeployOutcome[source]
parse_execute(transaction_on_network: TransactionOnNetwork, function: str | None = None) ParsedSmartContractCallOutcome[source]
parse_query_response(response: SmartContractQueryResponse) list[Any][source]
query(contract: Address, function: str, arguments: list[Any], caller: Address | None = None, value: int | None = None) list[Any][source]

It calls create_query(), run_query() and parse_query_response() in one go.

run_query(query: SmartContractQuery) SmartContractQueryResponse[source]

multiversx_sdk.smart_contracts.smart_contract_query module

class multiversx_sdk.smart_contracts.smart_contract_query.SmartContractQuery(contract: Address, function: str, arguments: list[bytes], caller: Address | None = None, value: int | None = None)[source]

Bases: object

class multiversx_sdk.smart_contracts.smart_contract_query.SmartContractQueryResponse(function: str, return_code: str, return_message: str, return_data_parts: list[bytes])[source]

Bases: object

multiversx_sdk.smart_contracts.smart_contract_transactions_factory module

class multiversx_sdk.smart_contracts.smart_contract_transactions_factory.SmartContractTransactionsFactory(config: TransactionsFactoryConfig, abi: Abi | None = None)[source]

Bases: object

create_transaction_for_changing_owner_address(sender: Address, contract: Address, new_owner: Address) Transaction[source]
create_transaction_for_claiming_developer_rewards(sender: Address, contract: Address) Transaction[source]
create_transaction_for_deploy(sender: Address, bytecode: Path | bytes, gas_limit: int, arguments: Sequence[Any] = [], native_transfer_amount: int = 0, is_upgradeable: bool = True, is_readable: bool = True, is_payable: bool = False, is_payable_by_sc: bool = True) Transaction[source]
create_transaction_for_execute(sender: Address, contract: Address, function: str, gas_limit: int, arguments: Sequence[Any] = [], native_transfer_amount: int = 0, token_transfers: list[TokenTransfer] = []) Transaction[source]
create_transaction_for_upgrade(sender: Address, contract: Address, bytecode: Path | bytes, gas_limit: int, arguments: Sequence[Any] = [], native_transfer_amount: int = 0, is_upgradeable: bool = True, is_readable: bool = True, is_payable: bool = False, is_payable_by_sc: bool = True) Transaction[source]

multiversx_sdk.smart_contracts.smart_contract_transactions_outcome_parser module

class multiversx_sdk.smart_contracts.smart_contract_transactions_outcome_parser.Events(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

SCDeploy = 'SCDeploy'
SignalError = 'signalError'
WriteLog = 'writeLog'
class multiversx_sdk.smart_contracts.smart_contract_transactions_outcome_parser.SmartContractCallOutcome(function: str = '', return_data_parts: list[bytes] = [], return_message: str = '', return_code: str = '')[source]

Bases: object

For internal use only.

class multiversx_sdk.smart_contracts.smart_contract_transactions_outcome_parser.SmartContractTransactionsOutcomeParser(abi: Abi | None = None)[source]

Bases: object

parse_deploy(transaction: TransactionOnNetwork) SmartContractDeployOutcome[source]
parse_execute(transaction: TransactionOnNetwork, function: str | None = None) ParsedSmartContractCallOutcome[source]

multiversx_sdk.smart_contracts.smart_contract_transactions_outcome_parser_types module

class multiversx_sdk.smart_contracts.smart_contract_transactions_outcome_parser_types.DeployedSmartContract(address: multiversx_sdk.core.address.Address, owner_address: multiversx_sdk.core.address.Address, code_hash: bytes)[source]

Bases: object

address: Address
code_hash: bytes
owner_address: Address
class multiversx_sdk.smart_contracts.smart_contract_transactions_outcome_parser_types.ParsedSmartContractCallOutcome(values: list[Any], return_code: str, return_message: str)[source]

Bases: object

return_code: str
return_message: str
values: list[Any]
class multiversx_sdk.smart_contracts.smart_contract_transactions_outcome_parser_types.SmartContractDeployOutcome(return_code: str, return_message: str, contracts: list[multiversx_sdk.smart_contracts.smart_contract_transactions_outcome_parser_types.DeployedSmartContract])[source]

Bases: object

contracts: list[DeployedSmartContract]
return_code: str
return_message: str

Module contents

class multiversx_sdk.smart_contracts.DeployedSmartContract(address: multiversx_sdk.core.address.Address, owner_address: multiversx_sdk.core.address.Address, code_hash: bytes)[source]

Bases: object

address: Address
code_hash: bytes
owner_address: Address
class multiversx_sdk.smart_contracts.ParsedSmartContractCallOutcome(values: list[Any], return_code: str, return_message: str)[source]

Bases: object

return_code: str
return_message: str
values: list[Any]
class multiversx_sdk.smart_contracts.SmartContractController(chain_id: str, network_provider: INetworkProvider, abi: Abi | None = None)[source]

Bases: object

await_completed_deploy(transaction_hash: str | bytes) SmartContractDeployOutcome[source]
await_completed_execute(transaction_hash: str | bytes) ParsedSmartContractCallOutcome[source]
create_query(contract: Address, function: str, arguments: list[Any], caller: Address | None = None, value: int | None = None) SmartContractQuery[source]
create_transaction_for_deploy(sender: IAccount, nonce: int, bytecode: Path | bytes, gas_limit: int, arguments: Sequence[Any] = [], native_transfer_amount: int = 0, is_upgradeable: bool = True, is_readable: bool = True, is_payable: bool = False, is_payable_by_sc: bool = True, guardian: Address | None = None, relayer: Address | None = None) Transaction[source]
create_transaction_for_execute(sender: IAccount, nonce: int, contract: Address, gas_limit: int, function: str, arguments: Sequence[Any] = [], native_transfer_amount: int = 0, token_transfers: list[TokenTransfer] = [], guardian: Address | None = None, relayer: Address | None = None) Transaction[source]
create_transaction_for_upgrade(sender: IAccount, nonce: int, contract: Address, bytecode: Path | bytes, gas_limit: int, arguments: Sequence[Any] = [], native_transfer_amount: int = 0, is_upgradeable: bool = True, is_readable: bool = True, is_payable: bool = False, is_payable_by_sc: bool = True, guardian: Address | None = None, relayer: Address | None = None) Transaction[source]
parse_deploy(transaction_on_network: TransactionOnNetwork) SmartContractDeployOutcome[source]
parse_execute(transaction_on_network: TransactionOnNetwork, function: str | None = None) ParsedSmartContractCallOutcome[source]
parse_query_response(response: SmartContractQueryResponse) list[Any][source]
query(contract: Address, function: str, arguments: list[Any], caller: Address | None = None, value: int | None = None) list[Any][source]

It calls create_query(), run_query() and parse_query_response() in one go.

run_query(query: SmartContractQuery) SmartContractQueryResponse[source]
class multiversx_sdk.smart_contracts.SmartContractDeployOutcome(return_code: str, return_message: str, contracts: list[multiversx_sdk.smart_contracts.smart_contract_transactions_outcome_parser_types.DeployedSmartContract])[source]

Bases: object

contracts: list[DeployedSmartContract]
return_code: str
return_message: str
class multiversx_sdk.smart_contracts.SmartContractQuery(contract: Address, function: str, arguments: list[bytes], caller: Address | None = None, value: int | None = None)[source]

Bases: object

class multiversx_sdk.smart_contracts.SmartContractQueryResponse(function: str, return_code: str, return_message: str, return_data_parts: list[bytes])[source]

Bases: object

class multiversx_sdk.smart_contracts.SmartContractTransactionsFactory(config: TransactionsFactoryConfig, abi: Abi | None = None)[source]

Bases: object

create_transaction_for_changing_owner_address(sender: Address, contract: Address, new_owner: Address) Transaction[source]
create_transaction_for_claiming_developer_rewards(sender: Address, contract: Address) Transaction[source]
create_transaction_for_deploy(sender: Address, bytecode: Path | bytes, gas_limit: int, arguments: Sequence[Any] = [], native_transfer_amount: int = 0, is_upgradeable: bool = True, is_readable: bool = True, is_payable: bool = False, is_payable_by_sc: bool = True) Transaction[source]
create_transaction_for_execute(sender: Address, contract: Address, function: str, gas_limit: int, arguments: Sequence[Any] = [], native_transfer_amount: int = 0, token_transfers: list[TokenTransfer] = []) Transaction[source]
create_transaction_for_upgrade(sender: Address, contract: Address, bytecode: Path | bytes, gas_limit: int, arguments: Sequence[Any] = [], native_transfer_amount: int = 0, is_upgradeable: bool = True, is_readable: bool = True, is_payable: bool = False, is_payable_by_sc: bool = True) Transaction[source]
class multiversx_sdk.smart_contracts.SmartContractTransactionsOutcomeParser(abi: Abi | None = None)[source]

Bases: object

parse_deploy(transaction: TransactionOnNetwork) SmartContractDeployOutcome[source]
parse_execute(transaction: TransactionOnNetwork, function: str | None = None) ParsedSmartContractCallOutcome[source]