Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
popenta committed Nov 15, 2024
1 parent 7823fd2 commit 0f8ad56
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from typing import Dict, List, Protocol
from typing import Dict, Protocol

from multiversx_sdk.builders.transaction_builder import TransactionBuilder
from multiversx_sdk.core.address import Address
from multiversx_sdk.core.transaction import Transaction
from multiversx_sdk.builders.transaction_builder import TransactionBuilder


class IConfig(Protocol):
Expand Down Expand Up @@ -86,8 +86,8 @@ def create_transaction_for_unguarding_account(self, sender: Address) -> Transact

return transaction

def _compute_data_parts_for_saving_key_value(self, key_value_pairs: Dict[bytes, bytes]) -> List[str]:
data_parts: List[str] = []
def _compute_data_parts_for_saving_key_value(self, key_value_pairs: Dict[bytes, bytes]) -> list[str]:
data_parts: list[str] = []

for key, value in key_value_pairs.items():
data_parts.extend([key.hex(), value.hex()])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import List

from multiversx_sdk.core import (Address, TransactionEvent,
TransactionOnNetwork,
find_events_by_identifier)
Expand All @@ -14,13 +12,13 @@ def __init__(self) -> None:
pass

def parse_create_new_delegation_contract(self,
transaction: TransactionOnNetwork) -> List[CreateNewDelegationContractOutcome]:
transaction: TransactionOnNetwork) -> list[CreateNewDelegationContractOutcome]:
self._ensure_no_error(transaction.logs.events)

events = find_events_by_identifier(transaction, "SCDeploy")
return [CreateNewDelegationContractOutcome(self._extract_contract_address(event)) for event in events]

def _ensure_no_error(self, transaction_events: List[TransactionEvent]) -> None:
def _ensure_no_error(self, transaction_events: list[TransactionEvent]) -> None:
for event in transaction_events:
if event.identifier == "signalError":
data = event.additional_data[0].decode()[1:] if len(event.additional_data[0]) else ""
Expand Down
6 changes: 3 additions & 3 deletions multiversx_sdk/entrypoints/entrypoints.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Optional, Tuple, Union
from typing import Optional, Union

from multiversx_sdk.abi.abi import Abi
from multiversx_sdk.account_management import AccountController
Expand Down Expand Up @@ -70,15 +70,15 @@ def verify_message_signature(self, message: Message) -> bool:
def recall_account_nonce(self, address: Address) -> int:
return self.network_provider.get_account(address).nonce

def send_transactions(self, transactions: list[Transaction]) -> Tuple[int, list[bytes]]:
def send_transactions(self, transactions: list[Transaction]) -> tuple[int, list[bytes]]:
"""
Sends multiple transactions.
Args:
transactions (list[Transaction]): An iterable containing multiple transactions (e.g. a list of transactions).
Returns:
Tuple (int, list[bytes]): The integer indicates the total number of transactions sent, while the list contains the transactions hashes. If a transaction is not sent, the hash is empty.
tuple (int, list[bytes]): The integer indicates the total number of transactions sent, while the list contains the transactions hashes. If a transaction is not sent, the hash is empty.
"""
return self.network_provider.send_transactions(transactions)

Expand Down
5 changes: 0 additions & 5 deletions multiversx_sdk/entrypoints/errors.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
class BadUsageError(Exception):
def __init__(self, message: str) -> None:
super().__init__(message)


class InvalidNetworkProviderKindError(Exception):
def __init__(self) -> None:
super().__init__("Invalid network provider kind. Choose between `api` and `proxy`.")

0 comments on commit 0f8ad56

Please sign in to comment.