{
  "openrpc": "1.0.0-rc1",
  "info": {
    "version": "0.10.4-rc.0",
    "title": "Starknet Wallet API",
    "license": {}
  },
  "servers": [],
  "methods": [
    {
      "name": "wallet_supportedWalletApi",
      "summary": "Returns a list of wallet api versions compatible with the wallet. Notice this might be different from Starknet JSON-RPC spec",
      "description": "When wallet is locked, return values. When Dapp is not approved, return values. When wallet is connected and unlocked, return values.",
      "params": [],
      "result": {
        "name": "result",
        "description": "The full semver of the latest wallet API version supported by the wallet, and any past supported versions.",
        "required": true,
        "schema": {
          "type": "array",
          "properties": {
            "items": {
              "$ref": "#/components/schemas/API_VERSION"
            }
          }
        }
      }
    },
    {
      "name": "wallet_supportedSpecs",
      "summary": "Returns a list of rpc spec versions compatible with the wallet",
      "description": "When wallet is locked, return values. When Dapp is not approved, return values. When wallet is connected and unlocked, return values.",
      "params": [],
      "result": {
        "name": "result",
        "description": "Semver of Starknet's JSON-RPC supported by the wallet",
        "required": true,
        "schema": {
          "type": "array",
          "properties": {
            "items": {
              "$ref": "#/components/schemas/SPEC_VERSION"
            }
          }
        }
      }
    },
    {
      "name": "wallet_getPermissions",
      "summary": "Get the existing permissions for the Dapp from the wallet",
      "description": "When wallet is locked, return empty array. When Dapp is not approved, return empty array. When wallet is connected and unlocked, return values.",
      "params": [
        {
          "name": "api_version",
          "required": false,
          "schema": {
            "$ref": "#/components/schemas/API_VERSION"
          }
        }
      ],
      "result": {
        "name": "result",
        "schema": {
          "title": "Wallet permissions",
          "oneOf": [
            {
              "type": "array",
              "properties": {
                "items": {
                  "$ref": "#/components/schemas/PERMISSION"
                }
              }
            },
            {
              "type": "array",
              "title": "Empty array"
            }
          ],
          "required": []
        }
      },
      "errors": [
        {
          "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED"
        },
        {
          "$ref": "#/components/errors/UNKNOWN_ERROR"
        }
      ]
    },
    {
      "name": "wallet_requestAccounts",
      "summary": "Get the account addresses of the wallet active account",
      "description": "When wallet is locked, open wallet-unlock UI. When Dapp is not approved, display Dapp-approve UI. When wallet is connected and unlocked, return values.",
      "params": [
        {
          "name": "silent_mode",
          "summary": "If true, the wallet will not show the wallet-unlock UI in case of a locked wallet, nor the Dapp-approve UI in case of a non-allowed Dapp, and will return an empty array",
          "required": false,
          "schema": {
            "type": "boolean"
          }
        },
        {
          "name": "api_version",
          "required": false,
          "schema": {
            "$ref": "#/components/schemas/API_VERSION"
          }
        }
      ],
      "result": {
        "name": "result",
        "description": "The active account of the wallet",
        "schema": {
          "title": "Wallet Accounts",
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/ADDRESS"
          },
          "required": []
        }
      },
      "errors": [
        {
          "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED"
        },
        {
          "$ref": "#/components/errors/UNKNOWN_ERROR"
        }
      ]
    },
    {
      "name": "wallet_requestChainId",
      "summary": "Request the current Chain Id",
      "description": "When wallet is locked, return values. When Dapp is not approved, return values. When wallet is connected and unlocked, return values.",
      "params": [
        {
          "name": "api_version",
          "required": false,
          "schema": {
            "$ref": "#/components/schemas/API_VERSION"
          }
        }
      ],
      "result": {
        "name": "result",
        "description": "The active chainId",
        "schema": {
          "$ref": "#/components/schemas/CHAIN_ID"
        }
      },
      "errors": [
        {
          "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED"
        },
        {
          "$ref": "#/components/errors/UNKNOWN_ERROR"
        }
      ]
    },
    {
      "name": "wallet_deploymentData",
      "summary": "Request from the current wallet the data required to deploy the account at the current address",
      "description": "When wallet is locked, return error DEPLOYMENT_DATA_NOT_AVAILABLE. When Dapp is not approved, return error DEPLOYMENT_DATA_NOT_AVAILABLE. When wallet is connected and unlocked, return values.",
      "params": [
        {
          "name": "api_version",
          "required": false,
          "schema": {
            "$ref": "#/components/schemas/API_VERSION"
          }
        }
      ],
      "result": {
        "name": "result",
        "schema": {
          "$ref": "#/components/schemas/ACCOUNT_DEPLOYMENT_DATA"
        }
      },
      "errors": [
        {
          "$ref": "#/components/errors/ACCOUNT_ALREADY_DEPLOYED"
        },
        {
          "$ref": "#/components/errors/DEPLOYMENT_DATA_NOT_AVAILABLE"
        },
        {
          "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED"
        },
        {
          "$ref": "#/components/errors/UNKNOWN_ERROR"
        }
      ]
    },
    {
      "name": "wallet_switchStarknetChain",
      "summary": "Change the current network of the wallet, a permission request will be displayed on the wallet UI.",
      "description": "When wallet is locked, open wallet-unlock UI. When Dapp is not approved, display Dapp-approve UI. When wallet is connected and unlocked, display switch-chain UI.",
      "params": [
        {
          "name": "chainId",
          "required": true,
          "schema": {
            "$ref": "#/components/schemas/CHAIN_ID"
          }
        },
        {
          "name": "silent_mode",
          "summary": "If true, the wallet will not show the wallet-unlock UI in case of a locked wallet, nor the Dapp-approve UI in case of a non-allowed Dapp, and will return an error CHAIN_ID_NOT_SUPPORTED",
          "required": false,
          "schema": {
            "type": "boolean"
          }
        },
        {
          "name": "api_version",
          "required": false,
          "schema": {
            "$ref": "#/components/schemas/API_VERSION"
          }
        }
      ],
      "result": {
        "name": "response",
        "summary": "If wallet agrees to change network, return true. If the current network is selected, return true. If network is not added to wallet, return false",
        "required": true,
        "schema": {
          "type": "boolean"
        }
      },
      "errors": [
        {
          "$ref": "#/components/errors/UNLISTED_NETWORK"
        },
        {
          "$ref": "#/components/errors/USER_REFUSED_OP"
        },
        {
          "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED"
        },
        {
          "$ref": "#/components/errors/CHAIN_ID_NOT_SUPPORTED"
        },
        {
          "$ref": "#/components/errors/UNKNOWN_ERROR"
        }
      ]
    },
    {
      "name": "wallet_watchAsset",
      "summary": "Add a token in the list of assets displayed by the wallet, the wallet will show an approval UI",
      "description": "When wallet is locked, open wallet-unlock UI. When Dapp is not approved, display Dapp-approve UI. When wallet is connected and unlocked, display watch-asset UI.",
      "params": [
        {
          "name": "Asset to add",
          "description": "Information needed to add asset",
          "required": true,
          "schema": {
            "$ref": "#/components/schemas/ASSET"
          }
        },
        {
          "name": "api_version",
          "required": false,
          "schema": {
            "$ref": "#/components/schemas/API_VERSION"
          }
        }
      ],
      "result": {
        "name": "response",
        "summary": "If adding a token is agreed, or if token is already displayed, return true",
        "required": true,
        "schema": {
          "type": "boolean"
        }
      },
      "errors": [
        {
          "$ref": "#/components/errors/NOT_ERC20"
        },
        {
          "$ref": "#/components/errors/INVALID_REQUEST_PAYLOAD"
        },
        {
          "$ref": "#/components/errors/USER_REFUSED_OP"
        },
        {
          "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED"
        },
        {
          "$ref": "#/components/errors/UNKNOWN_ERROR"
        }
      ]
    },
    {
      "name": "wallet_addStarknetChain",
      "summary": "Add a new network in the list of networks of the wallet, a permission request will be displayed on the wallet UI.",
      "description": "When wallet is locked, open wallet-unlock UI. When Dapp is not approved, display Dapp-approve UI. When wallet is connected and unlocked, display add-chain UI.",
      "params": [
        {
          "name": "Starknet Chain to add",
          "description": "Information for the chain to add to the wallet",
          "required": true,
          "schema": {
            "$ref": "#/components/schemas/STARKNET_CHAIN"
          }
        },
        {
          "name": "api_version",
          "required": false,
          "schema": {
            "$ref": "#/components/schemas/API_VERSION"
          }
        }
      ],
      "result": {
        "name": "response",
        "summary": "If user agreed, and network added successfully, or if network already listed, return true",
        "required": true,
        "schema": {
          "type": "boolean"
        }
      },
      "errors": [
        {
          "$ref": "#/components/errors/INVALID_REQUEST_PAYLOAD"
        },
        {
          "$ref": "#/components/errors/USER_REFUSED_OP"
        },
        {
          "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED"
        },
        {
          "$ref": "#/components/errors/UNKNOWN_ERROR"
        }
      ]
    },
    {
      "name": "wallet_addInvokeTransaction",
      "summary": "Submit a new transaction to be added to the chain",
      "description": "When wallet is locked, open wallet-unlock UI. When Dapp is not approved, display Dapp-approve UI. When wallet is connected and unlocked, display invoke-tx UI. To submit a STRK20 transaction prepared by wallet_strk20PrepareInvoke, pass the prepared call as the single entry of 'invoke_transaction' and the prepared proof material via 'proof'.",
      "params": [
        {
          "name": "invoke_transaction",
          "description": "A list of calls to invoke in an invoke transaction",
          "required": true,
          "schema": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/INVOKE_CALL"
            }
          }
        },
        {
          "name": "proof",
          "description": "Zero-knowledge proof material to attach to the transaction. Required when submitting a STRK20 call produced by wallet_strk20PrepareInvoke; omitted for regular invocations.",
          "required": false,
          "schema": {
            "$ref": "#/components/schemas/STRK20_PROOF"
          }
        },
        {
          "name": "api_version",
          "required": false,
          "schema": {
            "$ref": "#/components/schemas/API_VERSION"
          }
        }
      ],
      "result": {
        "name": "result",
        "description": "The result of the transaction submission",
        "schema": {
          "type": "object",
          "properties": {
            "transaction_hash": {
              "title": "Transaction Hash",
              "$ref": "#/components/schemas/PADDED_TXN_HASH"
            }
          },
          "required": ["transaction_hash"]
        }
      },
      "errors": [
        {
          "$ref": "#/components/errors/INVALID_REQUEST_PAYLOAD"
        },
        {
          "$ref": "#/components/errors/USER_REFUSED_OP"
        },
        {
          "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED"
        },
        {
          "$ref": "#/components/errors/UNKNOWN_ERROR"
        }
      ]
    },
    {
      "name": "wallet_addDeclareTransaction",
      "summary": "Submit a declare transaction",
      "description": "When wallet is locked, open wallet-unlock UI. When Dapp is not approved, display Dapp-approve UI. When wallet is connected and unlocked, display declare-tx UI.",
      "params": [
        {
          "name": "declare_transaction",
          "description": "The information needed to declare a new class",
          "required": true,
          "schema": {
            "$ref": "#/components/schemas/DECLARE_TXN"
          }
        },
        {
          "name": "api_version",
          "required": false,
          "schema": {
            "$ref": "#/components/schemas/API_VERSION"
          }
        }
      ],
      "result": {
        "name": "result",
        "description": "The result of the transaction submission",
        "schema": {
          "type": "object",
          "properties": {
            "transaction_hash": {
              "title": "The hash of the declare transaction",
              "$ref": "#/components/schemas/PADDED_TXN_HASH"
            },
            "class_hash": {
              "title": "The hash of the declared class",
              "$ref": "#/components/schemas/PADDED_FELT"
            }
          },
          "required": ["transaction_hash", "class_hash"]
        }
      },
      "errors": [
        {
          "$ref": "#/components/errors/INVALID_REQUEST_PAYLOAD"
        },
        {
          "$ref": "#/components/errors/USER_REFUSED_OP"
        },
        {
          "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED"
        },
        {
          "$ref": "#/components/errors/UNKNOWN_ERROR"
        }
      ]
    },
    {
      "name": "wallet_strk20InvokeTransaction",
      "summary": "Submit a transaction containing STRK20 privacy protocol actions",
      "description": "Submits one or more STRK20 actions (deposit, withdraw, private transfer) as a single transaction. The wallet displays an approval UI and may take significantly longer than wallet_addInvokeTransaction because zero-knowledge proof generation is required. The dapp must tolerate long-running calls. The wallet adds the fee action itself: a withdraw action covering the paymaster/relayer fee required to submit, on top of the actions the dapp supplies. Registration into the privacy pool is handled transparently by the wallet — if the user is not registered, NOT_REGISTERED is returned. If the number of open notes filled by invoke actions does not match the number of open notes created by transfer actions with \"OPEN\" as the amount, INVALID_REQUEST_PAYLOAD is returned.",
      "params": [
        {
          "name": "actions",
          "description": "An ordered list of STRK20 actions to execute atomically",
          "required": true,
          "schema": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/STRK20_ACTION"
            },
            "minItems": 1
          }
        },
        {
          "name": "api_version",
          "required": false,
          "schema": {
            "$ref": "#/components/schemas/API_VERSION"
          }
        }
      ],
      "result": {
        "name": "result",
        "description": "The result of the transaction submission",
        "schema": {
          "type": "object",
          "properties": {
            "transaction_hash": {
              "title": "Transaction Hash",
              "$ref": "#/components/schemas/PADDED_TXN_HASH"
            }
          },
          "required": ["transaction_hash"]
        }
      },
      "errors": [
        {
          "$ref": "#/components/errors/NOT_REGISTERED"
        },
        {
          "$ref": "#/components/errors/INSUFFICIENT_PRIVATE_BALANCE"
        },
        {
          "$ref": "#/components/errors/PRIVACY_LEAK"
        },
        {
          "$ref": "#/components/errors/INVALID_REQUEST_PAYLOAD"
        },
        {
          "$ref": "#/components/errors/USER_REFUSED_OP"
        },
        {
          "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED"
        },
        {
          "$ref": "#/components/errors/UNKNOWN_ERROR"
        }
      ]
    },
    {
      "name": "wallet_strk20PrepareInvoke",
      "summary": "Build the Starknet call (and zero-knowledge proof) for a STRK20 transaction without submitting it",
      "description": "Builds the Starknet call that wallet_strk20InvokeTransaction would submit, plus its zero-knowledge proof, but does not send the transaction to the network. The dapp is responsible for submitting the returned call itself. The wallet supplies the viewing key and the user's private state (channels, notes) — the dapp only describes the actions. The wallet does not add a fee withdrawal action. When 'simulate' is true the wallet returns the call with an empty proof: it skips the (expensive, state-revealing) proof-generation step, but the returned call is otherwise the same shape as the non-simulated one. Simulate mode is intended for fee estimation and UI previews; the returned call cannot be submitted on-chain. As with wallet_strk20InvokeTransaction the wallet may take significantly longer than wallet_addInvokeTransaction when simulate is false, because proof generation is required, and the dapp must tolerate long-running calls. Registration into the privacy pool is handled transparently by the wallet — if the user is not registered, NOT_REGISTERED is returned. If the number of open notes filled by invoke actions does not match the number of open notes created by transfer actions with \"OPEN\" as the amount, INVALID_REQUEST_PAYLOAD is returned.",
      "params": [
        {
          "name": "actions",
          "description": "An ordered list of STRK20 actions to bundle into the prepared call",
          "required": true,
          "schema": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/STRK20_ACTION"
            },
            "minItems": 1
          }
        },
        {
          "name": "simulate",
          "description": "If true, skip zero-knowledge proof generation and return an empty proof. Use for fee estimation or UI previews; the returned call is not submittable on-chain. Defaults to false.",
          "required": false,
          "schema": {
            "type": "boolean",
            "default": false
          }
        },
        {
          "name": "api_version",
          "required": false,
          "schema": {
            "$ref": "#/components/schemas/API_VERSION"
          }
        }
      ],
      "result": {
        "name": "result",
        "description": "The Starknet call that materializes the requested STRK20 actions and its accompanying zero-knowledge proof. When 'simulate' was true, the 'proof' fields are present but empty.",
        "schema": {
          "$ref": "#/components/schemas/STRK20_CALL_AND_PROOF"
        }
      },
      "errors": [
        {
          "$ref": "#/components/errors/NOT_REGISTERED"
        },
        {
          "$ref": "#/components/errors/INSUFFICIENT_PRIVATE_BALANCE"
        },
        {
          "$ref": "#/components/errors/PRIVACY_LEAK"
        },
        {
          "$ref": "#/components/errors/INVALID_REQUEST_PAYLOAD"
        },
        {
          "$ref": "#/components/errors/USER_REFUSED_OP"
        },
        {
          "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED"
        },
        {
          "$ref": "#/components/errors/UNKNOWN_ERROR"
        }
      ]
    },
    {
      "name": "wallet_strk20Balances",
      "summary": "Query the user's private balances for a list of tokens, or for all shielded tokens",
      "description": "Returns the private balance held inside the STRK20 privacy pool for each of the requested token addresses. If an empty array is passed, returns the balances of all shielded tokens the wallet holds in the privacy pool. If the user is not registered in the pool, returns NOT_REGISTERED.",
      "params": [
        {
          "name": "tokens",
          "description": "The token addresses to query balances for. An empty array returns the balances of all shielded tokens",
          "required": true,
          "schema": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ADDRESS"
            }
          }
        },
        {
          "name": "api_version",
          "required": false,
          "schema": {
            "$ref": "#/components/schemas/API_VERSION"
          }
        }
      ],
      "result": {
        "name": "result",
        "description": "Private balances, one entry per requested token, in the same order as the input. When an empty array is passed, one entry per shielded token held in the privacy pool",
        "schema": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/STRK20_BALANCE_ENTRY"
          }
        }
      },
      "errors": [
        {
          "$ref": "#/components/errors/NOT_REGISTERED"
        },
        {
          "$ref": "#/components/errors/INVALID_REQUEST_PAYLOAD"
        },
        {
          "$ref": "#/components/errors/USER_REFUSED_OP"
        },
        {
          "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED"
        },
        {
          "$ref": "#/components/errors/UNKNOWN_ERROR"
        }
      ]
    },
    {
      "name": "wallet_strk20SubaccountCommitment",
      "summary": "Compute the commitment for a dapp's STRK20 sub-accounts",
      "description": "Returns a STRK20 sub-account commitment, computed locally by the wallet from the user's private state (no transaction is sent). When 'nonce' is given, returns the full commitment for that single sub-account: hash(partial_commitment, nonce); each nonce maps to a distinct, deterministic sub-account for the user + dapp. When 'nonce' is omitted, returns the partial (nonce-independent) commitment: hash(identity_key, dapp_name), where identity_key is derived from the user, their viewing key, and the sub-account anonymizer address. The partial commitment is shared by every sub-account the user derives for this dapp, so it can be published once to let a dapp recognize all of the user's sub-accounts without learning any individual nonce. If the user is not registered in the STRK20 privacy pool, NOT_REGISTERED is returned.",
      "params": [
        {
          "name": "dapp_name",
          "description": "The dapp that scopes the sub-account(s)",
          "required": true,
          "schema": {
            "$ref": "#/components/schemas/STRK20_DAPP_NAME"
          }
        },
        {
          "name": "nonce",
          "description": "The sub-account nonce; each nonce selects a distinct sub-account for this user + dapp. When omitted, the partial (nonce-independent) commitment shared by all of the dapp's sub-accounts is returned instead.",
          "required": false,
          "schema": {
            "$ref": "#/components/schemas/FELT"
          }
        },
        {
          "name": "api_version",
          "required": false,
          "schema": {
            "$ref": "#/components/schemas/API_VERSION"
          }
        }
      ],
      "result": {
        "name": "result",
        "description": "The sub-account commitment: hash(partial_commitment, nonce) when 'nonce' was given, otherwise the partial commitment hash(identity_key, dapp_name)",
        "required": true,
        "schema": {
          "title": "Sub-account Commitment",
          "$ref": "#/components/schemas/FELT"
        }
      },
      "errors": [
        {
          "$ref": "#/components/errors/NOT_REGISTERED"
        },
        {
          "$ref": "#/components/errors/INVALID_REQUEST_PAYLOAD"
        },
        {
          "$ref": "#/components/errors/USER_REFUSED_OP"
        },
        {
          "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED"
        },
        {
          "$ref": "#/components/errors/UNKNOWN_ERROR"
        }
      ]
    },
    {
      "name": "wallet_signTypedData",
      "summary": "Sign typed data using the wallet",
      "description": "When wallet is locked, open wallet-unlock UI. When Dapp is not approved, display Dapp-approve UI. When wallet is connected and unlocked, display sign-typed-data UI.",
      "params": [
        {
          "name": "typed_data",
          "description": "The typed data to sign",
          "required": true,
          "schema": {
            "$ref": "#/components/schemas/TYPED_DATA"
          }
        },
        {
          "name": "api_version",
          "required": false,
          "schema": {
            "$ref": "#/components/schemas/API_VERSION"
          }
        }
      ],
      "result": {
        "name": "response",
        "summary": "The signature over the typed data",
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/SIGNATURE"
        }
      },
      "errors": [
        {
          "$ref": "#/components/errors/INVALID_REQUEST_PAYLOAD"
        },
        {
          "$ref": "#/components/errors/USER_REFUSED_OP"
        },
        {
          "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED"
        },
        {
          "$ref": "#/components/errors/UNKNOWN_ERROR"
        }
      ]
    }
  ],
  "components": {
    "contentDescriptors": {},
    "schemas": {
      "PADDED_TXN_HASH": {
        "title": "Padded Transaction Hash",
        "description": "The transaction hash, as assigned in Starknet, padded to 64 hex digits",
        "$ref": "#/components/schemas/PADDED_FELT"
      },
      "ADDRESS": {
        "title": "Address",
        "$ref": "#/components/schemas/FELT"
      },
      "TOKEN_SYMBOL": {
        "title": "ERC20 Token Symbol",
        "description": "The symbol of the token",
        "type": "string",
        "minLength": 1,
        "maxLength": 6,
        "pattern": "^[A-Za-z0-9]{1,6}$"
      },
      "SPEC_VERSION": {
        "title": "Starknet Spec Version",
        "description": "A Starknet JSON-RPC spec version, following semantic versioning.",
        "type": "string",
        "pattern": "^[0-9]+\\.[0-9]+(\\.[0-9]+(-[0-9A-Za-z.-]+)?)?$"
      },
      "API_VERSION": {
        "title": "Wallet API version",
        "description": "A wallet API version, following semantic versioning. When used as a request parameter and not specified, the latest is assumed.",
        "type": "string",
        "pattern": "^[0-9]+\\.[0-9]+(\\.[0-9]+)?$"
      },
      "PERMISSION": {
        "title": "Wallet permission",
        "type": "string",
        "enum": ["accounts"],
        "description": "Optional wallet permissions"
      },
      "ASSET": {
        "title": "Starknet Token",
        "description": "Details of an onchain Starknet ERC20 token",
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["ERC20"]
          },
          "options": {
            "type": "object",
            "properties": {
              "address": {
                "title": "Token Address",
                "$ref": "#/components/schemas/ADDRESS"
              },
              "symbol": {
                "title": "Token Symbol",
                "$ref": "#/components/schemas/TOKEN_SYMBOL"
              },
              "decimals": {
                "type": "number",
                "minimum": 0
              },
              "image": {
                "type": "string",
                "format": "uri"
              },
              "name": {
                "type": "string"
              }
            },
            "required": ["address"]
          }
        },
        "required": ["type", "options"]
      },
      "CHAIN_ID": {
        "title": "Chain id",
        "description": "Starknet chain id, given in hex representation.",
        "type": "string",
        "pattern": "^0x[a-fA-F0-9]+$"
      },
      "STARKNET_CHAIN_ID": {
        "title": "Starknet Chain id",
        "description": "Only officially supported Starknet IDs",
        "allOf": [
          {
            "type": "string",
            "enum": ["0x534e5f4d41494e", "0x534e5f5345504f4c4941"]
          },
          {
            "$ref": "#/components/schemas/CHAIN_ID"
          }
        ]
      },
      "ACCOUNT_DEPLOYMENT_DATA": {
        "title": "Account Deployment Data",
        "description": "Data required to deploy an account at and address",
        "type": "object",
        "properties": {
          "address": {
            "title": "Address",
            "description": "The expected address to be deployed, used to double check",
            "$ref": "#/components/schemas/ADDRESS"
          },
          "class_hash": {
            "title": "Class hash",
            "description": "The hash of the deployed contract's class",
            "$ref": "#/components/schemas/FELT"
          },
          "salt": {
            "title": "Class hash",
            "description": "The hash of the deployed contract's class",
            "$ref": "#/components/schemas/FELT"
          },
          "calldata": {
            "type": "array",
            "description": "The parameters passed to the constructor",
            "title": "Constructor calldata",
            "items": {
              "$ref": "#/components/schemas/FELT"
            }
          },
          "sigdata": {
            "title": "Signature Data",
            "type": "array",
            "description": "Optional array of felts to be added to the signature",
            "items": {
              "$ref": "#/components/schemas/FELT"
            }
          },
          "version": {
            "title": "Contract Version",
            "description": "The Cairo version of the contract 0 or 1",
            "type": "integer",
            "enum": [0, 1]
          }
        },
        "required": ["address", "class_hash", "salt", "calldata", "version"]
      },
      "INVOKE_CALL": {
        "title": "Invoke transaction",
        "description": "initiates a transaction from a given account",
        "type": "object",
        "properties": {
          "contract_address": {
            "title": "The contract address to interact with",
            "$ref": "#/components/schemas/ADDRESS"
          },
          "entry_point": {
            "title": "Contract entry point",
            "description": "A string correlating the selector name of the contract, e.g. 'transfer'",
            "type": "string"
          },
          "calldata": {
            "type": "array",
            "title": "calldata",
            "description": "Calldata to be passed to the entry point",
            "items": {
              "$ref": "#/components/schemas/FELT"
            }
          }
        },
        "required": ["contract_address", "entry_point"]
      },
      "DECLARE_TXN": {
        "title": "Declare Transaction",
        "description": "Declare Contract Transaction",
        "type": "object",
        "properties": {
          "compiled_class_hash": {
            "title": "Compiled class hash",
            "description": "The hash of the Cairo assembly resulting from the Sierra compilation",
            "$ref": "#/components/schemas/FELT"
          },
          "class_hash": {
            "title": "Class hash",
            "description": "The hash of the declared class",
            "$ref": "#/components/schemas/FELT"
          },
          "contract_class": {
            "title": "Contract class",
            "description": "The class to be declared",
            "$ref": "#/components/schemas/CONTRACT_CLASS"
          }
        },
        "required": ["compiled_class_hash", "contract_class"]
      },
      "STARKNET_CHAIN": {
        "title": "Starknet Chain",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "chain_id": {
            "title": "Starknet Chain Id",
            "$ref": "#/components/schemas/CHAIN_ID"
          },
          "chain_name": {
            "type": "string"
          },
          "rpc_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            },
            "minItems": 1,
            "uniqueItems": true
          },
          "block_explorer_url": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            },
            "minItems": 1,
            "uniqueItems": true
          },
          "native_currency": {
            "title": "Native Currency",
            "$ref": "#/components/schemas/ASSET"
          },
          "icon_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            },
            "minItems": 1,
            "uniqueItems": true
          }
        },
        "required": ["id", "chain_id", "chain_name"]
      },
      "STARKNET_MERKLE_TYPE": {
        "title": "Starknet Merkle Type",
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": ["merkletree"]
          },
          "contains": {
            "type": "string"
          }
        },
        "required": ["name", "type", "contains"]
      },
      "STARKNET_ENUM_TYPE": {
        "title": "Starknet Enum Type",
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": ["enum"]
          },
          "contains": {
            "type": "string"
          }
        },
        "required": ["name", "type", "contains"]
      },
      "STARKNET_TYPE": {
        "title": "Starknet Type",
        "description": "A single type, as part of a struct. The `type` field can be any of the EIP-712 supported types",
        "schema": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "name": { "type": "string" },
                "type": { "type": "string" }
              },
              "required": ["name", "type"]
            },
            {
              "$ref": "#/components/schemas/STARKNET_MERKLE_TYPE"
            },
            {
              "$ref": "#/components/schemas/STARKNET_ENUM_TYPE"
            }
          ]
        }
      },
      "TYPED_DATA": {
        "title": "Typed Data",
        "type": "object",
        "properties": {
          "types": {
            "description": "Defines the types of the typed data object",
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/STARKNET_TYPE"
              }
            }
          },
          "primaryType": {
            "type": "string",
            "description": "primaryType represents the top-level type of the object in the message"
          },
          "domain": {
            "description": "The EIP712 domain struct. Any of these fields are optional, but it must contain at least one field",
            "$ref": "#/components/schemas/STARKNET_DOMAIN"
          },
          "message": {
            "type": "object",
            "description": "The message to be signed"
          }
        },
        "required": ["types", "primaryType", "domain", "message"]
      },
      "STARKNET_DOMAIN": {
        "title": "Starknet Domain",
        "type": "object",
        "minProperties": 1,
        "properties": {
          "name": { "type": "string" },
          "version": { "type": "string" },
          "chainId": {
            "anyOf": [{ "type": "string" }, { "type": "number" }]
          },
          "revision": {
            "oneOf": [
              {
                "type": "string",
                "enum": ["2"]
              },
              {
                "type": "number",
                "enum": [0, 1]
              }
            ]
          }
        }
      },
      "STRK20_ACTION": {
        "title": "STRK20 Action",
        "description": "A single action to perform via the STRK20 privacy protocol. The 'type' field discriminates the variant.",
        "oneOf": [
          {
            "$ref": "#/components/schemas/STRK20_DEPOSIT_ACTION"
          },
          {
            "$ref": "#/components/schemas/STRK20_WITHDRAW_ACTION"
          },
          {
            "$ref": "#/components/schemas/STRK20_TRANSFER_ACTION"
          },
          {
            "$ref": "#/components/schemas/STRK20_INVOKE_ACTION"
          },
          {
            "$ref": "#/components/schemas/STRK20_SUBACCOUNT_INVOKE_ACTION"
          }
        ]
      },
      "STRK20_DEPOSIT_ACTION": {
        "title": "STRK20 Deposit Action",
        "description": "Deposits public funds from the user's account into the privacy pool. Always to self.",
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["deposit"]
          },
          "token": {
            "title": "Token Address",
            "$ref": "#/components/schemas/ADDRESS"
          },
          "amount": {
            "title": "Amount",
            "description": "Amount of the token, in its smallest unit",
            "$ref": "#/components/schemas/FELT"
          }
        },
        "required": ["type", "token", "amount"]
      },
      "STRK20_WITHDRAW_ACTION": {
        "title": "STRK20 Withdraw Action",
        "description": "Withdraws funds from the privacy pool to a public recipient address.",
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["withdraw"]
          },
          "token": {
            "title": "Token Address",
            "$ref": "#/components/schemas/ADDRESS"
          },
          "amount": {
            "title": "Amount",
            "description": "Amount of the token, in its smallest unit",
            "$ref": "#/components/schemas/FELT"
          },
          "recipient": {
            "title": "Recipient Address",
            "description": "The public Starknet address that receives the withdrawn funds",
            "$ref": "#/components/schemas/ADDRESS"
          }
        },
        "required": ["type", "token", "amount", "recipient"]
      },
      "STRK20_TRANSFER_ACTION": {
        "title": "STRK20 Transfer Action",
        "description": "Privately transfers funds inside the privacy pool to another registered user. When amount is \"OPEN\", creates an open note instead of transferring a fixed amount (see the amount field).",
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["transfer"]
          },
          "token": {
            "title": "Token Address",
            "$ref": "#/components/schemas/ADDRESS"
          },
          "amount": {
            "title": "Amount",
            "description": "Amount of the token, in its smallest unit, or the literal string \"OPEN\" to create a new open note",
            "oneOf": [
              {
                "$ref": "#/components/schemas/FELT"
              },
              {
                "type": "string",
                "enum": ["OPEN"]
              }
            ]
          },
          "recipient": {
            "title": "Recipient Address",
            "description": "The Starknet address of the registered recipient inside the privacy pool",
            "$ref": "#/components/schemas/ADDRESS"
          }
        },
        "required": ["type", "token", "amount", "recipient"]
      },
      "STRK20_INVOKE_ACTION": {
        "title": "STRK20 Invoke Action",
        "description": "Invokes an arbitrary contract as part of the same STRK20 transaction. Calldata items may be literal felts or wallet-resolved placeholders that the wallet substitutes during action assembly: ${openNoteIds[N]} for the Nth opened note ID, or ${poolAddress} for the privacy pool address.",
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["invoke"]
          },
          "contract": {
            "title": "Contract Address",
            "$ref": "#/components/schemas/ADDRESS"
          },
          "calldata": {
            "type": "array",
            "title": "Calldata",
            "items": {
              "$ref": "#/components/schemas/STRK20_CALLDATA_ITEM"
            }
          }
        },
        "required": ["type", "contract", "calldata"]
      },
      "STRK20_CALLDATA_ITEM": {
        "title": "STRK20 Invoke Calldata Item",
        "description": "A single calldata entry: either a literal felt, or one of the placeholder strings the wallet expands during action assembly.",
        "oneOf": [
          {
            "$ref": "#/components/schemas/FELT"
          },
          {
            "$ref": "#/components/schemas/STRK20_CALLDATA_PLACEHOLDER"
          }
        ]
      },
      "STRK20_CALLDATA_PLACEHOLDER": {
        "title": "STRK20 Calldata Placeholder",
        "description": "A wallet-resolved placeholder that the wallet substitutes with a single felt during action assembly. ${openNoteIds[N]} expands to the ID of the Nth open note in the same transaction (i.e. the Nth transfer action with amount \"OPEN\"); ${poolAddress} expands to the privacy pool contract address. N is a zero-based index.",
        "type": "string",
        "pattern": "^\\$\\{(?:openNoteIds\\[[0-9]+\\]|poolAddress)\\}$"
      },
      "STRK20_SUBACCOUNT_INVOKE_ACTION": {
        "title": "STRK20 Sub-account Invoke Action",
        "description": "Invokes one or more contract calls through the user's STRK20 sub-account for a dapp, routed via the sub-account anonymizer. The sub-account is selected by (dapp_name, nonce); each nonce maps to a distinct, deterministic sub-account. The proceeds of the calls are settled into the open notes created by transfer actions with amount \"OPEN\" in the same transaction, so the usual rule applies: the number of open notes filled by this action must match the number of open notes created in the transaction.",
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["subaccount_invoke"]
          },
          "dapp_name": {
            "title": "Dapp Name",
            "description": "The dapp that scopes the sub-account",
            "$ref": "#/components/schemas/STRK20_DAPP_NAME"
          },
          "nonce": {
            "title": "Sub-account Nonce",
            "description": "The sub-account nonce; each nonce selects a distinct sub-account for this user + dapp",
            "$ref": "#/components/schemas/FELT"
          },
          "calls": {
            "type": "array",
            "title": "Calls",
            "description": "The contract calls to execute through the sub-account, in order",
            "items": {
              "$ref": "#/components/schemas/INVOKE_CALL"
            },
            "minItems": 1
          },
          "collect_policy": {
            "title": "Collect Policy",
            "description": "A single policy applied to every open note this action settles: how much of the sub-account's balance each note collects.",
            "$ref": "#/components/schemas/STRK20_COLLECT_POLICY"
          }
        },
        "required": ["type", "dapp_name", "nonce", "calls", "collect_policy"]
      },
      "STRK20_COLLECT_POLICY": {
        "title": "STRK20 Collect Policy",
        "description": "How much of the sub-account's token balance a settled open note collects. 'all' collects the sub-account's entire token balance; 'diff' collects only the balance gained during this interaction; 'exact' collects the given amount (which must be provided).",
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["all", "diff", "exact"]
          },
          "amount": {
            "title": "Exact Amount",
            "description": "The exact amount to collect, in the token's smallest unit. Required when and only when type is 'exact'.",
            "$ref": "#/components/schemas/FELT"
          }
        },
        "required": ["type"]
      },
      "STRK20_DAPP_NAME": {
        "title": "STRK20 Dapp Name",
        "description": "Identifies the dapp that scopes a set of STRK20 sub-accounts, as a single felt. Either a 0x-prefixed felt, or a human-readable ASCII string of at most 31 characters that the wallet encodes as a Cairo short string.",
        "type": "string"
      },
      "STRK20_BALANCE_ENTRY": {
        "title": "STRK20 Balance Entry",
        "description": "A private balance for a single token held inside the privacy pool",
        "type": "object",
        "properties": {
          "token": {
            "title": "Token Address",
            "$ref": "#/components/schemas/ADDRESS"
          },
          "balance": {
            "title": "Balance",
            "description": "The private balance of the token, in its smallest unit",
            "$ref": "#/components/schemas/FELT"
          }
        },
        "required": ["token", "balance"]
      },
      "STRK20_CALL_AND_PROOF": {
        "title": "STRK20 Call And Proof",
        "description": "A Starknet call that materializes a STRK20 transaction, together with the zero-knowledge proof needed to submit it. When this was produced in simulate mode the 'proof' fields are present but empty (proof.data is an empty string, proof.output and proof.proof_facts are empty arrays); in that case the call is not submittable on-chain and is only useful for fee estimation or UI previews.",
        "type": "object",
        "properties": {
          "call": {
            "title": "Call",
            "description": "The Starknet call to submit (typically targeting the privacy pool contract)",
            "$ref": "#/components/schemas/INVOKE_CALL"
          },
          "proof": {
            "title": "Proof",
            "$ref": "#/components/schemas/STRK20_PROOF"
          }
        },
        "required": ["call", "proof"]
      },
      "STRK20_PROOF": {
        "title": "STRK20 Proof",
        "description": "Zero-knowledge proof material that must be included with the call when submitting the STRK20 transaction on-chain. When the prepared call was built in simulate mode all three fields are present but empty.",
        "type": "object",
        "properties": {
          "data": {
            "title": "Proof Data",
            "description": "The serialized proof. Empty string in simulate mode.",
            "type": "string"
          },
          "output": {
            "title": "L2-to-L1 Message Payload",
            "description": "L2-to-L1 message payload: [class_hash, ...serialized_server_actions]. Empty array in simulate mode.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FELT"
            }
          },
          "proof_facts": {
            "title": "Proof Facts",
            "description": "Proof facts emitted by the proving service; must be included with the transaction when submitting to the chain. Empty array in simulate mode.",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FELT"
            }
          }
        },
        "required": ["data", "output", "proof_facts"]
      },
      "PADDED_FELT": {
        "type": "string",
        "title": "Padded felt",
        "description": "A padded felt represented as 62 hex digits, 3 bits, and 5 leading zero bits.",
        "pattern": "^0x(0[0-8]{1}[a-fA-F0-9]{62}$)"
      },
      "CONTRACT_CLASS": {
        "$ref": "./api/starknet_api_openrpc.json#/components/schemas/CONTRACT_CLASS"
      },
      "SIGNATURE": {
        "$ref": "./api/starknet_api_openrpc.json#/components/schemas/SIGNATURE"
      },
      "FELT": {
        "$ref": "./api/starknet_api_openrpc.json#/components/schemas/FELT"
      }
    },
    "errors": {
      "NOT_ERC20": {
        "code": 111,
        "message": "An error occurred (NOT_ERC20)"
      },
      "UNLISTED_NETWORK": {
        "code": 112,
        "message": "An error occurred (UNLISTED_NETWORK)"
      },
      "USER_REFUSED_OP": {
        "code": 113,
        "message": "An error occurred (USER_REFUSED_OP)",
        "description": "The user refused the operation in the wallet"
      },
      "INVALID_REQUEST_PAYLOAD": {
        "code": 114,
        "message": "An error occurred (INVALID_REQUEST_PAYLOAD)"
      },
      "ACCOUNT_ALREADY_DEPLOYED": {
        "code": 115,
        "message": "An error occurred (ACCOUNT_ALREADY_DEPLOYED)"
      },
      "DEPLOYMENT_DATA_NOT_AVAILABLE": {
        "code": 116,
        "message": "An error occurred (DEPLOYMENT_DATA_NOT_AVAILABLE)",
        "description": "The deployment data is not available or no supported"
      },
      "CHAIN_ID_NOT_SUPPORTED": {
        "code": 117,
        "message": "An error occurred (CHAIN_ID_NOT_SUPPORTED)",
        "description": "The requested chain ID is not supported by the wallet"
      },
      "NOT_REGISTERED": {
        "code": 118,
        "message": "An error occurred (NOT_REGISTERED)",
        "description": "The user is not registered in the STRK20 privacy pool"
      },
      "INSUFFICIENT_PRIVATE_BALANCE": {
        "code": 119,
        "message": "An error occurred (INSUFFICIENT_PRIVATE_BALANCE)",
        "description": "The user does not have enough private balance to cover the requested withdraw or transfer"
      },
      "PRIVACY_LEAK": {
        "code": 120,
        "message": "An error occurred (PRIVACY_LEAK)",
        "description": "The wallet detected that completing the operation may compromise the user's privacy"
      },
      "API_VERSION_NOT_SUPPORTED": {
        "code": 162,
        "message": "An error occurred (API_VERSION_NOT_SUPPORTED)",
        "data": "string"
      },
      "UNKNOWN_ERROR": {
        "code": 163,
        "message": "An error occurred (UNKNOWN_ERROR)",
        "data": "string"
      }
    }
  }
}
