diff --git a/test.py b/test.py index a3c3264..2ed82fa 100644 --- a/test.py +++ b/test.py @@ -8,6 +8,7 @@ from src.crypto.private_key import PrivateKey from src.tokens.token_create_transaction import TokenCreateTransaction from src.tokens.token_associate_transaction import TokenAssociateTransaction +from src.tokens.token_id import TokenId from src.transaction.transfer_transaction import TransferTransaction from src.response_code import ResponseCode @@ -57,9 +58,6 @@ def create_new_account(client, initial_balance=100000000): def create_token(client, operator_id): """Create a new token and return its TokenId instance.""" - admin_key = PrivateKey.generate() - admin_public_key = admin_key.public_key() - transaction = ( TokenCreateTransaction() .set_token_name("ExampleToken") @@ -83,10 +81,9 @@ def create_token(client, operator_id): sys.exit(1) token_id = receipt.tokenId - print(f"Token creation successful. Token ID: {token_id}, Admin Key: {admin_key.to_string()}") - - return token_id, admin_key + print(f"Token creation successful. Token ID: {token_id}") + return token_id def associate_token(client, recipient_id, recipient_private_key, token_id): """Associate the specified token with the recipient account.""" @@ -97,7 +94,7 @@ def associate_token(client, recipient_id, recipient_private_key, token_id): .freeze_with(client) ) transaction.sign(client.operator_private_key) # sign with operator's key (payer) - transaction.sign(recipient_private_key) # sign with newly created accounts key (recipient) + transaction.sign(recipient_private_key) # sign with newly created account's key (recipient) try: receipt = transaction.execute(client) @@ -132,17 +129,16 @@ def transfer_token(client, recipient_id, token_id): def main(): operator_id, operator_key = load_operator_credentials() - # network = Network(node_address='localhost:50211', node_account_id=AccountId(0, 0, 3)) - network_type = os.getenv('NETWORK') # 'solo' + network_type = os.getenv('NETWORK') network = Network(network=network_type) client = Client(network) client.set_operator(operator_id, operator_key) recipient_id, recipient_private_key = create_new_account(client) - token_id, admin_key = create_token(client, operator_id) + token_id = create_token(client, operator_id) associate_token(client, recipient_id, recipient_private_key, token_id) transfer_token(client, recipient_id, token_id) if __name__ == "__main__": - main() \ No newline at end of file + main()