createUserOp
curl --request POST \
--url 'https://rpc.particle.network/evm-chain/#particle_aa_createUserOp' \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"id": 1,
"method": "particle_aa_createUserOp",
"params": [
"<string>"
]
}
'import requests
url = "https://rpc.particle.network/evm-chain/#particle_aa_createUserOp"
payload = {
"jsonrpc": "2.0",
"id": 1,
"method": "particle_aa_createUserOp",
"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_createUserOp',
params: ['<string>']
})
};
fetch('https://rpc.particle.network/evm-chain/#particle_aa_createUserOp', 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_createUserOp",
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_createUserOp',
'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_createUserOp"
payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"particle_aa_createUserOp\",\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_createUserOp")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"particle_aa_createUserOp\",\n \"params\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://rpc.particle.network/evm-chain/#particle_aa_createUserOp")
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_createUserOp\",\n \"params\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"jsonrpc": "2.0",
"id": 1,
"result": {
"userOp": {},
"userOpHash": "0xUserOpHash"
},
"chainId": 80001
}Account Abstraction RPC
createUserOp
Learn how to use the createUserOp JSON-RPC method.
POST
/
#particle_aa_createUserOp
createUserOp
curl --request POST \
--url 'https://rpc.particle.network/evm-chain/#particle_aa_createUserOp' \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"id": 1,
"method": "particle_aa_createUserOp",
"params": [
"<string>"
]
}
'import requests
url = "https://rpc.particle.network/evm-chain/#particle_aa_createUserOp"
payload = {
"jsonrpc": "2.0",
"id": 1,
"method": "particle_aa_createUserOp",
"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_createUserOp',
params: ['<string>']
})
};
fetch('https://rpc.particle.network/evm-chain/#particle_aa_createUserOp', 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_createUserOp",
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_createUserOp',
'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_createUserOp"
payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"particle_aa_createUserOp\",\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_createUserOp")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"particle_aa_createUserOp\",\n \"params\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://rpc.particle.network/evm-chain/#particle_aa_createUserOp")
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_createUserOp\",\n \"params\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"jsonrpc": "2.0",
"id": 1,
"result": {
"userOp": {},
"userOpHash": "0xUserOpHash"
},
"chainId": 80001
}Understanding createUserOp
createUserOpwill construct and return a UserOperation object and hash using a transaction or collection of transactions, alongside smart account and fee payment information. It takes:- Account config object:
name- string, eitherBICONOMY,CYBERCONNECT, orSIMPLE.version- string, either1.0.0or2.0.0.ownerAddress- string.biconomyApiKey- (optional, for using Biconomy’s Paymaster), string.
- Array of transactions:
- Standard transaction object.
- Optionally, a token
feeQuoteobject, retrieved fromgetFeeQuotes, only used if you’re paying the gas fee in an ERC-20 token. - Token paymaster address - (optional), string.
- Account config object:
Query example
JSON
{
"jsonrpc": "2.0",
"id": "4259f7fe-87aa-44fd-89c8-fc1e41f6d3d8",
"chainId": 80001,
"method": "particle_aa_createUserOp",
"params": [
// account config
{
"name": "BICONOMY",
"version": "1.0.0",
"ownerAddress": "0xA60123a1056e9D38B64c4993615F27cCe9A9E8D5",
"biconomyApiKey": "LdF-gC43H.6f0ec763-fde5-4d5e-89f6-1b9ef12ba4a4" // optional
},
// txs
[
{
"to": "0x329a7f8b91Ce7479035cb1B5D62AB41845830Ce8",
"value": "0x1",
"data": "0x"
}
],
// optional: If you don't pass the following params, it'll create a gasless/user paid user op
// token feeQuote
{
"tokenInfo": {
"chainId": 80001,
"name": "WMATIC",
"symbol": "WMATIC",
"decimals": 18,
"address": "0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889",
"logoURI": "https://polygonscan.com/token/images/wMatic_32.png"
},
"fee": "374428266633331",
"balance": "1019119852023946296",
"premiumPercentage": "10"
},
// token paymaster address
"0x00000f7365cA6C59A2C93719ad53d567ed49c14C"
]
}
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 create 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_createUserOp Parameters for creating a user operation.
Response
200 - application/json
Successful response with created user operation details.
