sol balance
This commit is contained in:
3
run.sh
3
run.sh
@@ -12,7 +12,8 @@ rpcurls=(
|
|||||||
"https://api.mainnet-beta.solana.com"
|
"https://api.mainnet-beta.solana.com"
|
||||||
)
|
)
|
||||||
|
|
||||||
for keypair in *.json;
|
files=$(find . -maxdepth 2 -type f -name "*.json")
|
||||||
|
for keyfile in $files; do
|
||||||
do
|
do
|
||||||
# 随机选择一个RPC URL
|
# 随机选择一个RPC URL
|
||||||
index=$((RANDOM % ${#rpcurls[@]}))
|
index=$((RANDOM % ${#rpcurls[@]}))
|
||||||
|
|||||||
20
solBalance.sh
Normal file
20
solBalance.sh
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#export http_proxy="http://10.3.255.132:51837"
|
||||||
|
#export https_proxy="http://10.3.255.132:51837"
|
||||||
|
|
||||||
|
rpc=https://api.mainnet-beta.solana.com
|
||||||
|
total_sol=0
|
||||||
|
files=$(find . -maxdepth 2 -type f -name "*.json")
|
||||||
|
for keyfile in $files;
|
||||||
|
do
|
||||||
|
if [ -f ./rpc_config ]; then
|
||||||
|
source ./rpc_config
|
||||||
|
fi
|
||||||
|
# 获取源账户余额(以lamports为单位)
|
||||||
|
balance_lamports=$(solana balance $from_keypair --url $RPC_URL --output json | jq -r '.lamports')
|
||||||
|
balance_SOL=$(echo "scale=9; $balance_lamports / 1000000000" | bc)
|
||||||
|
total_sol=$(echo "$total_sol + $balance_SOL" | bc)
|
||||||
|
echo $keyfile $balance_SOL SOL
|
||||||
|
done
|
||||||
|
printf "Total SOL: %.9f SOL\n" "$total_sol"
|
||||||
Reference in New Issue
Block a user