Skip to content

Commit cd41801

Browse files
committed
account_gen.py - Remove unused imports
sc_deployer.py - Remove unused imports sc_deployer.py - Added / Removed comment spacing sc_deployer.py - Removed Account Credentials (19-20) sc_deployer.py - Removed dangling parenthesis (52) store_file_onchain.py - Added / Removed comment spacing (19) store_file_onchain.py - Remove unused imports acc_balance.py - Remove unused imports acc_balance.py - Removed dangling character (19) Note - Consider purging GH history to remove legacy credentials
1 parent f29479a commit cd41801

File tree

4 files changed

+9
-27
lines changed

4 files changed

+9
-27
lines changed

create-new-account-py/account_gen.py

-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
#Import module and classes
2-
from hedera import PrivateKey
3-
from hedera import FileId, FileContentsQuery
42
import os
53
from hedera import (
64
Client,
75
Hbar,
86
PrivateKey,
97
AccountCreateTransaction,
108
AccountId,
11-
AccountBalanceQuery,
12-
FileCreateTransaction,
13-
FileContentsQuery,
149
Client
1510
)
1611

deploy-smart-contract-py/sc_deployer.py

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
1-
#Import library and modulesfrom hedera import PrivateKey
2-
from hedera import FileId, FileContentsQuery
1+
#Import library and modules
32
import os
43
from hedera import (
54
Hbar,
65
FileCreateTransaction,
76
ContractCreateTransaction,
8-
ContractCallQuery,
9-
ContractDeleteTransaction,
7+
FileContentsQuery,
108
AccountId,
119
PrivateKey,
1210
Client
1311
)
1412

15-
#create function
13+
#create function to deploy contract
1614
def deployContract():
15+
1716
#Get operator AccountID and PvtKey
18-
OPERATOR_ID = AccountId.fromString('0.0.13752044')
19-
OPERATOR_KEY = PrivateKey.fromString('302e020100300506032b657004220420aa2f73270c906f5a4ffafd8c42261b7b7fcfdb83d15bdcbacbad3bd140039302')
17+
OPERATOR_ID = AccountId.fromString('Get yours on Hedera Portal')
18+
OPERATOR_KEY = PrivateKey.fromString('Get yours on Hedera Portal')
2019

2120
#Create client class using Operator credentials. In this case we also setup max txn fee and max query payment since the transaction we are going to execute could have an higher gas limit and could be more expensive than other ones.
2221
client = Client.forTestnet()
@@ -27,7 +26,6 @@ def deployContract():
2726
#bytecode of the Smart contract compiled
2827
byteCode = '608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506101cb806100606000396000f3fe608060405260043610610046576000357c01000000000000000000000000000000000000000000000000000000009004806341c0e1b51461004b578063cfae321714610062575b600080fd5b34801561005757600080fd5b506100606100f2565b005b34801561006e57600080fd5b50610077610162565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100b757808201518184015260208101905061009c565b50505050905090810190601f1680156100e45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610160573373ffffffffffffffffffffffffffffffffffffffff16ff5b565b60606040805190810160405280600d81526020017f48656c6c6f2c20776f726c64210000000000000000000000000000000000000081525090509056fea165627a7a72305820ae96fb3af7cde9c0abfe365272441894ab717f816f07f41f07b1cbede54e256e0029'.encode()
2928

30-
3129
#create Transaction to store on Hedera the file that will contain SC bytecode and execute it
3230
tnx = FileCreateTransaction()
3331
resp = tnx.setKeys(OPERATOR_KEY.getPublicKey()).setContents(byteCode).setMaxTransactionFee(Hbar(2)).execute(client)
@@ -49,6 +47,6 @@ def deployContract():
4947
receipt = tran.getReceipt(client)
5048
contractId = receipt.contractId
5149

52-
contract_tx_id = receipt.transactionId.toString())
50+
contract_tx_id = receipt.transactionId.toString()
5351
contract_id = contractId.toString()
5452

get-account-hbar-balance-py/acc_balance.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
#Import clients
2-
from hedera import PrivateKey
3-
from hedera import FileId, FileContentsQuery
42
import os
53
from hedera import (
64
Client,
7-
Hbar,
85
PrivateKey,
9-
AccountCreateTransaction,
106
AccountId,
117
AccountBalanceQuery,
12-
FileCreateTransaction,
13-
FileContentsQuery,
148
Client
159
)
1610

@@ -22,7 +16,7 @@ def fetchAccountBalance(accountId):
2216
OPERATOR_KEY = PrivateKey.fromString('Get yours on Hedera Portal')
2317

2418
#Call Client class and use Operator credentials
25-
client = Client.forTestnet()S
19+
client = Client.forTestnet()
2620
client.setOperator(OPERATOR_ID, OPERATOR_KEY)
2721

2822
#Enter the ID of the account whose balance the user wants to know about

store-file-onchain-py/store_file_onchain.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
#Import library and modules
2-
from hedera import PrivateKey
3-
from hedera import FileId, FileContentsQuery
42
import os
53
from hedera import (
64
Client,
75
Hbar,
86
PrivateKey,
9-
AccountCreateTransaction,
107
AccountId,
11-
AccountBalanceQuery,
128
FileCreateTransaction,
139
FileContentsQuery,
1410
Client
1511
)
1612

17-
#create function
13+
#create function to store and retrieve file
1814
def createFile():
1915

20-
2116
#Get operator AccountID and PvtKey
2217
OPERATOR_ID = AccountId.fromString('Get yours on Hedera Portal')
2318
OPERATOR_KEY = PrivateKey.fromString('Get yours on Hedera Portal')

0 commit comments

Comments
 (0)