Files
cdk/justfile
thesimplekid f4c857c3e7 Nutshell wallet (#695)
* chore: Add nutshell wallet integration test script

feat: Add MINT_URL configuration for docker container in nutshell wallet integration test script

chore: Make nutshell_wallet_itest.sh executable

fix: Update MINT_URL to use host.docker.internal for Docker container access

feat: Add Docker container startup for Cashu daemon in wallet integration test script

chore: Update Docker image to use Docker Hub repository

feat: Add cleanup trap to stop Docker container and unset variables

feat: Add initial test stub for nutshell wallet mint functionality

test: Add Cashu wallet mint integration test

feat: Add just command for nutshell wallet integration test

refactor: Organize imports and improve code formatting in nutshell wallet test

fix: Update Cashu Docker image and test URL for correct container access

fix: Update Docker container name and image for Cashu wallet test script

fix: Handle Docker container name conflict in nutshell wallet integration test

fix: Update Docker image to cashubtc/nutshell:latest in wallet integration test script

feat: Add support for running separate Nutshell mint and wallet containers

feat: Update Nutshell mint and wallet container configurations for integration testing

fix: Update wallet port and container configuration in integration test script

chore: Export MINT_URL and WALLET_URL as environment variables

fix: Update invoice creation and state checking in nutshell wallet test

fix: Update MINT_URL to use host.docker.internal for container access

fix: Update nutshell wallet mint test to handle invoice payment state

refactor: Improve Nutshell wallet test with better error handling and robustness

refactor: Improve code formatting and logging in nutshell wallet test

refactor: Replace anyhow with expect for error handling in Nutshell wallet test

refactor: Simplify error handling in Nutshell wallet mint test

refactor: Replace `?` with `expect()` in Nutshell wallet test

refactor: Simplify nutshell wallet test by removing unused code and improving error handling

refactor: Extract minting and balance helper functions in nutshell wallet test

feat: Add test for Nutshell wallet token swap functionality

fix: Trim quotes from token in nutshell wallet swap test

refactor: Remove debug print statements and improve code readability

refactor: Improve test_nutshell_wallet_melt with payment state checking and balance verification

refactor: Update Nutshell wallet integration test script configuration

feat: Extract common mint startup function into shared script

refactor: Simplify nutshell wallet integration test script and improve startup process

feat: Add mintd process termination and test status capture in integration test script

refactor: Capitalize env vars and ensure comprehensive cleanup in trap

feat: nutshell wallet test

* ci: Add test step for Nutshell wallet integration tests

* ci: Split Nutshell integration tests into separate jobs

* feat: nutshell wallet test

* ci: Add Docker setup and increase timeout for Nutshell wallet integration tests

* chore: Improve Nutshell wallet integration test script robustness

* fix: Remove -i flag from Nix develop and improve Docker accessibility check

* fix: payment processor

* fix: wallet tests

* feat: Add integration shell with Docker and Rust stable for testing

* ci: Simplify Nutshell wallet integration test workflow and script

* fix: Improve mintd endpoint detection and error handling in integration test script

* fix: wallet tests
2025-03-30 13:08:00 +01:00

226 lines
4.4 KiB
Makefile

alias b := build
alias c := check
alias t := test
default:
@just --list
final-check: typos format clippy test
# run `cargo build` on everything
build *ARGS="--workspace --all-targets":
#!/usr/bin/env bash
set -euo pipefail
if [ ! -f Cargo.toml ]; then
cd {{invocation_directory()}}
fi
cargo build {{ARGS}}
# run `cargo check` on everything
check *ARGS="--workspace --all-targets":
#!/usr/bin/env bash
set -euo pipefail
if [ ! -f Cargo.toml ]; then
cd {{invocation_directory()}}
fi
cargo check {{ARGS}}
# run code formatters
format:
#!/usr/bin/env bash
set -euo pipefail
if [ ! -f Cargo.toml ]; then
cd {{invocation_directory()}}
fi
cargo fmt --all
nixpkgs-fmt $(echo **.nix)
# run doc tests
test: build
#!/usr/bin/env bash
set -euo pipefail
if [ ! -f Cargo.toml ]; then
cd {{invocation_directory()}}
fi
cargo test --lib
# Run pure integration tests
cargo test -p cdk-integration-tests --test mint
# run doc tests
test-pure db="memory": build
#!/usr/bin/env bash
set -euo pipefail
if [ ! -f Cargo.toml ]; then
cd {{invocation_directory()}}
fi
# Run pure integration tests
CDK_TEST_DB_TYPE={{db}} cargo test -p cdk-integration-tests --test integration_tests_pure
test-all db="memory":
#!/usr/bin/env bash
just test {{db}}
./misc/itests.sh "{{db}}"
./misc/fake_itests.sh "{{db}}"
test-nutshell:
#!/usr/bin/env bash
export CDK_TEST_MINT_URL=http://127.0.0.1:3338
export LN_BACKEND=FAKEWALLET
cargo test -p cdk-integration-tests --test happy_path_mint_wallet
unset CDK_TEST_MINT_URL
unset LN_BACKEND
# run `cargo clippy` on everything
clippy *ARGS="--locked --offline --workspace --all-targets":
cargo clippy {{ARGS}}
# run `cargo clippy --fix` on everything
clippy-fix *ARGS="--locked --offline --workspace --all-targets":
cargo clippy {{ARGS}} --fix
typos:
typos
# fix all typos
[no-exit-message]
typos-fix:
just typos -w
itest db:
#!/usr/bin/env bash
./misc/itests.sh "{{db}}"
fake-mint-itest db:
#!/usr/bin/env bash
./misc/fake_itests.sh "{{db}}"
itest-payment-processor ln:
#!/usr/bin/env bash
./misc/mintd_payment_processor.sh "{{ln}}"
fake-auth-mint-itest db openid_discovery:
#!/usr/bin/env bash
./misc/fake_auth_itests.sh "{{db}}" "{{openid_discovery}}"
nutshell-wallet-itest:
#!/usr/bin/env bash
./misc/nutshell_wallet_itest.sh
run-examples:
cargo r --example p2pk
cargo r --example mint-token
cargo r --example melt-token
cargo r --example proof_selection
cargo r --example wallet
check-wasm *ARGS="--target wasm32-unknown-unknown":
#!/usr/bin/env bash
set -euo pipefail
if [ ! -f Cargo.toml ]; then
cd {{invocation_directory()}}
fi
buildargs=(
"-p cdk"
"-p cdk --no-default-features"
"-p cdk --no-default-features --features wallet"
"-p cdk --no-default-features --features mint"
)
for arg in "${buildargs[@]}"; do
echo "Checking '$arg'"
cargo check $arg {{ARGS}}
echo
done
release m="":
#!/usr/bin/env bash
set -euo pipefail
args=(
"-p cashu"
"-p cdk-common"
"-p cdk-sqlite"
"-p cdk-redb"
"-p cdk"
"-p cdk-rexie"
"-p cdk-axum"
"-p cdk-mint-rpc"
"-p cdk-cln"
"-p cdk-lnd"
"-p cdk-lnbits"
"-p cdk-fake-wallet"
"-p cdk-payment-processor"
"-p cdk-cli"
"-p cdk-mintd"
)
for arg in "${args[@]}";
do
echo "Publishing '$arg'"
cargo publish $arg {{m}}
echo
done
check-docs:
#!/usr/bin/env bash
set -euo pipefail
args=(
"-p cashu"
"-p cdk-common"
"-p cdk"
"-p cdk-redb"
"-p cdk-sqlite"
"-p cdk-axum"
"-p cdk-rexie"
"-p cdk-cln"
"-p cdk-lnd"
"-p cdk-lnbits"
"-p cdk-fake-wallet"
"-p cdk-mint-rpc"
"-p cdk-cli"
"-p cdk-mintd"
)
for arg in "${args[@]}"; do
echo "Checking '$arg' docs"
cargo doc $arg --all-features
echo
done
# Build docs for all crates and error on warnings
docs-strict:
#!/usr/bin/env bash
set -euo pipefail
args=(
"-p cashu"
"-p cdk-common"
"-p cdk"
"-p cdk-redb"
"-p cdk-sqlite"
"-p cdk-axum"
"-p cdk-rexie"
"-p cdk-cln"
"-p cdk-lnd"
"-p cdk-lnbits"
"-p cdk-fake-wallet"
"-p cdk-mint-rpc"
"-p cdk-payment-processor"
"-p cdk-cli"
"-p cdk-mintd"
)
for arg in "${args[@]}"; do
echo "Building docs for $arg with strict warnings"
RUSTDOCFLAGS="-D warnings" cargo doc $arg --all-features --no-deps
echo
done