diff --git a/.gitignore b/.gitignore
index dfe009ff..336a11a9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,5 +7,15 @@ node_modules/
.dmypy.json
.build
.bin/
+.vscode/
.DS_Store
+*.idea
wheelhouse/
+
+# Android/Kotlin
+.gradle/
+build/
+*.iml
+local.properties
+gradle-wrapper.jar
+*.so
diff --git a/README.md b/README.md
index dfbe10a9..a6619755 100644
--- a/README.md
+++ b/README.md
@@ -30,6 +30,12 @@ The exported interfaces should be purely functional without any state owned by R
## Contributing
+## Build Scripts
+
+`cargo pkg` will run the build script. For example: `cargo pkg transact kt` builds `algokit_transact` for `kotlin`.
+
+The scripts are defined in [tools/build_pkgs] for each language.
+
### Learning Resources
If you are new to Rust or UniFFI, check out the [learning resources document](./docs/contributing/learning_resources.md)
diff --git a/packages/android/algokit_transact/.gitignore b/packages/android/algokit_transact/.gitignore
new file mode 100644
index 00000000..58696bd6
--- /dev/null
+++ b/packages/android/algokit_transact/.gitignore
@@ -0,0 +1,17 @@
+*.iml
+.gradle
+**/local.properties
+**/.idea/caches
+**/.idea/libraries
+**/.idea/misc.xml
+**/.idea/modules.xml
+**/.idea/workspace.xml
+**/.idea/navEditor.xml
+**/.idea/assetWizardSettings.xml
+.DS_Store
+**/build
+**/captures
+.externalNativeBuild
+.cxx
+local.properties
+
diff --git a/packages/android/algokit_transact/app/.gitignore b/packages/android/algokit_transact/app/.gitignore
new file mode 100644
index 00000000..42afabfd
--- /dev/null
+++ b/packages/android/algokit_transact/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/packages/android/algokit_transact/app/build.gradle.kts b/packages/android/algokit_transact/app/build.gradle.kts
new file mode 100644
index 00000000..91e7cfdb
--- /dev/null
+++ b/packages/android/algokit_transact/app/build.gradle.kts
@@ -0,0 +1,75 @@
+plugins {
+ alias(libs.plugins.android.application)
+ alias(libs.plugins.kotlin.android)
+ alias(libs.plugins.compose.compiler)
+}
+
+android {
+ namespace = "com.example.algokit_transact"
+ compileSdk = 36
+
+ defaultConfig {
+ applicationId = "com.example.algokit_transact"
+ minSdk = 28
+ targetSdk = 36
+ versionCode = 1
+ versionName = "1.0"
+
+ testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
+ vectorDrawables {
+ useSupportLibrary = true
+ }
+ }
+
+ buildTypes {
+ release {
+ isMinifyEnabled = false
+ proguardFiles(
+ getDefaultProguardFile("proguard-android-optimize.txt"),
+ "proguard-rules.pro"
+ )
+ }
+ }
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_21
+ targetCompatibility = JavaVersion.VERSION_21
+ }
+ kotlinOptions {
+ jvmTarget = "21"
+ }
+ buildFeatures {
+ compose = true
+ }
+ composeOptions {
+ kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
+ }
+ packaging {
+ resources {
+ excludes += "/META-INF/{AL2.0,LGPL2.1}"
+ }
+ }
+}
+
+dependencies {
+ // implementation(project(":transact"))
+ implementation("com.example.transact:algo-transact-ffi:0.0.1")
+ implementation(libs.androidx.core.ktx)
+ implementation(libs.androidx.appcompat)
+ implementation(libs.material)
+
+ // Compose dependencies
+ implementation(platform(libs.androidx.compose.bom))
+ implementation(libs.androidx.compose.ui)
+ implementation(libs.androidx.compose.ui.graphics)
+ implementation(libs.androidx.compose.ui.tooling.preview)
+ implementation(libs.androidx.compose.material3)
+ implementation(libs.androidx.activity.compose)
+ implementation(libs.androidx.lifecycle.runtime.compose)
+ debugImplementation(libs.androidx.compose.ui.tooling)
+
+ testImplementation(libs.junit)
+ androidTestImplementation(libs.androidx.junit)
+ androidTestImplementation(libs.androidx.espresso.core)
+ androidTestImplementation(platform(libs.androidx.compose.bom))
+ androidTestImplementation(libs.androidx.compose.ui.test.junit4)
+}
\ No newline at end of file
diff --git a/packages/android/algokit_transact/app/proguard-rules.pro b/packages/android/algokit_transact/app/proguard-rules.pro
new file mode 100644
index 00000000..481bb434
--- /dev/null
+++ b/packages/android/algokit_transact/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/packages/android/algokit_transact/app/src/androidTest/kotlin/com/example/algokit_transact/ExampleInstrumentedTest.kt b/packages/android/algokit_transact/app/src/androidTest/kotlin/com/example/algokit_transact/ExampleInstrumentedTest.kt
new file mode 100644
index 00000000..ad1d4415
--- /dev/null
+++ b/packages/android/algokit_transact/app/src/androidTest/kotlin/com/example/algokit_transact/ExampleInstrumentedTest.kt
@@ -0,0 +1,24 @@
+package com.example.algokit_transact
+
+import androidx.test.platform.app.InstrumentationRegistry
+import androidx.test.ext.junit.runners.AndroidJUnit4
+
+import org.junit.Test
+import org.junit.runner.RunWith
+
+import org.junit.Assert.*
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+@RunWith(AndroidJUnit4::class)
+class ExampleInstrumentedTest {
+ @Test
+ fun useAppContext() {
+ // Context of the app under test.
+ val appContext = InstrumentationRegistry.getInstrumentation().targetContext
+ assertEquals("com.example.algokit_transact", appContext.packageName)
+ }
+}
\ No newline at end of file
diff --git a/packages/android/algokit_transact/app/src/main/AndroidManifest.xml b/packages/android/algokit_transact/app/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..93949a97
--- /dev/null
+++ b/packages/android/algokit_transact/app/src/main/AndroidManifest.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packages/android/algokit_transact/app/src/main/kotlin/com.example.algokit_transact/MainActivity.kt b/packages/android/algokit_transact/app/src/main/kotlin/com.example.algokit_transact/MainActivity.kt
new file mode 100644
index 00000000..1acdfd7f
--- /dev/null
+++ b/packages/android/algokit_transact/app/src/main/kotlin/com.example.algokit_transact/MainActivity.kt
@@ -0,0 +1,74 @@
+package com.example.algokit_transact
+
+import android.os.Bundle
+import androidx.activity.ComponentActivity
+import androidx.activity.compose.setContent
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Surface
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.tooling.preview.Preview
+import com.example.transact.TransactApi
+
+class MainActivity : ComponentActivity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContent {
+ HelloWorldTheme {
+ // A surface container using the 'background' color from the theme
+ Surface(
+ modifier = Modifier.fillMaxSize(),
+ color = MaterialTheme.colorScheme.background
+ ) {
+ val address = TransactApi()
+ .createAddressFromString("YVRRLLVBX54N44WG4EZJWPXXA6RROAU5TLHB4XHCMZFVZBVCB6KSDWDSEQ")
+ Greeting(address.address)
+ }
+ }
+ }
+ }
+}
+
+@Composable
+fun Greeting(name: String, modifier: Modifier = Modifier) {
+ Box(
+ modifier = Modifier.fillMaxSize(),
+ contentAlignment = Alignment.Center
+ ) {
+ Text(
+ text = "Hello $name!",
+ modifier = modifier,
+ style = MaterialTheme.typography.headlineMedium
+ )
+ }
+}
+
+@Composable
+fun HelloWorldTheme(
+ darkTheme: Boolean = false,
+ content: @Composable () -> Unit
+) {
+ val colorScheme = when {
+ darkTheme -> MaterialTheme.colorScheme.copy(
+ surface = MaterialTheme.colorScheme.surfaceVariant
+ )
+ else -> MaterialTheme.colorScheme
+ }
+ MaterialTheme(
+ colorScheme = colorScheme,
+ typography = MaterialTheme.typography,
+ content = content
+ )
+}
+
+@Preview(showBackground = true)
+@Composable
+fun GreetingPreview() {
+ HelloWorldTheme {
+ Greeting("Android")
+ }
+}
\ No newline at end of file
diff --git a/packages/android/algokit_transact/app/src/main/res/drawable/ic_launcher_background.xml b/packages/android/algokit_transact/app/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644
index 00000000..07d5da9c
--- /dev/null
+++ b/packages/android/algokit_transact/app/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,170 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/android/algokit_transact/app/src/main/res/drawable/ic_launcher_foreground.xml b/packages/android/algokit_transact/app/src/main/res/drawable/ic_launcher_foreground.xml
new file mode 100644
index 00000000..2b068d11
--- /dev/null
+++ b/packages/android/algokit_transact/app/src/main/res/drawable/ic_launcher_foreground.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packages/android/algokit_transact/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/packages/android/algokit_transact/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 00000000..6f3b755b
--- /dev/null
+++ b/packages/android/algokit_transact/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packages/android/algokit_transact/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/packages/android/algokit_transact/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644
index 00000000..6f3b755b
--- /dev/null
+++ b/packages/android/algokit_transact/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packages/android/algokit_transact/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/packages/android/algokit_transact/app/src/main/res/mipmap-hdpi/ic_launcher.webp
new file mode 100644
index 00000000..c209e78e
Binary files /dev/null and b/packages/android/algokit_transact/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ
diff --git a/packages/android/algokit_transact/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/packages/android/algokit_transact/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
new file mode 100644
index 00000000..b2dfe3d1
Binary files /dev/null and b/packages/android/algokit_transact/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ
diff --git a/packages/android/algokit_transact/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/packages/android/algokit_transact/app/src/main/res/mipmap-mdpi/ic_launcher.webp
new file mode 100644
index 00000000..4f0f1d64
Binary files /dev/null and b/packages/android/algokit_transact/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ
diff --git a/packages/android/algokit_transact/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/packages/android/algokit_transact/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
new file mode 100644
index 00000000..62b611da
Binary files /dev/null and b/packages/android/algokit_transact/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ
diff --git a/packages/android/algokit_transact/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/packages/android/algokit_transact/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
new file mode 100644
index 00000000..948a3070
Binary files /dev/null and b/packages/android/algokit_transact/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ
diff --git a/packages/android/algokit_transact/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/packages/android/algokit_transact/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
new file mode 100644
index 00000000..1b9a6956
Binary files /dev/null and b/packages/android/algokit_transact/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ
diff --git a/packages/android/algokit_transact/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/packages/android/algokit_transact/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
new file mode 100644
index 00000000..28d4b77f
Binary files /dev/null and b/packages/android/algokit_transact/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ
diff --git a/packages/android/algokit_transact/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/packages/android/algokit_transact/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
new file mode 100644
index 00000000..9287f508
Binary files /dev/null and b/packages/android/algokit_transact/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ
diff --git a/packages/android/algokit_transact/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/packages/android/algokit_transact/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
new file mode 100644
index 00000000..aa7d6427
Binary files /dev/null and b/packages/android/algokit_transact/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ
diff --git a/packages/android/algokit_transact/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/packages/android/algokit_transact/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
new file mode 100644
index 00000000..9126ae37
Binary files /dev/null and b/packages/android/algokit_transact/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ
diff --git a/packages/android/algokit_transact/app/src/main/res/values-night/themes.xml b/packages/android/algokit_transact/app/src/main/res/values-night/themes.xml
new file mode 100644
index 00000000..d099a13f
--- /dev/null
+++ b/packages/android/algokit_transact/app/src/main/res/values-night/themes.xml
@@ -0,0 +1,16 @@
+
+
+
+
\ No newline at end of file
diff --git a/packages/android/algokit_transact/app/src/main/res/values/colors.xml b/packages/android/algokit_transact/app/src/main/res/values/colors.xml
new file mode 100644
index 00000000..f8c6127d
--- /dev/null
+++ b/packages/android/algokit_transact/app/src/main/res/values/colors.xml
@@ -0,0 +1,10 @@
+
+
+ #FFBB86FC
+ #FF6200EE
+ #FF3700B3
+ #FF03DAC5
+ #FF018786
+ #FF000000
+ #FFFFFFFF
+
\ No newline at end of file
diff --git a/packages/android/algokit_transact/app/src/main/res/values/strings.xml b/packages/android/algokit_transact/app/src/main/res/values/strings.xml
new file mode 100644
index 00000000..10b59518
--- /dev/null
+++ b/packages/android/algokit_transact/app/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ algokit_transact
+
\ No newline at end of file
diff --git a/packages/android/algokit_transact/app/src/main/res/values/themes.xml b/packages/android/algokit_transact/app/src/main/res/values/themes.xml
new file mode 100644
index 00000000..617f5e9b
--- /dev/null
+++ b/packages/android/algokit_transact/app/src/main/res/values/themes.xml
@@ -0,0 +1,16 @@
+
+
+
+
\ No newline at end of file
diff --git a/packages/android/algokit_transact/app/src/main/res/xml/backup_rules.xml b/packages/android/algokit_transact/app/src/main/res/xml/backup_rules.xml
new file mode 100644
index 00000000..4df92558
--- /dev/null
+++ b/packages/android/algokit_transact/app/src/main/res/xml/backup_rules.xml
@@ -0,0 +1,13 @@
+
+
+
+
\ No newline at end of file
diff --git a/packages/android/algokit_transact/app/src/main/res/xml/data_extraction_rules.xml b/packages/android/algokit_transact/app/src/main/res/xml/data_extraction_rules.xml
new file mode 100644
index 00000000..9ee9997b
--- /dev/null
+++ b/packages/android/algokit_transact/app/src/main/res/xml/data_extraction_rules.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packages/android/algokit_transact/app/src/test/kotlin/com/example/algokit_transact/ExampleUnitTest.kt b/packages/android/algokit_transact/app/src/test/kotlin/com/example/algokit_transact/ExampleUnitTest.kt
new file mode 100644
index 00000000..9aad49b4
--- /dev/null
+++ b/packages/android/algokit_transact/app/src/test/kotlin/com/example/algokit_transact/ExampleUnitTest.kt
@@ -0,0 +1,17 @@
+package com.example.algokit_transact
+
+import org.junit.Test
+
+import org.junit.Assert.*
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+class ExampleUnitTest {
+ @Test
+ fun addition_isCorrect() {
+ assertEquals(4, 2 + 2)
+ }
+}
\ No newline at end of file
diff --git a/packages/android/algokit_transact/build.gradle.kts b/packages/android/algokit_transact/build.gradle.kts
new file mode 100644
index 00000000..a81b2692
--- /dev/null
+++ b/packages/android/algokit_transact/build.gradle.kts
@@ -0,0 +1,7 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+plugins {
+ alias(libs.plugins.android.application) apply false
+ alias(libs.plugins.kotlin.android) apply false
+ alias(libs.plugins.android.library) apply false
+ alias(libs.plugins.compose.compiler) apply false
+}
\ No newline at end of file
diff --git a/packages/android/algokit_transact/gradle.properties b/packages/android/algokit_transact/gradle.properties
new file mode 100644
index 00000000..20e2a015
--- /dev/null
+++ b/packages/android/algokit_transact/gradle.properties
@@ -0,0 +1,23 @@
+# Project-wide Gradle settings.
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. For more details, visit
+# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
+# org.gradle.parallel=true
+# AndroidX package structure to make it clearer which packages are bundled with the
+# Android operating system, and which are packaged with your app's APK
+# https://developer.android.com/topic/libraries/support-library/androidx-rn
+android.useAndroidX=true
+# Kotlin code style for this project: "official" or "obsolete":
+kotlin.code.style=official
+# Enables namespacing of each library's R class so that its R class includes only the
+# resources declared in the library itself and none from the library's dependencies,
+# thereby reducing the size of the R class for that library
+android.nonTransitiveRClass=true
\ No newline at end of file
diff --git a/packages/android/algokit_transact/gradle/libs.versions.toml b/packages/android/algokit_transact/gradle/libs.versions.toml
new file mode 100644
index 00000000..d6623e52
--- /dev/null
+++ b/packages/android/algokit_transact/gradle/libs.versions.toml
@@ -0,0 +1,41 @@
+[versions]
+agp = "8.10.0"
+kotlin = "2.0.21"
+coreKtx = "1.16.0"
+junit = "4.13.2"
+junitVersion = "1.2.1"
+espressoCore = "3.6.1"
+appcompat = "1.7.0"
+kotlinxCoroutinesCore = "1.10.2"
+material = "1.12.0"
+compose-bom = "2025.05.00"
+compose-compiler = "2.0.21"
+activity-compose = "1.10.1"
+lifecycle-runtime-compose = "2.9.0"
+
+[libraries]
+androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
+junit = { group = "junit", name = "junit", version.ref = "junit" }
+androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
+androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
+androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
+kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxCoroutinesCore" }
+material = { group = "com.google.android.material", name = "material", version.ref = "material" }
+
+# Compose dependencies
+androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "compose-bom" }
+androidx-compose-ui = { group = "androidx.compose.ui", name = "ui" }
+androidx-compose-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
+androidx-compose-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
+androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3" }
+androidx-compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
+androidx-compose-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
+androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activity-compose" }
+androidx-lifecycle-runtime-compose = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "lifecycle-runtime-compose" }
+
+[plugins]
+android-application = { id = "com.android.application", version.ref = "agp" }
+android-library = { id = "com.android.library", version.ref = "agp" }
+kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
+compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
+
diff --git a/packages/android/algokit_transact/gradle/wrapper/gradle-wrapper.properties b/packages/android/algokit_transact/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 00000000..64dc02e6
--- /dev/null
+++ b/packages/android/algokit_transact/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Wed May 07 17:07:13 EDT 2025
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/packages/android/algokit_transact/gradlew b/packages/android/algokit_transact/gradlew
new file mode 100755
index 00000000..4f906e0c
--- /dev/null
+++ b/packages/android/algokit_transact/gradlew
@@ -0,0 +1,185 @@
+#!/usr/bin/env sh
+
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=`expr $i + 1`
+ done
+ case $i in
+ 0) set -- ;;
+ 1) set -- "$args0" ;;
+ 2) set -- "$args0" "$args1" ;;
+ 3) set -- "$args0" "$args1" "$args2" ;;
+ 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=`save "$@"`
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+exec "$JAVACMD" "$@"
diff --git a/packages/android/algokit_transact/gradlew.bat b/packages/android/algokit_transact/gradlew.bat
new file mode 100644
index 00000000..ac1b06f9
--- /dev/null
+++ b/packages/android/algokit_transact/gradlew.bat
@@ -0,0 +1,89 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/packages/android/algokit_transact/settings.gradle.kts b/packages/android/algokit_transact/settings.gradle.kts
new file mode 100644
index 00000000..b1201a84
--- /dev/null
+++ b/packages/android/algokit_transact/settings.gradle.kts
@@ -0,0 +1,26 @@
+pluginManagement {
+ repositories {
+ google {
+ content {
+ includeGroupByRegex("com\\.android.*")
+ includeGroupByRegex("com\\.google.*")
+ includeGroupByRegex("androidx.*")
+ }
+ }
+ mavenCentral()
+ gradlePluginPortal()
+ }
+}
+dependencyResolutionManagement {
+ repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+ repositories {
+ mavenLocal()
+ google()
+ mavenCentral()
+ }
+}
+
+rootProject.name = "algokit_transact"
+include(":app")
+include(":transact")
+
\ No newline at end of file
diff --git a/packages/android/algokit_transact/transact/.gitignore b/packages/android/algokit_transact/transact/.gitignore
new file mode 100644
index 00000000..42afabfd
--- /dev/null
+++ b/packages/android/algokit_transact/transact/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/packages/android/algokit_transact/transact/build.gradle.kts b/packages/android/algokit_transact/transact/build.gradle.kts
new file mode 100644
index 00000000..6371cd3a
--- /dev/null
+++ b/packages/android/algokit_transact/transact/build.gradle.kts
@@ -0,0 +1,68 @@
+plugins {
+ alias(libs.plugins.android.library)
+ alias(libs.plugins.kotlin.android)
+ `maven-publish`
+}
+
+android {
+ namespace = "com.example.transact"
+ compileSdk = 36
+ ndkVersion = "29.0.13113456"
+
+ defaultConfig {
+ minSdk = 28
+ ndk {
+ abiFilters += listOf("arm64-v8a", "armeabi-v7a", "x86_64")
+ }
+ testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
+ consumerProguardFiles("consumer-rules.pro")
+ }
+
+ buildTypes {
+ release {
+ isMinifyEnabled = false
+ proguardFiles(
+ getDefaultProguardFile("proguard-android-optimize.txt"),
+ "proguard-rules.pro"
+ )
+ }
+ }
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_21
+ targetCompatibility = JavaVersion.VERSION_21
+ }
+ kotlinOptions {
+ jvmTarget = "21"
+ }
+ publishing {
+ singleVariant("release") {
+ withSourcesJar()
+ withJavadocJar()
+ }
+ }
+}
+
+dependencies {
+ implementation("net.java.dev.jna:jna:5.17.0@aar")
+ implementation(libs.kotlinx.coroutines.core)
+ implementation(libs.androidx.core.ktx)
+ implementation(libs.androidx.appcompat)
+ implementation(libs.material)
+ testImplementation(libs.junit)
+ androidTestImplementation(libs.androidx.junit)
+ androidTestImplementation(libs.androidx.espresso.core)
+}
+
+publishing {
+ publications {
+ register("release") {
+ groupId = "com.example.transact"
+ artifactId = "algo-transact-ffi"
+ version = "0.0.1"
+
+ afterEvaluate {
+ from(components["release"])
+ }
+ }
+ }
+}
diff --git a/packages/android/algokit_transact/transact/consumer-rules.pro b/packages/android/algokit_transact/transact/consumer-rules.pro
new file mode 100644
index 00000000..e69de29b
diff --git a/packages/android/algokit_transact/transact/proguard-rules.pro b/packages/android/algokit_transact/transact/proguard-rules.pro
new file mode 100644
index 00000000..481bb434
--- /dev/null
+++ b/packages/android/algokit_transact/transact/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/packages/android/algokit_transact/transact/src/androidTest/kotlin/com/example/transact/ExampleInstrumentedTest.kt b/packages/android/algokit_transact/transact/src/androidTest/kotlin/com/example/transact/ExampleInstrumentedTest.kt
new file mode 100644
index 00000000..afd2e8a2
--- /dev/null
+++ b/packages/android/algokit_transact/transact/src/androidTest/kotlin/com/example/transact/ExampleInstrumentedTest.kt
@@ -0,0 +1,24 @@
+package com.example.transact
+
+import androidx.test.platform.app.InstrumentationRegistry
+import androidx.test.ext.junit.runners.AndroidJUnit4
+
+import org.junit.Test
+import org.junit.runner.RunWith
+
+import org.junit.Assert.*
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+@RunWith(AndroidJUnit4::class)
+class ExampleInstrumentedTest {
+ @Test
+ fun useAppContext() {
+ // Context of the app under test.
+ val appContext = InstrumentationRegistry.getInstrumentation().targetContext
+ assertEquals("com.example.transact.test", appContext.packageName)
+ }
+}
\ No newline at end of file
diff --git a/packages/android/algokit_transact/transact/src/main/AndroidManifest.xml b/packages/android/algokit_transact/transact/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..a5918e68
--- /dev/null
+++ b/packages/android/algokit_transact/transact/src/main/AndroidManifest.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/packages/android/algokit_transact/transact/src/main/kotlin/com/example/transact/TransactApi.kt b/packages/android/algokit_transact/transact/src/main/kotlin/com/example/transact/TransactApi.kt
new file mode 100644
index 00000000..e690e0f4
--- /dev/null
+++ b/packages/android/algokit_transact/transact/src/main/kotlin/com/example/transact/TransactApi.kt
@@ -0,0 +1,31 @@
+package com.example.transact
+
+import uniffi.algokit_transact_ffi.*
+
+class TransactApi {
+ companion object {
+ init {
+ try {
+ System.loadLibrary("algokit_transact_ffi")
+ } catch (e: UnsatisfiedLinkError) {
+ throw RuntimeException("Failed to load native library: ${e.message}", e)
+ }
+ }
+ }
+
+ fun createAddressFromPubKey(pubKey: ByteArray): Address {
+ return addressFromPubKey(pubKey)
+ }
+
+ fun createAddressFromString(address: String): Address {
+ return addressFromString(address)
+ }
+
+ fun encodeTransaction(transaction: Transaction): ByteArray {
+ return encodeTransaction(transaction)
+ }
+
+ fun decodeTransaction(bytes: ByteArray): Transaction {
+ return decodeTransaction(bytes)
+ }
+}
diff --git a/packages/android/algokit_transact/transact/src/main/kotlin/uniffi/algokit_transact_ffi/algokit_transact_ffi.kt b/packages/android/algokit_transact/transact/src/main/kotlin/uniffi/algokit_transact_ffi/algokit_transact_ffi.kt
new file mode 100644
index 00000000..c2dd4a2e
--- /dev/null
+++ b/packages/android/algokit_transact/transact/src/main/kotlin/uniffi/algokit_transact_ffi/algokit_transact_ffi.kt
@@ -0,0 +1,2976 @@
+// This file was autogenerated by some hot garbage in the `uniffi` crate.
+// Trust me, you don't want to mess with it!
+
+@file:Suppress("NAME_SHADOWING")
+
+package uniffi.algokit_transact_ffi
+
+// Common helper code.
+//
+// Ideally this would live in a separate .kt file where it can be unittested etc
+// in isolation, and perhaps even published as a re-useable package.
+//
+// However, it's important that the details of how this helper code works (e.g. the
+// way that different builtin types are passed across the FFI) exactly match what's
+// expected by the Rust code on the other side of the interface. In practice right
+// now that means coming from the exact some version of `uniffi` that was used to
+// compile the Rust component. The easiest way to ensure this is to bundle the Kotlin
+// helpers directly inline like we're doing here.
+
+import com.sun.jna.Library
+import com.sun.jna.IntegerType
+import com.sun.jna.Native
+import com.sun.jna.Pointer
+import com.sun.jna.Structure
+import com.sun.jna.Callback
+import com.sun.jna.ptr.*
+import java.nio.ByteBuffer
+import java.nio.ByteOrder
+import java.nio.CharBuffer
+import java.nio.charset.CodingErrorAction
+import java.util.concurrent.atomic.AtomicLong
+import java.util.concurrent.ConcurrentHashMap
+
+// This is a helper for safely working with byte buffers returned from the Rust code.
+// A rust-owned buffer is represented by its capacity, its current length, and a
+// pointer to the underlying data.
+
+/**
+ * @suppress
+ */
+@Structure.FieldOrder("capacity", "len", "data")
+open class RustBuffer : Structure() {
+ // Note: `capacity` and `len` are actually `ULong` values, but JVM only supports signed values.
+ // When dealing with these fields, make sure to call `toULong()`.
+ @JvmField var capacity: Long = 0
+ @JvmField var len: Long = 0
+ @JvmField var data: Pointer? = null
+
+ class ByValue: RustBuffer(), Structure.ByValue
+ class ByReference: RustBuffer(), Structure.ByReference
+
+ internal fun setValue(other: RustBuffer) {
+ capacity = other.capacity
+ len = other.len
+ data = other.data
+ }
+
+ companion object {
+ internal fun alloc(size: ULong = 0UL) = uniffiRustCall() { status ->
+ // Note: need to convert the size to a `Long` value to make this work with JVM.
+ UniffiLib.INSTANCE.ffi_algokit_transact_ffi_rustbuffer_alloc(size.toLong(), status)
+ }.also {
+ if(it.data == null) {
+ throw RuntimeException("RustBuffer.alloc() returned null data pointer (size=${size})")
+ }
+ }
+
+ internal fun create(capacity: ULong, len: ULong, data: Pointer?): RustBuffer.ByValue {
+ var buf = RustBuffer.ByValue()
+ buf.capacity = capacity.toLong()
+ buf.len = len.toLong()
+ buf.data = data
+ return buf
+ }
+
+ internal fun free(buf: RustBuffer.ByValue) = uniffiRustCall() { status ->
+ UniffiLib.INSTANCE.ffi_algokit_transact_ffi_rustbuffer_free(buf, status)
+ }
+ }
+
+ @Suppress("TooGenericExceptionThrown")
+ fun asByteBuffer() =
+ this.data?.getByteBuffer(0, this.len.toLong())?.also {
+ it.order(ByteOrder.BIG_ENDIAN)
+ }
+}
+
+/**
+ * The equivalent of the `*mut RustBuffer` type.
+ * Required for callbacks taking in an out pointer.
+ *
+ * Size is the sum of all values in the struct.
+ *
+ * @suppress
+ */
+class RustBufferByReference : ByReference(16) {
+ /**
+ * Set the pointed-to `RustBuffer` to the given value.
+ */
+ fun setValue(value: RustBuffer.ByValue) {
+ // NOTE: The offsets are as they are in the C-like struct.
+ val pointer = getPointer()
+ pointer.setLong(0, value.capacity)
+ pointer.setLong(8, value.len)
+ pointer.setPointer(16, value.data)
+ }
+
+ /**
+ * Get a `RustBuffer.ByValue` from this reference.
+ */
+ fun getValue(): RustBuffer.ByValue {
+ val pointer = getPointer()
+ val value = RustBuffer.ByValue()
+ value.writeField("capacity", pointer.getLong(0))
+ value.writeField("len", pointer.getLong(8))
+ value.writeField("data", pointer.getLong(16))
+
+ return value
+ }
+}
+
+// This is a helper for safely passing byte references into the rust code.
+// It's not actually used at the moment, because there aren't many things that you
+// can take a direct pointer to in the JVM, and if we're going to copy something
+// then we might as well copy it into a `RustBuffer`. But it's here for API
+// completeness.
+
+@Structure.FieldOrder("len", "data")
+internal open class ForeignBytes : Structure() {
+ @JvmField var len: Int = 0
+ @JvmField var data: Pointer? = null
+
+ class ByValue : ForeignBytes(), Structure.ByValue
+}
+/**
+ * The FfiConverter interface handles converter types to and from the FFI
+ *
+ * All implementing objects should be public to support external types. When a
+ * type is external we need to import it's FfiConverter.
+ *
+ * @suppress
+ */
+public interface FfiConverter {
+ // Convert an FFI type to a Kotlin type
+ fun lift(value: FfiType): KotlinType
+
+ // Convert an Kotlin type to an FFI type
+ fun lower(value: KotlinType): FfiType
+
+ // Read a Kotlin type from a `ByteBuffer`
+ fun read(buf: ByteBuffer): KotlinType
+
+ // Calculate bytes to allocate when creating a `RustBuffer`
+ //
+ // This must return at least as many bytes as the write() function will
+ // write. It can return more bytes than needed, for example when writing
+ // Strings we can't know the exact bytes needed until we the UTF-8
+ // encoding, so we pessimistically allocate the largest size possible (3
+ // bytes per codepoint). Allocating extra bytes is not really a big deal
+ // because the `RustBuffer` is short-lived.
+ fun allocationSize(value: KotlinType): ULong
+
+ // Write a Kotlin type to a `ByteBuffer`
+ fun write(value: KotlinType, buf: ByteBuffer)
+
+ // Lower a value into a `RustBuffer`
+ //
+ // This method lowers a value into a `RustBuffer` rather than the normal
+ // FfiType. It's used by the callback interface code. Callback interface
+ // returns are always serialized into a `RustBuffer` regardless of their
+ // normal FFI type.
+ fun lowerIntoRustBuffer(value: KotlinType): RustBuffer.ByValue {
+ val rbuf = RustBuffer.alloc(allocationSize(value))
+ try {
+ val bbuf = rbuf.data!!.getByteBuffer(0, rbuf.capacity).also {
+ it.order(ByteOrder.BIG_ENDIAN)
+ }
+ write(value, bbuf)
+ rbuf.writeField("len", bbuf.position().toLong())
+ return rbuf
+ } catch (e: Throwable) {
+ RustBuffer.free(rbuf)
+ throw e
+ }
+ }
+
+ // Lift a value from a `RustBuffer`.
+ //
+ // This here mostly because of the symmetry with `lowerIntoRustBuffer()`.
+ // It's currently only used by the `FfiConverterRustBuffer` class below.
+ fun liftFromRustBuffer(rbuf: RustBuffer.ByValue): KotlinType {
+ val byteBuf = rbuf.asByteBuffer()!!
+ try {
+ val item = read(byteBuf)
+ if (byteBuf.hasRemaining()) {
+ throw RuntimeException("junk remaining in buffer after lifting, something is very wrong!!")
+ }
+ return item
+ } finally {
+ RustBuffer.free(rbuf)
+ }
+ }
+}
+
+/**
+ * FfiConverter that uses `RustBuffer` as the FfiType
+ *
+ * @suppress
+ */
+public interface FfiConverterRustBuffer: FfiConverter {
+ override fun lift(value: RustBuffer.ByValue) = liftFromRustBuffer(value)
+ override fun lower(value: KotlinType) = lowerIntoRustBuffer(value)
+}
+// A handful of classes and functions to support the generated data structures.
+// This would be a good candidate for isolating in its own ffi-support lib.
+
+internal const val UNIFFI_CALL_SUCCESS = 0.toByte()
+internal const val UNIFFI_CALL_ERROR = 1.toByte()
+internal const val UNIFFI_CALL_UNEXPECTED_ERROR = 2.toByte()
+
+@Structure.FieldOrder("code", "error_buf")
+internal open class UniffiRustCallStatus : Structure() {
+ @JvmField var code: Byte = 0
+ @JvmField var error_buf: RustBuffer.ByValue = RustBuffer.ByValue()
+
+ class ByValue: UniffiRustCallStatus(), Structure.ByValue
+
+ fun isSuccess(): Boolean {
+ return code == UNIFFI_CALL_SUCCESS
+ }
+
+ fun isError(): Boolean {
+ return code == UNIFFI_CALL_ERROR
+ }
+
+ fun isPanic(): Boolean {
+ return code == UNIFFI_CALL_UNEXPECTED_ERROR
+ }
+
+ companion object {
+ fun create(code: Byte, errorBuf: RustBuffer.ByValue): UniffiRustCallStatus.ByValue {
+ val callStatus = UniffiRustCallStatus.ByValue()
+ callStatus.code = code
+ callStatus.error_buf = errorBuf
+ return callStatus
+ }
+ }
+}
+
+class InternalException(message: String) : kotlin.Exception(message)
+
+/**
+ * Each top-level error class has a companion object that can lift the error from the call status's rust buffer
+ *
+ * @suppress
+ */
+interface UniffiRustCallStatusErrorHandler {
+ fun lift(error_buf: RustBuffer.ByValue): E;
+}
+
+// Helpers for calling Rust
+// In practice we usually need to be synchronized to call this safely, so it doesn't
+// synchronize itself
+
+// Call a rust function that returns a Result<>. Pass in the Error class companion that corresponds to the Err
+private inline fun uniffiRustCallWithError(errorHandler: UniffiRustCallStatusErrorHandler, callback: (UniffiRustCallStatus) -> U): U {
+ var status = UniffiRustCallStatus()
+ val return_value = callback(status)
+ uniffiCheckCallStatus(errorHandler, status)
+ return return_value
+}
+
+// Check UniffiRustCallStatus and throw an error if the call wasn't successful
+private fun uniffiCheckCallStatus(errorHandler: UniffiRustCallStatusErrorHandler, status: UniffiRustCallStatus) {
+ if (status.isSuccess()) {
+ return
+ } else if (status.isError()) {
+ throw errorHandler.lift(status.error_buf)
+ } else if (status.isPanic()) {
+ // when the rust code sees a panic, it tries to construct a rustbuffer
+ // with the message. but if that code panics, then it just sends back
+ // an empty buffer.
+ if (status.error_buf.len > 0) {
+ throw InternalException(FfiConverterString.lift(status.error_buf))
+ } else {
+ throw InternalException("Rust panic")
+ }
+ } else {
+ throw InternalException("Unknown rust call status: $status.code")
+ }
+}
+
+/**
+ * UniffiRustCallStatusErrorHandler implementation for times when we don't expect a CALL_ERROR
+ *
+ * @suppress
+ */
+object UniffiNullRustCallStatusErrorHandler: UniffiRustCallStatusErrorHandler {
+ override fun lift(error_buf: RustBuffer.ByValue): InternalException {
+ RustBuffer.free(error_buf)
+ return InternalException("Unexpected CALL_ERROR")
+ }
+}
+
+// Call a rust function that returns a plain value
+private inline fun uniffiRustCall(callback: (UniffiRustCallStatus) -> U): U {
+ return uniffiRustCallWithError(UniffiNullRustCallStatusErrorHandler, callback)
+}
+
+internal inline fun uniffiTraitInterfaceCall(
+ callStatus: UniffiRustCallStatus,
+ makeCall: () -> T,
+ writeReturn: (T) -> Unit,
+) {
+ try {
+ writeReturn(makeCall())
+ } catch(e: kotlin.Exception) {
+ callStatus.code = UNIFFI_CALL_UNEXPECTED_ERROR
+ callStatus.error_buf = FfiConverterString.lower(e.toString())
+ }
+}
+
+internal inline fun uniffiTraitInterfaceCallWithError(
+ callStatus: UniffiRustCallStatus,
+ makeCall: () -> T,
+ writeReturn: (T) -> Unit,
+ lowerError: (E) -> RustBuffer.ByValue
+) {
+ try {
+ writeReturn(makeCall())
+ } catch(e: kotlin.Exception) {
+ if (e is E) {
+ callStatus.code = UNIFFI_CALL_ERROR
+ callStatus.error_buf = lowerError(e)
+ } else {
+ callStatus.code = UNIFFI_CALL_UNEXPECTED_ERROR
+ callStatus.error_buf = FfiConverterString.lower(e.toString())
+ }
+ }
+}
+// Map handles to objects
+//
+// This is used pass an opaque 64-bit handle representing a foreign object to the Rust code.
+internal class UniffiHandleMap {
+ private val map = ConcurrentHashMap()
+ private val counter = java.util.concurrent.atomic.AtomicLong(0)
+
+ val size: Int
+ get() = map.size
+
+ // Insert a new object into the handle map and get a handle for it
+ fun insert(obj: T): Long {
+ val handle = counter.getAndAdd(1)
+ map.put(handle, obj)
+ return handle
+ }
+
+ // Get an object from the handle map
+ fun get(handle: Long): T {
+ return map.get(handle) ?: throw InternalException("UniffiHandleMap.get: Invalid handle")
+ }
+
+ // Remove an entry from the handlemap and get the Kotlin object back
+ fun remove(handle: Long): T {
+ return map.remove(handle) ?: throw InternalException("UniffiHandleMap: Invalid handle")
+ }
+}
+
+// Contains loading, initialization code,
+// and the FFI Function declarations in a com.sun.jna.Library.
+@Synchronized
+private fun findLibraryName(componentName: String): String {
+ val libOverride = System.getProperty("uniffi.component.$componentName.libraryOverride")
+ if (libOverride != null) {
+ return libOverride
+ }
+ return "algokit_transact_ffi"
+}
+
+private inline fun loadIndirect(
+ componentName: String
+): Lib {
+ return Native.load(findLibraryName(componentName), Lib::class.java)
+}
+
+// Define FFI callback types
+internal interface UniffiRustFutureContinuationCallback : com.sun.jna.Callback {
+ fun callback(`data`: Long,`pollResult`: Byte,)
+}
+internal interface UniffiForeignFutureFree : com.sun.jna.Callback {
+ fun callback(`handle`: Long,)
+}
+internal interface UniffiCallbackInterfaceFree : com.sun.jna.Callback {
+ fun callback(`handle`: Long,)
+}
+@Structure.FieldOrder("handle", "free")
+internal open class UniffiForeignFuture(
+ @JvmField internal var `handle`: Long = 0.toLong(),
+ @JvmField internal var `free`: UniffiForeignFutureFree? = null,
+) : Structure() {
+ class UniffiByValue(
+ `handle`: Long = 0.toLong(),
+ `free`: UniffiForeignFutureFree? = null,
+ ): UniffiForeignFuture(`handle`,`free`,), Structure.ByValue
+
+ internal fun uniffiSetValue(other: UniffiForeignFuture) {
+ `handle` = other.`handle`
+ `free` = other.`free`
+ }
+
+}
+@Structure.FieldOrder("returnValue", "callStatus")
+internal open class UniffiForeignFutureStructU8(
+ @JvmField internal var `returnValue`: Byte = 0.toByte(),
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
+) : Structure() {
+ class UniffiByValue(
+ `returnValue`: Byte = 0.toByte(),
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
+ ): UniffiForeignFutureStructU8(`returnValue`,`callStatus`,), Structure.ByValue
+
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructU8) {
+ `returnValue` = other.`returnValue`
+ `callStatus` = other.`callStatus`
+ }
+
+}
+internal interface UniffiForeignFutureCompleteU8 : com.sun.jna.Callback {
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructU8.UniffiByValue,)
+}
+@Structure.FieldOrder("returnValue", "callStatus")
+internal open class UniffiForeignFutureStructI8(
+ @JvmField internal var `returnValue`: Byte = 0.toByte(),
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
+) : Structure() {
+ class UniffiByValue(
+ `returnValue`: Byte = 0.toByte(),
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
+ ): UniffiForeignFutureStructI8(`returnValue`,`callStatus`,), Structure.ByValue
+
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructI8) {
+ `returnValue` = other.`returnValue`
+ `callStatus` = other.`callStatus`
+ }
+
+}
+internal interface UniffiForeignFutureCompleteI8 : com.sun.jna.Callback {
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructI8.UniffiByValue,)
+}
+@Structure.FieldOrder("returnValue", "callStatus")
+internal open class UniffiForeignFutureStructU16(
+ @JvmField internal var `returnValue`: Short = 0.toShort(),
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
+) : Structure() {
+ class UniffiByValue(
+ `returnValue`: Short = 0.toShort(),
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
+ ): UniffiForeignFutureStructU16(`returnValue`,`callStatus`,), Structure.ByValue
+
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructU16) {
+ `returnValue` = other.`returnValue`
+ `callStatus` = other.`callStatus`
+ }
+
+}
+internal interface UniffiForeignFutureCompleteU16 : com.sun.jna.Callback {
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructU16.UniffiByValue,)
+}
+@Structure.FieldOrder("returnValue", "callStatus")
+internal open class UniffiForeignFutureStructI16(
+ @JvmField internal var `returnValue`: Short = 0.toShort(),
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
+) : Structure() {
+ class UniffiByValue(
+ `returnValue`: Short = 0.toShort(),
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
+ ): UniffiForeignFutureStructI16(`returnValue`,`callStatus`,), Structure.ByValue
+
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructI16) {
+ `returnValue` = other.`returnValue`
+ `callStatus` = other.`callStatus`
+ }
+
+}
+internal interface UniffiForeignFutureCompleteI16 : com.sun.jna.Callback {
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructI16.UniffiByValue,)
+}
+@Structure.FieldOrder("returnValue", "callStatus")
+internal open class UniffiForeignFutureStructU32(
+ @JvmField internal var `returnValue`: Int = 0,
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
+) : Structure() {
+ class UniffiByValue(
+ `returnValue`: Int = 0,
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
+ ): UniffiForeignFutureStructU32(`returnValue`,`callStatus`,), Structure.ByValue
+
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructU32) {
+ `returnValue` = other.`returnValue`
+ `callStatus` = other.`callStatus`
+ }
+
+}
+internal interface UniffiForeignFutureCompleteU32 : com.sun.jna.Callback {
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructU32.UniffiByValue,)
+}
+@Structure.FieldOrder("returnValue", "callStatus")
+internal open class UniffiForeignFutureStructI32(
+ @JvmField internal var `returnValue`: Int = 0,
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
+) : Structure() {
+ class UniffiByValue(
+ `returnValue`: Int = 0,
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
+ ): UniffiForeignFutureStructI32(`returnValue`,`callStatus`,), Structure.ByValue
+
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructI32) {
+ `returnValue` = other.`returnValue`
+ `callStatus` = other.`callStatus`
+ }
+
+}
+internal interface UniffiForeignFutureCompleteI32 : com.sun.jna.Callback {
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructI32.UniffiByValue,)
+}
+@Structure.FieldOrder("returnValue", "callStatus")
+internal open class UniffiForeignFutureStructU64(
+ @JvmField internal var `returnValue`: Long = 0.toLong(),
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
+) : Structure() {
+ class UniffiByValue(
+ `returnValue`: Long = 0.toLong(),
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
+ ): UniffiForeignFutureStructU64(`returnValue`,`callStatus`,), Structure.ByValue
+
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructU64) {
+ `returnValue` = other.`returnValue`
+ `callStatus` = other.`callStatus`
+ }
+
+}
+internal interface UniffiForeignFutureCompleteU64 : com.sun.jna.Callback {
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructU64.UniffiByValue,)
+}
+@Structure.FieldOrder("returnValue", "callStatus")
+internal open class UniffiForeignFutureStructI64(
+ @JvmField internal var `returnValue`: Long = 0.toLong(),
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
+) : Structure() {
+ class UniffiByValue(
+ `returnValue`: Long = 0.toLong(),
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
+ ): UniffiForeignFutureStructI64(`returnValue`,`callStatus`,), Structure.ByValue
+
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructI64) {
+ `returnValue` = other.`returnValue`
+ `callStatus` = other.`callStatus`
+ }
+
+}
+internal interface UniffiForeignFutureCompleteI64 : com.sun.jna.Callback {
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructI64.UniffiByValue,)
+}
+@Structure.FieldOrder("returnValue", "callStatus")
+internal open class UniffiForeignFutureStructF32(
+ @JvmField internal var `returnValue`: Float = 0.0f,
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
+) : Structure() {
+ class UniffiByValue(
+ `returnValue`: Float = 0.0f,
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
+ ): UniffiForeignFutureStructF32(`returnValue`,`callStatus`,), Structure.ByValue
+
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructF32) {
+ `returnValue` = other.`returnValue`
+ `callStatus` = other.`callStatus`
+ }
+
+}
+internal interface UniffiForeignFutureCompleteF32 : com.sun.jna.Callback {
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructF32.UniffiByValue,)
+}
+@Structure.FieldOrder("returnValue", "callStatus")
+internal open class UniffiForeignFutureStructF64(
+ @JvmField internal var `returnValue`: Double = 0.0,
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
+) : Structure() {
+ class UniffiByValue(
+ `returnValue`: Double = 0.0,
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
+ ): UniffiForeignFutureStructF64(`returnValue`,`callStatus`,), Structure.ByValue
+
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructF64) {
+ `returnValue` = other.`returnValue`
+ `callStatus` = other.`callStatus`
+ }
+
+}
+internal interface UniffiForeignFutureCompleteF64 : com.sun.jna.Callback {
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructF64.UniffiByValue,)
+}
+@Structure.FieldOrder("returnValue", "callStatus")
+internal open class UniffiForeignFutureStructPointer(
+ @JvmField internal var `returnValue`: Pointer = Pointer.NULL,
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
+) : Structure() {
+ class UniffiByValue(
+ `returnValue`: Pointer = Pointer.NULL,
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
+ ): UniffiForeignFutureStructPointer(`returnValue`,`callStatus`,), Structure.ByValue
+
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructPointer) {
+ `returnValue` = other.`returnValue`
+ `callStatus` = other.`callStatus`
+ }
+
+}
+internal interface UniffiForeignFutureCompletePointer : com.sun.jna.Callback {
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructPointer.UniffiByValue,)
+}
+@Structure.FieldOrder("returnValue", "callStatus")
+internal open class UniffiForeignFutureStructRustBuffer(
+ @JvmField internal var `returnValue`: RustBuffer.ByValue = RustBuffer.ByValue(),
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
+) : Structure() {
+ class UniffiByValue(
+ `returnValue`: RustBuffer.ByValue = RustBuffer.ByValue(),
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
+ ): UniffiForeignFutureStructRustBuffer(`returnValue`,`callStatus`,), Structure.ByValue
+
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructRustBuffer) {
+ `returnValue` = other.`returnValue`
+ `callStatus` = other.`callStatus`
+ }
+
+}
+internal interface UniffiForeignFutureCompleteRustBuffer : com.sun.jna.Callback {
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructRustBuffer.UniffiByValue,)
+}
+@Structure.FieldOrder("callStatus")
+internal open class UniffiForeignFutureStructVoid(
+ @JvmField internal var `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
+) : Structure() {
+ class UniffiByValue(
+ `callStatus`: UniffiRustCallStatus.ByValue = UniffiRustCallStatus.ByValue(),
+ ): UniffiForeignFutureStructVoid(`callStatus`,), Structure.ByValue
+
+ internal fun uniffiSetValue(other: UniffiForeignFutureStructVoid) {
+ `callStatus` = other.`callStatus`
+ }
+
+}
+internal interface UniffiForeignFutureCompleteVoid : com.sun.jna.Callback {
+ fun callback(`callbackData`: Long,`result`: UniffiForeignFutureStructVoid.UniffiByValue,)
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+// A JNA Library to expose the extern-C FFI definitions.
+// This is an implementation detail which will be called internally by the public API.
+
+internal interface UniffiLib : Library {
+ companion object {
+ internal val INSTANCE: UniffiLib by lazy {
+ loadIndirect(componentName = "algokit_transact_ffi")
+ .also { lib: UniffiLib ->
+ uniffiCheckContractApiVersion(lib)
+ uniffiCheckApiChecksums(lib)
+ }
+ }
+
+ }
+
+ fun uniffi_algokit_transact_ffi_fn_func_address_from_pub_key(`pubKey`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+ ): RustBuffer.ByValue
+ fun uniffi_algokit_transact_ffi_fn_func_address_from_string(`address`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+ ): RustBuffer.ByValue
+ fun uniffi_algokit_transact_ffi_fn_func_assign_fee(`txn`: RustBuffer.ByValue,`feeParams`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+ ): RustBuffer.ByValue
+ fun uniffi_algokit_transact_ffi_fn_func_decode_base64_msgpack_to_json(`modelType`: RustBuffer.ByValue,`base64Str`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+ ): RustBuffer.ByValue
+ fun uniffi_algokit_transact_ffi_fn_func_decode_msgpack_to_json(`modelType`: RustBuffer.ByValue,`msgpackBytes`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+ ): RustBuffer.ByValue
+ fun uniffi_algokit_transact_ffi_fn_func_decode_signed_transaction(`bytes`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+ ): RustBuffer.ByValue
+ fun uniffi_algokit_transact_ffi_fn_func_decode_signed_transactions(`encodedSignedTxs`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+ ): RustBuffer.ByValue
+ fun uniffi_algokit_transact_ffi_fn_func_decode_transaction(`encodedTx`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+ ): RustBuffer.ByValue
+ fun uniffi_algokit_transact_ffi_fn_func_decode_transactions(`encodedTxs`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+ ): RustBuffer.ByValue
+ fun uniffi_algokit_transact_ffi_fn_func_encode_json_to_base64_msgpack(`modelType`: RustBuffer.ByValue,`jsonStr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+ ): RustBuffer.ByValue
+ fun uniffi_algokit_transact_ffi_fn_func_encode_json_to_msgpack(`modelType`: RustBuffer.ByValue,`jsonStr`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+ ): RustBuffer.ByValue
+ fun uniffi_algokit_transact_ffi_fn_func_encode_signed_transaction(`signedTx`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+ ): RustBuffer.ByValue
+ fun uniffi_algokit_transact_ffi_fn_func_encode_signed_transactions(`signedTxs`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+ ): RustBuffer.ByValue
+ fun uniffi_algokit_transact_ffi_fn_func_encode_transaction(`tx`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+ ): RustBuffer.ByValue
+ fun uniffi_algokit_transact_ffi_fn_func_encode_transaction_raw(`tx`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+ ): RustBuffer.ByValue
+ fun uniffi_algokit_transact_ffi_fn_func_encode_transactions(`txs`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+ ): RustBuffer.ByValue
+ fun uniffi_algokit_transact_ffi_fn_func_estimate_transaction_size(`transaction`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+ ): Long
+ fun uniffi_algokit_transact_ffi_fn_func_get_algorand_constant(`constant`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+ ): Long
+ fun uniffi_algokit_transact_ffi_fn_func_get_encoded_transaction_type(`bytes`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+ ): RustBuffer.ByValue
+ fun uniffi_algokit_transact_ffi_fn_func_get_transaction_id(`tx`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+ ): RustBuffer.ByValue
+ fun uniffi_algokit_transact_ffi_fn_func_get_transaction_id_raw(`tx`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+ ): RustBuffer.ByValue
+ fun uniffi_algokit_transact_ffi_fn_func_group_transactions(`txs`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+ ): RustBuffer.ByValue
+ fun uniffi_algokit_transact_ffi_fn_func_supported_models(uniffi_out_err: UniffiRustCallStatus,
+ ): RustBuffer.ByValue
+ fun ffi_algokit_transact_ffi_rustbuffer_alloc(`size`: Long,uniffi_out_err: UniffiRustCallStatus,
+ ): RustBuffer.ByValue
+ fun ffi_algokit_transact_ffi_rustbuffer_from_bytes(`bytes`: ForeignBytes.ByValue,uniffi_out_err: UniffiRustCallStatus,
+ ): RustBuffer.ByValue
+ fun ffi_algokit_transact_ffi_rustbuffer_free(`buf`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rustbuffer_reserve(`buf`: RustBuffer.ByValue,`additional`: Long,uniffi_out_err: UniffiRustCallStatus,
+ ): RustBuffer.ByValue
+ fun ffi_algokit_transact_ffi_rust_future_poll_u8(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_cancel_u8(`handle`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_free_u8(`handle`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_complete_u8(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
+ ): Byte
+ fun ffi_algokit_transact_ffi_rust_future_poll_i8(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_cancel_i8(`handle`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_free_i8(`handle`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_complete_i8(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
+ ): Byte
+ fun ffi_algokit_transact_ffi_rust_future_poll_u16(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_cancel_u16(`handle`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_free_u16(`handle`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_complete_u16(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
+ ): Short
+ fun ffi_algokit_transact_ffi_rust_future_poll_i16(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_cancel_i16(`handle`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_free_i16(`handle`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_complete_i16(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
+ ): Short
+ fun ffi_algokit_transact_ffi_rust_future_poll_u32(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_cancel_u32(`handle`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_free_u32(`handle`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_complete_u32(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
+ ): Int
+ fun ffi_algokit_transact_ffi_rust_future_poll_i32(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_cancel_i32(`handle`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_free_i32(`handle`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_complete_i32(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
+ ): Int
+ fun ffi_algokit_transact_ffi_rust_future_poll_u64(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_cancel_u64(`handle`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_free_u64(`handle`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_complete_u64(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
+ ): Long
+ fun ffi_algokit_transact_ffi_rust_future_poll_i64(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_cancel_i64(`handle`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_free_i64(`handle`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_complete_i64(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
+ ): Long
+ fun ffi_algokit_transact_ffi_rust_future_poll_f32(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_cancel_f32(`handle`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_free_f32(`handle`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_complete_f32(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
+ ): Float
+ fun ffi_algokit_transact_ffi_rust_future_poll_f64(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_cancel_f64(`handle`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_free_f64(`handle`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_complete_f64(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
+ ): Double
+ fun ffi_algokit_transact_ffi_rust_future_poll_pointer(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_cancel_pointer(`handle`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_free_pointer(`handle`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_complete_pointer(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
+ ): Pointer
+ fun ffi_algokit_transact_ffi_rust_future_poll_rust_buffer(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_cancel_rust_buffer(`handle`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_free_rust_buffer(`handle`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_complete_rust_buffer(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
+ ): RustBuffer.ByValue
+ fun ffi_algokit_transact_ffi_rust_future_poll_void(`handle`: Long,`callback`: UniffiRustFutureContinuationCallback,`callbackData`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_cancel_void(`handle`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_free_void(`handle`: Long,
+ ): Unit
+ fun ffi_algokit_transact_ffi_rust_future_complete_void(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
+ ): Unit
+ fun uniffi_algokit_transact_ffi_checksum_func_address_from_pub_key(
+ ): Short
+ fun uniffi_algokit_transact_ffi_checksum_func_address_from_string(
+ ): Short
+ fun uniffi_algokit_transact_ffi_checksum_func_assign_fee(
+ ): Short
+ fun uniffi_algokit_transact_ffi_checksum_func_decode_base64_msgpack_to_json(
+ ): Short
+ fun uniffi_algokit_transact_ffi_checksum_func_decode_msgpack_to_json(
+ ): Short
+ fun uniffi_algokit_transact_ffi_checksum_func_decode_signed_transaction(
+ ): Short
+ fun uniffi_algokit_transact_ffi_checksum_func_decode_signed_transactions(
+ ): Short
+ fun uniffi_algokit_transact_ffi_checksum_func_decode_transaction(
+ ): Short
+ fun uniffi_algokit_transact_ffi_checksum_func_decode_transactions(
+ ): Short
+ fun uniffi_algokit_transact_ffi_checksum_func_encode_json_to_base64_msgpack(
+ ): Short
+ fun uniffi_algokit_transact_ffi_checksum_func_encode_json_to_msgpack(
+ ): Short
+ fun uniffi_algokit_transact_ffi_checksum_func_encode_signed_transaction(
+ ): Short
+ fun uniffi_algokit_transact_ffi_checksum_func_encode_signed_transactions(
+ ): Short
+ fun uniffi_algokit_transact_ffi_checksum_func_encode_transaction(
+ ): Short
+ fun uniffi_algokit_transact_ffi_checksum_func_encode_transaction_raw(
+ ): Short
+ fun uniffi_algokit_transact_ffi_checksum_func_encode_transactions(
+ ): Short
+ fun uniffi_algokit_transact_ffi_checksum_func_estimate_transaction_size(
+ ): Short
+ fun uniffi_algokit_transact_ffi_checksum_func_get_algorand_constant(
+ ): Short
+ fun uniffi_algokit_transact_ffi_checksum_func_get_encoded_transaction_type(
+ ): Short
+ fun uniffi_algokit_transact_ffi_checksum_func_get_transaction_id(
+ ): Short
+ fun uniffi_algokit_transact_ffi_checksum_func_get_transaction_id_raw(
+ ): Short
+ fun uniffi_algokit_transact_ffi_checksum_func_group_transactions(
+ ): Short
+ fun uniffi_algokit_transact_ffi_checksum_func_supported_models(
+ ): Short
+ fun ffi_algokit_transact_ffi_uniffi_contract_version(
+ ): Int
+
+}
+
+private fun uniffiCheckContractApiVersion(lib: UniffiLib) {
+ // Get the bindings contract version from our ComponentInterface
+ val bindings_contract_version = 26
+ // Get the scaffolding contract version by calling the into the dylib
+ val scaffolding_contract_version = lib.ffi_algokit_transact_ffi_uniffi_contract_version()
+ if (bindings_contract_version != scaffolding_contract_version) {
+ throw RuntimeException("UniFFI contract version mismatch: try cleaning and rebuilding your project")
+ }
+}
+
+@Suppress("UNUSED_PARAMETER")
+private fun uniffiCheckApiChecksums(lib: UniffiLib) {
+ if (lib.uniffi_algokit_transact_ffi_checksum_func_address_from_pub_key() != 65205.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_algokit_transact_ffi_checksum_func_address_from_string() != 56499.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_algokit_transact_ffi_checksum_func_assign_fee() != 10019.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_algokit_transact_ffi_checksum_func_decode_base64_msgpack_to_json() != 38916.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_algokit_transact_ffi_checksum_func_decode_msgpack_to_json() != 8846.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_algokit_transact_ffi_checksum_func_decode_signed_transaction() != 61944.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_algokit_transact_ffi_checksum_func_decode_signed_transactions() != 64807.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_algokit_transact_ffi_checksum_func_decode_transaction() != 56405.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_algokit_transact_ffi_checksum_func_decode_transactions() != 26956.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_algokit_transact_ffi_checksum_func_encode_json_to_base64_msgpack() != 10243.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_algokit_transact_ffi_checksum_func_encode_json_to_msgpack() != 16545.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_algokit_transact_ffi_checksum_func_encode_signed_transaction() != 57498.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_algokit_transact_ffi_checksum_func_encode_signed_transactions() != 52346.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_algokit_transact_ffi_checksum_func_encode_transaction() != 62809.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_algokit_transact_ffi_checksum_func_encode_transaction_raw() != 1774.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_algokit_transact_ffi_checksum_func_encode_transactions() != 64884.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_algokit_transact_ffi_checksum_func_estimate_transaction_size() != 60858.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_algokit_transact_ffi_checksum_func_get_algorand_constant() != 49400.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_algokit_transact_ffi_checksum_func_get_encoded_transaction_type() != 9866.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_algokit_transact_ffi_checksum_func_get_transaction_id() != 20463.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_algokit_transact_ffi_checksum_func_get_transaction_id_raw() != 37098.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_algokit_transact_ffi_checksum_func_group_transactions() != 26081.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+ if (lib.uniffi_algokit_transact_ffi_checksum_func_supported_models() != 57883.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
+}
+
+// Async support
+
+// Public interface members begin here.
+
+
+// Interface implemented by anything that can contain an object reference.
+//
+// Such types expose a `destroy()` method that must be called to cleanly
+// dispose of the contained objects. Failure to call this method may result
+// in memory leaks.
+//
+// The easiest way to ensure this method is called is to use the `.use`
+// helper method to execute a block and destroy the object at the end.
+interface Disposable {
+ fun destroy()
+ companion object {
+ fun destroy(vararg args: Any?) {
+ args.filterIsInstance()
+ .forEach(Disposable::destroy)
+ }
+ }
+}
+
+/**
+ * @suppress
+ */
+inline fun T.use(block: (T) -> R) =
+ try {
+ block(this)
+ } finally {
+ try {
+ // N.B. our implementation is on the nullable type `Disposable?`.
+ this?.destroy()
+ } catch (e: Throwable) {
+ // swallow
+ }
+ }
+
+/**
+ * Used to instantiate an interface without an actual pointer, for fakes in tests, mostly.
+ *
+ * @suppress
+ * */
+object NoPointer
+
+/**
+ * @suppress
+ */
+public object FfiConverterULong: FfiConverter {
+ override fun lift(value: Long): ULong {
+ return value.toULong()
+ }
+
+ override fun read(buf: ByteBuffer): ULong {
+ return lift(buf.getLong())
+ }
+
+ override fun lower(value: ULong): Long {
+ return value.toLong()
+ }
+
+ override fun allocationSize(value: ULong) = 8UL
+
+ override fun write(value: ULong, buf: ByteBuffer) {
+ buf.putLong(value.toLong())
+ }
+}
+
+/**
+ * @suppress
+ */
+public object FfiConverterString: FfiConverter {
+ // Note: we don't inherit from FfiConverterRustBuffer, because we use a
+ // special encoding when lowering/lifting. We can use `RustBuffer.len` to
+ // store our length and avoid writing it out to the buffer.
+ override fun lift(value: RustBuffer.ByValue): String {
+ try {
+ val byteArr = ByteArray(value.len.toInt())
+ value.asByteBuffer()!!.get(byteArr)
+ return byteArr.toString(Charsets.UTF_8)
+ } finally {
+ RustBuffer.free(value)
+ }
+ }
+
+ override fun read(buf: ByteBuffer): String {
+ val len = buf.getInt()
+ val byteArr = ByteArray(len)
+ buf.get(byteArr)
+ return byteArr.toString(Charsets.UTF_8)
+ }
+
+ fun toUtf8(value: String): ByteBuffer {
+ // Make sure we don't have invalid UTF-16, check for lone surrogates.
+ return Charsets.UTF_8.newEncoder().run {
+ onMalformedInput(CodingErrorAction.REPORT)
+ encode(CharBuffer.wrap(value))
+ }
+ }
+
+ override fun lower(value: String): RustBuffer.ByValue {
+ val byteBuf = toUtf8(value)
+ // Ideally we'd pass these bytes to `ffi_bytebuffer_from_bytes`, but doing so would require us
+ // to copy them into a JNA `Memory`. So we might as well directly copy them into a `RustBuffer`.
+ val rbuf = RustBuffer.alloc(byteBuf.limit().toULong())
+ rbuf.asByteBuffer()!!.put(byteBuf)
+ return rbuf
+ }
+
+ // We aren't sure exactly how many bytes our string will be once it's UTF-8
+ // encoded. Allocate 3 bytes per UTF-16 code unit which will always be
+ // enough.
+ override fun allocationSize(value: String): ULong {
+ val sizeForLength = 4UL
+ val sizeForString = value.length.toULong() * 3UL
+ return sizeForLength + sizeForString
+ }
+
+ override fun write(value: String, buf: ByteBuffer) {
+ val byteBuf = toUtf8(value)
+ buf.putInt(byteBuf.limit())
+ buf.put(byteBuf)
+ }
+}
+
+/**
+ * @suppress
+ */
+public object FfiConverterByteArray: FfiConverterRustBuffer {
+ override fun read(buf: ByteBuffer): ByteArray {
+ val len = buf.getInt()
+ val byteArr = ByteArray(len)
+ buf.get(byteArr)
+ return byteArr
+ }
+ override fun allocationSize(value: ByteArray): ULong {
+ return 4UL + value.size.toULong()
+ }
+ override fun write(value: ByteArray, buf: ByteBuffer) {
+ buf.putInt(value.size)
+ buf.put(value)
+ }
+}
+
+
+
+data class Address (
+ var `address`: kotlin.String,
+ var `pubKey`: ByteBuf
+) {
+
+ companion object
+}
+
+/**
+ * @suppress
+ */
+public object FfiConverterTypeAddress: FfiConverterRustBuffer {
+ override fun read(buf: ByteBuffer): Address {
+ return Address(
+ FfiConverterString.read(buf),
+ FfiConverterTypeByteBuf.read(buf),
+ )
+ }
+
+ override fun allocationSize(value: Address) = (
+ FfiConverterString.allocationSize(value.`address`) +
+ FfiConverterTypeByteBuf.allocationSize(value.`pubKey`)
+ )
+
+ override fun write(value: Address, buf: ByteBuffer) {
+ FfiConverterString.write(value.`address`, buf)
+ FfiConverterTypeByteBuf.write(value.`pubKey`, buf)
+ }
+}
+
+
+
+/**
+ * Represents an application call transaction that interacts with Algorand Smart Contracts.
+ *
+ * Application call transactions are used to create, update, delete, opt-in to,
+ * close out of, or clear state from Algorand applications (smart contracts).
+ */
+data class ApplicationCallTransactionFields (
+ /**
+ * ID of the application being called.
+ *
+ * Set this to 0 to indicate an application creation call.
+ */
+ var `appId`: kotlin.ULong,
+ /**
+ * Defines what additional actions occur with the transaction.
+ */
+ var `onComplete`: OnApplicationComplete,
+ /**
+ * Logic executed for every application call transaction, except when
+ * on-completion is set to "clear".
+ *
+ * Approval programs may reject the transaction.
+ * Only required for application creation and update transactions.
+ */
+ var `approvalProgram`: ByteBuf? = null,
+ /**
+ * Logic executed for application call transactions with on-completion set to "clear".
+ *
+ * Clear state programs cannot reject the transaction.
+ * Only required for application creation and update transactions.
+ */
+ var `clearStateProgram`: ByteBuf? = null,
+ /**
+ * Holds the maximum number of global state values.
+ *
+ * Only required for application creation transactions.
+ * This cannot be changed after creation.
+ */
+ var `globalStateSchema`: StateSchema? = null,
+ /**
+ * Holds the maximum number of local state values.
+ *
+ * Only required for application creation transactions.
+ * This cannot be changed after creation.
+ */
+ var `localStateSchema`: StateSchema? = null,
+ /**
+ * Number of additional pages allocated to the application's approval
+ * and clear state programs.
+ *
+ * Each extra program page is 2048 bytes. The sum of approval program
+ * and clear state program may not exceed 2048*(1+extra_program_pages) bytes.
+ * Currently, the maximum value is 3.
+ * This cannot be changed after creation.
+ */
+ var `extraProgramPages`: kotlin.ULong? = null,
+ /**
+ * Transaction specific arguments available in the application's
+ * approval program and clear state program.
+ */
+ var `args`: List? = null,
+ /**
+ * List of accounts in addition to the sender that may be accessed
+ * from the application's approval program and clear state program.
+ */
+ var `accountReferences`: List? = null,
+ /**
+ * List of applications in addition to the application ID that may be called
+ * from the application's approval program and clear state program.
+ */
+ var `appReferences`: List? = null,
+ /**
+ * Lists the assets whose parameters may be accessed by this application's
+ * approval program and clear state program.
+ *
+ * The access is read-only.
+ */
+ var `assetReferences`: List? = null,
+ /**
+ * The boxes that should be made available for the runtime of the program.
+ */
+ var `boxReferences`: List? = null
+) {
+
+ companion object
+}
+
+/**
+ * @suppress
+ */
+public object FfiConverterTypeApplicationCallTransactionFields: FfiConverterRustBuffer {
+ override fun read(buf: ByteBuffer): ApplicationCallTransactionFields {
+ return ApplicationCallTransactionFields(
+ FfiConverterULong.read(buf),
+ FfiConverterTypeOnApplicationComplete.read(buf),
+ FfiConverterOptionalTypeByteBuf.read(buf),
+ FfiConverterOptionalTypeByteBuf.read(buf),
+ FfiConverterOptionalTypeStateSchema.read(buf),
+ FfiConverterOptionalTypeStateSchema.read(buf),
+ FfiConverterOptionalULong.read(buf),
+ FfiConverterOptionalSequenceTypeByteBuf.read(buf),
+ FfiConverterOptionalSequenceTypeAddress.read(buf),
+ FfiConverterOptionalSequenceULong.read(buf),
+ FfiConverterOptionalSequenceULong.read(buf),
+ FfiConverterOptionalSequenceTypeBoxReference.read(buf),
+ )
+ }
+
+ override fun allocationSize(value: ApplicationCallTransactionFields) = (
+ FfiConverterULong.allocationSize(value.`appId`) +
+ FfiConverterTypeOnApplicationComplete.allocationSize(value.`onComplete`) +
+ FfiConverterOptionalTypeByteBuf.allocationSize(value.`approvalProgram`) +
+ FfiConverterOptionalTypeByteBuf.allocationSize(value.`clearStateProgram`) +
+ FfiConverterOptionalTypeStateSchema.allocationSize(value.`globalStateSchema`) +
+ FfiConverterOptionalTypeStateSchema.allocationSize(value.`localStateSchema`) +
+ FfiConverterOptionalULong.allocationSize(value.`extraProgramPages`) +
+ FfiConverterOptionalSequenceTypeByteBuf.allocationSize(value.`args`) +
+ FfiConverterOptionalSequenceTypeAddress.allocationSize(value.`accountReferences`) +
+ FfiConverterOptionalSequenceULong.allocationSize(value.`appReferences`) +
+ FfiConverterOptionalSequenceULong.allocationSize(value.`assetReferences`) +
+ FfiConverterOptionalSequenceTypeBoxReference.allocationSize(value.`boxReferences`)
+ )
+
+ override fun write(value: ApplicationCallTransactionFields, buf: ByteBuffer) {
+ FfiConverterULong.write(value.`appId`, buf)
+ FfiConverterTypeOnApplicationComplete.write(value.`onComplete`, buf)
+ FfiConverterOptionalTypeByteBuf.write(value.`approvalProgram`, buf)
+ FfiConverterOptionalTypeByteBuf.write(value.`clearStateProgram`, buf)
+ FfiConverterOptionalTypeStateSchema.write(value.`globalStateSchema`, buf)
+ FfiConverterOptionalTypeStateSchema.write(value.`localStateSchema`, buf)
+ FfiConverterOptionalULong.write(value.`extraProgramPages`, buf)
+ FfiConverterOptionalSequenceTypeByteBuf.write(value.`args`, buf)
+ FfiConverterOptionalSequenceTypeAddress.write(value.`accountReferences`, buf)
+ FfiConverterOptionalSequenceULong.write(value.`appReferences`, buf)
+ FfiConverterOptionalSequenceULong.write(value.`assetReferences`, buf)
+ FfiConverterOptionalSequenceTypeBoxReference.write(value.`boxReferences`, buf)
+ }
+}
+
+
+
+data class AssetTransferTransactionFields (
+ var `assetId`: kotlin.ULong,
+ var `amount`: kotlin.ULong,
+ var `receiver`: Address,
+ var `assetSender`: Address? = null,
+ var `closeRemainderTo`: Address? = null
+) {
+
+ companion object
+}
+
+/**
+ * @suppress
+ */
+public object FfiConverterTypeAssetTransferTransactionFields: FfiConverterRustBuffer {
+ override fun read(buf: ByteBuffer): AssetTransferTransactionFields {
+ return AssetTransferTransactionFields(
+ FfiConverterULong.read(buf),
+ FfiConverterULong.read(buf),
+ FfiConverterTypeAddress.read(buf),
+ FfiConverterOptionalTypeAddress.read(buf),
+ FfiConverterOptionalTypeAddress.read(buf),
+ )
+ }
+
+ override fun allocationSize(value: AssetTransferTransactionFields) = (
+ FfiConverterULong.allocationSize(value.`assetId`) +
+ FfiConverterULong.allocationSize(value.`amount`) +
+ FfiConverterTypeAddress.allocationSize(value.`receiver`) +
+ FfiConverterOptionalTypeAddress.allocationSize(value.`assetSender`) +
+ FfiConverterOptionalTypeAddress.allocationSize(value.`closeRemainderTo`)
+ )
+
+ override fun write(value: AssetTransferTransactionFields, buf: ByteBuffer) {
+ FfiConverterULong.write(value.`assetId`, buf)
+ FfiConverterULong.write(value.`amount`, buf)
+ FfiConverterTypeAddress.write(value.`receiver`, buf)
+ FfiConverterOptionalTypeAddress.write(value.`assetSender`, buf)
+ FfiConverterOptionalTypeAddress.write(value.`closeRemainderTo`, buf)
+ }
+}
+
+
+
+/**
+ * Box reference for application call transactions.
+ *
+ * References a specific box that should be made available for the runtime
+ * of the program.
+ */
+data class BoxReference (
+ /**
+ * Application ID that owns the box.
+ * A value of 0 indicates the current application.
+ */
+ var `appId`: kotlin.ULong,
+ /**
+ * Name of the box.
+ */
+ var `name`: ByteBuf
+) {
+
+ companion object
+}
+
+/**
+ * @suppress
+ */
+public object FfiConverterTypeBoxReference: FfiConverterRustBuffer {
+ override fun read(buf: ByteBuffer): BoxReference {
+ return BoxReference(
+ FfiConverterULong.read(buf),
+ FfiConverterTypeByteBuf.read(buf),
+ )
+ }
+
+ override fun allocationSize(value: BoxReference) = (
+ FfiConverterULong.allocationSize(value.`appId`) +
+ FfiConverterTypeByteBuf.allocationSize(value.`name`)
+ )
+
+ override fun write(value: BoxReference, buf: ByteBuffer) {
+ FfiConverterULong.write(value.`appId`, buf)
+ FfiConverterTypeByteBuf.write(value.`name`, buf)
+ }
+}
+
+
+
+data class FeeParams (
+ var `feePerByte`: kotlin.ULong,
+ var `minFee`: kotlin.ULong,
+ var `extraFee`: kotlin.ULong? = null,
+ var `maxFee`: kotlin.ULong? = null
+) {
+
+ companion object
+}
+
+/**
+ * @suppress
+ */
+public object FfiConverterTypeFeeParams: FfiConverterRustBuffer {
+ override fun read(buf: ByteBuffer): FeeParams {
+ return FeeParams(
+ FfiConverterULong.read(buf),
+ FfiConverterULong.read(buf),
+ FfiConverterOptionalULong.read(buf),
+ FfiConverterOptionalULong.read(buf),
+ )
+ }
+
+ override fun allocationSize(value: FeeParams) = (
+ FfiConverterULong.allocationSize(value.`feePerByte`) +
+ FfiConverterULong.allocationSize(value.`minFee`) +
+ FfiConverterOptionalULong.allocationSize(value.`extraFee`) +
+ FfiConverterOptionalULong.allocationSize(value.`maxFee`)
+ )
+
+ override fun write(value: FeeParams, buf: ByteBuffer) {
+ FfiConverterULong.write(value.`feePerByte`, buf)
+ FfiConverterULong.write(value.`minFee`, buf)
+ FfiConverterOptionalULong.write(value.`extraFee`, buf)
+ FfiConverterOptionalULong.write(value.`maxFee`, buf)
+ }
+}
+
+
+
+data class PaymentTransactionFields (
+ var `receiver`: Address,
+ var `amount`: kotlin.ULong,
+ var `closeRemainderTo`: Address? = null
+) {
+
+ companion object
+}
+
+/**
+ * @suppress
+ */
+public object FfiConverterTypePaymentTransactionFields: FfiConverterRustBuffer {
+ override fun read(buf: ByteBuffer): PaymentTransactionFields {
+ return PaymentTransactionFields(
+ FfiConverterTypeAddress.read(buf),
+ FfiConverterULong.read(buf),
+ FfiConverterOptionalTypeAddress.read(buf),
+ )
+ }
+
+ override fun allocationSize(value: PaymentTransactionFields) = (
+ FfiConverterTypeAddress.allocationSize(value.`receiver`) +
+ FfiConverterULong.allocationSize(value.`amount`) +
+ FfiConverterOptionalTypeAddress.allocationSize(value.`closeRemainderTo`)
+ )
+
+ override fun write(value: PaymentTransactionFields, buf: ByteBuffer) {
+ FfiConverterTypeAddress.write(value.`receiver`, buf)
+ FfiConverterULong.write(value.`amount`, buf)
+ FfiConverterOptionalTypeAddress.write(value.`closeRemainderTo`, buf)
+ }
+}
+
+
+
+data class SignedTransaction (
+ /**
+ * The transaction that has been signed.
+ */
+ var `transaction`: Transaction,
+ /**
+ * Optional Ed25519 signature authorizing the transaction.
+ */
+ var `signature`: ByteBuf? = null,
+ /**
+ * Optional auth address applicable if the transaction sender is a rekeyed account.
+ */
+ var `authAddress`: Address? = null
+) {
+
+ companion object
+}
+
+/**
+ * @suppress
+ */
+public object FfiConverterTypeSignedTransaction: FfiConverterRustBuffer {
+ override fun read(buf: ByteBuffer): SignedTransaction {
+ return SignedTransaction(
+ FfiConverterTypeTransaction.read(buf),
+ FfiConverterOptionalTypeByteBuf.read(buf),
+ FfiConverterOptionalTypeAddress.read(buf),
+ )
+ }
+
+ override fun allocationSize(value: SignedTransaction) = (
+ FfiConverterTypeTransaction.allocationSize(value.`transaction`) +
+ FfiConverterOptionalTypeByteBuf.allocationSize(value.`signature`) +
+ FfiConverterOptionalTypeAddress.allocationSize(value.`authAddress`)
+ )
+
+ override fun write(value: SignedTransaction, buf: ByteBuffer) {
+ FfiConverterTypeTransaction.write(value.`transaction`, buf)
+ FfiConverterOptionalTypeByteBuf.write(value.`signature`, buf)
+ FfiConverterOptionalTypeAddress.write(value.`authAddress`, buf)
+ }
+}
+
+
+
+/**
+ * Schema for application state storage.
+ *
+ * Defines the maximum number of values that may be stored in application
+ * key/value storage for both global and local state.
+ */
+data class StateSchema (
+ /**
+ * Maximum number of integer values that may be stored.
+ */
+ var `numUints`: kotlin.ULong,
+ /**
+ * Maximum number of byte slice values that may be stored.
+ */
+ var `numByteSlices`: kotlin.ULong
+) {
+
+ companion object
+}
+
+/**
+ * @suppress
+ */
+public object FfiConverterTypeStateSchema: FfiConverterRustBuffer {
+ override fun read(buf: ByteBuffer): StateSchema {
+ return StateSchema(
+ FfiConverterULong.read(buf),
+ FfiConverterULong.read(buf),
+ )
+ }
+
+ override fun allocationSize(value: StateSchema) = (
+ FfiConverterULong.allocationSize(value.`numUints`) +
+ FfiConverterULong.allocationSize(value.`numByteSlices`)
+ )
+
+ override fun write(value: StateSchema, buf: ByteBuffer) {
+ FfiConverterULong.write(value.`numUints`, buf)
+ FfiConverterULong.write(value.`numByteSlices`, buf)
+ }
+}
+
+
+
+data class Transaction (
+ /**
+ * The type of transaction
+ */
+ var `transactionType`: TransactionType,
+ /**
+ * The sender of the transaction
+ */
+ var `sender`: Address,
+ /**
+ * Optional transaction fee in microALGO.
+ *
+ * If not set, the fee will be interpreted as 0 by the network.
+ */
+ var `fee`: kotlin.ULong? = null,
+ var `firstValid`: kotlin.ULong,
+ var `lastValid`: kotlin.ULong,
+ var `genesisHash`: ByteBuf?,
+ var `genesisId`: kotlin.String?,
+ var `note`: ByteBuf? = null,
+ var `rekeyTo`: Address? = null,
+ var `lease`: ByteBuf? = null,
+ var `group`: ByteBuf? = null,
+ var `payment`: PaymentTransactionFields? = null,
+ var `assetTransfer`: AssetTransferTransactionFields? = null,
+ var `applicationCall`: ApplicationCallTransactionFields? = null
+) {
+
+ companion object
+}
+
+/**
+ * @suppress
+ */
+public object FfiConverterTypeTransaction: FfiConverterRustBuffer {
+ override fun read(buf: ByteBuffer): Transaction {
+ return Transaction(
+ FfiConverterTypeTransactionType.read(buf),
+ FfiConverterTypeAddress.read(buf),
+ FfiConverterOptionalULong.read(buf),
+ FfiConverterULong.read(buf),
+ FfiConverterULong.read(buf),
+ FfiConverterOptionalTypeByteBuf.read(buf),
+ FfiConverterOptionalString.read(buf),
+ FfiConverterOptionalTypeByteBuf.read(buf),
+ FfiConverterOptionalTypeAddress.read(buf),
+ FfiConverterOptionalTypeByteBuf.read(buf),
+ FfiConverterOptionalTypeByteBuf.read(buf),
+ FfiConverterOptionalTypePaymentTransactionFields.read(buf),
+ FfiConverterOptionalTypeAssetTransferTransactionFields.read(buf),
+ FfiConverterOptionalTypeApplicationCallTransactionFields.read(buf),
+ )
+ }
+
+ override fun allocationSize(value: Transaction) = (
+ FfiConverterTypeTransactionType.allocationSize(value.`transactionType`) +
+ FfiConverterTypeAddress.allocationSize(value.`sender`) +
+ FfiConverterOptionalULong.allocationSize(value.`fee`) +
+ FfiConverterULong.allocationSize(value.`firstValid`) +
+ FfiConverterULong.allocationSize(value.`lastValid`) +
+ FfiConverterOptionalTypeByteBuf.allocationSize(value.`genesisHash`) +
+ FfiConverterOptionalString.allocationSize(value.`genesisId`) +
+ FfiConverterOptionalTypeByteBuf.allocationSize(value.`note`) +
+ FfiConverterOptionalTypeAddress.allocationSize(value.`rekeyTo`) +
+ FfiConverterOptionalTypeByteBuf.allocationSize(value.`lease`) +
+ FfiConverterOptionalTypeByteBuf.allocationSize(value.`group`) +
+ FfiConverterOptionalTypePaymentTransactionFields.allocationSize(value.`payment`) +
+ FfiConverterOptionalTypeAssetTransferTransactionFields.allocationSize(value.`assetTransfer`) +
+ FfiConverterOptionalTypeApplicationCallTransactionFields.allocationSize(value.`applicationCall`)
+ )
+
+ override fun write(value: Transaction, buf: ByteBuffer) {
+ FfiConverterTypeTransactionType.write(value.`transactionType`, buf)
+ FfiConverterTypeAddress.write(value.`sender`, buf)
+ FfiConverterOptionalULong.write(value.`fee`, buf)
+ FfiConverterULong.write(value.`firstValid`, buf)
+ FfiConverterULong.write(value.`lastValid`, buf)
+ FfiConverterOptionalTypeByteBuf.write(value.`genesisHash`, buf)
+ FfiConverterOptionalString.write(value.`genesisId`, buf)
+ FfiConverterOptionalTypeByteBuf.write(value.`note`, buf)
+ FfiConverterOptionalTypeAddress.write(value.`rekeyTo`, buf)
+ FfiConverterOptionalTypeByteBuf.write(value.`lease`, buf)
+ FfiConverterOptionalTypeByteBuf.write(value.`group`, buf)
+ FfiConverterOptionalTypePaymentTransactionFields.write(value.`payment`, buf)
+ FfiConverterOptionalTypeAssetTransferTransactionFields.write(value.`assetTransfer`, buf)
+ FfiConverterOptionalTypeApplicationCallTransactionFields.write(value.`applicationCall`, buf)
+ }
+}
+
+
+
+
+
+sealed class AlgoKitTransactException: kotlin.Exception() {
+
+ class EncodingException(
+
+ val v1: kotlin.String
+ ) : AlgoKitTransactException() {
+ override val message
+ get() = "v1=${ v1 }"
+ }
+
+ class DecodingException(
+
+ val v1: kotlin.String
+ ) : AlgoKitTransactException() {
+ override val message
+ get() = "v1=${ v1 }"
+ }
+
+ class InputException(
+
+ val v1: kotlin.String
+ ) : AlgoKitTransactException() {
+ override val message
+ get() = "v1=${ v1 }"
+ }
+
+ class MsgPackException(
+
+ val v1: kotlin.String
+ ) : AlgoKitTransactException() {
+ override val message
+ get() = "v1=${ v1 }"
+ }
+
+
+ companion object ErrorHandler : UniffiRustCallStatusErrorHandler {
+ override fun lift(error_buf: RustBuffer.ByValue): AlgoKitTransactException = FfiConverterTypeAlgoKitTransactError.lift(error_buf)
+ }
+
+
+}
+
+/**
+ * @suppress
+ */
+public object FfiConverterTypeAlgoKitTransactError : FfiConverterRustBuffer {
+ override fun read(buf: ByteBuffer): AlgoKitTransactException {
+
+
+ return when(buf.getInt()) {
+ 1 -> AlgoKitTransactException.EncodingException(
+ FfiConverterString.read(buf),
+ )
+ 2 -> AlgoKitTransactException.DecodingException(
+ FfiConverterString.read(buf),
+ )
+ 3 -> AlgoKitTransactException.InputException(
+ FfiConverterString.read(buf),
+ )
+ 4 -> AlgoKitTransactException.MsgPackException(
+ FfiConverterString.read(buf),
+ )
+ else -> throw RuntimeException("invalid error enum value, something is very wrong!!")
+ }
+ }
+
+ override fun allocationSize(value: AlgoKitTransactException): ULong {
+ return when(value) {
+ is AlgoKitTransactException.EncodingException -> (
+ // Add the size for the Int that specifies the variant plus the size needed for all fields
+ 4UL
+ + FfiConverterString.allocationSize(value.v1)
+ )
+ is AlgoKitTransactException.DecodingException -> (
+ // Add the size for the Int that specifies the variant plus the size needed for all fields
+ 4UL
+ + FfiConverterString.allocationSize(value.v1)
+ )
+ is AlgoKitTransactException.InputException -> (
+ // Add the size for the Int that specifies the variant plus the size needed for all fields
+ 4UL
+ + FfiConverterString.allocationSize(value.v1)
+ )
+ is AlgoKitTransactException.MsgPackException -> (
+ // Add the size for the Int that specifies the variant plus the size needed for all fields
+ 4UL
+ + FfiConverterString.allocationSize(value.v1)
+ )
+ }
+ }
+
+ override fun write(value: AlgoKitTransactException, buf: ByteBuffer) {
+ when(value) {
+ is AlgoKitTransactException.EncodingException -> {
+ buf.putInt(1)
+ FfiConverterString.write(value.v1, buf)
+ Unit
+ }
+ is AlgoKitTransactException.DecodingException -> {
+ buf.putInt(2)
+ FfiConverterString.write(value.v1, buf)
+ Unit
+ }
+ is AlgoKitTransactException.InputException -> {
+ buf.putInt(3)
+ FfiConverterString.write(value.v1, buf)
+ Unit
+ }
+ is AlgoKitTransactException.MsgPackException -> {
+ buf.putInt(4)
+ FfiConverterString.write(value.v1, buf)
+ Unit
+ }
+ }.let { /* this makes the `when` an expression, which ensures it is exhaustive */ }
+ }
+
+}
+
+
+
+/**
+ * Enum containing all constants used in this crate.
+ */
+
+enum class AlgorandConstant {
+
+ /**
+ * Length of hash digests (32)
+ */
+ HASH_LENGTH,
+ /**
+ * Length of the checksum used in Algorand addresses (4)
+ */
+ CHECKSUM_LENGTH,
+ /**
+ * Length of a base32-encoded Algorand address (58)
+ */
+ ADDRESS_LENGTH,
+ /**
+ * Length of an Algorand public key in bytes (32)
+ */
+ PUBLIC_KEY_LENGTH,
+ /**
+ * Length of an Algorand secret key in bytes (32)
+ */
+ SECRET_KEY_LENGTH,
+ /**
+ * Length of an Algorand signature in bytes (64)
+ */
+ SIGNATURE_LENGTH,
+ /**
+ * Increment in the encoded byte size when a signature is attached to a transaction (75)
+ */
+ SIGNATURE_ENCODING_INCR_LENGTH,
+ MAX_TX_GROUP_SIZE;
+ companion object
+}
+
+
+/**
+ * @suppress
+ */
+public object FfiConverterTypeAlgorandConstant: FfiConverterRustBuffer {
+ override fun read(buf: ByteBuffer) = try {
+ AlgorandConstant.values()[buf.getInt() - 1]
+ } catch (e: IndexOutOfBoundsException) {
+ throw RuntimeException("invalid enum value, something is very wrong!!", e)
+ }
+
+ override fun allocationSize(value: AlgorandConstant) = 4UL
+
+ override fun write(value: AlgorandConstant, buf: ByteBuffer) {
+ buf.putInt(value.ordinal + 1)
+ }
+}
+
+
+
+
+
+
+enum class ModelType {
+
+ SIMULATE_REQUEST,
+ SIMULATE_TRANSACTION200_RESPONSE;
+ companion object
+}
+
+
+/**
+ * @suppress
+ */
+public object FfiConverterTypeModelType: FfiConverterRustBuffer {
+ override fun read(buf: ByteBuffer) = try {
+ ModelType.values()[buf.getInt() - 1]
+ } catch (e: IndexOutOfBoundsException) {
+ throw RuntimeException("invalid enum value, something is very wrong!!", e)
+ }
+
+ override fun allocationSize(value: ModelType) = 4UL
+
+ override fun write(value: ModelType, buf: ByteBuffer) {
+ buf.putInt(value.ordinal + 1)
+ }
+}
+
+
+
+
+
+/**
+ * On-completion actions for application transactions.
+ *
+ * These values define what additional actions occur with the transaction.
+ */
+
+enum class OnApplicationComplete {
+
+ /**
+ * NoOp indicates that an application transaction will simply call its
+ * approval program without any additional action.
+ */
+ NO_OP,
+ /**
+ * OptIn indicates that an application transaction will allocate some
+ * local state for the application in the sender's account.
+ */
+ OPT_IN,
+ /**
+ * CloseOut indicates that an application transaction will deallocate
+ * some local state for the application from the user's account.
+ */
+ CLOSE_OUT,
+ /**
+ * ClearState is similar to CloseOut, but may never fail. This
+ * allows users to reclaim their minimum balance from an application
+ * they no longer wish to opt in to.
+ */
+ CLEAR_STATE,
+ /**
+ * UpdateApplication indicates that an application transaction will
+ * update the approval program and clear state program for the application.
+ */
+ UPDATE_APPLICATION,
+ /**
+ * DeleteApplication indicates that an application transaction will
+ * delete the application parameters for the application from the creator's
+ * balance record.
+ */
+ DELETE_APPLICATION;
+ companion object
+}
+
+
+/**
+ * @suppress
+ */
+public object FfiConverterTypeOnApplicationComplete: FfiConverterRustBuffer {
+ override fun read(buf: ByteBuffer) = try {
+ OnApplicationComplete.values()[buf.getInt() - 1]
+ } catch (e: IndexOutOfBoundsException) {
+ throw RuntimeException("invalid enum value, something is very wrong!!", e)
+ }
+
+ override fun allocationSize(value: OnApplicationComplete) = 4UL
+
+ override fun write(value: OnApplicationComplete, buf: ByteBuffer) {
+ buf.putInt(value.ordinal + 1)
+ }
+}
+
+
+
+
+
+
+enum class TransactionType {
+
+ PAYMENT,
+ ASSET_TRANSFER,
+ ASSET_FREEZE,
+ ASSET_CONFIG,
+ KEY_REGISTRATION,
+ APPLICATION_CALL;
+ companion object
+}
+
+
+/**
+ * @suppress
+ */
+public object FfiConverterTypeTransactionType: FfiConverterRustBuffer {
+ override fun read(buf: ByteBuffer) = try {
+ TransactionType.values()[buf.getInt() - 1]
+ } catch (e: IndexOutOfBoundsException) {
+ throw RuntimeException("invalid enum value, something is very wrong!!", e)
+ }
+
+ override fun allocationSize(value: TransactionType) = 4UL
+
+ override fun write(value: TransactionType, buf: ByteBuffer) {
+ buf.putInt(value.ordinal + 1)
+ }
+}
+
+
+
+
+
+
+/**
+ * @suppress
+ */
+public object FfiConverterOptionalULong: FfiConverterRustBuffer {
+ override fun read(buf: ByteBuffer): kotlin.ULong? {
+ if (buf.get().toInt() == 0) {
+ return null
+ }
+ return FfiConverterULong.read(buf)
+ }
+
+ override fun allocationSize(value: kotlin.ULong?): ULong {
+ if (value == null) {
+ return 1UL
+ } else {
+ return 1UL + FfiConverterULong.allocationSize(value)
+ }
+ }
+
+ override fun write(value: kotlin.ULong?, buf: ByteBuffer) {
+ if (value == null) {
+ buf.put(0)
+ } else {
+ buf.put(1)
+ FfiConverterULong.write(value, buf)
+ }
+ }
+}
+
+
+
+
+/**
+ * @suppress
+ */
+public object FfiConverterOptionalString: FfiConverterRustBuffer {
+ override fun read(buf: ByteBuffer): kotlin.String? {
+ if (buf.get().toInt() == 0) {
+ return null
+ }
+ return FfiConverterString.read(buf)
+ }
+
+ override fun allocationSize(value: kotlin.String?): ULong {
+ if (value == null) {
+ return 1UL
+ } else {
+ return 1UL + FfiConverterString.allocationSize(value)
+ }
+ }
+
+ override fun write(value: kotlin.String?, buf: ByteBuffer) {
+ if (value == null) {
+ buf.put(0)
+ } else {
+ buf.put(1)
+ FfiConverterString.write(value, buf)
+ }
+ }
+}
+
+
+
+
+/**
+ * @suppress
+ */
+public object FfiConverterOptionalTypeAddress: FfiConverterRustBuffer {
+ override fun read(buf: ByteBuffer): Address? {
+ if (buf.get().toInt() == 0) {
+ return null
+ }
+ return FfiConverterTypeAddress.read(buf)
+ }
+
+ override fun allocationSize(value: Address?): ULong {
+ if (value == null) {
+ return 1UL
+ } else {
+ return 1UL + FfiConverterTypeAddress.allocationSize(value)
+ }
+ }
+
+ override fun write(value: Address?, buf: ByteBuffer) {
+ if (value == null) {
+ buf.put(0)
+ } else {
+ buf.put(1)
+ FfiConverterTypeAddress.write(value, buf)
+ }
+ }
+}
+
+
+
+
+/**
+ * @suppress
+ */
+public object FfiConverterOptionalTypeApplicationCallTransactionFields: FfiConverterRustBuffer {
+ override fun read(buf: ByteBuffer): ApplicationCallTransactionFields? {
+ if (buf.get().toInt() == 0) {
+ return null
+ }
+ return FfiConverterTypeApplicationCallTransactionFields.read(buf)
+ }
+
+ override fun allocationSize(value: ApplicationCallTransactionFields?): ULong {
+ if (value == null) {
+ return 1UL
+ } else {
+ return 1UL + FfiConverterTypeApplicationCallTransactionFields.allocationSize(value)
+ }
+ }
+
+ override fun write(value: ApplicationCallTransactionFields?, buf: ByteBuffer) {
+ if (value == null) {
+ buf.put(0)
+ } else {
+ buf.put(1)
+ FfiConverterTypeApplicationCallTransactionFields.write(value, buf)
+ }
+ }
+}
+
+
+
+
+/**
+ * @suppress
+ */
+public object FfiConverterOptionalTypeAssetTransferTransactionFields: FfiConverterRustBuffer {
+ override fun read(buf: ByteBuffer): AssetTransferTransactionFields? {
+ if (buf.get().toInt() == 0) {
+ return null
+ }
+ return FfiConverterTypeAssetTransferTransactionFields.read(buf)
+ }
+
+ override fun allocationSize(value: AssetTransferTransactionFields?): ULong {
+ if (value == null) {
+ return 1UL
+ } else {
+ return 1UL + FfiConverterTypeAssetTransferTransactionFields.allocationSize(value)
+ }
+ }
+
+ override fun write(value: AssetTransferTransactionFields?, buf: ByteBuffer) {
+ if (value == null) {
+ buf.put(0)
+ } else {
+ buf.put(1)
+ FfiConverterTypeAssetTransferTransactionFields.write(value, buf)
+ }
+ }
+}
+
+
+
+
+/**
+ * @suppress
+ */
+public object FfiConverterOptionalTypePaymentTransactionFields: FfiConverterRustBuffer {
+ override fun read(buf: ByteBuffer): PaymentTransactionFields? {
+ if (buf.get().toInt() == 0) {
+ return null
+ }
+ return FfiConverterTypePaymentTransactionFields.read(buf)
+ }
+
+ override fun allocationSize(value: PaymentTransactionFields?): ULong {
+ if (value == null) {
+ return 1UL
+ } else {
+ return 1UL + FfiConverterTypePaymentTransactionFields.allocationSize(value)
+ }
+ }
+
+ override fun write(value: PaymentTransactionFields?, buf: ByteBuffer) {
+ if (value == null) {
+ buf.put(0)
+ } else {
+ buf.put(1)
+ FfiConverterTypePaymentTransactionFields.write(value, buf)
+ }
+ }
+}
+
+
+
+
+/**
+ * @suppress
+ */
+public object FfiConverterOptionalTypeStateSchema: FfiConverterRustBuffer {
+ override fun read(buf: ByteBuffer): StateSchema? {
+ if (buf.get().toInt() == 0) {
+ return null
+ }
+ return FfiConverterTypeStateSchema.read(buf)
+ }
+
+ override fun allocationSize(value: StateSchema?): ULong {
+ if (value == null) {
+ return 1UL
+ } else {
+ return 1UL + FfiConverterTypeStateSchema.allocationSize(value)
+ }
+ }
+
+ override fun write(value: StateSchema?, buf: ByteBuffer) {
+ if (value == null) {
+ buf.put(0)
+ } else {
+ buf.put(1)
+ FfiConverterTypeStateSchema.write(value, buf)
+ }
+ }
+}
+
+
+
+
+/**
+ * @suppress
+ */
+public object FfiConverterOptionalSequenceULong: FfiConverterRustBuffer?> {
+ override fun read(buf: ByteBuffer): List? {
+ if (buf.get().toInt() == 0) {
+ return null
+ }
+ return FfiConverterSequenceULong.read(buf)
+ }
+
+ override fun allocationSize(value: List?): ULong {
+ if (value == null) {
+ return 1UL
+ } else {
+ return 1UL + FfiConverterSequenceULong.allocationSize(value)
+ }
+ }
+
+ override fun write(value: List?, buf: ByteBuffer) {
+ if (value == null) {
+ buf.put(0)
+ } else {
+ buf.put(1)
+ FfiConverterSequenceULong.write(value, buf)
+ }
+ }
+}
+
+
+
+
+/**
+ * @suppress
+ */
+public object FfiConverterOptionalSequenceTypeAddress: FfiConverterRustBuffer?> {
+ override fun read(buf: ByteBuffer): List? {
+ if (buf.get().toInt() == 0) {
+ return null
+ }
+ return FfiConverterSequenceTypeAddress.read(buf)
+ }
+
+ override fun allocationSize(value: List?): ULong {
+ if (value == null) {
+ return 1UL
+ } else {
+ return 1UL + FfiConverterSequenceTypeAddress.allocationSize(value)
+ }
+ }
+
+ override fun write(value: List?, buf: ByteBuffer) {
+ if (value == null) {
+ buf.put(0)
+ } else {
+ buf.put(1)
+ FfiConverterSequenceTypeAddress.write(value, buf)
+ }
+ }
+}
+
+
+
+
+/**
+ * @suppress
+ */
+public object FfiConverterOptionalSequenceTypeBoxReference: FfiConverterRustBuffer?> {
+ override fun read(buf: ByteBuffer): List? {
+ if (buf.get().toInt() == 0) {
+ return null
+ }
+ return FfiConverterSequenceTypeBoxReference.read(buf)
+ }
+
+ override fun allocationSize(value: List?): ULong {
+ if (value == null) {
+ return 1UL
+ } else {
+ return 1UL + FfiConverterSequenceTypeBoxReference.allocationSize(value)
+ }
+ }
+
+ override fun write(value: List?, buf: ByteBuffer) {
+ if (value == null) {
+ buf.put(0)
+ } else {
+ buf.put(1)
+ FfiConverterSequenceTypeBoxReference.write(value, buf)
+ }
+ }
+}
+
+
+
+
+/**
+ * @suppress
+ */
+public object FfiConverterOptionalSequenceTypeByteBuf: FfiConverterRustBuffer?> {
+ override fun read(buf: ByteBuffer): List? {
+ if (buf.get().toInt() == 0) {
+ return null
+ }
+ return FfiConverterSequenceTypeByteBuf.read(buf)
+ }
+
+ override fun allocationSize(value: List?): ULong {
+ if (value == null) {
+ return 1UL
+ } else {
+ return 1UL + FfiConverterSequenceTypeByteBuf.allocationSize(value)
+ }
+ }
+
+ override fun write(value: List?, buf: ByteBuffer) {
+ if (value == null) {
+ buf.put(0)
+ } else {
+ buf.put(1)
+ FfiConverterSequenceTypeByteBuf.write(value, buf)
+ }
+ }
+}
+
+
+
+
+/**
+ * @suppress
+ */
+public object FfiConverterOptionalTypeByteBuf: FfiConverterRustBuffer {
+ override fun read(buf: ByteBuffer): ByteBuf? {
+ if (buf.get().toInt() == 0) {
+ return null
+ }
+ return FfiConverterTypeByteBuf.read(buf)
+ }
+
+ override fun allocationSize(value: ByteBuf?): ULong {
+ if (value == null) {
+ return 1UL
+ } else {
+ return 1UL + FfiConverterTypeByteBuf.allocationSize(value)
+ }
+ }
+
+ override fun write(value: ByteBuf?, buf: ByteBuffer) {
+ if (value == null) {
+ buf.put(0)
+ } else {
+ buf.put(1)
+ FfiConverterTypeByteBuf.write(value, buf)
+ }
+ }
+}
+
+
+
+
+/**
+ * @suppress
+ */
+public object FfiConverterSequenceULong: FfiConverterRustBuffer> {
+ override fun read(buf: ByteBuffer): List {
+ val len = buf.getInt()
+ return List(len) {
+ FfiConverterULong.read(buf)
+ }
+ }
+
+ override fun allocationSize(value: List): ULong {
+ val sizeForLength = 4UL
+ val sizeForItems = value.map { FfiConverterULong.allocationSize(it) }.sum()
+ return sizeForLength + sizeForItems
+ }
+
+ override fun write(value: List, buf: ByteBuffer) {
+ buf.putInt(value.size)
+ value.iterator().forEach {
+ FfiConverterULong.write(it, buf)
+ }
+ }
+}
+
+
+
+
+/**
+ * @suppress
+ */
+public object FfiConverterSequenceByteArray: FfiConverterRustBuffer> {
+ override fun read(buf: ByteBuffer): List {
+ val len = buf.getInt()
+ return List(len) {
+ FfiConverterByteArray.read(buf)
+ }
+ }
+
+ override fun allocationSize(value: List): ULong {
+ val sizeForLength = 4UL
+ val sizeForItems = value.map { FfiConverterByteArray.allocationSize(it) }.sum()
+ return sizeForLength + sizeForItems
+ }
+
+ override fun write(value: List, buf: ByteBuffer) {
+ buf.putInt(value.size)
+ value.iterator().forEach {
+ FfiConverterByteArray.write(it, buf)
+ }
+ }
+}
+
+
+
+
+/**
+ * @suppress
+ */
+public object FfiConverterSequenceTypeAddress: FfiConverterRustBuffer> {
+ override fun read(buf: ByteBuffer): List {
+ val len = buf.getInt()
+ return List(len) {
+ FfiConverterTypeAddress.read(buf)
+ }
+ }
+
+ override fun allocationSize(value: List): ULong {
+ val sizeForLength = 4UL
+ val sizeForItems = value.map { FfiConverterTypeAddress.allocationSize(it) }.sum()
+ return sizeForLength + sizeForItems
+ }
+
+ override fun write(value: List, buf: ByteBuffer) {
+ buf.putInt(value.size)
+ value.iterator().forEach {
+ FfiConverterTypeAddress.write(it, buf)
+ }
+ }
+}
+
+
+
+
+/**
+ * @suppress
+ */
+public object FfiConverterSequenceTypeBoxReference: FfiConverterRustBuffer> {
+ override fun read(buf: ByteBuffer): List {
+ val len = buf.getInt()
+ return List(len) {
+ FfiConverterTypeBoxReference.read(buf)
+ }
+ }
+
+ override fun allocationSize(value: List): ULong {
+ val sizeForLength = 4UL
+ val sizeForItems = value.map { FfiConverterTypeBoxReference.allocationSize(it) }.sum()
+ return sizeForLength + sizeForItems
+ }
+
+ override fun write(value: List, buf: ByteBuffer) {
+ buf.putInt(value.size)
+ value.iterator().forEach {
+ FfiConverterTypeBoxReference.write(it, buf)
+ }
+ }
+}
+
+
+
+
+/**
+ * @suppress
+ */
+public object FfiConverterSequenceTypeSignedTransaction: FfiConverterRustBuffer> {
+ override fun read(buf: ByteBuffer): List {
+ val len = buf.getInt()
+ return List(len) {
+ FfiConverterTypeSignedTransaction.read(buf)
+ }
+ }
+
+ override fun allocationSize(value: List): ULong {
+ val sizeForLength = 4UL
+ val sizeForItems = value.map { FfiConverterTypeSignedTransaction.allocationSize(it) }.sum()
+ return sizeForLength + sizeForItems
+ }
+
+ override fun write(value: List, buf: ByteBuffer) {
+ buf.putInt(value.size)
+ value.iterator().forEach {
+ FfiConverterTypeSignedTransaction.write(it, buf)
+ }
+ }
+}
+
+
+
+
+/**
+ * @suppress
+ */
+public object FfiConverterSequenceTypeTransaction: FfiConverterRustBuffer> {
+ override fun read(buf: ByteBuffer): List {
+ val len = buf.getInt()
+ return List(len) {
+ FfiConverterTypeTransaction.read(buf)
+ }
+ }
+
+ override fun allocationSize(value: List): ULong {
+ val sizeForLength = 4UL
+ val sizeForItems = value.map { FfiConverterTypeTransaction.allocationSize(it) }.sum()
+ return sizeForLength + sizeForItems
+ }
+
+ override fun write(value: List, buf: ByteBuffer) {
+ buf.putInt(value.size)
+ value.iterator().forEach {
+ FfiConverterTypeTransaction.write(it, buf)
+ }
+ }
+}
+
+
+
+
+/**
+ * @suppress
+ */
+public object FfiConverterSequenceTypeModelType: FfiConverterRustBuffer> {
+ override fun read(buf: ByteBuffer): List {
+ val len = buf.getInt()
+ return List(len) {
+ FfiConverterTypeModelType.read(buf)
+ }
+ }
+
+ override fun allocationSize(value: List): ULong {
+ val sizeForLength = 4UL
+ val sizeForItems = value.map { FfiConverterTypeModelType.allocationSize(it) }.sum()
+ return sizeForLength + sizeForItems
+ }
+
+ override fun write(value: List, buf: ByteBuffer) {
+ buf.putInt(value.size)
+ value.iterator().forEach {
+ FfiConverterTypeModelType.write(it, buf)
+ }
+ }
+}
+
+
+
+
+/**
+ * @suppress
+ */
+public object FfiConverterSequenceTypeByteBuf: FfiConverterRustBuffer> {
+ override fun read(buf: ByteBuffer): List {
+ val len = buf.getInt()
+ return List(len) {
+ FfiConverterTypeByteBuf.read(buf)
+ }
+ }
+
+ override fun allocationSize(value: List): ULong {
+ val sizeForLength = 4UL
+ val sizeForItems = value.map { FfiConverterTypeByteBuf.allocationSize(it) }.sum()
+ return sizeForLength + sizeForItems
+ }
+
+ override fun write(value: List, buf: ByteBuffer) {
+ buf.putInt(value.size)
+ value.iterator().forEach {
+ FfiConverterTypeByteBuf.write(it, buf)
+ }
+ }
+}
+
+
+
+/**
+ * Typealias from the type name used in the UDL file to the builtin type. This
+ * is needed because the UDL type name is used in function/method signatures.
+ * It's also what we have an external type that references a custom type.
+ */
+public typealias ByteBuf = kotlin.ByteArray
+public typealias FfiConverterTypeByteBuf = FfiConverterByteArray
+ @Throws(AlgoKitTransactException::class) fun `addressFromPubKey`(`pubKey`: kotlin.ByteArray): Address {
+ return FfiConverterTypeAddress.lift(
+ uniffiRustCallWithError(AlgoKitTransactException) { _status ->
+ UniffiLib.INSTANCE.uniffi_algokit_transact_ffi_fn_func_address_from_pub_key(
+ FfiConverterByteArray.lower(`pubKey`),_status)
+}
+ )
+ }
+
+
+ @Throws(AlgoKitTransactException::class) fun `addressFromString`(`address`: kotlin.String): Address {
+ return FfiConverterTypeAddress.lift(
+ uniffiRustCallWithError(AlgoKitTransactException) { _status ->
+ UniffiLib.INSTANCE.uniffi_algokit_transact_ffi_fn_func_address_from_string(
+ FfiConverterString.lower(`address`),_status)
+}
+ )
+ }
+
+
+ @Throws(AlgoKitTransactException::class) fun `assignFee`(`txn`: Transaction, `feeParams`: FeeParams): Transaction {
+ return FfiConverterTypeTransaction.lift(
+ uniffiRustCallWithError(AlgoKitTransactException) { _status ->
+ UniffiLib.INSTANCE.uniffi_algokit_transact_ffi_fn_func_assign_fee(
+ FfiConverterTypeTransaction.lower(`txn`),FfiConverterTypeFeeParams.lower(`feeParams`),_status)
+}
+ )
+ }
+
+
+ @Throws(AlgoKitTransactException::class) fun `decodeBase64MsgpackToJson`(`modelType`: ModelType, `base64Str`: kotlin.String): kotlin.String {
+ return FfiConverterString.lift(
+ uniffiRustCallWithError(AlgoKitTransactException) { _status ->
+ UniffiLib.INSTANCE.uniffi_algokit_transact_ffi_fn_func_decode_base64_msgpack_to_json(
+ FfiConverterTypeModelType.lower(`modelType`),FfiConverterString.lower(`base64Str`),_status)
+}
+ )
+ }
+
+
+ @Throws(AlgoKitTransactException::class) fun `decodeMsgpackToJson`(`modelType`: ModelType, `msgpackBytes`: kotlin.ByteArray): kotlin.String {
+ return FfiConverterString.lift(
+ uniffiRustCallWithError(AlgoKitTransactException) { _status ->
+ UniffiLib.INSTANCE.uniffi_algokit_transact_ffi_fn_func_decode_msgpack_to_json(
+ FfiConverterTypeModelType.lower(`modelType`),FfiConverterByteArray.lower(`msgpackBytes`),_status)
+}
+ )
+ }
+
+
+ /**
+ * Decodes a signed transaction.
+ *
+ * # Parameters
+ * * `bytes` - The MsgPack encoded signed transaction bytes
+ *
+ * # Returns
+ * The decoded SignedTransaction or an error if decoding fails.
+ */
+ @Throws(AlgoKitTransactException::class) fun `decodeSignedTransaction`(`bytes`: kotlin.ByteArray): SignedTransaction {
+ return FfiConverterTypeSignedTransaction.lift(
+ uniffiRustCallWithError(AlgoKitTransactException) { _status ->
+ UniffiLib.INSTANCE.uniffi_algokit_transact_ffi_fn_func_decode_signed_transaction(
+ FfiConverterByteArray.lower(`bytes`),_status)
+}
+ )
+ }
+
+
+ /**
+ * Decodes a collection of MsgPack bytes into a signed transaction collection.
+ *
+ * # Parameters
+ * * `encoded_signed_txs` - A collection of MsgPack encoded bytes, each representing a signed transaction.
+ *
+ * # Returns
+ * A collection of decoded signed transactions or an error if decoding fails.
+ */
+ @Throws(AlgoKitTransactException::class) fun `decodeSignedTransactions`(`encodedSignedTxs`: List): List {
+ return FfiConverterSequenceTypeSignedTransaction.lift(
+ uniffiRustCallWithError(AlgoKitTransactException) { _status ->
+ UniffiLib.INSTANCE.uniffi_algokit_transact_ffi_fn_func_decode_signed_transactions(
+ FfiConverterSequenceByteArray.lower(`encodedSignedTxs`),_status)
+}
+ )
+ }
+
+
+ /**
+ * Decodes MsgPack bytes into a transaction.
+ *
+ * # Parameters
+ * * `encoded_tx` - MsgPack encoded bytes representing a transaction.
+ *
+ * # Returns
+ * A decoded transaction or an error if decoding fails.
+ */
+ @Throws(AlgoKitTransactException::class) fun `decodeTransaction`(`encodedTx`: kotlin.ByteArray): Transaction {
+ return FfiConverterTypeTransaction.lift(
+ uniffiRustCallWithError(AlgoKitTransactException) { _status ->
+ UniffiLib.INSTANCE.uniffi_algokit_transact_ffi_fn_func_decode_transaction(
+ FfiConverterByteArray.lower(`encodedTx`),_status)
+}
+ )
+ }
+
+
+ /**
+ * Decodes a collection of MsgPack bytes into a transaction collection.
+ *
+ * # Parameters
+ * * `encoded_txs` - A collection of MsgPack encoded bytes, each representing a transaction.
+ *
+ * # Returns
+ * A collection of decoded transactions or an error if decoding fails.
+ */
+ @Throws(AlgoKitTransactException::class) fun `decodeTransactions`(`encodedTxs`: List): List {
+ return FfiConverterSequenceTypeTransaction.lift(
+ uniffiRustCallWithError(AlgoKitTransactException) { _status ->
+ UniffiLib.INSTANCE.uniffi_algokit_transact_ffi_fn_func_decode_transactions(
+ FfiConverterSequenceByteArray.lower(`encodedTxs`),_status)
+}
+ )
+ }
+
+
+ @Throws(AlgoKitTransactException::class) fun `encodeJsonToBase64Msgpack`(`modelType`: ModelType, `jsonStr`: kotlin.String): kotlin.String {
+ return FfiConverterString.lift(
+ uniffiRustCallWithError(AlgoKitTransactException) { _status ->
+ UniffiLib.INSTANCE.uniffi_algokit_transact_ffi_fn_func_encode_json_to_base64_msgpack(
+ FfiConverterTypeModelType.lower(`modelType`),FfiConverterString.lower(`jsonStr`),_status)
+}
+ )
+ }
+
+
+ @Throws(AlgoKitTransactException::class) fun `encodeJsonToMsgpack`(`modelType`: ModelType, `jsonStr`: kotlin.String): kotlin.ByteArray {
+ return FfiConverterByteArray.lift(
+ uniffiRustCallWithError(AlgoKitTransactException) { _status ->
+ UniffiLib.INSTANCE.uniffi_algokit_transact_ffi_fn_func_encode_json_to_msgpack(
+ FfiConverterTypeModelType.lower(`modelType`),FfiConverterString.lower(`jsonStr`),_status)
+}
+ )
+ }
+
+
+ /**
+ * Encode a signed transaction to MsgPack for sending on the network.
+ *
+ * This method performs canonical encoding. No domain separation prefix is applicable.
+ *
+ * # Parameters
+ * * `signed_tx` - The signed transaction to encode
+ *
+ * # Returns
+ * The MsgPack encoded bytes or an error if encoding fails.
+ */
+ @Throws(AlgoKitTransactException::class) fun `encodeSignedTransaction`(`signedTx`: SignedTransaction): kotlin.ByteArray {
+ return FfiConverterByteArray.lift(
+ uniffiRustCallWithError(AlgoKitTransactException) { _status ->
+ UniffiLib.INSTANCE.uniffi_algokit_transact_ffi_fn_func_encode_signed_transaction(
+ FfiConverterTypeSignedTransaction.lower(`signedTx`),_status)
+}
+ )
+ }
+
+
+ /**
+ * Encode signed transactions to MsgPack for sending on the network.
+ *
+ * This method performs canonical encoding. No domain separation prefix is applicable.
+ *
+ * # Parameters
+ * * `signed_txs` - A collection of signed transactions to encode
+ *
+ * # Returns
+ * A collection of MsgPack encoded bytes or an error if encoding fails.
+ */
+ @Throws(AlgoKitTransactException::class) fun `encodeSignedTransactions`(`signedTxs`: List): List {
+ return FfiConverterSequenceByteArray.lift(
+ uniffiRustCallWithError(AlgoKitTransactException) { _status ->
+ UniffiLib.INSTANCE.uniffi_algokit_transact_ffi_fn_func_encode_signed_transactions(
+ FfiConverterSequenceTypeSignedTransaction.lower(`signedTxs`),_status)
+}
+ )
+ }
+
+
+ /**
+ * Encode the transaction with the domain separation (e.g. "TX") prefix
+ */
+ @Throws(AlgoKitTransactException::class) fun `encodeTransaction`(`tx`: Transaction): kotlin.ByteArray {
+ return FfiConverterByteArray.lift(
+ uniffiRustCallWithError(AlgoKitTransactException) { _status ->
+ UniffiLib.INSTANCE.uniffi_algokit_transact_ffi_fn_func_encode_transaction(
+ FfiConverterTypeTransaction.lower(`tx`),_status)
+}
+ )
+ }
+
+
+ /**
+ * Encode the transaction without the domain separation (e.g. "TX") prefix
+ * This is useful for encoding the transaction for signing with tools that automatically add "TX" prefix to the transaction bytes.
+ */
+ @Throws(AlgoKitTransactException::class) fun `encodeTransactionRaw`(`tx`: Transaction): kotlin.ByteArray {
+ return FfiConverterByteArray.lift(
+ uniffiRustCallWithError(AlgoKitTransactException) { _status ->
+ UniffiLib.INSTANCE.uniffi_algokit_transact_ffi_fn_func_encode_transaction_raw(
+ FfiConverterTypeTransaction.lower(`tx`),_status)
+}
+ )
+ }
+
+
+ /**
+ * Encode transactions to MsgPack with the domain separation (e.g. "TX") prefix.
+ *
+ * # Parameters
+ * * `txs` - A collection of transactions to encode
+ *
+ * # Returns
+ * A collection of MsgPack encoded bytes or an error if encoding fails.
+ */
+ @Throws(AlgoKitTransactException::class) fun `encodeTransactions`(`txs`: List): List {
+ return FfiConverterSequenceByteArray.lift(
+ uniffiRustCallWithError(AlgoKitTransactException) { _status ->
+ UniffiLib.INSTANCE.uniffi_algokit_transact_ffi_fn_func_encode_transactions(
+ FfiConverterSequenceTypeTransaction.lower(`txs`),_status)
+}
+ )
+ }
+
+
+ /**
+ * Return the size of the transaction in bytes as if it was already signed and encoded.
+ * This is useful for estimating the fee for the transaction.
+ */
+ @Throws(AlgoKitTransactException::class) fun `estimateTransactionSize`(`transaction`: Transaction): kotlin.ULong {
+ return FfiConverterULong.lift(
+ uniffiRustCallWithError(AlgoKitTransactException) { _status ->
+ UniffiLib.INSTANCE.uniffi_algokit_transact_ffi_fn_func_estimate_transaction_size(
+ FfiConverterTypeTransaction.lower(`transaction`),_status)
+}
+ )
+ }
+
+ fun `getAlgorandConstant`(`constant`: AlgorandConstant): kotlin.ULong {
+ return FfiConverterULong.lift(
+ uniffiRustCall() { _status ->
+ UniffiLib.INSTANCE.uniffi_algokit_transact_ffi_fn_func_get_algorand_constant(
+ FfiConverterTypeAlgorandConstant.lower(`constant`),_status)
+}
+ )
+ }
+
+
+ /**
+ * Get the transaction type from the encoded transaction.
+ * This is particularly useful when decoding a transaction that has an unknown type
+ */
+ @Throws(AlgoKitTransactException::class) fun `getEncodedTransactionType`(`bytes`: kotlin.ByteArray): TransactionType {
+ return FfiConverterTypeTransactionType.lift(
+ uniffiRustCallWithError(AlgoKitTransactException) { _status ->
+ UniffiLib.INSTANCE.uniffi_algokit_transact_ffi_fn_func_get_encoded_transaction_type(
+ FfiConverterByteArray.lower(`bytes`),_status)
+}
+ )
+ }
+
+
+ /**
+ * Get the base32 transaction ID string for a transaction.
+ */
+ @Throws(AlgoKitTransactException::class) fun `getTransactionId`(`tx`: Transaction): kotlin.String {
+ return FfiConverterString.lift(
+ uniffiRustCallWithError(AlgoKitTransactException) { _status ->
+ UniffiLib.INSTANCE.uniffi_algokit_transact_ffi_fn_func_get_transaction_id(
+ FfiConverterTypeTransaction.lower(`tx`),_status)
+}
+ )
+ }
+
+
+ /**
+ * Get the raw 32-byte transaction ID for a transaction.
+ */
+ @Throws(AlgoKitTransactException::class) fun `getTransactionIdRaw`(`tx`: Transaction): kotlin.ByteArray {
+ return FfiConverterByteArray.lift(
+ uniffiRustCallWithError(AlgoKitTransactException) { _status ->
+ UniffiLib.INSTANCE.uniffi_algokit_transact_ffi_fn_func_get_transaction_id_raw(
+ FfiConverterTypeTransaction.lower(`tx`),_status)
+}
+ )
+ }
+
+
+ /**
+ * Groups a collection of transactions by calculating and assigning the group to each transaction.
+ */
+ @Throws(AlgoKitTransactException::class) fun `groupTransactions`(`txs`: List): List {
+ return FfiConverterSequenceTypeTransaction.lift(
+ uniffiRustCallWithError(AlgoKitTransactException) { _status ->
+ UniffiLib.INSTANCE.uniffi_algokit_transact_ffi_fn_func_group_transactions(
+ FfiConverterSequenceTypeTransaction.lower(`txs`),_status)
+}
+ )
+ }
+
+ fun `supportedModels`(): List {
+ return FfiConverterSequenceTypeModelType.lift(
+ uniffiRustCall() { _status ->
+ UniffiLib.INSTANCE.uniffi_algokit_transact_ffi_fn_func_supported_models(
+ _status)
+}
+ )
+ }
+
+
+
diff --git a/packages/android/algokit_transact/transact/src/test/kotlin/com/example/transact/ExampleUnitTest.kt b/packages/android/algokit_transact/transact/src/test/kotlin/com/example/transact/ExampleUnitTest.kt
new file mode 100644
index 00000000..03a82e68
--- /dev/null
+++ b/packages/android/algokit_transact/transact/src/test/kotlin/com/example/transact/ExampleUnitTest.kt
@@ -0,0 +1,17 @@
+package com.example.transact
+
+import org.junit.Test
+
+import org.junit.Assert.*
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+class ExampleUnitTest {
+ @Test
+ fun addition_isCorrect() {
+ assertEquals(4, 2 + 2)
+ }
+}
\ No newline at end of file
diff --git a/tools/build_pkgs/src/kotlin.rs b/tools/build_pkgs/src/kotlin.rs
new file mode 100644
index 00000000..4014365b
--- /dev/null
+++ b/tools/build_pkgs/src/kotlin.rs
@@ -0,0 +1,42 @@
+use crate::{Package, get_repo_root, run};
+use color_eyre::eyre::Result;
+
+pub fn build(package: &Package) -> Result<()> {
+ let so_file_output_dir = get_repo_root()
+ .join("packages")
+ .join("android")
+ .join(package.to_string())
+ .join(package.to_string().replace("algokit_", ""))
+ .join("src")
+ .join("main")
+ .join("jniLibs");
+
+ let kotlin_out_dir = get_repo_root()
+ .join("packages")
+ .join("android")
+ .join(package.to_string())
+ .join(package.to_string().replace("algokit_", ""))
+ .join("src")
+ .join("main")
+ .join("kotlin");
+
+ let cargo_build_cmd = format!(
+ "cargo ndk -o {} --manifest-path {} -t armeabi-v7a -t arm64-v8a -t x86_64 build --release",
+ so_file_output_dir.display(),
+ package.crate_manifest().display()
+ );
+
+ run(&cargo_build_cmd, None, None)?;
+
+ run(
+ &format!(
+ "cargo run -p uniffi-bindgen generate --library {} --language kotlin --out-dir {}",
+ package.dylib(Some("aarch64-linux-android")).display(),
+ kotlin_out_dir.display()
+ ),
+ None,
+ None,
+ )?;
+
+ Ok(())
+}
diff --git a/tools/build_pkgs/src/main.rs b/tools/build_pkgs/src/main.rs
index be529213..c5843707 100644
--- a/tools/build_pkgs/src/main.rs
+++ b/tools/build_pkgs/src/main.rs
@@ -1,3 +1,4 @@
+mod kotlin;
mod python;
mod swift;
mod typescript;
@@ -19,6 +20,8 @@ enum Language {
#[value(alias = "ts")]
Typescript,
Swift,
+ #[value(alias = "kt")]
+ Kotlin,
}
impl Display for Language {
@@ -27,6 +30,7 @@ impl Display for Language {
Language::Python => f.write_str("python"),
Language::Typescript => f.write_str("typescript"),
Language::Swift => f.write_str("swift"),
+ Language::Kotlin => f.write_str("kotlin"),
}
}
}
@@ -37,6 +41,7 @@ impl Language {
Self::Python => python::build(pkg),
Self::Typescript => typescript::build(pkg),
Self::Swift => swift::build(pkg),
+ Self::Kotlin => kotlin::build(pkg),
}
}
@@ -75,23 +80,29 @@ impl Package {
self.crate_dir().join("Cargo.toml")
}
- fn dylib(&self) -> PathBuf {
+ fn dylib(&self, target: Option<&str>) -> PathBuf {
let mut prefix = "lib";
- let ext = if cfg!(target_os = "windows") {
+ let ext = if target.map_or(cfg!(target_os = "windows"), |t| t.contains("windows")) {
prefix = "";
"dll"
- } else if cfg!(target_os = "macos") {
+ } else if target.map_or(cfg!(target_os = "macos"), |t| t.contains("darwin")) {
"dylib"
} else {
"so"
};
- get_repo_root().join("target").join("release").join(format!(
- "{}{}.{}",
- prefix,
- self.crate_name(),
- ext
- ))
+ let mut lib_path = get_repo_root().join("target");
+
+ if let Some(target) = target {
+ lib_path = lib_path.join(target);
+ }
+
+ lib_path =
+ lib_path
+ .join("release")
+ .join(format!("{}{}.{}", prefix, self.crate_name(), ext));
+
+ lib_path
}
}
diff --git a/tools/build_pkgs/src/python.rs b/tools/build_pkgs/src/python.rs
index bb186d24..57de192c 100644
--- a/tools/build_pkgs/src/python.rs
+++ b/tools/build_pkgs/src/python.rs
@@ -2,15 +2,6 @@ use crate::{Package, get_repo_root, run};
use color_eyre::eyre::{Result, eyre};
pub fn build(package: &Package) -> Result<()> {
- let crate_name = package.crate_name();
- let ext = if cfg!(target_os = "windows") {
- "dll"
- } else if cfg!(target_os = "macos") {
- "dylib"
- } else {
- "so"
- };
-
run(
&format!(
r#"cargo --color always build --release --manifest-path "{}""#,
@@ -29,7 +20,7 @@ pub fn build(package: &Package) -> Result<()> {
run(
&format!(
r#"cargo --color always run -p uniffi-bindgen generate --no-format --library "{}" --language python --out-dir "{}""#,
- package.dylib().display(),
+ package.dylib(None).display(),
module_dir.display()
),
None,
@@ -37,8 +28,8 @@ pub fn build(package: &Package) -> Result<()> {
)?;
std::fs::copy(
- package.dylib(),
- module_dir.join(package.dylib().file_name().unwrap()),
+ package.dylib(None),
+ module_dir.join(package.dylib(None).file_name().unwrap()),
)?;
run("poetry install --only build", Some(&package_dir), None)?;
@@ -48,7 +39,7 @@ pub fn build(package: &Package) -> Result<()> {
if cfg!(target_os = "linux") {
let dist_files: Vec<_> = std::fs::read_dir(package_dir.join("dist"))?
.filter_map(Result::ok)
- .filter(|entry| entry.path().extension().map_or(false, |ext| ext == "whl"))
+ .filter(|entry| entry.path().extension().is_some_and(|ext| ext == "whl"))
.collect();
if dist_files.is_empty() {