Erdpy network providers integration in erdpy#172
Conversation
Fixes after migration
Fix erdpy contract templates
| from erdpy.interfaces import IElrondProxy | ||
| from erdpy.transactions import Transaction | ||
| from erdpy.utils import Object | ||
| from erdpy_network_providers.proxy_network_provider import ContractQuery |
There was a problem hiding this comment.
Ideally, we should not import this, but define a similar class (that implements the IContractQuery interface) here in erdpy. Can stay as it is for the moment, though.
There was a problem hiding this comment.
Imported the IContractQuery interface and implemented a new ContractQuery class similar to the one in erdpy-network-providers.
| def simulate_transaction(self, transaction: Dict[str, Any]) -> ISimulateResponse: | ||
| ... | ||
|
|
||
| def simulate_transaction_cost(self, transaction: Dict[str, Any]) -> ISimulateCostResponse: |
There was a problem hiding this comment.
Yes, this will be dropped. If i remember correctly we've discussed to remove simulate_transaction_cost in v4.0.0, but I was thinking to do it in a separate PR. What do you think?
There was a problem hiding this comment.
OK, can be done in a separate PR 👍
|
|
||
| class Simulator(): | ||
| def __init__(self, proxy: IElrondProxy) -> None: | ||
| def __init__(self, proxy: INetworkProvider) -> None: |
There was a problem hiding this comment.
Maybe drop everything related to simulate_transaction_cost?
If I remember well, this function is not implemented in eggs-network-providers.
|
|
||
|
|
||
| class INetworkProvider(Protocol): | ||
| def get_account_nonce(self, address: IAddress) -> int: |
There was a problem hiding this comment.
This isn't implemented by erdpy-network-providers, if I remember well. Remove all calls to it (in erdpy)?
There was a problem hiding this comment.
And delete the ElrondProxyStub class as well?
There was a problem hiding this comment.
I think the stub has to stay, but to implement get_account(), instead?
repository.sync_nonces(proxy)
I think this function calls get_account().nonce, right? get_account_nonce() should normally not exist anymore in the code.
There was a problem hiding this comment.
Oh, I see you already did that.
| @@ -0,0 +1,140 @@ | |||
| from pathlib import Path | |||
There was a problem hiding this comment.
👍 for having this kind of tests.
| self.hash = txOnNetwork.hash | ||
| return txOnNetwork | ||
|
|
||
| def __send_transaction_and_wait_for_result(self, proxy: INetworkProvider, payload: Any, num_seconds_timeout: int = 100) -> ITransactionOnNetwork: |
There was a problem hiding this comment.
All right, until we figure out a better place for this logic.
Integrated erdpy-network-providers in erdpy.
The purpose of this pr is to replace the old
ProxyNetworkProvidersthat erdpy used with the ones fromerdpy-network-providers.Added unit tests.