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);