Skip to main content

AeonClient.prepareSigning(params: PrepareSigningParams): AeonClient

This AeonClient method takes a txId (identifying a previously defined transaction intent) and a workspaceId to specify the context. This method queues an operation. When aeonClient.build() is subsequently called, the backend service will:
  1. Retrieve the full transaction details associated with the provided txId and workspaceId.
  2. Ensure all necessary parameters for signing are present and valid. This can involve fetching current on-chain data such as the sender’s nonce or prevailing gas prices, especially if these were not finalized in the original transaction intent or need re-validation.
  3. Construct and serialize the transaction into a chain-specific signable format.
The AeonClient instance is returned to allow for chaining of other operations before calling build().

Parameters

  • params: PrepareSigningParams - An object containing:
    • txId: string - The unique identifier of a previously defined or simulated transaction intent. The backend uses this ID to retrieve the transaction details.
    • workspaceId: string - The identifier of the workspace in which the transaction (txId) exists and is being prepared.

Conceptual Example: aeonClient.prepareSigning()

// Example of queuing a transaction signing preparation
const aeonClient = new AeonClient({ simulationUrl: "..." }); // Backend URL for prepareSigning services

const transactionIdToPrepare = "existing-tx-intent-id-123";
const currentWorkspace = "workspace-main-ops";

aeonClient.prepareSigning({
  txId: transactionIdToPrepare,
  workspaceId: currentWorkspace,
});

// Optionally, chain other operations if needed
// .simulate("evm", { ... }) // etc.

// Later, to process the queue and get the signable transaction data:
// async function getPreparedTransaction() {
//   const buildResult = await aeonClient.build();
//   // The buildResult will contain outputs for each queued operation.
//   // You'll need to find the output corresponding to the prepareSigning call.
//   // Assuming buildResult.outputs is an array in order of queuing:
//   const preparedTxData = buildResult.outputs[0]; // Or find by a unique ID if available

//   if (preparedTxData && preparedTxData.type === "PREPARED_SIGNING_DATA") { // Hypothetical type
//     const txbToSign = preparedTxData.payload.txb_serialized_b64; // Example structure
//     console.log("Transaction ready for signing:", txbToSign);
//     return txbToSign;
//   } else {
//     console.error("Could not find prepared signing data in build result.");
//   }
// }