Skip to content

Instantly share code, notes, and snippets.

@sskeirik
Last active February 2, 2021 06:42
Show Gist options
  • Save sskeirik/47ec9c19da337ade8ea9bfe112c8efa4 to your computer and use it in GitHub Desktop.
Save sskeirik/47ec9c19da337ade8ea9bfe112c8efa4 to your computer and use it in GitHub Desktop.
Sandbox Setup Script for Vault Application
#!/bin/bash
if [ -z "$SANDBOX_PATH" ] || [ ! -f "$SANDBOX_PATH/sandbox" ] ; then
echo "Error: \$SANDBOX_PATH must be defined and point to a sandbox binary."
echo "To use this script, first clone the Algorand sandbox:"
echo
echo "git clone https://github.com/algorand/sandbox"
echo
echo "Then set \$SANDBOX_PATH to the newly created directory for the git clone"
echo
echo "Finally, update the settings.js file in vault application to point to sandbox algod instance."
echo "The sandbox default is:"
echo "address: http://localhost:4001"
echo "token: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
exit 1
fi
sandbox() {
"$SANDBOX_PATH/sandbox" "$@"
}
goal() {
"$SANDBOX_PATH/sandbox" goal "$@"
}
ACCOUNT_IDS=( \
'W3UV5O2VTJYC4J6DYESAAA6QNHQYDHULEOEXOFELAT7FEHT7SS3NMBKW2Q' \
'GZILFNLBQ4BURKLJISKDQVNDXOTFGMSP6MAXI76HRB2KDI2PBAA2TKFFIY' \
'5TAAKQIKHOWAGL7HQLB43LHNMOAZNKP76QBB4OWEAYQSKSVA5VS6Y6DRCQ' \
'3CMRUAF4U7P2GOGVXXEKXAUZCCVUTTQTKYEAA75CGFDG4H3L66SBPYAI3A' \
'M7VGND73KDBHIKB3KB7GT3PHVORFPGVOEOY6TZFA25DDVJ5WRLV7S5KQ7E' \
'P4QKUHU4ZWR7IVF3DXHWFC34ZLI3EZ7JWT6YCPGJ6RQNNHF5RJ2LADTSXE' \
'DDA62FAYHSPYBSGKXQPUFNL2IG5WPMYQNPQS44YW5X4NER7ABNUOVHL4M4' \
'XTZVAH6FPQDX2VOVHBOCTWP3YSNFK5PFFN76YLBI7HMJS7TSWLQKU6DKOA' \
'HEBIUTQ4WVRQSK7GBNUOZSWC4XP6HLIGF2YGV4ASTPHGW7CDJ5OMMJLOIU' \
'CV3U3AV6WY4Q22QLGYUQYFBF6DQWZLK23S5PBLFXRI3MWVQHVUHIE7EZB4' \
)
ACCOUNT_KEYS=( \
'injury purchase behave pool tuna error keep apart snow essence symbol notice mansion exile punch aware tent kid cinnamon vault mask talent change absorb raise' \
'sadness cradle giraffe famous garbage uniform real catalog horse swift elder trim skill shoe fault lyrics net file brown shop trophy vehicle fitness abstract orphan' \
'south quick valid slab defy conduct absorb captain borrow bulb drive box wall again orchard express ensure mail venue deputy negative radar violin about cousin' \
'off make custom code notable rule furnace zoo acid miss almost orchard add original pelican obtain open entire depend bleak rival dove outside absorb fame' \
'hello lesson dad camp squeeze screen ensure question concert never trash when soda wool smart genre humor verb vote insect abandon tide defense about soccer' \
'immune gloom foil disorder furnace bleak attack huge risk resemble phone choose minute priority shop grow jewel armor air exact real hurry arrange ability picnic' \
'reason rigid ranch shock portion blouse miracle barrel balcony option curious quarter possible stick true sting lake recycle nest junior horn veteran copy about alien' \
'twelve chunk clay rally balcony debris raw only library tenant auction discover error hammer economy visit frog bridge wheel slogan caution remain alone ability magnet' \
'track panic hollow hub clap sniff bracket animal whale mother mirror object coral same canoe pitch lyrics oven issue deputy north soft story above very' \
'worry sphere situate rib update trumpet glove mechanic perfect glare cost cart agree drastic spin blanket what flash orient utility grow focus zebra abandon leave' \
)
add_account() {
echo sandbox goal account import -m "$1"
goal account import -m "$1"
}
pay() {
echo sandbox goal clerk send --no-wait -f "$1" -t "$2" -a 50000000
goal clerk send --no-wait -f "$1" -t "$2" -a 50000000
}
# start sandbox
sandbox up -v
# extract account from initial accounts list
PAYER=$(goal account list | head -n1 | cut -f2 | tr -d [:space:])
# import account keys
for key in "${ACCOUNT_KEYS[@]}"; do
add_account "$key" || true
done
# pay money to each account
for acct in "${ACCOUNT_IDS[@]}"; do
pay $PAYER $acct
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment