YmcAI commited on
Commit
bf7868e
1 Parent(s): bb667b2

Upload mogwai.py

Browse files

AJUNA WALLET CHECKER

Files changed (1) hide show
  1. mogwai.py +95 -0
mogwai.py ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from dotenv import load_dotenv
3
+ import gradio
4
+ from substrateinterface import SubstrateInterface, Keypair, MnemonicLanguageCode, KeypairType
5
+ from decimal import Decimal, getcontext
6
+ from mexc_sdk import Spot
7
+ import requests
8
+
9
+
10
+
11
+
12
+
13
+ load_dotenv()
14
+ key = os.getenv("COINMARKKETCAP_API_KEY")
15
+ mexc_client = Spot(api_key=os.getenv('MEXC_ACCESS_KEY'),api_secret=os.getenv('MEXC_SECRET_KEY'))
16
+
17
+
18
+
19
+ rpc_url = SubstrateInterface(url="wss://rpc-parachain.bajun.network")
20
+ # substrate = SubstrateInterface(url="ws://127.0.0.1:9944")
21
+ # etat = local_host.isConnected()
22
+ # print(etat)
23
+
24
+ # ymc_address = ['5G6s3tvwCbQ7MZWYmUrZkG8iYxYwAG8usqM57yJF8bU8Dbvr']
25
+
26
+
27
+
28
+
29
+
30
+
31
+ def salut(name) :
32
+ print(name)
33
+ return f"Salut !!! {name}"
34
+
35
+
36
+ def get_balance(address) :
37
+
38
+ url = "https://www.mexc.com/open/api/v2/market/ticker?symbol=BAJU_USDT"
39
+ reponse = requests.get(url)
40
+ data = reponse.json()
41
+ prix_baju = float(data['data'][0]['last'])
42
+ getcontext().prec = 15
43
+ result = rpc_url.query('System', 'Account', [address])
44
+ balance = Decimal(result.value['data']['free']) / Decimal(10 ** 12)
45
+ balance_format = float(format(balance, '.2f'))
46
+ # print(type(result.value['data']['free']))
47
+ print(address)
48
+ balance_usd = prix_baju * balance_format
49
+ return f"Votre Balance est de : {balance_format} Bajun ~ {balance_usd:.2f}$ USD"
50
+
51
+
52
+ print(rpc_url.get_chain_head())
53
+
54
+ description2 = 'h1 style="font-size:50px;text-align:center;"> Bajun Balanc Checker</h1>'
55
+ description = "Bajun Balance Checker ^^"
56
+ desk = "Mogwai Wallet checker 0.0.1 "
57
+
58
+
59
+ with gradio.Blocks(title="Mogwai Wallet Checker..by YmC") as app :
60
+ title = gradio.Label(description,label=desk)
61
+ adresse = gradio.Textbox(label="enter your address")
62
+ nom = gradio.Textbox(label="enter your name or not ")
63
+ balance_output = gradio.Textbox(label="Balance")
64
+ run_button = gradio.Button("RUN")
65
+ salut_button = gradio.Button("Say Holla To YmC ^^ ")
66
+ run_button.click(fn=get_balance, inputs=adresse, outputs=balance_output)
67
+ salut_button.click(fn=salut, inputs=nom, outputs=balance_output)
68
+
69
+ app.launch(share=True,debug=True)
70
+
71
+ # get_balance(liste_address[0])
72
+ # get_balance(ymc_address[0])
73
+
74
+ # def transfer(dest):
75
+ # call = rpc_url.compose_call(
76
+ # call_module='Balances',
77
+ # call_function='transfer',
78
+ # call_params={
79
+ # 'dest': dest,
80
+ # 'value': 1 * 10 ** 15
81
+ # }
82
+ # )
83
+ # keypair = Keypair.create_from_uri('//Alice')
84
+ # extrinsic = rpc_url.create_signed_extrinsic(call=call, keypair=keypair)
85
+ # recu = rpc_url.submit_extrinsic(extrinsic, wait_for_inclusion=True)
86
+ #
87
+ # print(f"extrinsic : '{recu.extrinsic_hash}")
88
+ # print(f"Block Hash: {recu.block_hash}")
89
+ # print(f"Block Number: {recu.block_number}")
90
+ #
91
+ #
92
+ # print()
93
+
94
+ # for balance in liste_address:
95
+ # print(f'{get_balance(balance)} Bajun ')