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:
- Use the error code to debug issues. Check out the SDK errors and warnings documentation
- For help, navigate to the troubleshooting guide to contact support
Method Overview
| Methods | Description |
|---|---|
async oktoClient.signUserOp | Sign a user operation |
Sign UserOp
async oktoClient.signUserOp(userop: UserOp) signs a user operation with the user's credentials.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
userop | UserOp | The user operation to be signed | Yes |
Response
Success Response
| Field Name | Type | Description |
|---|---|---|
result | UserOp | Returns the signed user operation |