diff --git a/.gitignore b/.gitignore index 0015a5476..0c249bd8e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -/target +target/ Cargo.lock .idea *.dylib @@ -7,3 +7,4 @@ Cargo.lock __pycache__ build .vscode +.kotlin diff --git a/bindings/go/examples/full/README.md b/bindings/go/examples/full/README.md new file mode 100644 index 000000000..aec7406e9 --- /dev/null +++ b/bindings/go/examples/full/README.md @@ -0,0 +1,7 @@ +```bash +go get github.com/iotaledger/iota-sdk-go +``` + +```bash +go run main.go +``` diff --git a/bindings/go/examples/full/main.go b/bindings/go/examples/full/main.go new file mode 100644 index 000000000..4f2bb93c8 --- /dev/null +++ b/bindings/go/examples/full/main.go @@ -0,0 +1,18 @@ +package main + +import ( + "fmt" + "log" + + "github.com/iotaledger/iota-sdk-go" +) + +func main() { + client := iota_sdk.GraphQlClientNewDevnet() + + chainID, err := client.ChainId() + if err.(*iota_sdk.SdkFfiError) != nil { + log.Fatalf("Failed to get chain ID: %v", err) + } + fmt.Println("Chain ID:", chainID) +} \ No newline at end of file diff --git a/bindings/kotlin/examples/full/README.md b/bindings/kotlin/examples/full/README.md new file mode 100644 index 000000000..acdebd9cc --- /dev/null +++ b/bindings/kotlin/examples/full/README.md @@ -0,0 +1,5 @@ +Full project example using the released package. + +```bash +gradle run +``` diff --git a/bindings/kotlin/examples/full/build.gradle.kts b/bindings/kotlin/examples/full/build.gradle.kts new file mode 100644 index 000000000..7fcfe7b88 --- /dev/null +++ b/bindings/kotlin/examples/full/build.gradle.kts @@ -0,0 +1,19 @@ +plugins { + kotlin("jvm") version "2.2.20" + application +} + +group = "com.example" + +version = "1.0-SNAPSHOT" + +repositories { mavenCentral() } + +dependencies { + implementation("org.iota:iota-sdk:0.0.1-alpha.2") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0") +} + +kotlin { jvmToolchain(21) } + +application { mainClass.set("MainKt") } diff --git a/bindings/kotlin/examples/full/settings.gradle.kts b/bindings/kotlin/examples/full/settings.gradle.kts new file mode 100644 index 000000000..7af2cc835 --- /dev/null +++ b/bindings/kotlin/examples/full/settings.gradle.kts @@ -0,0 +1 @@ +rootProject.name = "kotlintest" diff --git a/bindings/kotlin/examples/full/src/main/kotlin/Main.kt b/bindings/kotlin/examples/full/src/main/kotlin/Main.kt new file mode 100644 index 000000000..b6abbc726 --- /dev/null +++ b/bindings/kotlin/examples/full/src/main/kotlin/Main.kt @@ -0,0 +1,13 @@ +import iota_sdk.GraphQlClient +import kotlinx.coroutines.runBlocking + +fun main() = runBlocking { + try { + val client = GraphQlClient.newDevnet() + val chainId = client.chainId() + println("Chain ID: $chainId") + } catch (e: Exception) { + e.printStackTrace() + kotlin.system.exitProcess(1) + } +} diff --git a/bindings/python/examples/full/README.md b/bindings/python/examples/full/README.md new file mode 100644 index 000000000..4bb37fcf5 --- /dev/null +++ b/bindings/python/examples/full/README.md @@ -0,0 +1,14 @@ +Full project example using the released package. + +To set up the environment: + +```bash +uv venv +uv pip install -r requirements.txt +``` + +Then run: + +```bash +uv run python example.py +``` diff --git a/bindings/python/examples/full/example.py b/bindings/python/examples/full/example.py new file mode 100644 index 000000000..51c95dcd0 --- /dev/null +++ b/bindings/python/examples/full/example.py @@ -0,0 +1,17 @@ +# Copyright (c) 2025 IOTA Stiftung +# SPDX-License-Identifier: Apache-2.0 + +from iota_sdk import * + +import asyncio + + +async def main(): + client = GraphQlClient.new_devnet() + + chain_id = await client.chain_id() + print("Chain ID:", chain_id) + + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/bindings/python/examples/full/requirements.txt b/bindings/python/examples/full/requirements.txt new file mode 100644 index 000000000..fdd6af948 --- /dev/null +++ b/bindings/python/examples/full/requirements.txt @@ -0,0 +1,2 @@ +--index-url https://test.pypi.org/simple/ +iota-sdk==3.0.0a1.dev7 diff --git a/crates/iota-sdk/examples/full/Cargo.toml b/crates/iota-sdk/examples/full/Cargo.toml new file mode 100644 index 000000000..555b1eeef --- /dev/null +++ b/crates/iota-sdk/examples/full/Cargo.toml @@ -0,0 +1,9 @@ +[workspace] +[package] +name = "full" +version = "0.1.0" +edition = "2024" + +[dependencies] +iota-sdk = "=3.0.0-alpha.1" +tokio = "1.40.0" diff --git a/crates/iota-sdk/examples/full/src/main.rs b/crates/iota-sdk/examples/full/src/main.rs new file mode 100644 index 000000000..12d97d22f --- /dev/null +++ b/crates/iota-sdk/examples/full/src/main.rs @@ -0,0 +1,11 @@ +use iota_sdk::graphql_client::{Client, error::Result}; + +#[tokio::main] +async fn main() -> Result<()> { + let client = Client::new_devnet(); + + let chain_id = client.chain_id().await?; + println!("Chain ID: {chain_id}"); + + Ok(()) +}