Spaces:
Runtime error
Runtime error
removed ocean
Browse files
app.py
CHANGED
|
@@ -1,35 +1,35 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from ocean_lib.config import Config
|
| 3 |
-
from ocean_lib.models.btoken import BToken #BToken is ERC20
|
| 4 |
-
from ocean_lib.ocean.ocean import Ocean
|
| 5 |
-
from ocean_lib.web3_internal.wallet import Wallet
|
| 6 |
-
from ocean_lib.web3_internal.currency import from_wei # wei is the smallest denomination of ether e.g. like cents
|
| 7 |
-
from ocean_lib.web3_internal.currency import pretty_ether_and_wei
|
| 8 |
from wallet import get_wallet
|
| 9 |
|
| 10 |
-
config = Config('config.ini')
|
| 11 |
-
ocean = Ocean(config)
|
| 12 |
|
| 13 |
def w(hello):
|
| 14 |
account, mnemonic = get_wallet()
|
| 15 |
return account, mnemonic
|
| 16 |
|
| 17 |
-
def wallet(private_key, did):
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
| 24 |
|
| 25 |
-
|
| 26 |
|
| 27 |
-
|
| 28 |
-
|
| 29 |
|
| 30 |
-
|
| 31 |
|
| 32 |
-
|
| 33 |
|
| 34 |
description = (
|
| 35 |
"This demo shows the balance of algorithm tokens, as well as ETH and OCEAN, in your Web3 wallet (for a given private key). The algorithm tokens will be used to run Algovera apps on HF spaces in future. "
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
# from ocean_lib.config import Config
|
| 3 |
+
# from ocean_lib.models.btoken import BToken #BToken is ERC20
|
| 4 |
+
# from ocean_lib.ocean.ocean import Ocean
|
| 5 |
+
# from ocean_lib.web3_internal.wallet import Wallet
|
| 6 |
+
# from ocean_lib.web3_internal.currency import from_wei # wei is the smallest denomination of ether e.g. like cents
|
| 7 |
+
# from ocean_lib.web3_internal.currency import pretty_ether_and_wei
|
| 8 |
from wallet import get_wallet
|
| 9 |
|
| 10 |
+
# config = Config('config.ini')
|
| 11 |
+
# ocean = Ocean(config)
|
| 12 |
|
| 13 |
def w(hello):
|
| 14 |
account, mnemonic = get_wallet()
|
| 15 |
return account, mnemonic
|
| 16 |
|
| 17 |
+
# def wallet(private_key, did):
|
| 18 |
+
# wallet = Wallet(ocean.web3, private_key, transaction_timeout=20, block_confirmations=config.block_confirmations)
|
| 19 |
+
# address = wallet.address
|
| 20 |
+
# OCEAN_token = BToken(ocean.web3, ocean.OCEAN_address)
|
| 21 |
|
| 22 |
+
# eth_balance = from_wei(ocean.web3.eth.get_balance(wallet.address))
|
| 23 |
+
# ocean_balance = from_wei(OCEAN_token.balanceOf(wallet.address))
|
| 24 |
|
| 25 |
+
# asset = ocean.assets.resolve(did)
|
| 26 |
|
| 27 |
+
# ALG_ddo = ocean.assets.resolve(did)
|
| 28 |
+
# alg_token = ocean.get_data_token(ALG_ddo.data_token_address)
|
| 29 |
|
| 30 |
+
# alg_token_balance = pretty_ether_and_wei(alg_token.balanceOf(wallet.address))
|
| 31 |
|
| 32 |
+
# return address, eth_balance, ocean_balance, alg_token_balance
|
| 33 |
|
| 34 |
description = (
|
| 35 |
"This demo shows the balance of algorithm tokens, as well as ETH and OCEAN, in your Web3 wallet (for a given private key). The algorithm tokens will be used to run Algovera apps on HF spaces in future. "
|