-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaegis-export.sh
More file actions
executable file
·32 lines (28 loc) · 1.3 KB
/
aegis-export.sh
File metadata and controls
executable file
·32 lines (28 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
set -e # Fail on any error
set -o pipefail # Ensure piped commands propagate exit codes properly
set -u # Treat unset variables as an error when substituting
# If .env exists, source it
if [[ -f .env ]]; then
# We know at this point that .env exists, so we can safely source it
# trunk-ignore(trunk/ignore-does-nothing)
# trunk-ignore(shellcheck/SC1091)
source .env
# Check if RELAYER_MNEMONIC_SECRET_ID is set, if not, regenerate .env
if [[ -z ${RELAYER_MNEMONIC_SECRET_ID} ]]; then
echo 'Env var RELAYER_MNEMONIC_SECRET_ID not found. Regenerating .env...'
npm run generate:env
# We know at this point that .env exists because the npm task created it (or failed with an error), so we can safely source it
# trunk-ignore(trunk/ignore-does-nothing)
# trunk-ignore(shellcheck/SC1091)
source .env
fi
# If not, regenerate .env to ensure RELAYER_MNEMONIC_SECRET_ID is set
else
echo 'Env var RELAYER_MNEMONIC_SECRET_ID not found. Regenerating .env...'
npm run generate:env
fi
# Print out all signer wallets for all relayers in an aegis-compatible format (so monitoring additional signer wallets becomes as easy as copy-pasting)
echo "Generating aegis-compatible signer wallet export..."
script_dir=$(dirname "$0")
NODE_ENV=development npx ts-node "${script_dir}/aegis-export.ts"