Skip to content

Commit

Permalink
reference latest network provider package
Browse files Browse the repository at this point in the history
  • Loading branch information
popenta committed Nov 7, 2023
1 parent cb6734b commit b75e727
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
7 changes: 3 additions & 4 deletions multiversx_sdk_cli/cli_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from typing import Any, Dict, List, Optional, Union

from multiversx_sdk_core import Address
from multiversx_sdk_network_providers.transactions import \
transaction_to_dictionary

from multiversx_sdk_cli import utils
from multiversx_sdk_cli.interfaces import ITransaction
Expand Down Expand Up @@ -51,15 +53,12 @@ def build(self) -> Dict[str, Any]:
output: Dict[str, Any] = OrderedDict()

if self.emitted_transaction:
emitted_transaction_dict = self.emitted_transaction.__dict__
emitted_transaction_dict = transaction_to_dictionary(self.emitted_transaction)
emitted_transaction_hash = self.emitted_transaction_hash or ""
emitted_transaction_data = self.emitted_transaction.data.decode()
utils.omit_fields(emitted_transaction_dict, self.emitted_transaction_omitted_fields)

output["emittedTransaction"] = emitted_transaction_dict
signature: bytes = output["emittedTransaction"]["signature"]
output["emittedTransaction"]["signature"] = signature.hex() if type(signature) is not str else signature

output["emittedTransactionData"] = emitted_transaction_data
output["emittedTransactionHash"] = emitted_transaction_hash

Expand Down
2 changes: 1 addition & 1 deletion multiversx_sdk_cli/transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def do_prepare_transaction(args: Any) -> Transaction:
sender_username=getattr(args, "sender_username", ""),
receiver_username=getattr(args, "receiver_username", ""),
gas_price=int(args.gas_price),
data=TransactionPayload.from_str(args.data).data,
data=str(args.data).encode(),
nonce=int(args.nonce),
amount=int(args.value),
version=int(args.version),
Expand Down
4 changes: 0 additions & 4 deletions multiversx_sdk_cli/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import base64
import json
import logging
import os
Expand Down Expand Up @@ -41,9 +40,6 @@ def to_json(self):

class BasicEncoder(json.JSONEncoder):
def default(self, o: Any):
if isinstance(o, bytes):
# Encode bytes as a base64 string
return base64.b64encode(o).decode('utf-8')
if isinstance(o, ISerializable):
return o.to_dictionary()
return super().default(o)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ requests-cache
rich==13.3.4

multiversx-sdk-core==0.7.1
multiversx-sdk-network-providers==0.12.0
multiversx-sdk-network-providers==0.12.1
multiversx-sdk-wallet==0.8.2

0 comments on commit b75e727

Please sign in to comment.