File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # This script imports all account keys from the specified YAML configuration file
4+ # into Ignite accounts using the provided names and mnemonics.
5+
6+ # Path to the YAML configuration file
7+ YAML_FILE=" config.yml"
8+
9+ # Check if 'yq' is installed, which is required for parsing the YAML file
10+ if ! command -v yq & > /dev/null
11+ then
12+ echo " The 'yq' command-line tool is required to run this script."
13+ echo " You can install it with 'brew install yq' (on macOS) or see https://github.com/mikefarah/yq for other options."
14+ exit 1
15+ fi
16+
17+ # Loop through each account entry in the YAML file
18+ for index in $( yq eval ' .accounts | keys' " $YAML_FILE " -o=json | jq ' .[]' ) ; do
19+ # Extract the account's name and mnemonic based on the current index
20+ NAME=$( yq eval " .accounts[$index ].name" " $YAML_FILE " )
21+ MNEMONIC=$( yq eval " .accounts[$index ].mnemonic" " $YAML_FILE " )
22+
23+ # Run the import command for each account
24+ echo " Importing account: $NAME "
25+ ignite a import " $NAME " --secret " $MNEMONIC "
26+ done
You can’t perform that action at this time.
0 commit comments