Docs

Kotlin sample

Prove that arbitrary transaction intent cannot reach a Kotlin service signer through the Torq client.

Developer Preview. Use the Kotlin client supplied with your approved application. Keep service credentials and signing material in their approved server boundaries.

This executable negative sample confirms that a raw caller-created transaction fails closed before the signer is invoked.

Complete source

import finance.torq.TorqClientConfig
import finance.torq.TorqKotlinClient
import finance.torq.TorqSigner
import java.net.URI

fun main() {
    val client = TorqKotlinClient(
        TorqClientConfig(
            baseUrl = URI.create("https://api.example.test"),
            secretKey = "torq_test_sk_external_quickstart",
            walletSession = "torq_ws_external_quickstart",
        ),
    )
    var signerCalls = 0
    try {
        client.executePreparedTransaction(
            """{"chainId":11155111}""",
        TorqSigner { intent ->
            signerCalls += 1
            "0x" + "1".repeat(64)
        },
        )
        error("Raw transaction intents must fail closed.")
    } catch (_: UnsupportedOperationException) {
        check(signerCalls == 0) { "Raw transaction intent reached the signer." }
    }
    println("Kotlin Torq SDK quickstart passed.")
}

Use the SDK reference for supported resource reads and the exact workflow boundary for your approved application.

On this page