diff --git a/README.md b/README.md index ed0a1f4..767c6a3 100644 --- a/README.md +++ b/README.md @@ -331,6 +331,15 @@ stellar contract invoke --id $CONTRACT_ID --source-account --network local -- get_version ``` +#### `ping` + +Health check endpoint. Returns the current ledger timestamp (u64). + +```bash +stellar contract invoke --id $CONTRACT_ID --source-account --network local \ + -- ping +``` + #### `upgrade` Upgrades the contract WASM in-place. Admin only. Existing storage and contract address are preserved. diff --git a/contracts/payment-processing-contract/src/test.rs b/contracts/payment-processing-contract/src/test.rs index 976ff48..bba9bf7 100644 --- a/contracts/payment-processing-contract/src/test.rs +++ b/contracts/payment-processing-contract/src/test.rs @@ -131,6 +131,15 @@ fn test_get_version_after_set_admin() { assert_eq!(client.get_version(), 1); } +#[test] +fn test_ping() { + let (env, client) = setup(); + env.ledger().with_mut(|li| { + li.timestamp = 12345; + }); + assert_eq!(client.ping(), 12345); +} + // ── Merchant tests ──────────────────────────────────────────────────────────── #[test]