|
20 | 20 | uv run -m examples.contract.contract_delete_transaction |
21 | 21 | python -m examples.contract.contract_delete_transaction |
22 | 22 | """ |
23 | | -import os |
| 23 | + |
24 | 24 | import sys |
25 | 25 |
|
26 | | -from dotenv import load_dotenv |
27 | 26 |
|
28 | | -from hiero_sdk_python import AccountId, Client, Network, PrivateKey |
| 27 | + |
| 28 | +from hiero_sdk_python import Client |
| 29 | + |
29 | 30 | from hiero_sdk_python.contract.contract_create_transaction import ( |
30 | 31 | ContractCreateTransaction, |
31 | 32 | ) |
|
41 | 42 | # The contract bytecode is pre-compiled from Solidity source code |
42 | 43 | from .contracts import SIMPLE_CONTRACT_BYTECODE |
43 | 44 |
|
44 | | -load_dotenv() |
45 | | - |
46 | | -network_name = os.getenv("NETWORK", "testnet").lower() |
47 | 45 |
|
48 | 46 |
|
49 | | -def setup_client(): |
50 | | - """Initialize and set up the client with operator account.""" |
51 | | - network = Network(network_name) |
52 | | - print(f"Connecting to Hedera {network_name} network!") |
53 | | - client = Client(network) |
54 | | - |
55 | | - operator_id = AccountId.from_string(os.getenv("OPERATOR_ID", "")) |
56 | | - operator_key = PrivateKey.from_string(os.getenv("OPERATOR_KEY", "")) |
57 | | - client.set_operator(operator_id, operator_key) |
| 47 | +def setup_client() -> Client: |
| 48 | + """ |
| 49 | + Set up and configure the client by loading OPERATOR_ID and OPERATOR_KEY with Client.from_env(). |
| 50 | + """ |
| 51 | + client = Client.from_env() |
| 52 | + print(f"Connecting to Hedera {client.network.network} network!") |
58 | 53 | print(f"Client set up with operator id {client.operator_account_id}") |
59 | | - |
60 | 54 | return client |
61 | 55 |
|
62 | 56 |
|
|
0 commit comments