From d03a06921b67d16d81a40ed8c93294e958f729d2 Mon Sep 17 00:00:00 2001 From: Christian Rogobete Date: Fri, 10 Jul 2026 20:16:50 +0200 Subject: [PATCH] Add kmp stub to contract bindings The kmp subcommand mirrors the python, java, flutter, swift, and php stubs: binding generation is not implemented in the CLI and the error points at the external stellar-contract-bindings tool. FULL_HELP_DOCS.md carries the regenerated entries. --- FULL_HELP_DOCS.md | 7 +++++++ .../src/commands/contract/bindings.rs | 8 ++++++++ .../src/commands/contract/bindings/kmp.rs | 19 +++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 cmd/soroban-cli/src/commands/contract/bindings/kmp.rs diff --git a/FULL_HELP_DOCS.md b/FULL_HELP_DOCS.md index fe72570534..aa2f6660b8 100644 --- a/FULL_HELP_DOCS.md +++ b/FULL_HELP_DOCS.md @@ -278,6 +278,7 @@ Generate code client bindings for a contract - `flutter` — Generate Flutter bindings - `swift` — Generate Swift bindings - `php` — Generate PHP bindings +- `kmp` — Generate Kotlin Multiplatform bindings ## `stellar contract bindings rust` @@ -344,6 +345,12 @@ Generate PHP bindings **Usage:** `stellar contract bindings php` +## `stellar contract bindings kmp` + +Generate Kotlin Multiplatform bindings + +**Usage:** `stellar contract bindings kmp` + ## `stellar contract build` Build a contract from source diff --git a/cmd/soroban-cli/src/commands/contract/bindings.rs b/cmd/soroban-cli/src/commands/contract/bindings.rs index 15617fa3e0..95c9696718 100644 --- a/cmd/soroban-cli/src/commands/contract/bindings.rs +++ b/cmd/soroban-cli/src/commands/contract/bindings.rs @@ -1,5 +1,6 @@ pub mod flutter; pub mod java; +pub mod kmp; pub mod php; pub mod python; pub mod rust; @@ -28,6 +29,9 @@ pub enum Cmd { /// Generate PHP bindings Php(php::Cmd), + + /// Generate Kotlin Multiplatform bindings + Kmp(kmp::Cmd), } #[derive(thiserror::Error, Debug)] @@ -52,6 +56,9 @@ pub enum Error { #[error(transparent)] Php(#[from] php::Error), + + #[error(transparent)] + Kmp(#[from] kmp::Error), } impl Cmd { @@ -64,6 +71,7 @@ impl Cmd { Cmd::Flutter(flutter) => flutter.run()?, Cmd::Swift(swift) => swift.run()?, Cmd::Php(php) => php.run()?, + Cmd::Kmp(kmp) => kmp.run()?, } Ok(()) } diff --git a/cmd/soroban-cli/src/commands/contract/bindings/kmp.rs b/cmd/soroban-cli/src/commands/contract/bindings/kmp.rs new file mode 100644 index 0000000000..a9d80fe82e --- /dev/null +++ b/cmd/soroban-cli/src/commands/contract/bindings/kmp.rs @@ -0,0 +1,19 @@ +use std::fmt::Debug; + +use clap::Parser; + +#[derive(Parser, Debug, Clone)] +#[group(skip)] +pub struct Cmd {} + +#[derive(thiserror::Error, Debug)] +pub enum Error { + #[error("kmp binding generation is not implemented in the stellar-cli, but is available via the tool located here: https://github.com/lightsail-network/stellar-contract-bindings")] + NotImplemented, +} + +impl Cmd { + pub fn run(&self) -> Result<(), Error> { + Err(Error::NotImplemented) + } +}