sendUserOp
curl --request POST \
--url 'https://rpc.particle.network/evm-chain/#particle_aa_sendUserOp' \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"id": 1,
"method": "particle_aa_sendUserOp",
"params": [
"<string>"
]
}
'import requests
url = "https://rpc.particle.network/evm-chain/#particle_aa_sendUserOp"
payload = {
"jsonrpc": "2.0",
"id": 1,
"method": "particle_aa_sendUserOp",
"params": ["<string>"]
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({jsonrpc: '2.0', id: 1, method: 'particle_aa_sendUserOp', params: ['<string>']})
};
fetch('https://rpc.particle.network/evm-chain/#particle_aa_sendUserOp', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://rpc.particle.network/evm-chain/#particle_aa_sendUserOp",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'jsonrpc' => '2.0',
'id' => 1,
'method' => 'particle_aa_sendUserOp',
'params' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://rpc.particle.network/evm-chain/#particle_aa_sendUserOp"
payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"particle_aa_sendUserOp\",\n \"params\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://rpc.particle.network/evm-chain/#particle_aa_sendUserOp")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"particle_aa_sendUserOp\",\n \"params\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://rpc.particle.network/evm-chain/#particle_aa_sendUserOp")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"particle_aa_sendUserOp\",\n \"params\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"jsonrpc": "2.0",
"id": 1,
"result": "0xResult",
"chainId": 80001
}Account Abstraction RPC
sendUserOp
Learn how to use the sendUserOp JSON-RPC method.
POST
/
#particle_aa_sendUserOp
sendUserOp
curl --request POST \
--url 'https://rpc.particle.network/evm-chain/#particle_aa_sendUserOp' \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"id": 1,
"method": "particle_aa_sendUserOp",
"params": [
"<string>"
]
}
'import requests
url = "https://rpc.particle.network/evm-chain/#particle_aa_sendUserOp"
payload = {
"jsonrpc": "2.0",
"id": 1,
"method": "particle_aa_sendUserOp",
"params": ["<string>"]
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({jsonrpc: '2.0', id: 1, method: 'particle_aa_sendUserOp', params: ['<string>']})
};
fetch('https://rpc.particle.network/evm-chain/#particle_aa_sendUserOp', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://rpc.particle.network/evm-chain/#particle_aa_sendUserOp",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'jsonrpc' => '2.0',
'id' => 1,
'method' => 'particle_aa_sendUserOp',
'params' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://rpc.particle.network/evm-chain/#particle_aa_sendUserOp"
payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"particle_aa_sendUserOp\",\n \"params\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://rpc.particle.network/evm-chain/#particle_aa_sendUserOp")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"particle_aa_sendUserOp\",\n \"params\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://rpc.particle.network/evm-chain/#particle_aa_sendUserOp")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"particle_aa_sendUserOp\",\n \"params\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"jsonrpc": "2.0",
"id": 1,
"result": "0xResult",
"chainId": 80001
}Understanding sendUserOp
sendUserOppushes a structured and signed UserOperation to the network, also handling session keys, sender management, etc. It takes:- Account config object:
name- string.version- string.ownerAddress- string.biconomyApiKey- (optional), string. Should only be used if you’d like to use a Biconomy Paymaster.
- UserOp object. This should be signed by the user and if applicable, the Paymaster as well.
- Optionally,
sessionsarray - Session key object(s).
- Account config object:
Query example
JSON
{
"jsonrpc": "2.0",
"id": "89916c65-2a47-4933-aa4c-55f7e29edbf0",
"chainId": 80001,
"method": "particle_aa_sendUserOp",
"params": [
// account config
{
"name": "BICONOMY",
"version": "1.0.0",
"ownerAddress": "0xA60123a1056e9D38B64c4993615F27cCe9A9E8D5",
"biconomyApiKey": "LdF-gC43H.6f0ec763-fde5-4d5e-89f6-1b9ef12ba4a4" // optional
},
// user op
{
"sender": "0x8fb859e944561678be40cdd2db16551396c0b074",
"nonce": "0x64",
"initCode": "0x",
"callData": "0x912ccaa3000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000020000000000000000000000009c3c9283d3e44854697cd22d3faa240cfb032889000000000000000000000000329a7f8b91ce7479035cb1b5d62ab41845830ce80000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000044095ea7b300000000000000000000000000000f7365ca6c59a2c93719ad53d567ed49c14c0000000000000000000000000000000000000000000000000001548a5fd39873000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"signature": "0xf173083acfa6ddfdbbb84023ebdeb07ff2a38aa1a2e7f7b1b2eb27e180ff13987c14d72273b82f448b8e89066045aebb9e5423eea3c2314136cc9c75d7bb716f1b",
"verificationGasLimit": "0x163b8",
"callGasLimit": "0xd1e7",
"preVerificationGas": "50736",
"paymasterAndData": "0x00000f7365ca6c59a2c93719ad53d567ed49c14c000000000000000000000000000000000000000000000000000000000064d2762e0000000000000000000000000000000000000000000000000000000064d26f260000000000000000000000009c3c9283d3e44854697cd22d3faa240cfb03288900000000000000000000000000000f7748595e46527413574a9327942e744e910000000000000000000000000000000000000000000000000de567836c0e69c0000000000000000000000000000000000000000000000000000000000010c8e09292fc583c0427b08765e4eccc030122182d141b6dbc5bb539fc4de726935042106faec9ee5b7537cf15c5f7d317fc355a0ff41877815fcbf9c906e0b584c4b61b",
"maxFeePerGas": "1500000034",
"maxPriorityFeePerGas": "1500000000"
},
// Optional
{
"sessions": [
{
"validUntil": 0,
"validAfter": 0,
"sessionValidationModule": "0x4b7f018Fa27a97b6a17b6d4d8Cb3c0e2D9340133",
"sessionKeyDataInAbi": [ // or use sessionKeyData to replace
["address", "address", "address", "uint256"],
[
"0x1dacDa1087C4048774bEce7784EB8EC4CfBeDB2c",
"0x909E30bdBCb728131E3F8d17150eaE740C904649",
"0x11D266772b85C2C5D4f84A41ca3E08e9f04Fb5D3",
1
]
]
}
],
"targetSession": {
"validUntil": 0,
"validAfter": 0,
"sessionValidationModule": "0x4b7f018Fa27a97b6a17b6d4d8Cb3c0e2D9340133",
"sessionKeyDataInAbi": [ // or use sessionKeyData to replace
["address", "address", "address", "uint256"],
[
"0x1dacDa1087C4048774bEce7784EB8EC4CfBeDB2c",
"0x909E30bdBCb728131E3F8d17150eaE740C904649",
"0x11D266772b85C2C5D4f84A41ca3E08e9f04Fb5D3",
1
]
]
}
}
]
}
Authorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Body
application/json
Request to send a user operation.
Version of the JSON-RPC protocol, should be 2.0.
Example:
"2.0"
The request identifier.
Example:
1
API method being called.
Available options:
particle_aa_sendUserOp Parameters for sending a user operation.
Response
200 - application/json
Successful response with the result of the user operation.
⌘I
