kvi-crypto / app.py
Kvikontent's picture
Update app.py
31b70a7 verified
raw
history blame
1.84 kB
import streamlit as st
import string
import secrets
user_name = []
user_token = []
user_balance = []
count = len(user_name)
def generate_api_token(length):
characters = string.ascii_letters + string.digits
api_token = ''.join(secrets.choice(characters) for _ in range(length))
return api_token
st.sidebar.title("KVI Crypto", help="IT IS FAKE!! Just for research")
st.sidebar.write("New crypto money")
name = st.sidebar.text_input("Enter name")
create = st.sidebar.button("Create wallet")
tok_inp = st.text_input("Enter token to login")
login = st.button("Login")
account, deposit, price = st.tabs(["Account", "Deposit", "Price"])
price = "587$"
if create:
user_token = generate_api_token(16)
user_name.append(name)
user_token.append(user_token)
user_balance.append(0)
index = count
balance = user_balance[index]
st.header(f"Welcome, {name}", divider="rainbow")
with account:
st.write(f"Your token: {user_token} . Remember it or copy!!")
st.header(f"Your balance: {balance}")
st.number_input
with deposit:
st.subheader("Deposid money to wallet.")
how = st.number_input("Enter how much")
user_balance[index] += how
with price:
st.header(f"Current KVI Crypto price is {price}")
if login:
if tok_inp in user_token:
innd = user_token.index(tok_inp)
name = user_name[innd]
st.header(f"Welcome, {name}", divider="rainbow")
with account:
st.write(f"Your token: {user_token}")
st.header(f"Your balance: {balance}")
with deposit:
st.subheader("Deposid money to wallet.")
how = st.number_input("Enter how much")
user_balance[innd] += how
with price:
st.header(f"Current KVI Crypto price is {price}")