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 echo "Do these values look correct? If not, press ctrl-c. Otherwise, press Enter." 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.tmp mv /data/output.json.tmp /data/output.json