Skip to content

Commit

Permalink
hardcoding to test this
Browse files Browse the repository at this point in the history
  • Loading branch information
nadineloepfe committed Nov 26, 2024
1 parent 9308a48 commit ff69a08
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ jobs:
OPERATOR_ID: ${{ steps.solo.outputs.accountId }}
OPERATOR_KEY: ${{ steps.solo.outputs.privateKey }}
PUBLIC_KEY: ${{ steps.solo.outputs.publicKey }}
NETWORK: 'solo'
PYTHONPATH: ${{ github.workspace }}/src
NETWORK:
run: python test.py

3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
'cryptography',
'protobuf==5.27.2',
'cryptography',
'python-dotenv'
'python-dotenv',
'requests'
],
)
22 changes: 11 additions & 11 deletions src/client/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,24 @@ class Network:
],
}

def __init__(self, network='testnet'):
def __init__(self, node_address=None, node_account_id=None, network='testnet'):
"""
Initializes the Network with the specified network name.
Args:
network (str): The network to connect to ('mainnet', 'testnet', 'previewnet').
"""
if network not in ('mainnet', 'testnet', 'previewnet'):
raise ValueError("Network must be 'mainnet', 'testnet', or 'previewnet'.")
if node_address and node_account_id:
self.nodes = [(node_address, node_account_id)]
else:
self.network = network
self.nodes = self._fetch_nodes_from_mirror_node()

if not self.nodes:
# default nodes if fetching from the mirror node API fails
self.nodes = self.DEFAULT_NODES[self.network]

self.network = network
self.nodes = self._fetch_nodes_from_mirror_node()

if not self.nodes:
# default nodes if fetching from the mirror node API fails
self.nodes = self.DEFAULT_NODES[self.network]

self.select_node()
self.select_node()

def _fetch_nodes_from_mirror_node(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion test.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def transfer_token(client, recipient_id, token_id):
def main():
operator_id, operator_key = load_operator_credentials()

network = Network(os.getenv('NETWORK', 'solo'))
network = Network(node_address='localhost:50211', node_account_id=AccountId(0, 0, 3))
client = Client(network)
client.set_operator(operator_id, operator_key)

Expand Down

0 comments on commit ff69a08

Please sign in to comment.