diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..73ca041
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,21 @@
+on:
+ release:
+ types: [created]
+
+jobs:
+ build:
+ runs-on: macos-latest
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v2
+
+ - name: Setup Java
+ uses: actions/setup-java@v1
+ with:
+ java-version: 11
+
+ - name: Publish
+ run: ./gradlew check publish --no-configure-on-demand --no-daemon
+ env:
+ ORG_GRADLE_PROJECT_githubUsername: ${{ github.actor }}
+ ORG_GRADLE_PROJECT_githubPassword: ${{ github.token }}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..d5549b1
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,12 @@
+*.iml
+.gradle
+/local.properties
+.idea
+.DS_Store
+/build
+*/build
+/captures
+.externalNativeBuild
+.cxx
+local.properties
+.swiftpm
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..a88e57c
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,401 @@
+ Apache License
+
+ Version 2.0, January 2004
+
+ http://www.apache.org/licenses/
+
+
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+
+
+ 1. Definitions.
+
+
+
+ "License" shall mean the terms and conditions for use, reproduction,
+
+ and distribution as defined by Sections 1 through 9 of this document.
+
+
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+
+ the copyright owner that is granting the License.
+
+
+
+ "Legal Entity" shall mean the union of the acting entity and all
+
+ other entities that control, are controlled by, or are under common
+
+ control with that entity. For the purposes of this definition,
+
+ "control" means (i) the power, direct or indirect, to cause the
+
+ direction or management of such entity, whether by contract or
+
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+
+ exercising permissions granted by this License.
+
+
+
+ "Source" form shall mean the preferred form for making modifications,
+
+ including but not limited to software source code, documentation
+
+ source, and configuration files.
+
+
+
+ "Object" form shall mean any form resulting from mechanical
+
+ transformation or translation of a Source form, including but
+
+ not limited to compiled object code, generated documentation,
+
+ and conversions to other media types.
+
+
+
+ "Work" shall mean the work of authorship, whether in Source or
+
+ Object form, made available under the License, as indicated by a
+
+ copyright notice that is included in or attached to the work
+
+ (an example is provided in the Appendix below).
+
+
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+
+ form, that is based on (or derived from) the Work and for which the
+
+ editorial revisions, annotations, elaborations, or other modifications
+
+ represent, as a whole, an original work of authorship. For the purposes
+
+ of this License, Derivative Works shall not include works that remain
+
+ separable from, or merely link (or bind by name) to the interfaces of,
+
+ the Work and Derivative Works thereof.
+
+
+
+ "Contribution" shall mean any work of authorship, including
+
+ the original version of the Work and any modifications or additions
+
+ to that Work or Derivative Works thereof, that is intentionally
+
+ submitted to Licensor for inclusion in the Work by the copyright owner
+
+ or by an individual or Legal Entity authorized to submit on behalf of
+
+ the copyright owner. For the purposes of this definition, "submitted"
+
+ means any form of electronic, verbal, or written communication sent
+
+ to the Licensor or its representatives, including but not limited to
+
+ communication on electronic mailing lists, source code control systems,
+
+ and issue tracking systems that are managed by, or on behalf of, the
+
+ Licensor for the purpose of discussing and improving the Work, but
+
+ excluding communication that is conspicuously marked or otherwise
+
+ designated in writing by the copyright owner as "Not a Contribution."
+
+
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+
+ on behalf of whom a Contribution has been received by Licensor and
+
+ subsequently incorporated within the Work.
+
+
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+
+ this License, each Contributor hereby grants to You a perpetual,
+
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+
+ copyright license to reproduce, prepare Derivative Works of,
+
+ publicly display, publicly perform, sublicense, and distribute the
+
+ Work and such Derivative Works in Source or Object form.
+
+
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+
+ this License, each Contributor hereby grants to You a perpetual,
+
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+
+ (except as stated in this section) patent license to make, have made,
+
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+
+ where such license applies only to those patent claims licensable
+
+ by such Contributor that are necessarily infringed by their
+
+ Contribution(s) alone or by combination of their Contribution(s)
+
+ with the Work to which such Contribution(s) was submitted. If You
+
+ institute patent litigation against any entity (including a
+
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+
+ or a Contribution incorporated within the Work constitutes direct
+
+ or contributory patent infringement, then any patent licenses
+
+ granted to You under this License for that Work shall terminate
+
+ as of the date such litigation is filed.
+
+
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+
+ Work or Derivative Works thereof in any medium, with or without
+
+ modifications, and in Source or Object form, provided that You
+
+ meet the following conditions:
+
+
+
+ (a) You must give any other recipients of the Work or
+
+ Derivative Works a copy of this License; and
+
+
+
+ (b) You must cause any modified files to carry prominent notices
+
+ stating that You changed the files; and
+
+
+
+ (c) You must retain, in the Source form of any Derivative Works
+
+ that You distribute, all copyright, patent, trademark, and
+
+ attribution notices from the Source form of the Work,
+
+ excluding those notices that do not pertain to any part of
+
+ the Derivative Works; and
+
+
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+
+ distribution, then any Derivative Works that You distribute must
+
+ include a readable copy of the attribution notices contained
+
+ within such NOTICE file, excluding those notices that do not
+
+ pertain to any part of the Derivative Works, in at least one
+
+ of the following places: within a NOTICE text file distributed
+
+ as part of the Derivative Works; within the Source form or
+
+ documentation, if provided along with the Derivative Works; or,
+
+ within a display generated by the Derivative Works, if and
+
+ wherever such third-party notices normally appear. The contents
+
+ of the NOTICE file are for informational purposes only and
+
+ do not modify the License. You may add Your own attribution
+
+ notices within Derivative Works that You distribute, alongside
+
+ or as an addendum to the NOTICE text from the Work, provided
+
+ that such additional attribution notices cannot be construed
+
+ as modifying the License.
+
+
+
+ You may add Your own copyright statement to Your modifications and
+
+ may provide additional or different license terms and conditions
+
+ for use, reproduction, or distribution of Your modifications, or
+
+ for any such Derivative Works as a whole, provided Your use,
+
+ reproduction, and distribution of the Work otherwise complies with
+
+ the conditions stated in this License.
+
+
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+
+ any Contribution intentionally submitted for inclusion in the Work
+
+ by You to the Licensor shall be under the terms and conditions of
+
+ this License, without any additional terms or conditions.
+
+ Notwithstanding the above, nothing herein shall supersede or modify
+
+ the terms of any separate license agreement you may have executed
+
+ with Licensor regarding such Contributions.
+
+
+
+ 6. Trademarks. This License does not grant permission to use the trade
+
+ names, trademarks, service marks, or product names of the Licensor,
+
+ except as required for reasonable and customary use in describing the
+
+ origin of the Work and reproducing the content of the NOTICE file.
+
+
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+
+ agreed to in writing, Licensor provides the Work (and each
+
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+
+ implied, including, without limitation, any warranties or conditions
+
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+
+ appropriateness of using or redistributing the Work and assume any
+
+ risks associated with Your exercise of permissions under this License.
+
+
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+
+ whether in tort (including negligence), contract, or otherwise,
+
+ unless required by applicable law (such as deliberate and grossly
+
+ negligent acts) or agreed to in writing, shall any Contributor be
+
+ liable to You for damages, including any direct, indirect, special,
+
+ incidental, or consequential damages of any character arising as a
+
+ result of this License or out of the use or inability to use the
+
+ Work (including but not limited to damages for loss of goodwill,
+
+ work stoppage, computer failure or malfunction, or any and all
+
+ other commercial damages or losses), even if such Contributor
+
+ has been advised of the possibility of such damages.
+
+
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+
+ the Work or Derivative Works thereof, You may choose to offer,
+
+ and charge a fee for, acceptance of support, warranty, indemnity,
+
+ or other liability obligations and/or rights consistent with this
+
+ License. However, in accepting such obligations, You may act only
+
+ on Your own behalf and on Your sole responsibility, not on behalf
+
+ of any other Contributor, and only if You agree to indemnify,
+
+ defend, and hold each Contributor harmless for any liability
+
+ incurred by, or claims asserted against, such Contributor by reason
+
+ of your accepting any such warranty or additional liability.
+
+
+
+ END OF TERMS AND CONDITIONS
+
+
+
+ APPENDIX: How to apply the Apache License to your work.
+
+
+
+ To apply the Apache License to your work, attach the following
+
+ boilerplate notice, with the fields enclosed by brackets "[]"
+
+ replaced with your own identifying information. (Don't include
+
+ the brackets!) The text should be enclosed in the appropriate
+
+ comment syntax for the file format. We also recommend that a
+
+ file or class name and description of purpose be included on the
+
+ same "printed page" as the copyright notice for easier
+
+ identification within third-party archives.
+
+
+
+ Copyright 2019-2023 Dapper Labs, Inc.
+
+
+
+ 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
+
+
+
+ http://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.
diff --git a/Package.swift b/Package.swift
new file mode 100644
index 0000000..91e685a
--- /dev/null
+++ b/Package.swift
@@ -0,0 +1,21 @@
+// swift-tools-version:5.3
+import PackageDescription
+
+let package = Package(
+ name: "Flow",
+ platforms: [
+ .iOS(.v13)
+ ],
+ products: [
+ .library(
+ name: "Flow",
+ targets: ["Flow"]
+ ),
+ ],
+ targets: [
+ .binaryTarget(
+ name: "Flow",
+ path: "./flow/swiftpackage/Flow.xcframework"
+ ),
+ ]
+)
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..60f5b52
--- /dev/null
+++ b/README.md
@@ -0,0 +1,124 @@
+# Flow KMM SDK
+
+The Flow KMM SDK is an open-source Kotlin Multiplatform Mobile (KMM) library for building Android and iOS applications on the Flow blockchain. It provides a set of APIs for querying the blockchain, managing accounts, interacting with smart contracts, and handling cryptographic operations.
+
+## Features
+
+- Kotlin Multiplatform Mobile (KMM) support for Android and iOS
+- Flow Client for interacting with the Flow blockchain
+- Interacting with Flow smart contracts
+- Sending transactions to the Flow blockchain
+- Encode and decode Cadence values & type
+
+## Get Started
+
+#### Android
+
+```groovy
+dependencies {
+ implementation("org.onflow:flow:$flowKMMVersion")
+}
+```
+
+#### iOS
+
+We recommend to use Swift Package, and which can be installed via Xcode with the URL of this repository:
+
+```swift
+dependencies: [
+ .package(url: "https://github.com/onflow/flow-kmm", from: "$flowKMMVersion")
+]
+```
+
+## API & Examples
+
+The library communicates with access nodes via the Flow RESTful API. You can find the 📖 **RESTful API** documentation [here](https://docs.onflow.org/http-api). To start using the SDK, simply provide the desired chainID. You can configure the chainID as follows:
+
+##### Android
+
+```kotlin
+// Android - Mainnet
+val api = FlowApi(ChainId.Mainnet)
+
+// Testnet
+val api = FlowApi(ChainId.Testnet)
+
+// Custom Endpoint
+val accessProvider = ChainId.Custom("https://custom.access.endpoint", "Custom Chain")
+val api = FlowApi(accessProvider)
+```
+
+##### iOS
+
+```swift
+// iOS - Mainnet
+let api = FlowApi(chainId: ChainId.Mainnet())
+// Testnet
+let api = FlowApi(chainId: ChainId.Testnet())
+// Custom Endpoint
+let provider = ChainId.Custom(baseUrl: "https://custom.access.endpoint", description: "Custom Chain")
+let api = FlowApi(chainId: provider)
+```
+
+## Querying the Flow Network
+
+Once you've connected to an access node, you can interact with the Flow blockchain to obtain information on blocks, accounts, events, and transactions. In the following sections, we'll delve into the process of retrieving each of these entities.
+
+### Get Account
+
+Retrieve any account from Flow network's latest block or from a specified block height.
+
+📖 **Account address** is a unique account identifier. Be mindful about the `0x` prefix, you should use the prefix as a default representation but be careful and safely handle user inputs without the prefix.
+
+An account includes the following data:
+
+- **Address**: the account address.
+- **Balance**: balance of the account.
+- **Contracts**: list of contracts deployed to the account.
+- **Keys**: list of keys associated with the account.
+
+```kotlin
+// Android
+val account = api.getAccount("0x328649a25184b171")
+
+// iOS
+let account = try await api.getAccount(address: "0x328649a25184b171")
+```
+
+### Get Block
+
+Query the network for block by id, height or get the latest block.
+
+📖 **Block ID** is SHA3-256 hash of the entire block payload. This hash is stored as an ID field on any block response object (ie. response from `GetLatestBlock`).
+
+📖 **Block height** expresses the height of the block on the chain. The latest block height increases by one for every valid block produced.
+
+##### Android
+
+```kotlin
+// Get Latest Block
+val latestBlock = api.getBlock()
+
+// Get Block by id
+val block = api.getBlock(id = "e285bafe8372ae0ad9e0070218c35588b83a09a2a4fa0e1cdc71eedc2488bce1")
+```
+
+##### iOS
+
+```swift
+// Get Latest Block
+let latestBlock = try await api.getBlock(id: nil, blockHeight: nil, sealed: true)
+
+// Get Block by id
+let block = try await api.getBlock(id: "e285bafe8372ae0ad9e0070218c35588b83a09a2a4fa0e1cdc71eedc2488bce1",
+ blockHeight: nil,
+ sealed: true)
+```
+
+## Contributing
+
+We welcome contributions to the Flow KMM SDK! Please read our [CONTRIBUTING.md](https://chat.openai.com/CONTRIBUTING.md) file for guidelines on submitting issues, feature requests, and pull requests.
+
+## License
+
+The Flow KMM SDK is released under the [MIT License](https://chat.openai.com/LICENSE).
\ No newline at end of file
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000..8eb268c
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,28 @@
+buildscript {
+ repositories {
+ gradlePluginPortal()
+ google()
+ mavenCentral()
+ }
+ dependencies {
+ classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0")
+ // downgraded to 4.2.2 from 7.2.1 to support intellij IDEA development
+ classpath("com.android.tools.build:gradle:4.2.2")
+ }
+}
+
+allprojects {
+ repositories {
+ google()
+ mavenCentral()
+ maven { setUrl("https://jitpack.io") }
+ }
+
+ group = "org.onflow.flow"
+ val defaultVersion = "0.0.1"
+ version = System.getenv("GITHUB_REF")?.split('/')?.last() ?: defaultVersion
+}
+
+tasks.register("clean", Delete::class) {
+ delete(rootProject.buildDir)
+}
\ No newline at end of file
diff --git a/flow/build.gradle.kts b/flow/build.gradle.kts
new file mode 100644
index 0000000..6875b2d
--- /dev/null
+++ b/flow/build.gradle.kts
@@ -0,0 +1,100 @@
+import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFramework
+import java.lang.System.getenv
+
+plugins {
+ kotlin("multiplatform")
+ kotlin("plugin.serialization") version "1.8.0"
+ id("com.android.library")
+ id("io.github.luca992.multiplatform-swiftpackage") version "2.0.5-arm64"
+ id("maven-publish")
+}
+
+multiplatformSwiftPackage {
+ swiftToolsVersion("5.3")
+ targetPlatforms {
+ iOS { v("13") }
+ }
+}
+
+kotlin {
+ android {
+ publishLibraryVariants("release", "debug")
+ }
+
+ val xcf = XCFramework()
+ ios {
+ binaries {
+ framework {
+ baseName = "Flow"
+ xcf.add(this)
+ }
+ }
+ }
+
+ val coroutineVersion = "1.6.4"
+ val ktorVersion = "2.1.3"
+
+ sourceSets {kotlin
+ val commonMain by getting {
+ dependencies {
+ implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutineVersion") {
+ version {
+ strictly(coroutineVersion)
+ }
+ }
+
+ implementation("io.ktor:ktor-client-core:$ktorVersion")
+ implementation("io.ktor:ktor-utils:$ktorVersion")
+ implementation("io.ktor:ktor-client-logging:$ktorVersion")
+ implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
+ implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
+
+ implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1")
+ implementation("com.ionspin.kotlin:bignum:0.3.7")
+ implementation("com.ionspin.kotlin:bignum-serialization-kotlinx:0.3.2")
+ }
+ }
+ val commonTest by getting {
+ dependencies {
+ implementation(kotlin("test"))
+ }
+ }
+ val androidMain by getting {
+ dependencies {
+ implementation("io.ktor:ktor-client-okhttp:$ktorVersion")
+ implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutineVersion")
+ }
+ }
+ val iosMain by getting {
+ dependencies {
+ implementation("io.ktor:ktor-client-darwin:$ktorVersion")
+ implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-native:1.3.8")
+ }
+ }
+ val iosTest by getting
+ }
+}
+
+android {
+ compileSdk = 32
+ sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
+ defaultConfig {
+ minSdk = 21
+ targetSdk = 32
+ }
+}
+
+getenv("GITHUB_REPOSITORY")?.let {
+ publishing {
+ repositories {
+ maven {
+ name = "github"
+ url = uri("https://maven.pkg.github.com/$it")
+ credentials(PasswordCredentials::class)
+ }
+ }
+ }
+}
+
+tasks.named("build") { finalizedBy("createXCFramework") }
+tasks.named("clean") { doFirst { delete("swiftpackage") } }
diff --git a/flow/src/androidMain/AndroidManifest.xml b/flow/src/androidMain/AndroidManifest.xml
new file mode 100644
index 0000000..3ec542e
--- /dev/null
+++ b/flow/src/androidMain/AndroidManifest.xml
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/flow/src/androidMain/kotlin/org/onflow/flow/infrastructure/FixedPointFormatter.kt b/flow/src/androidMain/kotlin/org/onflow/flow/infrastructure/FixedPointFormatter.kt
new file mode 100644
index 0000000..9970ed9
--- /dev/null
+++ b/flow/src/androidMain/kotlin/org/onflow/flow/infrastructure/FixedPointFormatter.kt
@@ -0,0 +1,10 @@
+package org.onflow.flow.infrastructure
+
+import java.math.BigDecimal
+
+actual object FixedPointFormatter {
+ actual fun format(num: String, precision: ULong): String? {
+ val bd = BigDecimal(num)
+ return String.format("%.8f", bd)
+ }
+}
\ No newline at end of file
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/ChainId.kt b/flow/src/commonMain/kotlin/org/onflow/flow/ChainId.kt
new file mode 100644
index 0000000..d34c0a7
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/ChainId.kt
@@ -0,0 +1,38 @@
+package org.onflow.flow
+
+interface ChainIdProvider {
+ val baseUrl: String
+ val description: String
+}
+
+sealed class ChainId: ChainIdProvider {
+ object Mainnet: ChainId() {
+ override val baseUrl: String = "https://rest-mainnet.onflow.org/v1"
+ override val description: String = "Flow Mainnet"
+ }
+
+ object Testnet: ChainId() {
+ override val baseUrl: String = "https://rest-testnet.onflow.org/v1"
+ override val description: String = "Flow Testnet"
+ }
+
+ object Canary: ChainId() {
+ override val baseUrl: String = "https://rest-canary.onflow.org/v1"
+ override val description: String = "Flow Canary"
+ }
+
+ object Sandboxnet: ChainId() {
+ override val baseUrl: String = "https://rest-sandboxnet.onflow.org/v1"
+ override val description: String = "Flow Sandboxnet"
+ }
+
+ object Emulator: ChainId() {
+ override val baseUrl: String = "http://localhost:8888/v1"
+ override val description: String = "Flow Emulator"
+ }
+
+ data class Custom(
+ override val baseUrl: String,
+ override val description: String
+ ): ChainId()
+}
\ No newline at end of file
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/FlowApi.kt b/flow/src/commonMain/kotlin/org/onflow/flow/FlowApi.kt
new file mode 100644
index 0000000..5aed12a
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/FlowApi.kt
@@ -0,0 +1,88 @@
+package org.onflow.flow
+
+import org.onflow.flow.apis.AccountsApi
+import org.onflow.flow.apis.BlocksApi
+import org.onflow.flow.apis.CollectionsApi
+import org.onflow.flow.apis.EventsApi
+import org.onflow.flow.apis.ExecutionResultsApi
+import org.onflow.flow.apis.ScriptsApi
+import org.onflow.flow.apis.TransactionsApi
+import org.onflow.flow.infrastructure.Cadence
+import org.onflow.flow.models.Account
+import org.onflow.flow.models.Block
+import org.onflow.flow.models.BlockEvents
+import org.onflow.flow.models.BlockHeader
+import org.onflow.flow.models.Collection
+import org.onflow.flow.models.ExecutionResult
+import org.onflow.flow.models.Transaction
+import org.onflow.flow.models.TransactionResult
+
+class FlowApi(val chainId: ChainIdProvider) {
+
+ private val baseUrl = chainId.baseUrl.toString()
+ private val accountsApi = AccountsApi(baseUrl)
+ private val blocksApi = BlocksApi(baseUrl)
+ private val collectionsApi = CollectionsApi(baseUrl)
+ private val eventsApi = EventsApi(baseUrl)
+ private val executionResultsApi = ExecutionResultsApi(baseUrl)
+ private val scriptsApi = ScriptsApi(baseUrl)
+ private val transactionsApi = TransactionsApi(baseUrl)
+
+ suspend fun getAccount(address: String, blockHeight: String? = null, sealed: Boolean = true): Account {
+ return accountsApi.getAccount(address, blockHeight, sealed)
+ }
+
+ suspend fun getBlock(id: String? = null, blockHeight: String? = null, sealed: Boolean = true): Block {
+ return blocksApi.getBlock(id, blockHeight, sealed)
+ }
+
+ suspend fun getBlockHeader(
+ id: String? = null,
+ blockHeight: String? = null,
+ sealed: Boolean = true
+ ): BlockHeader {
+ return blocksApi.getBlockHeader(id, blockHeight, sealed)
+ }
+
+ suspend fun getCollection(id: String): Collection {
+ return collectionsApi.getCollection(id)
+ }
+
+ suspend fun getEvents(
+ type: String,
+ startHeight: String? = null,
+ endHeight: String? = null,
+ blockIds: Set? = null
+ ): BlockEvents {
+ return eventsApi.getEvents(type, startHeight, endHeight, blockIds)
+ }
+
+ suspend fun getExecutionResult(id: String): ExecutionResult {
+ return executionResultsApi.getExecutionResult(id)
+ }
+
+ suspend fun getExecutionResults(blockId: Set): List {
+ return executionResultsApi.getExecutionResults(blockId)
+ }
+
+ suspend fun executeScript(
+ script: String,
+ arguments: List? = null,
+ blockId: String? = null,
+ blockHeight: String? = null
+ ): Cadence.Value {
+ return scriptsApi.executeScript(script, arguments, blockId, blockHeight)
+ }
+
+ suspend fun getTransactionResult(transactionId: String): TransactionResult {
+ return transactionsApi.getTransactionResult(transactionId)
+ }
+
+ suspend fun getTransaction(transactionId: String): Transaction {
+ return transactionsApi.getTransaction(transactionId)
+ }
+
+ suspend fun sendTransaction(request: Transaction): Transaction {
+ return transactionsApi.sendTransaction(request)
+ }
+}
\ No newline at end of file
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/apis/AccountsApi.kt b/flow/src/commonMain/kotlin/org/onflow/flow/apis/AccountsApi.kt
new file mode 100644
index 0000000..6b4b209
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/apis/AccountsApi.kt
@@ -0,0 +1,48 @@
+package org.onflow.flow.apis
+
+import io.ktor.client.call.body
+import io.ktor.client.request.get
+import io.ktor.client.request.parameter
+import org.onflow.flow.infrastructure.ApiBase
+import org.onflow.flow.infrastructure.toMultiValue
+import org.onflow.flow.models.Account
+
+internal class AccountsApi(val baseUrl: String) : ApiBase() {
+
+ private suspend fun request(
+ address: String,
+ blockHeight: String? = null,
+ expand: Set? = null
+ ): Account {
+
+ val queryParams = mutableMapOf>()
+ blockHeight?.apply { queryParams["block_height"] = listOf("$blockHeight") }
+ expand?.apply { queryParams["expand"] = toMultiValue(this, "csv") }
+
+ return client.get("$baseUrl/accounts/$address") {
+ queryParams.forEach { queryParam ->
+ queryParam.value.forEach { value ->
+ parameter(queryParam.key, value)
+ }
+ }
+ }.body()
+ }
+
+ /**
+ * Get an Account By Address
+ * Get an account data by provided address in latest \"sealed\" block or by provided block height.
+ * @param address The address of the account.
+ * @param blockHeight The block height to query for the account details at the \"sealed\" is used by default. (optional)
+ * @return Account
+ */
+ internal suspend fun getAccount(address: String, blockHeight: String? = null, sealed: Boolean = true): Account {
+ val expand = setOf("contracts", "keys")
+ return if (blockHeight != null) {
+ request(address, blockHeight, expand)
+ } else {
+ val height = if (sealed) "sealed" else "final"
+ request(address, height, expand)
+ }
+ }
+
+}
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/apis/BlocksApi.kt b/flow/src/commonMain/kotlin/org/onflow/flow/apis/BlocksApi.kt
new file mode 100644
index 0000000..29f6161
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/apis/BlocksApi.kt
@@ -0,0 +1,77 @@
+package org.onflow.flow.apis
+
+import org.onflow.flow.infrastructure.ApiBase
+import org.onflow.flow.infrastructure.toMultiValue
+import org.onflow.flow.models.Block
+
+import io.ktor.client.call.body
+import io.ktor.client.request.get
+import io.ktor.client.request.parameter
+import org.onflow.flow.models.BlockHeader
+
+internal class BlocksApi(val baseUrl: String) : ApiBase() {
+
+ private suspend fun requestBlocksByHeight(
+ height: Set? = null,
+ startHeight: String? = null,
+ endHeight: String? = null,
+ expand: Set? = null,
+ select: Set? = null
+ ): List {
+
+ val queryParams = mutableMapOf>()
+ height?.apply { queryParams["height"] = toMultiValue(this, "csv") }
+ startHeight?.apply { queryParams["start_height"] = listOf("$startHeight") }
+ endHeight?.apply { queryParams["end_height"] = listOf("$endHeight") }
+ expand?.apply { queryParams["expand"] = toMultiValue(this, "csv") }
+ select?.apply { queryParams["select"] = toMultiValue(this, "csv") }
+
+ return client.get("$baseUrl/blocks") {
+ queryParams.forEach { queryParam ->
+ queryParam.value.forEach { value ->
+ parameter(queryParam.key, value)
+ }
+ }
+ }.body()
+ }
+
+ private suspend fun requestBlocksById(
+ id: String,
+ expand: Set? = null,
+ select: Set? = null
+ ): List {
+
+ val queryParams = mutableMapOf>()
+ expand?.apply { queryParams["expand"] = toMultiValue(this, "csv") }
+ select?.apply { queryParams["select"] = toMultiValue(this, "csv") }
+
+ return client.get("$baseUrl/blocks/$id") {
+ queryParams.forEach { queryParam ->
+ queryParam.value.forEach { value ->
+ parameter(queryParam.key, value)
+ }
+ }
+ }.body()
+ }
+
+ internal suspend fun getBlock(id: String? = null, blockHeight: String? = null, sealed: Boolean = true): Block {
+ val expand = setOf("payload")
+ return if (id != null) {
+ requestBlocksById(id, expand).first()
+ } else if (blockHeight != null) {
+ requestBlocksByHeight(setOf(blockHeight), expand = expand).first()
+ } else {
+ val height = if (sealed) "sealed" else "final"
+ requestBlocksByHeight(setOf(height), expand = expand).first()
+ }
+ }
+
+ internal suspend fun getBlockHeader(
+ id: String? = null,
+ blockHeight: String? = null,
+ sealed: Boolean = true
+ ): BlockHeader {
+ return getBlock(id, blockHeight, sealed).header
+ }
+
+}
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/apis/CollectionsApi.kt b/flow/src/commonMain/kotlin/org/onflow/flow/apis/CollectionsApi.kt
new file mode 100644
index 0000000..6b10792
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/apis/CollectionsApi.kt
@@ -0,0 +1,38 @@
+package org.onflow.flow.apis
+
+import io.ktor.client.call.body
+import io.ktor.client.request.get
+import io.ktor.client.request.parameter
+import org.onflow.flow.infrastructure.ApiBase
+import org.onflow.flow.infrastructure.toMultiValue
+import org.onflow.flow.models.Collection
+
+internal class CollectionsApi(val baseUrl: String) : ApiBase() {
+
+ private suspend fun request(id: String, expand: Set? = null): Collection {
+
+ val queryParams = mutableMapOf>()
+ expand?.apply { queryParams["expand"] = toMultiValue(this, "csv") }
+
+ return client.get("$baseUrl/collections/$id") {
+ queryParams.forEach { queryParam ->
+ queryParam.value.forEach { value ->
+ parameter(queryParam.key, value)
+ }
+ }
+ }.body()
+ }
+
+ /**
+ * Gets a Collection by ID
+ * Get a collection by provided collection ID.
+ * @param id The collection ID.
+ * @return Collection
+ */
+ internal suspend fun getCollection(id: String): Collection {
+ val expand = setOf("transactions")
+ return request(id, expand)
+ }
+
+
+}
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/apis/EventsApi.kt b/flow/src/commonMain/kotlin/org/onflow/flow/apis/EventsApi.kt
new file mode 100644
index 0000000..5352b21
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/apis/EventsApi.kt
@@ -0,0 +1,55 @@
+package org.onflow.flow.apis
+
+import org.onflow.flow.infrastructure.ApiBase
+import org.onflow.flow.infrastructure.toMultiValue
+import io.ktor.client.call.body
+import io.ktor.client.request.get
+import io.ktor.client.request.parameter
+import org.onflow.flow.models.BlockEvents
+
+internal class EventsApi(val baseUrl: String) : ApiBase() {
+
+ private suspend fun request(
+ type: String,
+ startHeight: String? = null,
+ endHeight: String? = null,
+ blockIds: Set? = null,
+ select: Set? = null
+ ): BlockEvents {
+
+ val queryParams = mutableMapOf>()
+ type.apply { queryParams["type"] = listOf("$type") }
+ startHeight?.apply { queryParams["start_height"] = listOf("$startHeight") }
+ endHeight?.apply { queryParams["end_height"] = listOf("$endHeight") }
+ blockIds?.apply { queryParams["block_ids"] = toMultiValue(this, "csv") }
+ select?.apply { queryParams["select"] = toMultiValue(this, "csv") }
+
+ return client.get("$baseUrl/events") {
+ queryParams.forEach { queryParam ->
+ queryParam.value.forEach { value ->
+ parameter(queryParam.key, value)
+ }
+ }
+ }.body()
+ }
+
+ internal suspend fun getEvents(
+ type: String,
+ startHeight: String? = null,
+ endHeight: String? = null,
+ blockIds: Set? = null
+ ): BlockEvents {
+
+ require((startHeight != null) || (blockIds != null && blockIds.isNotEmpty())) {
+ "Either a block height range, or blockIDs must be specified."
+ }
+
+ return if (startHeight != null) {
+ request(type, startHeight, endHeight)
+ } else {
+ request(type, blockIds = blockIds)
+ }
+ }
+
+
+}
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/apis/ExecutionResultsApi.kt b/flow/src/commonMain/kotlin/org/onflow/flow/apis/ExecutionResultsApi.kt
new file mode 100644
index 0000000..9d8dc69
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/apis/ExecutionResultsApi.kt
@@ -0,0 +1,38 @@
+package org.onflow.flow.apis
+import io.ktor.client.call.body
+import io.ktor.client.request.get
+import io.ktor.client.request.parameter
+import org.onflow.flow.infrastructure.ApiBase
+import org.onflow.flow.infrastructure.toMultiValue
+import org.onflow.flow.models.ExecutionResult
+
+internal class ExecutionResultsApi(val baseUrl: String) : ApiBase() {
+
+ private suspend fun requestResults(blockId: Set): List {
+
+ val queryParams = mutableMapOf>()
+ blockId.apply { queryParams["block_id"] = toMultiValue(this, "csv") }
+
+ return client.get("$baseUrl/execution_results") {
+ queryParams.forEach { queryParam ->
+ queryParam.value.forEach { value ->
+ parameter(queryParam.key, value)
+ }
+ }
+ }.body()
+ }
+
+ private suspend fun requestResult(id: String): ExecutionResult {
+ return client.get("$baseUrl/execution_results/$id").body()
+ }
+
+ internal suspend fun getExecutionResult(id: String): ExecutionResult {
+ return requestResult(id)
+ }
+
+ internal suspend fun getExecutionResults(blockId: Set): List {
+ return requestResults(blockId)
+ }
+
+
+}
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/apis/ScriptsApi.kt b/flow/src/commonMain/kotlin/org/onflow/flow/apis/ScriptsApi.kt
new file mode 100644
index 0000000..9fceb27
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/apis/ScriptsApi.kt
@@ -0,0 +1,67 @@
+package org.onflow.flow.apis
+import org.onflow.flow.infrastructure.*
+import io.ktor.client.request.headers
+import io.ktor.client.request.parameter
+import io.ktor.client.request.post
+import io.ktor.client.request.setBody
+import io.ktor.client.statement.bodyAsText
+import io.ktor.util.decodeBase64String
+import io.ktor.util.encodeBase64
+import io.ktor.utils.io.core.toByteArray
+import kotlinx.serialization.encodeToString
+import kotlinx.serialization.json.Json
+import kotlinx.serialization.json.JsonElement
+import org.onflow.flow.models.ScriptsPostRequest
+
+internal class ScriptsApi(val baseUrl: String) : ApiBase() {
+
+ private suspend fun request(
+ scriptsPostRequest: ScriptsPostRequest,
+ blockId: String? = null,
+ blockHeight: String? = null
+ ): String {
+
+ val queryParams = mutableMapOf>()
+ blockId?.apply { queryParams["block_id"] = listOf("$blockId") }
+ blockHeight?.apply { queryParams["block_height"] = listOf("$blockHeight") }
+
+ val headers = mutableMapOf()
+ headers["Content-Type"] = "application/json"
+
+ val response = client.post("$baseUrl/scripts") {
+ queryParams.forEach { queryParam ->
+ queryParam.value.forEach { value ->
+ parameter(queryParam.key, value)
+ }
+ }
+ headers {
+ headers.forEach { header ->
+ append(header.key, header.value)
+ }
+ }
+ setBody(scriptsPostRequest)
+ }.bodyAsText()
+
+ return response.replace("\"", "").decodeBase64String()
+ }
+
+ internal suspend fun executeScript(
+ script: String,
+ arguments: List? = null,
+ blockId: String? = null,
+ blockHeight: String? = null
+ ): Cadence.Value {
+ val request = ScriptsPostRequest(
+ script.encodeBase64(),
+ arguments?.map { it.encodeBase64() })
+ val response = if (blockId != null) {
+ request(request, blockId)
+ } else if (blockHeight != null) {
+ request(request, blockHeight = blockHeight)
+ } else {
+ request(request, blockHeight = "sealed")
+ }
+
+ return Cadence.Value.decodeFromJson(response)
+ }
+}
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/apis/TransactionsApi.kt b/flow/src/commonMain/kotlin/org/onflow/flow/apis/TransactionsApi.kt
new file mode 100644
index 0000000..b96ddf1
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/apis/TransactionsApi.kt
@@ -0,0 +1,78 @@
+package org.onflow.flow.apis
+import io.ktor.client.call.body
+import io.ktor.client.request.get
+import io.ktor.client.request.headers
+import io.ktor.client.request.parameter
+import io.ktor.client.request.post
+import io.ktor.client.request.setBody
+import org.onflow.flow.infrastructure.ApiBase
+import org.onflow.flow.infrastructure.toMultiValue
+import org.onflow.flow.models.Transaction
+import org.onflow.flow.models.TransactionResult
+
+internal class TransactionsApi(val baseUrl: String) : ApiBase() {
+
+ private suspend fun requestTransactionResultById(
+ transactionId: String,
+ expand: Set? = null,
+ select: Set? = null
+ ): TransactionResult {
+
+ val queryParams = mutableMapOf>()
+ expand?.apply { queryParams["expand"] = toMultiValue(this, "csv") }
+ select?.apply { queryParams["select"] = toMultiValue(this, "csv") }
+
+ return client.get("$baseUrl/transaction_results/$transactionId") {
+ queryParams.forEach { queryParam ->
+ queryParam.value.forEach { value ->
+ parameter(queryParam.key, value)
+ }
+ }
+ }.body()
+ }
+
+ private suspend fun requestTransactionById(
+ id: String,
+ expand: Set? = null,
+ select: Set? = null
+ ): Transaction {
+
+ val queryParams = mutableMapOf>()
+ expand?.apply { queryParams["expand"] = toMultiValue(this, "csv") }
+ select?.apply { queryParams["select"] = toMultiValue(this, "csv") }
+
+ return client.get("$baseUrl/transactions/$id") {
+ queryParams.forEach { queryParam ->
+ queryParam.value.forEach { value ->
+ parameter(queryParam.key, value)
+ }
+ }
+ }.body()
+ }
+
+ private suspend fun requestSendTransaction(transaction: Transaction): Transaction {
+ val headers = mutableMapOf()
+ headers["Content-Type"] = "application/json"
+ return client.post("$baseUrl/transactions") {
+ headers {
+ headers.forEach { header ->
+ append(header.key, header.value)
+ }
+ }
+ setBody(transaction)
+ }.body()
+ }
+
+ internal suspend fun getTransactionResult(transactionId: String): TransactionResult {
+ return requestTransactionResultById(transactionId)
+ }
+
+ internal suspend fun getTransaction(transactionId: String): Transaction {
+ return requestTransactionById(transactionId)
+ }
+
+ internal suspend fun sendTransaction(request: Transaction): Transaction {
+ return requestSendTransaction(request)
+ }
+
+}
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/infrastructure/ApiAbstractions.kt b/flow/src/commonMain/kotlin/org/onflow/flow/infrastructure/ApiAbstractions.kt
new file mode 100644
index 0000000..b0f3143
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/infrastructure/ApiAbstractions.kt
@@ -0,0 +1,23 @@
+package org.onflow.flow.infrastructure
+
+typealias MultiValueMap = MutableMap>
+
+fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) {
+ "csv" -> ","
+ "tsv" -> "\t"
+ "pipe" -> "|"
+ "space" -> " "
+ else -> ""
+}
+
+val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" }
+
+fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter)
+ = toMultiValue(items.asIterable(), collectionFormat, map)
+
+fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List {
+ return when(collectionFormat) {
+ "multi" -> items.map(map)
+ else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map))
+ }
+}
\ No newline at end of file
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/infrastructure/ApiBase.kt b/flow/src/commonMain/kotlin/org/onflow/flow/infrastructure/ApiBase.kt
new file mode 100644
index 0000000..aa5d4f8
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/infrastructure/ApiBase.kt
@@ -0,0 +1,36 @@
+package org.onflow.flow.infrastructure
+
+import io.ktor.client.HttpClient
+import io.ktor.client.plugins.HttpRequestRetry
+import io.ktor.client.plugins.contentnegotiation.ContentNegotiation
+import io.ktor.client.plugins.logging.DEFAULT
+import io.ktor.client.plugins.logging.Logger
+import io.ktor.client.plugins.logging.Logging
+import io.ktor.client.plugins.logging.SIMPLE
+import io.ktor.serialization.kotlinx.json.json
+import kotlinx.serialization.json.Json
+
+open class ApiBase {
+
+ companion object {
+ val client = HttpClient {
+ install(HttpRequestRetry) {
+ retryOnServerErrors(maxRetries = 5)
+ exponentialDelay()
+ }
+
+ install(Logging) {
+ logger = Logger.DEFAULT
+ }
+
+ install(ContentNegotiation) {
+ json(Json {
+ prettyPrint = true
+ isLenient = true
+ ignoreUnknownKeys = true
+ })
+ }
+ }
+ }
+
+}
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/infrastructure/Base64ByteArray.kt b/flow/src/commonMain/kotlin/org/onflow/flow/infrastructure/Base64ByteArray.kt
new file mode 100644
index 0000000..31d1f3b
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/infrastructure/Base64ByteArray.kt
@@ -0,0 +1,37 @@
+package org.onflow.flow.infrastructure
+
+import io.ktor.util.decodeBase64Bytes
+import io.ktor.util.encodeBase64
+import io.ktor.util.hex
+import kotlinx.serialization.*
+import kotlinx.serialization.descriptors.*
+import kotlinx.serialization.encoding.*
+
+class Base64ByteArray(val bytes: ByteArray) {
+ @OptIn(ExperimentalSerializationApi::class)
+ @Serializer(Base64ByteArray::class)
+ companion object : KSerializer {
+ override val descriptor = PrimitiveSerialDescriptor("Base64ByteArray", PrimitiveKind.STRING)
+ override fun serialize(encoder: Encoder, value: Base64ByteArray) {
+ encoder.encodeString(value.bytes.encodeBase64())
+ }
+ override fun deserialize(decoder: Decoder): Base64ByteArray {
+ return Base64ByteArray(decoder.decodeString().decodeBase64Bytes())
+ }
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (other == null || this::class != other::class) return false
+ other as Base64ByteArray
+ return bytes.contentEquals(other.bytes)
+ }
+
+ override fun hashCode(): Int {
+ return bytes.contentHashCode()
+ }
+
+ override fun toString(): String {
+ return "Base64ByteArray(${hex(bytes)})"
+ }
+}
\ No newline at end of file
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/infrastructure/Cadence.kt b/flow/src/commonMain/kotlin/org/onflow/flow/infrastructure/Cadence.kt
new file mode 100644
index 0000000..8d99efd
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/infrastructure/Cadence.kt
@@ -0,0 +1,533 @@
+package org.onflow.flow.infrastructure
+
+import com.ionspin.kotlin.bignum.integer.BigInteger
+import com.ionspin.kotlin.bignum.serialization.kotlinx.humanReadableSerializerModule
+import io.ktor.util.*
+import io.ktor.utils.io.core.*
+import kotlinx.serialization.*
+import kotlinx.serialization.json.*
+import kotlinx.serialization.modules.SerializersModule
+import kotlinx.serialization.modules.plus
+import kotlinx.serialization.modules.polymorphic
+import kotlinx.serialization.modules.subclass
+
+class Cadence {
+
+ @Serializable(with = CadenceTypeSerializer::class)
+ enum class Type(val value: String) {
+ VOID(TYPE_VOID),
+ OPTIONAL(TYPE_OPTIONAL),
+ BOOLEAN(TYPE_BOOLEAN),
+ STRING(TYPE_STRING),
+ INT(TYPE_INT),
+ UINT(TYPE_UINT),
+ INT8(TYPE_INT8),
+ UINT8(TYPE_UINT8),
+ INT16(TYPE_INT16),
+ UINT16(TYPE_UINT16),
+ INT32(TYPE_INT32),
+ UINT32(TYPE_UINT32),
+ INT64(TYPE_INT64),
+ UINT64(TYPE_UINT64),
+ INT128(TYPE_INT128),
+ UINT128(TYPE_UINT128),
+ INT256(TYPE_INT256),
+ UINT256(TYPE_UINT256),
+ WORD8(TYPE_WORD8),
+ WORD16(TYPE_WORD16),
+ WORD32(TYPE_WORD32),
+ WORD64(TYPE_WORD64),
+ FIX64(TYPE_FIX64),
+ UFIX64(TYPE_UFIX64),
+ ARRAY(TYPE_ARRAY),
+ DICTIONARY(TYPE_DICTIONARY),
+ ADDRESS(TYPE_ADDRESS),
+ PATH(TYPE_PATH),
+ CAPABILITY(TYPE_CAPABILITY),
+ STRUCT(TYPE_STRUCT),
+ RESOURCE(TYPE_RESOURCE),
+ EVENT(TYPE_EVENT),
+ CONTRACT(TYPE_CONTRACT),
+ ENUM(TYPE_ENUM),
+
+ //TODO: Handle More Types
+ TYPE(TYPE_TYPE);
+
+ companion object {
+ fun findByKey(value: String, default: Type = Type.VOID): Type {
+ return Type.values().find { it.value == value } ?: default
+ }
+ }
+ }
+
+ @Polymorphic
+ @Serializable
+ sealed class Value {
+ abstract val value: Any?
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (other !is Value) return false
+ return this.encodeBase64() == other.encodeBase64()
+ }
+
+ override fun hashCode(): Int {
+ return encodeBase64().hashCode()
+ }
+
+ companion object {
+ private val serializersModule = SerializersModule {
+ polymorphic(Value::class) {
+ subclass(VoidValue::class)
+ subclass(BooleanValue::class)
+ subclass(StringValue::class)
+ subclass(OptionalValue::class)
+ subclass(AddressValue::class)
+ subclass(IntValue::class)
+ subclass(UIntValue::class)
+ subclass(Int8Value::class)
+ subclass(UInt8Value::class)
+ subclass(Int16Value::class)
+ subclass(UInt16Value::class)
+ subclass(Int32Value::class)
+ subclass(UInt32Value::class)
+ subclass(Int64Value::class)
+ subclass(UInt64Value::class)
+ subclass(Int128Value::class)
+ subclass(UInt128Value::class)
+ subclass(Int256Value::class)
+ subclass(UInt256Value::class)
+ subclass(Word8Value::class)
+ subclass(Word16Value::class)
+ subclass(Word32Value::class)
+ subclass(Word64Value::class)
+ subclass(Fix64Value::class)
+ subclass(UFix64Value::class)
+ subclass(ArrayValue::class)
+ subclass(DictionaryValue::class)
+ subclass(StructValue::class)
+ subclass(ContractValue::class)
+ subclass(EventValue::class)
+ subclass(EnumValue::class)
+ subclass(ResourceValue::class)
+ subclass(TypeValue::class)
+ subclass(PathValue::class)
+ subclass(CapabilityValue::class)
+ }
+ }
+
+ val jsonSerializer = Json {
+ serializersModule = Value.serializersModule + humanReadableSerializerModule
+ ignoreUnknownKeys = true
+ isLenient = true
+ classDiscriminator = "type"
+ }
+
+ fun decodeFromJsonElement(jsonElement: JsonElement): Value {
+ return jsonSerializer.decodeFromJsonElement(jsonElement)
+ }
+
+ fun decodeFromJson(jsonString: String): Value {
+ return jsonSerializer.decodeFromString(jsonString)
+ }
+
+ fun encodeToJsonString(Value: Value): String {
+ return Value.encode()
+ }
+
+ fun decodeFromBase64(base64String: String): Value {
+ return decodeFromJson(base64String.decodeBase64Bytes().decodeToString())
+ }
+ }
+
+ fun encode(): String {
+ return Value.jsonSerializer.encodeToString(this)
+ }
+
+ fun encodeBase64(): String {
+ return encode().toByteArray().encodeBase64()
+ }
+
+ fun decodeToAny(): Any? {
+ return when (this) {
+ is VoidValue -> { null }
+ is OptionalValue -> { value?.decodeToAny() }
+ is ArrayValue -> { value.map { it.decodeToAny() } }
+
+ // CompositeValue
+ is StructValue -> { value.toMap() }
+ is ContractValue -> { value.toMap() }
+ is EventValue -> { value.toMap() }
+ is ResourceValue -> { value.toMap() }
+ is EnumValue -> { value.toMap() }
+
+ is DictionaryValue -> {
+ value.associate {
+ it.key.decodeToAny() to it.value.decodeToAny()
+ }
+ }
+
+// is CapabilityValue -> { value.let { toMap(it) } }
+// is PathValue -> { value.let { toMap(it) } }
+//
+// // TODO: Handle type decode
+// is TypeValue -> { value.let { toMap(it) } }
+
+ else -> { value }
+ }
+ }
+
+ @Throws(Exception::class)
+ inline fun decode(): T {
+ val decode = decodeToAny()
+ val jsonElement = decode.toJsonElement()
+ return jsonSerializer.decodeFromJsonElement(jsonElement)
+ }
+
+ @Serializable
+ @SerialName(TYPE_BOOLEAN)
+ data class BooleanValue(override val value: Boolean): Value()
+
+ @Serializable
+ @SerialName(TYPE_STRING)
+ data class StringValue(override val value: String) : Value()
+
+ @Serializable
+ @SerialName(TYPE_VOID)
+ data class VoidValue(override val value: Unit? = null) : Value()
+
+ @Serializable
+ @SerialName(TYPE_OPTIONAL)
+ data class OptionalValue(override val value: Value?): Value()
+
+ @Serializable
+ @SerialName(TYPE_ADDRESS)
+ data class AddressValue(override val value: String): Value()
+
+ @Serializable
+ @SerialName(TYPE_INT)
+ data class IntValue(
+ @Serializable(IntCadenceSerializer::class)
+ override val value: Int): Value()
+
+ @Serializable
+ @SerialName(TYPE_UINT)
+ data class UIntValue(
+ @Serializable(UIntCadenceSerializer::class)
+ override val value: UInt): Value()
+
+ @Serializable
+ @SerialName(TYPE_INT8)
+ data class Int8Value(
+ @Serializable(ByteCadenceSerializer::class)
+ override val value: Byte): Value()
+
+ @Serializable
+ @SerialName(TYPE_UINT8)
+ data class UInt8Value(
+ @Serializable(UByteCadenceSerializer::class)
+ override val value: UByte): Value()
+
+ @Serializable
+ @SerialName(TYPE_INT16)
+ data class Int16Value(
+ @Serializable(ShortCadenceSerializer::class)
+ override val value: Short): Value()
+
+ @Serializable
+ @SerialName(TYPE_UINT16)
+ data class UInt16Value(
+ @Serializable(UShortCadenceSerializer::class)
+ override val value: UShort): Value()
+
+ @Serializable
+ @SerialName(TYPE_INT32)
+ data class Int32Value(
+ @Serializable(IntCadenceSerializer::class)
+ override val value: Int): Value()
+
+ @Serializable
+ @SerialName(TYPE_UINT32)
+ data class UInt32Value(
+ @Serializable(UIntCadenceSerializer::class)
+ override val value: UInt): Value()
+
+ @Serializable
+ @SerialName(TYPE_INT64)
+ data class Int64Value(
+ @Serializable(LongCadenceSerializer::class)
+ override val value: Long): Value()
+
+ @Serializable
+ @SerialName(TYPE_UINT64)
+ data class UInt64Value(
+ @Serializable(ULongCadenceSerializer::class)
+ override val value: ULong): Value()
+
+ @Serializable
+ @SerialName(TYPE_INT128)
+ data class Int128Value(
+ @Serializable(BigIntegerCadenceSerializer::class)
+ override val value: BigInteger): Value()
+
+ @Serializable
+ @SerialName(TYPE_UINT128)
+ data class UInt128Value(
+ @Serializable(BigIntegerCadenceSerializer::class)
+ override val value: BigInteger): Value()
+
+ @Serializable
+ @SerialName(TYPE_INT256)
+ data class Int256Value(
+ @Serializable(BigIntegerCadenceSerializer::class)
+ override val value: BigInteger): Value()
+
+ @Serializable
+ @SerialName(TYPE_UINT256)
+ data class UInt256Value(
+ @Serializable(BigIntegerCadenceSerializer::class)
+ override val value: BigInteger): Value()
+
+ @Serializable
+ @SerialName(TYPE_FIX64)
+ data class Fix64Value(
+ @Serializable(DoubleCadenceSerializer::class)
+ override val value: Double
+ ): Value()
+
+ @Serializable
+ @SerialName(TYPE_UFIX64)
+ data class UFix64Value(
+ @Serializable(DoubleCadenceSerializer::class)
+ override val value: Double): Value()
+
+ @Serializable
+ @SerialName(TYPE_WORD8)
+ data class Word8Value(
+ @Serializable(UByteCadenceSerializer::class)
+ override val value: UByte): Value()
+
+ @Serializable
+ @SerialName(TYPE_WORD16)
+ data class Word16Value(
+ @Serializable(UShortCadenceSerializer::class)
+ override val value: UShort): Value()
+
+ @Serializable
+ @SerialName(TYPE_WORD32)
+ data class Word32Value(
+ @Serializable(UIntCadenceSerializer::class)
+ override val value: UInt): Value()
+
+ @Serializable
+ @SerialName(TYPE_WORD64)
+ data class Word64Value(
+ @Serializable(ULongCadenceSerializer::class)
+ override val value: ULong): Value()
+
+ @Serializable
+ @SerialName(TYPE_ARRAY)
+ data class ArrayValue(override val value: List): Value()
+
+
+ @Serializable
+ @SerialName(TYPE_DICTIONARY)
+ data class DictionaryValue(override val value: List): Value()
+
+ @Serializable
+ @SerialName(TYPE_CONTRACT)
+ data class ContractValue(override val value: CompositeValue): Value()
+
+ @Serializable
+ @SerialName(TYPE_EVENT)
+ data class EventValue(override val value: CompositeValue): Value()
+
+ @Serializable
+ @SerialName(TYPE_RESOURCE)
+ data class ResourceValue(override val value: CompositeValue): Value()
+
+ @Serializable
+ @SerialName(TYPE_ENUM)
+ data class EnumValue(override val value: CompositeValue): Value()
+
+ @Serializable
+ @SerialName(TYPE_STRUCT)
+ open class StructValue(override val value: CompositeValue) : Value()
+
+ @Serializable
+ @SerialName(TYPE_PATH)
+ open class PathValue(override val value: Path) : Value()
+
+ @Serializable
+ @SerialName(TYPE_TYPE)
+ open class TypeValue(override val value: TypeEntry) : Value()
+
+ @Serializable
+ @SerialName(TYPE_CAPABILITY)
+ open class CapabilityValue(override val value: Capability) : Value()
+ }
+
+ companion object {
+ fun void() = Value.VoidValue()
+
+ fun optional(value: Value?) = Value.OptionalValue(value)
+
+ fun bool(value: Boolean) = Value.BooleanValue(value)
+
+ fun string(value: String) = Value.StringValue(value)
+
+ fun address(value: String) = Value.AddressValue(value.addHexPrefix())
+
+ fun address(value: ByteArray) = Value.AddressValue(hex(value))
+
+ fun `int`(value: Int) = Value.IntValue(value)
+
+ fun uint(value: UInt) = Value.UIntValue(value)
+
+ fun int8(value: Byte) = Value.Int8Value(value)
+
+ fun uint8(value: UByte) = Value.UInt8Value(value)
+
+ fun int16(value: Short) = Value.Int16Value(value)
+
+ fun uint16(value: UShort) = Value.UInt16Value(value)
+
+ fun struct(value: CompositeValue) = Value.StructValue(value)
+
+ fun int32(value: Int) = Value.Int32Value(value)
+
+ fun uint32(value: UInt) = Value.UInt32Value(value)
+
+ fun int64(value: Long) = Value.Int64Value(value)
+
+ fun uint64(value: ULong) = Value.UInt64Value(value)
+
+ fun int128(value: BigInteger) = Value.Int128Value(value)
+
+ fun uint128(value: BigInteger) = Value.UInt128Value(value)
+
+ fun int256(value: BigInteger) = Value.Int256Value(value)
+
+ fun uint256(value: BigInteger) = Value.UInt256Value(value)
+
+ fun word8(value: UByte) = Value.Word8Value(value)
+
+ fun word16(value: UShort) = Value.Word16Value(value)
+
+ fun word32(value: UInt) = Value.Word32Value(value)
+
+ fun word64(value: ULong) = Value.Word64Value(value)
+
+ fun fix64(value: Double) = Value.Fix64Value(value)
+ fun fix64(value: Number) = fix64(value.toDouble())
+ fun fix64(value: String) = fix64(value.toDouble())
+
+ fun ufix64(value: Double) = Value.UFix64Value(value)
+ fun ufix64(value: Number) = ufix64(value.toDouble())
+ fun ufix64(value: String) = ufix64(value.toDouble())
+
+ fun array(value: List) = Value.ArrayValue(value)
+
+ fun dictionary(value: List) = Value.DictionaryValue(value)
+ fun dictionary(value: Map) = Value.DictionaryValue(value.map { DictionaryFieldEntry(it.key, it.value) })
+
+ fun contractValue(value: CompositeValue) = Value.ContractValue(value)
+
+ fun resourceValue(value: CompositeValue) = Value.ContractValue(value)
+
+ fun eventValue(value: CompositeValue) = Value.ContractValue(value)
+
+ fun enumValue(value: CompositeValue) = Value.ContractValue(value)
+
+ fun path(value: Path) = Value.PathValue(value)
+ fun path(domain: PathDomain, identifier: String) = Value.PathValue(Path(domain, identifier))
+
+ fun type(value: TypeEntry) = Value.TypeValue(value)
+ fun type(value: Cadence.Kind) = type(TypeEntry(value))
+
+ fun capability(value: Capability) = Value.CapabilityValue(value)
+ fun capability(path: String, address: String, borrowType: Type) = capability(Capability(path, address, borrowType))
+ }
+
+ @Serializable
+ enum class PathDomain(val value: String) {
+
+ @SerialName("storage")
+ STORAGE("storage"),
+
+ @SerialName("private")
+ PRIVATE("private"),
+
+ @SerialName("public")
+ PUBLIC("public")
+ }
+
+ @Serializable
+ data class Path(val domain: PathDomain, val identifier: String)
+
+ @Serializable
+ data class TypeEntry(val staticType: Kind)
+
+ //TODO: Handle more types
+ @Serializable
+ data class Kind (val kind: Type, val typeID : String?, val type: String?)
+
+ @Serializable
+ data class Capability(val path: String, val address: String, val borrowType: Type)
+
+ @Serializable
+ class DictionaryFieldEntry(val key: Cadence.Value, val value: Cadence.Value) {
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (other !is DictionaryFieldEntry) return false
+ return key == other.key && value == other.value
+ }
+
+ override fun hashCode(): Int {
+ var result = key.hashCode()
+ result = 31 * result + value.hashCode()
+ return result
+ }
+
+ constructor(pair: Pair) : this(pair.first, pair.second)
+ }
+
+ @Serializable
+ open class CompositeAttribute(val name: String, val value: Cadence.Value) {
+ override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (other !is CompositeAttribute) return false
+ return name == other.name && value == other.value
+ }
+
+ override fun hashCode(): Int {
+ var result = name.hashCode()
+ result = 31 * result + value.hashCode()
+ return result
+ }
+ }
+
+ @Serializable
+ open class CompositeValue(val id: String, val fields: List) {
+ override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (other !is CompositeValue) return false
+ return id == other.id && fields == other.fields
+ }
+
+ override fun hashCode(): Int {
+ var result = id.hashCode()
+ result = 31 * result + fields.hashCode()
+ return result
+ }
+ }
+}
+
+inline fun Cadence.CompositeValue.getField(key: String): T? {
+ return fields.getField(key)
+}
+
+inline fun List.getField(key: String): T? {
+ return find { it.name == key }?.value?.decode()
+}
\ No newline at end of file
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/infrastructure/CadenceDecode.kt b/flow/src/commonMain/kotlin/org/onflow/flow/infrastructure/CadenceDecode.kt
new file mode 100644
index 0000000..c3bf6e6
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/infrastructure/CadenceDecode.kt
@@ -0,0 +1,76 @@
+package org.onflow.flow.infrastructure
+
+import com.ionspin.kotlin.bignum.integer.BigInteger
+import com.ionspin.kotlin.bignum.serialization.kotlinx.biginteger.BigIntegerHumanReadableSerializer
+import kotlinx.serialization.builtins.serializer
+import kotlinx.serialization.json.*
+import kotlin.time.Duration
+
+fun List.decodeToAny(): List {
+ return map { it.decodeToAny() }
+}
+
+fun List.encodeBase64(): List {
+ return map { it.encodeBase64() }
+}
+
+inline fun List.decode(): List {
+ return map { it.decode() }
+}
+
+fun String.addHexPrefix(): String {
+ return if (startsWith("0x")) this else "0x$this"
+}
+
+fun String.removeHexPrefix(): String {
+ return if (startsWith("0x")) this.removePrefix("0x") else this
+}
+
+fun Any?.toJsonElement(): JsonElement = when (this) {
+ null -> JsonNull
+ is JsonElement -> this
+ is Number -> JsonPrimitive(this)
+ is Boolean -> JsonPrimitive(this)
+ is String -> JsonPrimitive(this)
+ is Array<*> -> JsonArray(map { it.toJsonElement() })
+ is List<*> -> JsonArray(map { it.toJsonElement() })
+ is Map<*, *> -> JsonObject(map { it.key.toString() to it.value.toJsonElement() }.toMap())
+ is Char -> Json.encodeToJsonElement(Char.serializer(), this)
+ is Byte -> Json.encodeToJsonElement(Byte.serializer(), this)
+ is Short -> Json.encodeToJsonElement(Short.serializer(), this)
+ is Long -> Json.encodeToJsonElement(Long.serializer(), this)
+ is Float -> Json.encodeToJsonElement(Float.serializer(), this)
+ is Duration -> Json.encodeToJsonElement(Duration.serializer(), this)
+ is Unit -> Json.encodeToJsonElement(Unit.serializer(), this)
+ is UInt -> Json.encodeToJsonElement(UInt.serializer(), this)
+ is UByte -> Json.encodeToJsonElement(UByte.serializer(), this)
+ is ULong -> Json.encodeToJsonElement(ULong.serializer(), this)
+ is UShort -> Json.encodeToJsonElement(UShort.serializer(), this)
+ is BigInteger -> Json.encodeToJsonElement(BigIntegerHumanReadableSerializer, this)
+
+ is Cadence.Path -> Json.encodeToJsonElement(Cadence.Path.serializer(), this)
+ is Cadence.Capability -> Json.encodeToJsonElement(Cadence.Capability.serializer(), this)
+ is Cadence.TypeEntry -> Json.encodeToJsonElement(Cadence.TypeEntry.serializer(), this)
+
+ //TODO: Improve me
+ else -> JsonNull
+// else -> Json.encodeToJsonElement(serializer(this::class.createType()), this)
+}
+
+fun Cadence.CompositeValue.toMap(): Map {
+ return this.fields.associate {
+ it.name to it.value.decodeToAny()
+ }
+}
+
+//fun toMap(obj: T): Map {
+// return (obj::class as KClass).memberProperties.associate { prop ->
+// prop.name to prop.get(obj)?.let { value ->
+// if (value::class.isData) {
+// toMap(value)
+// } else {
+// value
+// }
+// }
+// }
+//}
\ No newline at end of file
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/infrastructure/CadenceType.kt b/flow/src/commonMain/kotlin/org/onflow/flow/infrastructure/CadenceType.kt
new file mode 100644
index 0000000..777b748
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/infrastructure/CadenceType.kt
@@ -0,0 +1,75 @@
+package org.onflow.flow.infrastructure
+
+// simple types
+const val TYPE_ANY = "Any"
+const val TYPE_ANYSTRUCT = "AnyStruct"
+const val TYPE_ANYRESOURCE = "AnyResource"
+const val TYPE_TYPE = "Type"
+const val TYPE_VOID = "Void"
+const val TYPE_NEVER = "Never"
+const val TYPE_BOOLEAN = "Bool"
+const val TYPE_STRING = "String"
+const val TYPE_CHARACTER = "Character"
+const val TYPE_BYTES = "Bytes"
+const val TYPE_NUMBER = "Number"
+const val TYPE_SIGNEDNUMBER = "SignedNumber"
+const val TYPE_INTEGER = "Integer"
+const val TYPE_SIGNEDINTEGER = "SignedInteger"
+const val TYPE_FIXEDPOINT = "FixedPoint"
+const val TYPE_SIGNEDFIXEDPOINT = "SignedFixedPoint"
+const val TYPE_INT = "Int"
+const val TYPE_UINT = "UInt"
+const val TYPE_INT8 = "Int8"
+const val TYPE_UINT8 = "UInt8"
+const val TYPE_INT16 = "Int16"
+const val TYPE_UINT16 = "UInt16"
+const val TYPE_INT32 = "Int32"
+const val TYPE_UINT32 = "UInt32"
+const val TYPE_INT64 = "Int64"
+const val TYPE_UINT64 = "UInt64"
+const val TYPE_INT128 = "Int128"
+const val TYPE_UINT128 = "UInt128"
+const val TYPE_INT256 = "Int256"
+const val TYPE_UINT256 = "UInt256"
+const val TYPE_WORD8 = "Word8"
+const val TYPE_WORD16 = "Word16"
+const val TYPE_WORD32 = "Word32"
+const val TYPE_WORD64 = "Word64"
+const val TYPE_FIX64 = "Fix64"
+const val TYPE_UFIX64 = "UFix64"
+const val TYPE_ARRAY = "Array"
+const val TYPE_ADDRESS = "Address"
+const val TYPE_PATH = "Path"
+const val TYPE_CAPABILITYPATH = "CapabilityPath"
+const val TYPE_STORAGEPATH = "StoragePath"
+const val TYPE_PUBLICPATH = "PublicPath"
+const val TYPE_PRIVATEPATH = "PrivatePath"
+const val TYPE_AUTHACCOUNT = "AuthAccount"
+const val TYPE_PUBLICACCOUNT = "PublicAccount"
+const val TYPE_AUTHACCOUNT_KEYS = "AuthAccount.Keys"
+const val TYPE_PUBLICACCOUNT_KEYS = "PublicAccount.Keys"
+const val TYPE_AUTHACCOUNT_CONTRACTS = "AuthAccount.Contracts"
+const val TYPE_PUBLICACCOUNT_CONTRACTS = "PublicAccount.Contracts"
+const val TYPE_DEPLOYEDCONTRACT = "DeployedContract"
+const val TYPE_ACCOUNTKEY = "AccountKey"
+const val TYPE_BLOCK = "Block"
+
+// complex type
+const val TYPE_OPTIONAL = "Optional"
+const val TYPE_DICTIONARY = "Dictionary"
+const val TYPE_VARIABLE_SIZED_ARRAY = "VariableSizedArray"
+const val TYPE_CONSTANT_SIZED_ARRAY = "ConstantSizedArray"
+const val TYPE_CAPABILITY = "Capability"
+const val TYPE_ENUM = "Enum"
+const val TYPE_FUNCTION = "Function"
+const val TYPE_REFERENCE = "Reference"
+const val TYPE_RESTRICTION = "Restriction"
+
+// composite types
+const val TYPE_STRUCT = "Struct"
+const val TYPE_RESOURCE = "Resource"
+const val TYPE_EVENT = "Event"
+const val TYPE_CONTRACT = "Contract"
+const val TYPE_STRUCT_INTERFACE = "StructInterface"
+const val TYPE_RESOURCE_INTERFACE = "ResourceInterface"
+const val TYPE_CONTRACT_INTERFACE = "ContractInterface"
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/infrastructure/FixedPointFormatter.kt b/flow/src/commonMain/kotlin/org/onflow/flow/infrastructure/FixedPointFormatter.kt
new file mode 100644
index 0000000..c12a478
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/infrastructure/FixedPointFormatter.kt
@@ -0,0 +1,5 @@
+package org.onflow.flow.infrastructure
+
+expect object FixedPointFormatter {
+ fun format(num: String, precision: ULong): String?
+}
\ No newline at end of file
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/infrastructure/Serializer.kt b/flow/src/commonMain/kotlin/org/onflow/flow/infrastructure/Serializer.kt
new file mode 100644
index 0000000..1dbfab9
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/infrastructure/Serializer.kt
@@ -0,0 +1,128 @@
+package org.onflow.flow.infrastructure
+
+import com.ionspin.kotlin.bignum.decimal.BigDecimal
+import com.ionspin.kotlin.bignum.decimal.toBigDecimal
+import com.ionspin.kotlin.bignum.integer.BigInteger
+import com.ionspin.kotlin.bignum.integer.toBigInteger
+import kotlinx.serialization.KSerializer
+import kotlinx.serialization.Serializer
+import kotlinx.serialization.descriptors.PrimitiveKind
+import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
+import kotlinx.serialization.descriptors.SerialDescriptor
+import kotlinx.serialization.encoding.Decoder
+import kotlinx.serialization.encoding.Encoder
+
+object ByteCadenceSerializer : KSerializer {
+ override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("value", PrimitiveKind.STRING)
+ override fun serialize(encoder: Encoder, value: Byte) = encoder.encodeString(value.toString())
+ override fun deserialize(decoder: Decoder): Byte = decoder.decodeString().toByte()
+}
+
+object UByteCadenceSerializer : KSerializer {
+ override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("value", PrimitiveKind.STRING)
+ override fun serialize(encoder: Encoder, value: UByte) = encoder.encodeString(value.toString())
+ override fun deserialize(decoder: Decoder): UByte = decoder.decodeString().toUByte()
+}
+
+object IntCadenceSerializer : KSerializer {
+ override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("value", PrimitiveKind.STRING)
+ override fun serialize(encoder: Encoder, value: Int) = encoder.encodeString(value.toString())
+ override fun deserialize(decoder: Decoder): Int = decoder.decodeString().toInt()
+}
+
+object UIntCadenceSerializer : KSerializer {
+ override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("value", PrimitiveKind.STRING)
+ override fun serialize(encoder: Encoder, value: UInt) = encoder.encodeString(value.toString())
+ override fun deserialize(decoder: Decoder): UInt = decoder.decodeString().toUInt()
+}
+
+object ShortCadenceSerializer : KSerializer {
+ override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("value", PrimitiveKind.STRING)
+ override fun serialize(encoder: Encoder, value: Short) = encoder.encodeString(value.toString())
+ override fun deserialize(decoder: Decoder): Short = decoder.decodeString().toShort()
+}
+
+object UShortCadenceSerializer : KSerializer {
+ override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("value", PrimitiveKind.STRING)
+ override fun serialize(encoder: Encoder, value: UShort) = encoder.encodeString(value.toString())
+ override fun deserialize(decoder: Decoder): UShort = decoder.decodeString().toUShort()
+}
+
+object LongCadenceSerializer : KSerializer {
+ override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("value", PrimitiveKind.STRING)
+ override fun serialize(encoder: Encoder, value: Long) = encoder.encodeString(value.toString())
+ override fun deserialize(decoder: Decoder): Long = decoder.decodeString().toLong()
+}
+
+object ULongCadenceSerializer : KSerializer {
+ override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("value", PrimitiveKind.STRING)
+ override fun serialize(encoder: Encoder, value: ULong) = encoder.encodeString(value.toString())
+ override fun deserialize(decoder: Decoder): ULong = decoder.decodeString().toULong()
+}
+
+object BigIntegerCadenceSerializer : KSerializer {
+ override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("value", PrimitiveKind.STRING)
+ override fun serialize(encoder: Encoder, value: BigInteger) = encoder.encodeString(value.toString())
+ override fun deserialize(decoder: Decoder): BigInteger = decoder.decodeString().toBigInteger()
+}
+
+object BigDecimalCadenceSerializer : KSerializer {
+ override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("value", PrimitiveKind.STRING)
+ override fun serialize(encoder: Encoder, value: BigDecimal) = encoder.encodeString(value.toString())
+ override fun deserialize(decoder: Decoder): BigDecimal = decoder.decodeString().toBigDecimal()
+}
+
+object DoubleCadenceSerializer : KSerializer {
+ override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("value", PrimitiveKind.STRING)
+ override fun serialize(encoder: Encoder, value: Double) =
+ encoder.encodeString(FixedPointFormatter.format(value.toString(), 8UL) ?: "")
+ override fun deserialize(decoder: Decoder): Double = decoder.decodeString().toDouble()
+}
+
+@kotlinx.serialization.ExperimentalSerializationApi
+@Serializer(forClass = Cadence.Type::class)
+object CadenceTypeSerializer : KSerializer {
+ override val descriptor: SerialDescriptor =
+ PrimitiveSerialDescriptor("Cadence.Type", PrimitiveKind.STRING)
+
+ override fun serialize(encoder: Encoder, value: Cadence.Type) {
+ encoder.encodeString(value.value)
+ }
+
+ override fun deserialize(decoder: Decoder): Cadence.Type {
+ return try {
+ val key = decoder.decodeString()
+ Cadence.Type.findByKey(key)
+ } catch (e: IllegalArgumentException) {
+ Cadence.Type.VOID
+ }
+ }
+}
+
+//open class NewNumberSerializer(val type: KClass ): KSerializer {
+// override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("value", PrimitiveKind.STRING)
+// override fun serialize(encoder: Encoder, value: T) = encoder.encodeString(value.toString())
+// override fun deserialize(decoder: Decoder): T {
+// val value = decoder.decodeString()
+// return when (type) {
+// Int::class -> { value.toInt() }
+// UInt::class -> { value.toUInt() }
+// else -> {
+// throw Exception("Can't convert $this to Number ")
+// }
+// } as T
+// }
+//}
+
+//class IntSerializer: NewNumberSerializer(type = Int::class)
+//class UIntSerializer: NewNumberSerializer(type = UInt::class)
+
+//inline fun String.toNumber(t: KClass): T {
+// return when (t) {
+// Int::class -> { toInt() }
+// UInt::class -> { toUInt() }
+// else -> {
+// throw Exception("Can't convert $this to Number ")
+// }
+// } as T
+//}
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/Account.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/Account.kt
new file mode 100644
index 0000000..35fac46
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/Account.kt
@@ -0,0 +1,34 @@
+package org.onflow.flow.models
+
+import kotlinx.serialization.*
+import org.onflow.flow.infrastructure.Base64ByteArray
+
+/**
+ *
+ *
+ * @param address The 8-byte address of an account.
+ * @param balance Flow balance of the account.
+ * @param expandable
+ * @param propertyKeys
+ * @param contracts
+ * @param links
+ */
+@Serializable
+data class Account(
+
+ /* The 8-byte address of an account. */
+ @SerialName(value = "address") @Required val address: String,
+
+ /* Flow balance of the account. */
+ @SerialName(value = "balance") @Required val balance: String,
+
+ @SerialName(value = "_expandable") @Required val expandable: AccountExpandable,
+
+ @SerialName(value = "keys") val keys: Set? = null,
+
+ @SerialName(value = "contracts") val contracts: Map? = null,
+
+ @SerialName(value = "_links") val links: Links? = null
+
+)
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/AccountExpandable.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/AccountExpandable.kt
new file mode 100644
index 0000000..8cb4ceb
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/AccountExpandable.kt
@@ -0,0 +1,21 @@
+package org.onflow.flow.models
+
+import kotlinx.serialization.*
+import kotlinx.serialization.descriptors.*
+import kotlinx.serialization.encoding.*
+
+/**
+ *
+ *
+ * @param propertyKeys
+ * @param contracts
+ */
+@Serializable
+data class AccountExpandable (
+
+ @SerialName(value = "keys") val propertyKeys: String? = null,
+
+ @SerialName(value = "contracts") val contracts: String? = null
+
+)
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/AccountPublicKey.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/AccountPublicKey.kt
new file mode 100644
index 0000000..bae2c1c
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/AccountPublicKey.kt
@@ -0,0 +1,39 @@
+package org.onflow.flow.models
+
+import kotlinx.serialization.*
+
+/**
+ *
+ *
+ * @param index Index of the public key.
+ * @param publicKey Hex encoded public key.
+ * @param signingAlgorithm
+ * @param hashingAlgorithm
+ * @param sequenceNumber Current account sequence number.
+ * @param weight Weight of the key.
+ * @param revoked Flag indicating whether the key is active or not.
+ */
+@Serializable
+data class AccountPublicKey (
+
+ /* Index of the public key. */
+ @SerialName(value = "index") @Required val index: String,
+
+ /* Hex encoded public key. */
+ @SerialName(value = "public_key") @Required val publicKey: String,
+
+ @SerialName(value = "signing_algorithm") @Required val signingAlgorithm: SigningAlgorithm,
+
+ @SerialName(value = "hashing_algorithm") @Required val hashingAlgorithm: HashingAlgorithm,
+
+ /* Current account sequence number. */
+ @SerialName(value = "sequence_number") @Required val sequenceNumber: String,
+
+ /* Weight of the key. */
+ @SerialName(value = "weight") @Required val weight: String,
+
+ /* Flag indicating whether the key is active or not. */
+ @SerialName(value = "revoked") @Required val revoked: Boolean
+
+)
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/AggregatedSignature.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/AggregatedSignature.kt
new file mode 100644
index 0000000..cd5ffa3
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/AggregatedSignature.kt
@@ -0,0 +1,20 @@
+package org.onflow.flow.models
+
+import kotlinx.serialization.*
+import org.onflow.flow.infrastructure.Base64ByteArray
+
+/**
+ *
+ *
+ * @param verifierSignatures
+ * @param signerIds
+ */
+@Serializable
+data class AggregatedSignature (
+
+ @SerialName(value = "verifier_signatures") @Required val verifierSignatures: List,
+
+ @SerialName(value = "signer_ids") @Required val signerIds: List
+
+)
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/Block.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/Block.kt
new file mode 100644
index 0000000..fe014c2
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/Block.kt
@@ -0,0 +1,30 @@
+package org.onflow.flow.models
+
+import kotlinx.serialization.Required
+import kotlinx.serialization.SerialName
+import kotlinx.serialization.Serializable
+
+/**
+ *
+ *
+ * @param header
+ * @param expandable
+ * @param payload
+ * @param executionResult
+ * @param links
+ */
+@Serializable
+data class Block (
+
+ @SerialName(value = "header") @Required val header: BlockHeader,
+
+ @SerialName(value = "_expandable") @Required val expandable: BlockExpandable,
+
+ @SerialName(value = "payload") val payload: BlockPayload? = null,
+
+ @SerialName(value = "execution_result") val executionResult: ExecutionResult? = null,
+
+ @SerialName(value = "_links") val links: Links? = null
+
+)
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/BlockEvents.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/BlockEvents.kt
new file mode 100644
index 0000000..50ee6d6
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/BlockEvents.kt
@@ -0,0 +1,31 @@
+package org.onflow.flow.models
+
+import org.onflow.flow.models.Event
+import org.onflow.flow.models.Links
+import kotlinx.serialization.*
+
+/**
+ *
+ *
+ * @param blockId A 32-byte unique identifier for an entity.
+ * @param blockHeight
+ * @param blockTimestamp
+ * @param events
+ * @param links
+ */
+@Serializable
+data class BlockEvents (
+
+ /* A 32-byte unique identifier for an entity. */
+ @SerialName(value = "block_id") val blockId: String? = null,
+
+ @SerialName(value = "block_height") val blockHeight: String? = null,
+
+ @SerialName(value = "block_timestamp") val blockTimestamp: String? = null,
+
+ @SerialName(value = "events") val events: List? = null,
+
+ @SerialName(value = "_links") val links: Links? = null
+
+)
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/BlockExpandable.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/BlockExpandable.kt
new file mode 100644
index 0000000..ae67363
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/BlockExpandable.kt
@@ -0,0 +1,21 @@
+package org.onflow.flow.models
+
+import kotlinx.serialization.*
+import kotlinx.serialization.descriptors.*
+import kotlinx.serialization.encoding.*
+
+/**
+ *
+ *
+ * @param payload
+ * @param executionResult
+ */
+@Serializable
+data class BlockExpandable (
+
+ @SerialName(value = "payload") val payload: String? = null,
+
+ @SerialName(value = "execution_result") val executionResult: String? = null
+
+)
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/BlockHeader.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/BlockHeader.kt
new file mode 100644
index 0000000..615ef3f
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/BlockHeader.kt
@@ -0,0 +1,32 @@
+package org.onflow.flow.models
+
+import kotlinx.serialization.*
+import org.onflow.flow.infrastructure.Base64ByteArray
+
+/**
+ *
+ *
+ * @param id A 32-byte unique identifier for an entity.
+ * @param parentId A 32-byte unique identifier for an entity.
+ * @param height
+ * @param timestamp
+ * @param parentVoterSignature A variable length signature.
+ */
+@Serializable
+data class BlockHeader (
+
+ /* A 32-byte unique identifier for an entity. */
+ @SerialName(value = "id") @Required val id: kotlin.String,
+
+ /* A 32-byte unique identifier for an entity. */
+ @SerialName(value = "parent_id") @Required val parentId: kotlin.String,
+
+ @SerialName(value = "height") @Required val height: kotlin.String,
+
+ @SerialName(value = "timestamp") @Required val timestamp: kotlin.String,
+
+ /* A variable length signature. */
+ @SerialName(value = "parent_voter_signature") @Required val parentVoterSignature: Base64ByteArray
+
+)
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/BlockHeightOneOf.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/BlockHeightOneOf.kt
new file mode 100644
index 0000000..32369c5
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/BlockHeightOneOf.kt
@@ -0,0 +1,46 @@
+package org.onflow.flow.models
+
+
+import kotlinx.serialization.*
+
+/**
+ *
+ *
+ * Values: `final`,`sealed`
+ */
+@Serializable
+enum class BlockHeightOneOf(val value: String) {
+
+ @SerialName(value = "final")
+ `final`("final"),
+
+ @SerialName(value = "sealed")
+ `sealed`("sealed");
+
+ /**
+ * Override toString() to avoid using the enum variable name as the value, and instead use
+ * the actual value defined in the API spec file.
+ *
+ * This solves a problem when the variable name and its value are different, and ensures that
+ * the client sends the correct enum values to the server always.
+ */
+ override fun toString(): String = value
+
+ companion object {
+ /**
+ * Converts the provided [data] to a [String] on success, null otherwise.
+ */
+ fun encode(data: Any?): String? = if (data is BlockHeightOneOf) "$data" else null
+
+ /**
+ * Returns a valid [BlockHeightOneOf] for [data], null otherwise.
+ */
+ fun decode(data: Any?): BlockHeightOneOf? = data?.let {
+ val normalizedData = "$it".lowercase()
+ values().firstOrNull { value ->
+ it == value || normalizedData == "$value".lowercase()
+ }
+ }
+ }
+}
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/BlockPayload.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/BlockPayload.kt
new file mode 100644
index 0000000..641df2f
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/BlockPayload.kt
@@ -0,0 +1,18 @@
+package org.onflow.flow.models
+import kotlinx.serialization.*
+
+/**
+ *
+ *
+ * @param collectionGuarantees
+ * @param blockSeals
+ */
+@Serializable
+data class BlockPayload (
+
+ @SerialName(value = "collection_guarantees") @Required val collectionGuarantees: List,
+
+ @SerialName(value = "block_seals") @Required val blockSeals: List
+
+)
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/BlockSeal.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/BlockSeal.kt
new file mode 100644
index 0000000..31805d1
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/BlockSeal.kt
@@ -0,0 +1,28 @@
+package org.onflow.flow.models
+
+import kotlinx.serialization.*
+
+/**
+ *
+ *
+ * @param blockId A 32-byte unique identifier for an entity.
+ * @param resultId A 32-byte unique identifier for an entity.
+ * @param finalState The root hash of the state tree.
+ * @param aggregatedApprovalSignatures
+ */
+@Serializable
+data class BlockSeal (
+
+ /* A 32-byte unique identifier for an entity. */
+ @SerialName(value = "block_id") @Required val blockId: String,
+
+ /* A 32-byte unique identifier for an entity. */
+ @SerialName(value = "result_id") @Required val resultId: String,
+
+ /* The root hash of the state tree. */
+ @SerialName(value = "final_state") @Required val finalState: String,
+
+ @SerialName(value = "aggregated_approval_signatures") @Required val aggregatedApprovalSignatures: List
+
+)
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/Chunk.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/Chunk.kt
new file mode 100644
index 0000000..ea7a189
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/Chunk.kt
@@ -0,0 +1,39 @@
+package org.onflow.flow.models
+
+import org.onflow.flow.infrastructure.Base64ByteArray
+import kotlinx.serialization.*
+
+/**
+ *
+ *
+ * @param blockId A 32-byte unique identifier for an entity.
+ * @param collectionIndex
+ * @param startState
+ * @param endState
+ * @param eventCollection
+ * @param index
+ * @param numberOfTransactions
+ * @param totalComputationUsed
+ */
+@Serializable
+data class Chunk (
+
+ /* A 32-byte unique identifier for an entity. */
+ @SerialName(value = "block_id") @Required val blockId: kotlin.String,
+
+ @SerialName(value = "collection_index") @Required val collectionIndex: kotlin.String,
+
+ @SerialName(value = "start_state") @Required val startState: Base64ByteArray,
+
+ @SerialName(value = "end_state") @Required val endState: Base64ByteArray,
+
+ @SerialName(value = "event_collection") @Required val eventCollection: Base64ByteArray,
+
+ @SerialName(value = "index") @Required val index: kotlin.String,
+
+ @SerialName(value = "number_of_transactions") @Required val numberOfTransactions: kotlin.String,
+
+ @SerialName(value = "total_computation_used") @Required val totalComputationUsed: kotlin.String
+
+)
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/Collection.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/Collection.kt
new file mode 100644
index 0000000..0c0260b
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/Collection.kt
@@ -0,0 +1,28 @@
+package org.onflow.flow.models
+
+import org.onflow.flow.models.CollectionExpandable
+import org.onflow.flow.models.Links
+import kotlinx.serialization.*
+
+/**
+ *
+ *
+ * @param id A 32-byte unique identifier for an entity.
+ * @param expandable
+ * @param transactions
+ * @param links
+ */
+@Serializable
+data class Collection (
+
+ /* A 32-byte unique identifier for an entity. */
+ @SerialName(value = "id") @Required val id: String,
+
+ @SerialName(value = "_expandable") @Required val expandable: CollectionExpandable,
+
+ @SerialName(value = "transactions") val transactions: List? = null,
+
+ @SerialName(value = "_links") val links: Links? = null
+
+)
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/CollectionExpandable.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/CollectionExpandable.kt
new file mode 100644
index 0000000..fa85a9a
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/CollectionExpandable.kt
@@ -0,0 +1,19 @@
+package org.onflow.flow.models
+
+
+import kotlinx.serialization.*
+import kotlinx.serialization.descriptors.*
+import kotlinx.serialization.encoding.*
+
+/**
+ *
+ *
+ * @param transactions
+ */
+@Serializable
+data class CollectionExpandable (
+
+ @SerialName(value = "transactions") val transactions: List? = null
+
+)
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/CollectionGuarantee.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/CollectionGuarantee.kt
new file mode 100644
index 0000000..1791213
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/CollectionGuarantee.kt
@@ -0,0 +1,26 @@
+package org.onflow.flow.models
+
+
+import kotlinx.serialization.*
+import org.onflow.flow.infrastructure.Base64ByteArray
+
+/**
+ *
+ *
+ * @param collectionId A 32-byte unique identifier for an entity.
+ * @param signerIds
+ * @param signature A variable length signature.
+ */
+@Serializable
+data class CollectionGuarantee (
+
+ /* A 32-byte unique identifier for an entity. */
+ @SerialName(value = "collection_id") @Required val collectionId: String,
+
+ @SerialName(value = "signer_ids") val signerIds: List? = null,
+
+ /* A variable length signature. */
+ @SerialName(value = "signature") @Required val signature: Base64ByteArray
+
+)
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/DomainTag.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/DomainTag.kt
new file mode 100644
index 0000000..0076b5b
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/DomainTag.kt
@@ -0,0 +1,19 @@
+package org.onflow.flow.models
+
+import io.ktor.utils.io.core.*
+import org.onflow.flow.rlp.paddingZeroRight
+
+sealed class DomainTag {
+ abstract val tag: String
+
+ open val bytes: ByteArray
+ get() = tag.toByteArray().paddingZeroRight(32)
+
+ data class Transaction(override val tag: String = "FLOW-V0.0-transaction") : DomainTag()
+
+ data class User(override val tag: String = "FLOW-V0.0-user") : DomainTag()
+
+ data class AccountProof(override val tag: String = "FCL-ACCOUNT-PROOF-V0.0") : DomainTag()
+
+ data class Custom(override val tag: String): DomainTag()
+}
\ No newline at end of file
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/Error.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/Error.kt
new file mode 100644
index 0000000..46bd660
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/Error.kt
@@ -0,0 +1,21 @@
+package org.onflow.flow.models
+
+import kotlinx.serialization.*
+import kotlinx.serialization.descriptors.*
+import kotlinx.serialization.encoding.*
+
+/**
+ *
+ *
+ * @param code
+ * @param message
+ */
+@Serializable
+data class Error (
+
+ @SerialName(value = "code") val code: Int? = null,
+
+ @SerialName(value = "message") val message: String? = null
+
+)
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/Event.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/Event.kt
new file mode 100644
index 0000000..5382433
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/Event.kt
@@ -0,0 +1,30 @@
+package org.onflow.flow.models
+import org.onflow.flow.infrastructure.Cadence
+import kotlinx.serialization.*
+
+/**
+ *
+ *
+ * @param type The qualified event type.
+ * @param transactionId A 32-byte unique identifier for an entity.
+ * @param transactionIndex
+ * @param eventIndex
+ * @param payload
+ */
+@Serializable
+data class Event (
+
+ /* The qualified event type. */
+ @SerialName(value = "type") @Required val type: kotlin.String,
+
+ /* A 32-byte unique identifier for an entity. */
+ @SerialName(value = "transaction_id") @Required val transactionId: kotlin.String,
+
+ @SerialName(value = "transaction_index") @Required val transactionIndex: kotlin.String,
+
+ @SerialName(value = "event_index") @Required val eventIndex: kotlin.String,
+
+ @Serializable(CadenceBase64Serializer::class)
+ @SerialName(value = "payload") @Required val payload: Cadence.Value
+)
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/ExecutionResult.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/ExecutionResult.kt
new file mode 100644
index 0000000..413c450
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/ExecutionResult.kt
@@ -0,0 +1,34 @@
+package org.onflow.flow.models
+
+import kotlinx.serialization.*
+
+/**
+ *
+ *
+ * @param id A 32-byte unique identifier for an entity.
+ * @param blockId A 32-byte unique identifier for an entity.
+ * @param events
+ * @param previousResultId A 32-byte unique identifier for an entity.
+ * @param chunks
+ * @param links
+ */
+@Serializable
+data class ExecutionResult (
+
+ /* A 32-byte unique identifier for an entity. */
+ @SerialName(value = "id") @Required val id: String,
+
+ /* A 32-byte unique identifier for an entity. */
+ @SerialName(value = "block_id") @Required val blockId: String,
+
+ @SerialName(value = "events") @Required val events: List,
+
+ /* A 32-byte unique identifier for an entity. */
+ @SerialName(value = "previous_result_id") val previousResultId: String? = null,
+
+ @SerialName(value = "chunks") val chunks: List? = null,
+
+ @SerialName(value = "_links") val links: Links? = null
+
+)
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/HashingAlgorithm.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/HashingAlgorithm.kt
new file mode 100644
index 0000000..d12ca6e
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/HashingAlgorithm.kt
@@ -0,0 +1,50 @@
+package org.onflow.flow.models
+
+
+import kotlinx.serialization.*
+
+@Serializable
+enum class HashingAlgorithm(val value: String) {
+
+ @SerialName(value = "SHA2_256")
+ SHA2_256("SHA2_256"),
+
+ @SerialName(value = "SHA2_384")
+ SHA2_384("SHA2_384"),
+
+ @SerialName(value = "SHA3_256")
+ SHA3_256("SHA3_256"),
+
+ @SerialName(value = "SHA3_384")
+ SHA3_384("SHA3_384"),
+
+ @SerialName(value = "KMAC128_BLS_BLS12_381")
+ KMAC128_BLS_BLS12_381("KMAC128_BLS_BLS12_381");
+
+ /**
+ * Override toString() to avoid using the enum variable name as the value, and instead use
+ * the actual value defined in the API spec file.
+ *
+ * This solves a problem when the variable name and its value are different, and ensures that
+ * the client sends the correct enum values to the server always.
+ */
+ override fun toString(): String = value
+
+ companion object {
+ /**
+ * Converts the provided [data] to a [String] on success, null otherwise.
+ */
+ fun encode(data: Any?): String? = if (data is HashingAlgorithm) "$data" else null
+
+ /**
+ * Returns a valid [HashingAlgorithm] for [data], null otherwise.
+ */
+ fun decode(data: Any?): HashingAlgorithm? = data?.let {
+ val normalizedData = "$it".lowercase()
+ values().firstOrNull { value ->
+ it == value || normalizedData == "$value".lowercase()
+ }
+ }
+ }
+}
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/Links.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/Links.kt
new file mode 100644
index 0000000..22acd9b
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/Links.kt
@@ -0,0 +1,14 @@
+package org.onflow.flow.models
+
+
+import kotlinx.serialization.*
+/**
+ *
+ *
+ * @param self
+ */
+@Serializable
+data class Links (
+ @SerialName(value = "_self") val self: String? = null
+)
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/ProposalKey.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/ProposalKey.kt
new file mode 100644
index 0000000..5eb430c
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/ProposalKey.kt
@@ -0,0 +1,31 @@
+package org.onflow.flow.models
+
+
+import org.onflow.flow.infrastructure.BigIntegerCadenceSerializer
+import org.onflow.flow.infrastructure.IntCadenceSerializer
+import com.ionspin.kotlin.bignum.integer.BigInteger
+import kotlinx.serialization.*
+import kotlinx.serialization.descriptors.*
+import kotlinx.serialization.encoding.*
+
+/**
+ *
+ *
+ * @param address The 8-byte address of an account.
+ * @param keyIndex
+ * @param sequenceNumber
+ */
+@Serializable
+data class ProposalKey (
+
+ /* The 8-byte address of an account. */
+ @SerialName(value = "address") @Required val address: String,
+
+ @Serializable(IntCadenceSerializer::class)
+ @SerialName(value = "key_index") @Required val keyIndex: Int,
+
+ @Serializable(BigIntegerCadenceSerializer::class)
+ @SerialName(value = "sequence_number") @Required val sequenceNumber: BigInteger
+
+)
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/ScriptsPostRequest.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/ScriptsPostRequest.kt
new file mode 100644
index 0000000..047d663
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/ScriptsPostRequest.kt
@@ -0,0 +1,22 @@
+package org.onflow.flow.models
+
+import kotlinx.serialization.*
+import org.onflow.flow.infrastructure.Base64ByteArray
+
+/**
+ *
+ *
+ * @param script Base64 encoded content of the Cadence script.
+ * @param arguments An list of arguments each encoded as Base64 passed in the [JSON-Cadence interchange format](https://docs.onflow.org/cadence/json-cadence-spec/).
+ */
+@Serializable
+data class ScriptsPostRequest(
+
+ /* Base64 encoded content of the Cadence script. */
+ @SerialName(value = "script") val script: String? = null,
+
+ /* An list of arguments each encoded as Base64 passed in the [JSON-Cadence interchange format](https://docs.onflow.org/cadence/json-cadence-spec/). */
+ @SerialName(value = "arguments") val arguments: List? = null
+
+)
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/ScriptsPostResponse.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/ScriptsPostResponse.kt
new file mode 100644
index 0000000..ab8d07b
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/ScriptsPostResponse.kt
@@ -0,0 +1,16 @@
+package org.onflow.flow.models
+
+
+import kotlinx.serialization.*
+import org.onflow.flow.infrastructure.Base64ByteArray
+
+/**
+ *
+ *
+ * @param `value`
+ */
+@Serializable
+data class ScriptsPostResponse (
+ val value: Base64ByteArray? = null
+)
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/SigningAlgorithm.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/SigningAlgorithm.kt
new file mode 100644
index 0000000..fe3abfa
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/SigningAlgorithm.kt
@@ -0,0 +1,45 @@
+package org.onflow.flow.models
+
+
+import kotlinx.serialization.*
+
+
+@Serializable
+enum class SigningAlgorithm(val value: String) {
+
+ @SerialName(value = "BLS_BLS12_381")
+ BLS_BLS12_381("BLS_BLS12_381"),
+
+ @SerialName(value = "ECDSA_P256")
+ ECDSA_P256("ECDSA_P256"),
+
+ @SerialName(value = "ECDSA_secp256k1")
+ ECDSA_secp256k1("ECDSA_secp256k1");
+
+ /**
+ * Override toString() to avoid using the enum variable name as the value, and instead use
+ * the actual value defined in the API spec file.
+ *
+ * This solves a problem when the variable name and its value are different, and ensures that
+ * the client sends the correct enum values to the server always.
+ */
+ override fun toString(): String = value
+
+ companion object {
+ /**
+ * Converts the provided [data] to a [String] on success, null otherwise.
+ */
+ fun encode(data: Any?): String? = if (data is SigningAlgorithm) "$data" else null
+
+ /**
+ * Returns a valid [SigningAlgorithm] for [data], null otherwise.
+ */
+ fun decode(data: Any?): SigningAlgorithm? = data?.let {
+ val normalizedData = "$it".lowercase()
+ values().firstOrNull { value ->
+ it == value || normalizedData == "$value".lowercase()
+ }
+ }
+ }
+}
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/Transaction.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/Transaction.kt
new file mode 100644
index 0000000..e6b3b8d
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/Transaction.kt
@@ -0,0 +1,142 @@
+package org.onflow.flow.models
+
+import org.onflow.flow.infrastructure.BigIntegerCadenceSerializer
+import org.onflow.flow.infrastructure.Cadence
+import org.onflow.flow.infrastructure.addHexPrefix
+import org.onflow.flow.infrastructure.removeHexPrefix
+import org.onflow.flow.rlp.*
+import com.ionspin.kotlin.bignum.integer.BigInteger
+import io.ktor.util.*
+import io.ktor.utils.io.core.*
+import kotlinx.serialization.*
+import kotlinx.serialization.builtins.ListSerializer
+import kotlinx.serialization.descriptors.PrimitiveKind
+import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
+import kotlinx.serialization.descriptors.SerialDescriptor
+import kotlinx.serialization.encoding.Decoder
+import kotlinx.serialization.encoding.Encoder
+
+/**
+ *
+ *
+ * @param id A 32-byte unique identifier for an entity.
+ * @param script Base64 encoded Cadence script.
+ * @param arguments Array of Base64 encoded arguments with in [JSON-Cadence interchange format](https://docs.onflow.org/cadence/json-cadence-spec/).
+ * @param referenceBlockId A 32-byte unique identifier for an entity.
+ * @param gasLimit The limit on the amount of computation a transaction is allowed to preform.
+ * @param payer The 8-byte address of an account.
+ * @param proposalKey
+ * @param authorizers
+ * @param payloadSignatures
+ * @param envelopeSignatures
+ * @param expandable
+ * @param result
+ * @param links
+ */
+@Serializable
+data class Transaction (
+
+ /* A 32-byte unique identifier for an entity. */
+ @SerialName(value = "id") @Required val id: String? = null,
+
+ /* Base64 encoded Cadence script. */
+ @Serializable(Base64UFT8Serializer::class)
+ @SerialName(value = "script") @Required val script: String,
+
+ /* Array of Base64 encoded arguments with in [JSON-Cadence interchange format](https://docs.onflow.org/cadence/json-cadence-spec/). */
+ @Serializable(CadenceBase64ListSerializer::class)
+ @SerialName(value = "arguments") @Required val arguments: List,
+
+ /* A 32-byte unique identifier for an entity. */
+ @SerialName(value = "reference_block_id") @Required val referenceBlockId: String,
+
+ /* The limit on the amount of computation a transaction is allowed to preform. */
+ @Serializable(BigIntegerCadenceSerializer::class)
+ @SerialName(value = "gas_limit") @Required val gasLimit: BigInteger,
+
+ /* The 8-byte address of an account. */
+ @SerialName(value = "payer") @Required val payer: String,
+
+ @SerialName(value = "proposal_key") @Required val proposalKey: ProposalKey,
+
+ @SerialName(value = "authorizers") @Required val authorizers: List,
+
+ @SerialName(value = "payload_signatures") @Required val payloadSignatures: List = emptyList(),
+
+ @SerialName(value = "envelope_signatures") @Required val envelopeSignatures: List = emptyList(),
+
+ @SerialName(value = "_expandable") @Required val expandable: TransactionExpandable? = null,
+
+ @SerialName(value = "result") val result: TransactionResult? = null,
+
+ @SerialName(value = "_links") val links: Links? = null
+) {
+ val signers: Map
+ get() = listOf(listOf(proposalKey.address, payer), authorizers)
+ .flatten()
+ .toSet()
+ .mapIndexed{ index, item ->
+ item to index
+ }
+ .toMap()
+}
+
+fun Transaction.payload(): List = listOf(
+ script.toRLP(),
+ RLPList(arguments.map{ it.encode().toByteArray().toRLP() }),
+ hex(referenceBlockId).toRLP(),
+ gasLimit.toRLP(),
+ hex(proposalKey.address).paddingZeroLeft().toRLP(),
+ proposalKey.keyIndex.toRLP(),
+ proposalKey.sequenceNumber.toRLP(),
+ hex(payer).paddingZeroLeft().toRLP(),
+ RLPList(authorizers.map{hex(it).paddingZeroLeft().toRLP()})
+)
+
+fun Transaction.toRLP(): RLPElement = payload().toRLP()
+
+fun Transaction.payloadMessage(): ByteArray =
+ DomainTag.Transaction().bytes +
+ (RLPList(
+ listOf(
+ RLPList(payload()),
+ RLPList(
+ payloadSignatures.map {
+ listOf((signers[it.address] ?: -1).toRLP(), it.keyIndex.toRLP(), hex(it.signature).toRLP()).toRLP()
+ }
+ )
+ )
+ )).encode()
+
+object Base64UFT8Serializer : KSerializer {
+ override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("base64ToUTF8", PrimitiveKind.STRING)
+ override fun serialize(encoder: Encoder, value: String) = encoder.encodeString(value.toByteArray().encodeBase64())
+ override fun deserialize(decoder: Decoder): String = decoder.decodeString().decodeBase64Bytes().decodeToString()
+}
+
+object Base64HexSerializer : KSerializer {
+ override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("base64ToUTF8", PrimitiveKind.STRING)
+ override fun serialize(encoder: Encoder, value: String) = encoder.encodeString(hex(value.removeHexPrefix()).encodeBase64())
+ override fun deserialize(decoder: Decoder): String = hex(decoder.decodeString().decodeBase64Bytes()).addHexPrefix()
+}
+
+object CadenceBase64Serializer : KSerializer {
+ override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("CadenceBase64", PrimitiveKind.STRING)
+ override fun serialize(encoder: Encoder, value: Cadence.Value) = encoder.encodeString(value.encodeBase64())
+ override fun deserialize(decoder: Decoder): Cadence.Value = Cadence.Value.decodeFromBase64(decoder.decodeString())
+}
+
+class CadenceBase64ListSerializer : KSerializer> {
+ private val elementSerializer = ListSerializer(CadenceBase64Serializer)
+ override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("CadenceBase64List", PrimitiveKind.STRING)
+
+ override fun deserialize(decoder: Decoder): List {
+ return decoder.decodeSerializableValue(elementSerializer)
+ }
+
+ override fun serialize(encoder: Encoder, value: List) {
+ encoder.encodeSerializableValue(elementSerializer, value)
+ }
+}
+
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/TransactionExecution.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/TransactionExecution.kt
new file mode 100644
index 0000000..73c9aa4
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/TransactionExecution.kt
@@ -0,0 +1,49 @@
+package org.onflow.flow.models
+
+
+import kotlinx.serialization.*
+
+/**
+ * This value indicates whether the transaction execution succeded or not, this value should be checked when determining transaction success.
+ *
+ * Values: pending,success,failure
+ */
+@Serializable
+enum class TransactionExecution(val value: String) {
+
+ @SerialName(value = "Pending")
+ pending("Pending"),
+
+ @SerialName(value = "Success")
+ success("Success"),
+
+ @SerialName(value = "Failure")
+ failure("Failure");
+
+ /**
+ * Override toString() to avoid using the enum variable name as the value, and instead use
+ * the actual value defined in the API spec file.
+ *
+ * This solves a problem when the variable name and its value are different, and ensures that
+ * the client sends the correct enum values to the server always.
+ */
+ override fun toString(): String = value
+
+ companion object {
+ /**
+ * Converts the provided [data] to a [String] on success, null otherwise.
+ */
+ fun encode(data: Any?): String? = if (data is TransactionExecution) "$data" else null
+
+ /**
+ * Returns a valid [TransactionExecution] for [data], null otherwise.
+ */
+ fun decode(data: Any?): TransactionExecution? = data?.let {
+ val normalizedData = "$it".lowercase()
+ values().firstOrNull { value ->
+ it == value || normalizedData == "$value".lowercase()
+ }
+ }
+ }
+}
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/TransactionExpandable.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/TransactionExpandable.kt
new file mode 100644
index 0000000..06b19ff
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/TransactionExpandable.kt
@@ -0,0 +1,18 @@
+package org.onflow.flow.models
+
+import kotlinx.serialization.*
+import kotlinx.serialization.descriptors.*
+import kotlinx.serialization.encoding.*
+
+/**
+ *
+ *
+ * @param result
+ */
+@Serializable
+data class TransactionExpandable (
+
+ @SerialName(value = "result") val result: String? = null
+
+)
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/TransactionResult.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/TransactionResult.kt
new file mode 100644
index 0000000..31425db
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/TransactionResult.kt
@@ -0,0 +1,38 @@
+package org.onflow.flow.models
+import kotlinx.serialization.*
+
+/**
+ *
+ *
+ * @param blockId A 32-byte unique identifier for an entity.
+ * @param status
+ * @param statusCode
+ * @param errorMessage Provided transaction error in case the transaction wasn't successful.
+ * @param computationUsed
+ * @param events
+ * @param execution
+ * @param links
+ */
+@Serializable
+data class TransactionResult (
+
+ /* A 32-byte unique identifier for an entity. */
+ @SerialName(value = "block_id") @Required val blockId: String,
+
+ @SerialName(value = "status") @Required val status: TransactionStatus,
+
+ @SerialName(value = "status_code") @Required val statusCode: Int,
+
+ /* Provided transaction error in case the transaction wasn't successful. */
+ @SerialName(value = "error_message") @Required val errorMessage: String,
+
+ @SerialName(value = "computation_used") @Required val computationUsed: String,
+
+ @SerialName(value = "events") @Required val events: List,
+
+ @SerialName(value = "execution") val execution: TransactionExecution? = null,
+
+ @SerialName(value = "_links") val links: Links? = null
+
+)
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/TransactionSignature.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/TransactionSignature.kt
new file mode 100644
index 0000000..bc183c0
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/TransactionSignature.kt
@@ -0,0 +1,26 @@
+package org.onflow.flow.models
+
+import kotlinx.serialization.*
+import org.onflow.flow.infrastructure.Base64ByteArray
+
+/**
+ * Base64 encoded signature.
+ *
+ * @param address The 8-byte address of an account.
+ * @param keyIndex
+ * @param signature A variable length signature.
+ */
+@Serializable
+data class TransactionSignature (
+
+ /* The 8-byte address of an account. */
+ @SerialName(value = "address") @Required val address: String,
+
+ @SerialName(value = "key_index") @Required val keyIndex: String,
+
+ /* A variable length signature. */
+ @Serializable(Base64HexSerializer::class)
+ @SerialName(value = "signature") @Required val signature: String
+
+)
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/models/TransactionStatus.kt b/flow/src/commonMain/kotlin/org/onflow/flow/models/TransactionStatus.kt
new file mode 100644
index 0000000..f4d2ef3
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/models/TransactionStatus.kt
@@ -0,0 +1,54 @@
+package org.onflow.flow.models
+
+import kotlinx.serialization.*
+
+/**
+ * This value indicates the state of the transaction execution. Only sealed and expired are final and immutable states.
+ *
+ * Values: pending,finalized,executed,`sealed`,expired
+ */
+@Serializable
+enum class TransactionStatus(val value: String) {
+
+ @SerialName(value = "Pending")
+ PENDING("Pending"),
+
+ @SerialName(value = "Finalized")
+ FINALIZED("Finalized"),
+
+ @SerialName(value = "Executed")
+ EXECUTED("Executed"),
+
+ @SerialName(value = "Sealed")
+ SEALED("Sealed"),
+
+ @SerialName(value = "Expired")
+ EXPIRED("Expired");
+
+ /**
+ * Override toString() to avoid using the enum variable name as the value, and instead use
+ * the actual value defined in the API spec file.
+ *
+ * This solves a problem when the variable name and its value are different, and ensures that
+ * the client sends the correct enum values to the server always.
+ */
+ override fun toString(): String = value
+
+ companion object {
+ /**
+ * Converts the provided [data] to a [String] on success, null otherwise.
+ */
+ fun encode(data: Any?): String? = if (data is TransactionStatus) "$data" else null
+
+ /**
+ * Returns a valid [TransactionStatus] for [data], null otherwise.
+ */
+ fun decode(data: Any?): TransactionStatus? = data?.let {
+ val normalizedData = "$it".lowercase()
+ values().firstOrNull { value ->
+ it == value || normalizedData == "$value".lowercase()
+ }
+ }
+ }
+}
+
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/rlp/RLPDecoder.kt b/flow/src/commonMain/kotlin/org/onflow/flow/rlp/RLPDecoder.kt
new file mode 100644
index 0000000..58da844
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/rlp/RLPDecoder.kt
@@ -0,0 +1,51 @@
+package org.onflow.flow.rlp
+
+/**
+ Original file: https://github.com/komputing/KEthereum/blob/master/rlp/src/main/kotlin/org/kethereum/rlp
+ Convert it to KMM compatible
+ */
+
+import com.ionspin.kotlin.bignum.integer.BigInteger
+import com.ionspin.kotlin.bignum.integer.Sign
+
+fun ByteArray.decodeRLP() = decodeRLPWithSize().element
+
+private data class DecodeResult(val element: RLPType, val size: Int)
+
+private data class LengthAndOffset(val length: Int, val offset: Int)
+
+private fun ByteArray.decodeRLPWithSize(offset: Int = 0): DecodeResult {
+
+ if (offset >= size) {
+ throw IllegalRLPException("Cannot decode RLP at offset=$offset and size=$size")
+ }
+
+ val value = this[offset].toInt() and 0xFF
+ return when {
+ value < ELEMENT_OFFSET -> DecodeResult(value.toByte().toRLP(), 1)
+ value < LIST_OFFSET -> (value - ELEMENT_OFFSET).let {
+ val lengthAndOffset = getLengthAndOffset(it, offset)
+ DecodeResult(copyOfRange(lengthAndOffset.offset, lengthAndOffset.offset + lengthAndOffset.length).toRLP(), lengthAndOffset.length + lengthAndOffset.offset - offset)
+ }
+ else -> (value - LIST_OFFSET).let {
+ val list = mutableListOf()
+
+ val lengthAndOffset = getLengthAndOffset(it, offset)
+ var currentOffset = lengthAndOffset.offset
+ while (currentOffset < lengthAndOffset.offset + lengthAndOffset.length) {
+ val element = decodeRLPWithSize(currentOffset)
+ currentOffset += element.size
+ list.add(element.element)
+ }
+ DecodeResult(RLPList(list), (lengthAndOffset.offset + lengthAndOffset.length) - offset)
+ }
+ }
+}
+
+private fun ByteArray.getLengthAndOffset(firstByte: Int, offset: Int) = if (firstByte <= 55) {
+ LengthAndOffset(firstByte, offset + 1)
+} else {
+ val size = firstByte - 54
+ val length = BigInteger.fromByteArray(copyOfRange(offset + 1, offset + size), Sign.POSITIVE).intValue()
+ LengthAndOffset(length, offset + size)
+}
\ No newline at end of file
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/rlp/RLPEncoder.kt b/flow/src/commonMain/kotlin/org/onflow/flow/rlp/RLPEncoder.kt
new file mode 100644
index 0000000..6cc6c2b
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/rlp/RLPEncoder.kt
@@ -0,0 +1,20 @@
+package org.onflow.flow.rlp
+/**
+ Original file: https://github.com/komputing/KEthereum/blob/master/rlp/src/main/kotlin/org/kethereum/rlp
+ Convert it to KMM compatible
+ */
+
+fun RLPType.encode(): ByteArray = when (this) {
+ is RLPElement -> bytes.encodeLegacyTxRLP(ELEMENT_OFFSET)
+ is RLPList -> element.asSequence().map { it.encode() }
+ .fold(ByteArray(0)) { acc, bytes -> acc + bytes } // this can be speed optimized when needed
+ .encodeLegacyTxRLP(LIST_OFFSET)
+}
+
+internal fun ByteArray.encodeLegacyTxRLP(offset: Int) = when {
+ size == 1 && ((first().toInt() and 0xff) < ELEMENT_OFFSET) && offset == ELEMENT_OFFSET -> this
+ size <= 55 -> ByteArray(1) { (size + offset).toByte() }.plus(this)
+ else -> size.toMinimalByteArray().let { arr ->
+ ByteArray(1) { (offset + 55 + arr.size).toByte() } + arr + this
+ }
+}
\ No newline at end of file
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/rlp/RLPModel.kt b/flow/src/commonMain/kotlin/org/onflow/flow/rlp/RLPModel.kt
new file mode 100644
index 0000000..81e75a2
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/rlp/RLPModel.kt
@@ -0,0 +1,25 @@
+package org.onflow.flow.rlp
+
+/**
+ Original file: https://github.com/komputing/KEthereum/blob/master/rlp/src/main/kotlin/org/kethereum/rlp
+ Convert it to KMM compatible
+ */
+
+internal const val ELEMENT_OFFSET = 128
+internal const val LIST_OFFSET = 192
+
+sealed class RLPType
+
+data class RLPElement(val bytes: ByteArray) : RLPType() {
+
+ override fun equals(other: Any?) = when (other) {
+ is RLPElement -> bytes.contentEquals(other.bytes)
+ else -> false
+ }
+
+ override fun hashCode() = bytes.contentHashCode()
+}
+
+data class RLPList(val element: List) : RLPType()
+
+class IllegalRLPException(msg: String) : IllegalArgumentException(msg)
\ No newline at end of file
diff --git a/flow/src/commonMain/kotlin/org/onflow/flow/rlp/RLPTypeConverter.kt b/flow/src/commonMain/kotlin/org/onflow/flow/rlp/RLPTypeConverter.kt
new file mode 100644
index 0000000..cbc56bd
--- /dev/null
+++ b/flow/src/commonMain/kotlin/org/onflow/flow/rlp/RLPTypeConverter.kt
@@ -0,0 +1,60 @@
+package org.onflow.flow.rlp
+
+import com.ionspin.kotlin.bignum.integer.BigInteger
+import com.ionspin.kotlin.bignum.integer.BigInteger.Companion.ZERO
+import com.ionspin.kotlin.bignum.integer.Sign
+import io.ktor.utils.io.core.*
+
+/**
+ Original file: https://github.com/komputing/KEthereum/blob/master/rlp/src/main/kotlin/org/kethereum/rlp
+ Convert it to KMM compatible
+ */
+
+fun String.toRLP() = RLPElement(toByteArray())
+fun Int.toRLP() = RLPElement(toMinimalByteArray())
+fun BigInteger.toRLP() = RLPElement(toByteArray().removeLeadingZero())
+fun ByteArray.toRLP() = RLPElement(this)
+fun Byte.toRLP() = RLPElement(ByteArray(1) { this })
+fun List.toRLP() = RLPElement(RLPList(this.map { it }).encode())
+
+// from RLP
+fun RLPElement.toIntFromRLP() = if (bytes.isEmpty()) {
+ 0
+} else {
+ bytes.mapIndexed { index, byte -> (byte.toInt() and 0xff).shl((bytes.size - 1 - index) * 8) }
+ .reduce { acc, i -> acc + i }
+}
+
+fun RLPElement.toUnsignedBigIntegerFromRLP(): BigInteger = if (bytes.isEmpty()) ZERO else BigInteger.fromByteArray(bytes, Sign.POSITIVE)
+fun RLPElement.toByteFromRLP(): Byte {
+ require(bytes.size == 1) { "trying to convert RLP with != 1 byte to Byte" }
+ return bytes.first()
+}
+
+fun RLPElement.toStringFromRLP() = String(bytes)
+
+fun Int.toByteArray() = ByteArray(4) { i ->
+ shr(8 * (3 - i)).toByte()
+}
+
+private fun ByteArray.minimalStart() = indexOfFirst { it != 0.toByte() }.let { if (it == -1) 4 else it }
+
+fun Int.toMinimalByteArray() = toByteArray().let {
+ it.copyOfRange(it.minimalStart(), 4)
+}
+fun ByteArray.removeLeadingZero() = if (first() == 0.toByte()) copyOfRange(1, size) else this
+
+
+fun ByteArray.paddingZeroLeft(blockSize: Int = 8): ByteArray {
+ if (size >= blockSize) {
+ return this
+ }
+ return ByteArray(size = blockSize - size) + this
+}
+
+fun ByteArray.paddingZeroRight(blockSize: Int = 8): ByteArray {
+ if (size >= blockSize) {
+ return this
+ }
+ return this + ByteArray(size = blockSize - size)
+}
\ No newline at end of file
diff --git a/flow/src/commonTest/kotlin/org/onflow/flow/FlowApiTests.kt b/flow/src/commonTest/kotlin/org/onflow/flow/FlowApiTests.kt
new file mode 100644
index 0000000..d40268d
--- /dev/null
+++ b/flow/src/commonTest/kotlin/org/onflow/flow/FlowApiTests.kt
@@ -0,0 +1,56 @@
+package org.onflow.flow
+
+import org.onflow.flow.cadence.TestStruct
+import kotlinx.coroutines.runBlocking
+import kotlinx.serialization.encodeToString
+import kotlinx.serialization.json.Json
+import org.onflow.flow.infrastructure.Cadence
+import org.onflow.flow.infrastructure.toJsonElement
+import kotlinx.serialization.Serializable
+import kotlin.test.Ignore
+import kotlin.test.Test
+import kotlin.test.assertEquals
+import kotlin.test.assertTrue
+
+class FlowApiTests {
+
+ private val api = FlowApi(ChainId.Testnet)
+ private val format = Json { prettyPrint = true }
+
+ @Test
+ @Ignore
+ fun testGetAccount() {
+ runBlocking {
+ val account = api.getAccount("0x328649a25184b171")
+ println(format.encodeToString(account))
+ assertEquals("328649a25184b171", account.address)
+ assertTrue(true == account.keys?.isNotEmpty())
+ }
+ }
+
+ @Test
+ @Ignore
+ fun testGetBlock() {
+ runBlocking {
+ val block = api.getBlock()
+ println(format.encodeToString(block))
+ assertTrue(block.header.id.isNotEmpty())
+ }
+ }
+
+ @Test
+ @Ignore
+ fun testRunScript() {
+ runBlocking {
+ val response = api.executeScript("""
+ pub fun main(name: String): String {
+ let greeting = "Hello, "
+ return greeting.concat(name)
+ }
+ """.trimIndent(), listOf(Cadence.string("Ryan")))
+ println(format.encodeToString(response))
+ val result = response.decode()
+ assertTrue(result == "Hello, Ryan")
+ }
+ }
+}
\ No newline at end of file
diff --git a/flow/src/commonTest/kotlin/org/onflow/flow/FlowMainnetApiTests.kt b/flow/src/commonTest/kotlin/org/onflow/flow/FlowMainnetApiTests.kt
new file mode 100644
index 0000000..37dfff2
--- /dev/null
+++ b/flow/src/commonTest/kotlin/org/onflow/flow/FlowMainnetApiTests.kt
@@ -0,0 +1,73 @@
+package org.onflow.flow
+
+import org.onflow.flow.cadence.TestStruct
+import org.onflow.flow.infrastructure.Cadence
+import org.onflow.flow.infrastructure.getField
+import kotlinx.coroutines.runBlocking
+import kotlin.test.Ignore
+import kotlin.test.Test
+import kotlin.test.assertEquals
+import kotlin.test.assertTrue
+
+class FlowMainnetApiTests {
+
+ val api = FlowApi(ChainId.Mainnet)
+
+ @Test
+ @Ignore
+ fun testGetTransactionID() {
+ runBlocking {
+ val tx = api.getTransaction("663869d910278d7b6caf793396f6f2c5b91aace7180c2c70cfb3b0b6efd7a049")
+ assertEquals(1, tx.arguments.count())
+ assertEquals(291975851UL, tx.arguments.first().decode())
+ assertTrue( tx.payloadSignatures.first().signature.startsWith("0xfe25c43444") )
+ }
+ }
+
+ @Test
+ @Ignore
+ fun testGetEvents() {
+ runBlocking {
+ val result = api.getTransactionResult("663869d910278d7b6caf793396f6f2c5b91aace7180c2c70cfb3b0b6efd7a049")
+ val event = result.events.first().payload.value as Cadence.CompositeValue
+ assertEquals("A.b8ea91944fd51c43.Offers.OfferCompleted", event.id)
+ assertEquals(291975851UL, event.getField("offerId"))
+ }
+ }
+
+ @Test
+ @Ignore
+ fun decodeStruct() {
+ runBlocking {
+ val result = api.executeScript(
+ """
+ pub struct StorageInfo {
+ pub let capacity: Int
+ pub let used: Int
+ pub let available: Int
+
+ init(capacity: Int, used: Int, available: Int) {
+ self.capacity = capacity
+ self.used = used
+ self.available = available
+ }
+ }
+
+ pub fun main(addr: Address): [StorageInfo] {
+ let acct = getAccount(addr)
+ return [StorageInfo(capacity: 1,
+ used: 2,
+ available: 3)]
+ }
+ """.trimIndent(),
+ listOf(Cadence.address("0x84221fe0294044d7"))
+ )
+
+ val info = result.decode>().first()
+
+ assertEquals(1, info.capacity)
+ assertEquals(2, info.used)
+ assertEquals(3, info.available)
+ }
+ }
+}
\ No newline at end of file
diff --git a/flow/src/commonTest/kotlin/org/onflow/flow/cadence/CadenceTests.kt b/flow/src/commonTest/kotlin/org/onflow/flow/cadence/CadenceTests.kt
new file mode 100644
index 0000000..a490c34
--- /dev/null
+++ b/flow/src/commonTest/kotlin/org/onflow/flow/cadence/CadenceTests.kt
@@ -0,0 +1,211 @@
+package org.onflow.flow.cadence
+
+import org.onflow.flow.infrastructure.*
+import com.ionspin.kotlin.bignum.decimal.RoundingMode
+import com.ionspin.kotlin.bignum.integer.BigInteger
+import com.ionspin.kotlin.bignum.integer.toBigInteger
+import kotlinx.serialization.encodeToString
+import kotlinx.serialization.json.Json
+import kotlinx.serialization.PolymorphicSerializer
+import kotlinx.serialization.Serializable
+import kotlinx.serialization.decodeFromString
+import kotlinx.serialization.modules.polymorphic
+import kotlinx.serialization.modules.subclass
+import kotlinx.serialization.modules.SerializersModule
+import kotlin.test.Test
+import kotlin.test.assertEquals
+import kotlin.reflect.KClass
+
+@Serializable
+data class TestStruct(
+ val capacity: Int,
+ val used: Int,
+ val available: Int
+)
+
+class CadenceTests {
+
+ @Test
+ fun testVoid() {
+ val rawValue: Unit? = null
+ val field = Cadence.void()
+ val jsonString = "{\"type\":\"Void\"}"
+ genericCadenceTest(field, null, jsonString, rawValue)
+ }
+
+ @Test
+ fun testOptional() {
+ var rawValue: String? = "bar"
+ var field = Cadence.optional(Cadence.string("bar"))
+ var jsonString = "{\"type\":\"Optional\",\"value\":{\"type\":\"String\",\"value\":\"bar\"}}"
+ genericCadenceTest(field, Cadence.string("bar"), jsonString, rawValue)
+
+ rawValue = null
+ field = Cadence.optional(null)
+ jsonString = "{\"type\":\"Optional\",\"value\":null}"
+ genericCadenceTest(field, null, jsonString, rawValue)
+ }
+
+ @Test
+ fun testString() {
+ val value = "foo"
+ val field = Cadence.string(value)
+ val jsonString = "{\"type\":\"String\",\"value\":\"$value\"}"
+ genericCadenceTest(field, value, jsonString, value)
+ }
+
+ @Test
+ fun testAddress() {
+ val value = "0x84221fe0294044d7"
+ val field = Cadence.address(value)
+ val jsonString = "{\"type\":\"Address\",\"value\":\"$value\"}"
+ genericCadenceTest(field, value, jsonString, value)
+ }
+
+ @Test
+ fun testInt() {
+ val value = 123
+ val field = Cadence.int(value)
+ val jsonString = "{\"type\":\"Int\",\"value\":\"$value\"}"
+ genericCadenceTest(field, value, jsonString, value)
+ }
+
+ @Test
+ fun testUInt() {
+ val value: UInt = 8u
+ val field = Cadence.uint(value)
+ val jsonString = "{\"type\":\"UInt\",\"value\":\"$value\"}"
+ genericCadenceTest(field, value, jsonString, value)
+ }
+
+ @Test
+ fun testWord8() {
+ val value: UByte = 8u
+ val field = Cadence.word8(value)
+ val jsonString = "{\"type\":\"Word8\",\"value\":\"$value\"}"
+ genericCadenceTest(field, value, jsonString, value)
+ }
+
+ @Test
+ fun testUInt128() {
+ val value: BigInteger = "8507059173023461585662027982108".toBigInteger()
+ val field = Cadence.uint128(value)
+ val jsonString = "{\"type\":\"UInt128\",\"value\":\"$value\"}"
+ genericCadenceTest(field, value, jsonString, value)
+ }
+
+ @Test
+ fun testInt256() {
+ val value: BigInteger = "-85070591730234615856620279821087277056".toBigInteger()
+ val field = Cadence.int256(value)
+ val jsonString = "{\"type\":\"Int256\",\"value\":\"$value\"}"
+ genericCadenceTest(field, value, jsonString, value)
+ }
+
+ @Test
+ fun testBoolean() {
+ val rawValue = true
+ val field = Cadence.bool(rawValue)
+ val jsonString = "{\"type\":\"Bool\",\"value\":true}"
+ genericCadenceTest(field, true, jsonString, rawValue)
+ }
+
+ @Test
+ fun testFix64() {
+ val value = 23.098842
+ val field = Cadence.fix64(value)
+ val jsonString = "{\"type\":\"Fix64\",\"value\":\"23.09884200\"}"
+ genericCadenceTest(field, value, jsonString, value)
+ }
+
+ @Test
+ fun testArray() {
+ val rawValue = listOf("bar", "foo")
+ val cadenceInt = Cadence.string("bar")
+ val cadenceOptional = Cadence.optional(Cadence.string("foo"))
+ val cadenceList = listOf(cadenceInt, cadenceOptional)
+ val field = Cadence.array(cadenceList)
+ val jsonString = "{\"type\":\"Array\",\"value\":[{\"type\":\"String\",\"value\":\"bar\"},{\"type\":\"Optional\",\"value\":{\"type\":\"String\",\"value\":\"foo\"}}]}"
+ genericCadenceTest>(field, cadenceList, jsonString, rawValue)
+ }
+
+ @Test
+ fun testStruct() {
+ val value = listOf(TestStruct(1,2,3))
+ val cadenceStruct = Cadence.struct(
+ Cadence.CompositeValue(
+ id = "s.ae201908260897d0362313d810b2e5dc5aa7d48af253e068b716a0ce7ac0212e.StorageInfo",
+ listOf(
+ Cadence.CompositeAttribute("capacity", Cadence.int(1)),
+ Cadence.CompositeAttribute("used", Cadence.int(2)),
+ Cadence.CompositeAttribute("available", Cadence.int(3))
+ )
+ )
+ )
+ val cadenceList = listOf(cadenceStruct)
+ val field = Cadence.array(cadenceList)
+ val jsonString = "{\"type\":\"Array\",\"value\":[{\"type\":\"Struct\",\"value\":{\"id\":\"s.ae201908260897d0362313d810b2e5dc5aa7d48af253e068b716a0ce7ac0212e.StorageInfo\",\"fields\":[{\"name\":\"capacity\",\"value\":{\"type\":\"Int\",\"value\":\"1\"}},{\"name\":\"used\",\"value\":{\"type\":\"Int\",\"value\":\"2\"}},{\"name\":\"available\",\"value\":{\"type\":\"Int\",\"value\":\"3\"}}]}}]}"
+
+ genericCadenceTest>(field, cadenceList, jsonString, value)
+ }
+
+ @Test
+ fun testDictionary() {
+ val rawValue = mapOf(
+ 42 to "foo"
+ )
+ val cadenceInt = Cadence.int(42)
+ val cadenceOptional = Cadence.optional(Cadence.string("foo"))
+ val dict = listOf(Cadence.DictionaryFieldEntry(cadenceInt to cadenceOptional))
+ val field = Cadence.dictionary(dict)
+ val jsonString = "{\"type\":\"Dictionary\",\"value\":[{\"key\":{\"type\":\"Int\",\"value\":\"42\"},\"value\":{\"type\":\"Optional\",\"value\":{\"type\":\"String\",\"value\":\"foo\"}}}]}"
+ genericCadenceTest(field, dict, jsonString, rawValue)
+ }
+
+ @Test
+ fun testComposite() {
+ @Serializable
+ data class TestContract(
+ val foo: Int
+ )
+ val rawValue = TestContract(42)
+ val id = "some.id"
+ val cadenceInt = Cadence.int(42)
+ val compositeValue = Cadence.CompositeAttribute("foo", cadenceInt)
+ val cadenceCompositeValue = Cadence.CompositeValue(id, listOf( compositeValue))
+ val field = Cadence.contractValue(cadenceCompositeValue)
+ val jsonString = "{\"type\":\"Contract\",\"value\":{\"id\":\"some.id\",\"fields\":[{\"name\":\"foo\",\"value\":{\"type\":\"Int\",\"value\":\"42\"}}]}}"
+ genericCadenceTest(field, cadenceCompositeValue, jsonString, rawValue)
+ }
+
+ @Test
+ fun testPath() {
+ val cadenceValue = Cadence.Path(Cadence.PathDomain.STORAGE, "someIdentifier")
+ val field = Cadence.path(Cadence.PathDomain.STORAGE, "someIdentifier")
+ val jsonString = "{\"type\":\"Path\",\"value\":{\"domain\":\"storage\",\"identifier\":\"someIdentifier\"}}"
+ genericCadenceTest(field, cadenceValue, jsonString, cadenceValue)
+ }
+
+ @Test
+ fun testCapability() {
+ val cadenceValue = Cadence.Capability("/public/someInteger", "0x1", Cadence.Type.INT)
+ val field = Cadence.capability(cadenceValue)
+ val jsonString = "{\"type\":\"Capability\",\"value\":{\"path\":\"/public/someInteger\",\"address\":\"0x1\",\"borrowType\":\"Int\"}}"
+ genericCadenceTest(field, cadenceValue, jsonString, cadenceValue)
+ }
+
+ private inline fun genericCadenceTest(field: Cadence.Value, value: Any?, jsonString: String, rawValue: T) {
+ // Decode Test
+ val result = Cadence.Value.decodeFromJson(jsonString)
+ assertEquals(field, result)
+ assertEquals(result.value, value)
+
+ // Encode Test
+ val encoded = field.encode()
+ assertEquals(jsonString, encoded)
+
+ // Decode to Kotlin value
+ val decode = result.decode()
+ assertEquals(rawValue, decode)
+ }
+}
\ No newline at end of file
diff --git a/flow/src/commonTest/kotlin/org/onflow/flow/rlp/RLPTests.kt b/flow/src/commonTest/kotlin/org/onflow/flow/rlp/RLPTests.kt
new file mode 100644
index 0000000..6f66c18
--- /dev/null
+++ b/flow/src/commonTest/kotlin/org/onflow/flow/rlp/RLPTests.kt
@@ -0,0 +1,37 @@
+package org.onflow.flow.rlp
+
+import org.onflow.flow.models.ProposalKey
+import org.onflow.flow.models.Transaction
+import org.onflow.flow.models.payloadMessage
+import com.ionspin.kotlin.bignum.integer.BigInteger
+import io.ktor.util.*
+import kotlin.test.Test
+import kotlin.test.assertEquals
+
+class RLPTests {
+
+ @Test
+ fun testSimpleDecode() {
+ val rlpString = "f83f800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870b801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a3664935301"
+ val list = hex(rlpString).decodeRLP() as RLPList
+ val size = list.element.size
+ assertEquals(9, size)
+ }
+
+ @Test
+ fun testSimpleFlowTxEncode() {
+ val tx = Transaction(
+ script = "transaction { execute { log(\"Hello, World!\") } }",
+ arguments = listOf(),
+ referenceBlockId = "f0e4c2f76c58916ec258f246851bea091d14d4247a2fc3e18694461b1816e13b",
+ gasLimit = BigInteger(42),
+ proposalKey = ProposalKey(address = "01", keyIndex = 4, sequenceNumber = BigInteger(10)),
+ payer = "01",
+ authorizers = listOf("01")
+ )
+ val hexString = hex(tx.payloadMessage())
+ println(hexString)
+ val rlpString = "464c4f572d56302e302d7472616e73616374696f6e0000000000000000000000f875f872b07472616e73616374696f6e207b2065786563757465207b206c6f67282248656c6c6f2c20576f726c64212229207d207dc0a0f0e4c2f76c58916ec258f246851bea091d14d4247a2fc3e18694461b1816e13b2a880000000000000001040a880000000000000001c9880000000000000001c0"
+ assertEquals(rlpString, hexString)
+ }
+}
\ No newline at end of file
diff --git a/flow/src/iosMain/kotlin/org/onflow/flow/FlowApi.kt b/flow/src/iosMain/kotlin/org/onflow/flow/FlowApi.kt
new file mode 100644
index 0000000..b03183f
--- /dev/null
+++ b/flow/src/iosMain/kotlin/org/onflow/flow/FlowApi.kt
@@ -0,0 +1,28 @@
+package org.onflow.flow
+
+import kotlinx.coroutines.CoroutineDispatcher
+import kotlinx.coroutines.CoroutineScope
+import kotlinx.coroutines.Job
+import kotlinx.coroutines.Runnable
+import org.onflow.flow.models.Account
+import platform.darwin.dispatch_async
+import platform.darwin.dispatch_get_main_queue
+import kotlin.coroutines.CoroutineContext
+
+internal class MainDispatcher : CoroutineDispatcher() {
+ override fun dispatch(context: CoroutineContext, block: Runnable) {
+ dispatch_async(dispatch_get_main_queue()) { block.run() }
+ }
+}
+
+internal class MainScope : CoroutineScope {
+ private val dispatcher = MainDispatcher()
+ private val job = Job()
+
+ override val coroutineContext: CoroutineContext
+ get() = dispatcher + job
+}
+
+suspend fun FlowApi.getAccount(address: String): Account {
+ return getAccount(address)
+}
\ No newline at end of file
diff --git a/flow/src/iosMain/kotlin/org/onflow/flow/infrastructure/FixedPointFormatter.kt b/flow/src/iosMain/kotlin/org/onflow/flow/infrastructure/FixedPointFormatter.kt
new file mode 100644
index 0000000..999ab0c
--- /dev/null
+++ b/flow/src/iosMain/kotlin/org/onflow/flow/infrastructure/FixedPointFormatter.kt
@@ -0,0 +1,16 @@
+package org.onflow.flow.infrastructure
+
+import platform.Foundation.NSDecimalNumber
+import platform.Foundation.NSNumberFormatter
+import platform.Foundation.NSNumberFormatterDecimalStyle
+
+actual object FixedPointFormatter {
+ actual fun format(num: String, precision: ULong): String? {
+ val formatter = NSNumberFormatter()
+ formatter.minimumFractionDigits = precision
+ formatter.maximumFractionDigits = precision
+ formatter.numberStyle = NSNumberFormatterDecimalStyle
+ val nsNum = NSDecimalNumber(num)
+ return formatter.stringFromNumber(nsNum)
+ }
+}
\ No newline at end of file
diff --git a/flow/swiftpackage/Flow.xcframework/Info.plist b/flow/swiftpackage/Flow.xcframework/Info.plist
new file mode 100644
index 0000000..0d85292
--- /dev/null
+++ b/flow/swiftpackage/Flow.xcframework/Info.plist
@@ -0,0 +1,43 @@
+
+
+
+
+ AvailableLibraries
+
+
+ DebugSymbolsPath
+ dSYMs
+ LibraryIdentifier
+ ios-arm64
+ LibraryPath
+ Flow.framework
+ SupportedArchitectures
+
+ arm64
+
+ SupportedPlatform
+ ios
+
+
+ DebugSymbolsPath
+ dSYMs
+ LibraryIdentifier
+ ios-x86_64-simulator
+ LibraryPath
+ Flow.framework
+ SupportedArchitectures
+
+ x86_64
+
+ SupportedPlatform
+ ios
+ SupportedPlatformVariant
+ simulator
+
+
+ CFBundlePackageType
+ XFWK
+ XCFrameworkFormatVersion
+ 1.0
+
+
diff --git a/flow/swiftpackage/Flow.xcframework/ios-arm64/Flow.framework/Flow b/flow/swiftpackage/Flow.xcframework/ios-arm64/Flow.framework/Flow
new file mode 100755
index 0000000..5a4e6f3
Binary files /dev/null and b/flow/swiftpackage/Flow.xcframework/ios-arm64/Flow.framework/Flow differ
diff --git a/flow/swiftpackage/Flow.xcframework/ios-arm64/Flow.framework/Headers/Flow.h b/flow/swiftpackage/Flow.xcframework/ios-arm64/Flow.framework/Headers/Flow.h
new file mode 100644
index 0000000..f1bd974
--- /dev/null
+++ b/flow/swiftpackage/Flow.xcframework/ios-arm64/Flow.framework/Headers/Flow.h
@@ -0,0 +1,5307 @@
+#import
+#import
+#import
+#import
+#import
+#import
+#import
+
+@class FlowChainId, FlowChainIdCanary, FlowChainIdCustom, FlowChainIdEmulator, FlowChainIdMainnet, FlowChainIdSandboxnet, FlowChainIdTestnet, FlowCadenceValue, FlowAccount, FlowBlock, FlowBlockHeader, FlowCollection, FlowBlockEvents, FlowExecutionResult, FlowTransaction, FlowTransactionResult, FlowKotlinThrowable, FlowKotlinArray, FlowKotlinException, FlowKotlinRuntimeException, FlowKotlinIllegalArgumentException, FlowRLPType, FlowKotlinByteArray, FlowRLPElement, FlowRLPList, FlowApiBaseCompanion, FlowKtor_client_coreHttpClient, FlowBase64ByteArrayCompanion, FlowBase64ByteArray, FlowBigDecimalCadenceSerializer, FlowBignumBigDecimal, FlowBigIntegerCadenceSerializer, FlowBignumBigInteger, FlowByteCadenceSerializer, FlowCadenceCompanion, FlowCadenceType, FlowCadenceCapabilityCompanion, FlowCadenceCapability, FlowCadenceValueAddressValue, FlowCadenceValueArrayValue, FlowCadenceValueBooleanValue, FlowCadenceValueCapabilityValue, FlowCadenceValueContractValue, FlowCadenceCompositeValue, FlowCadenceValueDictionaryValue, FlowCadenceDictionaryFieldEntry, FlowCadenceValueFix64Value, FlowCadenceValueIntValue, FlowCadenceValueInt128Value, FlowCadenceValueInt16Value, FlowCadenceValueInt256Value, FlowCadenceValueInt32Value, FlowCadenceValueInt64Value, FlowCadenceValueInt8Value, FlowCadenceValueOptionalValue, FlowCadenceValuePathValue, FlowCadencePath, FlowCadencePathDomain, FlowCadenceValueStringValue, FlowCadenceValueStructValue, FlowCadenceValueTypeValue, FlowCadenceKind, FlowCadenceTypeEntry, FlowCadenceValueUFix64Value, FlowCadenceValueUIntValue, FlowCadenceValueUInt128Value, FlowCadenceValueUInt16Value, FlowCadenceValueUInt256Value, FlowCadenceValueUInt32Value, FlowCadenceValueUInt64Value, FlowCadenceValueUInt8Value, FlowCadenceValueVoidValue, FlowCadenceValueWord16Value, FlowCadenceValueWord32Value, FlowCadenceValueWord64Value, FlowCadenceValueWord8Value, FlowCadenceCompositeAttributeCompanion, FlowCadenceCompositeAttribute, FlowCadenceCompositeValueCompanion, FlowKotlinPair<__covariant A, __covariant B>, FlowCadenceDictionaryFieldEntryCompanion, FlowCadenceKindCompanion, FlowCadencePathCompanion, FlowKotlinEnumCompanion, FlowKotlinEnum, FlowCadencePathDomainCompanion, FlowCadenceTypeCompanion, FlowCadenceTypeEntryCompanion, FlowCadenceValueCompanion, FlowCadenceValueAddressValueCompanion, FlowCadenceValueArrayValueCompanion, FlowCadenceValueBooleanValueCompanion, FlowCadenceValueCapabilityValueCompanion, FlowKotlinx_serialization_jsonJsonElement, FlowKotlinx_serialization_jsonJson, FlowCadenceValueContractValueCompanion, FlowCadenceValueDictionaryValueCompanion, FlowCadenceValueEnumValueCompanion, FlowCadenceValueEnumValue, FlowCadenceValueEventValueCompanion, FlowCadenceValueEventValue, FlowCadenceValueFix64ValueCompanion, FlowCadenceValueInt128ValueCompanion, FlowCadenceValueInt16ValueCompanion, FlowCadenceValueInt256ValueCompanion, FlowCadenceValueInt32ValueCompanion, FlowCadenceValueInt64ValueCompanion, FlowCadenceValueInt8ValueCompanion, FlowCadenceValueIntValueCompanion, FlowCadenceValueOptionalValueCompanion, FlowCadenceValuePathValueCompanion, FlowCadenceValueResourceValueCompanion, FlowCadenceValueResourceValue, FlowCadenceValueStringValueCompanion, FlowCadenceValueStructValueCompanion, FlowCadenceValueTypeValueCompanion, FlowCadenceValueUFix64ValueCompanion, FlowCadenceValueUInt128ValueCompanion, FlowCadenceValueUInt16ValueCompanion, FlowCadenceValueUInt256ValueCompanion, FlowCadenceValueUInt32ValueCompanion, FlowCadenceValueUInt64ValueCompanion, FlowCadenceValueUInt8ValueCompanion, FlowCadenceValueUIntValueCompanion, FlowKotlinUnit, FlowCadenceValueVoidValueCompanion, FlowCadenceValueWord16ValueCompanion, FlowCadenceValueWord32ValueCompanion, FlowCadenceValueWord64ValueCompanion, FlowCadenceValueWord8ValueCompanion, FlowCadenceTypeSerializer, FlowDoubleCadenceSerializer, FlowFixedPointFormatter, FlowIntCadenceSerializer, FlowLongCadenceSerializer, FlowShortCadenceSerializer, FlowUByteCadenceSerializer, FlowUIntCadenceSerializer, FlowULongCadenceSerializer, FlowUShortCadenceSerializer, FlowAccountExpandable, FlowAccountPublicKey, FlowLinks, FlowAccountCompanion, FlowAccountExpandableCompanion, FlowSigningAlgorithm, FlowHashingAlgorithm, FlowAccountPublicKeyCompanion, FlowAggregatedSignatureCompanion, FlowAggregatedSignature, FlowBase64HexSerializer, FlowBase64UFT8Serializer, FlowBlockExpandable, FlowBlockPayload, FlowBlockCompanion, FlowEvent, FlowBlockEventsCompanion, FlowBlockExpandableCompanion, FlowBlockHeaderCompanion, FlowBlockHeightOneOfCompanion, FlowBlockHeightOneOf, FlowCollectionGuarantee, FlowBlockSeal, FlowBlockPayloadCompanion, FlowBlockSealCompanion, FlowCadenceBase64Serializer, FlowChunkCompanion, FlowChunk, FlowCollectionExpandable, FlowCollectionCompanion, FlowCollectionExpandableCompanion, FlowCollectionGuaranteeCompanion, FlowDomainTag, FlowDomainTagAccountProof, FlowDomainTagCustom, FlowDomainTagTransaction, FlowDomainTagUser, FlowErrorCompanion, FlowError, FlowEventCompanion, FlowExecutionResultCompanion, FlowHashingAlgorithmCompanion, FlowLinksCompanion, FlowProposalKeyCompanion, FlowProposalKey, FlowScriptsPostRequestCompanion, FlowScriptsPostRequest, FlowScriptsPostResponseCompanion, FlowScriptsPostResponse, FlowSigningAlgorithmCompanion, FlowTransactionSignature, FlowTransactionExpandable, FlowTransactionCompanion, FlowTransactionExecutionCompanion, FlowTransactionExecution, FlowTransactionExpandableCompanion, FlowTransactionStatus, FlowTransactionResultCompanion, FlowTransactionSignatureCompanion, FlowTransactionStatusCompanion, FlowFlowApi, FlowKotlinByteIterator, FlowBignumBigIntegerCompanion, FlowBignumBigIntegerQuotientAndRemainder, FlowBignumSign, FlowBignumBigIntegerBigIntegerRange, FlowBignumBigIntegerSqareRootAndRemainder, FlowBignumModularBigInteger, FlowKotlinIllegalStateException, FlowKtor_client_coreHttpClientEngineConfig, FlowKtor_client_coreHttpClientConfig, FlowKtor_eventsEvents, FlowKtor_client_coreHttpReceivePipeline, FlowKtor_client_coreHttpRequestPipeline, FlowKtor_client_coreHttpResponsePipeline, FlowKtor_client_coreHttpSendPipeline, FlowKotlinx_serialization_coreSerializersModule, FlowKotlinx_serialization_coreSerialKind, FlowKotlinNothing, FlowBignumBigDecimalCompanion, FlowBignumDecimalMode, FlowBignumRoundingMode, FlowKotlinx_serialization_jsonJsonElementCompanion, FlowKotlinx_serialization_jsonJsonDefault, FlowKotlinx_serialization_jsonJsonConfiguration, FlowBignumModularBigIntegerCompanion, FlowBignumModularQuotientAndRemainder, FlowKtor_client_coreHttpRequestData, FlowKtor_client_coreHttpResponseData, FlowKotlinx_coroutines_coreCoroutineDispatcher, FlowKtor_client_coreProxyConfig, FlowKtor_utilsAttributeKey, FlowKtor_eventsEventDefinition, FlowKtor_utilsPipelinePhase, FlowKtor_utilsPipeline, FlowKtor_client_coreHttpReceivePipelinePhases, FlowKtor_client_coreHttpResponse, FlowKtor_client_coreHttpRequestPipelinePhases, FlowKtor_client_coreHttpRequestBuilder, FlowKtor_client_coreHttpResponsePipelinePhases, FlowKtor_client_coreHttpResponseContainer, FlowKtor_client_coreHttpClientCall, FlowKtor_client_coreHttpSendPipelinePhases, FlowBignumDecimalModeCompanion, FlowKtor_httpUrl, FlowKtor_httpHttpMethod, FlowKtor_httpOutgoingContent, FlowKtor_httpHttpStatusCode, FlowKtor_utilsGMTDate, FlowKtor_httpHttpProtocolVersion, FlowKotlinAbstractCoroutineContextElement, FlowKotlinx_coroutines_coreCoroutineDispatcherKey, FlowKtor_httpHeadersBuilder, FlowKtor_client_coreHttpRequestBuilderCompanion, FlowKtor_httpURLBuilder, FlowKtor_utilsTypeInfo, FlowKtor_client_coreHttpClientCallCompanion, FlowKtor_httpUrlCompanion, FlowKtor_httpURLProtocol, FlowKtor_httpHttpMethodCompanion, FlowKtor_httpContentType, FlowKotlinCancellationException, FlowKtor_httpHttpStatusCodeCompanion, FlowKtor_utilsGMTDateCompanion, FlowKtor_utilsWeekDay, FlowKtor_utilsMonth, FlowKtor_httpHttpProtocolVersionCompanion, FlowKotlinAbstractCoroutineContextKey, FlowKtor_ioMemory, FlowKtor_ioChunkBuffer, FlowKtor_ioBuffer, FlowKtor_ioByteReadPacket, FlowKtor_utilsStringValuesBuilderImpl, FlowKtor_httpURLBuilderCompanion, FlowKtor_httpURLProtocolCompanion, FlowKtor_httpHeaderValueParam, FlowKtor_httpHeaderValueWithParametersCompanion, FlowKtor_httpHeaderValueWithParameters, FlowKtor_httpContentTypeCompanion, FlowKtor_utilsWeekDayCompanion, FlowKtor_utilsMonthCompanion, FlowKtor_ioMemoryCompanion, FlowKtor_ioBufferCompanion, FlowKtor_ioChunkBufferCompanion, FlowKtor_ioInputCompanion, FlowKtor_ioInput, FlowKtor_ioByteReadPacketCompanion, FlowKotlinKTypeProjection, FlowKotlinx_coroutines_coreAtomicDesc, FlowKotlinx_coroutines_coreLockFreeLinkedListNodePrepareOp, FlowKotlinKVariance, FlowKotlinKTypeProjectionCompanion, FlowKotlinx_coroutines_coreAtomicOp<__contravariant T>, FlowKotlinx_coroutines_coreOpDescriptor, FlowKotlinx_coroutines_coreLockFreeLinkedListNode, FlowKotlinx_coroutines_coreLockFreeLinkedListNodeAbstractAtomicDesc, FlowKotlinx_coroutines_coreLockFreeLinkedListNodeAddLastDesc, FlowKotlinx_coroutines_coreLockFreeLinkedListNodeRemoveFirstDesc;
+
+@protocol FlowChainIdProvider, FlowKotlinx_serialization_coreEncoder, FlowKotlinx_serialization_coreSerialDescriptor, FlowKotlinx_serialization_coreSerializationStrategy, FlowKotlinx_serialization_coreDecoder, FlowKotlinx_serialization_coreDeserializationStrategy, FlowKotlinx_serialization_coreKSerializer, FlowKotlinComparable, FlowBignumBigNumber, FlowBignumBigNumberCreator, FlowBignumBitwiseCapable, FlowBignumByteArraySerializable, FlowKotlinIterator, FlowKotlinCoroutineContext, FlowKotlinx_coroutines_coreCoroutineScope, FlowKtor_ioCloseable, FlowKtor_client_coreHttpClientEngine, FlowKtor_client_coreHttpClientEngineCapability, FlowKtor_utilsAttributes, FlowKotlinx_serialization_coreCompositeEncoder, FlowKotlinAnnotation, FlowKotlinx_serialization_coreCompositeDecoder, FlowKotlinx_serialization_coreSerialFormat, FlowKotlinx_serialization_coreStringFormat, FlowBignumBigNumberUtil, FlowBignumByteArrayDeserializable, FlowKotlinClosedRange, FlowKotlinIterable, FlowKotlinCoroutineContextElement, FlowKotlinCoroutineContextKey, FlowKtor_client_coreHttpClientPlugin, FlowKotlinx_coroutines_coreDisposableHandle, FlowKotlinSuspendFunction2, FlowKotlinx_serialization_coreSerializersModuleCollector, FlowKotlinKClass, FlowKtor_httpHeaders, FlowKotlinx_coroutines_coreJob, FlowKotlinContinuation, FlowKotlinContinuationInterceptor, FlowKotlinx_coroutines_coreRunnable, FlowKotlinFunction, FlowKtor_httpHttpMessage, FlowKtor_ioByteReadChannel, FlowKtor_httpHttpMessageBuilder, FlowKtor_client_coreHttpRequest, FlowKotlinKDeclarationContainer, FlowKotlinKAnnotatedElement, FlowKotlinKClassifier, FlowKtor_httpParameters, FlowKotlinMapEntry, FlowKtor_utilsStringValues, FlowKotlinx_coroutines_coreChildHandle, FlowKotlinx_coroutines_coreChildJob, FlowKotlinSequence, FlowKotlinx_coroutines_coreSelectClause0, FlowKtor_ioReadSession, FlowKotlinSuspendFunction1, FlowKotlinAppendable, FlowKtor_utilsStringValuesBuilder, FlowKtor_httpParametersBuilder, FlowKotlinKType, FlowKotlinx_coroutines_coreParentJob, FlowKotlinx_coroutines_coreSelectInstance, FlowKotlinSuspendFunction0, FlowKtor_ioObjectPool;
+
+NS_ASSUME_NONNULL_BEGIN
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunknown-warning-option"
+#pragma clang diagnostic ignored "-Wincompatible-property-type"
+#pragma clang diagnostic ignored "-Wnullability"
+
+#pragma push_macro("_Nullable_result")
+#if !__has_feature(nullability_nullable_result)
+#undef _Nullable_result
+#define _Nullable_result _Nullable
+#endif
+
+__attribute__((swift_name("KotlinBase")))
+@interface FlowBase : NSObject
+- (instancetype)init __attribute__((unavailable));
++ (instancetype)new __attribute__((unavailable));
++ (void)initialize __attribute__((objc_requires_super));
+@end;
+
+@interface FlowBase (FlowBaseCopying)
+@end;
+
+__attribute__((swift_name("KotlinMutableSet")))
+@interface FlowMutableSet : NSMutableSet
+@end;
+
+__attribute__((swift_name("KotlinMutableDictionary")))
+@interface FlowMutableDictionary : NSMutableDictionary
+@end;
+
+@interface NSError (NSErrorFlowKotlinException)
+@property (readonly) id _Nullable kotlinException;
+@end;
+
+__attribute__((swift_name("KotlinNumber")))
+@interface FlowNumber : NSNumber
+- (instancetype)initWithChar:(char)value __attribute__((unavailable));
+- (instancetype)initWithUnsignedChar:(unsigned char)value __attribute__((unavailable));
+- (instancetype)initWithShort:(short)value __attribute__((unavailable));
+- (instancetype)initWithUnsignedShort:(unsigned short)value __attribute__((unavailable));
+- (instancetype)initWithInt:(int)value __attribute__((unavailable));
+- (instancetype)initWithUnsignedInt:(unsigned int)value __attribute__((unavailable));
+- (instancetype)initWithLong:(long)value __attribute__((unavailable));
+- (instancetype)initWithUnsignedLong:(unsigned long)value __attribute__((unavailable));
+- (instancetype)initWithLongLong:(long long)value __attribute__((unavailable));
+- (instancetype)initWithUnsignedLongLong:(unsigned long long)value __attribute__((unavailable));
+- (instancetype)initWithFloat:(float)value __attribute__((unavailable));
+- (instancetype)initWithDouble:(double)value __attribute__((unavailable));
+- (instancetype)initWithBool:(BOOL)value __attribute__((unavailable));
+- (instancetype)initWithInteger:(NSInteger)value __attribute__((unavailable));
+- (instancetype)initWithUnsignedInteger:(NSUInteger)value __attribute__((unavailable));
++ (instancetype)numberWithChar:(char)value __attribute__((unavailable));
++ (instancetype)numberWithUnsignedChar:(unsigned char)value __attribute__((unavailable));
++ (instancetype)numberWithShort:(short)value __attribute__((unavailable));
++ (instancetype)numberWithUnsignedShort:(unsigned short)value __attribute__((unavailable));
++ (instancetype)numberWithInt:(int)value __attribute__((unavailable));
++ (instancetype)numberWithUnsignedInt:(unsigned int)value __attribute__((unavailable));
++ (instancetype)numberWithLong:(long)value __attribute__((unavailable));
++ (instancetype)numberWithUnsignedLong:(unsigned long)value __attribute__((unavailable));
++ (instancetype)numberWithLongLong:(long long)value __attribute__((unavailable));
++ (instancetype)numberWithUnsignedLongLong:(unsigned long long)value __attribute__((unavailable));
++ (instancetype)numberWithFloat:(float)value __attribute__((unavailable));
++ (instancetype)numberWithDouble:(double)value __attribute__((unavailable));
++ (instancetype)numberWithBool:(BOOL)value __attribute__((unavailable));
++ (instancetype)numberWithInteger:(NSInteger)value __attribute__((unavailable));
++ (instancetype)numberWithUnsignedInteger:(NSUInteger)value __attribute__((unavailable));
+@end;
+
+__attribute__((swift_name("KotlinByte")))
+@interface FlowByte : FlowNumber
+- (instancetype)initWithChar:(char)value;
++ (instancetype)numberWithChar:(char)value;
+@end;
+
+__attribute__((swift_name("KotlinUByte")))
+@interface FlowUByte : FlowNumber
+- (instancetype)initWithUnsignedChar:(unsigned char)value;
++ (instancetype)numberWithUnsignedChar:(unsigned char)value;
+@end;
+
+__attribute__((swift_name("KotlinShort")))
+@interface FlowShort : FlowNumber
+- (instancetype)initWithShort:(short)value;
++ (instancetype)numberWithShort:(short)value;
+@end;
+
+__attribute__((swift_name("KotlinUShort")))
+@interface FlowUShort : FlowNumber
+- (instancetype)initWithUnsignedShort:(unsigned short)value;
++ (instancetype)numberWithUnsignedShort:(unsigned short)value;
+@end;
+
+__attribute__((swift_name("KotlinInt")))
+@interface FlowInt : FlowNumber
+- (instancetype)initWithInt:(int)value;
++ (instancetype)numberWithInt:(int)value;
+@end;
+
+__attribute__((swift_name("KotlinUInt")))
+@interface FlowUInt : FlowNumber
+- (instancetype)initWithUnsignedInt:(unsigned int)value;
++ (instancetype)numberWithUnsignedInt:(unsigned int)value;
+@end;
+
+__attribute__((swift_name("KotlinLong")))
+@interface FlowLong : FlowNumber
+- (instancetype)initWithLongLong:(long long)value;
++ (instancetype)numberWithLongLong:(long long)value;
+@end;
+
+__attribute__((swift_name("KotlinULong")))
+@interface FlowULong : FlowNumber
+- (instancetype)initWithUnsignedLongLong:(unsigned long long)value;
++ (instancetype)numberWithUnsignedLongLong:(unsigned long long)value;
+@end;
+
+__attribute__((swift_name("KotlinFloat")))
+@interface FlowFloat : FlowNumber
+- (instancetype)initWithFloat:(float)value;
++ (instancetype)numberWithFloat:(float)value;
+@end;
+
+__attribute__((swift_name("KotlinDouble")))
+@interface FlowDouble : FlowNumber
+- (instancetype)initWithDouble:(double)value;
++ (instancetype)numberWithDouble:(double)value;
+@end;
+
+__attribute__((swift_name("KotlinBoolean")))
+@interface FlowBoolean : FlowNumber
+- (instancetype)initWithBool:(BOOL)value;
++ (instancetype)numberWithBool:(BOOL)value;
+@end;
+
+__attribute__((swift_name("ChainIdProvider")))
+@protocol FlowChainIdProvider
+@required
+@property (readonly) NSString *baseUrl __attribute__((swift_name("baseUrl")));
+@property (readonly) NSString *description_ __attribute__((swift_name("description_")));
+@end;
+
+__attribute__((swift_name("ChainId")))
+@interface FlowChainId : FlowBase
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("ChainId.Canary")))
+@interface FlowChainIdCanary : FlowChainId
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)canary __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowChainIdCanary *shared __attribute__((swift_name("shared")));
+@property (readonly) NSString *baseUrl __attribute__((swift_name("baseUrl")));
+@property (readonly) NSString *description_ __attribute__((swift_name("description_")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("ChainId.Custom")))
+@interface FlowChainIdCustom : FlowChainId
+- (instancetype)initWithBaseUrl:(NSString *)baseUrl description:(NSString *)description __attribute__((swift_name("init(baseUrl:description:)"))) __attribute__((objc_designated_initializer));
+- (NSString *)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (NSString *)component2 __attribute__((swift_name("component2()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowChainIdCustom *)doCopyBaseUrl:(NSString *)baseUrl description:(NSString *)description __attribute__((swift_name("doCopy(baseUrl:description:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) NSString *baseUrl __attribute__((swift_name("baseUrl")));
+@property (readonly) NSString *description_ __attribute__((swift_name("description_")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("ChainId.Emulator")))
+@interface FlowChainIdEmulator : FlowChainId
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)emulator __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowChainIdEmulator *shared __attribute__((swift_name("shared")));
+@property (readonly) NSString *baseUrl __attribute__((swift_name("baseUrl")));
+@property (readonly) NSString *description_ __attribute__((swift_name("description_")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("ChainId.Mainnet")))
+@interface FlowChainIdMainnet : FlowChainId
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)mainnet __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowChainIdMainnet *shared __attribute__((swift_name("shared")));
+@property (readonly) NSString *baseUrl __attribute__((swift_name("baseUrl")));
+@property (readonly) NSString *description_ __attribute__((swift_name("description_")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("ChainId.Sandboxnet")))
+@interface FlowChainIdSandboxnet : FlowChainId
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)sandboxnet __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowChainIdSandboxnet *shared __attribute__((swift_name("shared")));
+@property (readonly) NSString *baseUrl __attribute__((swift_name("baseUrl")));
+@property (readonly) NSString *description_ __attribute__((swift_name("description_")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("ChainId.Testnet")))
+@interface FlowChainIdTestnet : FlowChainId
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)testnet __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowChainIdTestnet *shared __attribute__((swift_name("shared")));
+@property (readonly) NSString *baseUrl __attribute__((swift_name("baseUrl")));
+@property (readonly) NSString *description_ __attribute__((swift_name("description_")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("FlowApi")))
+@interface FlowFlowApi : FlowBase
+- (instancetype)initWithChainId:(id)chainId __attribute__((swift_name("init(chainId:)"))) __attribute__((objc_designated_initializer));
+
+/**
+ @note This method converts instances of CancellationException to errors.
+ Other uncaught Kotlin exceptions are fatal.
+*/
+- (void)executeScriptScript:(NSString *)script arguments:(NSArray * _Nullable)arguments blockId:(NSString * _Nullable)blockId blockHeight:(NSString * _Nullable)blockHeight completionHandler:(void (^)(FlowCadenceValue * _Nullable, NSError * _Nullable))completionHandler __attribute__((swift_name("executeScript(script:arguments:blockId:blockHeight:completionHandler:)")));
+
+/**
+ @note This method converts instances of CancellationException to errors.
+ Other uncaught Kotlin exceptions are fatal.
+*/
+- (void)getAccountAddress:(NSString *)address blockHeight:(NSString * _Nullable)blockHeight sealed:(BOOL)sealed completionHandler:(void (^)(FlowAccount * _Nullable, NSError * _Nullable))completionHandler __attribute__((swift_name("getAccount(address:blockHeight:sealed:completionHandler:)")));
+
+/**
+ @note This method converts instances of CancellationException to errors.
+ Other uncaught Kotlin exceptions are fatal.
+*/
+- (void)getBlockId:(NSString * _Nullable)id blockHeight:(NSString * _Nullable)blockHeight sealed:(BOOL)sealed completionHandler:(void (^)(FlowBlock * _Nullable, NSError * _Nullable))completionHandler __attribute__((swift_name("getBlock(id:blockHeight:sealed:completionHandler:)")));
+
+/**
+ @note This method converts instances of CancellationException to errors.
+ Other uncaught Kotlin exceptions are fatal.
+*/
+- (void)getBlockHeaderId:(NSString * _Nullable)id blockHeight:(NSString * _Nullable)blockHeight sealed:(BOOL)sealed completionHandler:(void (^)(FlowBlockHeader * _Nullable, NSError * _Nullable))completionHandler __attribute__((swift_name("getBlockHeader(id:blockHeight:sealed:completionHandler:)")));
+
+/**
+ @note This method converts instances of CancellationException to errors.
+ Other uncaught Kotlin exceptions are fatal.
+*/
+- (void)getCollectionId:(NSString *)id completionHandler:(void (^)(FlowCollection * _Nullable, NSError * _Nullable))completionHandler __attribute__((swift_name("getCollection(id:completionHandler:)")));
+
+/**
+ @note This method converts instances of CancellationException to errors.
+ Other uncaught Kotlin exceptions are fatal.
+*/
+- (void)getEventsType:(NSString *)type startHeight:(NSString * _Nullable)startHeight endHeight:(NSString * _Nullable)endHeight blockIds:(NSSet * _Nullable)blockIds completionHandler:(void (^)(FlowBlockEvents * _Nullable, NSError * _Nullable))completionHandler __attribute__((swift_name("getEvents(type:startHeight:endHeight:blockIds:completionHandler:)")));
+
+/**
+ @note This method converts instances of CancellationException to errors.
+ Other uncaught Kotlin exceptions are fatal.
+*/
+- (void)getExecutionResultId:(NSString *)id completionHandler:(void (^)(FlowExecutionResult * _Nullable, NSError * _Nullable))completionHandler __attribute__((swift_name("getExecutionResult(id:completionHandler:)")));
+
+/**
+ @note This method converts instances of CancellationException to errors.
+ Other uncaught Kotlin exceptions are fatal.
+*/
+- (void)getExecutionResultsBlockId:(NSSet *)blockId completionHandler:(void (^)(NSArray * _Nullable, NSError * _Nullable))completionHandler __attribute__((swift_name("getExecutionResults(blockId:completionHandler:)")));
+
+/**
+ @note This method converts instances of CancellationException to errors.
+ Other uncaught Kotlin exceptions are fatal.
+*/
+- (void)getTransactionTransactionId:(NSString *)transactionId completionHandler:(void (^)(FlowTransaction * _Nullable, NSError * _Nullable))completionHandler __attribute__((swift_name("getTransaction(transactionId:completionHandler:)")));
+
+/**
+ @note This method converts instances of CancellationException to errors.
+ Other uncaught Kotlin exceptions are fatal.
+*/
+- (void)getTransactionResultTransactionId:(NSString *)transactionId completionHandler:(void (^)(FlowTransactionResult * _Nullable, NSError * _Nullable))completionHandler __attribute__((swift_name("getTransactionResult(transactionId:completionHandler:)")));
+
+/**
+ @note This method converts instances of CancellationException to errors.
+ Other uncaught Kotlin exceptions are fatal.
+*/
+- (void)sendTransactionRequest:(FlowTransaction *)request completionHandler:(void (^)(FlowTransaction * _Nullable, NSError * _Nullable))completionHandler __attribute__((swift_name("sendTransaction(request:completionHandler:)")));
+@property (readonly) id chainId __attribute__((swift_name("chainId")));
+@end;
+
+__attribute__((swift_name("KotlinThrowable")))
+@interface FlowKotlinThrowable : FlowBase
+- (instancetype)initWithMessage:(NSString * _Nullable)message __attribute__((swift_name("init(message:)"))) __attribute__((objc_designated_initializer));
+- (instancetype)initWithCause:(FlowKotlinThrowable * _Nullable)cause __attribute__((swift_name("init(cause:)"))) __attribute__((objc_designated_initializer));
+- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
+- (instancetype)initWithMessage:(NSString * _Nullable)message cause:(FlowKotlinThrowable * _Nullable)cause __attribute__((swift_name("init(message:cause:)"))) __attribute__((objc_designated_initializer));
+- (FlowKotlinArray *)getStackTrace __attribute__((swift_name("getStackTrace()")));
+- (void)printStackTrace __attribute__((swift_name("printStackTrace()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowKotlinThrowable * _Nullable cause __attribute__((swift_name("cause")));
+@property (readonly) NSString * _Nullable message __attribute__((swift_name("message")));
+- (NSError *)asError __attribute__((swift_name("asError()")));
+@end;
+
+__attribute__((swift_name("KotlinException")))
+@interface FlowKotlinException : FlowKotlinThrowable
+- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
+- (instancetype)initWithMessage:(NSString * _Nullable)message __attribute__((swift_name("init(message:)"))) __attribute__((objc_designated_initializer));
+- (instancetype)initWithMessage:(NSString * _Nullable)message cause:(FlowKotlinThrowable * _Nullable)cause __attribute__((swift_name("init(message:cause:)"))) __attribute__((objc_designated_initializer));
+- (instancetype)initWithCause:(FlowKotlinThrowable * _Nullable)cause __attribute__((swift_name("init(cause:)"))) __attribute__((objc_designated_initializer));
+@end;
+
+__attribute__((swift_name("KotlinRuntimeException")))
+@interface FlowKotlinRuntimeException : FlowKotlinException
+- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
+- (instancetype)initWithMessage:(NSString * _Nullable)message __attribute__((swift_name("init(message:)"))) __attribute__((objc_designated_initializer));
+- (instancetype)initWithMessage:(NSString * _Nullable)message cause:(FlowKotlinThrowable * _Nullable)cause __attribute__((swift_name("init(message:cause:)"))) __attribute__((objc_designated_initializer));
+- (instancetype)initWithCause:(FlowKotlinThrowable * _Nullable)cause __attribute__((swift_name("init(cause:)"))) __attribute__((objc_designated_initializer));
+@end;
+
+__attribute__((swift_name("KotlinIllegalArgumentException")))
+@interface FlowKotlinIllegalArgumentException : FlowKotlinRuntimeException
+- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
+- (instancetype)initWithMessage:(NSString * _Nullable)message __attribute__((swift_name("init(message:)"))) __attribute__((objc_designated_initializer));
+- (instancetype)initWithMessage:(NSString * _Nullable)message cause:(FlowKotlinThrowable * _Nullable)cause __attribute__((swift_name("init(message:cause:)"))) __attribute__((objc_designated_initializer));
+- (instancetype)initWithCause:(FlowKotlinThrowable * _Nullable)cause __attribute__((swift_name("init(cause:)"))) __attribute__((objc_designated_initializer));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("IllegalRLPException")))
+@interface FlowIllegalRLPException : FlowKotlinIllegalArgumentException
+- (instancetype)initWithMsg:(NSString *)msg __attribute__((swift_name("init(msg:)"))) __attribute__((objc_designated_initializer));
+- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
++ (instancetype)new __attribute__((unavailable));
+- (instancetype)initWithMessage:(NSString * _Nullable)message __attribute__((swift_name("init(message:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
+- (instancetype)initWithMessage:(NSString * _Nullable)message cause:(FlowKotlinThrowable * _Nullable)cause __attribute__((swift_name("init(message:cause:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
+- (instancetype)initWithCause:(FlowKotlinThrowable * _Nullable)cause __attribute__((swift_name("init(cause:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
+@end;
+
+__attribute__((swift_name("RLPType")))
+@interface FlowRLPType : FlowBase
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("RLPElement")))
+@interface FlowRLPElement : FlowRLPType
+- (instancetype)initWithBytes:(FlowKotlinByteArray *)bytes __attribute__((swift_name("init(bytes:)"))) __attribute__((objc_designated_initializer));
+- (FlowKotlinByteArray *)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowRLPElement *)doCopyBytes:(FlowKotlinByteArray *)bytes __attribute__((swift_name("doCopy(bytes:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowKotlinByteArray *bytes __attribute__((swift_name("bytes")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("RLPList")))
+@interface FlowRLPList : FlowRLPType
+- (instancetype)initWithElement:(NSArray *)element __attribute__((swift_name("init(element:)"))) __attribute__((objc_designated_initializer));
+- (NSArray *)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowRLPList *)doCopyElement:(NSArray *)element __attribute__((swift_name("doCopy(element:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) NSArray *element __attribute__((swift_name("element")));
+@end;
+
+__attribute__((swift_name("ApiBase")))
+@interface FlowApiBase : FlowBase
+- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
+@property (class, readonly, getter=companion) FlowApiBaseCompanion *companion __attribute__((swift_name("companion")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("ApiBase.Companion")))
+@interface FlowApiBaseCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowApiBaseCompanion *shared __attribute__((swift_name("shared")));
+@property (readonly) FlowKtor_client_coreHttpClient *client __attribute__((swift_name("client")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Base64ByteArray")))
+@interface FlowBase64ByteArray : FlowBase
+- (instancetype)initWithBytes:(FlowKotlinByteArray *)bytes __attribute__((swift_name("init(bytes:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowBase64ByteArrayCompanion *companion __attribute__((swift_name("companion")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowKotlinByteArray *bytes __attribute__((swift_name("bytes")));
+@end;
+
+__attribute__((swift_name("Kotlinx_serialization_coreSerializationStrategy")))
+@protocol FlowKotlinx_serialization_coreSerializationStrategy
+@required
+- (void)serializeEncoder:(id)encoder value:(id _Nullable)value __attribute__((swift_name("serialize(encoder:value:)")));
+@property (readonly) id descriptor __attribute__((swift_name("descriptor")));
+@end;
+
+__attribute__((swift_name("Kotlinx_serialization_coreDeserializationStrategy")))
+@protocol FlowKotlinx_serialization_coreDeserializationStrategy
+@required
+- (id _Nullable)deserializeDecoder:(id)decoder __attribute__((swift_name("deserialize(decoder:)")));
+@property (readonly) id descriptor __attribute__((swift_name("descriptor")));
+@end;
+
+__attribute__((swift_name("Kotlinx_serialization_coreKSerializer")))
+@protocol FlowKotlinx_serialization_coreKSerializer
+@required
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Base64ByteArray.Companion")))
+@interface FlowBase64ByteArrayCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowBase64ByteArrayCompanion *shared __attribute__((swift_name("shared")));
+- (FlowBase64ByteArray *)deserializeDecoder:(id)decoder __attribute__((swift_name("deserialize(decoder:)")));
+- (void)serializeEncoder:(id)encoder value:(FlowBase64ByteArray *)value __attribute__((swift_name("serialize(encoder:value:)")));
+@property (readonly) id descriptor __attribute__((swift_name("descriptor")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("BigDecimalCadenceSerializer")))
+@interface FlowBigDecimalCadenceSerializer : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)bigDecimalCadenceSerializer __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowBigDecimalCadenceSerializer *shared __attribute__((swift_name("shared")));
+- (FlowBignumBigDecimal *)deserializeDecoder:(id)decoder __attribute__((swift_name("deserialize(decoder:)")));
+- (void)serializeEncoder:(id)encoder value:(FlowBignumBigDecimal *)value __attribute__((swift_name("serialize(encoder:value:)")));
+@property (readonly) id descriptor __attribute__((swift_name("descriptor")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("BigIntegerCadenceSerializer")))
+@interface FlowBigIntegerCadenceSerializer : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)bigIntegerCadenceSerializer __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowBigIntegerCadenceSerializer *shared __attribute__((swift_name("shared")));
+- (FlowBignumBigInteger *)deserializeDecoder:(id)decoder __attribute__((swift_name("deserialize(decoder:)")));
+- (void)serializeEncoder:(id)encoder value:(FlowBignumBigInteger *)value __attribute__((swift_name("serialize(encoder:value:)")));
+@property (readonly) id descriptor __attribute__((swift_name("descriptor")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("ByteCadenceSerializer")))
+@interface FlowByteCadenceSerializer : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)byteCadenceSerializer __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowByteCadenceSerializer *shared __attribute__((swift_name("shared")));
+- (FlowByte *)deserializeDecoder:(id)decoder __attribute__((swift_name("deserialize(decoder:)")));
+- (void)serializeEncoder:(id)encoder value:(FlowByte *)value __attribute__((swift_name("serialize(encoder:value:)")));
+@property (readonly) id descriptor __attribute__((swift_name("descriptor")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence")))
+@interface FlowCadence : FlowBase
+- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
++ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
+@property (class, readonly, getter=companion) FlowCadenceCompanion *companion __attribute__((swift_name("companion")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.Capability")))
+@interface FlowCadenceCapability : FlowBase
+- (instancetype)initWithPath:(NSString *)path address:(NSString *)address borrowType:(FlowCadenceType *)borrowType __attribute__((swift_name("init(path:address:borrowType:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceCapabilityCompanion *companion __attribute__((swift_name("companion")));
+- (NSString *)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (NSString *)component2 __attribute__((swift_name("component2()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceType *)component3 __attribute__((swift_name("component3()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceCapability *)doCopyPath:(NSString *)path address:(NSString *)address borrowType:(FlowCadenceType *)borrowType __attribute__((swift_name("doCopy(path:address:borrowType:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) NSString *address __attribute__((swift_name("address")));
+@property (readonly) FlowCadenceType *borrowType __attribute__((swift_name("borrowType")));
+@property (readonly) NSString *path __attribute__((swift_name("path")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.CapabilityCompanion")))
+@interface FlowCadenceCapabilityCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceCapabilityCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.Companion")))
+@interface FlowCadenceCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceCompanion *shared __attribute__((swift_name("shared")));
+- (FlowCadenceValueAddressValue *)addressValue:(FlowKotlinByteArray *)value __attribute__((swift_name("address(value:)")));
+- (FlowCadenceValueAddressValue *)addressValue_:(NSString *)value __attribute__((swift_name("address(value_:)")));
+- (FlowCadenceValueArrayValue *)arrayValue:(NSArray *)value __attribute__((swift_name("array(value:)")));
+- (FlowCadenceValueBooleanValue *)boolValue:(BOOL)value __attribute__((swift_name("bool(value:)")));
+- (FlowCadenceValueCapabilityValue *)capabilityPath:(NSString *)path address:(NSString *)address borrowType:(FlowCadenceType *)borrowType __attribute__((swift_name("capability(path:address:borrowType:)")));
+- (FlowCadenceValueCapabilityValue *)capabilityValue:(FlowCadenceCapability *)value __attribute__((swift_name("capability(value:)")));
+- (FlowCadenceValueContractValue *)contractValueValue:(FlowCadenceCompositeValue *)value __attribute__((swift_name("contractValue(value:)")));
+- (FlowCadenceValueDictionaryValue *)dictionaryValue:(NSArray *)value __attribute__((swift_name("dictionary(value:)")));
+- (FlowCadenceValueDictionaryValue *)dictionaryValue_:(NSDictionary *)value __attribute__((swift_name("dictionary(value_:)")));
+- (FlowCadenceValueContractValue *)enumValueValue:(FlowCadenceCompositeValue *)value __attribute__((swift_name("enumValue(value:)")));
+- (FlowCadenceValueContractValue *)eventValueValue:(FlowCadenceCompositeValue *)value __attribute__((swift_name("eventValue(value:)")));
+- (FlowCadenceValueFix64Value *)fix64Value:(double)value __attribute__((swift_name("fix64(value:)")));
+- (FlowCadenceValueFix64Value *)fix64Value_:(id)value __attribute__((swift_name("fix64(value_:)")));
+- (FlowCadenceValueFix64Value *)fix64Value__:(NSString *)value __attribute__((swift_name("fix64(value__:)")));
+- (FlowCadenceValueIntValue *)intValue:(int32_t)value __attribute__((swift_name("int(value:)")));
+- (FlowCadenceValueInt128Value *)int128Value:(FlowBignumBigInteger *)value __attribute__((swift_name("int128(value:)")));
+- (FlowCadenceValueInt16Value *)int16Value:(int16_t)value __attribute__((swift_name("int16(value:)")));
+- (FlowCadenceValueInt256Value *)int256Value:(FlowBignumBigInteger *)value __attribute__((swift_name("int256(value:)")));
+- (FlowCadenceValueInt32Value *)int32Value:(int32_t)value __attribute__((swift_name("int32(value:)")));
+- (FlowCadenceValueInt64Value *)int64Value:(int64_t)value __attribute__((swift_name("int64(value:)")));
+- (FlowCadenceValueInt8Value *)int8Value:(int8_t)value __attribute__((swift_name("int8(value:)")));
+- (FlowCadenceValueOptionalValue *)optionalValue:(FlowCadenceValue * _Nullable)value __attribute__((swift_name("optional(value:)")));
+- (FlowCadenceValuePathValue *)pathValue:(FlowCadencePath *)value __attribute__((swift_name("path(value:)")));
+- (FlowCadenceValuePathValue *)pathDomain:(FlowCadencePathDomain *)domain identifier:(NSString *)identifier __attribute__((swift_name("path(domain:identifier:)")));
+- (FlowCadenceValueContractValue *)resourceValueValue:(FlowCadenceCompositeValue *)value __attribute__((swift_name("resourceValue(value:)")));
+- (FlowCadenceValueStringValue *)stringValue:(NSString *)value __attribute__((swift_name("string(value:)")));
+- (FlowCadenceValueStructValue *)structValue:(FlowCadenceCompositeValue *)value __attribute__((swift_name("struct(value:)")));
+- (FlowCadenceValueTypeValue *)typeValue:(FlowCadenceKind *)value __attribute__((swift_name("type(value:)")));
+- (FlowCadenceValueTypeValue *)typeValue_:(FlowCadenceTypeEntry *)value __attribute__((swift_name("type(value_:)")));
+- (FlowCadenceValueUFix64Value *)ufix64Value:(double)value __attribute__((swift_name("ufix64(value:)")));
+- (FlowCadenceValueUFix64Value *)ufix64Value_:(id)value __attribute__((swift_name("ufix64(value_:)")));
+- (FlowCadenceValueUFix64Value *)ufix64Value__:(NSString *)value __attribute__((swift_name("ufix64(value__:)")));
+- (FlowCadenceValueUIntValue *)uintValue:(uint32_t)value __attribute__((swift_name("uint(value:)")));
+- (FlowCadenceValueUInt128Value *)uint128Value:(FlowBignumBigInteger *)value __attribute__((swift_name("uint128(value:)")));
+- (FlowCadenceValueUInt16Value *)uint16Value:(uint16_t)value __attribute__((swift_name("uint16(value:)")));
+- (FlowCadenceValueUInt256Value *)uint256Value:(FlowBignumBigInteger *)value __attribute__((swift_name("uint256(value:)")));
+- (FlowCadenceValueUInt32Value *)uint32Value:(uint32_t)value __attribute__((swift_name("uint32(value:)")));
+- (FlowCadenceValueUInt64Value *)uint64Value:(uint64_t)value __attribute__((swift_name("uint64(value:)")));
+- (FlowCadenceValueUInt8Value *)uint8Value:(uint8_t)value __attribute__((swift_name("uint8(value:)")));
+- (FlowCadenceValueVoidValue *)void __attribute__((swift_name("void()")));
+- (FlowCadenceValueWord16Value *)word16Value:(uint16_t)value __attribute__((swift_name("word16(value:)")));
+- (FlowCadenceValueWord32Value *)word32Value:(uint32_t)value __attribute__((swift_name("word32(value:)")));
+- (FlowCadenceValueWord64Value *)word64Value:(uint64_t)value __attribute__((swift_name("word64(value:)")));
+- (FlowCadenceValueWord8Value *)word8Value:(uint8_t)value __attribute__((swift_name("word8(value:)")));
+@end;
+
+__attribute__((swift_name("Cadence.CompositeAttribute")))
+@interface FlowCadenceCompositeAttribute : FlowBase
+- (instancetype)initWithName:(NSString *)name value:(FlowCadenceValue *)value __attribute__((swift_name("init(name:value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceCompositeAttributeCompanion *companion __attribute__((swift_name("companion")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+@property (readonly) NSString *name __attribute__((swift_name("name")));
+@property (readonly) FlowCadenceValue *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.CompositeAttributeCompanion")))
+@interface FlowCadenceCompositeAttributeCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceCompositeAttributeCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((swift_name("Cadence.CompositeValue")))
+@interface FlowCadenceCompositeValue : FlowBase
+- (instancetype)initWithId:(NSString *)id fields:(NSArray *)fields __attribute__((swift_name("init(id:fields:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceCompositeValueCompanion *companion __attribute__((swift_name("companion")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+@property (readonly) NSArray *fields __attribute__((swift_name("fields")));
+@property (readonly) NSString *id __attribute__((swift_name("id")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.CompositeValueCompanion")))
+@interface FlowCadenceCompositeValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceCompositeValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.DictionaryFieldEntry")))
+@interface FlowCadenceDictionaryFieldEntry : FlowBase
+- (instancetype)initWithPair:(FlowKotlinPair *)pair __attribute__((swift_name("init(pair:)"))) __attribute__((objc_designated_initializer));
+- (instancetype)initWithKey:(FlowCadenceValue *)key value:(FlowCadenceValue *)value __attribute__((swift_name("init(key:value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceDictionaryFieldEntryCompanion *companion __attribute__((swift_name("companion")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+@property (readonly) FlowCadenceValue *key __attribute__((swift_name("key")));
+@property (readonly) FlowCadenceValue *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.DictionaryFieldEntryCompanion")))
+@interface FlowCadenceDictionaryFieldEntryCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceDictionaryFieldEntryCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.Kind")))
+@interface FlowCadenceKind : FlowBase
+- (instancetype)initWithKind:(FlowCadenceType *)kind typeID:(NSString * _Nullable)typeID type:(NSString * _Nullable)type __attribute__((swift_name("init(kind:typeID:type:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceKindCompanion *companion __attribute__((swift_name("companion")));
+- (FlowCadenceType *)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (NSString * _Nullable)component2 __attribute__((swift_name("component2()"))) __attribute__((deprecated("use corresponding property instead")));
+- (NSString * _Nullable)component3 __attribute__((swift_name("component3()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceKind *)doCopyKind:(FlowCadenceType *)kind typeID:(NSString * _Nullable)typeID type:(NSString * _Nullable)type __attribute__((swift_name("doCopy(kind:typeID:type:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowCadenceType *kind __attribute__((swift_name("kind")));
+@property (readonly) NSString * _Nullable type __attribute__((swift_name("type")));
+@property (readonly) NSString * _Nullable typeID __attribute__((swift_name("typeID")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.KindCompanion")))
+@interface FlowCadenceKindCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceKindCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.Path")))
+@interface FlowCadencePath : FlowBase
+- (instancetype)initWithDomain:(FlowCadencePathDomain *)domain identifier:(NSString *)identifier __attribute__((swift_name("init(domain:identifier:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadencePathCompanion *companion __attribute__((swift_name("companion")));
+- (FlowCadencePathDomain *)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (NSString *)component2 __attribute__((swift_name("component2()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadencePath *)doCopyDomain:(FlowCadencePathDomain *)domain identifier:(NSString *)identifier __attribute__((swift_name("doCopy(domain:identifier:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowCadencePathDomain *domain __attribute__((swift_name("domain")));
+@property (readonly) NSString *identifier __attribute__((swift_name("identifier")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.PathCompanion")))
+@interface FlowCadencePathCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadencePathCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((swift_name("KotlinComparable")))
+@protocol FlowKotlinComparable
+@required
+- (int32_t)compareToOther:(id _Nullable)other __attribute__((swift_name("compareTo(other:)")));
+@end;
+
+__attribute__((swift_name("KotlinEnum")))
+@interface FlowKotlinEnum : FlowBase
+- (instancetype)initWithName:(NSString *)name ordinal:(int32_t)ordinal __attribute__((swift_name("init(name:ordinal:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowKotlinEnumCompanion *companion __attribute__((swift_name("companion")));
+- (int32_t)compareToOther:(E)other __attribute__((swift_name("compareTo(other:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) NSString *name __attribute__((swift_name("name")));
+@property (readonly) int32_t ordinal __attribute__((swift_name("ordinal")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.PathDomain")))
+@interface FlowCadencePathDomain : FlowKotlinEnum
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
+- (instancetype)initWithName:(NSString *)name ordinal:(int32_t)ordinal __attribute__((swift_name("init(name:ordinal:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
+@property (class, readonly, getter=companion) FlowCadencePathDomainCompanion *companion __attribute__((swift_name("companion")));
+@property (class, readonly) FlowCadencePathDomain *storage __attribute__((swift_name("storage")));
+@property (class, readonly) FlowCadencePathDomain *private_ __attribute__((swift_name("private_")));
+@property (class, readonly) FlowCadencePathDomain *public_ __attribute__((swift_name("public_")));
++ (FlowKotlinArray *)values __attribute__((swift_name("values()")));
+@property (readonly) NSString *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.PathDomainCompanion")))
+@interface FlowCadencePathDomainCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadencePathDomainCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.Type_")))
+@interface FlowCadenceType : FlowKotlinEnum
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
+- (instancetype)initWithName:(NSString *)name ordinal:(int32_t)ordinal __attribute__((swift_name("init(name:ordinal:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
+@property (class, readonly, getter=companion) FlowCadenceTypeCompanion *companion __attribute__((swift_name("companion")));
+@property (class, readonly) FlowCadenceType *void_ __attribute__((swift_name("void_")));
+@property (class, readonly) FlowCadenceType *optional __attribute__((swift_name("optional")));
+@property (class, readonly) FlowCadenceType *boolean __attribute__((swift_name("boolean")));
+@property (class, readonly) FlowCadenceType *string __attribute__((swift_name("string")));
+@property (class, readonly) FlowCadenceType *int_ __attribute__((swift_name("int_")));
+@property (class, readonly) FlowCadenceType *uint __attribute__((swift_name("uint")));
+@property (class, readonly) FlowCadenceType *int8 __attribute__((swift_name("int8")));
+@property (class, readonly) FlowCadenceType *uint8 __attribute__((swift_name("uint8")));
+@property (class, readonly) FlowCadenceType *int16 __attribute__((swift_name("int16")));
+@property (class, readonly) FlowCadenceType *uint16 __attribute__((swift_name("uint16")));
+@property (class, readonly) FlowCadenceType *int32 __attribute__((swift_name("int32")));
+@property (class, readonly) FlowCadenceType *uint32 __attribute__((swift_name("uint32")));
+@property (class, readonly) FlowCadenceType *int64 __attribute__((swift_name("int64")));
+@property (class, readonly) FlowCadenceType *uint64 __attribute__((swift_name("uint64")));
+@property (class, readonly) FlowCadenceType *int128 __attribute__((swift_name("int128")));
+@property (class, readonly) FlowCadenceType *uint128 __attribute__((swift_name("uint128")));
+@property (class, readonly) FlowCadenceType *int256 __attribute__((swift_name("int256")));
+@property (class, readonly) FlowCadenceType *uint256 __attribute__((swift_name("uint256")));
+@property (class, readonly) FlowCadenceType *word8 __attribute__((swift_name("word8")));
+@property (class, readonly) FlowCadenceType *word16 __attribute__((swift_name("word16")));
+@property (class, readonly) FlowCadenceType *word32 __attribute__((swift_name("word32")));
+@property (class, readonly) FlowCadenceType *word64 __attribute__((swift_name("word64")));
+@property (class, readonly) FlowCadenceType *fix64 __attribute__((swift_name("fix64")));
+@property (class, readonly) FlowCadenceType *ufix64 __attribute__((swift_name("ufix64")));
+@property (class, readonly) FlowCadenceType *array __attribute__((swift_name("array")));
+@property (class, readonly) FlowCadenceType *dictionary __attribute__((swift_name("dictionary")));
+@property (class, readonly) FlowCadenceType *address __attribute__((swift_name("address")));
+@property (class, readonly) FlowCadenceType *path __attribute__((swift_name("path")));
+@property (class, readonly) FlowCadenceType *capability __attribute__((swift_name("capability")));
+@property (class, readonly) FlowCadenceType *struct_ __attribute__((swift_name("struct_")));
+@property (class, readonly) FlowCadenceType *resource __attribute__((swift_name("resource")));
+@property (class, readonly) FlowCadenceType *event __attribute__((swift_name("event")));
+@property (class, readonly) FlowCadenceType *contract __attribute__((swift_name("contract")));
+@property (class, readonly) FlowCadenceType *enum_ __attribute__((swift_name("enum_")));
+@property (class, readonly) FlowCadenceType *type __attribute__((swift_name("type")));
++ (FlowKotlinArray *)values __attribute__((swift_name("values()")));
+@property (readonly) NSString *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.Type_Companion")))
+@interface FlowCadenceTypeCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceTypeCompanion *shared __attribute__((swift_name("shared")));
+- (FlowCadenceType *)findByKeyValue:(NSString *)value default:(FlowCadenceType *)default_ __attribute__((swift_name("findByKey(value:default:)")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.TypeEntry")))
+@interface FlowCadenceTypeEntry : FlowBase
+- (instancetype)initWithStaticType:(FlowCadenceKind *)staticType __attribute__((swift_name("init(staticType:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceTypeEntryCompanion *companion __attribute__((swift_name("companion")));
+- (FlowCadenceKind *)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceTypeEntry *)doCopyStaticType:(FlowCadenceKind *)staticType __attribute__((swift_name("doCopy(staticType:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowCadenceKind *staticType __attribute__((swift_name("staticType")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.TypeEntryCompanion")))
+@interface FlowCadenceTypeEntryCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceTypeEntryCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((swift_name("Cadence.Value")))
+@interface FlowCadenceValue : FlowBase
+@property (class, readonly, getter=companion) FlowCadenceValueCompanion *companion __attribute__((swift_name("companion")));
+
+/**
+ @note This method converts instances of Exception to errors.
+ Other uncaught Kotlin exceptions are fatal.
+*/
+- (id _Nullable)decodeAndReturnError:(NSError * _Nullable * _Nullable)error __attribute__((swift_name("decode()"))) __attribute__((swift_error(nonnull_error)));
+- (id _Nullable)decodeToAny __attribute__((swift_name("decodeToAny()")));
+- (NSString *)encode __attribute__((swift_name("encode()")));
+- (NSString *)encodeBase64 __attribute__((swift_name("encodeBase64()")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+@property (readonly) id _Nullable value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueAddressValue")))
+@interface FlowCadenceValueAddressValue : FlowCadenceValue
+- (instancetype)initWithValue:(NSString *)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueAddressValueCompanion *companion __attribute__((swift_name("companion")));
+- (NSString *)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceValueAddressValue *)doCopyValue:(NSString *)value __attribute__((swift_name("doCopy(value:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) NSString *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueAddressValueCompanion")))
+@interface FlowCadenceValueAddressValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueAddressValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueArrayValue")))
+@interface FlowCadenceValueArrayValue : FlowCadenceValue
+- (instancetype)initWithValue:(NSArray *)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueArrayValueCompanion *companion __attribute__((swift_name("companion")));
+- (NSArray *)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceValueArrayValue *)doCopyValue:(NSArray *)value __attribute__((swift_name("doCopy(value:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) NSArray *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueArrayValueCompanion")))
+@interface FlowCadenceValueArrayValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueArrayValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueBooleanValue")))
+@interface FlowCadenceValueBooleanValue : FlowCadenceValue
+- (instancetype)initWithValue:(BOOL)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueBooleanValueCompanion *companion __attribute__((swift_name("companion")));
+- (BOOL)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceValueBooleanValue *)doCopyValue:(BOOL)value __attribute__((swift_name("doCopy(value:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowBoolean *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueBooleanValueCompanion")))
+@interface FlowCadenceValueBooleanValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueBooleanValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((swift_name("Cadence.ValueCapabilityValue")))
+@interface FlowCadenceValueCapabilityValue : FlowCadenceValue
+- (instancetype)initWithValue:(FlowCadenceCapability *)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueCapabilityValueCompanion *companion __attribute__((swift_name("companion")));
+@property (readonly) FlowCadenceCapability *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueCapabilityValueCompanion")))
+@interface FlowCadenceValueCapabilityValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueCapabilityValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueCompanion")))
+@interface FlowCadenceValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueCompanion *shared __attribute__((swift_name("shared")));
+- (FlowCadenceValue *)decodeFromBase64Base64String:(NSString *)base64String __attribute__((swift_name("decodeFromBase64(base64String:)")));
+- (FlowCadenceValue *)decodeFromJsonJsonString:(NSString *)jsonString __attribute__((swift_name("decodeFromJson(jsonString:)")));
+- (FlowCadenceValue *)decodeFromJsonElementJsonElement:(FlowKotlinx_serialization_jsonJsonElement *)jsonElement __attribute__((swift_name("decodeFromJsonElement(jsonElement:)")));
+- (NSString *)encodeToJsonStringValue:(FlowCadenceValue *)Value __attribute__((swift_name("encodeToJsonString(Value:)")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+- (id)serializerTypeParamsSerializers:(FlowKotlinArray> *)typeParamsSerializers __attribute__((swift_name("serializer(typeParamsSerializers:)")));
+@property (readonly) FlowKotlinx_serialization_jsonJson *jsonSerializer __attribute__((swift_name("jsonSerializer")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueContractValue")))
+@interface FlowCadenceValueContractValue : FlowCadenceValue
+- (instancetype)initWithValue:(FlowCadenceCompositeValue *)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueContractValueCompanion *companion __attribute__((swift_name("companion")));
+- (FlowCadenceCompositeValue *)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceValueContractValue *)doCopyValue:(FlowCadenceCompositeValue *)value __attribute__((swift_name("doCopy(value:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowCadenceCompositeValue *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueContractValueCompanion")))
+@interface FlowCadenceValueContractValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueContractValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueDictionaryValue")))
+@interface FlowCadenceValueDictionaryValue : FlowCadenceValue
+- (instancetype)initWithValue:(NSArray *)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueDictionaryValueCompanion *companion __attribute__((swift_name("companion")));
+- (NSArray *)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceValueDictionaryValue *)doCopyValue:(NSArray *)value __attribute__((swift_name("doCopy(value:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) NSArray *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueDictionaryValueCompanion")))
+@interface FlowCadenceValueDictionaryValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueDictionaryValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueEnumValue")))
+@interface FlowCadenceValueEnumValue : FlowCadenceValue
+- (instancetype)initWithValue:(FlowCadenceCompositeValue *)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueEnumValueCompanion *companion __attribute__((swift_name("companion")));
+- (FlowCadenceCompositeValue *)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceValueEnumValue *)doCopyValue:(FlowCadenceCompositeValue *)value __attribute__((swift_name("doCopy(value:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowCadenceCompositeValue *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueEnumValueCompanion")))
+@interface FlowCadenceValueEnumValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueEnumValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueEventValue")))
+@interface FlowCadenceValueEventValue : FlowCadenceValue
+- (instancetype)initWithValue:(FlowCadenceCompositeValue *)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueEventValueCompanion *companion __attribute__((swift_name("companion")));
+- (FlowCadenceCompositeValue *)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceValueEventValue *)doCopyValue:(FlowCadenceCompositeValue *)value __attribute__((swift_name("doCopy(value:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowCadenceCompositeValue *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueEventValueCompanion")))
+@interface FlowCadenceValueEventValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueEventValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueFix64Value")))
+@interface FlowCadenceValueFix64Value : FlowCadenceValue
+- (instancetype)initWithValue:(double)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueFix64ValueCompanion *companion __attribute__((swift_name("companion")));
+- (double)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceValueFix64Value *)doCopyValue:(double)value __attribute__((swift_name("doCopy(value:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowDouble *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueFix64ValueCompanion")))
+@interface FlowCadenceValueFix64ValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueFix64ValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueInt128Value")))
+@interface FlowCadenceValueInt128Value : FlowCadenceValue
+- (instancetype)initWithValue:(FlowBignumBigInteger *)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueInt128ValueCompanion *companion __attribute__((swift_name("companion")));
+- (FlowBignumBigInteger *)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceValueInt128Value *)doCopyValue:(FlowBignumBigInteger *)value __attribute__((swift_name("doCopy(value:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowBignumBigInteger *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueInt128ValueCompanion")))
+@interface FlowCadenceValueInt128ValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueInt128ValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueInt16Value")))
+@interface FlowCadenceValueInt16Value : FlowCadenceValue
+- (instancetype)initWithValue:(int16_t)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueInt16ValueCompanion *companion __attribute__((swift_name("companion")));
+- (int16_t)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceValueInt16Value *)doCopyValue:(int16_t)value __attribute__((swift_name("doCopy(value:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowShort *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueInt16ValueCompanion")))
+@interface FlowCadenceValueInt16ValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueInt16ValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueInt256Value")))
+@interface FlowCadenceValueInt256Value : FlowCadenceValue
+- (instancetype)initWithValue:(FlowBignumBigInteger *)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueInt256ValueCompanion *companion __attribute__((swift_name("companion")));
+- (FlowBignumBigInteger *)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceValueInt256Value *)doCopyValue:(FlowBignumBigInteger *)value __attribute__((swift_name("doCopy(value:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowBignumBigInteger *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueInt256ValueCompanion")))
+@interface FlowCadenceValueInt256ValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueInt256ValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueInt32Value")))
+@interface FlowCadenceValueInt32Value : FlowCadenceValue
+- (instancetype)initWithValue:(int32_t)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueInt32ValueCompanion *companion __attribute__((swift_name("companion")));
+- (int32_t)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceValueInt32Value *)doCopyValue:(int32_t)value __attribute__((swift_name("doCopy(value:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowInt *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueInt32ValueCompanion")))
+@interface FlowCadenceValueInt32ValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueInt32ValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueInt64Value")))
+@interface FlowCadenceValueInt64Value : FlowCadenceValue
+- (instancetype)initWithValue:(int64_t)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueInt64ValueCompanion *companion __attribute__((swift_name("companion")));
+- (int64_t)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceValueInt64Value *)doCopyValue:(int64_t)value __attribute__((swift_name("doCopy(value:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowLong *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueInt64ValueCompanion")))
+@interface FlowCadenceValueInt64ValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueInt64ValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueInt8Value")))
+@interface FlowCadenceValueInt8Value : FlowCadenceValue
+- (instancetype)initWithValue:(int8_t)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueInt8ValueCompanion *companion __attribute__((swift_name("companion")));
+- (int8_t)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceValueInt8Value *)doCopyValue:(int8_t)value __attribute__((swift_name("doCopy(value:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowByte *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueInt8ValueCompanion")))
+@interface FlowCadenceValueInt8ValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueInt8ValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueIntValue")))
+@interface FlowCadenceValueIntValue : FlowCadenceValue
+- (instancetype)initWithValue:(int32_t)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueIntValueCompanion *companion __attribute__((swift_name("companion")));
+- (int32_t)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceValueIntValue *)doCopyValue:(int32_t)value __attribute__((swift_name("doCopy(value:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowInt *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueIntValueCompanion")))
+@interface FlowCadenceValueIntValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueIntValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueOptionalValue")))
+@interface FlowCadenceValueOptionalValue : FlowCadenceValue
+- (instancetype)initWithValue:(FlowCadenceValue * _Nullable)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueOptionalValueCompanion *companion __attribute__((swift_name("companion")));
+- (FlowCadenceValue * _Nullable)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceValueOptionalValue *)doCopyValue:(FlowCadenceValue * _Nullable)value __attribute__((swift_name("doCopy(value:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowCadenceValue * _Nullable value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueOptionalValueCompanion")))
+@interface FlowCadenceValueOptionalValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueOptionalValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((swift_name("Cadence.ValuePathValue")))
+@interface FlowCadenceValuePathValue : FlowCadenceValue
+- (instancetype)initWithValue:(FlowCadencePath *)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValuePathValueCompanion *companion __attribute__((swift_name("companion")));
+@property (readonly) FlowCadencePath *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValuePathValueCompanion")))
+@interface FlowCadenceValuePathValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValuePathValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueResourceValue")))
+@interface FlowCadenceValueResourceValue : FlowCadenceValue
+- (instancetype)initWithValue:(FlowCadenceCompositeValue *)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueResourceValueCompanion *companion __attribute__((swift_name("companion")));
+- (FlowCadenceCompositeValue *)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceValueResourceValue *)doCopyValue:(FlowCadenceCompositeValue *)value __attribute__((swift_name("doCopy(value:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowCadenceCompositeValue *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueResourceValueCompanion")))
+@interface FlowCadenceValueResourceValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueResourceValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueStringValue")))
+@interface FlowCadenceValueStringValue : FlowCadenceValue
+- (instancetype)initWithValue:(NSString *)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueStringValueCompanion *companion __attribute__((swift_name("companion")));
+- (NSString *)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceValueStringValue *)doCopyValue:(NSString *)value __attribute__((swift_name("doCopy(value:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) NSString *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueStringValueCompanion")))
+@interface FlowCadenceValueStringValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueStringValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((swift_name("Cadence.ValueStructValue")))
+@interface FlowCadenceValueStructValue : FlowCadenceValue
+- (instancetype)initWithValue:(FlowCadenceCompositeValue *)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueStructValueCompanion *companion __attribute__((swift_name("companion")));
+@property (readonly) FlowCadenceCompositeValue *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueStructValueCompanion")))
+@interface FlowCadenceValueStructValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueStructValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((swift_name("Cadence.ValueTypeValue")))
+@interface FlowCadenceValueTypeValue : FlowCadenceValue
+- (instancetype)initWithValue:(FlowCadenceTypeEntry *)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueTypeValueCompanion *companion __attribute__((swift_name("companion")));
+@property (readonly) FlowCadenceTypeEntry *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueTypeValueCompanion")))
+@interface FlowCadenceValueTypeValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueTypeValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueUFix64Value")))
+@interface FlowCadenceValueUFix64Value : FlowCadenceValue
+- (instancetype)initWithValue:(double)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueUFix64ValueCompanion *companion __attribute__((swift_name("companion")));
+- (double)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceValueUFix64Value *)doCopyValue:(double)value __attribute__((swift_name("doCopy(value:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowDouble *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueUFix64ValueCompanion")))
+@interface FlowCadenceValueUFix64ValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueUFix64ValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueUInt128Value")))
+@interface FlowCadenceValueUInt128Value : FlowCadenceValue
+- (instancetype)initWithValue:(FlowBignumBigInteger *)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueUInt128ValueCompanion *companion __attribute__((swift_name("companion")));
+- (FlowBignumBigInteger *)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceValueUInt128Value *)doCopyValue:(FlowBignumBigInteger *)value __attribute__((swift_name("doCopy(value:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowBignumBigInteger *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueUInt128ValueCompanion")))
+@interface FlowCadenceValueUInt128ValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueUInt128ValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueUInt16Value")))
+@interface FlowCadenceValueUInt16Value : FlowCadenceValue
+- (instancetype)initWithValue:(uint16_t)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueUInt16ValueCompanion *companion __attribute__((swift_name("companion")));
+- (uint16_t)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceValueUInt16Value *)doCopyValue:(uint16_t)value __attribute__((swift_name("doCopy(value:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowUShort *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueUInt16ValueCompanion")))
+@interface FlowCadenceValueUInt16ValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueUInt16ValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueUInt256Value")))
+@interface FlowCadenceValueUInt256Value : FlowCadenceValue
+- (instancetype)initWithValue:(FlowBignumBigInteger *)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueUInt256ValueCompanion *companion __attribute__((swift_name("companion")));
+- (FlowBignumBigInteger *)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceValueUInt256Value *)doCopyValue:(FlowBignumBigInteger *)value __attribute__((swift_name("doCopy(value:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowBignumBigInteger *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueUInt256ValueCompanion")))
+@interface FlowCadenceValueUInt256ValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueUInt256ValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueUInt32Value")))
+@interface FlowCadenceValueUInt32Value : FlowCadenceValue
+- (instancetype)initWithValue:(uint32_t)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueUInt32ValueCompanion *companion __attribute__((swift_name("companion")));
+- (uint32_t)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceValueUInt32Value *)doCopyValue:(uint32_t)value __attribute__((swift_name("doCopy(value:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowUInt *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueUInt32ValueCompanion")))
+@interface FlowCadenceValueUInt32ValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueUInt32ValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueUInt64Value")))
+@interface FlowCadenceValueUInt64Value : FlowCadenceValue
+- (instancetype)initWithValue:(uint64_t)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueUInt64ValueCompanion *companion __attribute__((swift_name("companion")));
+- (uint64_t)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceValueUInt64Value *)doCopyValue:(uint64_t)value __attribute__((swift_name("doCopy(value:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowULong *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueUInt64ValueCompanion")))
+@interface FlowCadenceValueUInt64ValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueUInt64ValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueUInt8Value")))
+@interface FlowCadenceValueUInt8Value : FlowCadenceValue
+- (instancetype)initWithValue:(uint8_t)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueUInt8ValueCompanion *companion __attribute__((swift_name("companion")));
+- (uint8_t)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceValueUInt8Value *)doCopyValue:(uint8_t)value __attribute__((swift_name("doCopy(value:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowUByte *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueUInt8ValueCompanion")))
+@interface FlowCadenceValueUInt8ValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueUInt8ValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueUIntValue")))
+@interface FlowCadenceValueUIntValue : FlowCadenceValue
+- (instancetype)initWithValue:(uint32_t)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueUIntValueCompanion *companion __attribute__((swift_name("companion")));
+- (uint32_t)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceValueUIntValue *)doCopyValue:(uint32_t)value __attribute__((swift_name("doCopy(value:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowUInt *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueUIntValueCompanion")))
+@interface FlowCadenceValueUIntValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueUIntValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueVoidValue")))
+@interface FlowCadenceValueVoidValue : FlowCadenceValue
+- (instancetype)initWithValue:(FlowKotlinUnit * _Nullable)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueVoidValueCompanion *companion __attribute__((swift_name("companion")));
+- (FlowKotlinUnit * _Nullable)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceValueVoidValue *)doCopyValue:(FlowKotlinUnit * _Nullable)value __attribute__((swift_name("doCopy(value:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowKotlinUnit * _Nullable value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueVoidValueCompanion")))
+@interface FlowCadenceValueVoidValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueVoidValueCompanion *shared __attribute__((swift_name("shared")));
+- (id)serializer __attribute__((swift_name("serializer()")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueWord16Value")))
+@interface FlowCadenceValueWord16Value : FlowCadenceValue
+- (instancetype)initWithValue:(uint16_t)value __attribute__((swift_name("init(value:)"))) __attribute__((objc_designated_initializer));
+@property (class, readonly, getter=companion) FlowCadenceValueWord16ValueCompanion *companion __attribute__((swift_name("companion")));
+- (uint16_t)component1 __attribute__((swift_name("component1()"))) __attribute__((deprecated("use corresponding property instead")));
+- (FlowCadenceValueWord16Value *)doCopyValue:(uint16_t)value __attribute__((swift_name("doCopy(value:)")));
+- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
+- (NSUInteger)hash __attribute__((swift_name("hash()")));
+- (NSString *)description __attribute__((swift_name("description()")));
+@property (readonly) FlowUShort *value __attribute__((swift_name("value")));
+@end;
+
+__attribute__((objc_subclassing_restricted))
+__attribute__((swift_name("Cadence.ValueWord16ValueCompanion")))
+@interface FlowCadenceValueWord16ValueCompanion : FlowBase
++ (instancetype)alloc __attribute__((unavailable));
++ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
++ (instancetype)companion __attribute__((swift_name("init()")));
+@property (class, readonly, getter=shared) FlowCadenceValueWord16ValueCompanion *shared __attribute__((swift_name("shared")));
+- (id