{
  "openapi": "3.0.0",
  "info": {
    "title": "Particle Network Account Abstraction RPC",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://rpc.particle.network/evm-chain"
    }
  ],
  "security": [
    {
      "BasicAuth": []
    }
  ],
  "paths": {
    "/#particle_aa_getSmartAccount": {
      "post": {
        "summary": "getSmartAccount",
        "operationId": "getSmartAccount",
        "requestBody": {
          "description": "Request to retrieve smart account information.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GetSmartAccountRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response with smart account information.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetSmartAccountResponse"
                }
              }
            }
          }
        }
      }
    },
    "/#particle_aa_getFeeQuotes": {
      "post": {
        "summary": "getFeeQuotes",
        "operationId": "getFeeQuotes",
        "requestBody": {
          "description": "Request to retrieve fee quotes for operations.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GetFeeQuotesRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response with fee quotes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetFeeQuotesResponse"
                }
              }
            }
          }
        }
      }
    },
    "/#particle_aa_createUserOp": {
      "post": {
        "summary": "createUserOp",
        "operationId": "createUserOp",
        "requestBody": {
          "description": "Request to create a user operation.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateUserOpRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response with created user operation details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateUserOpResponse"
                }
              }
            }
          }
        }
      }
    },
    "/#particle_aa_sendUserOp": {
      "post": {
        "summary": "sendUserOp",
        "operationId": "sendUserOp",
        "requestBody": {
          "description": "Request to send a user operation.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendUserOpRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response with the result of the user operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendUserOpResponse"
                }
              }
            }
          }
        }
      }
    },
    "/#particle_aa_createSessions": {
      "post": {
        "summary": "createSessions",
        "operationId": "particle_aa_createSessions",
        "requestBody": {
          "description": "Request to create sessions.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSessionsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response with created session details.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateSessionsResponse"
                }
              }
            }
          }
        }
      }
    },
    "/#particle_aa_validateSession": {
      "post": {
        "summary": "validateSession",
        "operationId": "particle_aa_validateSession",
        "requestBody": {
          "description": "Request to validate a session.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ValidateSessionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response indicating the session validity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidateSessionResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BasicAuth": {
        "type": "http",
        "scheme": "basic"
      }
    },
    "schemas": {
      "AnyValue": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "number"
          },
          {
            "type": "integer"
          },
          {
            "type": "boolean"
          },
          {
            "type": "object"
          },
          {
            "type": "array",
            "items": {}
          }
        ]
      },
      "RPCRequest": {
        "type": "object",
        "required": [
          "jsonrpc",
          "id",
          "method",
          "params"
        ],
        "properties": {
          "jsonrpc": {
            "type": "string",
            "default": "2.0",
            "description": "Version of the JSON-RPC protocol, should be 2.0.",
            "example": "2.0"
          },
          "id": {
            "type": "integer",
            "default": 1,
            "description": "The request identifier.",
            "example": 1
          },
          "method": {
            "type": "string",
            "description": "API method being called."
          },
          "params": {
            "type": "array",
            "description": "Parameters for the API method call."
          }
        }
      },
      "RPCResponse": {
        "type": "object",
        "required": [
          "jsonrpc",
          "id",
          "result"
        ],
        "properties": {
          "jsonrpc": {
            "type": "string",
            "default": "2.0",
            "description": "Version of the JSON-RPC protocol, should be 2.0.",
            "example": "2.0"
          },
          "id": {
            "type": "integer",
            "default": 1,
            "description": "The request identifier.",
            "example": 1
          },
          "result": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AnyValue"
              }
            ]
          },
          "chainId": {
            "type": "integer",
            "description": "The blockchain chain ID.",
            "example": 80001
          }
        }
      },
      "GetSmartAccountRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/RPCRequest"
          },
          {
            "type": "object",
            "properties": {
              "method": {
                "enum": [
                  "particle_aa_getSmartAccount"
                ]
              },
              "params": {
                "type": "array",
                "description": "Parameters for retrieving a smart account.",
                "items": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "description": "Account details as a string."
                  }
                }
              }
            }
          }
        ]
      },
      "GetSmartAccountResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/RPCResponse"
          },
          {
            "type": "object",
            "properties": {
              "result": {
                "type": "array",
                "description": "Array of smart account details.",
                "items": {
                  "type": "object"
                }
              }
            }
          }
        ]
      },
      "GetFeeQuotesRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/RPCRequest"
          },
          {
            "type": "object",
            "properties": {
              "method": {
                "enum": [
                  "particle_aa_getFeeQuotes"
                ]
              },
              "params": {
                "type": "array",
                "description": "Parameters for retrieving fee quotes.",
                "items": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "to": {
                            "type": "string",
                            "description": "Recipient address.",
                            "example": "0xRecipientAddress"
                          },
                          "value": {
                            "type": "string",
                            "description": "Amount value.",
                            "example": "1000000000000000000"
                          },
                          "data": {
                            "type": "string",
                            "description": "Transaction data.",
                            "example": "0xTransactionData"
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        ]
      },
      "GetFeeQuotesResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/RPCResponse"
          },
          {
            "type": "object",
            "properties": {
              "result": {
                "type": "object",
                "properties": {
                  "verifyingPaymasterGasless": {
                    "type": "object",
                    "description": "Gasless fee quote."
                  },
                  "verifyingPaymasterNative": {
                    "type": "object",
                    "description": "Native token fee quote."
                  },
                  "tokenPaymaster": {
                    "type": "object",
                    "description": "Token fee quote."
                  }
                }
              }
            }
          }
        ]
      },
      "CreateUserOpRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/RPCRequest"
          },
          {
            "type": "object",
            "properties": {
              "method": {
                "enum": [
                  "particle_aa_createUserOp"
                ]
              },
              "params": {
                "type": "array",
                "description": "Parameters for creating a user operation.",
                "items": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "to": {
                          "type": "string",
                          "description": "Recipient address.",
                          "example": "0xRecipientAddress"
                        },
                        "value": {
                          "type": "string",
                          "description": "Amount value.",
                          "example": "1000000000000000000"
                        },
                        "data": {
                          "type": "string",
                          "description": "Transaction data.",
                          "example": "0xTransactionData"
                        }
                      }
                    },
                    {
                      "type": "object",
                      "properties": {
                        "tokenInfo": {
                          "type": "object",
                          "description": "Token information.",
                          "properties": {
                            "chainId": {
                              "type": "number",
                              "description": "Chain ID.",
                              "example": 80001
                            },
                            "name": {
                              "type": "string",
                              "description": "Token name.",
                              "example": "Example Token"
                            },
                            "symbol": {
                              "type": "string",
                              "description": "Token symbol.",
                              "example": "EXT"
                            },
                            "decimals": {
                              "type": "number",
                              "description": "Token decimals.",
                              "example": 18
                            },
                            "address": {
                              "type": "string",
                              "description": "Token address.",
                              "example": "0xTokenAddress"
                            },
                            "logoURI": {
                              "type": "string",
                              "description": "Token logo URI.",
                              "example": "https://example.com/logo.png"
                            }
                          }
                        },
                        "fee": {
                          "type": "string",
                          "description": "Fee amount.",
                          "example": "0.01"
                        },
                        "balance": {
                          "type": "string",
                          "description": "Balance amount.",
                          "example": "1000000000000000000"
                        },
                        "premiumPercentage": {
                          "type": "string",
                          "description": "Premium percentage.",
                          "example": "1"
                        }
                      }
                    },
                    {
                      "type": "string"
                    }
                  ]
                }
              }
            }
          }
        ]
      },
      "CreateUserOpResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/RPCResponse"
          },
          {
            "type": "object",
            "properties": {
              "result": {
                "type": "object",
                "properties": {
                  "userOp": {
                    "type": "object",
                    "description": "User operation details."
                  },
                  "userOpHash": {
                    "type": "string",
                    "description": "User operation hash.",
                    "example": "0xUserOpHash"
                  }
                }
              }
            }
          }
        ]
      },
      "SendUserOpRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/RPCRequest"
          },
          {
            "type": "object",
            "properties": {
              "method": {
                "enum": [
                  "particle_aa_sendUserOp"
                ]
              },
              "params": {
                "type": "array",
                "description": "Parameters for sending a user operation.",
                "items": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "sender": {
                          "type": "string",
                          "description": "Sender address.",
                          "example": "0xSenderAddress"
                        },
                        "nonce": {
                          "type": "string",
                          "description": "Nonce value.",
                          "example": "0x1"
                        },
                        "initCode": {
                          "type": "string",
                          "description": "Initialization code.",
                          "example": "0xInitCode"
                        },
                        "callData": {
                          "type": "string",
                          "description": "Call data.",
                          "example": "0xCallData"
                        },
                        "signature": {
                          "type": "string",
                          "description": "Signature.",
                          "example": "0xSignature"
                        },
                        "verificationGasLimit": {
                          "type": "string",
                          "description": "Gas limit for verification.",
                          "example": "0x5208"
                        },
                        "callGasLimit": {
                          "type": "string",
                          "description": "Gas limit for the call.",
                          "example": "0x5208"
                        },
                        "preVerificationGas": {
                          "type": "string",
                          "description": "Gas cost for pre-verification.",
                          "example": "0x5208"
                        },
                        "paymasterAndData": {
                          "type": "string",
                          "description": "Paymaster and data.",
                          "example": "0xPaymasterData"
                        },
                        "maxFeePerGas": {
                          "type": "string",
                          "description": "Maximum fee per gas unit.",
                          "example": "0x3B9ACA00"
                        },
                        "maxPriorityFeePerGas": {
                          "type": "string",
                          "description": "Maximum priority fee per gas unit.",
                          "example": "0x3B9ACA00"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        ]
      },
      "SendUserOpResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/RPCResponse"
          },
          {
            "type": "object",
            "properties": {
              "result": {
                "type": "string",
                "description": "Result of the user operation.",
                "example": "0xResult"
              }
            }
          }
        ]
      },
      "CreateSessionsRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/RPCRequest"
          },
          {
            "type": "object",
            "properties": {
              "method": {
                "enum": [
                  "particle_aa_createSessions"
                ]
              },
              "params": {
                "type": "array",
                "description": "Parameters for creating sessions.",
                "items": {
                  "type": "object",
                  "oneOf": [
                    {
                      "properties": {
                        "name": {
                          "type": "string",
                          "description": "Session name.",
                          "example": "Example Session"
                        },
                        "version": {
                          "type": "string",
                          "description": "Session version.",
                          "example": "1.0"
                        },
                        "ownerAddress": {
                          "type": "string",
                          "description": "Owner address.",
                          "example": "0xOwnerAddress"
                        }
                      }
                    },
                    {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "validUntil": {
                            "type": "integer",
                            "description": "Session validity end timestamp.",
                            "example": 1700000000
                          },
                          "validAfter": {
                            "type": "integer",
                            "description": "Session validity start timestamp.",
                            "example": 1600000000
                          },
                          "sessionValidationModule": {
                            "type": "string",
                            "description": "Session validation module.",
                            "example": "0xValidationModule"
                          },
                          "sessionKeyDataInAbi": {
                            "type": "array",
                            "description": "Session key data in ABI format.",
                            "items": {
                              "oneOf": [
                                {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                }
                              ]
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        ]
      },
      "CreateSessionsResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/RPCResponse"
          },
          {
            "type": "object",
            "properties": {
              "result": {
                "type": "object",
                "properties": {
                  "verifyingPaymasterGasless": {
                    "type": "object",
                    "description": "Gasless fee quote."
                  },
                  "verifyingPaymasterNative": {
                    "type": "object",
                    "description": "Native token fee quote."
                  },
                  "tokenPaymaster": {
                    "type": "object",
                    "description": "Token fee quote."
                  },
                  "sessions": {
                    "type": "array",
                    "description": "Array of session objects.",
                    "items": {
                      "type": "object"
                    }
                  },
                  "transactions": {
                    "type": "array",
                    "description": "Array of transaction objects.",
                    "items": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "ValidateSessionRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/RPCRequest"
          },
          {
            "type": "object",
            "properties": {
              "method": {
                "enum": [
                  "particle_aa_validateSession"
                ]
              },
              "params": {
                "type": "array",
                "description": "Parameters for validating a session.",
                "items": {
                  "type": "object",
                  "oneOf": [
                    {
                      "properties": {
                        "name": {
                          "type": "string",
                          "description": "Session name.",
                          "example": "Example Session"
                        },
                        "version": {
                          "type": "string",
                          "description": "Session version.",
                          "example": "1.0"
                        },
                        "ownerAddress": {
                          "type": "string",
                          "description": "Owner address.",
                          "example": "0xOwnerAddress"
                        }
                      }
                    },
                    {
                      "properties": {
                        "sessions": {
                          "type": "array",
                          "description": "Array of session objects.",
                          "items": {
                            "type": "object"
                          }
                        },
                        "targetSession": {
                          "type": "object",
                          "description": "Target session details.",
                          "properties": {
                            "validUntil": {
                              "type": "integer",
                              "description": "Session validity end timestamp.",
                              "example": 1700000000
                            },
                            "validAfter": {
                              "type": "integer",
                              "description": "Session validity start timestamp.",
                              "example": 1600000000
                            },
                            "sessionValidationModule": {
                              "type": "string",
                              "description": "Session validation module.",
                              "example": "0xValidationModule"
                            },
                            "sessionKeyDataInAbi": {
                              "type": "array",
                              "description": "Session key data in ABI format.",
                              "items": {
                                "oneOf": [
                                  {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  }
                                ]
                              }
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        ]
      },
      "ValidateSessionResponse": {
        "allOf": [
          {
            "$ref": "#/components/schemas/RPCResponse"
          },
          {
            "type": "object",
            "properties": {
              "result": {
                "type": "boolean",
                "description": "Indicates if the session is valid.",
                "example": true
              },
              "chainId": {
                "type": "integer",
                "description": "Blockchain chain ID.",
                "example": 80001
              }
            }
          }
        ]
      }
    }
  }
}