Spaces:
Runtime error
Runtime error
Commit
·
4ca6244
1
Parent(s):
1dd27af
display eth and ocean balance
Browse files
app.py
CHANGED
@@ -16,14 +16,14 @@ def wallet(hello):
|
|
16 |
private_key = account.key.hex()
|
17 |
address = account.address
|
18 |
|
19 |
-
|
20 |
|
21 |
-
|
22 |
|
23 |
-
|
24 |
-
|
25 |
|
26 |
-
return address, mnemonic,
|
27 |
|
28 |
# def wallet(private_key, did):
|
29 |
# wallet = Wallet(ocean.web3, private_key, transaction_timeout=20, block_confirmations=config.block_confirmations)
|
@@ -76,10 +76,9 @@ interface = gr.Interface(
|
|
76 |
#gr.outputs.Textbox(label="Public Key"),
|
77 |
#gr.outputs.Textbox(label="Algorithm token balance"),
|
78 |
gr.outputs.Textbox(label="Public Address"),
|
79 |
-
gr.outputs.Textbox(label="Private Key"),
|
80 |
gr.outputs.Textbox(label="Recovery Passphrase"),
|
81 |
-
|
82 |
-
|
83 |
],
|
84 |
title="Algorithm Web3 Wallet",
|
85 |
description=description,
|
|
|
16 |
private_key = account.key.hex()
|
17 |
address = account.address
|
18 |
|
19 |
+
wallet = Wallet(ocean.web3, private_key, transaction_timeout=20, block_confirmations=config.block_confirmations)
|
20 |
|
21 |
+
OCEAN_token = BToken(ocean.web3, ocean.OCEAN_address)
|
22 |
|
23 |
+
eth_balance = from_wei(ocean.web3.eth.get_balance(address))
|
24 |
+
ocean_balance = from_wei(OCEAN_token.balanceOf(address))
|
25 |
|
26 |
+
return address, mnemonic, eth_balance, ocean_balance
|
27 |
|
28 |
# def wallet(private_key, did):
|
29 |
# wallet = Wallet(ocean.web3, private_key, transaction_timeout=20, block_confirmations=config.block_confirmations)
|
|
|
76 |
#gr.outputs.Textbox(label="Public Key"),
|
77 |
#gr.outputs.Textbox(label="Algorithm token balance"),
|
78 |
gr.outputs.Textbox(label="Public Address"),
|
|
|
79 |
gr.outputs.Textbox(label="Recovery Passphrase"),
|
80 |
+
gr.outputs.Textbox(label="ETH balance"),
|
81 |
+
gr.outputs.Textbox(label="OCEAN balance"),
|
82 |
],
|
83 |
title="Algorithm Web3 Wallet",
|
84 |
description=description,
|