openapi: 3.0.3
info:
  title: M2M Gateway API
  description: The M2M Gateway API is for communication by 3rd party servers for automated tasks in the Framework
  termsOfService: https://uxly.software/terms/
  contact:
    name: API Support
    url: https://uxly.software/support
    email: support@uxly.software
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  version: "0.1"
servers:
  - url: https://api.1shotapi.dev/v0
    description: Development server
  - url: https://api.1shotapi.com/v0
    description: Production server

paths:
  /token:
    post:
      tags: 
        - Authentication
        - OAuth2
      summary: Obtain an OAuth2 access token
      description: |
        This endpoint implements the OAuth2 Client Credentials Flow. Clients must send their `client_id` and `client_secret` in the request body to receive an access token.
      operationId: getAccessToken
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                grant_type:
                  type: string
                  enum: [client_credentials]
                  description: Must be `client_credentials`
                client_id:
                  type: string
                  description: A valid API Key value from a defined API Credential
                client_secret:
                  type: string
                  description: A valid Secret value from a defined API Credential
      responses:
        200:
          description: Successfully issued an access token
          content:
            application/json:
              schema:
                type: object
                properties:
                  access_token:
                    type: string
                    description: The OAuth2 access token
                  token_type:
                    type: string
                    enum: [Bearer]
                    description: Token type (always `Bearer`)
                  expires_in:
                    type: integer
                    description: Expiration time in seconds (usually 3600)
                  scope:
                    type: string
                    description: Granted scopes
        400:
          $ref: "#/components/responses/BadRequestError"
        401:
          $ref: "#/components/responses/UnauthenticatedError"
        403:
          $ref: "#/components/responses/PermissionError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /chains:
    get:
      tags:
        - Chains
        - List
      description: Returns a listing of all chains supported by 1Shot API
      parameters:
        - name: pageSize
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/PageSize"
        - name: page
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/Page"
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Returns a list of Contract Method objects.
          content:
            application/json:
              schema:
                allOf:
                  - type: object
                    properties:
                      response:
                        type: array
                        items:
                          $ref: "#/components/schemas/ChainInfo"
                  - $ref: "#/components/schemas/PagedResponse"

        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /chains/{chainId}/fees:
    get:
      tags:
        - Chains
        - Get
      description: Gets current gas fees and fee history for the specified chain. Returns either gasPrice for non-EIP-1559 chains (like Binance) or maxFeePerGas/maxPriorityFeePerGas plus nextBaseFeePerGas/history for EIP-1559 enabled chains.
      parameters:
        - name: chainId
          in: path
          required: true
          schema:
            $ref: "#/components/schemas/EChain"
        - name: numberOfBlocks
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 1024
            default: 5
          description: Number of latest blocks to request from `eth_feeHistory`.
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Returns the current gas fees for the chain.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GasFees"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /chains/{chainId}/contracts/{contractAddress}:
    get:
      tags:
        - Chains
        - Get
      description: |
        Returns whether the address has contract bytecode on the given chain (`eth_getCode`) and, when the bytecode matches the EIP-7702 delegation designator (`0xef0100` + 20-byte implementation), the delegated implementation contract address. Counts against the same monthly read quota as reading a Contract Method.
      parameters:
        - name: chainId
          in: path
          required: true
          schema:
            $ref: "#/components/schemas/EChain"
        - name: contractAddress
          in: path
          required: true
          schema:
            $ref: "#/components/schemas/ContractAddress"
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Bytecode summary at the address.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ContractCodeInfo"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"
  
  /methods/{contractMethodId}/test:  
    post:
      tags:
        - Contract Methods
      description: This method simulates the execution of a contract method. No gas will be spent and nothing on chain will change, but it will let you know whether or not an execution would succeed. Internally, this method relies on staticCall.
      parameters:
        - name: contractMethodId
          in: path
          required: true
          schema:
            $ref: "#/components/schemas/ContractMethodId"
      security:
        - OAuth2ClientCredentials:
          - read:api
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: You need to provide a value for every parameter in the Contract Method via the name of the parameter
              properties:
                params:
                  $ref: '#/components/schemas/JSONValue'
                walletId:
                  $ref: "#/components/schemas/WalletId"
                authorizationList:
                  type: array
                  items:
                    $ref: "#/components/schemas/ERC7702Authorization"
                  description: A list of authorizations for the Contract Method. If you are using ERC-7702, you must provide at least one authorization.
                  example: [{"address": "0x1234567890abcdef", "nonce": "1", "chainId": "1", "signature": "0x1234567890abcdef"}]
                value:
                  type: string
                  format: big-number-string
                  description: The amount of native token to send along with the Contract Method. This is only applicable for Contract Methods that are payable. Including this value for a nonpayable method will result in an error.
                  example: "123400000000000000000"
                contractAddress:
                  $ref: "#/components/schemas/ContractAddress"
                gasLimit:
                  type: string
                  format: big-number-string
                  description: The gas limit for the transaction. The transaction will revert if it uses more gas than this, and you will spend the gas in the process. Ordinarily, you do not need this, 1Shot will calculate it for you. However, for some very complicated transactions, you may need to set the gas limit manually as the normal estimation process may underestimate the gas amount.
                  example: "123400000000000000000"
      responses:
        200:
          description: "Success"
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractMethodTestResult'
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /methods/{contractMethodId}/encode:  
    post:
      tags:
        - Contract Methods
      description: This method encodes the transaction data for a Contract Method. It returns a hex string of the bytes of the encoded data. This can be used to call the Contract Method directly on the blockchain.
      parameters:
        - name: contractMethodId
          in: path
          required: true
          schema:
            $ref: "#/components/schemas/ContractMethodId"
      security:
        - OAuth2ClientCredentials:
          - read:api
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: You need to provide a value for every parameter in the Contract Method via the name of the parameter
              properties:
                params:
                  $ref: '#/components/schemas/JSONValue'
                authorizationList:
                  type: array
                  items:
                    $ref: "#/components/schemas/ERC7702Authorization"
                  description: A list of authorizations for the Contract Method. If you are using ERC-7702, you must provide at least one authorization.
                  example: [{"address": "0x1234567890abcdef", "nonce": "1", "chainId": "1", "signature": "0x1234567890abcdef"}]
                value:
                  type: string
                  format: big-number-string
                  description: The amount of native token to send along with the Contract Method. This is only applicable for Contract Methods that are payable. Including this value for a nonpayable method will result in an error.
                  example: "123400000000000000000"
      responses:
        200:
          description: "Success"
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractMethodEncodeResult'
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"
   
  /methods/{contractMethodId}/estimate:
    post:
      tags:
        - Contract Methods
        - Contract Methods
      description: Estimates the cost of executing the Contract Method with the given parameters. Returns data about the fees and amount of gas.
      parameters:
        - name: contractMethodId
          in: path
          required: true
          schema:
            $ref: "#/components/schemas/ContractMethodId"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: You need to provide a value for every parameter in the Contract Method via the name of the parameter
              properties:
                params:
                  $ref: '#/components/schemas/JSONValue'
                contractAddress:
                  $ref: "#/components/schemas/ContractAddress"
                authorizationList:
                  type: array
                  items:
                    $ref: "#/components/schemas/ERC7702Authorization"
                  description: A list of authorizations for the Contract Method. If you are using ERC-7702, you must provide at least one authorization.
                  example: [{"address": "0x1234567890abcdef", "nonce": "1", "chainId": "1", "signature": "0x1234567890abcdef"}]
                value:
                  type: string
                  format: big-number-string
                  description: The amount of native token to send along with the Contract Method. This is only applicable for Contract Methods that are payable. Including this value for a nonpayable method will result in an error.
                  example: "123400000000000000000"
      responses:
        200:
          description: "Success"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ContractMethodEstimate"
        400:
          $ref: "#/components/responses/BadRequestError"
        403:
          $ref: "#/components/responses/PermissionError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /methods/{contractMethodId}/execute:
    post:
      tags:
        - Contract Methods
      description: Starts the execution of the Contract Method, and returns a Transaction. You can only execute Contract Methods that are payable or nonpayable. Use /read for view and pure Contract Methods.
      parameters:
        - name: contractMethodId
          in: path
          required: true
          schema:
            $ref: "#/components/schemas/ContractMethodId"
      security:
        - OAuth2ClientCredentials:
          - read:api
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: You need to provide a value for every parameter in the Contract Method via the name of the parameter
              properties:
                params:
                  $ref: '#/components/schemas/JSONValue'
                walletId:
                  $ref: "#/components/schemas/WalletId"
                memo:
                  type: string
                  description: You may include any text you like when you execute a Contract Method, as a note to yourself about why it was done. This text can be JSON or similar if you want to store formatted data.
                authorizationList:
                  type: array
                  items:
                    $ref: "#/components/schemas/ERC7702Authorization"
                  description: A list of authorizations for the Contract Method. If you are using ERC-7702, you must provide at least one authorization.
                  example: [{"address": "0x1234567890abcdef", "nonce": "1", "chainId": "1", "signature": "0x1234567890abcdef"}]
                value:
                  type: string
                  format: big-number-string
                  description: The amount of native token to send along with the Contract Method. This is only applicable for Contract Methods that are payable. Including this value for a nonpayable method will result in an error.
                  example: "123400000000000000000"
                contractAddress:
                  $ref: "#/components/schemas/ContractAddress"
                gasLimit:
                  type: string
                  format: big-number-string
                  description: The gas limit for the transaction. The transaction will revert if it uses more gas than this, and you will spend the gas in the process. Ordinarily, you do not need this, 1Shot will calculate it for you. However, for some very complicated transactions, you may need to set the gas limit manually as the normal estimation process may underestimate the gas amount.
                  example: "123400000000000000000"
                upgradeTo7710:
                  type: boolean
                  description: This will upgrade the wallet to a 7710 Smart Wallet on supported chains. The call will error if this is set and the chain is not supported.
      responses:
        200:
          description: "Success"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Transaction"
        400:
          $ref: "#/components/responses/BadRequestError"
        403:
          $ref: "#/components/responses/PermissionError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /methods/{contractMethodId}/executeAsDelegator:  
    post:
      tags:
        - Contract Methods
      description: Starts the execution of the Contract Method as a delegator, and returns a Transaction. You can only execute Contract Methods that are payable or nonpayable. Use /read for view and pure Contract Methods. This method executes the transaction on behalf of the specified delegator address.
      parameters:
        - name: contractMethodId
          in: path
          required: true
          schema:
            $ref: "#/components/schemas/ContractMethodId"
      security:
        - OAuth2ClientCredentials:
          - read:api
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: You need to provide a value for every parameter in the Contract Method via the name of the parameter
              properties:
                params:
                  $ref: '#/components/schemas/JSONValue'
                walletId:
                  $ref: "#/components/schemas/WalletId"
                memo:
                  type: string
                  description: You may include any text you like when you execute a Contract Method, as a note to yourself about why it was done. This text can be JSON or similar if you want to store formatted data.
                delegatorAddress:
                  $ref: "#/components/schemas/AccountAddress"
                  description: The address of the delegator on whose behalf the transaction will be executed. This delegation must be on file already; 1Shot API will use the first matching delegation for the delegator address but is not guaranteed to use the best or correct one if multiple delegations exist.
                delegationId:
                  $ref: "#/components/schemas/DelegationId"
                  description: The ID of a specific delegation to use for this transaction. This is the best way to ensure that 1Shot API uses the correct delegation for the transaction.
                delegationData:
                  type: array
                  items:
                    type: string
                    format: json-string
                  description: Array of delegation objects to use for the transaction, each serialized as a JSON string. Treated as one-time use and not stored in 1Shot API for reuse. Not usable with delegatorAddress or delegationId.
                authorizationList:
                  type: array
                  items:
                    $ref: "#/components/schemas/ERC7702Authorization"
                  description: A list of authorizations for the Contract Method. If you are using ERC-7702, you must provide at least one authorization.
                  example: [{"address": "0x1234567890abcdef", "nonce": "1", "chainId": "1", "signature": "0x1234567890abcdef"}]
                value:
                  type: string
                  format: big-number-string
                  description: The amount of native token to send along with the Contract Method. This is only applicable for Contract Methods that are payable. Including this value for a nonpayable method will result in an error.
                  example: "123400000000000000000"
                gasLimit:
                  type: string
                  format: big-number-string
                  description: The gas limit for the transaction. The transaction will revert if it uses more gas than this, and you will spend the gas in the process. Ordinarily, you do not need this, 1Shot will calculate it for you. However, for some very complicated transactions, you may need to set the gas limit manually as the normal estimation process may underestimate the gas amount.
                  example: "123400000000000000000"
      responses:
        200:
          description: "Success"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Transaction"
        400:
          $ref: "#/components/responses/BadRequestError"
        403:
          $ref: "#/components/responses/PermissionError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /methods/executeBatch:  
    post:
      tags:
        - Contract Methods
      description: Batches multiple contract method invocations into a single transction. Will reject if the server wallet has not been upgraded.
      security:
        - OAuth2ClientCredentials:
          - read:api
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: You need to provide a value for every parameter in the Contract Method via the name of the parameter
              properties:
                contractMethods:
                  type: array
                  items:
                    type: object
                    properties:
                      contractMethodId:
                        $ref: "#/components/schemas/ContractMethodId"
                      executionIndex:
                        type: integer
                        description: The order in which to execute this method. Must start at 0 and increment by 1. Must be unique. Provided in case the array gets shuffled in transmission.
                      params:
                        $ref: '#/components/schemas/JSONValue'
                      value:
                        type: string
                        format: big-number-string
                        description: The amount of native token to send along with the Contract Method. This is only applicable for Contract Methods that are payable. Including this value for a nonpayable method will result in an error.
                        example: "123400000000000000000"
                      contractAddress:
                        $ref: "#/components/schemas/ContractAddress"
                    required:
                      - contractMethodId
                      - executionIndex
                walletId:
                  $ref: "#/components/schemas/WalletId"
                atomic:
                  type: boolean
                  description: If true, all transactions in the batch must succeed, or the entire batch is rolled back. If false, the executions that succeed will complete, but no transactions after the first failure will be executed.
                  default: true
                memo:
                  type: string
                  description: You may include any text you like when you execute a Contract Method, as a note to yourself about why it was done. This text can be JSON or similar if you want to store formatted data.
                authorizationList:
                  type: array
                  items:
                    $ref: "#/components/schemas/ERC7702Authorization"
                  description: A list of authorizations for the Contract Method. If you are using ERC-7702, you must provide at least one authorization.
                  example: [{"address": "0x1234567890abcdef", "nonce": "1", "chainId": "1", "signature": "0x1234567890abcdef"}]
                gasLimit:
                  type: string
                  format: big-number-string
                  description: The gas limit for the transaction. The transaction will revert if it uses more gas than this, and you will spend the gas in the process. Ordinarily, you do not need this, 1Shot will calculate it for you. However, for some very complicated transactions, you may need to set the gas limit manually as the normal estimation process may underestimate the gas amount.
                  example: "123400000000000000000"
              required:
                - contractMethods
                - walletId
      responses:
        200:
          description: "Success"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Transaction"
        400:
          $ref: "#/components/responses/BadRequestError"
        403:
          $ref: "#/components/responses/PermissionError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /methods/executeAsDelegatorBatch:  
    post:
      tags:
        - Contract Methods
      description: Batches multiple contract method invocations into a single transction. Will reject if the server wallet has not been upgraded.
      security:
        - OAuth2ClientCredentials:
          - read:api
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: You need to provide a value for every parameter in the Contract Method via the name of the parameter
              properties:
                contractMethods:
                  type: array
                  items:
                    type: object
                    properties:
                      contractMethodId:
                        $ref: "#/components/schemas/ContractMethodId"
                      executionIndex:
                        type: integer
                        description: The order in which to execute this method. Must start at 0 and increment by 1. Must be unique. Provided in case the array gets shuffled in transmission.
                      params:
                        $ref: '#/components/schemas/JSONValue'
                      delegatorAddress:
                        $ref: "#/components/schemas/AccountAddress"
                        description: The address of the delegator on whose behalf the transaction will be executed. This delegation must be on file already; 1Shot API will use the first matching delegation for the delegator address but is not guaranteed to use the best or correct one if multiple delegations exist.
                      delegationId:
                        $ref: "#/components/schemas/DelegationId"
                        description: The ID of a specific delegation to use for this transaction. This is the best way to ensure that 1Shot API uses the correct delegation for the transaction.
                      delegationData:
                        type: array
                        items:
                          type: string
                          format: json-string
                        description: Array of delegation objects to use for this method invocation, each serialized as a JSON string. Treated as one-time use and not stored in 1Shot API for reuse. Not usable with delegatorAddress or delegationId. If you are using redelegations, make sure to properly order them- Child, Parent is correct, Parent, Child will fail.
                      value:
                        type: string
                        format: big-number-string
                        description: The amount of native token to send along with the Contract Method. This is only applicable for Contract Methods that are payable. Including this value for a nonpayable method will result in an error.
                        example: "123400000000000000000"
                      contractAddress:
                        $ref: "#/components/schemas/ContractAddress"
                    required:
                      - contractMethodId
                      - executionIndex
                      - delegatorAddress
                walletId:
                  $ref: "#/components/schemas/WalletId"
                atomic:
                  type: boolean
                  description: If true, all transactions in the batch must succeed, or the entire batch is rolled back. If false, the executions that succeed will complete, but no transactions after the first failure will be executed.
                  default: true
                memo:
                  type: string
                  description: You may include any text you like when you execute a Contract Method, as a note to yourself about why it was done. This text can be JSON or similar if you want to store formatted data.
                authorizationList:
                  type: array
                  items:
                    $ref: "#/components/schemas/ERC7702Authorization"
                  description: A list of authorizations for the Contract Method. If you are using ERC-7702, you must provide at least one authorization.
                  example: [{"address": "0x1234567890abcdef", "nonce": "1", "chainId": "1", "signature": "0x1234567890abcdef"}]
                gasLimit:
                  type: string
                  format: big-number-string
                  description: The gas limit for the transaction. The transaction will revert if it uses more gas than this, and you will spend the gas in the process. Ordinarily, you do not need this, 1Shot will calculate it for you. However, for some very complicated transactions, you may need to set the gas limit manually as the normal estimation process may underestimate the gas amount.
                  example: "123400000000000000000"
              required:
                - contractMethods
                - walletId
      responses:
        200:
          description: "Success"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Transaction"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"
  
  /methods/{contractMethodId}/read:
    post:
      tags:
        - Contract Methods
      description: Gets the result of a view or pure function; this will error on payable and nonpayable Contract Methods.
      parameters:
        - name: contractMethodId
          in: path
          required: true
          schema:
            $ref: "#/components/schemas/ContractMethodId"
      security:
        - OAuth2ClientCredentials:
          - read:api
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: You need to provide a value for every parameter in the Contract Method via the name of the parameter
              properties:
                params:
                  $ref: '#/components/schemas/JSONValue'
      responses:
        200:
          description: "Success"
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JSONValue'
        500:
          $ref: "#/components/responses/DatabaseError"
  
  /business/{businessId}/methods:
    post:
      tags:
        - Contract Methods
        - Create
      description: Create a new Contract Method. A Contract Method is sometimes referred to as an Endpoint. A Contract Method corresponds to a single method on a smart contract, and most of the required information to create one can be pulled from an Ethereum EBI. Contract Methods can be configured with static values for input parameters, which is useful for controlling how the Contract Method is called. For instance, you may set the "amount" parameter to a constant value on a "mint" call so that you always mint the same amount of tokens and can't cheat. You can have multiple Contract Methods for the same underlying method on a smart contract, if you want to configure them with different static parameters.
      parameters:
        - name: businessId
          in: path
          description: The internal uuid of the Business you are interested in
          required: true
          schema:
            $ref: "#/components/schemas/BusinessId"
      security:
        - OAuth2ClientCredentials:
          - read:api
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                chainId:
                  $ref: "#/components/schemas/EChain"
                contractAddress:
                  $ref: "#/components/schemas/ContractAddress"
                walletId:
                  $ref: "#/components/schemas/WalletId"
                name:
                  type: string
                  description: This is the name of the Contract Method, which is used for display purposes and lookup- it is not the same as the functionName, but can be.
                  example: Mint Token
                description:
                  type: string
                  description: A description of the Contract Method. You should include details about what the Contract Method does and when it should be called. If you are using static parameters, describe the configured values.
                  example: This calls the mint() method on our ERC20 contract
                functionName:
                  type: string
                  description: The actual method name on the smart contract. Solidity names are case sensitive and must match precisely.
                  example: mint
                stateMutability:
                  $ref: "#/components/schemas/ESolidityStateMutability"
                inputs:
                  type: array
                  description: An array of the input parameters for the smart contract method. These may be configured with static values.
                  items:
                    $ref: "#/components/schemas/NewSolidityStructParam"
                outputs:
                  type: array
                  description: An array of the output parameters for the smart contract method. Static values can be configured but will be ignored. Output parameters for "payable" and "nonpayable" methods are generally ignored and do not need to be defined, but these are required for "pure" and "view" methods.
                  items:
                    $ref: "#/components/schemas/NewSolidityStructParam"
                callbackUrl:
                  type: string
                  description: The URL that will be notified after the Contract Method is executed. This must be a valid HTTP or HTTPS URL and include the protocol.
                  nullable: true
                  example: https://example.com/webhook
              required:
                - chainId
                - contractAddress
                - walletId
                - name
                - description
                - functionName
                - stateMutability
                - inputs
      responses:
        200:
          description: Returns the created Contract Method.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ContractMethod"
                  

        500:
          $ref: "#/components/responses/DatabaseError"

    get:
      tags:
        - Contract Methods
        - List
      description: Lists Contract Methods for a business
      parameters:
        - name: businessId
          in: path
          description: The business that you want Contract Methods from
          required: true
          schema:
            $ref: "#/components/schemas/BusinessId"
        - name: pageSize
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/PageSize"
        - name: page
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/Page"
        - name: chainId
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/EChain"
        - name: name
          in: query
          required: false
          schema:
            type: string
            example: "Best Contract Method Ever"
        - name: status
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/EDeletedStatusSelector"
        - name: contractAddress
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/ContractAddress"
        - name: promptId
          in: query
          required: false
          description: The ID of the Prompt you want to filter by. If provided, only Contract Methods created from this Prompt will be returned.
          schema:
            type: string
            format: uuid
            example: 8a6e0804-2bd0-4672-b79d-d97027f90720
        - name: methodType
          in: query
          required: false
          description: Which type of Contract Method you want to filter by- read or write methods. If not provided, all Contract Methods will be returned.
          schema:
            type: string
            enum:
              - read
              - write
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Returns a list of Contract Method objects.
          content:
            application/json:
              schema:
                allOf:
                  - type: object
                    properties:
                      response:
                        type: array
                        items:
                          $ref: "#/components/schemas/ContractMethod"
                  - $ref: "#/components/schemas/PagedResponse"

        400:
          $ref: "#/components/responses/BadRequestError"
        403:
          $ref: "#/components/responses/PermissionError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /business/{businessId}/methods/abi:
    post:
      tags:
        - Contract Methods
        - Create
      description: Imports a complete ethereum ABI and creates Contract Methods for each "function" type entry. Every Contract Method will be associated with the same Wallet
      parameters:
        - name: businessId
          in: path
          description: The internal uuid of the Business you are interested in
          required: true
          schema:
            $ref: "#/components/schemas/BusinessId"
      security:
        - OAuth2ClientCredentials:
          - read:api
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                chainId:
                  $ref: "#/components/schemas/EChain"
                contractAddress:
                  $ref: "#/components/schemas/ContractAddress"
                walletId:
                  $ref: "#/components/schemas/WalletId"
                abi:
                  $ref: "#/components/schemas/EthereumAbi"
                name:
                  type: string
                  description: The name of the smart contract, if it doesn't already exist.
                  example: Uniswap V3
                description:
                  type: string
                  description: A description of the smart contract, if it doesn't already exist.
                  example: The Uniswap V3 smart contract
                tags:
                  type: array
                  items:
                    type: string
                  description: Tags to add to the smart contract
              required:
                - chainId
                - contractAddress
                - walletId
                - abi
      responses:
        200:
          description: Returns the created Contract Method objects.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/ContractMethod"

        400:
          $ref: "#/components/responses/BadRequestError"
        403:
          $ref: "#/components/responses/PermissionError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /business/{businessId}/methods/prompt:
    post:
      tags:
        - Contract Methods
        - Assure
      description: Assures that Contract Methods exist for a given Prompt. This is based on the verified contract ABI and either the highest-ranked Prompt or the promptId provided. If Contract Methods already exist, they are not modified. If they do not exist, any methods that are in the Prompt will be created with the details from the Prompt. We return every Contract Method for methods defined in the Prompt.
      parameters:
        - name: businessId
          in: path
          description: The internal uuid of the Business you are interested in
          required: true
          schema:
            $ref: "#/components/schemas/BusinessId"
      security:
        - OAuth2ClientCredentials:
          - read:api
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                chainId:
                  $ref: "#/components/schemas/EChain"
                contractAddress:
                  $ref: "#/components/schemas/ContractAddress"
                walletId:
                  $ref: "#/components/schemas/WalletId"
                promptId:
                  type: string
                  format: uuid
                  description: The ID of the prompt that you want to use. If not provided, the highest-ranked Prompt for the chain and contract address will be used. This is optional, and a Contract Method can drift from the original Prompt but retain this association.
                  example: 100d2e83-dddd-480d-88ad-74a71c214912
              required:
                - chainId
                - contractAddress
                - walletId
      responses:
        200:
          description: Returns all the Contract Methods defined by the Prompt. It is possible for the descriptions of these Contract Methods to drift from the original Prompt. In the case that multiple Contract Methods exist for the same Prompt, the most recently created one will be returned.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/ContractMethod"

        500:
          $ref: "#/components/responses/DatabaseError"

  /methods/{contractMethodId}:
    get:
      tags:
        - Contract Methods
        - Get
      description: Gets a single Contract Method via its ContractMethodId
      parameters:
        - name: contractMethodId
          in: path
          description: The Contract Method that you want to retrieve
          required: true
          schema:
            $ref: "#/components/schemas/ContractMethodId"
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Returns a single Contract Method object.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ContractMethod"
        403:
          $ref: "#/components/responses/PermissionError"
        404:
          $ref: "#/components/responses/NotFoundError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

    put:
      tags:
       - Contract Methods
       - Update
      description: Updates a Contract Method. You can update most of the properties of a Contract Method via this method, but you can't change the inputs or outputs. Use the Struct API calls for that instead.
      parameters:
        - name: contractMethodId
          in: path
          description: The Contract Method that you want to update
          required: true
          schema:
            $ref: "#/components/schemas/ContractMethodId"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: You need to provide a value for every parameter in the Contract Method via the name of the parameter
              properties:
                chainId:
                  $ref: "#/components/schemas/EChain"
                contractAddress:
                  $ref: "#/components/schemas/ContractAddress"
                walletId:
                  $ref: "#/components/schemas/WalletId"
                name:
                  type: string
                  description: The name of the Contract Method, used for organization purposes.
                description:
                  type: string
                  description: An optional description of the Contract Method, for your own reference in the site.
                functionName:
                  type: string
                  description: The name of the function on the contract. This is case-sensitive, so be sure to check your ABI.
                stateMutability:
                  $ref: "#/components/schemas/ESolidityStateMutability"
                callbackUrl:
                  type: string
                  format: URL
                  example: "https://my-server.com/1shotwebhook"
                  description: The desired URL for the callback. This will internally create a Webhook Trigger. Make sure to leave this undefined to not update the field, if you pass null it will clear the webhook.
                  nullable: true
      responses:
        200:
          description: Returns the updated Contract Method object.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ContractMethod"
        400:
          $ref: "#/components/responses/BadRequestError"
        403:
          $ref: "#/components/responses/PermissionError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

    delete:
      tags:
        - Contract Methods
        - Delete
      description: Deletes a Contract Method
      parameters:
        - name: contractMethodId
          in: path
          required: true
          schema:
            $ref: "#/components/schemas/ContractMethodId"
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: "Success"

        400:
          $ref: "#/components/responses/BadRequestError"
        403:
          $ref: "#/components/responses/PermissionError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /business/{businessId}/events:
    post:
      tags:
        - Contract Events
        - Create
      description: Creates a new contract event definition for monitoring blockchain events.
      parameters:
        - name: businessId
          required: true
          in: path
          schema:
            $ref: "#/components/schemas/BusinessId"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - chainId
                - contractAddress
                - name
                - description
                - eventName
              properties:
                chainId:
                  $ref: "#/components/schemas/EChain"
                contractAddress:
                  $ref: "#/components/schemas/ContractAddress"
                name:
                  type: string
                  description: A human-readable name for this event definition
                  example: "Transfer Event"
                description:
                  type: string
                  description: A description of what this event represents
                  example: "Monitors token transfer events"
                eventName:
                  type: string
                  description: The exact name of the event as defined in the contract ABI
                  example: "Transfer"
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Returns the created contract event definition.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ContractEvent"
        400:
          $ref: "#/components/responses/BadRequestError"
        403:
          $ref: "#/components/responses/PermissionError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

    get:
      tags:
        - Contract Events
        - List
      description: Lists contract event definitions for a business with optional filtering.
      parameters:
        - name: businessId
          required: true
          in: path
          schema:
            $ref: "#/components/schemas/BusinessId"
        - name: page
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/Page"
        - name: pageSize
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/PageSize"
        - name: chainId
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/EChain"
        - name: name
          in: query
          required: false
          schema:
            type: string
            description: Filter by event definition name
        - name: status
          in: query
          required: false
          schema:
            type: string
            enum: [active, deleted, all]
            default: active
            description: Filter by deletion status
        - name: contractAddress
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/ContractAddress"
        - name: eventName
          in: query
          required: false
          schema:
            type: string
            description: Filter by contract event name
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Returns a paginated list of contract event definitions.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/PagedResponse"
                  - type: object
                    properties:
                      response:
                        type: array
                        items:
                          $ref: "#/components/schemas/ContractEvent"
        403:
          $ref: "#/components/responses/PermissionError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /events/{contractEventId}:
    get:
      tags:
        - Contract Events
        - Get
      description: Retrieves a specific contract event definition by ID.
      parameters:
        - name: contractEventId
          required: true
          in: path
          schema:
            $ref: "#/components/schemas/ContractEventId"
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Returns the contract event definition.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ContractEvent"
        403:
          $ref: "#/components/responses/PermissionError"
        404:
          $ref: "#/components/responses/NotFoundError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

    put:
      tags:
        - Contract Events
        - Update
      description: Updates an existing contract event definition.
      parameters:
        - name: contractEventId
          required: true
          in: path
          schema:
            $ref: "#/components/schemas/ContractEventId"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: Updated name for the event definition
                description:
                  type: string
                  description: Updated description for the event definition
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Returns the updated contract event definition.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ContractEvent"
        403:
          $ref: "#/components/responses/PermissionError"
        404:
          $ref: "#/components/responses/NotFoundError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

    delete:
      tags:
        - Contract Events
        - Delete
      description: Deletes a contract event definition.
      parameters:
        - name: contractEventId
          required: true
          in: path
          schema:
            $ref: "#/components/schemas/ContractEventId"
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Successfully deleted the contract event definition.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        403:
          $ref: "#/components/responses/PermissionError"
        500:
          $ref: "#/components/responses/DatabaseError"

  /events/{contractEventId}/search:
    post:
      tags:
        - Contract Events
        - Search
      description: Reads contract event logs from the blockchain for the specified event definition.
      parameters:
        - name: contractEventId
          required: true
          in: path
          schema:
            $ref: "#/components/schemas/ContractEventId"
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                startBlock:
                  type: integer
                  description: Starting block number to search from
                  example: 12345678
                endBlock:
                  type: integer
                  description: Ending block number to search to
                  example: 12345680
                topics:
                  type: object
                  description: Filter by indexed event parameters
                  additionalProperties:
                    type: string
                    description: Topic value to filter by. Must be an indexed topic.
                  example:
                    from: "0x1234567890123456789012345678901234567890"
                    to: "0x0987654321098765432109876543210987654321"
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Returns the contract event logs found.
          content:
            application/json:
              schema:
                type: object
                properties:
                  logs:
                    type: array
                    items:
                      $ref: "#/components/schemas/ContractEventLog"
                  error:
                    type: string
                    description: The error message from the API
                  maxResults:
                    type: integer
                    description: The maximum number of results returned by the API
                  startBlock:
                    type: integer
                    description: The recommended starting block number in case of excessive results.
                  endBlock:
                    type: integer
                    description: The recommended ending block number in case of excessive results.
        403:
          $ref: "#/components/responses/PermissionError"
        404:
          $ref: "#/components/responses/NotFoundError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /business/{businessId}/transactions:
    get:
      tags:
        - Transactions
        - List
      description: Gets a paged list of Transactions, which are records of changes made to the blockchain from executing a Contract Method. You can see the status of the Transaction and your history.
      parameters:
        - name: businessId
          in: path
          description: The business that you want Transactions from
          required: true
          schema:
            $ref: "#/components/schemas/BusinessId"
        - name: pageSize
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/PageSize"
        - name: page
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/Page"
        - name: chainId
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/EChain"
        - name: status
          in: query
          required: false
          schema:
            type: string
            description: The status of the Transaction as it moves through 1Shot.
            enum:
              - Pending
              - Submitted
              - Completed
              - Retrying
              - Failed
        - name: walletId
          in: query
          required: false
          description: Will filter the results to Transactions using this Wallet Id only.
          schema:
            $ref: "#/components/schemas/WalletId"
        - name: contractMethodId
          in: query
          required: false
          description: Will filter the results to only those Transactions for this particular Contract Method.
          schema:
            $ref: "#/components/schemas/ContractMethodId"
        - name: apiCredentialId
          in: query
          required: false
          schema:
            type: string
            format: uuid
            example: 8a6e0804-2bd0-4672-b79d-d97027f90720
        - name: userId
          in: query
          required: false
          schema:
            type: string
            format: uuid
            example: 8a6e0804-2bd0-4672-b79d-d97027f90720
        - name: memo
          in: query
          required: false
          schema:
            type: string
            example: "Illicit Activities"
        - name: createdAfter
          in: query
          required: false
          schema:
            type: number
            format: unix-timestamp
            example: 1659485172
        - name: createdBefore
          in: query
          required: false
          schema:
            type: number
            format: unix-timestamp
            example: 1659485172
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Returns a paged response of Transaction objects.
          content:
            application/json:
              schema:
                allOf:
                  - type: object
                    properties:
                      response:
                        type: array
                        items:
                          $ref: "#/components/schemas/Transaction"
                  - $ref: "#/components/schemas/PagedResponse"
        403:
          $ref: "#/components/responses/PermissionError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /transactions/{transactionId}:
    get:
      tags:
        - Transactions
        - Get
      description: Gets a specific Transaction
      parameters:
        - name: transactionId
          in: path
          description: The Transaction that you want to retrieve
          required: true
          schema:
            $ref: "#/components/schemas/TransactionId"
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Returns the specific requested Transaction
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Transaction"
        403:
          $ref: "#/components/responses/PermissionError"
        404:
          $ref: "#/components/responses/NotFoundError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /business/{businessId}/wallets:
    get:
      tags:
        - Wallets
        - List
      description: Lists wallets for the business- NOT BusinessWallets. These are almost identical but Wallet has more stuff.
      parameters:
        - name: businessId
          in: path
          description: The internal uuid of the Business you are interested in
          required: true
          schema:
            $ref: "#/components/schemas/BusinessId"
        - name: chainId
          in: query
          description: The specific chain to get the wallets for
          required: false
          schema:
            $ref: "#/components/schemas/EChain"
        - name: pageSize
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/PageSize"
        - name: page
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/Page"
        - name: name
          in: query
          required: false
          description: Filters on the name of the wallet.
          schema:
            type: string
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: "Success"
          content:
            application/json:
              schema:
                allOf:
                  - type: object
                    properties:
                      response:
                        type: array
                        items:
                          $ref: "#/components/schemas/Wallet"
                  - $ref: "#/components/schemas/PagedResponse"
        403:
          $ref: "#/components/responses/PermissionError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"
    post:
      tags:
        - Wallets
        - Create
      description: Creates a new Wallet. Wallets are owned by a single Business and are linked a single Chain.
      parameters:
        - name: businessId
          in: path
          description: The internal uuid of the Business you are interested in
          required: true
          schema:
            $ref: "#/components/schemas/BusinessId"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                chainId:
                  $ref: "#/components/schemas/EChain"
                name:
                  type: string
                  description: The name of the wallet.
                description:
                  type: string
                  description: A description of the wallet, such as it's intended use. This is for reference only.
                lowBalanceThreshold:
                  type: string
                  format: big-number-string
                  description: The low balance threshold for the wallet. Defaults to 10000000000000000. (0.01 ETH)
              required:
                - chainId
                - name
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Returns the wallet object.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Wallet"
        400:
          $ref: "#/components/responses/BadRequestError"
        403:
          $ref: "#/components/responses/PermissionError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"
          
  /wallets/{walletId}:
    get:
      tags:
        - Wallets
        - Get
      description: Gets n Wallet by the ID. Doesn't matter what chain it's on.
      parameters:
        - name: walletId
          in: path
          description: The ID of the wallet
          required: true
          schema:
            $ref: "#/components/schemas/WalletId"
        - name: includeBalances
          in: query
          description: Set to "true" to return the balance information for the wallet. Includes only the native token balance.
          required: false
          schema:
            type: boolean
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: "Success"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Wallet"
        403:
          $ref: "#/components/responses/PermissionError"
        404:
          $ref: "#/components/responses/NotFoundError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"
    delete:
      tags:
        - Wallets
        - Delete
      description: Deletes a Wallet with the provided ID. The API Credential must have Admin level permissions on the Business that owns this Wallet, and the Wallet must be near empty.
      parameters:
        - name: walletId
          in: path
          description: The ID of the wallet
          required: true
          schema:
            $ref: "#/components/schemas/WalletId"
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: "Success"
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: Whether or not the delete was successful
                    example: true
        403:
          $ref: "#/components/responses/PermissionError"
        404:
          $ref: "#/components/responses/NotFoundError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"
    put:
      tags:
        - Wallets
        - Update
      description: Updates a Wallet. Will only update properties that are not null
      parameters:
        - name: walletId
          in: path
          description: The ID of the wallet
          required: true
          schema:
            $ref: "#/components/schemas/WalletId"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                description:
                  type: string
                lowBalanceThreshold:
                  type: string
                  format: big-number-string
                  description: The low balance threshold for the wallet.
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: "Success"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Wallet"
        403:
          $ref: "#/components/responses/PermissionError"
          
  /wallets/{walletId}/transfer:
    post:
      tags:
        - Wallets
      description: Initiates a tranfer of the chains' native token from the Wallet. This is almost the same as executing a Contract Method except there is no contract involved.
      parameters:
        - name: walletId
          in: path
          description: The internal uuid of the Wallet you are transfering funds from
          required: true
          schema:
            $ref: "#/components/schemas/WalletId"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                destinationAccountAddress:
                  $ref: "#/components/schemas/AccountAddress"
                transferAmount:
                  type: string
                  format: big-number-string
                  description: the amount of native token to transfer. This is the "value" parameter in the actual transaction. If you omit this parameter, 1Shot API will calculate the maximum amount of token that you can transfer, getting as close to zeroing out the Wallet as possible.
                  example: "123400000000000000000"
                memo:
                  type: string
                  description: An optional memo for the transfer
              required:
                - destinationAccountAddress
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Returns a Transaction object, which will not be mined yet. You'll need to poll to see when the Transaction completes, because there are no available webhook notifications for native transfers.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Transaction"
        400:
          $ref: "#/components/responses/BadRequestError"
        403:
          $ref: "#/components/responses/PermissionError"
        404:
          $ref: "#/components/responses/NotFoundError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /wallets/{walletId}/delegations:
    get:
      tags:
        - Wallets
        - Delegations
        - List
      description: Lists delegations for a wallet. Returns a paged response of delegations associated with the specified wallet.
      parameters:
        - name: walletId
          in: path
          description: The internal uuid of the Wallet to list delegations for
          required: true
          schema:
            $ref: "#/components/schemas/WalletId"
        - name: pageSize
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/PageSize"
        - name: page
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/Page"
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Returns a paged response of delegation objects.
          content:
            application/json:
              schema:
                allOf:
                  - type: object
                    properties:
                      response:
                        type: array
                        items:
                          $ref: "#/components/schemas/Delegation"
                  - $ref: "#/components/schemas/PagedResponse"
        403:
          $ref: "#/components/responses/PermissionError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

    post:
      tags:
        - Wallets
        - Delegations
      description: Creates a new delegation for a wallet. A delegation allows the wallet to execute transactions on behalf of specified contract addresses and methods.
      parameters:
        - name: walletId
          in: path
          description: The internal uuid of the Wallet to create the delegation for
          required: true
          schema:
            $ref: "#/components/schemas/WalletId"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                startTime:
                  type: number
                  format: unix-timestamp
                  description: The start time for the delegation. If not provided, the delegation starts immediately.
                  example: 1659485172
                endTime:
                  type: number
                  format: unix-timestamp
                  description: The end time for the delegation. If not provided, the delegation has no expiration.
                  example: 1659485172
                contractAddresses:
                  type: array
                  items:
                    $ref: "#/components/schemas/ContractAddress"
                  description: Array of contract addresses that the wallet can execute transactions for.
                  example: ["0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9"]
                methods:
                  type: array
                  items:
                    type: string
                  description: Array of method names that the wallet can execute. If empty, all methods are allowed.
                  example: ["mint", "transfer"]
                delegationData:
                  type: array
                  minItems: 1
                  items:
                    type: string
                    format: json-string
                  description: Ordered delegation chain. Each item is one signed Delegation Framework delegation serialized as a JSON string. BigInts must be encoded as strings.
                  example:
                    - '{"authority":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","caveats":[],"delegate":"0x74847c451c3745fcdf4fd447a9fa5eef8a6791a9","delegator":"0x3e6a2f0CBA03d293B54c9fCF354948903007a798","salt":"0x","signature":"0x000007dc509f5f440bd07e2a51cb8dd135f170bc8886ccf24c35652d256d4f06501537e663fbb3b6e51ca640ad4791fb605ba7434d4d8a0a0a24bfd4d841e88f1c"}'
              required:
                - delegationData
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Returns the created delegation.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Delegation"
        400:
          $ref: "#/components/responses/BadRequestError"
        403:
          $ref: "#/components/responses/PermissionError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /wallets/{walletId}/delegations/redelegate:
    post:
      tags:
        - Wallets
        - Delegations
      description: |
        Variant of redelegation that signs a passed-in delegation instead of looking one up by ID.
        Identical to POST /delegation/{delegationId}/redelegate except you supply the parent delegation in the body.
        The wallet (walletId) must be the delegate of the passed-in delegation; it signs the new delegation to delegateAddress.
        Very useful for fanning out a single delegation to multiple server wallets.
      parameters:
        - name: walletId
          in: path
          description: The internal uuid of the escrow wallet that is the delegate of the passed-in delegation and will sign the redelegation
          required: true
          schema:
            $ref: "#/components/schemas/WalletId"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - delegationData
                - delegateAddress
              properties:
                delegationData:
                  $ref: "#/components/schemas/DelegationData"
                  description: The parent delegation (to this wallet) serialized as a JSON string. BigInts must be encoded as strings.
                delegateAddress:
                  $ref: "#/components/schemas/AccountAddress"
                  description: The address of the new delegate to redelegate to.
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: The parent and redelegation as serialized JSON strings (DelegationData). Pass these in delegationData when executing as delegator.
          content:
            application/json:
              schema:
                type: object
                required:
                  - parent
                  - redelegation
                properties:
                  parent:
                    $ref: "#/components/schemas/DelegationData"
                    description: The parent delegation serialized as JSON. Include this and the redelegation (in order) in delegationData when redeeming.
                  redelegation:
                    $ref: "#/components/schemas/DelegationData"
                    description: The signed redelegation serialized as JSON.
        400:
          $ref: "#/components/responses/BadRequestError"
        403:
          $ref: "#/components/responses/PermissionError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /wallets/{walletId}/signature/{type}:
    get:
      tags:
        - Wallets
        - Get
      description: |
        Gets a signature from a Wallet (same behavior as **POST** on this path). Supported types:
        - **erc3009** / **permit2**: Token transfer authorizations. Pass `contractAddress`, `destinationAddress`, and `amount` as query parameters (plus optional `validUntil`, `validAfter`, `fromAddress`), or use **POST** with the same fields in the JSON body.
        - **erc712**: EIP-712 / `eth_signTypedData_v4`. Pass `domain`, `types`, and `message` (typed-data envelope: `primaryType` + struct `message`) as query JSON strings, or **POST** with objects (recommended for large payloads).
        - **erc191**: EIP-191 personal message via `signMessage`. Pass **`message`** as the plain UTF-8 string to sign (query or **POST** body). Use **POST** for long messages.
      parameters:
        - name: walletId
          in: path
          description: The ID of the wallet
          required: true
          schema:
            $ref: "#/components/schemas/WalletId"
        - name: type
          in: path
          description: erc3009 / permit2 (token auth), erc712 (typed data), erc191 (plain message, EIP-191).
          required: true
          schema:
            type: string
            enum:
              - erc3009
              - permit2
              - erc712
              - erc191
        - name: contractAddress
          in: query
          description: Required for erc3009 and permit2. Ignored for erc712 and erc191.
          required: false
          schema:
            $ref: "#/components/schemas/ContractAddress"
        - name: destinationAddress
          in: query
          description: Required for erc3009 and permit2. Ignored for erc712 and erc191.
          required: false
          schema:
            $ref: "#/components/schemas/AccountAddress"
        - name: amount
          in: query
          description: Required for erc3009 and permit2. Ignored for erc712 and erc191.
          required: false
          schema:
            type: string
            format: big-number-string
            example: "123400"
        - name: validUntil
          in: query
          description: The timestamp until which the signature is valid. This is in seconds since the Unix epoch. For Permit2 signatures, this is the "deadline" value.
          required: false
          schema:
            type: number
            format: unix-timestamp
            example: 1659485172
        - name: validAfter
          in: query
          description: The timestamp after which the signature is valid (seconds since Unix epoch). Only for erc3009; must not be set for permit2.
          required: false
          schema:
            type: number
            format: unix-timestamp
            example: 1659485172
        - name: fromAddress
          in: query
          description: Optional. When set, the ERC-3009 authorization uses this address as the "from" (token holder). Only for erc3009.
          required: false
          schema:
            $ref: "#/components/schemas/AccountAddress"
        - name: domain
          in: query
          description: |
            **erc712 only.** URL-encoded JSON string of the EIP-712 domain (e.g. `name`, `version`, `chainId`, `verifyingContract`), same as the first argument to `signTypedData`.
          required: false
          schema:
            type: string
            example: '{"name":"MyApp","version":"1","chainId":1,"verifyingContract":"0x0000000000000000000000000000000000000000"}'
        - name: types
          in: query
          description: |
            **erc712 only.** URL-encoded JSON string of the types map (struct definitions), same as the `types` argument to `signTypedData`. Do not include `EIP712Domain` if your library adds it automatically; the API strips it before signing.
          required: false
          schema:
            type: string
            example: '{"Person":[{"name":"name","type":"string"},{"name":"wallet","type":"address"}]}'
        - name: message
          in: query
          description: |
            **erc712:** URL-encoded JSON string `{ "primaryType": "...", "message": { ...struct fields } }` (same shape as the typed-data root passed to `signTypedData`).
            **erc191:** Plain UTF-8 text to sign (EIP-191). For long text prefer **POST**.
          required: false
          schema:
            type: string
            example: '{"primaryType":"Person","message":{"name":"Alice","wallet":"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"}}'
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: "The signature and the data that was signed."
          content:
            application/json:
              schema:
                type: object
                properties:
                  signature:
                    type: string
                    format: hex-string
                    description: The signature of the transfer.
                    example: "0x1234567890abcdef"
                  data:
                    type: string
                    format: json-string
                    description: For erc3009/permit2, the signed payload. For erc712, domain/types/primaryType/struct. For erc191, the message that was signed.
        400:
          $ref: "#/components/responses/BadRequestError"
        403:
          $ref: "#/components/responses/PermissionError"
        404:
          $ref: "#/components/responses/NotFoundError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

    post:
      tags:
        - Wallets
        - Post
      description: |
        Same as **GET**, with parameters in the JSON body. Prefer **POST** for large **erc712** payloads or long **erc191** messages.

        - **erc3009** / **permit2**: `contractAddress`, `destinationAddress`, `amount` (required); optional `validUntil`, `validAfter`, `fromAddress`.
        - **erc712**: `domain`, `types`, `message` (`{ primaryType, message: { ...struct } }`). Objects or JSON strings.
        - **erc191**: `message` as a plain string (UTF-8).
      parameters:
        - name: walletId
          in: path
          description: The ID of the wallet
          required: true
          schema:
            $ref: "#/components/schemas/WalletId"
        - name: type
          in: path
          description: Same as GET — erc3009, permit2, erc712, erc191.
          required: true
          schema:
            type: string
            enum:
              - erc3009
              - permit2
              - erc712
              - erc191
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: |
                Include the fields for the chosen `type`. Omit unrelated fields (e.g. no `contractAddress` for erc712/erc191).
              properties:
                contractAddress:
                  $ref: "#/components/schemas/ContractAddress"
                destinationAddress:
                  $ref: "#/components/schemas/AccountAddress"
                amount:
                  oneOf:
                    - type: string
                      format: big-number-string
                    - type: number
                  description: Required for erc3009 and permit2. Number values are accepted and coerced to string.
                validUntil:
                  type: number
                  format: unix-timestamp
                validAfter:
                  type: number
                  format: unix-timestamp
                fromAddress:
                  $ref: "#/components/schemas/AccountAddress"
                domain:
                  description: erc712 — EIP-712 domain object (or JSON string).
                  oneOf:
                    - type: object
                      additionalProperties: true
                    - type: string
                types:
                  description: erc712 — types map (or JSON string).
                  oneOf:
                    - type: object
                      additionalProperties: true
                    - type: string
                message:
                  description: |
                    **erc712:** object `{ primaryType, message }` (struct payload) or JSON string of that object.
                    **erc191:** plain string to sign (EIP-191).
                  oneOf:
                    - type: string
                    - type: object
                      required:
                        - primaryType
                        - message
                      properties:
                        primaryType:
                          type: string
                        message:
                          type: object
                          additionalProperties: true
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: "The signature and the data that was signed."
          content:
            application/json:
              schema:
                type: object
                properties:
                  signature:
                    type: string
                    format: hex-string
                    description: The signature.
                    example: "0x1234567890abcdef"
                  data:
                    type: string
                    format: json-string
                    description: Signed payload / metadata (same as GET).
        400:
          $ref: "#/components/responses/BadRequestError"
        403:
          $ref: "#/components/responses/PermissionError"
        404:
          $ref: "#/components/responses/NotFoundError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /wallets/{walletId}/authorizePermit2:
    put:
      tags:
        - Wallets
        - Update
      description: Authorizes Permit2 for a wallet. This allows the wallet to use Permit2 transfers without requiring individual signatures for each transaction.
      parameters:
        - name: walletId
          in: path
          description: The ID of the wallet to authorize Permit2 for
          required: true
          schema:
            $ref: "#/components/schemas/WalletId"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                contractAddress:
                  $ref: "#/components/schemas/ContractAddress"
                  description: The contract address of the token to authorize Permit2 for
                  example: "0x1234567890abcdef"
              required:
                - contractAddress
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Successfully authorized Permit2 for the wallet
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: Whether the authorization was successful
                    example: true
        400:
          $ref: "#/components/responses/BadRequestError"
        403:
          $ref: "#/components/responses/PermissionError"
        404:
          $ref: "#/components/responses/NotFoundError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /delegation/{delegationId}/redelegate:
    post:
      tags:
        - Wallets
        - Delegations
        - Update
      description: Creates a redelegation from an existing delegation to a new delegate address. The escrow wallet that was the delegate of the original delegation signs the new delegation. Returns the parent and redelegation as serialized JSON strings (the form you pass in to execute as delegator).
      parameters:
        - name: delegationId
          in: path
          description: The internal uuid of the delegation to redelegate from
          required: true
          schema:
            type: string
            format: uuid
            example: 8a6e0804-2bd0-4672-b79d-d97027f90720
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - delegateAddress
              properties:
                delegateAddress:
                  $ref: "#/components/schemas/AccountAddress"
                  description: The new delegate address (recipient of the redelegation)
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: The parent and redelegation as serialized JSON strings (DelegationData). Pass these in delegationData when executing as delegator.
          content:
            application/json:
              schema:
                type: object
                required:
                  - parent
                  - redelegation
                properties:
                  parent:
                    $ref: "#/components/schemas/DelegationData"
                    description: The parent delegation serialized as JSON. Include this and the redelegation (in order) in delegationData when redeeming.
                  redelegation:
                    $ref: "#/components/schemas/DelegationData"
                    description: The signed redelegation serialized as JSON.
        403:
          $ref: "#/components/responses/PermissionError"
        404:
          $ref: "#/components/responses/NotFoundError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /delegation/{delegationId}:
    delete:
      tags:
        - Wallets
        - Delegations
        - Delete
      description: Deletes a delegation by its ID. This operation cannot be undone.
      parameters:
        - name: delegationId
          in: path
          description: The internal uuid of the delegation to delete
          required: true
          schema:
            type: string
            format: uuid
            example: 8a6e0804-2bd0-4672-b79d-d97027f90720
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Successfully deleted the delegation
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: Whether or not the delete was successful
                    example: true
        403:
          $ref: "#/components/responses/PermissionError"
        404:
          $ref: "#/components/responses/NotFoundError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"
  
  /structs/{structId}:
    put:
      tags:
        - Solidity Structs
        - Update
      description: Updates an existing solidity struct. You can get the structId from the SolidityStructParam.typeStructId, which are either input or output params of a Contract Method.
      parameters:
        - name: structId
          in: path
          description: The ID of the existing Solidity Struct
          required: true
          schema:
            type: string
            format: uuid
            example: 8a6e0804-2bd0-4672-b79d-d97027f90720
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
              description: You must provide at least one value to update
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: The updated Solidity Struct
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SolidityStruct"
        403:
          $ref: "#/components/responses/PermissionError"
        404:
          $ref: "#/components/responses/NotFoundError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"
      
  /structs/{structId}/params:
    post:
      tags:
        - Solidity Structs
        - Create
      description: Adds a param to an existing struct. Because of the way the indexes work, you can only add params to the end of a struct. You can use /structs/{structId}/params to later rearrange all the indexes of the params if required.
      parameters:
        - name: structId
          in: path
          description: The ID of the existing Solidity Struct
          required: true
          schema:
            type: string
            format: uuid
            example: 8a6e0804-2bd0-4672-b79d-d97027f90720
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/NewSolidityStructParam"
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: The updated Solidity Struct
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SolidityStruct"
        400:
          $ref: "#/components/responses/BadRequestError"
        403:
          $ref: "#/components/responses/PermissionError"
        404:
          $ref: "#/components/responses/NotFoundError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"
  
    put:
      tags:
        - Solidity Structs
        - Update
      description: Update the params of an existing struct. Normally, you would do updates one at a time, but since the parameter indexes must be kept in order, you can update multiple params at once with this call.
      parameters:
        - name: structId
          in: path
          description: The ID of the existing Solidity Struct
          required: true
          schema:
            type: string
            format: uuid
            example: 8a6e0804-2bd0-4672-b79d-d97027f90720
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                updates:
                  type: array
                  items:
                    allOf:
                      - $ref: "#/components/schemas/SolidityStructParamUpdate"
                      - type: object
                        properties:
                          id: 
                            type: string
                            format: uuid
                            example: 8a6e0804-2bd0-4672-b79d-d97027f90720
                        required:
                          - id
              description: You must provide at least one update object
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: The updated Solidity Struct
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SolidityStruct"
        400:
          $ref: "#/components/responses/BadRequestError"
        403:
          $ref: "#/components/responses/PermissionError"
        404:
          $ref: "#/components/responses/NotFoundError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /structs/{structId}/params/{structParamId}:
    delete:
      tags:
        - Solidity Structs
        - Delete
      description: Removes a param from an existing solidity struct. Because the indexes must be kept valid at all times, you can only practically remove the last param from the struct. If you need to remove a param in the middle, call PUT /structs/{structId}/params and rearrange the param indexes first. 
      parameters:
        - name: structId
          in: path
          description: The ID of the existing Solidity Struct
          required: true
          schema:
            type: string
            format: uuid
            example: 8a6e0804-2bd0-4672-b79d-d97027f90720
        - name: structParamId
          in: path
          description: The ID of the existing Solidity Struct param that you want to remove.
          required: true
          schema:
            type: string
            format: uuid
            example: 8a6e0804-2bd0-4672-b79d-d97027f90720
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: The updated Solidity Struct
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SolidityStruct"
        403:
          $ref: "#/components/responses/PermissionError"
        404:
          $ref: "#/components/responses/NotFoundError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /prompts/search:
    post:
      tags:
        - Search
        - Prompts
      description: Performs a semantic search on prompts to find the most relevant contracts.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                query:
                  type: string
                  description: A free-form query to search for contracts. This uses semantic search to find the most relevant contracts.
                chainId:
                  $ref: "#/components/schemas/EChain"
              required:
                - query
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Returns a paged response of prompts
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/FullPrompt"
        400:
          $ref: "#/components/responses/BadRequestError"
        403:
          $ref: "#/components/responses/PermissionError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /x402/supported:
    get:
      tags:
        - x402
      description: |
        Returns supported x402 payment kinds. For each chain/scheme supported by the facilitator, the API returns **two** entries:
        one with `x402Version: 1` and legacy `network` names, and one with `x402Version: 2` and CAIP-2 `eip155:&lt;chainId&gt;` network ids.
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Supported x402 payment kinds (v1 and v2 rows per chain)
          content:
            application/json:
              schema:
                type: object
                properties:
                  kinds:
                    type: array
                    items:
                      type: object
                      properties:
                        x402Version:
                          type: integer
                          enum: [1, 2]
                          description: Protocol version this row describes (`1` = legacy network name, `2` = CAIP-2 network).
                        scheme:
                          type: string
                          description: The scheme for the payment (e.g. `exact`)
                        network:
                          description: v1 rows use legacy x402 network names; v2 rows use CAIP-2 `eip155:&lt;chainId&gt;`.
                          oneOf:
                            - $ref: "#/components/schemas/EX402Network"
                            - $ref: "#/components/schemas/CAIP2Network"
                        tokens:
                          type: array
                          items:
                            type: object
                            properties:
                              contractAddress:
                                type: string
                                format: evm-address
                              name:
                                type: string
                              symbol:
                                type: string
                              decimals:
                                type: integer
                              version:
                                type: string
                                description: Token metadata version (e.g. USDC `2`)
                      required:
                        - x402Version
                        - scheme
                        - network
                        - tokens
        403:
          $ref: "#/components/responses/PermissionError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /x402/verify:
    post:
      tags:
        - x402
      description: |
        Verifies an x402 payment (facilitator flow). Supports **v1** and **v2**
        ([x402 v1 spec](https://github.com/coinbase/x402/blob/main/specs/x402-specification-v1.md),
        [x402 v2 spec](https://github.com/coinbase/x402/blob/main/specs/x402-specification-v2.md)).
        **v1:** `paymentPayload` is the v1 PaymentPayload; `paymentRequirements` uses `maxAmountRequired` and legacy `network` names.
        **v2:** `paymentPayload` is the v2 shape (`accepted`, inner `payload`, optional `resource`); `paymentRequirements` uses `amount` and CAIP-2 `network` (e.g. `eip155:84532`). `paymentPayload.accepted` must match `paymentRequirements`.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                x402Version:
                  type: integer
                  description: Protocol version — use `1` or `2`.
                  example: 1
                paymentPayload:
                  type: object
                  description: x402 v1 or v2 PaymentPayload (see endpoint description).
                paymentRequirements:
                  type: object
                  description: |
                    v1 facilitator requirements (`maxAmountRequired`, legacy `network`) or
                    v2 requirements (`amount`, CAIP-2 `network`). Other fields match the spec.
                  properties:
                    scheme:
                      type: string
                      example: exact
                    network:
                      oneOf:
                        - $ref: "#/components/schemas/EX402Network"
                        - $ref: "#/components/schemas/CAIP2Network"
                    maxAmountRequired:
                      type: string
                      format: big-number-string
                      example: 5000000
                    amount:
                      type: string
                      format: big-number-string
                      description: v2 required payment amount (atomic units)
                    resource:
                      type: string
                      example: https://n8n.1shotapi.dev/webhook/gas-station
                    description:
                      type: string
                      example: Swap stablecoins for gas tokens
                    mimeType:
                      type: string
                      example: ""
                    outputSchema:
                      type: object
                    payTo:
                      type: string
                      format: evm-address
                      example: 0x9fEad8B19C044C2f404dac38B925Ea16ADaa2954
                    maxTimeoutSeconds:
                      type: integer
                      example: 150
                    asset:
                      type: string
                      format: evm-address
                      example: 0xcac524bca292aaade2df8a05cc58f0a65b1b3bb9
                    extra:
                      type: object
                      properties:
                        name:
                          type: string
                          example: Paypal USD
                        version:
                          type: string
                          example: 1
              required:
                - x402Version
                - paymentPayload
                - paymentRequirements
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Returns whether or not the payment should succeed
          content:
            application/json:
              schema:
                type: object
                properties:
                  isValid:
                    type: boolean
                    description: Whether or not the payment is valid
                  invalidReason: 
                    type: string
                    description: The reason, if any, that the payment is invalid. Will be empty if isValid is true.
                  payer:
                    type: string
                    format: evm-address
                    nullable: true
                    description: Payer address when determinable (v2-style); may be null when validation fails early.
        400:
          $ref: "#/components/responses/BadRequestError"
        403:
          $ref: "#/components/responses/PermissionError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /x402/settle:
    post:
      tags:
        - x402
      description: |
        Settles an x402 payment on-chain. Request body matches `POST /x402/verify` (**v1** vs **v2** `paymentPayload` / `paymentRequirements`).

        **Response shape depends on `x402Version` in the request:**
        - **`x402Version: 1`** — [x402 v1](https://github.com/coinbase/x402/blob/main/specs/x402-specification-v1.md) settle shape: `error`, `txHash`, `networkId` (legacy network enum).
        - **`x402Version: 2`** — [x402 v2](https://github.com/coinbase/x402/blob/main/specs/x402-specification-v2.md) settle shape: `errorReason`, `transaction`, `network` (CAIP-2), `payer`.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                x402Version:
                  type: integer
                  description: Protocol version — use `1` or `2`.
                  example: 1
                paymentPayload:
                  type: object
                  description: x402 v1 or v2 PaymentPayload (see `POST /x402/verify`).
                paymentRequirements:
                  type: object
                  description: v1 or v2 payment requirements (same as `POST /x402/verify`).
                  properties:
                    scheme:
                      type: string
                      example: exact
                    network:
                      oneOf:
                        - $ref: "#/components/schemas/EX402Network"
                        - $ref: "#/components/schemas/CAIP2Network"
                    maxAmountRequired:
                      type: string
                      format: big-number-string
                      example: 5000000
                    amount:
                      type: string
                      format: big-number-string
                    resource:
                      type: string
                      example: https://n8n.1shotapi.dev/webhook/gas-station
                    description:
                      type: string
                      example: Swap stablecoins for gas tokens
                    mimeType:
                      type: string
                      example: ""
                    outputSchema:
                      type: object
                    payTo:
                      type: string
                      format: evm-address
                      example: 0x9fEad8B19C044C2f404dac38B925Ea16ADaa2954
                    maxTimeoutSeconds:
                      type: integer
                      example: 150
                    asset:
                      type: string
                      format: evm-address
                      example: 0xcac524bca292aaade2df8a05cc58f0a65b1b3bb9
                    extra:
                      type: object
                      properties:
                        name:
                          type: string
                          example: Paypal USD
                        version:
                          type: string
                          example: 1
              required:
                - x402Version
                - paymentPayload
                - paymentRequirements
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: |
            Settlement result. **`x402Version` in the body** matches the request and selects the schema (`1` = v1 fields, `2` = v2 fields).
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: "#/components/schemas/X402SettleResponseV1"
                  - $ref: "#/components/schemas/X402SettleResponseV2"
                discriminator:
                  propertyName: x402Version
                  mapping:
                    "1": "#/components/schemas/X402SettleResponseV1"
                    "2": "#/components/schemas/X402SettleResponseV2"
        400:
          $ref: "#/components/responses/BadRequestError"
        403:
          $ref: "#/components/responses/PermissionError"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /webhooks:
    get:
      tags:
        - Webhooks
        - List
      description: Returns information about the webhooks system- event names that can trigger webhooks.
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Returns an array of all event names that may trigger webhooks
          content:
            application/json:
              schema:
                type: object
                properties:
                  events:
                    type: array
                    items:
                      $ref: "#/components/schemas/EEventName"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /business/{businessId}/webhooks/triggers:
    get:
      tags:
        - Webhooks
        - Webhook Triggers
        - List
      description: Lists all webhook triggers for a business
      parameters:
        - name: businessId
          in: path
          required: true
          schema:
            $ref: "#/components/schemas/BusinessId"
        - name: page
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/Page"
        - name: pageSize
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/PageSize"
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Returns a page of webhook triggers for the requested business
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/PagedResponse"
                  - type: object
                    properties:
                      response:
                        type: array
                        items:
                          $ref: "#/components/schemas/WebhookTrigger"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"
    post:
      tags:
        - Webhooks
        - Webhook Triggers
        - Create
      description: Create a new webhook trigger
      parameters:
        - name: businessId
          in: path
          required: true
          schema:
            $ref: "#/components/schemas/BusinessId"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - endpointId
                - eventNames
                - transactionIds
                - name
              properties:
                endpointId:
                  type: string
                  format: uuid
                  description: The webhook endpoint ID to trigger
                eventNames:
                  type: array
                  items:
                    $ref: "#/components/schemas/EEventName"
                  description: Event names that will trigger the webhook
                contractMethodIds:
                  type: array
                  items:
                    type: string
                    format: uuid
                  description: Which contract methods will trigger the webhook.
                name:
                  type: string
                  description: Name for the trigger
                description:
                  type: string
                  description: Description of the trigger
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Returns the new WebhookTrigger
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookTrigger"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /webhooks/triggers/{webhookTriggerId}:
    put:
      tags:
        - Webhooks
        - Webhook Triggers
      description: Update an existing webhook trigger
      parameters:
        - name: webhookTriggerId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                endpointId:
                  type: string
                  format: uuid
                eventNames:
                  type: array
                  items:
                    $ref: "#/components/schemas/EEventName"
                contractMethodIds:
                  type: array
                  items:
                    type: string
                    format: uuid
                name:
                  type: string
                description:
                  type: string
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Returns the updated WebhookTrigger
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookTrigger"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"
    delete:
      tags:
        - Webhooks
        - Webhook Triggers
      description: Delete a webhook trigger
      parameters:
        - name: webhookTriggerId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /business/{businessId}/webhooks/endpoints:
    get:
      tags:
        - Webhooks
        - Webhook Endpoints
        - List
      description: Lists all webhook endpoints for a business
      parameters:
        - name: businessId
          in: path
          required: true
          schema:
            $ref: "#/components/schemas/BusinessId"
        - name: page
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/Page"
        - name: pageSize
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/PageSize"
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Returns a page of webhook endpoints for the requested business
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/PagedResponse"
                  - type: object
                    properties:
                      response:
                        type: array
                        items:
                          $ref: "#/components/schemas/WebhookEndpoint"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"
    post:
      tags:
        - Webhooks
        - Webhook Endpoints
        - Create
      description: Create a new webhook endpoint
      parameters:
        - name: businessId
          in: path
          required: true
          schema:
            $ref: "#/components/schemas/BusinessId"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - destinationUrl
                - name
              properties:
                destinationUrl:
                  type: string
                  format: uri
                  description: The URL to send the webhook to (http:// or https://)
                name:
                  type: string
                  description: Name for the endpoint
                description:
                  type: string
                  description: Description of the endpoint
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Returns the new Webhook Endpoint
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookEndpoint"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /webhooks/endpoints/{webhookEndpointId}:
    get:
      tags:
        - Webhooks
        - Webhook Endpoints
      description: Gets a specific webhook endpoint
      parameters:
        - name: webhookEndpointId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Returns webhook endpoint
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookEndpoint"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"
    put:
      tags:
        - Webhooks
        - Webhook Endpoints
      description: Update a webhook endpoint
      parameters:
        - name: webhookEndpointId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                description:
                  type: string
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Returns the updated webhook endpoint
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookEndpoint"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"
    delete:
      tags:
        - Webhooks
        - Webhook Endpoints
      description: Delete a webhook endpoint
      parameters:
        - name: webhookEndpointId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /webhooks/endpoints/{webhookEndpointId}/rotate:
    put:
      tags:
        - Webhooks
        - Webhook Endpoints
      description: Rotate the private key for a webhook endpoint
      parameters:
        - name: webhookEndpointId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Returns the webhook endpoint with new public key
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookEndpoint"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /webhooks/endpoints/{webhookEndpointId}/webhooks:
    get:
      tags:
        - Webhooks
        - Webhook Endpoints
        - List
      description: Lists all generated webhooks for a particular endpoint. Webhooks are generated by a Webhook Trigger, and delivery may be attempted multiple times.
      parameters:
        - name: webhookEndpointId
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: page
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/Page"
        - name: pageSize
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/PageSize"
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Returns a page of webhooks for the requested webhook endpoint
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/PagedResponse"
                  - type: object
                    properties:
                      response:
                        type: array
                        items:
                          $ref: "#/components/schemas/Webhook"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

  /webhooks/{webhookId}/attempts:
    get:
      tags:
        - Webhooks
        - Webhook Delivery Attempts
        - List
      description: Lists all delivery attempts for a particular webhook
      parameters:
        - name: webhookId
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: page
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/Page"
        - name: pageSize
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/PageSize"
      security:
        - OAuth2ClientCredentials:
          - read:api
      responses:
        200:
          description: Returns a page of delivery attempts for the requested webhook
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/PagedResponse"
                  - type: object
                    properties:
                      response:
                        type: array
                        items:
                          $ref: "#/components/schemas/WebhookDeliveryAttempt"
        422:
          $ref: "#/components/responses/UnprocessableEntityError"
        500:
          $ref: "#/components/responses/DatabaseError"
        503:
          $ref: "#/components/responses/DatabaseError"

components:
  securitySchemes:
    OAuth2ClientCredentials:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://api.1shotapi.com/token
          scopes:
            read:api: Read access to the API
            write:api: Write access to the API

  responses:
    BadRequestError:
      description: Bad request - invalid parameters or arguments
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
          examples:
            invalidParameters:
              summary: Invalid Parameters
              value:
                type: "INVALID_PARAMETERS_ERROR"
                message: "The provided parameters are invalid"
                data: null
                retryable: false
            invalidType:
              summary: Invalid Type
              value:
                type: "InvalidTypeError"
                message: "Invalid type provided"
                data: null
                retryable: true
            unauthorizedNonce:
              summary: Unauthorized Nonce
              value:
                type: "UnauthorizedNonceError"
                message: "The nonce provided is not authorized"
                data: null
                retryable: false
    UnauthenticatedError:
      description: Authentication required - no valid authentication token provided
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
          examples:
            missingToken:
              summary: Missing Authentication Token
              value:
                type: "UnauthenticatedError"
                message: "No authentication token provided or invalid"
                data: null
                retryable: false
    ForbiddenError:
      description: Forbidden - authentication token does not have permission to access this endpoint
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
          examples:
            insufficientPermissions:
              summary: Insufficient Permissions
              value:
                type: "UnauthorizedError"
                message: "Insufficient permissions for operation"
                data: null
                retryable: false
            unknownEntity:
              summary: Unknown Entity
              value:
                type: "UnknownEntityError"
                message: "Unknown Object"
                data: null
                retryable: false
            stripeError:
              summary: Stripe Request Error
              value:
                type: "StripeRequestError"
                message: "Stripe request failed"
                data: null
                retryable: false
    NotFoundError:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
          examples:
            chainTransaction:
              summary: Chain Transaction Not Found
              value:
                type: "ChainTransactionError"
                message: "Transaction not found on chain"
                data: null
                retryable: false
            unknownFunction:
              summary: Unknown Function
              value:
                type: "ERR_UNKNOWN_FUNCTION"
                message: "Function not found"
                data: null
                retryable: false
            deserialization:
              summary: Deserialization Error
              value:
                type: "DeserializationError"
                message: "Failed to deserialize data"
                data: null
                retryable: false
    UnprocessableEntityError:
      description: Unprocessable entity - invalid API parameters
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
          examples:
            invalidApiParameters:
              summary: Invalid API Parameters
              value:
                type: "InvalidApiParametersError"
                message: "Parameter walletId should be of type string, but was given '123'"
                data:
                  parameterType: "string"
                  parameterName: "walletId"
                  parameterValue: 123
                retryable: true
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
          examples:
            blockchainUnavailable:
              summary: Blockchain Unavailable
              value:
                type: "BLOCKCHAIN_UNAVAILABLE"
                message: "Blockchain service is currently unavailable"
                data: null
                retryable: false
            transactionError:
              summary: Transaction Error
              value:
                type: "TransactionError"
                message: "Transaction failed"
                data: null
                retryable: true
            databaseError:
              summary: Database Error
              value:
                type: "ERR_DATABASE"
                message: "Database operation failed"
                data: null
                retryable: true
            ethereumReadError:
              summary: Ethereum Read Error
              value:
                type: "EthereumReadError"
                message: "Failed to read from Ethereum"
                data: null
                retryable: true
            ethereumWriteError:
              summary: Ethereum Write Error
              value:
                type: "EthereumWriteError"
                message: "Failed to write to Ethereum"
                data: null
                retryable: true
            insufficientFunds:
              summary: Insufficient Funds
              value:
                type: "ERR_INSUFFICIENT_FUNDS"
                message: "Insufficient funds for transaction"
                data: null
                retryable: false
            invalidContract:
              summary: Invalid Contract
              value:
                type: "InvalidContractError"
                message: "Invalid contract address or ABI"
                data: null
                retryable: false
            gasPriceError:
              summary: Gas Price Error
              value:
                type: "ERR_GAS_PRICE"
                message: "Failed to get gas price"
                data: null
                retryable: false
            gasFeeDataError:
              summary: Gas Fee Data Error
              value:
                type: "GasFeeDataError"
                message: "Failed to get gas fee data"
                data: null
                retryable: true
            retryError:
              summary: Retry Error
              value:
                type: "RetryError"
                message: "Operation failed after retries"
                data: null
                retryable: true
            thirdPartyError:
              summary: Third Party Error
              value:
                type: "ThirdPartyError"
                message: "Third party service error"
                data: null
                retryable: true
            redisError:
              summary: Redis Error
              value:
                type: "RedisError"
                message: "Redis operation failed"
                data: null
                retryable: true
            queueError:
              summary: Queue Error
              value:
                type: "QueueError"
                message: "Queue operation failed"
                data: null
                retryable: false
            webhookDeliveryError:
              summary: Webhook Delivery Error
              value:
                type: "ERR_WEBHOOK_DELIVERY"
                message: "Failed to deliver webhook"
                data: null
                retryable: false
    BadGatewayError:
      description: Bad gateway - external API error
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
          examples:
            externalApiError:
              summary: External API Error
              value:
                type: "ExternalApiError"
                message: "External API request failed"
                data: null
                retryable: true
    ServiceUnavailableError:
      description: Service unavailable - database or service temporarily unavailable
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
          examples:
            databaseUnavailable:
              summary: Database Unavailable
              value:
                type: "ERR_DATABASE"
                message: "Database service is temporarily unavailable"
                data:
                  sourceCode: "ECONNREFUSED"
                retryable: true
    InvalidError:
      description: Data is invalid
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
    PermissionError:
      description: The authentication token does not have permission to access this endpoint
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
          examples:
            unauthorized:
              summary: Unauthorized Access
              value:
                type: "UnauthorizedError"
                message: "Insufficient permissions for operation"
                data: null
                retryable: false
    DatabaseError:
      description: Database has encountered an error
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
          examples:
            databaseError:
              summary: Database Error
              value:
                type: "ERR_DATABASE"
                message: "Database operation failed"
                data:
                  sourceCode: "ECONNREFUSED"
                retryable: true

  schemas:
    ErrorResponse:
      description: Standard error response format for all API errors
      type: object
      properties:
        type:
          type: string
          description: The error type code from ErrorCodes. This is a specific identifier for the error type.
          example: "ERR_DATABASE"
        message:
          type: string
          description: Human-readable error message describing what went wrong.
          example: "Database operation failed"
        data:
          description: Additional error data. This can be null, an object with error-specific fields, or any other data structure that provides context about the error.
          nullable: true
          example:
            parameterType: "string"
            parameterName: "walletId"
            parameterValue: 123
        retryable:
          type: boolean
          description: Indicates whether the error is retryable. If true, the client may retry the request. If false, retrying will not help.
          example: true
      required:
        - type
        - message
        - retryable

    PageSize:
      description: The size of the page to return. Defaults to 25
      type: integer
      example: 25

    Page:
      description: Which page to return. This is 1 indexed, and default to the first page, 1
      type: integer
      example: 1

    TotalResults:
      description: The total number of results returned by a paged response
      type: integer
      example: 1

    PagedResponse:
      type: object
      properties:
        page:
          $ref: "#/components/schemas/Page"
        pageSize:
          $ref: "#/components/schemas/PageSize"
        totalResults:
          $ref: "#/components/schemas/TotalResults"
      required:
        - page
        - pageSize
        - totalResults

    EntityBookKeepingWithoutDeleted:
      type: object
      properties:
        updated:
          type: number
          format: unix-timestamp
          example: 1659485172
        created:
          type: number
          format: unix-timestamp
          example: 1659485172
      required:
        - updated
        - created

    EntityBookKeeping:
      allOf:
        - type: object
          properties:
            deleted:
              type: boolean
              example: false
          required:
            - deleted
        - $ref: "#/components/schemas/EntityBookKeepingWithoutDeleted"

    EEventName:
      type: string
      description: Event names that can trigger webhooks
      enum:
        - TransactionExecutionFailure
        - TransactionExecutionSubmitted
        - TransactionExecutionSuccess
        - EscrowWalletLowBalanceDetected
        - EscrowWalletDepositConfirmed
        - BusinessUserCreated
        - BusinessUserDeleted
        - InvoiceCreated

    EWebhookStatus:
      type: string
      description: The current status of the webhook
      enum:
        - Unsent
        - Success
        - Retrying
        - Failed

    WebhookEndpoint:
      allOf:
        - type: object
          properties:
            id:
              type: string
              format: uuid
              description: The WebhookEndpointId
            destinationUrl:
              type: string
              format: uri
              description: The URL for the endpoint
            businessId:
              type: string
              format: uuid
              nullable: true
            userId:
              type: string
              format: uuid
              nullable: true
            name:
              type: string
            description:
              type: string
            publicKey:
              type: string
              description: Base64-encoded ED25519 public key for verifying webhook signatures
            verified:
              type: boolean
            lastPing:
              type: number
              format: unix-timestamp
              nullable: true
            lastPingStatus:
              type: boolean
          required:
            - id
            - destinationUrl
            - name
            - description
            - publicKey
            - verified
            - lastPingStatus
        - $ref: "#/components/schemas/EntityBookKeeping"

    WebhookTrigger:
      allOf:
        - type: object
          properties:
            id:
              type: string
              format: uuid
            endpointId:
              type: string
              format: uuid
              nullable: true
            businessId:
              type: string
              format: uuid
              nullable: true
            userId:
              type: string
              format: uuid
              nullable: true
            name:
              type: string
            description:
              type: string
            events:
              type: array
              items:
                $ref: "#/components/schemas/EEventName"
            contractMethodIds:
              type: array
              items:
                type: string
                format: uuid
            service:
              type: string
              nullable: true
          required:
            - id
            - name
            - description
            - events
        - $ref: "#/components/schemas/EntityBookKeeping"

    Webhook:
      allOf:
        - type: object
          properties:
            id:
              type: string
              format: uuid
            endpointId:
              type: string
              format: uuid
            eventName:
              type: string
            content:
              type: string
              format: json
            status:
              $ref: "#/components/schemas/EWebhookStatus"
          required:
            - id
            - endpointId
            - eventName
            - content
            - status
        - $ref: "#/components/schemas/EntityBookKeeping"

    WebhookDeliveryAttempt:
      type: object
      properties:
        id:
          type: string
          format: uuid
        webhookId:
          type: string
          format: uuid
        apiVersion:
          type: integer
        httpResponse:
          type: integer
        clientResponse:
          type: string
        signature:
          type: string
          format: byte
        timestamp:
          type: number
          format: unix-timestamp
      required:
        - id
        - webhookId
        - apiVersion
        - httpResponse
        - clientResponse
        - signature
        - timestamp
    
    EX402Network:
      type: string
      description: The x402 network name
      enum:
        - mainnet
        - sepolia

    CAIP2Network:
      type: string
      description: CAIP-2 chain identifier (e.g. EIP-155 `eip155:8453` for Base)
      example: eip155:84532

    X402SettleResponseV1:
      type: object
      description: |
        Returned when the request body `x402Version` is `1`. Aligns with [x402 v1 SettlementResponse](https://github.com/coinbase/x402/blob/main/specs/x402-specification-v1.md).
      properties:
        x402Version:
          type: integer
          enum: [1]
          description: Always `1`; discriminates this response from v2.
        success:
          type: boolean
        error:
          type: string
          nullable: true
          description: Error message when settlement failed
        txHash:
          type: string
          nullable: true
          description: Transaction hash when broadcast; null when not available
        networkId:
          $ref: "#/components/schemas/EX402Network"
          nullable: true
          description: Legacy x402 network name for the chain
      required:
        - x402Version
        - success

    X402SettleResponseV2:
      type: object
      description: |
        Returned when the request body `x402Version` is `2`. Aligns with [x402 v2 SettleResponse](https://github.com/coinbase/x402/blob/main/specs/x402-specification-v2.md).
      properties:
        x402Version:
          type: integer
          enum: [2]
          description: Always `2`; discriminates this response from v1.
        success:
          type: boolean
        errorReason:
          type: string
          nullable: true
          description: Error reason when `success` is false
        transaction:
          type: string
          nullable: true
          description: Transaction hash (empty string when settlement failed in some clients; here may be null)
        network:
          $ref: "#/components/schemas/CAIP2Network"
          nullable: true
          description: Chain as CAIP-2 `eip155:&lt;chainId&gt;`
        payer:
          type: string
          format: evm-address
          nullable: true
          description: Payer address from the payment authorization
      required:
        - x402Version
        - success

    ETransactionStatus:
      type: string
      enum:
        - Pending
        - Submitted
        - Completed
        - Retrying
        - Failed
    
    ESolidityAbiParameterType:
      type: string
      enum:
        - address
        - bool
        - bytes
        - int
        - string
        - uint
        - struct

    ESolidityStateMutability:
      type: string
      enum:
        - nonpayable
        - payable
        - view
        - pure
        
    EDeletedStatusSelector:
      type: string
      enum:
        - live
        - archived
        - both
        
    EChain:
      type: integer
      description: The ChainId of a supported chain on 1Shot API
      enum:
        - 1
        - 11155111
        - 42
        - 137
        - 43114
        - 43113
        - 80002
        - 56
        - 42161
        - 10
        - 592
        - 81
        - 97
        - 324
        - 8453
        - 84532
        - 88888
        - 11297108109
        - 42220
        - 130
        - 480
        - 81457
        - 1952
        - 196
        - 59144

    EChainTechnology:
      type: integer
      description: The technology of the chain. 1Shot currently only supports EVM (0) chains
      enum:
        - 0

    EChainType:
      type: string
      enum:
        - Mainnet
        - Testnet
        - Hardhat

    ContractAddress:
      type: string
      description: string address of contract
      format: evm-address
      example: "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9"
      
    AccountAddress:
      type: string
      description: An EVM address that designates an Externally Owned Account (EOA). Wallets are an example of an EOA.
      format: evm-address
      example: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
      
    Wallet:
      description: A Wallet is a custodial "hot" wallet controlled by 1Shot. It is a normal Externally Owned Account, and can be used like any normal wallet. 1Shot executes Contract Methods via a Wallet, which must at least hold some gas token for the chain. Wallets are linked to a particular chain for safety and ease of use; technically an EOA address can be used on any EVM chain but the potential for confusion is greater than the utility provided. You may define as many Wallets as you need. Each Contract Method is configured with a default Wallet but this can be overridden. The Contract Method will be submitted via that Wallet and paid for from that Wallet. Wallets owned by a Business are the only ones used by 1Shot, but wallets owned by an individual User may be supported in the future.
      allOf:
        - type: object
          properties:
            id:
              $ref: "#/components/schemas/WalletId"
            accountAddress:
              $ref: "#/components/schemas/AccountAddress"
            businessId:
              allOf:
                - $ref: "#/components/schemas/BusinessId"
                - type: string
                  nullable: true
                  description: The business ID that owns this wallet. Admin wallets will not have this value. A Wallet will have either a user ID or a business ID.
            userId:
              type: string
              format: uuid
              nullable: true
              description: The User ID of the person that owns this Wallet. Admin wallets will not have this value. A wallet will have either a user ID or a business ID.
            chainId:
              $ref: "#/components/schemas/EChain"
            name:
              type: string
              description: The name of the wallet.
            description:
              type: string
              description: A description of the wallet, can be used to describe its purpose.
            erc7702ContractAddress:
              type: string
              format: contract-address
              nullable: true
              description: The address of the ERC-7702 contract that the Wallet has been upgraded to.
            isAdmin:
              type: boolean
              description: Whether or not the wallet is an admin wallet, used for internal purposes.
            permit2AuthorizedContractAddresses:
              type: array
              items:
                $ref: "#/components/schemas/ContractAddress"
              description: The contract addresses of the tokens that the wallet is authorized to use Permit2 for.
            accountBalanceDetails:
              allOf:
                - $ref: "#/components/schemas/AccountBalanceDetails"
                - type: object
                  nullable: true
          required:
            - id
            - accountAddress
            - businessId
            - userId
            - chainId
            - name
            - description
            - isAdmin
            - permit2AuthorizedContractAddresses
        - $ref: "#/components/schemas/EntityBookKeepingWithoutDeleted"
        
    AccountBalanceDetails:
      type: object
      properties:
        type:
          $ref: "#/components/schemas/EChainTechnology"
        ticker:
          type: string
          example: ETH
        chainId:
          $ref: "#/components/schemas/EChain"
        tokenAddress:
          $ref: "#/components/schemas/ContractAddress"
        accountAddress:
          $ref: "#/components/schemas/AccountAddress"
        balance:
          type: string
          format: big-number-string
          description: The balance of the token as a Big Number String
          example: "123400000000000000000"
        decimals:
          type: integer
          description: The number of decimals in the balance. Determined by the token type.
      required:
        - type
        - ticker
        - chainId
        - tokenAddress
        - accountAddress
        - balance
        - decimals
      
    ContractMethod:
      description: A single defined method on a smart contract on a chain. You can have multiple Contract Methods defined for the same method in the smart contract if you want to use different setups for static parameters, or if you create them from different Prompts. Contract Methods are sometimes referred to as Endpoints.
      allOf:
        - type: object
          properties:
            id:
              $ref: "#/components/schemas/ContractMethodId"
            businessId:
              $ref: "#/components/schemas/BusinessId"
            chainId:
              $ref: "#/components/schemas/EChain"
            contractAddress:
              $ref: "#/components/schemas/ContractAddress"
            walletId:
              allOf:
                - $ref: "#/components/schemas/WalletId"
                - type: string
                  description: The default Wallet that will execute this Contract Method
            name:
              type: string
              description: Name of the Contract Method. This is not necessarily the name of the underlying method (generally something simple like "mint"); this is used only in 1Shot to help you distinguish your Contract Methods. Given the Contract Method a good name will help when you have created multiple Contract Methods from different Prompts, in particular. The same "mint" function may be named "Mint 10000 tokens at a time" and "After creating the token contract", based on the intended use case.
              example: Got good
            description:
              type: string
              description: Description of the Contract Method. This should be written for AI agents to take advantage of. This will come from the original Prompt if you create the Contract Method from a Prompt.
              example: Contract Method for getting good
            functionName:
              type: string
              description: Name of the function on the contract to call for this Contract Method. 
              example: mint
            inputs:
              type: array
              items: 
                $ref: "#/components/schemas/SolidityStructParam"
            outputs:
              type: array
              items: 
                $ref: "#/components/schemas/SolidityStructParam"
            stateMutability: 
              $ref: "#/components/schemas/ESolidityStateMutability"
            promptId:
              type: string
              format: uuid
              nullable: true
              description: The ID of the Prompt that this Contract Method was created from. This is optional, and a Contract Method can drift from the original Prompt but retain this association.
              example: 100d2e83-dddd-480d-88ad-74a71c214912
            callbackUrl:
              type: string
              nullable: true
              description: The current destination for webhooks to be sent when this Contract Method is executed. Will be null if no webhook is assigned.
              example: "https://example.com/webhook"
            publicKey:
              type: string
              format: base64
              nullable: true
              description: The current public key for verifying the integrity of the webhook when this Contract Method is executed. 1Shot will sign its webhooks with a private key and provide a signature for the webhook that can be validated with this key. It will be null if there is no webhook destination specified.
          required:
            - id
            - businessId
            - chainId
            - contractAddress
            - walletId
            - name
            - description
            - functionName
            - inputs
            - outputs
            - stateMutability
            - promptId
            - callbackUrl
            - publicKey
        - $ref: "#/components/schemas/EntityBookKeeping"
       
    NewSolidityStruct:
      description: The values required to create a completely new Solidity Struct.
      type: object
      properties: 
        name: 
          type: string
          description: The name of the struct. Structs are used to define the parameters of a Contract Method, but these structs don't have names.
        params:
          type: array
          items:
            $ref: "#/components/schemas/NewSolidityStructParam"
      required:
        - businessId
        - params
            
    SolidityStruct:
      description: A struct object as defined in solidity ABI
      allOf:
        - type: object
          properties: 
            id:
              type: string
              format: uuid
              description: Internal ID of the struct.
              example: 100d2e83-dddd-480d-88ad-74a71c214912
            businessId:
              $ref: "#/components/schemas/BusinessId"
          required:
            - id
            - businessId
        - $ref: "#/components/schemas/EntityBookKeepingWithoutDeleted"
        - allOf:
          - $ref: "#/components/schemas/NewSolidityStruct"
          - type: object
            properties:
              params:
                type: array
                items:
                  $ref: "#/components/schemas/SolidityStructParam"
        
        
    SolidityStructParamUpdate:
      type: object
      description: These are the properties that may be updated on a Solidity Struct Param.
      properties:
        name:
          type: string
          example: amount
        description:
          type: string
          example: Description of the parameter
        type:
          $ref: "#/components/schemas/ESolidityAbiParameterType"
        index:
          type: integer
          example: 0
          description: This is the relative index in the contract function. It should start at 0, and must not skip any numbers.
        staticValue:
          type: string
          description: This is an optional, static value for the parameter. If you set this, you will never be required or able to pass a value for this parameter when you execute the Contract Method, it will use the set staticValue. This is useful for creating dedicated endpoints with specific functionalities, particularly when tied to API Credentials that can only execute specific Contract Methods. For example, you can have a 'transfer' Contract Method that is hardcoded to a specific amount, or to a specific receiver address.
        typeSize:
          type: number
          description: "This is an optional field that specifies the main size of the Solidity type. For example, if your type is uint, by default it is a uint256. If you want a uint8 instead, set this value to 8. It works for int, uint, fixed, ufixed, and bytes types. Valid values for bytes are 1 to 32, for others it is 256 % 8"
        typeSize2:
          type: integer
          description: This is identical to typeSize but only used for fixed and ufixed sizes. This is the second size of the fixed field, for example, fixed(typeSize)x(typeSize2).
        isArray:
          type: boolean
          description: If this parameter is an array type set this to true. By default, arrays can be of any size so you don't need to set arraySize.
        arraySize:
          type: integer
          description: If the parameter is a fixed size array, set this value.
        typeStructId:
          type: string
          description: The ID of the sub-struct if the type is "struct". When creating a param, you must set only one of either typeStructId (to re-use an existing Solidity Struct) or typeStruct (creates a new struct for the param)
        typeStruct:
          allOf:
            - $ref: "#/components/schemas/NewSolidityStruct"
            - type: object
              description: The sub-struct if the type is "struct", which will be created for use by this parameter. When creating a param, you must set only one of either typeStructId (to re-use an existing Solidity Struct) or typeStruct (creates a new struct for the param)

    NewSolidityStructParam:
      allOf:
        - $ref: "#/components/schemas/SolidityStructParamUpdate"
        - type: object
          description: These are the required values when creating a new Solidity Struct Parameter.
          required:
            - name
            - type
            - index

    SolidityStructParam:
      description: A single defined parameter for a Solidity Struct after it has been created. Contract Methods create an anonymous Solidiy Struct for the inputs and outputs, so a SolidityStructParam can be thought of as a parameter for a Contract Method. It corresponds to an item in an ABI.
      allOf:
        - type: object
          properties:
            id:
              type: string
              format: uuid
              description: Internal ID of the parameter.
              example: 100d2e83-dddd-480d-88ad-74a71c214912
            structId:
              type: string
              format: uuid
              description: Internal ID struct that owns this parameter.
              example: 100d2e83-dddd-480d-88ad-74a71c214912
          required:
            - id
            - structId
        - allOf:
          - $ref: "#/components/schemas/NewSolidityStructParam"
          - type: object
            properties:
              typeStruct:
                allOf:
                  - $ref: "#/components/schemas/SolidityStruct"
                  - type: object
                    description: The sub-struct if the type is "struct", which will be created for use by this parameter. When creating a param, you must set only one of either typeStructId (to re-use an existing Solidity Struct) or typeStruct (creates a new struct for the param)
              
    
    Transaction:
      description: A single execution of a Contract Method. This is a record of your execution history. Transactions are updated as they move forward on the blockchain.
      allOf:
        - type: object
          properties:
            id:
              $ref: "#/components/schemas/TransactionId"
            contractMethodIds:
              type: array
              items:
                $ref: "#/components/schemas/ContractMethodId"
            apiCredentialId:
              type: string
              format: uuid
              description: ID of the API Credential used to execute the Contract Method and create this Transaction. Note, this is not the API Key itself. This will be null if a user initiated the execution and not an API Credential
              example: f4e3d951-85ad-42fa-8e21-75545145c7cb
              nullable: true
            apiKey:
              type: string
              description: The actual API key used
              nullable: true
            userId:
              type: string
              format: uuid
              description: The User ID that executed the Contract Method and created this Transaction. This will be null if an API key was used instead of a user token.
              nullable: true
              example: f4e3d951-85ad-42fa-8e21-75545145c7cb
            status:
              $ref: "#/components/schemas/ETransactionStatus"
            transactionHash:
              type: string
              nullable: true
              description: The hash of the Transaction. Only calculated once the status is Submitted. This is an immutable value and can be looked up on the appropriate block scanner.
            contractAddress:
              $ref: "#/components/schemas/ContractAddress"
            name:
              type: string
              description: the name of the associated Contract Method. Included as a convienience.
            functionName:
              type: string
              description: The functionName of the associated Contract Method. Included as a convienience.
            chainId:
              $ref: "#/components/schemas/EChain"
            memo:
              type: string
              nullable: true
              description: Optional text supplied when the transaction is executed. This can be a note to the user about why the execution was done, or formatted information such as JSON that can be used by the user's system.
            completed:
              type: number
              description: This is the timestamp for when 1Shot determined the Transaction to have settled. It will be null until the Transaction is in it's final state, hopefully "Completed". 
              nullable: true
              format: unix-timestamp
              example: 1659485172
            walletId:
              $ref: "#/components/schemas/WalletId"
            failureReason:
              type: string
              nullable: true
              description: The reason the transaction failed. This is only set if the transaction failed.
              example: "Transaction reverted"
            from:
              type: string
              format: evm-address
              description: The address of the account that sent the transaction.
              example: "0x1234567890123456789012345678901234567890"
            to:
              type: string
              format: evm-address
              description: The address of the account that received the transaction.
              example: "0x1234567890123456789012345678901234567890"
            gasPrice:
              type: string
              format: big-number-string
              description: The gas price of the transaction.
              example: "123400000000000000000"
            gasLimit:
              type: string
              format: big-number-string
              description: The gas limit of the transaction.
              example: "123400000000000000000"
            maxFeePerGas:
              type: string
              format: big-number-string
              description: The max fee per gas of the transaction.
              example: "123400000000000000000"
            maxPriorityFeePerGas:
              type: string
              format: big-number-string
              description: The max priority fee per gas of the transaction.
              example: "123400000000000000000"
            gasUsed:
              type: string
              format: big-number-string
              description: The gas used by the transaction.
              example: "123400000000000000000"
            logs:
              type: array
              description: The logs, if any, emitted by the transaction.
              items:
                $ref: "#/components/schemas/LogDescription"
          required:
            - id
            - contractMethodId
            - apiCredentialId
            - apiKey
            - userId
            - status
            - transactionHash
            - contractAddress
            - name
            - functionName
            - chainId
            - memo
            - completed
            - walletId
            - from
            - to
            - gasPrice
            - gasLimit
            - maxFeePerGas
            - maxPriorityFeePerGas
        - $ref: "#/components/schemas/EntityBookKeeping"
        
    JSONValue:
      description: A JSON-compatible value. This could be a single primitive value such as a string, or it could be an Array or another Object.
      oneOf:
        - type: string
        - type: number
        - type: boolean
        - type: array
          items:
            $ref: '#/components/schemas/JSONValue'
        - type: object
          additionalProperties:
            $ref: '#/components/schemas/JSONValue'

    ContractMethodEstimate:
      description: A summary of values required to estimate the cost of executing a Contract Method
      properties:
        chainId:
          $ref: "#/components/schemas/EChain"
        contractAddress:
          $ref: "#/components/schemas/ContractAddress"
        functionName:
          type: string
        gasAmount:
          type: string
          format: big-number-string
          description: The amount of gas units it will use. This is a stringified bigint.
          example: "123400000000000000000"
        maxFeePerGas:
          type: string
          format: big-number-string
          example: "123400000000000000000"
          nullable: true
        maxPriorityFeePerGas:
          type: string
          format: big-number-string
          example: "123400000000000000000"
          nullable: true
        gasPrice:
          type: string
          format: big-number-string
          example: "123400000000000000000"
          nullable: true
      required:
        - chainId
        - contractAddress
        - functionName
        - gasAmount
        - maxFeePerGas
        - maxPriorityFeePerGas
        - gasPrice

    AbiParameter:
      type: object
      properties:
        name:
          type: string
        type:
          type: string
          example: uint256
        internalType:
          type: string
        components:
          type: array
          items:
            $ref: '#/components/schemas/AbiParameter'
        indexed:
          type: boolean
      required:
        - type

    AbiFunction:
      type: object
      properties:
        type:
          type: string
          enum: [function]
        name:
          type: string
        stateMutability:
          type: string
          enum: [pure, view, nonpayable, payable]
        inputs:
          type: array
          items:
            $ref: '#/components/schemas/AbiParameter'
        outputs:
          type: array
          items:
            $ref: '#/components/schemas/AbiParameter'
      required:
        - type
        - name
        - inputs
        - outputs
        - stateMutability

    AbiEvent:
      type: object
      properties:
        type:
          type: string
          enum: [event]
        name:
          type: string
        inputs:
          type: array
          items:
            $ref: '#/components/schemas/AbiParameter'
        anonymous:
          type: boolean
      required:
        - type
        - name
        - inputs

    AbiConstructor:
      type: object
      properties:
        type:
          type: string
          enum: [constructor]
        inputs:
          type: array
          items:
            $ref: '#/components/schemas/AbiParameter'
        stateMutability:
          type: string
          enum: [nonpayable, payable]
      required:
        - type
        - inputs
        - stateMutability

    AbiFallback:
      type: object
      properties:
        type:
          type: string
          enum: [fallback]
        stateMutability:
          type: string
          enum: [nonpayable, payable]
      required:
        - type
        - stateMutability

    EthereumAbi:
      type: array
      items:
        oneOf:
          - $ref: '#/components/schemas/AbiFunction'
          - $ref: '#/components/schemas/AbiConstructor'
          - $ref: '#/components/schemas/AbiEvent'
          - $ref: '#/components/schemas/AbiFallback'
          
    ContractMethodId:
      type: string
      format: uuid
      description: Internal ID of the Contract Method object. Contract Methods are sometimes referred to as Endpoints. A Contract Method is a single method on a smart contract.
      example: 4b4bab2d-673d-4b91-8e09-f1402962cd3e
    
    DelegationId:
      type: string
      format: uuid
      description: Internal ID of a Delegation object.
      example: 4b4bab2d-673d-4b91-8e09-f1402962cd3e
    
    TransactionId:
      type: string
      format: uuid
      description: Internal ID of the Transaction object. Each time a Contract Method is executed, a Transaction is created to track the status of it.
      example: 4b4bab2d-673d-4b91-8e09-f1402962cd3e
          
    WalletId:
      type: string
      format: uuid
      description: The internal ID of a Wallet object. A wallet is a custodial hot wallet in 1Shot. This is not the address associated with the Wallet but the internal ID.
      example: 8a6e0804-2bd0-4672-b79d-d97027f90720

    BusinessId:
      type: string
      format: uuid
      description: The internal ID of the Business. Every object in the API is ultimately scoped to a single Business. You can get this from the Business Details page on app.1shotapi.com.
      example: 8a6e0804-2bd0-4672-b79d-d97027f90720
    
    Prompt:
      description: A description of a contract, designed to be used for contract discovery by AI agents.
      allOf:
        - type: object
          properties:
            id:
              type: string
              format: uuid
              description: internal ID of the prompt
              example: f4e3d951-85ad-42fa-8e21-75545145c7bc
              readOnly: true
            userId:
              type: string
              format: uuid
              description: ID of the user that created 
              example: f4e3d951-85ad-42fa-8e21-75545145c7bc
              readOnly: true
            chainId:
              $ref: "#/components/schemas/EChain"
            contractAddress:
              $ref: "#/components/schemas/ContractAddress"
            name:
              type: string
              description: The name of the contract. This is human provided and has no technical significance
            description:
              type: string
              description: The human provided description of what the contract is and does. This is a top-level decription and should say what the overall purpose of the contract is, as well as explicit examples of how to use the contract, such as which methods to use and in what order to use them. A Prompt that is designed for a more specific use case can omit the overall description and just thouroghly describe the intended use case and method flow.
            tags:
              type: array
              description: An array of tag names provided to the contract
              items:
                type: string
            image:
              type: string
              nullable: true
              description: The URL of the image for the contract description.
              example: https://storage.googleapis.com/uxly-public-bucket/contract-descriptions/100d2e83-dddd-480d-88ad-74a71c214912/image.png
          required:
            - id
            - userId
            - chainId
            - contractAddress
            - name
            - description
            - tags
            - image
        - $ref: "#/components/schemas/EntityBookKeepingWithoutDeleted"
  
    FullPrompt:
      description: A description of a contract
      allOf:
        - type: object
          properties:
            functions: 
              type: array
              description: An array of Contract Function Descriptions, describing each function on the contract.
              items:
                $ref: "#/components/schemas/ContractFunctionPrompt"
          required:
            - functions
        - $ref: "#/components/schemas/Prompt"

    ContractFunctionPrompt:
      description: The description of a single function on a contract
      type: object
      properties:
        name:
          type: string
          description: The name of the function. This has to exactly match the name of the function in the Solidity contract, including the case and whitespace
        description:
          type: string
          description: A human provided description of the function, what it does, and a basic overview of its parameters.
        tags:
          type: array
          description: An array of tag names provided to the contract function
          items:
            type: string
        inputs:
          type: array
          description: An array of input parameters for the function. All inputs are required to be named.
          items:
            $ref: "#/components/schemas/ContractFunctionParamPrompt"
        outputs:
          type: array
          description: An array of output parameters for the function. Outputs are not required to be named in Solidity, but do require a name in 1Shot.
          items:
            $ref: "#/components/schemas/ContractFunctionParamPrompt"
      required:
        - name
        - description
        - tags
        - inputs
        - outputs

    ContractFunctionParamPrompt:
      description: A description of a function parameter. This may be an input or an output parameter.
      type: object
      properties:
        index:
          type: integer
          description: The index of the parameter. Starts at 0.
        name:
          type: string
          description: The name of the parameter, as defined in the Solidity contract. Input parameters are required to have names; this may be blank for output parameters.
        description:
          type: string
          description: A description of the parameter and its purpose. These descriptions are provided by either humans or AI and are intended for AI agent consumption.
        tags:
          type: array
          description: An array of tag names associated with the function parameter.
          items:
            type: string 
      required:
        - index
        - name
        - description
        - tags
    
    ContractMethodTestResult:
      description: The result of running /test on a contract method.
      type: object
      properties:
        success:
          type: boolean
          description: Whether or not the contract method would run successfully. 
        result:
          type: object
          description: The result returned by the contract method, if it was successful. When running a test, no changes are made on the blockchain, so these results are hypothetical.
          nullable: true
        error:
          type: object
          description: The error that occurred, if the contract method was not successful.
          nullable: true
      required:
        - success
        - result
        - error

    ContractMethodEncodeResult:
      description: The result of running /encode on a contract method.
      type: object
      properties:
        data:
          type: string
          format: hex-string
          description: The hex string of the encoded data.
          example: "0x1234567890abcdef"

    ERC7702Authorization:
      description: A single authorization for an ERC-7702 transaction. It represents a single potential delegation from an EOA to a contract. The EOA must sign a message with the contract address, the chain ID, and a nonce. Authorizations are sticky, once a Contract Method has been executed with an authorization, future Contract Methods may be executed for the EOA using the authorized contract without a new authorization being submitted.
      type: object
      properties:
        address:
          $ref: "#/components/schemas/ContractAddress"
        nonce:
          type: string
          format: big-number-string
          description: The delegation nonce. This starts at 0 and must be positive. The EOA must keep track of this nonce itself.
          example: "123400000000000000000"
        chainId:
          $ref: "#/components/schemas/EChain"
        signature:
          type: string
          format: hex-string
          description: The signature of the authorization, from the EOA that is delegating the authorization to the contract at address.
          example: "0x1234567890abcdef"
      required:
        - address
        - nonce
        - chainId
        - signature

    Delegation:
      description: A delegation allows a wallet to execute transactions on behalf of specified contract addresses and methods.
      allOf:
        - type: object
          properties:
            id:
              type: string
              format: uuid
              description: Internal ID of the delegation
              example: 8a6e0804-2bd0-4672-b79d-d97027f90720
            businessId:
              $ref: "#/components/schemas/BusinessId"
            walletId:
              $ref: "#/components/schemas/WalletId"
            delegatorAddress:
              type: string
              format: evm-address
              description: The address of the delegator account.
              example: "0x3e6a2f0CBA03d293B54c9fCF354948903007a798"
            startTime:
              type: number
              format: unix-timestamp
              description: The start time for the delegation. If null, the delegation starts immediately.
              example: 1659485172
              nullable: true
            endTime:
              type: number
              format: unix-timestamp
              description: The end time for the delegation. If null, the delegation has no expiration.
              example: 1659485172
              nullable: true
            contractAddresses:
              type: array
              items:
                $ref: "#/components/schemas/ContractAddress"
              description: Array of contract addresses that the wallet can execute transactions for.
              example: ["0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9"]
            methods:
              type: array
              items:
                type: string
              description: Array of method names that the wallet can execute. If empty, all methods are allowed.
              example: ["mint", "transfer"]
            delegationData:
              type: array
              minItems: 1
              items:
                type: string
                format: json-string
              description: Ordered chain of signed delegations; each element is one delegation as a JSON string.
          required:
            - id
            - businessId
            - walletId
            - startTime
            - endTime
            - contractAddresses
            - methods
            - delegationData
        - $ref: "#/components/schemas/EntityBookKeepingWithoutDeleted"

    SignedDelegation:
      description: Signed delegation object (MetaMask smart account kit / IDelegation format). Returned by the redelegate endpoint.
      type: object
      required:
        - delegate
        - delegator
        - authority
        - caveats
        - salt
        - signature
      properties:
        delegate:
          $ref: "#/components/schemas/AccountAddress"
          description: The delegate (recipient) address
        delegator:
          $ref: "#/components/schemas/AccountAddress"
          description: The delegator (grantor) address
        authority:
          type: string
          format: hex-string
          description: The authority hash
        caveats:
          type: array
          items:
            type: object
            required:
              - enforcer
              - terms
              - args
            properties:
              enforcer:
                $ref: "#/components/schemas/ContractAddress"
              terms:
                type: string
                format: hex-string
              args:
                type: string
                format: hex-string
        salt:
          oneOf:
            - type: string
              format: hex-string
            - type: integer
              format: int64
        signature:
          type: string
          format: hex-string
          description: The delegation signature

    DelegationData:
      type: string
      format: json-string
      description: The actual Delegation object serialized as a JSON string. BigInts must be encoded as strings.
      example: {"authority":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","caveats":[],"delegate":"0x74847c451c3745fcdf4fd447a9fa5eef8a6791a9","delegator":"0x3e6a2f0CBA03d293B54c9fCF354948903007a798","salt":"0x","signature":"0x000007dc509f5f440bd07e2a51cb8dd135f170bc8886ccf24c35652d256d4f06501537e663fbb3b6e51ca640ad4791fb605ba7434d4d8a0a0a24bfd4d841e88f1c"}

    ChainInfo:
      description: Information about a chain supported by 1Shot API
      type: object
      properties:
        name:
          type: string
          description: The name of the chain
        chainId: 
          $ref: "#/components/schemas/EChain"
        averageBlockMiningTime:
          type: number
          description: The average time it takes to mine a block on the chain
        nativeCurrency:
          $ref: "#/components/schemas/NativeCurrencyInformation"
        type:
          $ref: "#/components/schemas/EChainType"

    NativeCurrencyInformation:
      description: Information about the native currency of a chain
      type: object
      properties:
        name:
          type: string
          description: The name of the currency
        symbol:
          type: string
          description: The symbol of the currency
        decimals:
          type: number
          description: The number of decimals of the currency

    GasFeePricingModel:
      type: string
      description: How the chain prices gas — legacy fixed gas price, or EIP-1559 base + priority.
      enum:
        - legacy
        - erc1559

    GasFees:
      description: Current gas fees for a blockchain with optional EIP-1559 fee history.
      type: object
      required:
        - effectiveGasPrice
        - pricingModel
      properties:
        effectiveGasPrice:
          type: string
          format: big-number-string
          description: Effective gas price in wei — for legacy chains, the gas price; for EIP-1559, next base fee plus max priority fee.
          example: "26303502542"
        pricingModel:
          $ref: "#/components/schemas/GasFeePricingModel"
        gasPrice:
          type: string
          format: big-number-string
          description: Gas price in wei for non-EIP-1559 chains (e.g., Binance). Will be null for EIP-1559 chains.
          example: "20000000000"
          nullable: true
        maxFeePerGas:
          type: string
          format: big-number-string
          description: Maximum fee per gas in wei for EIP-1559 chains. Will be null for non-EIP-1559 chains.
          example: "30000000000"
          nullable: true
        maxPriorityFeePerGas:
          type: string
          format: big-number-string
          description: Maximum priority fee per gas in wei for EIP-1559 chains. Will be null for non-EIP-1559 chains.
          example: "2000000000"
          nullable: true
        nextBaseFeePerGas:
          type: string
          format: big-number-string
          description: Projected base fee per gas for the next block.
          example: "25000000000"
          nullable: true
        history:
          $ref: "#/components/schemas/GasFeesHistory"
          nullable: true

    GasFeesHistory:
      type: object
      description: Normalized `eth_feeHistory` data for recent blocks.
      required:
        - nextBaseFeePerGas
        - blocks
      properties:
        nextBaseFeePerGas:
          type: string
          format: big-number-string
          description: Projected base fee per gas for the next block.
          example: "25000000000"
        blocks:
          type: array
          items:
            $ref: "#/components/schemas/BlockHistory"

    BlockHistory:
      type: object
      description: Fee and usage data for one historical block.
      required:
        - blockNumber
        - baseFeePerGas
        - gasUsedRatio
        - baseFeePerBlob
        - blobGasUsedRatio
        - reward20
        - reward50
        - reward100
      properties:
        blockNumber:
          type: integer
          description: Block number.
          example: 22598066
        baseFeePerGas:
          type: string
          format: big-number-string
          description: Base fee per gas in wei for this block.
          example: "21303502542"
        gasUsedRatio:
          type: number
          format: double
          description: Ratio of gas used to block gas limit.
          example: 0.4872777320913827
        baseFeePerBlob:
          type: string
          format: big-number-string
          description: Blob base fee in wei for this block (0 when unavailable).
          example: "1"
        blobGasUsedRatio:
          type: number
          format: double
          description: Ratio of blob gas used for this block (0 when unavailable).
          example: 0
        reward20:
          type: string
          format: big-number-string
          description: Effective priority fee reward at the 20th percentile.
          example: "5000000"
        reward50:
          type: string
          format: big-number-string
          description: Effective priority fee reward at the 50th percentile.
          example: "12000000"
        reward100:
          type: string
          format: big-number-string
          description: Effective priority fee reward at the 100th percentile.
          example: "350000000"

    ContractCodeInfo:
      description: Result of inspecting bytecode at an address, including EIP-7702 delegation when applicable.
      type: object
      required:
        - isContract
        - eip7702ImplementationAddress
      properties:
        isContract:
          type: boolean
          description: True if `eth_getCode` returned non-empty bytecode at this address.
        eip7702ImplementationAddress:
          $ref: "#/components/schemas/ContractAddress"
          nullable: true
          description: When bytecode is exactly the EIP-7702 delegation designator plus a 20-byte implementation address, that implementation contract; otherwise null.

    LogDescription:
      description: A description of a log event
      type: object
      properties:
        name:
          type: string
        signature:
          type: string
        topic:
          type: string
        args:
          type: array
          items:
            type: string
      required:
        - name
        - signature
        - topic
        - args

    ContractEventId:
      type: string
      format: uuid
      description: The unique identifier for a contract event definition
      example: "8a6e0804-2bd0-4672-b79d-d97027f90720"

    ContractEvent:
      type: object
      properties:
        id:
          $ref: "#/components/schemas/ContractEventId"
        businessId:
          $ref: "#/components/schemas/BusinessId"
        chainId:
          $ref: "#/components/schemas/EChain"
        contractAddress:
          $ref: "#/components/schemas/ContractAddress"
        name:
          type: string
          description: Human-readable name for the event definition
          example: "Transfer Event"
        description:
          type: string
          description: Description of what this event represents
          example: "Monitors token transfer events"
        eventName:
          type: string
          description: The exact name of the event as defined in the contract ABI
          example: "Transfer"
        topicHash:
          type: string
          description: The keccak256 hash of the event signature
          example: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
        topics:
          type: array
          description: Array of event parameter definitions
          items:
            $ref: "#/components/schemas/Topic"
        updated:
          type: integer
          format: int64
          description: Unix timestamp when the event definition was last updated
        created:
          type: integer
          format: int64
          description: Unix timestamp when the event definition was created
      required:
        - id
        - businessId
        - chainId
        - contractAddress
        - name
        - description
        - eventName
        - topicHash
        - topics
        - updated
        - created

    Topic:
      type: object
      properties:
        name:
          type: string
          description: Name of the event parameter
          example: "from"
        indexed:
          type: boolean
          description: Whether this parameter is indexed in the event
          example: true
      required:
        - name
        - indexed

    ContractEventLog:
      type: object
      properties:
        eventName:
          type: string
          description: Name of the event that was emitted
          example: "Transfer"
        blockNumber:
          type: integer
          description: Block number where the event was emitted
          example: 12345678
        blockTimestamp:
          type: number
          format: unix-timestamp
          description: The block timestamp when the event was emitted
          example: 1659485172
        transactionHash:
          type: string
          description: Hash of the transaction that emitted the event
          example: "0x1234567890abcdef..."
        logIndex:
          type: integer
          description: Index of the log within the transaction
          example: 0
        removed:
          type: boolean
          description: Whether this log was removed due to chain reorganization
          example: false
        topics:
          type: object
          description: Decoded event arguments by parameter name
          additionalProperties:
            type: string
            description: Decoded value for the event parameter
          example:
            from: "0x1234567890123456789012345678901234567890"
            to: "0x0987654321098765432109876543210987654321"
            value: "1000000000000000000"
      required:
        - eventName
        - blockNumber
        - blockTimestamp
        - transactionHash
        - logIndex
        - removed
        - topics
