Skip to main content

signAndExecuteAeonTx(txb_serialized_b64: string): Promise<ExecuteIntentResponse>

This method is a core part of interacting with Aeon’s on-chain logic. It takes a serialized Sui Transaction Block (TXB), signs it using the AeonSigner’s internally managed key material (derived from the initial EVM private key), and then submits it for execution through the Aeon platform. This is typically used after AeonClient.build() has produced the txb_serialized_b64 for a Sui-based transaction or a batch that culminates in a Sui transaction.

Parameters

  • txb_serialized_b64: string - A Base64 encoded string representing the serialized Sui Transaction Block. This TXB should be prepared according to the transaction intent and already incorporate any necessary simulation results or data fetched by AeonClient.

Returns

  • Promise<ExecuteIntentResponse>: A promise that resolves with the response from the Aeon platform after attempting to execute the transaction.
    • ExecuteIntentResponse:
      • digest: string - The transaction digest (hash) of the executed Sui transaction. This can be used to look up the transaction on a Sui explorer.
      • message: string - A descriptive message about the outcome of the execution attempt (e.g., “Transaction submitted successfully”, or an error message if submission failed before reaching the chain).

Example

import { AeonSigner } from "@aeon-protocol/aeon-sdk";
// Assuming AeonSigner is initialized correctly as `signer`

interface ExecuteIntentResponse {
  digest: string;
  message: string;
}

async function signAndExecuteMyTransaction(signer: AeonSigner, txbB64: string) {
  try {
    console.log("Attempting to sign and execute intent...");
    const response: ExecuteIntentResponse = await signer.signAndExecuteAeonTx(
      txbB64
    );
    console.log("Intent executed successfully!");
    console.log(`  Digest: ${response.digest}`);
    console.log(`  Message: ${response.message}`);
    // You can use response.digest to track the transaction on a Sui explorer
  } catch (error) {
    console.error("Failed to sign and execute intent:", error);
    // Handle specific errors, e.g., from invalid TXB, insufficient gas, network issues
  }
}

// Example usage:
// const mySerializedTxb = "AQAAA...exampleSuiTxb...0A=="; // Replace with your actual Base64 encoded TXB from AeonClient.build()
// signAndExecuteMyTransaction(signer, mySerializedTxb);

Use Cases

  • Executing any transaction that targets Aeon’s smart contracts or managed on-chain resources on Sui.
  • The final step after AeonClient has been used to simulate and build a transaction for the Sui network.