logos-execution-zone/keycard_tests.sh

69 lines
2.7 KiB
Bash
Raw Normal View History

2026-05-01 19:35:57 -04:00
#!/usr/bin/env bash
# keycard_tests.sh — end-to-end keycard + token + AMM tests.
#
# Prerequisites:
# 1. Run wallet_with_keycard.sh once to install dependencies.
# 2. Reset the local chain so all accounts are uninitialized.
# 3. Keycard reader inserted with card loaded (wallet keycard load has been run).
#
# Non-keycard account-creation commands use "|| true" because label conflicts are
# harmless on re-runs against the same wallet storage — the existing labeled account
# (which is uninitialized on a fresh chain) is reused.
source venv/bin/activate
2026-05-01 02:44:36 -04:00
export KEYCARD_PIN=111111
2026-04-26 21:29:54 -04:00
2026-05-01 19:35:57 -04:00
# =============================================================================
# Keycard setup
# =============================================================================
echo "=== Test: wallet keycard available ==="
2026-04-26 21:29:54 -04:00
wallet keycard available
2026-05-01 19:35:57 -04:00
echo "=== Test: wallet keycard load ==="
2026-05-01 02:44:36 -04:00
wallet keycard load --mnemonic "fashion degree mountain wool question damp current pond grow dolphin chronic then"
2026-04-26 21:29:54 -04:00
2026-05-01 19:35:57 -04:00
# Register keycard account at path 0.
# auth-transfer init is idempotent: skips gracefully if nonce > 0.
echo "=== Test: auth-transfer init path 0 ==="
2026-05-01 02:44:36 -04:00
wallet auth-transfer init --key-path "m/44'/60'/0'/0/0"
2026-04-26 21:29:54 -04:00
2026-05-01 19:35:57 -04:00
echo "=== Test: account get path 0 ==="
2026-05-01 02:44:36 -04:00
wallet account get --key-path "m/44'/60'/0'/0/0"
2026-04-26 21:29:54 -04:00
2026-05-01 19:35:57 -04:00
echo "=== Test: pinata claim path 0 ==="
2026-05-01 02:44:36 -04:00
wallet pinata claim --key-path "m/44'/60'/0'/0/0"
2026-04-26 21:29:54 -04:00
2026-05-01 19:35:57 -04:00
echo "=== Test: account get path 0 (after claim) ==="
2026-05-01 02:44:36 -04:00
wallet account get --key-path "m/44'/60'/0'/0/0"
2026-04-26 21:29:54 -04:00
2026-05-01 19:35:57 -04:00
echo "=== Test: auth-transfer init path 1 ==="
2026-05-01 02:44:36 -04:00
wallet auth-transfer init --key-path "m/44'/60'/0'/0/1"
2026-04-26 21:29:54 -04:00
2026-05-01 19:35:57 -04:00
echo "=== Test: auth-transfer send path 0 → path 1 ==="
wallet auth-transfer send --amount 40 \
--from-key-path "m/44'/60'/0'/0/0" \
--to-key-path "m/44'/60'/0'/0/1"
2026-04-26 21:29:54 -04:00
2026-05-01 19:35:57 -04:00
echo "=== Test: account get path 0 ==="
wallet account get --key-path "m/44'/60'/0'/0/0"
echo "=== Test: account get path 1 ==="
2026-05-01 02:44:36 -04:00
wallet account get --key-path "m/44'/60'/0'/0/1"
2026-04-29 07:52:15 -04:00
2026-05-01 19:35:57 -04:00
# =============================================================================
# (1) Shielded auth-transfer to an owned private account; verify decoded state.
#
# Use --to-label (ShieldedOwned path) so the wallet decodes the received note
# after sync and the balance is visible locally.
# =============================================================================
echo ""
echo "=== Test (1): Shielded auth-transfer to owned private account ==="
2026-05-04 21:28:29 -04:00
wallet auth-transfer send --amount 2 \
2026-05-01 19:35:57 -04:00
--from-key-path "m/44'/60'/0'/0/0" \
2026-05-04 21:28:29 -04:00
--to-npk "55204e2934045b044f06d8222b454d46b54788f33c7dec4f6733d441703bb0e6" \
--to-vpk "02a8626b0c0ad9383c5678dad48c3969b4174fb377cdb03a6259648032c774cec8"
2026-05-01 19:35:57 -04:00
echo "Shielded auth-transfer sent"
2026-05-04 21:28:29 -04:00
# TODO: add a time delay here
wallet account get --key-path "m/44'/60'/0'/0/0"