From d7365c4b66d228484f183d2d937cee9856ceb2e4 Mon Sep 17 00:00:00 2001 From: Joe Tsang <30622993+jtsang586@users.noreply.github.com> Date: Wed, 21 Dec 2022 11:36:27 +0000 Subject: [PATCH] test(2433): capsule wallet script (#2447) * chore: added bash script for vega wallet * chore: update readme * chore: fix lint --- .../setup-vegawallet-docker/action.yml | 4 ---- README.md | 17 ++++++++++++++ vegacapsule/passphrase | 1 + vegacapsule/setup-vegawallet.sh | 22 +++++++++++++++++++ 4 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 vegacapsule/passphrase create mode 100644 vegacapsule/setup-vegawallet.sh diff --git a/.github/actions/setup-vegawallet-docker/action.yml b/.github/actions/setup-vegawallet-docker/action.yml index 810688166..5d377c99a 100644 --- a/.github/actions/setup-vegawallet-docker/action.yml +++ b/.github/actions/setup-vegawallet-docker/action.yml @@ -8,10 +8,6 @@ outputs: runs: using: 'composite' steps: - - name: Create passphrase - shell: bash - run: echo "${{ inputs.passphrase }}" > ./passphrase - - name: Initialize wallet shell: bash run: vega wallet init -f --home ~/.vegacapsule/testnet/wallet diff --git a/README.md b/README.md index 885ad1549..f2aef576e 100644 --- a/README.md +++ b/README.md @@ -156,6 +156,23 @@ In order to run the bootstrap command to generate and start a new network, we mu vegacapsule network bootstrap --config-path=../frontend-monorepo/vegacapsule/config.hcl ``` +In order to setup and run vegawallet for e2e capsule tests, in a separate terminal window: + +1. cd into `./vegacapsule` +2. run: + +```bash +bash setup-vegawallet.sh +``` + +3. copy generated `api-token` and paste the token into `CYPRESS_VEGA_WALLET_API_TOKEN` environment variable in either `apps/token-e2e/.env` or `apps/explorer-e2e/.env` depending on which project needs testing. + +Note: The script is only needed if capsule was built for first time or fresh. To run existing wallet service for capsule: + +```bash +vega wallet service run -n DV --load-tokens --tokens-passphrase-file passphrase --no-version-check --automatic-consent --home ~/.vegacapsule/testnet/wallet +``` + # 📑 License [MIT](./LICENSE) diff --git a/vegacapsule/passphrase b/vegacapsule/passphrase new file mode 100644 index 000000000..4b2cb5917 --- /dev/null +++ b/vegacapsule/passphrase @@ -0,0 +1 @@ +0123245 diff --git a/vegacapsule/setup-vegawallet.sh b/vegacapsule/setup-vegawallet.sh new file mode 100644 index 000000000..72fc682f9 --- /dev/null +++ b/vegacapsule/setup-vegawallet.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Initialise wallet +vega wallet init -f --home ~/.vegacapsule/testnet/wallet + +# Import wallet +vega wallet import -w capsule_wallet --recovery-phrase-file ./recovery -p ./passphrase --home ~/.vegacapsule/testnet/wallet + +# Generate public key +vega wallet key generate -w capsule_wallet -p ./passphrase --home ~/.vegacapsule/testnet/wallet + +# Import network +vega wallet network import --force --from-file ./wallet-config.toml --home ~/.vegacapsule/testnet/wallet + +# Initialise api-token +vega wallet api-token init --home ~/.vegacapsule/testnet/wallet --passphrase-file passphrase + +# Generate api-token +vega wallet api-token generate --wallet-name capsule_wallet --tokens-passphrase-file passphrase --wallet-passphrase-file passphrase --home ~/.vegacapsule/testnet/wallet + +# Wallet service run +vega wallet service run -n DV --load-tokens --tokens-passphrase-file passphrase --no-version-check --automatic-consent --home ~/.vegacapsule/testnet/wallet