-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #423 from multiversx/main
Main into feat/next
- Loading branch information
Showing
34 changed files
with
1,029 additions
and
175 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from typing import Any, Dict, Optional, Protocol | ||
|
||
from multiversx_sdk_network_providers import GenericError, ProxyNetworkProvider | ||
|
||
from multiversx_sdk_cli.errors import ProxyError | ||
from multiversx_sdk_cli.interfaces import ISimulateResponse, ITransaction | ||
|
||
|
||
class ITransactionOnNetwork(Protocol): | ||
hash: str | ||
is_completed: Optional[bool] | ||
|
||
def to_dictionary(self) -> Dict[str, Any]: | ||
... | ||
|
||
|
||
class CustomNetworkProvider: | ||
def __init__(self, url: str) -> None: | ||
self._provider = ProxyNetworkProvider(url) | ||
|
||
def send_transaction(self, transaction: ITransaction) -> str: | ||
try: | ||
hash = self._provider.send_transaction(transaction) | ||
return hash | ||
except GenericError as ge: | ||
url = ge.url | ||
message = ge.data.get("error", "") | ||
data = ge.data.get("data", "") | ||
code = ge.data.get("code", "") | ||
raise ProxyError(message, url, data, code) | ||
|
||
def get_transaction(self, tx_hash: str, with_process_status: Optional[bool] = False) -> ITransactionOnNetwork: | ||
return self._provider.get_transaction(tx_hash, with_process_status) | ||
|
||
def simulate_transaction(self, transaction: ITransaction) -> ISimulateResponse: | ||
return self._provider.simulate_transaction(transaction) |
Oops, something went wrong.