Hyphen
  • Hyphen
  • Concepts
    • Auth Methods
    • Hyphen Multi-Sig Account
      • Device Key
      • Recovery Key
      • Server Key
    • Paymaster
    • Hybrid Custody
  • Mechanism Paper
  • iOS SDK
    • Quick Start
    • Authenticating Users
    • Using Hyphen UI Kit
      • Account Management Screen
    • Sample Project
  • Android SDK
    • Quick Start
    • Authenticating Users
    • Handling 2FA / Transaction Request
    • Using Hyphen UI Kit
    • Sending Transactions
  • Flutter SDK
    • Quick Start
    • Authenticating Users
    • Using Hyphen UI Kit
    • Sending Transactions
    • Example App
  • Hybrid Custody
    • Into the Hybrid Custody
  • Without Using SDK
    • Authenticating Users
    • Handling 2FA Push
  • REST API
    • API Reference
      • Account
      • Auth
      • Device
      • Key
      • Sign
    • Swagger
Powered by GitBook
On this page
  • Creating, Signing, and Sending Transactions
  • Utilities
  • Wait for Transaction Seal
  • Get Transaction Result

Was this helpful?

  1. Android SDK

Sending Transactions

To send a transaction with Hyphen Android SDK

Creating, Signing, and Sending Transactions

To create, sign, and send a transaction with the Hyphen Android SDK, follow these steps:

// Define the Cadence script for the transaction
val cadenceScript = """
    transaction {
        execute {
            log("Hello World!!!")
        }
    }
""".trimIndent()

// Create, sign, and send the transaction
val txId = HyphenFlow.signAndSendTransaction(
    cadenceScript = cadenceScript,
    arguments = emptyList(),
    withAuthorizer = false
)

// Log the transaction ID
Log.e("Transaction ID", txId) // Outputs: "0x<TXID>"

Explanation:

  • cadenceScript: The Cadence script to be executed in the transaction.

  • arguments: List of arguments for the transaction. In this example, it's an empty list.

  • withAuthorizer: A boolean indicating whether the transaction requires an authorizer. Set to false in this example.

  • txId: The transaction ID returned by the signAndSendTransaction method.

Utilities

Wait for Transaction Seal

To wait for a transaction to be sealed on the Flow blockchain, you can use waitForSeal utility method.

val txId = FlowId(hex = "0x<TXID>")
val txResult = waitForSeal(txId = txId) // return FlowTransactionResult object

Get Transaction Result

To retrieve the result of a specific transaction:

val txId = FlowId(hex = "0x<TXID>")
val txResult = getTransactionResult(txId = txId) // return FlowTransactionResult object
PreviousUsing Hyphen UI KitNextQuick Start

Last updated 1 year ago

Was this helpful?