diff --git a/keycard_test_3.sh b/keycard_test_3.sh index b76f4f38..5b9f70c7 100644 --- a/keycard_test_3.sh +++ b/keycard_test_3.sh @@ -8,11 +8,11 @@ source venv/bin/activate export KEYCARD_PIN=111111 -echo "=== Test: wallet keycard get-private-keys path 0 ===" -wallet keycard get-private-keys --key-path "m/44'/60'/0'/0/0" +echo "=== Test: wallet keycard get-private-keys path 10 ===" +wallet keycard get-private-keys --key-path "m/44'/60'/0'/0/10" -echo "=== Test: wallet keycard get-private-keys path 1 ===" -wallet keycard get-private-keys --key-path "m/44'/60'/0'/0/1" +echo "=== Test: wallet keycard get-private-keys path 11 ===" +wallet keycard get-private-keys --key-path "m/44'/60'/0'/0/11" echo "" echo "=== All get-private-keys tests finished ===" diff --git a/keycard_tests_2.sh b/keycard_tests_2.sh index 9863cafa..9c82efa2 100644 --- a/keycard_tests_2.sh +++ b/keycard_tests_2.sh @@ -7,14 +7,14 @@ # 3. Keycard reader inserted with card loaded. # # Keycard path layout: -# path 0 → LEZ token definition (keycard) -# path 1 → LEZ token supply (keycard) -# path 2 → LEE token definition (keycard) -# path 3 → LEE token supply (keycard) -# path 4 → LEZ holding (keycard — transfers, mint, burn, swap, liquidity) -# path 5 → LEE holding (keycard — swap, add/remove liquidity) -# path 6 → LP holding (keycard — add/remove liquidity) -# path 7 → ATA owner (keycard — ATA create, send, burn) +# path 2 → LEZ token definition (keycard) +# path 3 → LEZ token supply (keycard) +# path 4 → LEE token definition (keycard) +# path 5 → LEE token supply (keycard) +# path 6 → LEZ holding (keycard — transfers, mint, burn, swap, liquidity) +# path 7 → LEE holding (keycard — swap, add/remove liquidity) +# path 8 → LP holding (keycard — add/remove liquidity) +# path 9 → ATA owner (keycard — ATA create, send, burn) # # Non-keycard accounts: # pub-receiver → public account (target for keycard → public token transfer) @@ -49,10 +49,10 @@ wallet account new public --label amm-lp-fund 2>/dev/null || true # (1) Create LEZ token — definition AND supply via keycard paths # ============================================================================= echo "" -echo "=== (1) Create LEZ token (keycard def=path0, supply=path1) ===" +echo "=== (1) Create LEZ token (keycard def=path2, supply=path1) ===" wallet token new \ - --definition-key-path "m/44'/60'/0'/0/0" \ - --supply-key-path "m/44'/60'/0'/0/1" \ + --definition-key-path "m/44'/60'/0'/0/2" \ + --supply-key-path "m/44'/60'/0'/0/3" \ --name LEZ \ --total-supply 100000 echo "LEZ token created" @@ -61,29 +61,29 @@ echo "LEZ token created" # (2) Create LEE token — definition AND supply via keycard paths # ============================================================================= echo "" -echo "=== (2) Create LEE token (keycard def=path2, supply=path3) ===" +echo "=== (2) Create LEE token (keycard def=path4, supply=path3) ===" wallet token new \ - --definition-key-path "m/44'/60'/0'/0/2" \ - --supply-key-path "m/44'/60'/0'/0/3" \ + --definition-key-path "m/44'/60'/0'/0/4" \ + --supply-key-path "m/44'/60'/0'/0/5" \ --name LEE \ --total-supply 100000 echo "LEE token created" sleep 15 -LEZ_DEF_ID=$(wallet account id --key-path "m/44'/60'/0'/0/0") -LEE_DEF_ID=$(wallet account id --key-path "m/44'/60'/0'/0/2") +LEZ_DEF_ID=$(wallet account id --key-path "m/44'/60'/0'/0/2") +LEE_DEF_ID=$(wallet account id --key-path "m/44'/60'/0'/0/4") echo "LEZ definition ID: $LEZ_DEF_ID" echo "LEE definition ID: $LEE_DEF_ID" -echo "Keycard path 0 (LEZ definition) state:" -wallet account get --key-path "m/44'/60'/0'/0/0" -echo "Keycard path 1 (LEZ supply) state:" -wallet account get --key-path "m/44'/60'/0'/0/1" -echo "Keycard path 2 (LEE definition) state:" +echo "Keycard path 2 (LEZ definition) state:" wallet account get --key-path "m/44'/60'/0'/0/2" -echo "Keycard path 3 (LEE supply) state:" +echo "Keycard path 3 (LEZ supply) state:" wallet account get --key-path "m/44'/60'/0'/0/3" +echo "Keycard path 4 (LEE definition) state:" +wallet account get --key-path "m/44'/60'/0'/0/4" +echo "Keycard path 5 (LEE supply) state:" +wallet account get --key-path "m/44'/60'/0'/0/5" # ============================================================================= # Initialize token holding accounts @@ -91,16 +91,16 @@ wallet account get --key-path "m/44'/60'/0'/0/3" echo "" echo "=== Initialize token holding accounts ===" -# Keycard path 4: LEZ holding +# Keycard path 6: LEZ holding wallet token init \ --definition-account-id "Public/$LEZ_DEF_ID" \ - --holder-key-path "m/44'/60'/0'/0/4" + --holder-key-path "m/44'/60'/0'/0/6" echo "LEZ holding initialized for keycard path 4" -# Keycard path 5: LEE holding +# Keycard path 7: LEE holding wallet token init \ --definition-account-id "Public/$LEE_DEF_ID" \ - --holder-key-path "m/44'/60'/0'/0/5" + --holder-key-path "m/44'/60'/0'/0/7" echo "LEE holding initialized for keycard path 5" # pub-receiver: public LEZ holding (for token transfer test) @@ -125,116 +125,116 @@ echo "" echo "=== Fund keycard holdings and AMM seed accounts ===" wallet token send \ - --from-key-path "m/44'/60'/0'/0/1" \ - --to-key-path "m/44'/60'/0'/0/4" \ + --from-key-path "m/44'/60'/0'/0/3" \ + --to-key-path "m/44'/60'/0'/0/6" \ --amount 20000 echo "Transferred 20000 LEZ → keycard path 4" wallet token send \ - --from-key-path "m/44'/60'/0'/0/3" \ - --to-key-path "m/44'/60'/0'/0/5" \ + --from-key-path "m/44'/60'/0'/0/5" \ + --to-key-path "m/44'/60'/0'/0/7" \ --amount 20000 echo "Transferred 20000 LEE → keycard path 5" wallet token send \ - --from-key-path "m/44'/60'/0'/0/1" \ + --from-key-path "m/44'/60'/0'/0/3" \ --to-label amm-lez-fund \ --amount 10000 echo "Transferred 10000 LEZ → amm-lez-fund" wallet token send \ - --from-key-path "m/44'/60'/0'/0/3" \ + --from-key-path "m/44'/60'/0'/0/5" \ --to-label amm-lee-fund \ --amount 10000 echo "Transferred 10000 LEE → amm-lee-fund" sleep 15 -echo "Keycard path 4 (LEZ holding) state (balance should be 20000):" -wallet account get --key-path "m/44'/60'/0'/0/4" -echo "Keycard path 5 (LEE holding) state (balance should be 20000):" -wallet account get --key-path "m/44'/60'/0'/0/5" +echo "Keycard path 6 (LEZ holding) state (balance should be 20000):" +wallet account get --key-path "m/44'/60'/0'/0/6" +echo "Keycard path 7 (LEE holding) state (balance should be 20000):" +wallet account get --key-path "m/44'/60'/0'/0/7" echo "amm-lez-fund state (balance should be 10000):" wallet account get --account-label amm-lez-fund echo "amm-lee-fund state (balance should be 10000):" wallet account get --account-label amm-lee-fund # ============================================================================= -# (3) Token transfer: keycard path 4 (LEZ) → public account +# (3) Token transfer: keycard path 6 (LEZ) → public account # ============================================================================= echo "" -echo "=== (3) Token transfer: keycard path 4 → pub-receiver (public) ===" +echo "=== (3) Token transfer: keycard path 6 → pub-receiver (public) ===" wallet token send \ - --from-key-path "m/44'/60'/0'/0/4" \ + --from-key-path "m/44'/60'/0'/0/6" \ --to-label pub-receiver \ --amount 1000 -echo "Transferred 1000 LEZ: keycard path 4 → pub-receiver" +echo "Transferred 1000 LEZ: keycard path 6 → pub-receiver" sleep 15 -echo "Keycard path 4 (LEZ) state (balance should be 19000):" -wallet account get --key-path "m/44'/60'/0'/0/4" +echo "Keycard path 6 (LEZ) state (balance should be 19000):" +wallet account get --key-path "m/44'/60'/0'/0/6" echo "pub-receiver state (balance should be 1000):" wallet account get --account-label pub-receiver # ============================================================================= -# (4) Token transfer: keycard path 4 (LEZ) → private account (shielded) +# (4) Token transfer: keycard path 6 (LEZ) → private account (shielded) # ============================================================================= echo "" -echo "=== (4) Token transfer: keycard path 4 → priv-receiver (private, shielded) ===" +echo "=== (4) Token transfer: keycard path 6 → priv-receiver (private, shielded) ===" PRIV_RECEIVER=$(wallet account new private | grep -o 'Private/[^[:space:]]*' | head -1) echo "Fresh private receiver account: $PRIV_RECEIVER" wallet token send \ - --from-key-path "m/44'/60'/0'/0/4" \ + --from-key-path "m/44'/60'/0'/0/6" \ --to "$PRIV_RECEIVER" \ --amount 500 -echo "Shielded transfer of 500 LEZ: keycard path 4 → $PRIV_RECEIVER" +echo "Shielded transfer of 500 LEZ: keycard path 6 → $PRIV_RECEIVER" wallet account sync-private sleep 15 -echo "Keycard path 4 (LEZ) state (balance should be 18500):" -wallet account get --key-path "m/44'/60'/0'/0/4" +echo "Keycard path 6 (LEZ) state (balance should be 18500):" +wallet account get --key-path "m/44'/60'/0'/0/6" echo "priv-receiver state (balance should be 500):" wallet account get --account-id "$PRIV_RECEIVER" # ============================================================================= -# (5) Token mint with keycard — definition signed by keycard path 0 +# (5) Token mint with keycard — definition signed by keycard path 2 # ============================================================================= echo "" -echo "=== (5) Token mint: keycard def path 0 mints 2000 LEZ to keycard path 4 ===" +echo "=== (5) Token mint: keycard def path 2 mints 2000 LEZ to keycard path 6 ===" wallet token mint \ - --definition-key-path "m/44'/60'/0'/0/0" \ - --holder-key-path "m/44'/60'/0'/0/4" \ + --definition-key-path "m/44'/60'/0'/0/2" \ + --holder-key-path "m/44'/60'/0'/0/6" \ --amount 2000 echo "Minted 2000 LEZ to keycard path 4" sleep 15 -echo "Keycard path 0 (LEZ definition) state (total supply should have increased):" -wallet account get --key-path "m/44'/60'/0'/0/0" -echo "Keycard path 4 (LEZ holding) state (balance should be 20500):" -wallet account get --key-path "m/44'/60'/0'/0/4" +echo "Keycard path 2 (LEZ definition) state (total supply should have increased):" +wallet account get --key-path "m/44'/60'/0'/0/2" +echo "Keycard path 6 (LEZ holding) state (balance should be 20500):" +wallet account get --key-path "m/44'/60'/0'/0/6" # ============================================================================= -# (6) Token burn with keycard — holder is keycard path 4 +# (6) Token burn with keycard — holder is keycard path 6 # ============================================================================= echo "" -echo "=== (6) Token burn: keycard path 4 burns 500 LEZ ===" +echo "=== (6) Token burn: keycard path 6 burns 500 LEZ ===" wallet token burn \ --definition "Public/$LEZ_DEF_ID" \ - --holder-key-path "m/44'/60'/0'/0/4" \ + --holder-key-path "m/44'/60'/0'/0/6" \ --amount 500 echo "Burned 500 LEZ from keycard path 4" sleep 15 -echo "Keycard path 0 (LEZ definition) state (total supply should reflect burn):" -wallet account get --key-path "m/44'/60'/0'/0/0" -echo "Keycard path 4 (LEZ holding) state (balance should be 20000):" -wallet account get --key-path "m/44'/60'/0'/0/4" +echo "Keycard path 2 (LEZ definition) state (total supply should reflect burn):" +wallet account get --key-path "m/44'/60'/0'/0/2" +echo "Keycard path 6 (LEZ holding) state (balance should be 20000):" +wallet account get --key-path "m/44'/60'/0'/0/6" # ============================================================================= # (7) Create AMM pool for LEZ/LEE — without keycard @@ -263,13 +263,13 @@ echo "LP token definition ID: $LP_DEF_ID" # ============================================================================= # (8) Swap tokens owned by keycard accounts -# keycard path 5 (LEE) sells 500 LEE; keycard path 4 (LEZ) receives LEZ +# keycard path 7 (LEE) sells 500 LEE; keycard path 6 (LEZ) receives LEZ # ============================================================================= echo "" -echo "=== (8) Swap: keycard path 5 sells 500 LEE, keycard path 4 receives LEZ ===" +echo "=== (8) Swap: keycard path 7 sells 500 LEE, keycard path 6 receives LEZ ===" wallet amm swap-exact-input \ - --user-holding-a-key-path "m/44'/60'/0'/0/4" \ - --user-holding-b-key-path "m/44'/60'/0'/0/5" \ + --user-holding-a-key-path "m/44'/60'/0'/0/6" \ + --user-holding-b-key-path "m/44'/60'/0'/0/7" \ --amount-in 500 \ --min-amount-out 1 \ --token-definition "$LEE_DEF_ID" @@ -277,32 +277,32 @@ echo "Swap LEE → LEZ complete via keycard" sleep 15 -echo "Keycard path 4 (LEZ holding) state (balance should have increased):" -wallet account get --key-path "m/44'/60'/0'/0/4" -echo "Keycard path 5 (LEE holding) state (balance should have decreased by 500):" -wallet account get --key-path "m/44'/60'/0'/0/5" +echo "Keycard path 6 (LEZ holding) state (balance should have increased):" +wallet account get --key-path "m/44'/60'/0'/0/6" +echo "Keycard path 7 (LEE holding) state (balance should have decreased by 500):" +wallet account get --key-path "m/44'/60'/0'/0/7" # ============================================================================= -# (9) Add liquidity — keycard accounts for holding A (path 4), B (path 5), LP (path 6) +# (9) Add liquidity — keycard accounts for holding A (path 6), B (path 7), LP (path 8) # ============================================================================= echo "" -echo "=== (9) Initialize LP holding (keycard path 6) before add-liquidity ===" +echo "=== (9) Initialize LP holding (keycard path 8) before add-liquidity ===" wallet token init \ --definition-account-id "Public/$LP_DEF_ID" \ - --holder-key-path "m/44'/60'/0'/0/6" -echo "Keycard path 6 (LP holding) initialized" + --holder-key-path "m/44'/60'/0'/0/8" +echo "Keycard path 8 (LP holding) initialized" sleep 15 -echo "Keycard path 6 (LP holding) state (after init):" -wallet account get --key-path "m/44'/60'/0'/0/6" +echo "Keycard path 8 (LP holding) state (after init):" +wallet account get --key-path "m/44'/60'/0'/0/8" echo "" -echo "=== (9) Add liquidity (keycard path 4=LEZ, path 5=LEE, path 6=LP) ===" +echo "=== (9) Add liquidity (keycard path 6=LEZ, path 7=LEE, path 8=LP) ===" wallet amm add-liquidity \ - --user-holding-a-key-path "m/44'/60'/0'/0/4" \ - --user-holding-b-key-path "m/44'/60'/0'/0/5" \ - --user-holding-lp-key-path "m/44'/60'/0'/0/6" \ + --user-holding-a-key-path "m/44'/60'/0'/0/6" \ + --user-holding-b-key-path "m/44'/60'/0'/0/7" \ + --user-holding-lp-key-path "m/44'/60'/0'/0/8" \ --max-amount-a 1000 \ --max-amount-b 1000 \ --min-amount-lp 1 @@ -310,22 +310,22 @@ echo "Add liquidity complete via keycard" sleep 15 -echo "Keycard path 4 (LEZ holding) state (balance should have decreased):" -wallet account get --key-path "m/44'/60'/0'/0/4" -echo "Keycard path 5 (LEE holding) state (balance should have decreased):" -wallet account get --key-path "m/44'/60'/0'/0/5" -echo "Keycard path 6 (LP holding) state (should have received LP tokens):" +echo "Keycard path 6 (LEZ holding) state (balance should have decreased):" wallet account get --key-path "m/44'/60'/0'/0/6" +echo "Keycard path 7 (LEE holding) state (balance should have decreased):" +wallet account get --key-path "m/44'/60'/0'/0/7" +echo "Keycard path 8 (LP holding) state (should have received LP tokens):" +wallet account get --key-path "m/44'/60'/0'/0/8" # ============================================================================= -# (10) Remove liquidity — keycard accounts for holding A (path 4), B (path 5), LP (path 6) +# (10) Remove liquidity — keycard accounts for holding A (path 6), B (path 7), LP (path 8) # ============================================================================= echo "" -echo "=== (10) Remove liquidity (keycard path 4=LEZ, path 5=LEE, path 6=LP) ===" +echo "=== (10) Remove liquidity (keycard path 6=LEZ, path 7=LEE, path 8=LP) ===" wallet amm remove-liquidity \ - --user-holding-a-key-path "m/44'/60'/0'/0/4" \ - --user-holding-b-key-path "m/44'/60'/0'/0/5" \ - --user-holding-lp-key-path "m/44'/60'/0'/0/6" \ + --user-holding-a-key-path "m/44'/60'/0'/0/6" \ + --user-holding-b-key-path "m/44'/60'/0'/0/7" \ + --user-holding-lp-key-path "m/44'/60'/0'/0/8" \ --balance-lp 500 \ --min-amount-a 1 \ --min-amount-b 1 @@ -333,39 +333,39 @@ echo "Remove liquidity complete via keycard" sleep 15 -echo "Keycard path 4 (LEZ holding) state (balance should have increased):" -wallet account get --key-path "m/44'/60'/0'/0/4" -echo "Keycard path 5 (LEE holding) state (balance should have increased):" -wallet account get --key-path "m/44'/60'/0'/0/5" -echo "Keycard path 6 (LP holding) state (balance should have decreased):" +echo "Keycard path 6 (LEZ holding) state (balance should have increased):" wallet account get --key-path "m/44'/60'/0'/0/6" +echo "Keycard path 7 (LEE holding) state (balance should have increased):" +wallet account get --key-path "m/44'/60'/0'/0/7" +echo "Keycard path 8 (LP holding) state (balance should have decreased):" +wallet account get --key-path "m/44'/60'/0'/0/8" # ============================================================================= -# (11) ATA create — keycard path 7 as owner for LEZ +# (11) ATA create — keycard path 9 as owner for LEZ # ============================================================================= echo "" -echo "=== (11) ATA create: keycard path 7 as owner, LEZ token ===" -ATA_OWNER_ID=$(wallet account id --key-path "m/44'/60'/0'/0/7") -echo "ATA owner (keycard path 7): $ATA_OWNER_ID" +echo "=== (11) ATA create: keycard path 9 as owner, LEZ token ===" +ATA_OWNER_ID=$(wallet account id --key-path "m/44'/60'/0'/0/9") +echo "ATA owner (keycard path 9): $ATA_OWNER_ID" wallet ata create \ - --key-path "m/44'/60'/0'/0/7" \ + --key-path "m/44'/60'/0'/0/9" \ --token-definition "$LEZ_DEF_ID" -echo "ATA created for keycard path 7 / LEZ" +echo "ATA created for keycard path 9 / LEZ" sleep 15 LEZ_ATA_ID=$(wallet ata address --owner "$ATA_OWNER_ID" --token-definition "$LEZ_DEF_ID") -echo "Keycard path 7 LEZ ATA ID: $LEZ_ATA_ID" +echo "Keycard path 9 LEZ ATA ID: $LEZ_ATA_ID" echo "ATA state (should be initialized with zero balance):" wallet account get --account-id "Public/$LEZ_ATA_ID" -# Fund the ATA from LEZ supply (path 1) — setup for tests 12 and 13 +# Fund the ATA from LEZ supply (path 3) — setup for tests 12 and 13 wallet token send \ - --from-key-path "m/44'/60'/0'/0/1" \ + --from-key-path "m/44'/60'/0'/0/3" \ --to "Public/$LEZ_ATA_ID" \ --amount 3000 -echo "Funded keycard path 7 ATA with 3000 LEZ" +echo "Funded keycard path 9 ATA with 3000 LEZ" sleep 15 @@ -391,15 +391,15 @@ echo "pub-receiver ATA state (should be initialized with zero balance):" wallet account get --account-id "Public/$PUB_RECEIVER_ATA_ID" wallet ata send \ - --from-key-path "m/44'/60'/0'/0/7" \ + --from-key-path "m/44'/60'/0'/0/9" \ --token-definition "$LEZ_DEF_ID" \ --to "$PUB_RECEIVER_ATA_ID" \ --amount 500 -echo "Sent 500 LEZ: keycard path 7 ATA → pub-receiver ATA" +echo "Sent 500 LEZ: keycard path 9 ATA → pub-receiver ATA" sleep 15 -echo "Keycard path 7 ATA state (balance should be 2500):" +echo "Keycard path 9 ATA state (balance should be 2500):" wallet account get --account-id "Public/$LEZ_ATA_ID" echo "pub-receiver ATA state (balance should be 500):" wallet account get --account-id "Public/$PUB_RECEIVER_ATA_ID" @@ -410,17 +410,17 @@ wallet account get --account-id "Public/$PUB_RECEIVER_ATA_ID" echo "" echo "=== (13) ATA burn: keycard path 7's ATA burns 200 LEZ ===" wallet ata burn \ - --key-path "m/44'/60'/0'/0/7" \ + --key-path "m/44'/60'/0'/0/9" \ --token-definition "$LEZ_DEF_ID" \ --amount 200 -echo "Burned 200 LEZ from keycard path 7 ATA" +echo "Burned 200 LEZ from keycard path 9 ATA" sleep 15 -echo "Keycard path 7 ATA state (balance should be 2300):" +echo "Keycard path 9 ATA state (balance should be 2300):" wallet account get --account-id "Public/$LEZ_ATA_ID" echo "LEZ definition state (total supply should reflect burn):" -wallet account get --key-path "m/44'/60'/0'/0/0" +wallet account get --key-path "m/44'/60'/0'/0/2" echo "" echo "=== All keycard token + AMM + ATA tests finished ==="