-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
84 lines (68 loc) · 2.51 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import csv
import hashlib
import math
import os
import time
import requests
import json
from flask import (Flask, after_this_request, jsonify, redirect,
render_template, request, url_for, abort)
app = Flask(__name__)
# assert "contractAddress" in os.environ, "Contract not deployed yet!"
CONTRACT_ADDRESS = "0x10F7c9D400ea1C95FBFE20d2D8e0C3f09039b2AF" # os.environ["contractAddress"] #v1.3.1
ETH_ADDRESS_LENGTH = 42
CURRENT_USER = ""
@app.route("/", methods = ["POST", "GET"])
def home():
return render_template("home.html")
@app.route("/avalanche-to-ethereum", methods = ["POST", "GET"])
def ava_to_eth():
return render_template("avalanche-to-ethereum.html")
@app.route("/solana-to-ethereum", methods = ["POST", "GET"])
def sol_to_eth():
return render_template("solana-to-ethereum.html")
@app.route("/contract_address", methods = ["GET"])
def get_contract_address():
@after_this_request
def add_header(response):
response.headers.add("Access-Control-Allow-Origin", "*")
return response
global CONTRACT_ADDRESS
return jsonify(CONTRACT_ADDRESS)
# @app.route("/get_metadata/<pub_key>", methods = ["GET"])
# def get_meta_data(pub_key):
# @after_this_request
# def add_header(response):
# response.headers.add("Access-Control-Allow-Origin", "*")
# return response
# headers = {
# 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36'
# }
# params = {
# 'address': pub_key
# }
# response = requests.get('http://api.devnet.solscan.io/account', headers=headers, params=params)
# print("Hello!!!!")
# print(response.content.decode())
# print("Hello!!!!")
# return jsonify(response.content.decode())
@app.route("/blockchainapi/<pub_key>", methods = ["GET"])
def get_theblockchainapi(pub_key):
response = requests.get(
"https://api.theblockchainapi.com/v1/solana/nft",
params={
'mint_address':
pub_key,
'network': 'devnet'
},
headers={
'APISecretKey': 'tt7Ev6E062jObYK',
'APIKeyId': 'FbiqdlAC5YG6WVJ'
}
)
print("----------------------------------------------")
print(response.json())
print("----------------------------------------------")
return response.json()
if __name__ == "__main__":
app.run(host="0.0.0.0", debug=True)