Skip to content

Commit

Permalink
Undo changes commited by mistake (e.g. formatting).
Browse files Browse the repository at this point in the history
  • Loading branch information
andreibancioiu committed Dec 10, 2024
1 parent 6137929 commit fd825fc
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 117 deletions.
6 changes: 2 additions & 4 deletions multiversx_sdk/core/address.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,8 @@ def compute_contract_address(self, deployer: Address, deployment_nonce: int) ->
deployer_pubkey = deployer.get_public_key()
nonce_bytes = deployment_nonce.to_bytes(8, byteorder="little")
bytes_to_hash = deployer_pubkey + nonce_bytes
contract_pubkey = keccak.new(
digest_bits=256).update(bytes_to_hash).digest()
contract_pubkey = bytes([0] * 8) + bytes([5, 0]) + \
contract_pubkey[10:30] + deployer_pubkey[30:]
contract_pubkey = keccak.new(digest_bits=256).update(bytes_to_hash).digest()
contract_pubkey = bytes([0] * 8) + bytes([5, 0]) + contract_pubkey[10:30] + deployer_pubkey[30:]
return Address(contract_pubkey, deployer.get_hrp())

def get_shard_of_address(self, address: Address) -> int:
Expand Down
1 change: 0 additions & 1 deletion multiversx_sdk/entrypoints/entrypoints_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import time
from pathlib import Path

import pytest
Expand Down
24 changes: 8 additions & 16 deletions multiversx_sdk/network_providers/http_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,9 @@ def smart_contract_query_to_vm_query_request(query: SmartContractQuery) -> dict[
def vm_query_response_to_smart_contract_query_response(
raw_response: dict[str, Any],
function: str) -> SmartContractQueryResponse:
return_data = raw_response.get(
"returnData", []) or raw_response.get("ReturnData", [])
return_code = raw_response.get(
"returnCode", "") or raw_response.get("ReturnCode", "")
return_message = raw_response.get(
"returnMessage", "") or raw_response.get("ReturnMessage", "")
return_data = raw_response.get("returnData", []) or raw_response.get("ReturnData", [])
return_code = raw_response.get("returnCode", "") or raw_response.get("ReturnCode", "")
return_message = raw_response.get("returnMessage", "") or raw_response.get("ReturnMessage", "")

return SmartContractQueryResponse(
function=function,
Expand Down Expand Up @@ -74,8 +71,7 @@ def transaction_from_api_response(tx_hash: str, response: dict[str, Any]) -> Tra
logs = transaction_logs_from_response(response.get("logs", {}))

sc_results = response.get("results", [])
smart_contract_results = [smart_contract_result_from_api_response(
result) for result in sc_results]
smart_contract_results = [smart_contract_result_from_api_response(result) for result in sc_results]

return TransactionOnNetwork(
raw=response,
Expand Down Expand Up @@ -130,8 +126,7 @@ def transaction_from_proxy_response(
logs = transaction_logs_from_response(response.get("logs", {}))

sc_results = response.get("smartContractResults", [])
smart_contract_results = [smart_contract_result_from_proxy_response(
result) for result in sc_results]
smart_contract_results = [smart_contract_result_from_proxy_response(result) for result in sc_results]

if process_status:
status = process_status
Expand Down Expand Up @@ -293,8 +288,7 @@ def network_config_from_response(raw_response: dict[str, Any]) -> NetworkConfig:
gas_price_modifier = float(raw_response.get("erd_gas_price_modifier", 0))
min_gas_limit = raw_response.get("erd_min_gas_limit", 0)
min_gas_price = raw_response.get("erd_min_gas_price", 0)
extra_gas_limit_guarded_tx = raw_response.get(
"erd_extra_gas_limit_guarded_tx", 0)
extra_gas_limit_guarded_tx = raw_response.get("erd_extra_gas_limit_guarded_tx", 0)
num_shards = raw_response.get("erd_num_shards_without_meta", 0)
round_duration = raw_response.get("erd_round_duration", 0)
rounds_per_epoch = raw_response.get("erd_rounds_per_epoch", 0)
Expand Down Expand Up @@ -336,8 +330,7 @@ def block_from_response(raw_response: dict[str, Any]) -> BlockOnNetwork:
shard = raw_response.get("shard", 0)
nonce = raw_response.get("nonce", 0)
hash = raw_response.get("hash", "")
previous_hash = raw_response.get(
"prevBlockHash", "") or raw_response.get("prevHash", "")
previous_hash = raw_response.get("prevBlockHash", "") or raw_response.get("prevHash", "")
timestamp = raw_response.get("timestamp", 0)
round = raw_response.get("round", 0)
epoch = raw_response.get("epoch", 0)
Expand Down Expand Up @@ -429,8 +422,7 @@ def account_from_api_response(raw_response: dict[str, Any]) -> AccountOnNetwork:
is_upgradeable = bool(raw_response.get("isUpgradeable", False))
is_readable = bool(raw_response.get("isReadable", False))
is_payable = bool(raw_response.get("isPayable", False))
is_payable_by_sc = bool(raw_response.get(
"isPayableBySmartContract", False))
is_payable_by_sc = bool(raw_response.get("isPayableBySmartContract", False))

return AccountOnNetwork(
raw=raw_response,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from multiversx_sdk.abi.abi import Abi
from multiversx_sdk.core.address import Address
from multiversx_sdk.core.codec import encode_unsigned_number
from multiversx_sdk.core.transaction_on_network import (SmartContractResult,
TransactionEvent,
TransactionLogs)
Expand Down
Loading

0 comments on commit fd825fc

Please sign in to comment.