🚀 NERO Chain x AKINDO WaveHack has officially started! Join now: https://app.akindo.io/wave-hacks/VwQGxPraOF0zZJkX
Developer ToolsUserOp SDKSending UserOperations

Sending UserOperations

Once your UserOperation is configured, you can send it to the network. This section covers the process of sending operations and handling the results.

Sending the UserOperation

try {
  // Send the UserOperation
  const result = await client.sendUserOperation(builder);
  
  // Get the transaction hash
  const userOpHash = result.userOpHash;
  console.log("UserOperation hash:", userOpHash);
  
  // Wait for the transaction to be mined
  const receipt = await result.wait();
  console.log("Transaction hash:", receipt.transactionHash);
  
  return receipt;
} catch (error) {
  console.error("Error sending UserOperation:", error);
  throw error;
}

Monitoring UserOperation Status

After sending a UserOperation, you can monitor its status:

  1. First, you get the userOpHash from the result of sendUserOperation.
  2. Then, you can use wait() on the result to wait for the operation to be included in a block.
  3. The receipt contains the transaction hash that can be used to look up details on a block explorer.

Next Steps

After sending UserOperations, you might want to: