-
Notifications
You must be signed in to change notification settings - Fork 5
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 #8 from balsulami/master
servicesExtensions implementation.
- Loading branch information
Showing
1 changed file
with
20 additions
and
9 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,22 +1,33 @@ | ||
from typing import Any, Union | ||
|
||
from artifacts import * | ||
|
||
from servicesExtensions.requestSyncrhoneExtensionEscrow_service import RequestSynchroneExtensionEscrowService | ||
|
||
def getServiceFromAddress(address: str) -> Union[RequestSynchroneExtensionEscrowService, None]: | ||
""" | ||
Returns the service of a corresponding extension contract address | ||
:param address: The address of the extension contract | ||
:return: The service object or None if not found | ||
:param address: | ||
The address of the currency contract | ||
:return | ||
The service object or None if not found | ||
""" | ||
pass | ||
if not address: | ||
return None | ||
if isThisArtifact(requestSynchroneExtensionEscrowArtifact, address): | ||
return RequestSynchroneExtensionEscrowService() | ||
|
||
def isThisArtifact(artifact: Any, address: str) -> bool: | ||
""" | ||
TODO: Fill out a description of what this does, no notes in RequestNetwork.js repo | ||
:param artifact: | ||
:param address: | ||
:return: | ||
return True if any address in the network is sanitized address, otherwise it returns False | ||
:param artifact: | ||
RequestNetwork Artifact to use in its interactions with the Ethereum network | ||
:param address: | ||
The address of the currency contract | ||
""" | ||
pass | ||
if not address: | ||
return False | ||
sanitizedAdress = address.lower() | ||
for network in artifact["networks"].values(): | ||
if 'address' in network and network['address'].lower() == sanitizedAdress: | ||
return True | ||
return False |