diff --git a/.gitignore b/.gitignore index ffe7c5a..10b22a3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .idea/ __pycache__/ *.pyc +app/__pycache__/ diff --git a/app/forms.py b/app/forms.py index 0291d0a..7c7faa7 100644 --- a/app/forms.py +++ b/app/forms.py @@ -2,7 +2,10 @@ from flask_wtf import FlaskForm from wtforms import StringField, PasswordField, BooleanField, SubmitField from wtforms.validators import DataRequired -class LoginForm(FlaskForm): +class SearchForm(FlaskForm): address = StringField('FLO address', validators=[DataRequired()]) submit = SubmitField('Search') +class BlankForm(FlaskForm): + pass + diff --git a/app/routes.py b/app/routes.py index e5f9ef6..0b5941f 100644 --- a/app/routes.py +++ b/app/routes.py @@ -1,38 +1,47 @@ from flask import render_template from flask import render_template, flash, redirect, url_for from app import app -from app.forms import LoginForm +from app.forms import SearchForm, BlankForm import sqlite3 +dblocation = '/home/vivek/Dev/RanchiMall/rmfzeTracking_testnet/tree.db' + @app.route('/', methods=['GET', 'POST']) -@app.route('/index', methods=['GET', 'POST']) def index(): - form = LoginForm() - if form.validate_on_submit(): - flash('Balance requested for address {}'.format( - form.address.data)) - return redirect(url_for('index')) - return render_template('index.html', title='RMT', form=form) + form = SearchForm() + blankform = BlankForm() + conn = sqlite3.connect(dblocation) + c = conn.cursor() + c.execute('SELECT * FROM transactionHistory ORDER BY id DESC LIMIT 5') + transactionHistoryTable = c.fetchall() + c.execute('SELECT address,SUM(transferBalance) FROM transactiontable GROUP BY address') + balanceTable = c.fetchall() + conn.close() -@app.route('/login') -def login(): - form = LoginForm() - return render_template('login.html', title='Search', form=form) - -@app.route('/example') -def example(): - return render_template('example.html') - -@app.route('/test', methods=['GET', 'POST']) -def test(): - form = LoginForm() if form.validate_on_submit(): flash('Balance requested for address {}'.format(form.address.data)) - conn = sqlite3.connect('/home/vivek/Dev/RanchiMall/rmfzeTracking_testnet/tree.db') + conn = sqlite3.connect(dblocation) c = conn.cursor() c.execute("select SUM(transferBalance) from transactiontable WHERE address=='{}'".format(str(form.address.data))) balance = c.fetchall()[0][0] + c.execute('SELECT * FROM transactionHistory ORDER BY id DESC LIMIT 5') + transactionHistoryTable = c.fetchall() + c.execute('SELECT address,SUM(transferBalance) FROM transactiontable GROUP BY address') + balanceTable = c.fetchall() conn.close() - return render_template('test.html', form=form, balance=balance) - # return redirect(url_for('index')) - return render_template('test.html', form=form) \ No newline at end of file + return render_template('test.html', form=form, blankform=blankform, balance=balance, transactionHistoryTable=transactionHistoryTable, balanceTable=balanceTable) + + if blankform.validate_on_submit(): + flash('Balance requested for address {}'.format(form.address.data)) + conn = sqlite3.connect(dblocation) + c = conn.cursor() + c.execute("select SUM(transferBalance) from transactiontable WHERE address=='{}'".format(str(form.address.data))) + balance = c.fetchall()[0][0] + c.execute('SELECT * FROM transactionHistory ORDER BY id DESC LIMIT 5') + transactionHistoryTable = c.fetchall() + c.execute('SELECT address,SUM(transferBalance) FROM transactiontable GROUP BY address') + balanceTable = c.fetchall() + conn.close() + return render_template('test.html', form=form, blankform=blankform, balance=balance, transactionHistoryTable=transactionHistoryTable, balanceTable=balanceTable) + + return render_template('index.html', form=form, blankform=blankform, transactionHistoryTable=transactionHistoryTable, balanceTable=balanceTable) \ No newline at end of file diff --git a/app/templates/base.html b/app/templates/base.html index 6267c7a..1c7c118 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -1,24 +1,112 @@ - - - {% if title %} - {{ title }} - Microblog - {% else %} - Welcome to Microblog - {% endif %} - - -

RMT explorer

-
Home
-
- {% with messages = get_flashed_messages() %} - {% if messages %} - - {% endif %} - {% endwith %} - {% block content %}{% endblock %} - - \ No newline at end of file + + + + + + + + + Ranchi Mall Token Explorer + + + + + + + + + + + + + + + + + + + + +{% block content %}{% endblock %} + + + + + + + + + + + + + + + + + diff --git a/app/templates/example.html b/app/templates/example.html deleted file mode 100644 index ee25be3..0000000 --- a/app/templates/example.html +++ /dev/null @@ -1,1112 +0,0 @@ - - - - - - - - - - Paper Kit 2 by Creative Tim - - - - - - - - - - - - - - - - - - - - -
- -
-
-
-
-

Basic Elements

-
-
-
-

Buttons -
- Pick your style -

-
-
-
- - - - - -
-
-
-

Pick your size

-
-
-
- - - -
-
-
-

Pick your color

-
-
-
- - - - - - -
-
-
-
-
- - - - - - -
-
-
-
-
-

Links

-
- -
-
-

Inputs

-
-
-
-
- -
-
-
-
- -
-
-
-
- - -
-
-
-
- - -
-
-
-
-
-
-
-

Checkboxes

-
-
- -
-
- -
-
- -
-
- -
-
-
-
-

Radio Buttons

-
-
- -
-
- -
- -
- -
- -
- -
-
-
-
-

Toggle Buttons

-
-
- -
-
- -
- -
-
-
-

Sliders

-
-
-
-
-
-
-
-
-
-
- -
- -
-
-
-
-
-
-

Progress Bar

-
-
-
-
-

-
-
-

-
-
-

-
-
-
-
-
-
-
-
-

Pagination

-
-
- -
- -
-
-
-
-
-
-

Navigation Tabs

-
- - -
-

Larger, yet dramatically thinner. More powerful, but remarkably power efficient. With a smooth metal surface that seamlessly meets the new Retina HD display.

-

Here is your profile.

-

Here are your messages.

-
-
- -
-
-

Labels

-
- Default - Primary - Info - Success - Warning - Danger -
-
-
-
-
-
-
-

Notification

-
- - -
-
- This is a plain notification! -
-
-
-
- - This is a notification with close button. -
-
-
-
-
- -
This is a notification with close button and icon.
-
-
-
-
-
-
- -
This is a notification with close button and icon and have many lines. You can see that the icon and the close button are always vertically aligned.
-
-
-
-
-
-
-
-
-

Typography

-
-
-
-
-
-

- Header 1 Thinking in textures -

-
-
-

- Header 2 Thinking in textures -

-
-
-

- Header 3 Thinking in textures -

-
-
-

- Header 4 Thinking in textures -

-
-
-
- Header 5 Thinking in textures -
-
-
-
- Header 6 Thinking in textures -
-
-
-

- Paragraph Thinking in textures -

-
-
- Quote -
-

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.

-
Someone famous in Source Title
-
-
-
- Muted text -

Fusce dapibus, tellus ac cursus commodo, tortor mauris nibh.

-
-
- Primary text -

Nullam id dolor id nibh ultricies vehicula ut id elit.

-
-
- Success text -

Duis mollis, est non commodo luctus, nisi erat porttitor ligula.

-
-
- Info text -

Maecenas sed diam eget risus varius blandit sit amet non magna.

-
-
- Warning text -

Etiam porta sem malesuada magna mollis euismod.

-
-
- Danger text -

Donec ullamcorper nulla non metus auctor fringilla.

-
-
-

Small tagHeader with small subtitle -
- ".small" is a tag for the headers -

-
-
-
-
-
-
-
-

Images

-
-
-
-

Rounded Image

- Rounded Image -
-
- Circle Image -
-

Chet Faker

-
-
-
-

Circle Image

- Rounded Image -

Joe Gardner

-
-
-

Thumbnail

- Rounded Image -

Erik Faker

-
-
-
-
-
-
-
-
-
-

Javascript Components

-
-
-
-
-

Modal

-
- - - - -
-
-
-

Popovers

-
- - - - -
-
-
-
-

Datepicker

-
-
-
-
-
- - - - -
-
-
-
-
-
-
-

Tooltips

-
- - - - -
-
-
-

Carousel

-
-
-
- -
-
-
-
-

Nucleo Icons


-

- Now UI Kit comes with 100 custom icons made by our friends from NucleoApp. The official package contains over 2.100 thin icons which are looking great in combination with Now UI Kit Make sure you check all of them and use those that you like the most. -


- View Demo Icons - View All Icons -
- -
-
- - - - - - - - - - - - - - - -
-
-
-
-
-
-
-
-
-

Completed with examples

-

The kit comes with three pre-built pages to help you get started faster. You can change the text and images and you're good to go. More importantly, looking at them will give you a picture of what you can built with this powerful kit.

-
-
-
-
-
-
-
-
-
-

Welcome

- -
- -
- - - - -
- - -
- - - - -
- -
- -
- -
-
-
-
-
-
- -
-
-
-
-
-
-

Do you like what you see?

-

Cause if you do, it can be yours for Free. Hit the button below and download it. Start a new project or give an old Bootstrap 4 project a new look.

-
- -
-
-
-

Want more?

-

We've just launched Paper Kit 2 PRO. It has a huge number of components, sections and example pages.

-
- -
- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/templates/index.html b/app/templates/index.html index 16e0118..796b572 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -1,19 +1,138 @@ {% extends "base.html" %} - {% block content %} -
- Enter FLO address associated with RMT +
+ -
- {{ form.hidden_tag() }} -

- {{ form.address.label }}
- {{ form.address(size=32) }} - {% for error in form.address.errors %} - [{{ error }}] - {% endfor %} -

-

{{ form.submit() }}

-
+ +
+
+
+
+

RMT Balance

+
+
+
+
+
+ + {{ form.hidden_tag() }} + {{ form.address(class="form-control", placeholder="Enter FLO address", length=100) }} + {% for error in form.address.errors %} + [{{ error }}] + {% endfor %} + {% if balance %} +
+
+

Balance {{balance}} RMT

+
+ {% endif %} +
+
+
+
+ +
+
+
+
+
+

Latest Transactions

+
+
+
+ + + + + + + + + + {% for item in transactionHistoryTable %} + + + + + + + + {% endfor %} + +
+ Block no. + + Sender + + Receiver + + Amount + + View @ Block explorer +
{{item[1]}}{{item[2]}}{{item[3]}}{{item[4]}} + + +
+
+ + View all + +
+
+
+
+
+ +
+
+
+

Balances

+
+
+
+ + + + + + + {% for item in balanceTable %} + + + + + {% endfor %} + +
+ Address + + Balance +
{{item[0]}}{{item[1]}}
+
+
+
+
+
+
+ +
+
+ + + +
+
{% endblock %} \ No newline at end of file diff --git a/app/templates/test.html b/app/templates/test.html deleted file mode 100644 index 6f7a38c..0000000 --- a/app/templates/test.html +++ /dev/null @@ -1,773 +0,0 @@ - - - - - - - - - Ranchi Mall Token Explorer - - - - - - - - - - - - - - - - - - - - - -
- - - -
-
-
-
-

RMT Balance

-
-
-
-
-
- - {{ form.hidden_tag() }} - {{ form.address(class="form-control", placeholder="Enter FLO address", length=100) }} - {% for error in form.address.errors %} - [{{ error }}] - {% endfor %} - {% if balance %} -
-
-

Balance {{balance}} RMT

-
- {% endif %} -
-
-
-
-
- -
-
-
-
-
-

Latest Transactions

-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Name - - Country - - City - - Salary -
- Dakota Rice - - Niger - - Oud-Turnhout - - $36,738 -
- Minerva Hooper - - Curaçao - - Sinaai-Waas - - $23,789 -
- Sage Rodriguez - - Netherlands - - Baileux - - $56,142 -
- Philip Chaney - - Korea, South - - Overland Park - - $38,735 -
- Doris Greene - - Malawi - - Feldkirchen in Kärnten - - $63,542 -
- Mason Porter - - Chile - - Gloucester - - $78,615 -
- Jon Porter - - Portugal - - Gloucester - - $98,615 -
-
-
-
-
- -
-
-
-
-
-

Simple Table

-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Name - - Country - - City - - Salary -
- Dakota Rice - - Niger - - Oud-Turnhout - - $36,738 -
- Minerva Hooper - - Curaçao - - Sinaai-Waas - - $23,789 -
- Sage Rodriguez - - Netherlands - - Baileux - - $56,142 -
- Philip Chaney - - Korea, South - - Overland Park - - $38,735 -
- Doris Greene - - Malawi - - Feldkirchen in Kärnten - - $63,542 -
- Mason Porter - - Chile - - Gloucester - - $78,615 -
- Jon Porter - - Portugal - - Gloucester - - $98,615 -
- Jon Porter - - Portugal - - Gloucester - - $98,615 -
- Jon Porter - - Portugal - - Gloucester - - $98,615 -
- Jon Porter - - Portugal - - Gloucester - - $98,615 -
- Jon Porter - - Portugal - - Gloucester - - $98,615 -
- Jon Porter - - Portugal - - Gloucester - - $98,615 -
- Jon Porter - - Portugal - - Gloucester - - $98,615 -
- Jon Porter - - Portugal - - Gloucester - - $98,615 -
- Jon Porter - - Portugal - - Gloucester - - $98,615 -
-
-
-
-
-
- -

-

-
-
-

Basic Elements

-
-
-
-

Buttons -
- Pick your style -

-
-
-
- - - - - -
-
-
-

Pick your size

-
-
-
- - - -
-
-
-

Pick your color

-
-
-
- - - - - - -
-
-
-
-
- - - - - - -
-
-
-
-
-

Links

-
- -
- -
-
-
-

Checkboxes

-
-
- -
-
- -
-
- -
-
- -
-
-
-
-

Radio Buttons

-
-
- -
-
- -
- -
- -
- -
- -
-
-
-
-

Toggle Buttons

-
-
- -
-
- -
- -
-
-
-

Sliders

-
-
-
-
-
-
-
-
-
- -
-
-
- -
-

Jane Faker

-
Music Producer
-
-
-
-
-

An artist of considerable range, Jane Faker — the name taken by Melbourne-raised, Brooklyn-based Nick Murphy — writes, performs and records all of his own music, giving it a warm, intimate feel with a solid groove structure.

-
- Settings -
-
-
- - -
-
-
-
-
    -
  • -
    -
    - Circle Image -
    -
    -
    Flume
    Musical Producer
    -
    -
    -
    - -
    -
    -
    -
  • -
    -
  • -
    -
    - Circle Image -
    -
    -
    Banks
    Singer
    -
    -
    -
    - -
    -
    -
    -
  • -
-
-
-
-
-

Not following anyone yet :(

- -
-
-
-
-
-
-
-
- -
- - © , made with by Creative Tim - -
-
-
-
- - - - - - - - - - - - - - - diff --git a/app/templates/transactions.html b/app/templates/transactions.html new file mode 100644 index 0000000..7458173 --- /dev/null +++ b/app/templates/transactions.html @@ -0,0 +1,137 @@ +{% extends "base.html" %} +{% block content %} +
+ + + +
+
+
+
+

RMT Balance

+
+
+
+
+
+ + {{ form.hidden_tag() }} + {{ form.address(class="form-control", placeholder="Enter FLO address", length=100) }} + {% for error in form.address.errors %} + [{{ error }}] + {% endfor %} + {% if balance %} +
+
+

Balance {{balance}} RMT

+
+ {% endif %} +
+
+
+
+ +
+
+
+
+
+

Latest Transactions

+
+
+
+ + + + + + + + + + {% for item in transactionHistoryTable %} + + + + + + + + {% endfor %} + +
+ Block no. + + Sender + + Receiver + + Amount + + View @ Block explorer +
{{item[1]}}{{item[2]}}{{item[3]}}{{item[4]}} + + +
+
+ + View all + +
+
+
+
+
+ +
+
+
+

Balances

+
+
+
+ + + + + + + {% for item in balanceTable %} + + + + + {% endfor %} + +
+ Address + + Balance +
{{item[0]}}{{item[1]}}
+
+
+
+
+
+
+ + +
+
+ + + +
+
+{% endblock %} \ No newline at end of file