UserOp

Execute UserOp

Learn how to execute user operations using the Okto SDK.

The executeUserOp() method is available on the OktoClient instance and is used to submit signed user operations to the blockchain. This method is used to execute transactions after they have been signed.

Example

import { useOkto } from '@okto_web3/react-sdk'; 
 
function ExecuteOperation() {
    const oktoClient = useOkto();
 
    async function handleExecuteOperation(signedUserOp) {
        try {
            const result = await oktoClient.executeUserOp(signedUserOp); 
            console.log('Job ID:', result);
            return result;
        } catch (error) {
            console.error('Error executing operation:', error);
        }
    }
 
    return (
        <button onClick={() => handleExecuteOperation(signedUserOp)}>
            Execute Operation
        </button>
    );
}

Note

For error handling:

Method Overview

MethodsDescription
async oktoClient.executeUserOpExecute a signed user operation

Execute UserOp

async oktoClient.executeUserOp(userop: UserOp) executes a signed user operation on the blockchain.

Parameters

ParameterTypeDescriptionRequired
useropSignedUserOpThe signed user operation to be executedYes

Response

Success Response

Field NameTypeDescription
resultPromise<string>Returns the job ID of the executed user operation

On this page