Created
August 14, 2022 13:30
-
-
Save wizicer/d90a905c688c1b59cabf600d84ae65cf to your computer and use it in GitHub Desktop.
Issue multiple-mint CAT, according to https://chialisp.com/docs/tutorials/CAT_Launch_Process_Linux_MacOS#creating-a-multiple-mint-cat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
keys=$(chia keys show) | |
fps=( $(echo "$keys" | grep "Fingerprint:" | awk -F ': ' '{print $2}') ) | |
PS3="Select the fingerprint: " | |
select fingerprint in "${fps[@]}"; | |
do | |
case $fingerprint in | |
*) | |
echo "fingerprint: $fingerprint" | |
break;; | |
esac | |
done | |
echo "Enter the amount (mojo) [ 1000 mojo = 1 Token ]" | |
read amount | |
# echo amount: $amount | |
mpubkey=$(echo "$keys" | grep -A4 $fingerprint | grep "Master public key" | awk -F ': ' '{print $2}') | |
echo master public key: $mpubkey | |
# receiver=$(chia wallet get_address -f $fingerprint) | |
receiver=$(echo "$keys" | grep -A4 $fingerprint | grep "First wallet address" | awk -F ': ' '{print $2}') | |
echo receiver: $receiver | |
coinid=$(cats --tail ./reference_tails/delegated_tail.clsp.hex --curry 0x$mpubkey --send-to $receiver --amount $amount --as-bytes --select-coin -f $fingerprint | grep "^Name:" | awk '{ printf $2 }') | |
echo coinid: $coinid | |
puzzle=$(cdv clsp curry ./reference_tails/genesis_by_coin_id.clsp.hex -a 0x$coinid) | |
echo puzzle: $puzzle | |
treehash=$(cdv clsp curry ./reference_tails/genesis_by_coin_id.clsp.hex -a 0x$coinid --treehash) | |
echo treehash: $treehash | |
signature=$(chia keys sign -d $treehash -f $fingerprint -t m -b | grep "^Signature:" | awk '{ printf $2 }') | |
echo signature: $signature | |
assetid=$(cdv clsp curry ./reference_tails/delegated_tail.clsp.hex -a 0x$mpubkey -H) | |
echo assetid: $assetid | |
# uncomment to inspect json bundle | |
# cats --quiet --tail ./reference_tails/delegated_tail.clsp.hex --curry 0x$mpubkey --send-to $receiver --amount $amount -f $fingerprint --solution "($puzzle ())" --signature $signature | |
bundle=$(cats --quiet --tail ./reference_tails/delegated_tail.clsp.hex --curry 0x$mpubkey --send-to $receiver --amount $amount --as-bytes -f $fingerprint --solution "($puzzle ())" --signature $signature | grep "^Spend Bundle:" | awk '{ printf $3 }') | |
echo bundle: ${bundle:0:60}... | |
read -r -p "Send bundle (y/n)?" CONT < /dev/tty | |
if [ "$CONT" != "y" ]; then | |
exit 0 | |
fi | |
cdv rpc pushtx $bundle |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment