icepick/e2e-tests/solana/online.sh

33 lines
779 B
Bash

printf "%s" "Public key of the sender address: "
read from_address
printf "%s" "Public key of the recipient address: "
read to_address
printf "%s" "Name of the token to transfer: "
read token_name
printf "%s" "Amount of token to transfer: "
read token_amount
echo "Acquiring blockhash..."
blockhash="$(icepick sol get-blockhash --cluster devnet | jq -r .blob)"
echo "Saving information to file"
cat <<EOF > /data/input.json
{
"from_address": "$from_address",
"to_address": "$to_address",
"token_name": "$token_name",
"token_amount": "$token_amount",
"blockhash": "$blockhash"
}
EOF
echo "Waiting for signed transaction..."
while test ! -f /data/output.json; do sleep 1; done
echo "Broadcasting transaction"
icepick sol broadcast --cluster devnet < /data/output.json