Skip to content

Commit

Permalink
Merge branch 'feat/next' into multisig
Browse files Browse the repository at this point in the history
  • Loading branch information
andreibancioiu committed Dec 10, 2024
2 parents ab6497e + f548eca commit 6137929
Show file tree
Hide file tree
Showing 164 changed files with 7,445 additions and 5,469 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: CI

on:
pull_request:
branches: [ main, feat/* ]
workflow_dispatch:

jobs:
Expand Down
14 changes: 11 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v5.0.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/hhatto/autopep8
rev: v2.0.4
rev: v2.3.1
hooks:
- id: autopep8
args:
- "-i"
- "--max-line-length=100"
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
rev: 7.1.1
hooks:
- id: flake8
args:
- "--config=.flake8"
- repo: https://github.com/PyCQA/autoflake
rev: v2.3.1
hooks:
- id: autoflake
args:
- --in-place
- --remove-all-unused-imports
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ Install development dependencies, as well:
pip install -r ./requirements-dev.txt --upgrade
```

Allow `pre-commit` to automatically run on `git commit`:
```
pre-commit install
```

Above, `requirements.txt` should mirror the **dependencies** section of `pyproject.toml`.

If using VSCode, restart it or follow these steps:
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
project = 'multiversx-sdk'
copyright = '2024, MultiversX'
author = 'MultiversX'
release = '0.11.0'
release = '0.19.0'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
16 changes: 16 additions & 0 deletions docs/multiversx_sdk.abi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ multiversx\_sdk.abi.bytes\_value module
:undoc-members:
:show-inheritance:

multiversx\_sdk.abi.code\_metadata\_value module
------------------------------------------------

.. automodule:: multiversx_sdk.abi.code_metadata_value
:members:
:undoc-members:
:show-inheritance:

multiversx\_sdk.abi.codec module
--------------------------------

Expand All @@ -92,6 +100,14 @@ multiversx\_sdk.abi.enum\_value module
:undoc-members:
:show-inheritance:

multiversx\_sdk.abi.explicit\_enum\_value module
------------------------------------------------

.. automodule:: multiversx_sdk.abi.explicit_enum_value
:members:
:undoc-members:
:show-inheritance:

multiversx\_sdk.abi.fields module
---------------------------------

Expand Down
8 changes: 8 additions & 0 deletions docs/multiversx_sdk.core.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ multiversx\_sdk.core.codec module
:undoc-members:
:show-inheritance:

multiversx\_sdk.core.config module
----------------------------------

.. automodule:: multiversx_sdk.core.config
:members:
:undoc-members:
:show-inheritance:

multiversx\_sdk.core.contract\_query module
-------------------------------------------

Expand Down
8 changes: 8 additions & 0 deletions docs/multiversx_sdk.network_providers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,14 @@ multiversx\_sdk.network\_providers.transactions module
:undoc-members:
:show-inheritance:

multiversx\_sdk.network\_providers.user\_agent module
-----------------------------------------------------

.. automodule:: multiversx_sdk.network_providers.user_agent
:members:
:undoc-members:
:show-inheritance:

multiversx\_sdk.network\_providers.utils module
-----------------------------------------------

Expand Down
43 changes: 42 additions & 1 deletion examples/Cookbook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,47 @@
"print(\"Is contract:\", address.is_smart_contract())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Changing the default hrp\n",
"\n",
"We have a configuration class, called `LibraryConfig`, that only stores (for the moment) the **default hrp** of the addresses. The default value is `erd`. The hrp can be changed when instantiating an address, or it can be changed in the `LibraryConfig` class, and all the addresses created will have the newly set hrp. "
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"erd\n",
"erd1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ssycr6th\n",
"test1qyu5wthldzr8wx5c9ucg8kjagg0jfs53s8nr3zpz3hypefsdd8ss5hqhtr\n"
]
}
],
"source": [
"from multiversx_sdk import Address\n",
"from multiversx_sdk import LibraryConfig\n",
"\n",
"\n",
"print(LibraryConfig.default_address_hrp)\n",
"address = Address.new_from_hex(\"0139472eff6886771a982f3083da5d421f24c29181e63888228dc81ca60d69e1\")\n",
"print(address.to_bech32())\n",
"\n",
"LibraryConfig.default_address_hrp = \"test\"\n",
"address = Address.new_from_hex(\"0139472eff6886771a982f3083da5d421f24c29181e63888228dc81ca60d69e1\")\n",
"print(address.to_bech32())\n",
"\n",
"# setting back the default value\n",
"LibraryConfig.default_address_hrp = \"erd\""
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -2352,7 +2393,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.12.3"
},
"orig_nbformat": 4,
"vscode": {
Expand Down
185 changes: 78 additions & 107 deletions multiversx_sdk/__init__.py
Original file line number Diff line number Diff line change
@@ -1,115 +1,86 @@
from multiversx_sdk.controllers.account_controller import AccountController
from multiversx_sdk.controllers.delegation_controller import \
DelegationController
from multiversx_sdk.controllers.relayed_controller import RelayedController
from multiversx_sdk.controllers.smart_contract_controller import \
SmartContractController
from multiversx_sdk.controllers.token_management_controller import \
TokenManagementController
from multiversx_sdk.controllers.transfers_controller import TransfersController
from multiversx_sdk.converters.transactions_converter import \
TransactionsConverter
from multiversx_sdk.core.account import AccountNonceHolder
from multiversx_sdk.core.address import (Address, AddressComputer,
AddressFactory)
from multiversx_sdk.core.code_metadata import CodeMetadata
from multiversx_sdk.core.message import Message, MessageComputer
from multiversx_sdk.core.smart_contract_queries_controller import \
SmartContractQueriesController
from multiversx_sdk.core.smart_contract_query import (
SmartContractQuery, SmartContractQueryResponse)
from multiversx_sdk.core.tokens import (Token, TokenComputer,
TokenIdentifierParts, TokenTransfer)
from multiversx_sdk.core.transaction import Transaction
from multiversx_sdk.core.transaction_computer import TransactionComputer
from multiversx_sdk.core.transaction_on_network import (
SmartContractResult, TransactionEvent, TransactionLogs,
TransactionOnNetwork, TransactionStatus, find_events_by_first_topic,
find_events_by_identifier)
from multiversx_sdk.core.transactions_factories.account_transactions_factory import \
AccountTransactionsFactory
from multiversx_sdk.core.transactions_factories.delegation_transactions_factory import \
DelegationTransactionsFactory
from multiversx_sdk.core.transactions_factories.relayed_transactions_factory import \
RelayedTransactionsFactory
from multiversx_sdk.core.transactions_factories.smart_contract_transactions_factory import \
SmartContractTransactionsFactory
from multiversx_sdk.core.transactions_factories.token_management_transactions_factory import (
TokenManagementTransactionsFactory, TokenType)
from multiversx_sdk.core.transactions_factories.transactions_factory_config import \
TransactionsFactoryConfig
from multiversx_sdk.core.transactions_factories.transfer_transactions_factory import \
TransferTransactionsFactory
from multiversx_sdk.core.transactions_outcome_parsers.delegation_transactions_outcome_parser import \
DelegationTransactionsOutcomeParser
from multiversx_sdk.core.transactions_outcome_parsers.delegation_transactions_outcome_parser_types import \
CreateNewDelegationContractOutcome
from multiversx_sdk.core.transactions_outcome_parsers.smart_contract_transactions_outcome_parser import \
SmartContractTransactionsOutcomeParser
from multiversx_sdk.core.transactions_outcome_parsers.smart_contract_transactions_outcome_parser_types import (
from multiversx_sdk.account_management import (AccountController,
AccountTransactionsFactory)
from multiversx_sdk.accounts import Account
from multiversx_sdk.core import (Address, AddressComputer, AddressFactory,
CodeMetadata, LibraryConfig, Message,
MessageComputer, SmartContractResult, Token,
TokenComputer, TokenIdentifierParts,
TokenTransfer, Transaction,
TransactionComputer, TransactionEvent,
TransactionEventsParser, TransactionLogs,
TransactionOnNetwork,
TransactionsFactoryConfig, TransactionStatus,
find_events_by_first_topic,
find_events_by_identifier)
from multiversx_sdk.delegation import (CreateNewDelegationContractOutcome,
DelegationController,
DelegationTransactionsFactory,
DelegationTransactionsOutcomeParser)
from multiversx_sdk.entrypoints import (DevnetEntrypoint, MainnetEntrypoint,
NetworkEntrypoint, TestnetEntrypoint)
from multiversx_sdk.network_providers import (AccountAwaiter, AccountOnNetwork,
AccountStorage,
AccountStorageEntry,
ApiNetworkProvider,
AwaitingOptions,
BlockCoordinates, BlockOnNetwork,
FungibleTokenMetadata,
GenericError, GenericResponse,
GetBlockArguments, NetworkConfig,
NetworkProviderConfig,
NetworkStatus,
ProxyNetworkProvider,
TokenAmountOnNetwork,
TokensCollectionMetadata,
TransactionAwaiter,
TransactionCostResponse,
TransactionDecoder,
TransactionMetadata)
from multiversx_sdk.relayed import (RelayedController,
RelayedTransactionsFactory)
from multiversx_sdk.smart_contracts import (
DeployedSmartContract, ParsedSmartContractCallOutcome,
SmartContractDeployOutcome)
from multiversx_sdk.core.transactions_outcome_parsers.token_management_transactions_outcome_parser import \
TokenManagementTransactionsOutcomeParser
from multiversx_sdk.core.transactions_outcome_parsers.token_management_transactions_outcome_parser_types import (
SmartContractController, SmartContractDeployOutcome, SmartContractQuery,
SmartContractQueryResponse, SmartContractTransactionsFactory,
SmartContractTransactionsOutcomeParser)
from multiversx_sdk.token_management import (
AddQuantityOutcome, BurnOutcome, BurnQuantityOutcome, FreezeOutcome,
IssueFungibleOutcome, IssueNonFungibleOutcome, IssueSemiFungibleOutcome,
MintOutcome, NFTCreateOutcome, PauseOutcome, RegisterAndSetAllRolesOutcome,
RegisterMetaEsdtOutcome, SetSpecialRoleOutcome, UnFreezeOutcome,
RegisterMetaEsdtOutcome, SetSpecialRoleOutcome, TokenManagementController,
TokenManagementTransactionsFactory,
TokenManagementTransactionsOutcomeParser, TokenType, UnFreezeOutcome,
UnPauseOutcome, UpdateAttributesOutcome, WipeOutcome)
from multiversx_sdk.core.transactions_outcome_parsers.transaction_events_parser import \
TransactionEventsParser
from multiversx_sdk.facades.account import Account
from multiversx_sdk.facades.entrypoints import (DevnetEntrypoint,
MainnetEntrypoint,
NetworkEntrypoint,
TestnetEntrypoint)
from multiversx_sdk.network_providers.api_network_provider import \
ApiNetworkProvider
from multiversx_sdk.network_providers.errors import GenericError
from multiversx_sdk.network_providers.proxy_network_provider import \
ProxyNetworkProvider
from multiversx_sdk.network_providers.resources import GenericResponse
from multiversx_sdk.network_providers.transaction_awaiter import \
TransactionAwaiter
from multiversx_sdk.network_providers.transaction_decoder import (
TransactionDecoder, TransactionMetadata)
from multiversx_sdk.wallet.mnemonic import Mnemonic
from multiversx_sdk.wallet.user_keys import UserPublicKey, UserSecretKey
from multiversx_sdk.wallet.user_pem import UserPEM
from multiversx_sdk.wallet.user_signer import UserSigner
from multiversx_sdk.wallet.user_verifer import UserVerifier
from multiversx_sdk.wallet.user_wallet import UserWallet
from multiversx_sdk.wallet.validator_keys import (ValidatorPublicKey,
ValidatorSecretKey)
from multiversx_sdk.wallet.validator_pem import ValidatorPEM
from multiversx_sdk.wallet.validator_signer import ValidatorSigner
from multiversx_sdk.wallet.validator_verifier import ValidatorVerifier
from multiversx_sdk.transfers import (TransfersController,
TransferTransactionsFactory)
from multiversx_sdk.wallet import (Mnemonic, UserPEM, UserPublicKey,
UserSecretKey, UserSigner, UserVerifier,
UserWallet, ValidatorPEM,
ValidatorPublicKey, ValidatorSecretKey,
ValidatorSigner, ValidatorVerifier)

__all__ = [
"AccountNonceHolder", "Address", "AddressFactory", "AddressComputer",
"Transaction", "TransactionComputer",
"Message", "MessageComputer", "CodeMetadata",
"Token", "TokenComputer", "TokenTransfer", "TokenIdentifierParts",
"TokenManagementTransactionsOutcomeParser", "SmartContractResult",
"TransactionEvent", "TransactionLogs",
"DelegationTransactionsFactory", "TokenManagementTransactionsFactory",
"TransactionsFactoryConfig", "TokenType",
"SmartContractTransactionsFactory", "TransferTransactionsFactory",
"RelayedTransactionsFactory", "AccountTransactionsFactory",
"GenericError", "GenericResponse", "ApiNetworkProvider", "ProxyNetworkProvider",
"UserSigner", "Mnemonic", "UserSecretKey", "UserPublicKey", "ValidatorSecretKey",
"ValidatorPublicKey", "UserVerifier", "ValidatorSigner", "ValidatorVerifier", "ValidatorPEM",
"UserWallet", "UserPEM", "TransactionsConverter", "DelegationTransactionsOutcomeParser",
"find_events_by_identifier", "find_events_by_first_topic", "SmartContractTransactionsOutcomeParser", "TransactionAwaiter",
"SmartContractQueriesController", "SmartContractQuery", "SmartContractQueryResponse",
"TransactionDecoder", "TransactionMetadata", "TransactionEventsParser",
"Account", "DevnetEntrypoint", "MainnetEntrypoint", "NetworkEntrypoint", "TestnetEntrypoint",
"AccountController", "DelegationController", "RelayedController", "SmartContractController",
"TokenManagementController", "TransfersController",
"CreateNewDelegationContractOutcome", "SmartContractDeployOutcome", "DeployedSmartContract",
"IssueFungibleOutcome", "IssueNonFungibleOutcome", "IssueSemiFungibleOutcome", "RegisterMetaEsdtOutcome",
"RegisterAndSetAllRolesOutcome", "SetSpecialRoleOutcome", "NFTCreateOutcome", "MintOutcome", "BurnOutcome",
"PauseOutcome", "UnPauseOutcome", "FreezeOutcome", "UnFreezeOutcome", "WipeOutcome", "UpdateAttributesOutcome",
"AddQuantityOutcome", "BurnQuantityOutcome", "TransactionOnNetwork", "TransactionStatus", "ParsedSmartContractCallOutcome"
"Account", "Address", "AddressFactory", "AddressComputer", "Transaction", "TransactionComputer",
"Message", "MessageComputer", "CodeMetadata", "Token", "TokenComputer", "TokenTransfer", "TokenIdentifierParts",
"TokenManagementTransactionsOutcomeParser", "SmartContractResult", "TransactionEvent", "TransactionLogs",
"DelegationTransactionsFactory", "TokenManagementTransactionsFactory", "TransactionsFactoryConfig", "TokenType",
"SmartContractTransactionsFactory", "TransferTransactionsFactory", "RelayedTransactionsFactory",
"AccountTransactionsFactory", "GenericError", "GenericResponse", "ApiNetworkProvider", "ProxyNetworkProvider",
"UserSigner", "Mnemonic", "UserSecretKey", "UserPublicKey", "ValidatorSecretKey", "ValidatorPublicKey",
"UserVerifier", "ValidatorSigner", "ValidatorVerifier", "ValidatorPEM", "UserWallet", "UserPEM",
"DelegationTransactionsOutcomeParser", "find_events_by_identifier",
"find_events_by_first_topic", "SmartContractTransactionsOutcomeParser", "TransactionAwaiter",
"SmartContractQuery", "SmartContractQueryResponse", "TransactionDecoder",
"TransactionMetadata", "TransactionEventsParser", "NetworkProviderConfig", "DevnetEntrypoint",
"MainnetEntrypoint", "NetworkEntrypoint", "TestnetEntrypoint", "AccountController", "DelegationController",
"RelayedController", "SmartContractController", "TokenManagementController", "TransfersController",
"CreateNewDelegationContractOutcome", "SmartContractDeployOutcome", "DeployedSmartContract", "IssueFungibleOutcome",
"IssueNonFungibleOutcome", "IssueSemiFungibleOutcome", "RegisterMetaEsdtOutcome", "RegisterAndSetAllRolesOutcome",
"SetSpecialRoleOutcome", "NFTCreateOutcome", "MintOutcome", "BurnOutcome", "PauseOutcome", "UnPauseOutcome",
"FreezeOutcome", "UnFreezeOutcome", "WipeOutcome", "UpdateAttributesOutcome", "AddQuantityOutcome",
"BurnQuantityOutcome", "TransactionOnNetwork", "TransactionStatus", "ParsedSmartContractCallOutcome",
"AccountOnNetwork", "AccountStorage", "AccountStorageEntry", "AwaitingOptions", "BlockCoordinates",
"BlockOnNetwork", "FungibleTokenMetadata", "GetBlockArguments", "NetworkConfig", "NetworkStatus",
"TokenAmountOnNetwork", "TokensCollectionMetadata", "TransactionCostResponse", "AccountAwaiter",
"LibraryConfig"
]
3 changes: 1 addition & 2 deletions multiversx_sdk/abi/abi.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,12 @@
from multiversx_sdk.abi.type_formula import TypeFormula
from multiversx_sdk.abi.type_formula_parser import TypeFormulaParser
from multiversx_sdk.abi.variadic_values import VariadicValues
from multiversx_sdk.core.constants import ARGS_SEPARATOR


class Abi:
def __init__(self, definition: AbiDefinition) -> None:
self._type_formula_parser = TypeFormulaParser()
self._serializer = Serializer(parts_separator=ARGS_SEPARATOR)
self._serializer = Serializer()

self.definition = definition
self.custom_types_prototypes_by_name: Dict[str, Any] = {}
Expand Down
2 changes: 0 additions & 2 deletions multiversx_sdk/abi/abi_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,6 @@ def __init__(self, name: str) -> None:

@classmethod
def from_dict(cls, data: Dict[str, Any]) -> "ExplicitEnumVariantDefinition":
fields = [FieldDefinition.from_dict(item) for item in data.get("fields", [])]

return cls(
name=data.get("name", "")
)
Expand Down
Loading

0 comments on commit 6137929

Please sign in to comment.