UserOp

Sign UserOp

Learn how to sign user operations using the Okto SDK.

The signUserOp() method is available on the OktoClient instance and is used to sign user operations before they can be executed on the blockchain. This method is essential for preparing transactions in a secure manner.

Example

        public UserOp SignUserOp(UserOp userOp)
        {
            var userOpForSigning = userOp.Clone();
 
            // Sign UserOp
            var signedUserOp = UserOpSign.SignUserOp(
                userOp: userOpForSigning,
                privateKey: OktoAuthExample.GetSession().SessionPrivKey,
                entryPointAddress: OktoAuthExample.getOktoClient().Env.EntryPointContractAdress,
                chainId: OktoAuthExample.getOktoClient().Env.ChainId
            );
 
            userOp.signature = signedUserOp.signature;
 
 
            return signedUserOp;
        }

Note

For error handling:

Method Overview

MethodsDescription
async oktoClient.signUserOpSign a user operation

Sign UserOp

async oktoClient.signUserOp(userop: UserOp) signs a user operation with the user's credentials.

Parameters

ParameterTypeDescriptionRequired
useropUserOpThe user operation to be signedYes

Response

Success Response

Field NameTypeDescription
resultUserOpReturns the signed user operation

On this page