鑫大叔
鑫大叔

一個在獲得肺腺癌末期患者頭銜後更加迷茫的大叔

QPython Series: Check LikeCoin Wallet Balance on Your Phone

(edited)
This time, the half-baked programmers have come to toss how to run Python on their mobile phones~ The first one is to test the waters with LikeCoin, which is always a hot topic in the city! ! !

When you see this title, do you want to ask, to check the LikeCoin wallet balance is not to open LikerLand?

If you only have one LikerLand account, it's fine to open the app, but for people with more than one Matters account to see the wallet balance, you have to log out and log in again. It's even worse if you use the Kelper wallet, you can't watch it without turning on the computer.

⏺ Applicable people

❇️ Hold more than one Liker Land account

❇️ Want to see the LikeCoin balance of Kepler wallet on your phone

❇️ Android phone users (no way, the uncle is not using an iPhone)

⏺ Introduction

Because the uncle's hands are too itchy, he made several LikeCoin wallets scattered, and after a long time, he can't figure out how much money is in that wallet, and what rewards should he get out? I just saw that @Kuàn-ka recently published an article with the source code directly attached to the text, so I decided to use it for modification.

The first time you use it, you need to download QPython from the Google Store and make some settings. After completion, just open the App and run the script to get the following results.


The renderings are my two wallet balances that I don't use much


⏺ Installation Instructions

The required tools and materials are:

❇️ QPython ( free download on Google Play)

❇️ Your LikeCoin wallet address (will be explained later)

❇️ The code written by the uncle (because it is too long, put it at the end of the article, or click here to open it)

Add the required Python libraries:

  1. Click on the App, if the App and you want permission, click OK. See the menu point "QPYPI".
  2. First click "Pip console" to install a library that needs to be used.
  3. Enter "pip3 install requests", refer to the picture.
  4. Press the Enter key to issue the command entered in the previous step.
  5. Wait until the arrow (-->) reappears and it's done.
How to add required Python libraries


Build script:

  1. Open the editor, copy and paste the code.
  2. Click the save button and select "scrpts3" to save the script.
  3. Enter a script name that is easy for you to identify, the end must be ".py", and click the tick button to save the script.
How to build a script


Run the script:

  1. Click Programs.
  2. Click the script to run.
  3. Click "Run".
  4. After the script finishes running, the time required will be affected by the number of wallets and the speed of the network. The two wallets in the figure only take a few seconds.
How to run the script


How to find the wallet address:

The leftmost picture below is how to find the address of Kepler wallet, and the other three pictures are from LikerLand.

  1. Click on "My Wallet".
  2. Click "Receive Payment".
  3. Click "Copy" to copy the wallet address.
Where are the Kepler and LikerLand wallet addresses


⏺ Notice of the next issue

In addition to watching the LikeCoin wallet, I am also doing a script to read various currency wallets with one click, and a script to read the currency price with one click. If you want to see it, please clap your hands a lot, otherwise I will misunderstand that no one will see it, maybe I will use it myself instead of posting it~

⏺ Code

You can enter up to 10 wallet addresses, just replace " your wallet address 1 " in the code below with your own wallet address, and enter wallet[1] , wallet[2] , wallet[3 for other wallets in sequence ] between the quotation marks after it.

The code can also be found here .

 import requests
requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS = "TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-256-GCM-SHA384:ECDHE:!COMPLEMENTOFDEFAULT"
from datetime import datetime

wallet=['','','','','','','','','','']
wallet[0]='Your wallet address 1'
wallet[1]=''
wallet[2]=''
wallet[3]=''
wallet[4]=''
wallet[5]=''
wallet[6]=''
wallet[7]=''
wallet[8]=''
wallet[9]=''

def GetLikeWalletInfo(address):
for x in range(3):
if (x == 0):
url = "https://mainnet-node.like.co/cosmos/bank/v1beta1/balances/" + address
res = requests.get(url)
data = res.json()

rAmt = 0
sChecker = str(data)
if sChecker[:7] !="{'code'":
DD1 = data['balances']
for DD2 in DD1:
aAmt = DD2['amount']
aAmt = float(aAmt) /pow(10,9)

elif(x == 1):
url = "https://mainnet-node.like.co/cosmos/distribution/v1beta1/delegators/" + address + "/rewards"
res = requests.get(url)
data = res.json()

rAmt = 0
sChecker = str(data)
if sChecker[:7] !="{'code'":
DD1 = data['rewards']
for DD2 in DD1:
DD3 = DD2['reward']
for DD4 in DD3:
rAmt = rAmt + float(DD4['amount'])

rAmt = float(rAmt) /pow(10,9)

elif(x == 2):
url = "https://mainnet-node.like.co/cosmos/staking/v1beta1/delegations/" + address
res = requests.get(url)
data = res.json()

sAmt = 0
sChecker = str(data)
if sChecker[:7] !="{'code'":
DD1 = data['delegation_responses']

for DD2 in DD1:
#print(DD2['balance']['amount'])
sAmt = sAmt + float(DD2['balance']['amount'])

sAmt = float(sAmt) /pow(10,9)

print(f"{address[-4:] :>4}{int(aAmt) :>7}{int(rAmt) :>7}{int(sAmt) :>7}")

dt = datetime.today().isoformat()[:19].replace("T", " ")
print('')
print('Your LikeCoin wallet balance is inquiring...')
print("Start time:",dt)
print('-'*30)
print(f"{'Wallet':<4}{'Balance':^7}{'Reward':<7}{'Delegation':<7}")

for x in range(len(wallet)):
if wallet[x] != '':
GetLikeWalletInfo(wallet[x])

print('-'*30)
dt = datetime.today().isoformat()[:19].replace("T", " ")
print ("Update complete:",dt)
print('')
CC BY-NC-ND 2.0

Like my work?
Don't forget to support or like, so I know you are with me..

Loading...
Loading...

Comment