2024-12-16 18:53:52 +00:00
|
|
|
set -eu
|
|
|
|
|
|
|
|
echo "Loading Keyfork by mnemonic"
|
|
|
|
export KEYFORKD_SOCKET_PATH=/tmp/keyforkd.sock
|
|
|
|
( keyfork recover mnemonic & )
|
|
|
|
|
|
|
|
while test ! -e $KEYFORKD_SOCKET_PATH; do sleep 1; done
|
|
|
|
|
|
|
|
echo "Waiting for inputs from online system..."
|
|
|
|
while test ! -f /data/input.json; do sleep 1; done
|
|
|
|
|
|
|
|
from_address="$(jq -r .from_address /data/input.json)"
|
|
|
|
to_address="$(jq -r .to_address /data/input.json)"
|
|
|
|
token_name="$(jq -r .token_name /data/input.json)"
|
|
|
|
token_amount="$(jq -r .token_amount /data/input.json)"
|
|
|
|
blockhash="$(jq -r .blockhash /data/input.json)"
|
|
|
|
token_address="$(icepick sol get-token-address "$token_name" | jq -r .blob)"
|
|
|
|
|
|
|
|
jq . /data/input.json
|
2024-12-16 18:56:34 +00:00
|
|
|
echo "Do these values look correct? If not, press ctrl-c. Otherwise, press Enter."
|
2024-12-16 18:53:52 +00:00
|
|
|
read _
|
|
|
|
|
|
|
|
echo "Creating and signing transaction"
|
|
|
|
|
|
|
|
icepick sol transfer-token "$token_amount" "$token_address" "$to_address" "$from_address" | icepick sol sign "$blockhash" > /data/output.json
|