-
Notifications
You must be signed in to change notification settings - Fork 0
/
tcg_wallet_inspector.sh
60 lines (49 loc) · 4.54 KB
/
tcg_wallet_inspector.sh
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
#!/bin/bash
#
# Chia TCG - Wallet Inspector
#
echo""
echo "████████╗ ██████╗ ██████╗ ██╗ ██╗ █████╗ ██╗ ██╗ ███████╗████████╗ ██╗███╗ ██╗███████╗██████╗ ███████╗ ██████╗████████╗ ██████╗ ██████╗ "
echo "╚══██╔══╝██╔════╝██╔════╝ ██║ ██║██╔══██╗██║ ██║ ██╔════╝╚══██╔══╝ ██║████╗ ██║██╔════╝██╔══██╗██╔════╝██╔════╝╚══██╔══╝██╔═══██╗██╔══██╗"
echo " ██║ ██║ ██║ ███╗ ██║ █╗ ██║███████║██║ ██║ █████╗ ██║ ██║██╔██╗ ██║███████╗██████╔╝█████╗ ██║ ██║ ██║ ██║██████╔╝"
echo " ██║ ██║ ██║ ██║ ██║███╗██║██╔══██║██║ ██║ ██╔══╝ ██║ ██║██║╚██╗██║╚════██║██╔═══╝ ██╔══╝ ██║ ██║ ██║ ██║██╔══██╗"
echo " ██║ ╚██████╗╚██████╔╝ ╚███╔███╔╝██║ ██║███████╗███████╗███████╗ ██║ ██║██║ ╚████║███████║██║ ███████╗╚██████╗ ██║ ╚██████╔╝██║ ██║"
echo " ╚═╝ ╚═════╝ ╚═════╝ ╚══╝╚══╝ ╚═╝ ╚═╝╚══════╝╚══════╝╚══════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚══════╝╚═╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝"
echo " powered by the MintGarden API. Version 0.1"
echo "____________________________________________________________________________________________________________________________________________________________"
echo ""
wallet_list=`chia wallet show -w nft | grep "Wallet ID" | cut -c 28- | tr '\n' ' '`
echo -e " NFT Wallet IDs: ${txtrst}$wallet_list${bldgrn}"
echo ""
read -p " Wallet ID, or [Enter] for all, or [x] to cancel? " answer_wallet
if [ "$answer_wallet" != "X" ] && [ "$answer_wallet" != "x" ]; then
if [ "$answer_wallet" != "" ]; then
wallet_list="$answer_wallet"
fi
all=0
for val in $wallet_list; do
echo ""
echo " ==== Wallet ID: $val ===="
echo "Wallet $val" > wallet_$val.ids
c=`chia rpc wallet nft_count_nfts '{"wallet_id":'$val'}' | jq -r '.count'`
nft_ids=`chia rpc wallet nft_get_nfts '{"wallet_id":'$val', "start_index":0, "num":'$c', "ignore_size_limit": false}' | grep "nft_id" | cut -c 24-85`
nft_collection=""
nft_name=""
for id in $nft_ids; do
nft_json=`curl -s https://api.mintgarden.io/nfts/$id`
nft_collection=`echo "$nft_json" | jq '.collection.name' | cut --fields 2 --delimiter=\"`
nft_collection_id=`echo "$nft_json" | jq '.collection.id' | cut --fields 2 --delimiter=\"`
nft_name=`echo "$nft_json" | jq '.data.metadata_json.name' | cut --fields 2 --delimiter=\"`
tcg_tier=`echo "$nft_json" | jq '.chiatcg_stats.tier' | cut --fields 2 --delimiter=\"`
tcg_cpu=`echo "$nft_json" | jq '.chiatcg_stats.cpu' | cut --fields 2 --delimiter=\"`
tcg_mem=`echo "$nft_json" | jq '.chiatcg_stats.mem' | cut --fields 2 --delimiter=\"`
tcg_faction=`echo "$nft_json" | jq '.chiatcg_stats.faction' | cut --fields 2 --delimiter=\"`
tcg_core_script=`echo "$nft_json" | jq '.chiatcg_stats.core_script' | cut --fields 2 --delimiter=\"`
echo -e "${txtrst}[T$tcg_tier] $id [$nft_collection] $nft_name -- ChiaTCG[T$tcg_tier, CPU:$tcg_cpu, MEM:$tcg_mem, Faction:$tcg_faction, Script:$tcg_core_script] ${bldgrn}"
done
echo -e " Wallet Count Total: ${txtrst}$c${bldgrn}"
all=$(($all+$c))
done
echo ""
echo -e " Total number of NFTs: ${txtrst}$all${bldgrn}"
fi