feat: add multi wallet support #59
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Functional Tests | |
on: | |
push: | |
tags: ['v*'] | |
pull_request: | |
branches: ['main'] | |
workflow_dispatch: | |
jobs: | |
functional-tests: | |
strategy: | |
matrix: | |
type: [ | |
"distributed-to-nd", | |
"nd-to-distributed", | |
"hd-to-distributed", | |
"hd-to-nd", | |
] | |
defaults: | |
run: | |
working-directory: './.github/examples/' | |
shell: bash | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: 'Build dkc script' | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: './go.mod' | |
- run: go build ../../ | |
- name: 'Install ethdo' | |
run: | | |
go install "github.com/wealdtech/ethdo@$ethdo_version" | |
env: | |
ethdo_version: 'v1.28.5' | |
- name: 'Converting ${{matrix.type}}' | |
run: | | |
#FIXME set -e is the default bash flag(this is not obvious btw need to fix) | |
echo -e "# Running DKC" | |
./dkc convert --config ${{matrix.type}}.yaml | |
echo -e "# Running Checking Accounts" | |
echo -e "Generating Input And Output Paths" | |
input_type=$(echo ${{ matrix.type }} | awk -F'-' '{print $1}') | |
input_path="./${{ matrix.type }}/$input_type" | |
output_type=$(echo ${{ matrix.type }} | awk -F'-' '{print $3}') | |
output_path="./${{ matrix.type }}/$output_type" | |
echo -e "Generating Input And Output Paths: ${green}OK${nc}" | |
echo -e "Generating Input Grep Command" | |
input_grep="Public key:" | |
ouput_grep="Public key:" | |
echo -e "Generating Input Grep Command: ${green}OK${nc}" | |
echo -e "Updating Paths And Grep Command If Wallet Is Distributed" | |
if echo "${input_type}" | grep -q "distributed"; then | |
input_path="$input_path/test1" | |
input_grep="Composite public key:" | |
fi | |
if echo "${output_type}" | grep -q "distributed"; then | |
output_path="$output_path/test1" | |
output_grep="Composite public key:" | |
fi | |
echo -e "Updating Paths And Grep Command If Wallet Is Distributed: ${green}OK${nc}" | |
echo -e "${green}Input Path | Input Grep:${nc} [$input_path] [$input_grep]" | |
echo -e "${green}Output Path | Output Grep:${nc} [$output_path] [$output_grep]" | |
echo -e "Getting Wallets" | |
wallets_list=$(ethdo wallet list --base-dir "$input_path" | tr '\n' ' ') | |
echo -e "Getting Wallets: ${green}OK${nc}" | |
for w in $wallets_list; do | |
echo -e "Checking Wallet [$w]" | |
echo -e "Getting Accounts For [$w]" | |
accounts=$(ethdo wallet --base-dir "$input_path" accounts --wallet="$w" | tr '\n' ' ') | |
echo -e "Getting Accounts For [$w]: ${green}OK${nc}" | |
for a in $accounts; do | |
echo -e "Cheking Account[$a]" | |
input_key=$(ethdo account --base-dir "$input_path" info --account "$w/$a" | grep -i "$input_grep" | awk '{print $NF}') | |
output_key=$(ethdo account --base-dir "$output_path" info --account "$w/$a" | grep -i "$output_grep" | awk '{print $NF}') | |
if [[ $input_key != $output_key ]]; then | |
echo -e "Account [$w/$a]: ${red}Fail${nc} ($input_key != $output_key)" | |
exit 1 | |
fi | |
echo -e "Checking Account [$w/$a]: ${green}OK${nc}" | |
done; | |
echo -e "Checking Wallet [$w]: ${green}OK${nc}" | |
done; | |
env: | |
red: '\033[0;31m' | |
green: '\033[0;32m' | |
nc: '\033[0m' |