The programs in crates/kuatia/examples/ need no setup. quickstart runs on
the in-memory store, so it needs no feature and no database. The other programs
open a real SQLite database in memory through Ledger::connect, which the
sqlite feature re-exports:
cargo run -p kuatia --example quickstart
cargo run -p kuatia --features sqlite --example create_accounts
cargo run -p kuatia --features sqlite --example fund_and_trade
cargo run -p kuatia --features sqlite --example withdraw
cargo run -p kuatia --features sqlite --example overdraft
cargo run -p kuatia --features sqlite --example inflight_hold
cargo run -p kuatia --features sqlite --example escrow
The book includes them below from source, so it shows the code that cargo test
compiles.
Register an asset, open two accounts, fund one account and pay the other. This is the same source as the quick example in the top-level README, and a test holds it in place there.
{{#include ../../crates/kuatia/examples/quickstart.rs}}
{{#include ../../crates/kuatia/examples/create_accounts.rs}}
A deposit into two accounts, then a cross-asset trade that settles as one transfer. Each asset conserves on its own, so a swap needs no special verb.
{{#include ../../crates/kuatia/examples/fund_and_trade.rs}}
{{#include ../../crates/kuatia/examples/withdraw.rs}}
A shortfall becomes a negative posting on an account that permits one. On an
account that does not permit one it becomes InsufficientFunds. The
overdraft chapter describes both.
{{#include ../../crates/kuatia/examples/overdraft.rs}}
Authorize, confirm and void through a per-destination holding subaccount; see inflight holds.
{{#include ../../crates/kuatia/examples/inflight_hold.rs}}
The Pending states chapter explains this one.
{{#include ../../crates/kuatia/examples/escrow.rs}}