├── .gitignore ├── .prettierrc ├── .github ├── pull_request_template.md └── workflows │ └── validate.yml ├── package.json ├── README.md ├── check_component_uniqueness.js ├── api ├── release.md ├── starknet_write_api.json ├── starknet_metadata.json ├── starknet_ws_api.json ├── starknet_trace_api_openrpc.json └── starknet_executables.json ├── validate.js ├── starknet_vs_ethereum_node_apis.md └── wallet-api └── wallet_rpc.json /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Diagnostic reports (https://nodejs.org/api/report.html) 7 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 8 | 9 | # Dependency directories 10 | node_modules/ 11 | jspm_packages/ 12 | 13 | # TypeScript cache 14 | *.tsbuildinfo 15 | 16 | # Optional npm cache directory 17 | .npm 18 | 19 | # Optional eslint cache 20 | .eslintcache 21 | 22 | # Optional REPL history 23 | .node_repl_history 24 | 25 | .vscode/settings.json 26 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "endOfLine": "lf", 3 | "insertPragma": false, 4 | "tabWidth": 2, 5 | "useTabs": false, 6 | "overrides": [ 7 | { 8 | "files": "*.js", 9 | "options": { 10 | "tabWidth": 2 11 | } 12 | }, 13 | { 14 | "files": "*.json", 15 | "options": { 16 | "tabWidth": 2 17 | } 18 | }, 19 | { 20 | "files": "*.md", 21 | "options": { 22 | "tabWidth": 2 23 | } 24 | } 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## Changes 2 | 3 | 4 | 5 | ## Checklist: 6 | 7 | - [ ] Validated the specification files - `npm run validate_all` 8 | - [ ] Applied formatting - `npm run format` 9 | - [ ] Performed code self-review 10 | - [ ] Checked if this PR resolves any [issues](https://github.com/starkware-libs/starknet-specs/issues) 11 | - [ ] If making a new release, check out [the guidelines](https://github.com/starkware-libs/starknet-specs/blob/master/api/release.md) 12 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "starknet_specs", 3 | "version": "0.6.0", 4 | "description": "Tooling for OpenRPC files", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/starkware-libs/starknet-specs.git" 8 | }, 9 | "scripts": { 10 | "validate_all": "find api/ -name '*.json' -not -name 'starknet_metadata.json' | xargs -n1 node validate.js", 11 | "check_component_uniqueness": "node check_component_uniqueness.js", 12 | "format": "prettier --write --config .prettierrc .", 13 | "format_check": "prettier -c --config .prettierrc ." 14 | }, 15 | "author": "Lior Schejter", 16 | "license": "MIT", 17 | "dependencies": { 18 | "@json-schema-tools/dereferencer": "1.6.3", 19 | "@open-rpc/schema-utils-js": "^2.0.3", 20 | "fs-extra": "10.1.0" 21 | }, 22 | "devDependencies": { 23 | "prettier": "^3.5.3" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /.github/workflows/validate.yml: -------------------------------------------------------------------------------- 1 | # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions 3 | 4 | name: Validate OpenRPC Spec 5 | 6 | on: 7 | push: 8 | branches: ["master"] 9 | pull_request: 10 | branches: ["master"] 11 | 12 | jobs: 13 | validate_all: 14 | runs-on: ubuntu-latest 15 | 16 | strategy: 17 | matrix: 18 | node-version: [20.x] 19 | # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ 20 | 21 | steps: 22 | - uses: actions/checkout@v3 23 | - name: Use Node.js ${{ matrix.node-version }} 24 | uses: actions/setup-node@v3 25 | with: 26 | node-version: ${{ matrix.node-version }} 27 | cache: "npm" 28 | - run: npm ci 29 | - run: npm run validate_all 30 | - run: npm run check_component_uniqueness 31 | - run: npm run format_check 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Starknet Specifications 2 | 3 | This repository publishes different technical specifications pertaining to the implementation and interaction with Starknet. 4 | 5 | ## API 6 | 7 | The JSON-RPC API can be found under the `api/` folder. 8 | You can view it more conveniently using the OpenRPC playground [here](https://playground.open-rpc.org/?uiSchema%5BappBar%5D%5Bui:splitView%5D=false&schemaUrl=https://raw.githubusercontent.com/starkware-libs/starknet-specs/master/api/starknet_api_openrpc.json&uiSchema%5BappBar%5D%5Bui:input%5D=false&uiSchema%5BappBar%5D%5Bui:darkMode%5D=true&uiSchema%5BappBar%5D%5Bui:examplesDropdown%5D=false). 9 | 10 | A guide to the API can be found [here](./starknet_vs_ethereum_node_apis.md). 11 | 12 | # Tooling 13 | 14 | When developing the schema, you can validate the OpenRPC schema file, by running the provided script. 15 | Note this requires node.js installed. 16 | 17 | The command: 18 | 19 | ``` 20 | ./validate.js api/starknet_api_openrpc.json 21 | ``` 22 | 23 | will run a validation on the `api/starknet_api_openrpc.json` schema file. 24 | If everything is ok, an appropriate message is displayed; otherwise errors are output to standard error. 25 | -------------------------------------------------------------------------------- /check_component_uniqueness.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const fs = require("fs"); 4 | const path = require("path"); 5 | 6 | /** 7 | * Updates one object with contents of the other. 8 | * Object expected to have nesting: { components: { schemas: { ... }, errors: { ... } } } 9 | * @param {*} globalComponents the object to be updated 10 | * @param {*} newComponents the object to be added to `globalComponents 11 | * @returns Number of encountered duplicates. 12 | */ 13 | function addComponents(globalComponents, newComponents, newComponentsOrigin) { 14 | let duplicates = 0; 15 | for (const componentType in newComponents) { 16 | if (!(componentType in globalComponents)) { 17 | globalComponents[componentType] = {}; 18 | for (const componentName in newComponents[componentType]) { 19 | globalComponents[componentType][componentName] = newComponentsOrigin; 20 | } 21 | continue; 22 | } 23 | 24 | for (const componentName in newComponents[componentType]) { 25 | const newComponent = newComponents[componentType][componentName]; 26 | const isReference = "$ref" in newComponent; 27 | if (componentName in globalComponents[componentType] && !isReference) { 28 | const previousLocation = globalComponents[componentType][componentName]; 29 | duplicates++; 30 | console.error( 31 | `Duplicate entry in ${componentType}: ${componentName} defined in ${previousLocation} and ${newComponentsOrigin}`, 32 | ); 33 | } else if (!isReference) { 34 | globalComponents[componentType][componentName] = newComponentsOrigin; 35 | } 36 | } 37 | } 38 | 39 | return duplicates; 40 | } 41 | 42 | function main() { 43 | const globalComponents = {}; 44 | const specDir = "api"; 45 | let duplicates = 0; 46 | 47 | console.error( 48 | "Temporarily ignoring starknet_metadata.json in uniqueness check. Perhaps remove it or use it better.", 49 | ); 50 | for (const fileName of fs.readdirSync(specDir)) { 51 | if (fileName.endsWith(".json") && fileName !== "starknet_metadata.json") { 52 | const filePath = path.join(specDir, fileName); 53 | const rawSpec = fs.readFileSync(filePath); 54 | const specContent = JSON.parse(rawSpec); 55 | const newComponents = specContent["components"]; 56 | duplicates += addComponents(globalComponents, newComponents, filePath); 57 | } 58 | } 59 | 60 | if (duplicates > 0) { 61 | process.exit(duplicates); 62 | } else { 63 | console.log("No duplicate component definitions!"); 64 | } 65 | } 66 | 67 | main(); 68 | -------------------------------------------------------------------------------- /api/release.md: -------------------------------------------------------------------------------- 1 | # API Specification Releases 2 | 3 | ## Goal 4 | 5 | Our goal is to allow collaboration on definition of the API specification for a StarkNet full node, while at the same time provide a reliable framework for understanding existing releases and ongoing work. 6 | This document outlines how releases for the node API specification is managed and released. 7 | 8 | ## General Scheme 9 | 10 | The api release follows a sequence of 3 phases: Draft -> Release Candidate (RC) -> Recommendation 11 | 12 | Where the phases are defined as: 13 | 14 | - Draft: the API specification is a work in progress, expect major changes and additions (types, methods added/changed/removed). 15 | - Generally there should be only one draft at a given time. 16 | - Release Candidate: 17 | - Specification is ready to be implemented or has at least 1 implementation. 18 | - Expect minor changes. No addition/removal of methods. 19 | - There may be several release candidates (rc1, rc2, ...) with relevant changes. 20 | - Recommendation: an agreed version of the specification, expected to be implemented and operated by nodes. 21 | 22 | The tip of the master branch represents the current working draft. 23 | Suggestions to API specification changes are made as pull requests on the master branch. 24 | 25 | ### Transition Between Phases 26 | 27 | - Draft -> RC: 28 | - All changes from previous release discussed, no pending items. 29 | - No existing suggestions (PRs) for major changes. 30 | - RC -> Recommendation: 31 | - A minimum of 7 working days passed from publication of latest release candidate. 32 | - No open discussion points. 33 | 34 | ## Version Numbering 35 | 36 | Releases follow [semantic versioning](https://semver.org) for version tags. 37 | We use `rc`_i_ ( i = 1,2,...) suffix to qualify different release candidates. 38 | No suffix to a version means it's the recommendation version. 39 | 40 | ## Different Specification Documents 41 | 42 | A release number is relevant to all API specification documents at the same time. In other words, they are all considered a single document. 43 | 44 | When updating the specification version, change the `"version"` property in all specification files. Also update the version in `package*.json` files by running: 45 | 46 | ``` 47 | npm version --no-git-tag-version 48 | ``` 49 | 50 | ## Technical Implementation 51 | 52 | We use github releases on this repo to publish releases. 53 | 54 | Git tags on the master branch signify releases. 55 | Tags are structured as "v _major.minor.patch[-suffix]_" 56 | where: 57 | 58 | 1. major, minor, patch are non negative integers as defined for semantic version. 59 | 2. _suffix_ is rc1,rc2, ...; qualifying release candidates. 60 | 61 | Examples for tags: 62 | 63 | - `v0.1.0-rc1`: release candidate 1 of version 0.1.0. 64 | - `v1.0.0`: First recommended release of the API 65 | - `v1.1.0-rc2`: 2nd release candidate for the release that has non-breaking changes over the first recommended release. 66 | -------------------------------------------------------------------------------- /validate.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const { 4 | parseOpenRPCDocument, 5 | validateOpenRPCDocument, 6 | } = require("@open-rpc/schema-utils-js"); 7 | const Dereferencer = require("@json-schema-tools/dereferencer"); 8 | const fs = require("fs-extra"); 9 | 10 | async function runValidation(filename) { 11 | try { 12 | let docToParse = await fileContentAsJSON(filename); 13 | let docToParseWithExternalRefs = await fetchExternalRefsFor(docToParse); 14 | let dereffedDoc = await derefAll(docToParseWithExternalRefs); 15 | 16 | let doc = await parseOpenRPCDocument(dereffedDoc, { dereference: true }); 17 | 18 | const validation = validateOpenRPCDocument(doc); 19 | if (validation !== true) { 20 | const errors = validation; 21 | console.error(errors.name); 22 | console.error(errors.message); 23 | process.exit(1); 24 | } 25 | } catch (exn) { 26 | console.error("Error in", filename); 27 | console.error("\t", exn && exn.message); 28 | process.exit(2); 29 | } 30 | 31 | console.log("Ok!"); 32 | } 33 | 34 | /** 35 | * Given a JSON document with an OpenRPC schema, fetch all references pointing to schemas in external files, 36 | * and add them to the schemas in this document. 37 | * @param {JSON} docToParse The OpenRPC document 38 | * @returns The amended objects. 39 | */ 40 | async function fetchExternalRefsFor(docToParse) { 41 | let externalRefs = await externalRefsFrom(docToParse.components.schemas); 42 | let allExternalSchemas = await fetchExternalSchemas(externalRefs); 43 | Object.keys(allExternalSchemas).forEach( 44 | (key) => (docToParse.components.schemas[key] = allExternalSchemas[key]), 45 | ); 46 | 47 | return docToParse; 48 | } 49 | 50 | /** 51 | * For a given dereferencer object, make sure its initial refs don't include refs that are already 52 | * in the ref cache it has. So it won't try to resolve these. 53 | * 54 | * @param {Dereferencer} dereffer The dereferencer object 55 | * @returns The amended dereferencer. 56 | */ 57 | function fixRefs(dereffer) { 58 | dereffer.refs = dereffer.refs.filter( 59 | (r) => dereffer.refCache[r] === undefined, 60 | ); 61 | return dereffer; 62 | } 63 | 64 | /** 65 | * For a given OpenRPC document, resolve all references. 66 | * This takes care of working around a bug with recursive definitions. 67 | * @param {JSON} doc The OpenRPC document 68 | * @returns The document, with the references resolved. 69 | */ 70 | async function derefAll(doc) { 71 | let allSchemas = doc.components.schemas; 72 | let refCacheWithRecursiveRef = { 73 | "#/components/schemas/CONTRACT_EXECUTION_ERROR": 74 | allSchemas["CONTRACT_EXECUTION_ERROR"], 75 | "#/components/schemas/NESTED_CALL": allSchemas["NESTED_CALL"], 76 | }; 77 | let dereferencerOptions = { 78 | refCache: refCacheWithRecursiveRef, 79 | rootSchema: doc, 80 | }; 81 | //resolve all schemas, and remember them 82 | await Promise.all( 83 | Object.keys(allSchemas).map(async (k) => { 84 | let s = allSchemas[k]; 85 | let dereffer = fixRefs(new Dereferencer.default(s, dereferencerOptions)); 86 | allSchemas[k] = await dereffer.resolve(); 87 | return allSchemas[k]; 88 | }), 89 | ); 90 | return doc; 91 | } 92 | 93 | /** 94 | * Retrieve external schema definitions, from other files. 95 | * @param {Map} externalRefs Mapping of schema definitions, pointing to external files. 96 | * @returns The actual referenced schema objects 97 | */ 98 | async function fetchExternalSchemas(externalRefs) { 99 | let externalFilenames = Object.values(externalRefs).map((ref) => 100 | filenameFromExternalRef(ref.value), 101 | ); 102 | let uniqueExtFilenames = [...new Set(externalFilenames)]; 103 | let externalJSONPromises = uniqueExtFilenames 104 | .map((relative) => { 105 | return { key: relative, fullpath: fullPathForRefFile(relative) }; 106 | }) 107 | .map((entry) => 108 | fileContentAsJSON(entry.fullpath).then((c) => { 109 | return { key: entry.key, content: c }; 110 | }), 111 | ); 112 | 113 | let externalJSONs = await Promise.all(externalJSONPromises); 114 | 115 | let ret = {}; 116 | 117 | //collect all schema objects into `ret` and return it. 118 | externalJSONs 119 | .map((entry) => entry.content.components.schemas) 120 | //note: this means that if we have duplicates, the last file will win. not a problem for now. 121 | .forEach((schemaParent) => 122 | Object.keys(schemaParent).forEach((k) => (ret[k] = schemaParent[k])), 123 | ); 124 | 125 | return ret; 126 | } 127 | 128 | /** 129 | * Given a filename, read, parse and return the JSON content of the file. 130 | * @param {String} filename The filename to read the JSON from 131 | * @returns The parsed JS object. 132 | */ 133 | async function fileContentAsJSON(filename) { 134 | let json = await fs.readJson(filename); 135 | return json; 136 | } 137 | 138 | /** 139 | * Given the set of all schemas in an RPC spec document, retrieve those that reference external 140 | * files. 141 | * @param {Map} allSchemas Mapping of schemas from keys to schema definitions 142 | * @returns The external schema references, keyed by their original keys. 143 | */ 144 | async function externalRefsFrom(allSchemas) { 145 | const isExternalRef = (ref) => ref && ref.length > 0 && ref.charAt(0) != "#"; 146 | 147 | let externalKeys = Object.keys(allSchemas).filter( 148 | (k) => 149 | allSchemas[k]["$ref"] !== undefined && 150 | isExternalRef(allSchemas[k]["$ref"]), 151 | ); 152 | return externalKeys.map((k) => { 153 | return { key: k, value: allSchemas[k]["$ref"] }; 154 | }); 155 | } 156 | 157 | /** 158 | * Extract the filename from an external reference 159 | * @param {String} ref The external reference 160 | * @returns The file name the reference refers to. 161 | */ 162 | const filenameFromExternalRef = (ref) => ref.split("#")[0]; 163 | 164 | //TODO: this assumes the script is run in a specific directory relative to the files. 165 | /** 166 | * Given a relative path, retrieve the full path to the relative API. 167 | * Note this assumes the references in the file are relative to the current working directory. 168 | * @param {String} relative The relative path 169 | * @returns The full filesystem path 170 | */ 171 | const fullPathForRefFile = (relative) => `${process.cwd()}/${relative}`; //should canonize this 172 | 173 | let args = process.argv.slice(2); 174 | 175 | if (args.length > 0) { 176 | runValidation(args[0]); 177 | } else console.error("Missing filename"); 178 | -------------------------------------------------------------------------------- /starknet_vs_ethereum_node_apis.md: -------------------------------------------------------------------------------- 1 | # General 2 | 3 | This document provides information to developers who wish to work with StarkNet's node RPC API and 4 | are familiar with Ethereum's RPC API. The document focuses on existing APIs, specifically targeting 5 | distributed application developers. 6 | 7 | As a general rule, the APIs are similar in naming, semantics and conventions. We generally follow 8 | the same methods used in Ethereum's node API and make changes where the technology requires it to 9 | maintain consistency. 10 | 11 | Below you can find a summary of the changes, whether cross-cutting or method-specific. We also 12 | provide a mapping of methods. 13 | 14 | We currently compare Ethereum 1.0 API, as defined [here](https://github.com/ethereum/execution-apis), 15 | and [StarkNet's API](https://github.com/starkware-libs/starknet-specs/blob/master/api/starknet_api_openrpc.json). 16 | 17 | Familiarity with Ethereum and [StarkNet](https://starkware.co/product/starknet/) is assumed herein. 18 | 19 | ## Cross-Cutting Changes 20 | 21 | Some differences are more fundamental and manifest in different API methods. 22 | 23 | **Block and Transaction objects:** Block and transaction objects have a somewhat different structure 24 | compared to Ethereum. These changes are mainly due to different network mechanics, e.g., no proof 25 | of work in StarkNet. 26 | 27 | **Block Tags:** In some cases, the API refers to a block using relative tags that point to a block 28 | in a specific position in the chain or state (latest, earliest, pending). Where applicable, 29 | StarkNet allows referring only to the latest block, using the `latest` tag. 30 | 31 | ## Naming Conventions 32 | 33 | Unless otherwise noted, the method names used are the same method names with a different prefix. 34 | The `eth` prefix is replaced with `starknet`. 35 | 36 | ## Types 37 | 38 | The fundamental data type in StarkNet is a field element. As a corollary, all resulting blocks and 39 | transactions' hashes are also field elements. When referring to a block/transaction type or an 40 | address, StarkNet uses a field element, not a 256-bit number. 41 | 42 | The field element type in StarkNet is based on the field in the underlying Cairo VM. 43 | In other words, a value x of a field element type is an integer in the range of `0≤x
  • Doesn’t have the include transactions input.
  • The result key is "result".
  • | 54 | | eth_getBlockTransactionCountByHash | starknet_getBlockTransactionCountByHash |
    • Supports also "latest" block tag as input
    • The result is always an integer
    • The response key is "result".
    • May return an error for invalid block hash.
    | 55 | | eth_getBlockTransactionCountByNumber | starknet_getBlockTransactionCountByNumber |
    • Block number input is given as a decimal integer.
    • The result key is "result".
    • May return an error for invalid block number.
    | 56 | | eth_getTransactionByBlockHashAndIndex | starknet_getTransactionByBlockHashAndIndex |
  • The Index is given as a decimal integer. | 57 | | eth_getTransactionByBlockNumberAndIndex | starknet_getTransactionByBlockNumberAndIndex |
  • The index is given as a decimal integer. | 58 | | eth_pendingTransactions | starknet_pendingTransactions |
    • The result key is "result".
    • Will not return market fee parameters.
    | 59 | | eth_getBlockByHash | starknet_getBlockByHash |
    • Doesn’t have the include transactions input.
    • The result key is "result".
    | 60 | | eth_protocolVersion | starknet_protocolVersion | 61 | | eth_syncing | starknet_syncing |
  • The result will not include known and pulled states | 62 | | eth_getStorageAt | starknet_getStorageAt |
    • Accepts a block hash instead of a block number
    • The result key is "result".
    • The result type is a field element.
    • Will return errors for invalid contract or storage keys.
    | 63 | | eth_getTransactionByHash | starknet_getTransactionByHash |
    • Input key is "transaction_hash".
    • The result key is "result".
    • Will not return null.
    • Will return an error for an invalid transaction hash.
    | 64 | | eth_getTransactionReceipt | starknet_getTransactionReceipt |
    • Input key is "transaction_hash".
    • The result key is "result".
    • Will not return null.
    • Will return an error for an invalid transaction hash.
    | 65 | | eth_getCode | starknet_getCode |
    • The input key is "contract_address".
    • Does not accept a block number.
    • Will return byte code (field elements) and ABI.
    • Will return an error for an invalid contract address.
    | 66 | | eth_call | starknet_call |
    • Input transaction is different.
    • Input block designated by hash.
    • Will return errors for invalid contract address | message selector | call data | or general error.
    | 67 | -------------------------------------------------------------------------------- /api/starknet_write_api.json: -------------------------------------------------------------------------------- 1 | { 2 | "openrpc": "1.0.0-rc1", 3 | "info": { 4 | "version": "0.10.0", 5 | "title": "StarkNet Node Write API", 6 | "license": {} 7 | }, 8 | "servers": [], 9 | "methods": [ 10 | { 11 | "name": "starknet_addInvokeTransaction", 12 | "summary": "Submit a new transaction to be added to the chain", 13 | "params": [ 14 | { 15 | "name": "invoke_transaction", 16 | "description": "The information needed to invoke the function (or account, for version 1 transactions)", 17 | "required": true, 18 | "schema": { 19 | "$ref": "#/components/schemas/BROADCASTED_INVOKE_TXN" 20 | } 21 | } 22 | ], 23 | "result": { 24 | "name": "result", 25 | "description": "The result of the transaction submission", 26 | "schema": { 27 | "type": "object", 28 | "properties": { 29 | "transaction_hash": { 30 | "title": "The hash of the invoke transaction", 31 | "$ref": "#/components/schemas/TXN_HASH" 32 | } 33 | }, 34 | "required": ["transaction_hash"] 35 | } 36 | }, 37 | "errors": [ 38 | { 39 | "$ref": "#/components/errors/INSUFFICIENT_ACCOUNT_BALANCE" 40 | }, 41 | { 42 | "$ref": "#/components/errors/INSUFFICIENT_RESOURCES_FOR_VALIDATE" 43 | }, 44 | { 45 | "$ref": "#/components/errors/INVALID_TRANSACTION_NONCE" 46 | }, 47 | { 48 | "$ref": "#/components/errors/REPLACEMENT_TRANSACTION_UNDERPRICED" 49 | }, 50 | { 51 | "$ref": "#/components/errors/FEE_BELOW_MINIMUM" 52 | }, 53 | { 54 | "$ref": "#/components/errors/VALIDATION_FAILURE" 55 | }, 56 | { 57 | "$ref": "#/components/errors/NON_ACCOUNT" 58 | }, 59 | { 60 | "$ref": "#/components/errors/DUPLICATE_TX" 61 | }, 62 | { 63 | "$ref": "#/components/errors/UNSUPPORTED_TX_VERSION" 64 | }, 65 | { 66 | "$ref": "#/components/errors/UNEXPECTED_ERROR" 67 | } 68 | ] 69 | }, 70 | { 71 | "name": "starknet_addDeclareTransaction", 72 | "summary": "Submit a new class declaration transaction", 73 | "params": [ 74 | { 75 | "name": "declare_transaction", 76 | "description": "Declare transaction required to declare a new class on Starknet", 77 | "required": true, 78 | "schema": { 79 | "title": "Declare transaction", 80 | "$ref": "#/components/schemas/BROADCASTED_DECLARE_TXN" 81 | } 82 | } 83 | ], 84 | "result": { 85 | "name": "result", 86 | "description": "The result of the transaction submission", 87 | "schema": { 88 | "type": "object", 89 | "properties": { 90 | "transaction_hash": { 91 | "title": "The hash of the declare transaction", 92 | "$ref": "#/components/schemas/TXN_HASH" 93 | }, 94 | "class_hash": { 95 | "title": "The hash of the declared class", 96 | "$ref": "#/components/schemas/FELT" 97 | } 98 | }, 99 | "required": ["transaction_hash", "class_hash"] 100 | } 101 | }, 102 | "errors": [ 103 | { 104 | "$ref": "#/components/errors/CLASS_ALREADY_DECLARED" 105 | }, 106 | { 107 | "$ref": "#/components/errors/COMPILATION_FAILED" 108 | }, 109 | { 110 | "$ref": "#/components/errors/COMPILED_CLASS_HASH_MISMATCH" 111 | }, 112 | { 113 | "$ref": "#/components/errors/INSUFFICIENT_ACCOUNT_BALANCE" 114 | }, 115 | { 116 | "$ref": "#/components/errors/INSUFFICIENT_RESOURCES_FOR_VALIDATE" 117 | }, 118 | { 119 | "$ref": "#/components/errors/INVALID_TRANSACTION_NONCE" 120 | }, 121 | { 122 | "$ref": "#/components/errors/REPLACEMENT_TRANSACTION_UNDERPRICED" 123 | }, 124 | { 125 | "$ref": "#/components/errors/FEE_BELOW_MINIMUM" 126 | }, 127 | { 128 | "$ref": "#/components/errors/VALIDATION_FAILURE" 129 | }, 130 | { 131 | "$ref": "#/components/errors/NON_ACCOUNT" 132 | }, 133 | { 134 | "$ref": "#/components/errors/DUPLICATE_TX" 135 | }, 136 | { 137 | "$ref": "#/components/errors/CONTRACT_CLASS_SIZE_IS_TOO_LARGE" 138 | }, 139 | { 140 | "$ref": "#/components/errors/UNSUPPORTED_TX_VERSION" 141 | }, 142 | { 143 | "$ref": "#/components/errors/UNSUPPORTED_CONTRACT_CLASS_VERSION" 144 | }, 145 | { 146 | "$ref": "#/components/errors/UNEXPECTED_ERROR" 147 | } 148 | ] 149 | }, 150 | { 151 | "name": "starknet_addDeployAccountTransaction", 152 | "summary": "Submit a new deploy account transaction", 153 | "params": [ 154 | { 155 | "name": "deploy_account_transaction", 156 | "description": "The deploy account transaction", 157 | "required": true, 158 | "schema": { 159 | "$ref": "#/components/schemas/BROADCASTED_DEPLOY_ACCOUNT_TXN" 160 | } 161 | } 162 | ], 163 | "result": { 164 | "name": "result", 165 | "description": "The result of the transaction submission", 166 | "schema": { 167 | "type": "object", 168 | "properties": { 169 | "transaction_hash": { 170 | "title": "The hash of the deploy transaction", 171 | "$ref": "#/components/schemas/TXN_HASH" 172 | }, 173 | "contract_address": { 174 | "title": "The address of the new contract", 175 | "$ref": "#/components/schemas/FELT" 176 | } 177 | }, 178 | "required": ["transaction_hash", "contract_address"] 179 | } 180 | }, 181 | "errors": [ 182 | { 183 | "$ref": "#/components/errors/INSUFFICIENT_ACCOUNT_BALANCE" 184 | }, 185 | { 186 | "$ref": "#/components/errors/INSUFFICIENT_RESOURCES_FOR_VALIDATE" 187 | }, 188 | { 189 | "$ref": "#/components/errors/INVALID_TRANSACTION_NONCE" 190 | }, 191 | { 192 | "$ref": "#/components/errors/REPLACEMENT_TRANSACTION_UNDERPRICED" 193 | }, 194 | { 195 | "$ref": "#/components/errors/FEE_BELOW_MINIMUM" 196 | }, 197 | { 198 | "$ref": "#/components/errors/VALIDATION_FAILURE" 199 | }, 200 | { 201 | "$ref": "#/components/errors/NON_ACCOUNT" 202 | }, 203 | { 204 | "$ref": "./api/starknet_api_openrpc.json#/components/errors/CLASS_HASH_NOT_FOUND" 205 | }, 206 | { 207 | "$ref": "#/components/errors/DUPLICATE_TX" 208 | }, 209 | { 210 | "$ref": "#/components/errors/UNSUPPORTED_TX_VERSION" 211 | }, 212 | { 213 | "$ref": "#/components/errors/UNEXPECTED_ERROR" 214 | } 215 | ] 216 | } 217 | ], 218 | "components": { 219 | "contentDescriptors": {}, 220 | "schemas": { 221 | "NUM_AS_HEX": { 222 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/NUM_AS_HEX" 223 | }, 224 | "SIGNATURE": { 225 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/SIGNATURE" 226 | }, 227 | "FELT": { 228 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/FELT" 229 | }, 230 | "TXN_HASH": { 231 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/TXN_HASH" 232 | }, 233 | "BROADCASTED_INVOKE_TXN": { 234 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/BROADCASTED_INVOKE_TXN" 235 | }, 236 | "BROADCASTED_DECLARE_TXN": { 237 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/BROADCASTED_DECLARE_TXN" 238 | }, 239 | "BROADCASTED_DEPLOY_ACCOUNT_TXN": { 240 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/BROADCASTED_DEPLOY_ACCOUNT_TXN" 241 | }, 242 | "FUNCTION_CALL": { 243 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/FUNCTION_CALL" 244 | } 245 | }, 246 | "errors": { 247 | "CLASS_ALREADY_DECLARED": { 248 | "code": 51, 249 | "message": "Class already declared" 250 | }, 251 | "INVALID_TRANSACTION_NONCE": { 252 | "code": 52, 253 | "message": "Invalid transaction nonce", 254 | "data": "string" 255 | }, 256 | "INSUFFICIENT_RESOURCES_FOR_VALIDATE": { 257 | "code": 53, 258 | "message": "The transaction's resources don't cover validation or the minimal transaction fee" 259 | }, 260 | "INSUFFICIENT_ACCOUNT_BALANCE": { 261 | "code": 54, 262 | "message": "Account balance is smaller than the transaction's maximal fee (calculated as the sum of each resource's limit x max price)" 263 | }, 264 | "VALIDATION_FAILURE": { 265 | "code": 55, 266 | "message": "Account validation failed", 267 | "data": "string" 268 | }, 269 | "COMPILATION_FAILED": { 270 | "code": 56, 271 | "message": "Compilation failed", 272 | "data": "string" 273 | }, 274 | "CONTRACT_CLASS_SIZE_IS_TOO_LARGE": { 275 | "code": 57, 276 | "message": "Contract class size is too large" 277 | }, 278 | "NON_ACCOUNT": { 279 | "code": 58, 280 | "message": "Sender address is not an account contract" 281 | }, 282 | "DUPLICATE_TX": { 283 | "code": 59, 284 | "message": "A transaction with the same hash already exists in the mempool" 285 | }, 286 | "COMPILED_CLASS_HASH_MISMATCH": { 287 | "code": 60, 288 | "message": "the compiled class hash did not match the one supplied in the transaction" 289 | }, 290 | "UNSUPPORTED_TX_VERSION": { 291 | "code": 61, 292 | "message": "the transaction version is not supported" 293 | }, 294 | "UNSUPPORTED_CONTRACT_CLASS_VERSION": { 295 | "code": 62, 296 | "message": "the contract class version is not supported" 297 | }, 298 | "UNEXPECTED_ERROR": { 299 | "code": 63, 300 | "message": "An unexpected error occurred", 301 | "data": "string" 302 | }, 303 | "REPLACEMENT_TRANSACTION_UNDERPRICED": { 304 | "code": 64, 305 | "message": "Replacement transaction is underpriced" 306 | }, 307 | "FEE_BELOW_MINIMUM": { 308 | "code": 65, 309 | "message": "Transaction fee below minimum" 310 | } 311 | } 312 | } 313 | } 314 | -------------------------------------------------------------------------------- /api/starknet_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "openrpc": "1.0.0", 3 | "info": { 4 | "version": "0.10.0", 5 | "title": "Starknet ABI specs" 6 | }, 7 | "methods": [], 8 | "components": { 9 | "contentDescriptors": { 10 | "ABI": { 11 | "name": "abi", 12 | "required": true, 13 | "description": "A Cairo v>=2 contract ABI", 14 | "schema": { 15 | "$ref": "#/components/schemas/ABI" 16 | } 17 | } 18 | }, 19 | "schemas": { 20 | "ABI": { 21 | "type": "array", 22 | "items": { 23 | "oneOf": [ 24 | { 25 | "title": "function", 26 | "$ref": "#/components/schemas/FUNCTION" 27 | }, 28 | { 29 | "title": "constructor", 30 | "$ref": "#/components/schemas/CONSTRUCTOR" 31 | }, 32 | { 33 | "title": "l1_handler", 34 | "$ref": "#/components/schemas/L1_HANDLER" 35 | }, 36 | { 37 | "title": "event", 38 | "$ref": "#/components/schemas/EVENT" 39 | }, 40 | { 41 | "title": "struct", 42 | "$ref": "#/components/schemas/STRUCT" 43 | }, 44 | { 45 | "title": "enum", 46 | "$ref": "#/components/schemas/ENUM" 47 | }, 48 | { 49 | "title": "interface", 50 | "$ref": "#/components/schemas/INTERFACE" 51 | }, 52 | { 53 | "title": "impl", 54 | "$ref": "#/components/schemas/IMPL" 55 | } 56 | ] 57 | } 58 | }, 59 | "FUNCTION": { 60 | "type": "object", 61 | "title": "function", 62 | "properties": { 63 | "type": { 64 | "title": "abi_entry_type", 65 | "type": "string", 66 | "enum": ["function"] 67 | }, 68 | "name": { 69 | "title": "name", 70 | "description": "the function's name", 71 | "type": "string" 72 | }, 73 | "inputs": { 74 | "type": "array", 75 | "description": "the function's inputs", 76 | "title": "inputs", 77 | "items": { 78 | "type": "object", 79 | "properties": { 80 | "name": { 81 | "title": "name", 82 | "description": "the argument name", 83 | "type": "string" 84 | }, 85 | "type": { 86 | "title": "type", 87 | "description": "the argument type", 88 | "type": "string" 89 | } 90 | }, 91 | "required": ["name", "type"] 92 | } 93 | }, 94 | "outputs": { 95 | "type": "array", 96 | "title": "outputs", 97 | "description": "the function's outputs", 98 | "items": { 99 | "type": "object", 100 | "properties": { 101 | "type": { 102 | "title": "type", 103 | "description": "the output type", 104 | "type": "string" 105 | } 106 | } 107 | } 108 | }, 109 | "state_mutability": { 110 | "title": "state mutability", 111 | "type": "string", 112 | "enum": ["view", "external"] 113 | } 114 | }, 115 | "required": ["type", "name", "inputs", "outputs", "state_mutability"] 116 | }, 117 | "CONSTRUCTOR": { 118 | "type": "object", 119 | "properties": { 120 | "type": { 121 | "title": "abi_entry_type", 122 | "type": "string", 123 | "enum": ["constructor"] 124 | }, 125 | "name": { 126 | "title": "name", 127 | "type": "string", 128 | "description": "the constructor name, currently forced to be `constructor`", 129 | "enum": ["constructor"] 130 | }, 131 | "inputs": { 132 | "type": "array", 133 | "title": "inputs", 134 | "description": "the constructor's inputs", 135 | "items": { 136 | "type": "object", 137 | "properties": { 138 | "name": { 139 | "title": "name", 140 | "description": "the argument name", 141 | "type": "string" 142 | }, 143 | "type": { 144 | "title": "type", 145 | "description": "the argument type", 146 | "type": "string" 147 | } 148 | } 149 | } 150 | } 151 | }, 152 | "required": ["type", "name", "inputs"] 153 | }, 154 | "L1_HANDLER": { 155 | "type": "object", 156 | "title": "function", 157 | "properties": { 158 | "type": { 159 | "title": "abi_entry_type", 160 | "type": "string", 161 | "enum": ["l1_handler"] 162 | }, 163 | "name": { 164 | "title": "name", 165 | "description": "the l1_handler name", 166 | "type": "string" 167 | }, 168 | "inputs": { 169 | "type": "array", 170 | "description": "the l1_handler inputs", 171 | "title": "inputs", 172 | "items": { 173 | "type": "object", 174 | "properties": { 175 | "name": { 176 | "title": "name", 177 | "description": "the argument name", 178 | "type": "string" 179 | }, 180 | "type": { 181 | "title": "type", 182 | "description": "the argument type", 183 | "type": "string" 184 | } 185 | }, 186 | "required": ["name", "type"] 187 | } 188 | }, 189 | "outputs": { 190 | "type": "array", 191 | "title": "outputs", 192 | "items": { 193 | "type": "object", 194 | "properties": { 195 | "type": { 196 | "title": "type", 197 | "description": "the output type", 198 | "type": "string" 199 | } 200 | } 201 | } 202 | }, 203 | "state_mutability": { 204 | "title": "state mutability", 205 | "type": "string", 206 | "enum": ["view", "external"] 207 | } 208 | }, 209 | "required": ["type", "name", "inputs", "outputs", "state_mutability"] 210 | }, 211 | "EVENT": { 212 | "title": "event", 213 | "allOf": [ 214 | { 215 | "type": "object", 216 | "properties": { 217 | "type": { 218 | "title": "abi_entry_type", 219 | "type": "string", 220 | "enum": ["event"] 221 | }, 222 | "name": { 223 | "title": "name", 224 | "description": "the name of the (Cairo) type associated with the event", 225 | "type": "string" 226 | } 227 | }, 228 | "required": ["type", "name"] 229 | }, 230 | { 231 | "oneOf": [ 232 | { 233 | "$ref": "#/components/schemas/ENUM_EVENT" 234 | }, 235 | { 236 | "$ref": "#/components/schemas/STRUCT_EVENT" 237 | } 238 | ] 239 | } 240 | ] 241 | }, 242 | "STRUCT_EVENT": { 243 | "type": "object", 244 | "properties": { 245 | "kind": { 246 | "title": "kind", 247 | "description": "determines the serialization of the corresponding type", 248 | "type": "string", 249 | "enum": ["struct"] 250 | }, 251 | "members": { 252 | "type": "array", 253 | "description": "struct members", 254 | "title": "members", 255 | "items": { 256 | "$ref": "#/components/schemas/EVENT_FIELD" 257 | } 258 | } 259 | }, 260 | "required": ["kind", "members"] 261 | }, 262 | "ENUM_EVENT": { 263 | "type": "object", 264 | "properties": { 265 | "kind": { 266 | "title": "kind", 267 | "description": "determines the serialization of the corresponding type", 268 | "type": "string", 269 | "enum": ["enum"] 270 | }, 271 | "variants": { 272 | "type": "array", 273 | "title": "variants", 274 | "description": "enum variants", 275 | "items": { 276 | "$ref": "#/components/schemas/EVENT_FIELD" 277 | } 278 | } 279 | }, 280 | "required": ["kind", "variants"] 281 | }, 282 | "STRUCT": { 283 | "type": "object", 284 | "properties": { 285 | "type": { 286 | "title": "abi_entry_type", 287 | "type": "string", 288 | "enum": ["struct"] 289 | }, 290 | "name": { 291 | "title": "name", 292 | "description": "the (Cairo) struct name, including namespacing", 293 | "type": "string" 294 | }, 295 | "members": { 296 | "type": "array", 297 | "title": "members", 298 | "description": "the struct members", 299 | "items": { 300 | "type": "object", 301 | "properties": { 302 | "name": { 303 | "title": "name", 304 | "description": "name of the struct member", 305 | "type": "string" 306 | }, 307 | "type": { 308 | "title": "type", 309 | "description": "the member type, including namespacing", 310 | "type": "string" 311 | } 312 | }, 313 | "required": ["name", "type"] 314 | } 315 | } 316 | }, 317 | "required": ["type", "name", "members"] 318 | }, 319 | "ENUM": { 320 | "type": "object", 321 | "properties": { 322 | "type": { 323 | "title": "abi_entry_type", 324 | "type": "string", 325 | "enum": ["enum"] 326 | }, 327 | "name": { 328 | "title": "name", 329 | "description": "the (Cairo) enum name, including namespacing", 330 | "type": "string" 331 | }, 332 | "variants": { 333 | "type": "array", 334 | "title": "variants", 335 | "items": { 336 | "type": "object", 337 | "properties": { 338 | "name": { 339 | "title": "name", 340 | "description": "name of the enum variant", 341 | "type": "string" 342 | }, 343 | "type": { 344 | "title": "type", 345 | "description": " the variant type, including namespacing", 346 | "type": "string" 347 | } 348 | }, 349 | "required": ["name", "type"] 350 | } 351 | } 352 | }, 353 | "required": ["type", "name", "variants"] 354 | }, 355 | "INTERFACE": { 356 | "type": "object", 357 | "title": "interface", 358 | "properties": { 359 | "type": { 360 | "title": "abi_entry_type", 361 | "type": "string", 362 | "enum": ["interface"] 363 | }, 364 | "name": { 365 | "title": "name", 366 | "description": "the name of the trait which defines the contract interface", 367 | "type": "string" 368 | }, 369 | "items": { 370 | "type": "array", 371 | "items": { 372 | "$ref": "#/components/schemas/FUNCTION" 373 | } 374 | } 375 | }, 376 | "required": ["type", "name", "items"] 377 | }, 378 | "IMPL": { 379 | "type": "object", 380 | "title": "impl", 381 | "properties": { 382 | "type": { 383 | "title": "abi_entry_type", 384 | "type": "string", 385 | "enum": ["impl"] 386 | }, 387 | "name": { 388 | "title": "name", 389 | "description": "the name of an impl containing contract entry points", 390 | "type": "string" 391 | }, 392 | "interface_name": { 393 | "description": "the name of the trait corresponding to this impl", 394 | "title": "interface name", 395 | "type": "string" 396 | } 397 | }, 398 | "required": ["type", "name", "interface_name"] 399 | }, 400 | "EVENT_KIND": { 401 | "type": "string", 402 | "enum": ["struct", "enum"] 403 | }, 404 | "EVENT_FIELD": { 405 | "title": "member", 406 | "type": "object", 407 | "properties": { 408 | "name": { 409 | "title": "name", 410 | "description": "the name of the struct member or enum variant", 411 | "type": "string" 412 | }, 413 | "type": { 414 | "description": "the Cairo type of the member or variant, including namespacing", 415 | "title": "type", 416 | "type": "string" 417 | }, 418 | "kind": { 419 | "title": "kind", 420 | "description": "specifies how the field should be serialized, via the starknet::Event trait or the serde::Serde trait", 421 | "type": "string", 422 | "enum": ["key", "data", "nested", "flat"] 423 | } 424 | }, 425 | "required": ["name", "type", "kind"] 426 | } 427 | } 428 | } 429 | } 430 | -------------------------------------------------------------------------------- /api/starknet_ws_api.json: -------------------------------------------------------------------------------- 1 | { 2 | "openrpc": "1.3.2", 3 | "info": { 4 | "version": "0.10.0", 5 | "title": "StarkNet WebSocket RPC API", 6 | "license": {} 7 | }, 8 | "methods": [ 9 | { 10 | "name": "starknet_subscribeNewHeads", 11 | "summary": "New block headers subscription", 12 | "description": "Creates a WebSocket stream which will fire events for new block headers", 13 | "params": [ 14 | { 15 | "name": "block_id", 16 | "summary": "The block to get notifications from, default is latest, limited to 1024 blocks back", 17 | "required": false, 18 | "schema": { 19 | "$ref": "#/components/schemas/SUBSCRIPTION_BLOCK_ID" 20 | } 21 | } 22 | ], 23 | "result": { 24 | "name": "subscription_id", 25 | "schema": { 26 | "$ref": "#/components/schemas/SUBSCRIPTION_ID" 27 | } 28 | }, 29 | "errors": [ 30 | { 31 | "$ref": "#/components/errors/TOO_MANY_BLOCKS_BACK" 32 | }, 33 | { 34 | "$ref": "./api/starknet_api_openrpc.json#/components/errors/BLOCK_NOT_FOUND" 35 | } 36 | ] 37 | }, 38 | { 39 | "name": "starknet_subscriptionNewHeads", 40 | "summary": "New block headers notification", 41 | "description": "Notification to the client of a new block header", 42 | "params": [ 43 | { 44 | "name": "subscription_id", 45 | "schema": { 46 | "$ref": "#/components/schemas/SUBSCRIPTION_ID" 47 | } 48 | }, 49 | { 50 | "name": "result", 51 | "schema": { 52 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/BLOCK_HEADER" 53 | } 54 | } 55 | ], 56 | "errors": [] 57 | }, 58 | { 59 | "name": "starknet_subscribeEvents", 60 | "summary": "Events subscription", 61 | "description": "Creates a WebSocket stream which will fire events for new Starknet events with applied filters. Events are emitted for all events from the specified block_id, up to the latest block. If PRE_CONFIRMED finality status is provided, events might appear multiple times, for each finality status update. If a single event is required, ACCEPTED_ON_L2 must be selected (the default).", 62 | "params": [ 63 | { 64 | "name": "from_address", 65 | "summary": "Filter events by from_address which emitted the event", 66 | "required": false, 67 | "schema": { 68 | "$ref": "#/components/schemas/ADDRESS" 69 | } 70 | }, 71 | { 72 | "name": "keys", 73 | "summary": "The keys to filter events by", 74 | "required": false, 75 | "schema": { 76 | "title": "event keys", 77 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/EVENT_KEYS" 78 | } 79 | }, 80 | { 81 | "name": "block_id", 82 | "summary": "The block to get notifications from, default is latest, limited to 1024 blocks back", 83 | "required": false, 84 | "schema": { 85 | "$ref": "#/components/schemas/SUBSCRIPTION_BLOCK_ID" 86 | } 87 | }, 88 | { 89 | "name": "finality_status", 90 | "summary": "The finality status of the most recent events to include, default is ACCEPTED_ON_L2. If PRE_CONFIRMED finality is selected, events might appear multiple times, once for each finality status update.", 91 | "required": false, 92 | "schema": { 93 | "type": "string", 94 | "enum": ["PRE_CONFIRMED", "ACCEPTED_ON_L2"] 95 | } 96 | } 97 | ], 98 | "result": { 99 | "name": "subscription_id", 100 | "schema": { 101 | "$ref": "#/components/schemas/SUBSCRIPTION_ID" 102 | } 103 | }, 104 | "errors": [ 105 | { 106 | "$ref": "./api/starknet_api_openrpc.json#/components/errors/TOO_MANY_KEYS_IN_FILTER" 107 | }, 108 | { 109 | "$ref": "#/components/errors/TOO_MANY_BLOCKS_BACK" 110 | }, 111 | { 112 | "$ref": "./api/starknet_api_openrpc.json#/components/errors/BLOCK_NOT_FOUND" 113 | } 114 | ] 115 | }, 116 | { 117 | "name": "starknet_subscriptionEvents", 118 | "summary": "New events notification", 119 | "description": "Notification to the client of a new event. The event also includes the finality status of the transaction emitting the event", 120 | "params": [ 121 | { 122 | "name": "subscription_id", 123 | "schema": { 124 | "$ref": "#/components/schemas/SUBSCRIPTION_ID" 125 | } 126 | }, 127 | { 128 | "name": "result", 129 | "schema": { 130 | "allOf": [ 131 | { 132 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/EMITTED_EVENT" 133 | }, 134 | { 135 | "type": "object", 136 | "properties": { 137 | "finality_status": { 138 | "description": "Finality status of the transaction", 139 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/TXN_FINALITY_STATUS" 140 | } 141 | }, 142 | "required": ["finality_status"] 143 | } 144 | ] 145 | } 146 | } 147 | ], 148 | "errors": [] 149 | }, 150 | { 151 | "name": "starknet_subscribeTransactionStatus", 152 | "summary": "Transaction Status subscription", 153 | "description": "Creates a WebSocket stream which at first fires an event with the current known transaction status, followed by events for every transaction status update", 154 | "params": [ 155 | { 156 | "name": "transaction_hash", 157 | "summary": "The transaction hash to fetch status updates for", 158 | "required": true, 159 | "schema": { 160 | "$ref": "#/components/schemas/FELT" 161 | } 162 | } 163 | ], 164 | "result": { 165 | "name": "subscription_id", 166 | "schema": { 167 | "$ref": "#/components/schemas/SUBSCRIPTION_ID" 168 | } 169 | }, 170 | "errors": [] 171 | }, 172 | { 173 | "name": "starknet_subscriptionTransactionStatus", 174 | "summary": "New transaction status notification", 175 | "description": "Notification to the client of a new transaction status", 176 | "params": [ 177 | { 178 | "name": "subscription_id", 179 | "schema": { 180 | "$ref": "#/components/schemas/SUBSCRIPTION_ID" 181 | } 182 | }, 183 | { 184 | "name": "result", 185 | "schema": { 186 | "$ref": "#/components/schemas/NEW_TXN_STATUS" 187 | } 188 | } 189 | ], 190 | "errors": [] 191 | }, 192 | { 193 | "name": "starknet_subscribeNewTransactionReceipts", 194 | "summary": "New transactions receipts subscription", 195 | "description": "Creates a WebSocket stream which will fire events when new transaction receipts are created. The endpoint receives a vector of finality statuses. An event is fired for each finality status update. It is possible for receipts for pre-confirmed transactions to be received multiple times, or not at all.", 196 | "params": [ 197 | { 198 | "name": "finality_status", 199 | "summary": "A vector of finality statuses to receive updates for, default is [ACCEPTED_ON_L2]", 200 | "required": false, 201 | "schema": { 202 | "type": "array", 203 | "items": { 204 | "allOf": [ 205 | { 206 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/TXN_FINALITY_STATUS" 207 | }, 208 | { 209 | "not": { 210 | "type": "string", 211 | "enum": ["ACCEPTED_ON_L1"] 212 | } 213 | } 214 | ] 215 | } 216 | } 217 | }, 218 | { 219 | "name": "sender_address", 220 | "summary": "Filter transaction receipts to only include transactions sent by the specified addresses", 221 | "required": false, 222 | "schema": { 223 | "type": "array", 224 | "items": { 225 | "$ref": "#/components/schemas/ADDRESS" 226 | } 227 | } 228 | } 229 | ], 230 | "result": { 231 | "name": "subscription_id", 232 | "schema": { 233 | "$ref": "#/components/schemas/SUBSCRIPTION_ID" 234 | } 235 | }, 236 | "errors": [ 237 | { 238 | "$ref": "#/components/errors/TOO_MANY_ADDRESSES_IN_FILTER" 239 | } 240 | ] 241 | }, 242 | { 243 | "name": "starknet_subscriptionNewTransactionReceipts", 244 | "summary": "New transaction receipt notification", 245 | "description": "Notification to the client of a new transaction receipt, with its current finality status", 246 | "params": [ 247 | { 248 | "name": "subscription_id", 249 | "schema": { 250 | "$ref": "#/components/schemas/SUBSCRIPTION_ID" 251 | } 252 | }, 253 | { 254 | "name": "result", 255 | "description": "A transaction receipt", 256 | "schema": { 257 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/TXN_RECEIPT_WITH_BLOCK_INFO" 258 | } 259 | } 260 | ], 261 | "errors": [] 262 | }, 263 | { 264 | "name": "starknet_subscribeNewTransactions", 265 | "summary": "New transactions subscription", 266 | "description": "Creates a WebSocket stream which will fire events when new transaction are created. The endpoint receives a vector of finality statuses. An event is fired for each finality status update. It is possible for events for pre-confirmed and candidate transactions to be received multiple times, or not at all.", 267 | "params": [ 268 | { 269 | "name": "finality_status", 270 | "summary": "A vector of finality statuses to receive updates for, default is [ACCEPTED_ON_L2]", 271 | "required": false, 272 | "schema": { 273 | "type": "array", 274 | "items": { 275 | "$ref": "#/components/schemas/TXN_STATUS_WITHOUT_L1" 276 | } 277 | } 278 | }, 279 | { 280 | "name": "sender_address", 281 | "summary": "Filter to only include transactions sent by the specified addresses", 282 | "required": false, 283 | "schema": { 284 | "type": "array", 285 | "items": { 286 | "$ref": "#/components/schemas/ADDRESS" 287 | } 288 | } 289 | } 290 | ], 291 | "result": { 292 | "name": "subscription_id", 293 | "schema": { 294 | "$ref": "#/components/schemas/SUBSCRIPTION_ID" 295 | } 296 | }, 297 | "errors": [ 298 | { 299 | "$ref": "#/components/errors/TOO_MANY_ADDRESSES_IN_FILTER" 300 | } 301 | ] 302 | }, 303 | { 304 | "name": "starknet_subscriptionNewTransaction", 305 | "summary": "New transaction notification", 306 | "description": "Notification to the client of a new transaction, with its current finality status", 307 | "params": [ 308 | { 309 | "name": "subscription_id", 310 | "schema": { 311 | "$ref": "#/components/schemas/SUBSCRIPTION_ID" 312 | } 313 | }, 314 | { 315 | "name": "result", 316 | "description": "A transaction and its current finality status", 317 | "schema": { 318 | "allOf": [ 319 | { 320 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/TXN_WITH_HASH" 321 | }, 322 | { 323 | "type": "object", 324 | "properties": { 325 | "finality_status": { 326 | "description": "Finality status of the transaction", 327 | "$ref": "#/components/schemas/TXN_STATUS_WITHOUT_L1" 328 | } 329 | }, 330 | "required": ["finality_status"] 331 | } 332 | ] 333 | } 334 | } 335 | ], 336 | "errors": [] 337 | }, 338 | { 339 | "name": "starknet_subscriptionReorg", 340 | "description": "Notifies the subscriber of a reorganization of the chain", 341 | "summary": "Can be received from subscribing to newHeads, Events, TransactionStatus, NewTransactionReceipts, NewTransactions", 342 | "params": [ 343 | { 344 | "name": "subscription_id", 345 | "schema": { 346 | "$ref": "#/components/schemas/SUBSCRIPTION_ID" 347 | } 348 | }, 349 | { 350 | "name": "result", 351 | "schema": { 352 | "$ref": "#/components/schemas/REORG_DATA" 353 | } 354 | } 355 | ] 356 | }, 357 | { 358 | "name": "starknet_unsubscribe", 359 | "summary": "Closes a websocket subscription", 360 | "description": "Close a previously opened ws stream, with the corresponding subscription id", 361 | "params": [ 362 | { 363 | "name": "subscription_id", 364 | "summary": "The subscription to close", 365 | "required": true, 366 | "schema": { 367 | "$ref": "#/components/schemas/SUBSCRIPTION_ID" 368 | } 369 | } 370 | ], 371 | "result": { 372 | "name": "Unsubscription result", 373 | "description": "True if the unsubscription was successful", 374 | "schema": { 375 | "type": "boolean" 376 | } 377 | }, 378 | "errors": [ 379 | { 380 | "$ref": "#/components/errors/INVALID_SUBSCRIPTION_ID" 381 | } 382 | ] 383 | } 384 | ], 385 | "components": { 386 | "schemas": { 387 | "FELT": { 388 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/FELT" 389 | }, 390 | "ADDRESS": { 391 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/ADDRESS" 392 | }, 393 | "NEW_TXN_STATUS": { 394 | "title": "New transaction Status", 395 | "type": "object", 396 | "properties": { 397 | "transaction_hash": { 398 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/TXN_HASH" 399 | }, 400 | "status": { 401 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/TXN_STATUS_RESULT" 402 | } 403 | } 404 | }, 405 | "SUBSCRIPTION_ID": { 406 | "name": "subscription id", 407 | "description": "An identifier for this subscription stream used to associate events with this subscription.", 408 | "schema": { 409 | "type": "string" 410 | } 411 | }, 412 | "SUBSCRIPTION_BLOCK_ID": { 413 | "title": "Subscription Block id", 414 | "description": "Block hash, number or tag, same as BLOCK_ID, but without 'pre_confirmed' or 'l1_accepted'", 415 | "schema": { 416 | "title": "Block id", 417 | "allOf": [ 418 | { 419 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/BLOCK_ID" 420 | }, 421 | { 422 | "not": { 423 | "type": "string", 424 | "enum": ["l1_accepted", "pre_confirmed"] 425 | } 426 | } 427 | ] 428 | } 429 | }, 430 | "TXN_STATUS_WITHOUT_L1": { 431 | "title": "Transaction status without ACCEPTED_ON_L1", 432 | "description": "Transaction status for new transactions subscription", 433 | "allOf": [ 434 | { 435 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/TXN_STATUS" 436 | }, 437 | { 438 | "not": { 439 | "type": "string", 440 | "enum": ["ACCEPTED_ON_L1"] 441 | } 442 | } 443 | ] 444 | }, 445 | "REORG_DATA": { 446 | "name": "Reorg Data", 447 | "description": "Data about reorganized blocks, starting and ending block number and hash", 448 | "properties": { 449 | "starting_block_hash": { 450 | "title": "Starting Block Hash", 451 | "description": "Hash of the first known block of the orphaned chain", 452 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/BLOCK_HASH" 453 | }, 454 | "starting_block_number": { 455 | "title": "Starting Block Number", 456 | "description": "Number of the first known block of the orphaned chain", 457 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/BLOCK_NUMBER" 458 | }, 459 | "ending_block_hash": { 460 | "title": "Ending Block", 461 | "description": "The last known block of the orphaned chain", 462 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/BLOCK_HASH" 463 | }, 464 | "ending_block_number": { 465 | "title": "Ending Block Number", 466 | "description": "Number of the last known block of the orphaned chain", 467 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/BLOCK_NUMBER" 468 | } 469 | }, 470 | "required": [ 471 | "starting_block_hash", 472 | "starting_block_number", 473 | "ending_block_hash", 474 | "ending_block_number" 475 | ] 476 | } 477 | }, 478 | "errors": { 479 | "INVALID_SUBSCRIPTION_ID": { 480 | "code": 66, 481 | "message": "Invalid subscription id" 482 | }, 483 | "TOO_MANY_ADDRESSES_IN_FILTER": { 484 | "code": 67, 485 | "message": "Too many addresses in filter sender_address filter" 486 | }, 487 | "TOO_MANY_BLOCKS_BACK": { 488 | "code": 68, 489 | "message": "Cannot go back more than 1024 blocks" 490 | } 491 | } 492 | } 493 | } 494 | -------------------------------------------------------------------------------- /api/starknet_trace_api_openrpc.json: -------------------------------------------------------------------------------- 1 | { 2 | "openrpc": "1.0.0-rc1", 3 | "info": { 4 | "version": "0.10.0", 5 | "title": "StarkNet Trace API", 6 | "license": {} 7 | }, 8 | "servers": [], 9 | "methods": [ 10 | { 11 | "name": "starknet_traceTransaction", 12 | "summary": "For a given executed transaction, return the trace of its execution, including internal calls", 13 | "description": "Returns the execution trace of the transaction designated by the input hash", 14 | "params": [ 15 | { 16 | "name": "transaction_hash", 17 | "summary": "The hash of the transaction to trace", 18 | "required": true, 19 | "schema": { 20 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/TXN_HASH" 21 | } 22 | } 23 | ], 24 | "result": { 25 | "name": "trace", 26 | "description": "The function call trace of the transaction designated by the given hash", 27 | "schema": { 28 | "$ref": "#/components/schemas/TRANSACTION_TRACE" 29 | } 30 | }, 31 | "errors": [ 32 | { 33 | "$ref": "./api/starknet_api_openrpc.json#/components/errors/TXN_HASH_NOT_FOUND" 34 | }, 35 | { 36 | "$ref": "#/components/errors/NO_TRACE_AVAILABLE" 37 | } 38 | ] 39 | }, 40 | { 41 | "name": "starknet_simulateTransactions", 42 | "summary": "Simulate a given sequence of transactions on the requested state, and generate the execution traces. Note that some of the transactions may revert, in which case no error is thrown, but revert details can be seen on the returned trace object. Note that some of the transactions may revert, this will be reflected by the revert_error property in the trace. Other types of failures (e.g. unexpected error or failure in the validation phase) will result in TRANSACTION_EXECUTION_ERROR.", 43 | "params": [ 44 | { 45 | "name": "block_id", 46 | "description": "The hash of the requested block, or number (height) of the requested block, or a block tag, for the block referencing the state or call the transaction on.", 47 | "required": true, 48 | "schema": { 49 | "$ref": "#/components/schemas/BLOCK_ID" 50 | } 51 | }, 52 | { 53 | "name": "transactions", 54 | "description": "The transactions to simulate", 55 | "required": true, 56 | "schema": { 57 | "type": "array", 58 | "description": "a sequence of transactions to simulate, running each transaction on the state resulting from applying all the previous ones", 59 | "items": { 60 | "$ref": "#/components/schemas/BROADCASTED_TXN" 61 | } 62 | } 63 | }, 64 | { 65 | "name": "simulation_flags", 66 | "description": "describes what parts of the transaction should be executed", 67 | "required": true, 68 | "schema": { 69 | "type": "array", 70 | "items": { 71 | "$ref": "#/components/schemas/SIMULATION_FLAG" 72 | } 73 | } 74 | } 75 | ], 76 | "result": { 77 | "name": "simulated_transactions", 78 | "description": "The execution trace and consumed resources of the required transactions", 79 | "schema": { 80 | "type": "array", 81 | "items": { 82 | "schema": { 83 | "type": "object", 84 | "properties": { 85 | "transaction_trace": { 86 | "title": "the transaction's trace", 87 | "$ref": "#/components/schemas/TRANSACTION_TRACE" 88 | }, 89 | "fee_estimation": { 90 | "title": "the transaction's resources and fee", 91 | "$ref": "#/components/schemas/FEE_ESTIMATE" 92 | } 93 | } 94 | } 95 | } 96 | } 97 | }, 98 | "errors": [ 99 | { 100 | "$ref": "./api/starknet_api_openrpc.json#/components/errors/BLOCK_NOT_FOUND" 101 | }, 102 | { 103 | "$ref": "./api/starknet_api_openrpc.json#/components/errors/TRANSACTION_EXECUTION_ERROR" 104 | } 105 | ] 106 | }, 107 | { 108 | "name": "starknet_traceBlockTransactions", 109 | "summary": "Retrieve traces for all transactions in the given block", 110 | "description": "Returns the execution traces of all transactions included in the given block", 111 | "params": [ 112 | { 113 | "name": "block_id", 114 | "description": "The hash of the requested block, or number (height) of the requested block, or a block tag", 115 | "required": true, 116 | "schema": { 117 | "allOf": [ 118 | { 119 | "$ref": "#/components/schemas/BLOCK_ID" 120 | }, 121 | { 122 | "not": { 123 | "enum": ["pre_confirmed"] 124 | } 125 | } 126 | ] 127 | } 128 | } 129 | ], 130 | "result": { 131 | "name": "traces", 132 | "description": "The traces of all transactions in the block", 133 | "schema": { 134 | "type": "array", 135 | "items": { 136 | "type": "object", 137 | "description": "A single pair of transaction hash and corresponding trace", 138 | "properties": { 139 | "transaction_hash": { 140 | "$ref": "#/components/schemas/FELT" 141 | }, 142 | "trace_root": { 143 | "$ref": "#/components/schemas/TRANSACTION_TRACE" 144 | } 145 | } 146 | } 147 | } 148 | }, 149 | "errors": [ 150 | { 151 | "$ref": "./api/starknet_api_openrpc.json#/components/errors/BLOCK_NOT_FOUND" 152 | } 153 | ] 154 | } 155 | ], 156 | "components": { 157 | "contentDescriptors": {}, 158 | "schemas": { 159 | "TRANSACTION_TRACE": { 160 | "oneOf": [ 161 | { 162 | "name": "INVOKE_TXN_TRACE", 163 | "type": "object", 164 | "description": "the execution trace of an invoke transaction", 165 | "properties": { 166 | "validate_invocation": { 167 | "$ref": "#/components/schemas/FUNCTION_INVOCATION" 168 | }, 169 | "execute_invocation": { 170 | "description": "the trace of the __execute__ call", 171 | "$ref": "#/components/schemas/REVERTIBLE_FUNCTION_INVOCATION" 172 | }, 173 | "fee_transfer_invocation": { 174 | "$ref": "#/components/schemas/FUNCTION_INVOCATION" 175 | }, 176 | "state_diff": { 177 | "title": "state_diff", 178 | "description": "the state diffs induced by the transaction", 179 | "$ref": "#/components/schemas/STATE_DIFF" 180 | }, 181 | "execution_resources": { 182 | "title": "Execution resources", 183 | "description": "the resources consumed by the transaction, includes both computation and data", 184 | "$ref": "#/components/schemas/EXECUTION_RESOURCES" 185 | }, 186 | "type": { 187 | "title": "Type", 188 | "type": "string", 189 | "enum": ["INVOKE"] 190 | } 191 | }, 192 | "required": ["type", "execute_invocation", "execution_resources"] 193 | }, 194 | { 195 | "name": "DECLARE_TXN_TRACE", 196 | "type": "object", 197 | "description": "the execution trace of a declare transaction", 198 | "properties": { 199 | "validate_invocation": { 200 | "$ref": "#/components/schemas/FUNCTION_INVOCATION" 201 | }, 202 | "fee_transfer_invocation": { 203 | "$ref": "#/components/schemas/FUNCTION_INVOCATION" 204 | }, 205 | "state_diff": { 206 | "title": "state_diff", 207 | "description": "the state diffs induced by the transaction", 208 | "$ref": "#/components/schemas/STATE_DIFF" 209 | }, 210 | "execution_resources": { 211 | "title": "Execution resources", 212 | "description": "the resources consumed by the transaction, includes both computation and data", 213 | "$ref": "#/components/schemas/EXECUTION_RESOURCES" 214 | }, 215 | "type": { 216 | "title": "Type", 217 | "type": "string", 218 | "enum": ["DECLARE"] 219 | } 220 | }, 221 | "required": ["type", "execution_resources"] 222 | }, 223 | { 224 | "name": "DEPLOY_ACCOUNT_TXN_TRACE", 225 | "type": "object", 226 | "description": "the execution trace of a deploy account transaction", 227 | "properties": { 228 | "validate_invocation": { 229 | "$ref": "#/components/schemas/FUNCTION_INVOCATION" 230 | }, 231 | "constructor_invocation": { 232 | "description": "the trace of the constructor call", 233 | "$ref": "#/components/schemas/FUNCTION_INVOCATION" 234 | }, 235 | "fee_transfer_invocation": { 236 | "$ref": "#/components/schemas/FUNCTION_INVOCATION" 237 | }, 238 | "state_diff": { 239 | "title": "state_diff", 240 | "description": "the state diffs induced by the transaction", 241 | "$ref": "#/components/schemas/STATE_DIFF" 242 | }, 243 | "execution_resources": { 244 | "title": "Execution resources", 245 | "description": "the resources consumed by the transaction, includes both computation and data", 246 | "$ref": "#/components/schemas/EXECUTION_RESOURCES" 247 | }, 248 | "type": { 249 | "title": "Type", 250 | "type": "string", 251 | "enum": ["DEPLOY_ACCOUNT"] 252 | } 253 | }, 254 | "required": [ 255 | "type", 256 | "execution_resources", 257 | "constructor_invocation" 258 | ] 259 | }, 260 | { 261 | "name": "L1_HANDLER_TXN_TRACE", 262 | "type": "object", 263 | "description": "the execution trace of an L1 handler transaction", 264 | "properties": { 265 | "function_invocation": { 266 | "description": "the trace of the L1 handler call", 267 | "$ref": "#/components/schemas/REVERTIBLE_FUNCTION_INVOCATION" 268 | }, 269 | "state_diff": { 270 | "title": "state_diff", 271 | "description": "the state diffs induced by the transaction", 272 | "$ref": "#/components/schemas/STATE_DIFF" 273 | }, 274 | "execution_resources": { 275 | "title": "Execution resources", 276 | "description": "the resources consumed by the transaction, includes both computation and data", 277 | "$ref": "#/components/schemas/EXECUTION_RESOURCES" 278 | }, 279 | "type": { 280 | "title": "Type", 281 | "type": "string", 282 | "enum": ["L1_HANDLER"] 283 | } 284 | }, 285 | "required": ["type", "function_invocation", "execution_resources"] 286 | } 287 | ] 288 | }, 289 | "SIMULATION_FLAG": { 290 | "type": "string", 291 | "enum": ["SKIP_VALIDATE", "SKIP_FEE_CHARGE"], 292 | "description": "Flags that indicate how to simulate a given transaction. By default, the sequencer behavior is replicated locally (enough funds are expected to be in the account, and fee will be deducted from the balance before the simulation of the next transaction). To skip the fee charge, use the SKIP_FEE_CHARGE flag." 293 | }, 294 | "NESTED_CALL": { 295 | "$ref": "#/components/schemas/FUNCTION_INVOCATION" 296 | }, 297 | "FUNCTION_INVOCATION": { 298 | "allOf": [ 299 | { 300 | "$ref": "#/components/schemas/FUNCTION_CALL" 301 | }, 302 | { 303 | "type": "object", 304 | "properties": { 305 | "caller_address": { 306 | "title": "Caller Address", 307 | "description": "The address of the invoking contract. 0 for the root invocation", 308 | "$ref": "#/components/schemas/FELT" 309 | }, 310 | "class_hash": { 311 | "title": "Class hash", 312 | "description": "The hash of the class being called", 313 | "$ref": "#/components/schemas/FELT" 314 | }, 315 | "entry_point_type": { 316 | "$ref": "#/components/schemas/ENTRY_POINT_TYPE" 317 | }, 318 | "call_type": { 319 | "$ref": "#/components/schemas/CALL_TYPE" 320 | }, 321 | "result": { 322 | "title": "Invocation Result", 323 | "description": "The value returned from the function invocation", 324 | "type": "array", 325 | "items": { 326 | "$ref": "#/components/schemas/FELT" 327 | } 328 | }, 329 | "calls": { 330 | "title": "Nested Calls", 331 | "description": "The calls made by this invocation", 332 | "type": "array", 333 | "items": { 334 | "$ref": "#/components/schemas/NESTED_CALL" 335 | } 336 | }, 337 | "events": { 338 | "title": "Invocation Events", 339 | "description": "The events emitted in this invocation", 340 | "type": "array", 341 | "items": { 342 | "$ref": "#/components/schemas/ORDERED_EVENT" 343 | } 344 | }, 345 | "messages": { 346 | "title": "L1 Messages", 347 | "description": "The messages sent by this invocation to L1", 348 | "type": "array", 349 | "items": { 350 | "$ref": "#/components/schemas/ORDERED_MESSAGE" 351 | } 352 | }, 353 | "execution_resources": { 354 | "title": "Execution resources", 355 | "description": "Resources consumed by the call tree rooted at this given call (including the root)", 356 | "$ref": "#/components/schemas/INNER_CALL_EXECUTION_RESOURCES" 357 | }, 358 | "is_reverted": { 359 | "title": "Is Reverted", 360 | "description": "true if this inner call panicked", 361 | "type": "boolean" 362 | } 363 | }, 364 | "required": [ 365 | "caller_address", 366 | "class_hash", 367 | "entry_point_type", 368 | "call_type", 369 | "result", 370 | "calls", 371 | "events", 372 | "messages", 373 | "execution_resources", 374 | "is_reverted" 375 | ] 376 | } 377 | ] 378 | }, 379 | "ENTRY_POINT_TYPE": { 380 | "type": "string", 381 | "enum": ["EXTERNAL", "L1_HANDLER", "CONSTRUCTOR"] 382 | }, 383 | "CALL_TYPE": { 384 | "type": "string", 385 | "enum": ["LIBRARY_CALL", "CALL", "DELEGATE"] 386 | }, 387 | "ORDERED_EVENT": { 388 | "type": "object", 389 | "title": "orderedEvent", 390 | "description": "an event alongside its order within the transaction", 391 | "allOf": [ 392 | { 393 | "type": "object", 394 | "properties": { 395 | "order": { 396 | "title": "order", 397 | "description": "the order of the event within the transaction", 398 | "type": "integer", 399 | "minimum": 0 400 | } 401 | } 402 | }, 403 | { 404 | "$ref": "#/components/schemas/EVENT" 405 | } 406 | ] 407 | }, 408 | "ORDERED_MESSAGE": { 409 | "type": "object", 410 | "title": "orderedMessage", 411 | "description": "a message alongside its order within the transaction", 412 | "allOf": [ 413 | { 414 | "type": "object", 415 | "properties": { 416 | "order": { 417 | "title": "order", 418 | "description": "the order of the message within the transaction", 419 | "type": "integer", 420 | "minimum": 0 421 | } 422 | } 423 | }, 424 | { 425 | "$ref": "#/components/schemas/MSG_TO_L1" 426 | } 427 | ] 428 | }, 429 | "INNER_CALL_EXECUTION_RESOURCES": { 430 | "type": "object", 431 | "title": "Execution resources", 432 | "description": "the resources consumed by an inner call (does not account for state diffs since data is squashed across the transaction)", 433 | "properties": { 434 | "l1_gas": { 435 | "title": "L1Gas", 436 | "description": "l1 gas consumed by this transaction, used for l2-->l1 messages and state updates if blobs are not used", 437 | "type": "integer", 438 | "minimum": 0 439 | }, 440 | "l2_gas": { 441 | "title": "L2Gas", 442 | "description": "l2 gas consumed by this transaction, used for computation and calldata", 443 | "type": "integer", 444 | "minimum": 0 445 | } 446 | }, 447 | "required": ["l1_gas", "l2_gas"] 448 | }, 449 | "REVERTIBLE_FUNCTION_INVOCATION": { 450 | "oneOf": [ 451 | { 452 | "$ref": "#/components/schemas/FUNCTION_INVOCATION" 453 | }, 454 | { 455 | "type": "object", 456 | "properties": { 457 | "revert_reason": { 458 | "name": "revert reason", 459 | "description": "the revert reason for the failed invocation", 460 | "type": "string" 461 | } 462 | }, 463 | "required": ["revert_reason"] 464 | } 465 | ] 466 | }, 467 | "FELT": { 468 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/FELT" 469 | }, 470 | "FUNCTION_CALL": { 471 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/FUNCTION_CALL" 472 | }, 473 | "EVENT": { 474 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/EVENT_CONTENT" 475 | }, 476 | "MSG_TO_L1": { 477 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/MSG_TO_L1" 478 | }, 479 | "BLOCK_ID": { 480 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/BLOCK_ID" 481 | }, 482 | "FEE_ESTIMATE": { 483 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/FEE_ESTIMATE" 484 | }, 485 | "BROADCASTED_TXN": { 486 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/BROADCASTED_TXN" 487 | }, 488 | "STATE_DIFF": { 489 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/STATE_DIFF" 490 | }, 491 | "EXECUTION_RESOURCES": { 492 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/EXECUTION_RESOURCES" 493 | } 494 | }, 495 | "errors": { 496 | "NO_TRACE_AVAILABLE": { 497 | "code": 10, 498 | "message": "No trace available for transaction", 499 | "data": { 500 | "type": "object", 501 | "description": "Extra information on why trace is not available. Either it wasn't executed yet (RECEIVED), or the transaction failed (REJECTED)", 502 | "properties": { 503 | "status": { 504 | "type": "string", 505 | "enum": ["RECEIVED", "REJECTED"] 506 | } 507 | } 508 | } 509 | } 510 | } 511 | } 512 | } 513 | -------------------------------------------------------------------------------- /wallet-api/wallet_rpc.json: -------------------------------------------------------------------------------- 1 | { 2 | "openrpc": "1.0.0-rc1", 3 | "info": { 4 | "version": "0.8.0", 5 | "title": "Starknet Wallet API", 6 | "license": {} 7 | }, 8 | "servers": [], 9 | "methods": [ 10 | { 11 | "name": "wallet_supportedWalletApi", 12 | "summary": "Returns a list of wallet api versions compatible with the wallet. Notice this might be different from Starknet JSON-RPC spec", 13 | "description": "When wallet is locked, return values. When Dapp is not approved, return values. When wallet is connected and unlocked, return values.", 14 | "params": [], 15 | "result": { 16 | "name": "result", 17 | "description": "Semver of the wallet api versions supported by the wallet", 18 | "required": true, 19 | "schema": { 20 | "type": "array", 21 | "properties": { 22 | "items": { 23 | "$ref": "#/components/schemas/API_VERSION" 24 | } 25 | } 26 | } 27 | } 28 | }, 29 | { 30 | "name": "wallet_supportedSpecs", 31 | "summary": "Returns a list of rpc spec versions compatible with the wallet", 32 | "description": "When wallet is locked, return values. When Dapp is not approved, return values. When wallet is connected and unlocked, return values.", 33 | "params": [], 34 | "result": { 35 | "name": "result", 36 | "description": "Semver of Starknet's JSON-RPC supported by the wallet", 37 | "required": true, 38 | "schema": { 39 | "type": "array", 40 | "properties": { 41 | "items": { 42 | "$ref": "#/components/schemas/SPEC_VERSION" 43 | } 44 | } 45 | } 46 | } 47 | }, 48 | { 49 | "name": "wallet_getPermissions", 50 | "summary": "Get the existing permissions for the Dapp from the wallet", 51 | "description": "When wallet is locked, return empty array. When Dapp is not approved, return empty array. When wallet is connected and unlocked, return values.", 52 | "params": [ 53 | { 54 | "name": "api_version", 55 | "required": false, 56 | "schema": { 57 | "$ref": "#/components/schemas/API_VERSION" 58 | } 59 | } 60 | ], 61 | "result": { 62 | "name": "result", 63 | "schema": { 64 | "title": "Wallet permissions", 65 | "oneOf": [ 66 | { 67 | "type": "array", 68 | "properties": { 69 | "items": { 70 | "$ref": "#/components/schemas/PERMISSION" 71 | } 72 | } 73 | }, 74 | { 75 | "type": "array", 76 | "title": "Empty array" 77 | } 78 | ], 79 | "required": [] 80 | } 81 | }, 82 | "errors": [ 83 | { 84 | "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED" 85 | }, 86 | { 87 | "$ref": "#/components/errors/UNKNOWN_ERROR" 88 | } 89 | ] 90 | }, 91 | { 92 | "name": "wallet_requestAccounts", 93 | "summary": "Get the account addresses of the wallet active account", 94 | "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.", 95 | "params": [ 96 | { 97 | "name": "silent_mode", 98 | "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", 99 | "required": false, 100 | "schema": { 101 | "type": "boolean" 102 | } 103 | }, 104 | { 105 | "name": "api_version", 106 | "required": false, 107 | "schema": { 108 | "$ref": "#/components/schemas/API_VERSION" 109 | } 110 | } 111 | ], 112 | "result": { 113 | "name": "result", 114 | "description": "The active account of the wallet", 115 | "schema": { 116 | "title": "Wallet Accounts", 117 | "type": "array", 118 | "items": { 119 | "$ref": "#/components/schemas/ADDRESS" 120 | }, 121 | "required": [] 122 | } 123 | }, 124 | "errors": [ 125 | { 126 | "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED" 127 | }, 128 | { 129 | "$ref": "#/components/errors/UNKNOWN_ERROR" 130 | } 131 | ] 132 | }, 133 | { 134 | "name": "wallet_requestChainId", 135 | "summary": "Request the current Chain Id", 136 | "description": "When wallet is locked, return values. When Dapp is not approved, return values. When wallet is connected and unlocked, return values.", 137 | "params": [ 138 | { 139 | "name": "api_version", 140 | "required": false, 141 | "schema": { 142 | "$ref": "#/components/schemas/API_VERSION" 143 | } 144 | } 145 | ], 146 | "result": { 147 | "name": "result", 148 | "description": "The active chainId", 149 | "schema": { 150 | "$ref": "#/components/schemas/CHAIN_ID" 151 | } 152 | }, 153 | "errors": [ 154 | { 155 | "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED" 156 | }, 157 | { 158 | "$ref": "#/components/errors/UNKNOWN_ERROR" 159 | } 160 | ] 161 | }, 162 | { 163 | "name": "wallet_deploymentData", 164 | "summary": "Request from the current wallet the data required to deploy the account at the current address", 165 | "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.", 166 | "params": [ 167 | { 168 | "name": "api_version", 169 | "required": false, 170 | "schema": { 171 | "$ref": "#/components/schemas/API_VERSION" 172 | } 173 | } 174 | ], 175 | "result": { 176 | "name": "result", 177 | "schema": { 178 | "$ref": "#/components/schemas/ACCOUNT_DEPLOYMENT_DATA" 179 | } 180 | }, 181 | "errors": [ 182 | { 183 | "$ref": "#/components/errors/ACCOUNT_ALREADY_DEPLOYED" 184 | }, 185 | { 186 | "$ref": "#/components/errors/DEPLOYMENT_DATA_NOT_AVAILABLE" 187 | }, 188 | { 189 | "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED" 190 | }, 191 | { 192 | "$ref": "#/components/errors/UNKNOWN_ERROR" 193 | } 194 | ] 195 | }, 196 | { 197 | "name": "wallet_switchStarknetChain", 198 | "summary": "Change the current network of the wallet, a permission request will be displayed on the wallet UI.", 199 | "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.", 200 | "params": [ 201 | { 202 | "name": "chainId", 203 | "required": true, 204 | "schema": { 205 | "$ref": "#/components/schemas/CHAIN_ID" 206 | } 207 | }, 208 | { 209 | "name": "silent_mode", 210 | "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", 211 | "required": false, 212 | "schema": { 213 | "type": "boolean" 214 | } 215 | }, 216 | { 217 | "name": "api_version", 218 | "required": false, 219 | "schema": { 220 | "$ref": "#/components/schemas/API_VERSION" 221 | } 222 | } 223 | ], 224 | "result": { 225 | "name": "response", 226 | "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", 227 | "required": true, 228 | "schema": { 229 | "type": "boolean" 230 | } 231 | }, 232 | "errors": [ 233 | { 234 | "$ref": "#/components/errors/UNLISTED_NETWORK" 235 | }, 236 | { 237 | "$ref": "#/components/errors/USER_REFUSED_OP" 238 | }, 239 | { 240 | "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED" 241 | }, 242 | { 243 | "$ref": "#/components/errors/CHAIN_ID_NOT_SUPPORTED" 244 | }, 245 | { 246 | "$ref": "#/components/errors/UNKNOWN_ERROR" 247 | } 248 | ] 249 | }, 250 | { 251 | "name": "wallet_watchAsset", 252 | "summary": "Add a token in the list of assets displayed by the wallet, the wallet will show an approval UI", 253 | "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.", 254 | "params": [ 255 | { 256 | "name": "Asset to add", 257 | "description": "Information needed to add asset", 258 | "required": true, 259 | "schema": { 260 | "$ref": "#/components/schemas/ASSET" 261 | } 262 | }, 263 | { 264 | "name": "api_version", 265 | "required": false, 266 | "schema": { 267 | "$ref": "#/components/schemas/API_VERSION" 268 | } 269 | } 270 | ], 271 | "result": { 272 | "name": "response", 273 | "summary": "If adding a token is agreed, or if token is already displayed, return true", 274 | "required": true, 275 | "schema": { 276 | "type": "boolean" 277 | } 278 | }, 279 | "errors": [ 280 | { 281 | "$ref": "#/components/errors/NOT_ERC20" 282 | }, 283 | { 284 | "$ref": "#/components/errors/INVALID_REQUEST_PAYLOAD" 285 | }, 286 | { 287 | "$ref": "#/components/errors/USER_REFUSED_OP" 288 | }, 289 | { 290 | "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED" 291 | }, 292 | { 293 | "$ref": "#/components/errors/UNKNOWN_ERROR" 294 | } 295 | ] 296 | }, 297 | { 298 | "name": "wallet_addStarknetChain", 299 | "summary": "Add a new network in the list of networks of the wallet, a permission request will be displayed on the wallet UI.", 300 | "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.", 301 | "params": [ 302 | { 303 | "name": "Starknet Chain to add", 304 | "description": "Information for the chain to add to the wallet", 305 | "required": true, 306 | "schema": { 307 | "$ref": "#/components/schemas/STARKNET_CHAIN" 308 | } 309 | }, 310 | { 311 | "name": "api_version", 312 | "required": false, 313 | "schema": { 314 | "$ref": "#/components/schemas/API_VERSION" 315 | } 316 | } 317 | ], 318 | "result": { 319 | "name": "response", 320 | "summary": "If user agreed, and network added successfully, or if network already listed, return true", 321 | "required": true, 322 | "schema": { 323 | "type": "boolean" 324 | } 325 | }, 326 | "errors": [ 327 | { 328 | "$ref": "#/components/errors/INVALID_REQUEST_PAYLOAD" 329 | }, 330 | { 331 | "$ref": "#/components/errors/USER_REFUSED_OP" 332 | }, 333 | { 334 | "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED" 335 | }, 336 | { 337 | "$ref": "#/components/errors/UNKNOWN_ERROR" 338 | } 339 | ] 340 | }, 341 | { 342 | "name": "wallet_addInvokeTransaction", 343 | "summary": "Submit a new transaction to be added to the chain", 344 | "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.", 345 | "params": [ 346 | { 347 | "name": "invoke_transaction", 348 | "description": "A list of calls to invoke in an invoke transaction", 349 | "required": true, 350 | "schema": { 351 | "type": "array", 352 | "items": { 353 | "$ref": "#/components/schemas/INVOKE_CALL" 354 | } 355 | } 356 | }, 357 | { 358 | "name": "api_version", 359 | "required": false, 360 | "schema": { 361 | "$ref": "#/components/schemas/API_VERSION" 362 | } 363 | } 364 | ], 365 | "result": { 366 | "name": "result", 367 | "description": "The result of the transaction submission", 368 | "schema": { 369 | "type": "object", 370 | "properties": { 371 | "transaction_hash": { 372 | "title": "Transaction Hash", 373 | "$ref": "#/components/schemas/PADDED_TXN_HASH" 374 | } 375 | }, 376 | "required": ["transaction_hash"] 377 | } 378 | }, 379 | "errors": [ 380 | { 381 | "$ref": "#/components/errors/INVALID_REQUEST_PAYLOAD" 382 | }, 383 | { 384 | "$ref": "#/components/errors/USER_REFUSED_OP" 385 | }, 386 | { 387 | "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED" 388 | }, 389 | { 390 | "$ref": "#/components/errors/UNKNOWN_ERROR" 391 | } 392 | ] 393 | }, 394 | { 395 | "name": "wallet_addDeclareTransaction", 396 | "summary": "Submit a declare transaction", 397 | "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.", 398 | "params": [ 399 | { 400 | "name": "declare_transaction", 401 | "description": "The information needed to declare a new class", 402 | "required": true, 403 | "schema": { 404 | "$ref": "#/components/schemas/DECLARE_TXN" 405 | } 406 | }, 407 | { 408 | "name": "api_version", 409 | "required": false, 410 | "schema": { 411 | "$ref": "#/components/schemas/API_VERSION" 412 | } 413 | } 414 | ], 415 | "result": { 416 | "name": "result", 417 | "description": "The result of the transaction submission", 418 | "schema": { 419 | "type": "object", 420 | "properties": { 421 | "transaction_hash": { 422 | "title": "The hash of the declare transaction", 423 | "$ref": "#/components/schemas/PADDED_TXN_HASH" 424 | }, 425 | "class_hash": { 426 | "title": "The hash of the declared class", 427 | "$ref": "#/components/schemas/PADDED_FELT" 428 | } 429 | }, 430 | "required": ["transaction_hash", "class_hash"] 431 | } 432 | }, 433 | "errors": [ 434 | { 435 | "$ref": "#/components/errors/INVALID_REQUEST_PAYLOAD" 436 | }, 437 | { 438 | "$ref": "#/components/errors/USER_REFUSED_OP" 439 | }, 440 | { 441 | "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED" 442 | }, 443 | { 444 | "$ref": "#/components/errors/UNKNOWN_ERROR" 445 | } 446 | ] 447 | }, 448 | { 449 | "name": "wallet_signTypedData", 450 | "summary": "Sign typed data using the wallet", 451 | "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.", 452 | "params": [ 453 | { 454 | "name": "typed_data", 455 | "description": "The typed data to sign", 456 | "required": true, 457 | "schema": { 458 | "$ref": "#/components/schemas/TYPED_DATA" 459 | } 460 | }, 461 | { 462 | "name": "api_version", 463 | "required": false, 464 | "schema": { 465 | "$ref": "#/components/schemas/API_VERSION" 466 | } 467 | } 468 | ], 469 | "result": { 470 | "name": "response", 471 | "summary": "The signature over the typed data", 472 | "required": true, 473 | "schema": { 474 | "$ref": "#/components/schemas/SIGNATURE" 475 | } 476 | }, 477 | "errors": [ 478 | { 479 | "$ref": "#/components/errors/INVALID_REQUEST_PAYLOAD" 480 | }, 481 | { 482 | "$ref": "#/components/errors/USER_REFUSED_OP" 483 | }, 484 | { 485 | "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED" 486 | }, 487 | { 488 | "$ref": "#/components/errors/UNKNOWN_ERROR" 489 | } 490 | ] 491 | } 492 | ], 493 | "components": { 494 | "contentDescriptors": {}, 495 | "schemas": { 496 | "PADDED_TXN_HASH": { 497 | "title": "Padded Transaction Hash", 498 | "description": "The transaction hash, as assigned in Starknet, padded to 64 hex digits", 499 | "$ref": "#/components/schemas/PADDED_FELT" 500 | }, 501 | "ADDRESS": { 502 | "title": "Address", 503 | "$ref": "#/components/schemas/FELT" 504 | }, 505 | "TOKEN_SYMBOL": { 506 | "title": "ERC20 Token Symbol", 507 | "description": "The symbol of the token", 508 | "type": "string", 509 | "minLength": 1, 510 | "maxLength": 6, 511 | "pattern": "^[A-Za-z0-9]{1,6}$" 512 | }, 513 | "SPEC_VERSION": { 514 | "title": "Starknet Spec Version", 515 | "description": "A Starknet RPC spec version, only two numbers are provided", 516 | "type": "string", 517 | "pattern": "^[0-9]+\\.[0-9]+$" 518 | }, 519 | "API_VERSION": { 520 | "title": "Wallet API version", 521 | "description": "The version of wallet API expected by the request. If not specified, the latest is assumed", 522 | "type": "string", 523 | "pattern": "^[0-9]+\\.[0-9]+$" 524 | }, 525 | "PERMISSION": { 526 | "title": "Wallet permission", 527 | "type": "string", 528 | "enum": ["accounts"], 529 | "description": "Optional wallet permissions" 530 | }, 531 | "ASSET": { 532 | "title": "Starknet Token", 533 | "description": "Details of an onchain Starknet ERC20 token", 534 | "type": "object", 535 | "properties": { 536 | "type": { 537 | "type": "string", 538 | "enum": ["ERC20"] 539 | }, 540 | "options": { 541 | "type": "object", 542 | "properties": { 543 | "address": { 544 | "title": "Token Address", 545 | "$ref": "#/components/schemas/ADDRESS" 546 | }, 547 | "symbol": { 548 | "title": "Token Symbol", 549 | "$ref": "#/components/schemas/TOKEN_SYMBOL" 550 | }, 551 | "decimals": { 552 | "type": "number", 553 | "minimum": 0 554 | }, 555 | "image": { 556 | "type": "string", 557 | "format": "uri" 558 | }, 559 | "name": { 560 | "type": "string" 561 | } 562 | }, 563 | "required": ["address"] 564 | } 565 | }, 566 | "required": ["type", "options"] 567 | }, 568 | "CHAIN_ID": { 569 | "title": "Chain id", 570 | "description": "Starknet chain id, given in hex representation.", 571 | "type": "string", 572 | "pattern": "^0x[a-fA-F0-9]+$" 573 | }, 574 | "STARKNET_CHAIN_ID": { 575 | "title": "Starknet Chain id", 576 | "description": "Only officially supported Starknet IDs", 577 | "allOf": [ 578 | { 579 | "type": "string", 580 | "enum": ["0x534e5f4d41494e", "0x534e5f5345504f4c4941"] 581 | }, 582 | { 583 | "$ref": "#/components/schemas/CHAIN_ID" 584 | } 585 | ] 586 | }, 587 | "ACCOUNT_DEPLOYMENT_DATA": { 588 | "title": "Account Deployment Data", 589 | "description": "Data required to deploy an account at and address", 590 | "type": "object", 591 | "properties": { 592 | "address": { 593 | "title": "Address", 594 | "description": "The expected address to be deployed, used to double check", 595 | "$ref": "#/components/schemas/ADDRESS" 596 | }, 597 | "class_hash": { 598 | "title": "Class hash", 599 | "description": "The hash of the deployed contract's class", 600 | "$ref": "#/components/schemas/FELT" 601 | }, 602 | "salt": { 603 | "title": "Class hash", 604 | "description": "The hash of the deployed contract's class", 605 | "$ref": "#/components/schemas/FELT" 606 | }, 607 | "calldata": { 608 | "type": "array", 609 | "description": "The parameters passed to the constructor", 610 | "title": "Constructor calldata", 611 | "items": { 612 | "$ref": "#/components/schemas/FELT" 613 | } 614 | }, 615 | "sigdata": { 616 | "title": "Signature Data", 617 | "type": "array", 618 | "description": "Optional array of felts to be added to the signature", 619 | "items": { 620 | "$ref": "#/components/schemas/FELT" 621 | } 622 | }, 623 | "version": { 624 | "title": "Contract Version", 625 | "description": "The Cairo version of the contract 0 or 1", 626 | "type": "integer", 627 | "enum": [0, 1] 628 | } 629 | }, 630 | "required": ["address", "class_hash", "salt", "calldata", "version"] 631 | }, 632 | "INVOKE_CALL": { 633 | "title": "Invoke transaction", 634 | "description": "initiates a transaction from a given account", 635 | "type": "object", 636 | "properties": { 637 | "contract_address": { 638 | "title": "The contract address to interact with", 639 | "$ref": "#/components/schemas/ADDRESS" 640 | }, 641 | "entry_point": { 642 | "title": "Contract entry point", 643 | "description": "A string correlating the selector name of the contract, e.g. 'transfer'", 644 | "type": "string" 645 | }, 646 | "calldata": { 647 | "type": "array", 648 | "title": "calldata", 649 | "description": "Calldata to be passed to the entry point", 650 | "items": { 651 | "$ref": "#/components/schemas/FELT" 652 | } 653 | } 654 | }, 655 | "required": ["contract_address", "entry_point"] 656 | }, 657 | "DECLARE_TXN": { 658 | "title": "Declare Transaction", 659 | "description": "Declare Contract Transaction", 660 | "type": "object", 661 | "properties": { 662 | "compiled_class_hash": { 663 | "title": "Compiled class hash", 664 | "description": "The hash of the Cairo assembly resulting from the Sierra compilation", 665 | "$ref": "#/components/schemas/FELT" 666 | }, 667 | "class_hash": { 668 | "title": "Class hash", 669 | "description": "The hash of the declared class", 670 | "$ref": "#/components/schemas/FELT" 671 | }, 672 | "contract_class": { 673 | "title": "Contract class", 674 | "description": "The class to be declared", 675 | "$ref": "#/components/schemas/CONTRACT_CLASS" 676 | } 677 | }, 678 | "required": ["compiled_class_hash", "contract_class"] 679 | }, 680 | "STARKNET_CHAIN": { 681 | "title": "Starknet Chain", 682 | "type": "object", 683 | "properties": { 684 | "id": { 685 | "type": "string" 686 | }, 687 | "chain_id": { 688 | "title": "Starknet Chain Id", 689 | "$ref": "#/components/schemas/CHAIN_ID" 690 | }, 691 | "chain_name": { 692 | "type": "string" 693 | }, 694 | "rpc_urls": { 695 | "type": "array", 696 | "items": { 697 | "type": "string", 698 | "format": "uri" 699 | }, 700 | "minItems": 1, 701 | "uniqueItems": true 702 | }, 703 | "block_explorer_url": { 704 | "type": "array", 705 | "items": { 706 | "type": "string", 707 | "format": "uri" 708 | }, 709 | "minItems": 1, 710 | "uniqueItems": true 711 | }, 712 | "native_currency": { 713 | "title": "Native Currency", 714 | "$ref": "#/components/schemas/ASSET" 715 | }, 716 | "icon_urls": { 717 | "type": "array", 718 | "items": { 719 | "type": "string", 720 | "format": "uri" 721 | }, 722 | "minItems": 1, 723 | "uniqueItems": true 724 | } 725 | }, 726 | "required": ["id", "chain_id", "chain_name"] 727 | }, 728 | "STARKNET_MERKLE_TYPE": { 729 | "title": "Starknet Merkle Type", 730 | "type": "object", 731 | "properties": { 732 | "name": { 733 | "type": "string" 734 | }, 735 | "type": { 736 | "type": "string", 737 | "enum": ["merkletree"] 738 | }, 739 | "contains": { 740 | "type": "string" 741 | } 742 | }, 743 | "required": ["name", "type", "contains"] 744 | }, 745 | "STARKNET_ENUM_TYPE": { 746 | "title": "Starknet Enum Type", 747 | "type": "object", 748 | "properties": { 749 | "name": { 750 | "type": "string" 751 | }, 752 | "type": { 753 | "type": "string", 754 | "enum": ["enum"] 755 | }, 756 | "contains": { 757 | "type": "string" 758 | } 759 | }, 760 | "required": ["name", "type", "contains"] 761 | }, 762 | "STARKNET_TYPE": { 763 | "title": "Starknet Type", 764 | "description": "A single type, as part of a struct. The `type` field can be any of the EIP-712 supported types", 765 | "schema": { 766 | "anyOf": [ 767 | { 768 | "type": "object", 769 | "properties": { 770 | "name": { "type": "string" }, 771 | "type": { "type": "string" } 772 | }, 773 | "required": ["name", "type"] 774 | }, 775 | { 776 | "$ref": "#/components/schemas/STARKNET_MERKLE_TYPE" 777 | }, 778 | { 779 | "$ref": "#/components/schemas/STARKNET_ENUM_TYPE" 780 | } 781 | ] 782 | } 783 | }, 784 | "TYPED_DATA": { 785 | "title": "Typed Data", 786 | "type": "object", 787 | "properties": { 788 | "types": { 789 | "description": "Defines the types of the typed data object", 790 | "type": "object", 791 | "additionalProperties": { 792 | "type": "array", 793 | "items": { 794 | "$ref": "#/components/schemas/STARKNET_TYPE" 795 | } 796 | } 797 | }, 798 | "primaryType": { 799 | "type": "string", 800 | "description": "primaryType represents the top-level type of the object in the message" 801 | }, 802 | "domain": { 803 | "description": "The EIP712 domain struct. Any of these fields are optional, but it must contain at least one field", 804 | "$ref": "#/components/schemas/STARKNET_DOMAIN" 805 | }, 806 | "message": { 807 | "type": "object", 808 | "description": "The message to be signed" 809 | } 810 | }, 811 | "required": ["types", "primaryType", "domain", "message"] 812 | }, 813 | "STARKNET_DOMAIN": { 814 | "title": "Starknet Domain", 815 | "type": "object", 816 | "minProperties": 1, 817 | "properties": { 818 | "name": { "type": "string" }, 819 | "version": { "type": "string" }, 820 | "chainId": { 821 | "anyOf": [{ "type": "string" }, { "type": "number" }] 822 | }, 823 | "revision": { 824 | "oneOf": [ 825 | { 826 | "type": "string", 827 | "enum": ["2"] 828 | }, 829 | { 830 | "type": "number", 831 | "enum": [0, 1] 832 | } 833 | ] 834 | } 835 | } 836 | }, 837 | "PADDED_FELT": { 838 | "type": "string", 839 | "title": "Padded felt", 840 | "description": "A padded felt represented as 62 hex digits, 3 bits, and 5 leading zero bits.", 841 | "pattern": "^0x(0[0-8]{1}[a-fA-F0-9]{62}$)" 842 | }, 843 | "CONTRACT_CLASS": { 844 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/CONTRACT_CLASS" 845 | }, 846 | "SIGNATURE": { 847 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/SIGNATURE" 848 | }, 849 | "FELT": { 850 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/FELT" 851 | } 852 | }, 853 | "errors": { 854 | "NOT_ERC20": { 855 | "code": 111, 856 | "message": "An error occurred (NOT_ERC20)" 857 | }, 858 | "UNLISTED_NETWORK": { 859 | "code": 112, 860 | "message": "An error occurred (UNLISTED_NETWORK)" 861 | }, 862 | "USER_REFUSED_OP": { 863 | "code": 113, 864 | "message": "An error occurred (USER_REFUSED_OP)", 865 | "description": "The user refused the operation in the wallet" 866 | }, 867 | "INVALID_REQUEST_PAYLOAD": { 868 | "code": 114, 869 | "message": "An error occurred (INVALID_REQUEST_PAYLOAD)" 870 | }, 871 | "ACCOUNT_ALREADY_DEPLOYED": { 872 | "code": 115, 873 | "message": "An error occurred (ACCOUNT_ALREADY_DEPLOYED)" 874 | }, 875 | "DEPLOYMENT_DATA_NOT_AVAILABLE": { 876 | "code": 116, 877 | "message": "An error occurred (DEPLOYMENT_DATA_NOT_AVAILABLE)", 878 | "description": "The deployment data is not available or no supported" 879 | }, 880 | "CHAIN_ID_NOT_SUPPORTED": { 881 | "code": 117, 882 | "message": "An error occurred (CHAIN_ID_NOT_SUPPORTED)", 883 | "description": "The requested chain ID is not supported by the wallet" 884 | }, 885 | "API_VERSION_NOT_SUPPORTED": { 886 | "code": 162, 887 | "message": "An error occurred (API_VERSION_NOT_SUPPORTED)", 888 | "data": "string" 889 | }, 890 | "UNKNOWN_ERROR": { 891 | "code": 163, 892 | "message": "An error occurred (UNKNOWN_ERROR)", 893 | "data": "string" 894 | } 895 | } 896 | } 897 | } 898 | -------------------------------------------------------------------------------- /api/starknet_executables.json: -------------------------------------------------------------------------------- 1 | { 2 | "openrpc": "1.0.0", 3 | "info": { 4 | "version": "0.10.0", 5 | "title": "API for getting Starknet executables from nodes that store compiled artifacts", 6 | "license": {} 7 | }, 8 | "servers": [], 9 | "methods": [ 10 | { 11 | "name": "starknet_getCompiledCasm", 12 | "summary": "Get the CASM code resulting from compiling a given class", 13 | "params": [ 14 | { 15 | "name": "class_hash", 16 | "description": "The hash of the contract class whose CASM will be returned", 17 | "required": true, 18 | "schema": { 19 | "title": "Field element", 20 | "$ref": "#/components/schemas/FELT" 21 | } 22 | } 23 | ], 24 | "result": { 25 | "name": "result", 26 | "description": "The compiled contract class", 27 | "schema": { 28 | "title": "Starknet get compiled CASM result", 29 | "$ref": "#/components/schemas/CASM_COMPILED_CONTRACT_CLASS" 30 | } 31 | }, 32 | "errors": [ 33 | { 34 | "$ref": "#/components/errors/COMPILATION_ERROR" 35 | }, 36 | { 37 | "$ref": "./api/starknet_api_openrpc.json#/components/errors/CLASS_HASH_NOT_FOUND" 38 | } 39 | ] 40 | } 41 | ], 42 | "components": { 43 | "contentDescriptors": {}, 44 | "schemas": { 45 | "CASM_COMPILED_CONTRACT_CLASS": { 46 | "type": "object", 47 | "properties": { 48 | "entry_points_by_type": { 49 | "title": "Entry points by type", 50 | "type": "object", 51 | "properties": { 52 | "CONSTRUCTOR": { 53 | "type": "array", 54 | "title": "Constructor", 55 | "items": { 56 | "$ref": "#/components/schemas/CASM_ENTRY_POINT" 57 | } 58 | }, 59 | "EXTERNAL": { 60 | "title": "External", 61 | "type": "array", 62 | "items": { 63 | "$ref": "#/components/schemas/CASM_ENTRY_POINT" 64 | } 65 | }, 66 | "L1_HANDLER": { 67 | "title": "L1 handler", 68 | "type": "array", 69 | "items": { 70 | "$ref": "#/components/schemas/CASM_ENTRY_POINT" 71 | } 72 | } 73 | }, 74 | "required": ["CONSTRUCTOR", "EXTERNAL", "L1_HANDLER"] 75 | }, 76 | "bytecode": { 77 | "type": "array", 78 | "items": { 79 | "$ref": "#/components/schemas/FELT" 80 | } 81 | }, 82 | "prime": { 83 | "$ref": "#/components/schemas/NUM_AS_HEX" 84 | }, 85 | "compiler_version": { 86 | "type": "string" 87 | }, 88 | "hints": { 89 | "type": "array", 90 | "items": { 91 | "type": "array", 92 | "description": "2-tuple of pc value and an array of hints to execute", 93 | "items": { 94 | "oneOf": [ 95 | { 96 | "type": "integer", 97 | "minimum": 0 98 | }, 99 | { 100 | "type": "array", 101 | "items": { 102 | "$ref": "#/components/schemas/HINT" 103 | } 104 | } 105 | ] 106 | }, 107 | "minItems": 2, 108 | "maxItems": 2 109 | } 110 | }, 111 | "bytecode_segment_lengths": { 112 | "type": "array", 113 | "description": "a list of sizes of segments in the bytecode, each segment is hashed individually when computing the bytecode hash", 114 | "items": { 115 | "type": "integer", 116 | "minimum": 0 117 | } 118 | } 119 | }, 120 | "required": [ 121 | "prime", 122 | "compiler_version", 123 | "entry_points_by_type", 124 | "bytecode", 125 | "hints" 126 | ] 127 | }, 128 | "CASM_ENTRY_POINT": { 129 | "type": "object", 130 | "properties": { 131 | "offset": { 132 | "title": "Offset", 133 | "description": "The offset of the entry point in the program", 134 | "type": "integer", 135 | "minimum": 0 136 | }, 137 | "selector": { 138 | "title": "Selector", 139 | "description": "A unique identifier of the entry point (function) in the program", 140 | "$ref": "#/components/schemas/FELT" 141 | }, 142 | "builtins": { 143 | "type": "array", 144 | "items": { 145 | "type": "string" 146 | } 147 | } 148 | }, 149 | "required": ["offset", "selector", "builtins"] 150 | }, 151 | "CellRef": { 152 | "title": "CellRef", 153 | "type": "object", 154 | "properties": { 155 | "register": { 156 | "type": "string", 157 | "enum": ["AP", "FP"] 158 | }, 159 | "offset": { 160 | "type": "integer", 161 | "minimum": 0 162 | } 163 | }, 164 | "required": ["register", "offset"] 165 | }, 166 | "Deref": { 167 | "type": "object", 168 | "properties": { 169 | "Deref": { 170 | "$ref": "#/components/schemas/CellRef" 171 | } 172 | }, 173 | "required": ["Deref"] 174 | }, 175 | "DoubleDeref": { 176 | "title": "DoubleDeref", 177 | "type": "object", 178 | "properties": { 179 | "DoubleDeref": { 180 | "title": "DoubleDeref", 181 | "description": "A (CellRef, offset) tuple", 182 | "type": "array", 183 | "items": { 184 | "oneOf": [ 185 | { 186 | "$ref": "#/components/schemas/CellRef" 187 | }, 188 | { 189 | "type": "integer", 190 | "minimum": 0 191 | } 192 | ] 193 | }, 194 | "minItems": 2, 195 | "maxItems": 2 196 | } 197 | }, 198 | "required": ["DoubleDeref"] 199 | }, 200 | "Immediate": { 201 | "title": "Immediate", 202 | "type": "object", 203 | "properties": { 204 | "Immediate": { 205 | "$ref": "#/components/schemas/NUM_AS_HEX" 206 | } 207 | }, 208 | "required": ["Immediate"] 209 | }, 210 | "BinOp": { 211 | "title": "BinOperand", 212 | "type": "object", 213 | "properties": { 214 | "BinOp": { 215 | "type": "object", 216 | "properties": { 217 | "op": { 218 | "type": "string", 219 | "enum": ["Add", "Mul"] 220 | }, 221 | "a": { 222 | "$ref": "#/components/schemas/CellRef" 223 | }, 224 | "b": { 225 | "oneOf": [ 226 | { 227 | "$ref": "#/components/schemas/Deref" 228 | }, 229 | { 230 | "$ref": "#/components/schemas/Immediate" 231 | } 232 | ] 233 | } 234 | }, 235 | "required": ["op", "a", "b"] 236 | } 237 | }, 238 | "required": ["BinOp"] 239 | }, 240 | "ResOperand": { 241 | "oneOf": [ 242 | { 243 | "$ref": "#/components/schemas/Deref" 244 | }, 245 | { 246 | "$ref": "#/components/schemas/DoubleDeref" 247 | }, 248 | { 249 | "$ref": "#/components/schemas/Immediate" 250 | }, 251 | { 252 | "$ref": "#/components/schemas/BinOp" 253 | } 254 | ] 255 | }, 256 | "HINT": { 257 | "oneOf": [ 258 | { 259 | "$ref": "#/components/schemas/DEPRECATED_HINT" 260 | }, 261 | { 262 | "$ref": "#/components/schemas/CORE_HINT" 263 | }, 264 | { 265 | "$ref": "#/components/schemas/STARKNET_HINT" 266 | } 267 | ] 268 | }, 269 | "DEPRECATED_HINT": { 270 | "oneOf": [ 271 | { 272 | "type": "string", 273 | "title": "AssertCurrentAccessIndicesIsEmpty", 274 | "enum": ["AssertCurrentAccessIndicesIsEmpty"] 275 | }, 276 | { 277 | "type": "object", 278 | "title": "AssertAllAccessesUsed", 279 | "properties": { 280 | "AssertAllAccessesUsed": { 281 | "type": "object", 282 | "properties": { 283 | "n_used_accesses": { 284 | "$ref": "#/components/schemas/CellRef" 285 | } 286 | }, 287 | "required": ["n_used_accesses"] 288 | } 289 | }, 290 | "required": ["AssertAllAccessesUsed"] 291 | }, 292 | { 293 | "type": "string", 294 | "title": "AssertAllKeysUsed", 295 | "enum": ["AssertAllKeysUsed"] 296 | }, 297 | { 298 | "type": "string", 299 | "title": "AssertLeAssertThirdArcExcluded", 300 | "enum": ["AssertLeAssertThirdArcExcluded"] 301 | }, 302 | { 303 | "type": "object", 304 | "title": "AssertLtAssertValidInput", 305 | "properties": { 306 | "AssertLtAssertValidInput": { 307 | "type": "object", 308 | "properties": { 309 | "a": { 310 | "$ref": "#/components/schemas/ResOperand" 311 | }, 312 | "b": { 313 | "$ref": "#/components/schemas/ResOperand" 314 | } 315 | }, 316 | "required": ["a", "b"] 317 | } 318 | }, 319 | "required": ["AssertLtAssertValidInput"] 320 | }, 321 | { 322 | "type": "object", 323 | "title": "Felt252DictRead", 324 | "properties": { 325 | "Felt252DictRead": { 326 | "type": "object", 327 | "properties": { 328 | "dict_ptr": { 329 | "$ref": "#/components/schemas/ResOperand" 330 | }, 331 | "key": { 332 | "$ref": "#/components/schemas/ResOperand" 333 | }, 334 | "value_dst": { 335 | "$ref": "#/components/schemas/CellRef" 336 | } 337 | }, 338 | "required": ["dict_ptr", "key", "value_dst"] 339 | } 340 | }, 341 | "required": ["Felt252DictRead"] 342 | }, 343 | { 344 | "type": "object", 345 | "title": "Felt252DictWrite", 346 | "properties": { 347 | "Felt252DictWrite": { 348 | "type": "object", 349 | "properties": { 350 | "dict_ptr": { 351 | "$ref": "#/components/schemas/ResOperand" 352 | }, 353 | "key": { 354 | "$ref": "#/components/schemas/ResOperand" 355 | }, 356 | "value": { 357 | "$ref": "#/components/schemas/ResOperand" 358 | } 359 | }, 360 | "required": ["dict_ptr", "key", "value"] 361 | } 362 | }, 363 | "required": ["Felt252DictWrite"] 364 | } 365 | ] 366 | }, 367 | "CORE_HINT": { 368 | "oneOf": [ 369 | { 370 | "type": "object", 371 | "title": "AllocSegment", 372 | "properties": { 373 | "AllocSegment": { 374 | "type": "object", 375 | "properties": { 376 | "dst": { 377 | "$ref": "#/components/schemas/CellRef" 378 | } 379 | }, 380 | "required": ["dst"] 381 | } 382 | }, 383 | "required": ["AllocSegment"] 384 | }, 385 | { 386 | "type": "object", 387 | "title": "TestLessThan", 388 | "properties": { 389 | "TestLessThan": { 390 | "type": "object", 391 | "properties": { 392 | "lhs": { 393 | "$ref": "#/components/schemas/ResOperand" 394 | }, 395 | "rhs": { 396 | "$ref": "#/components/schemas/ResOperand" 397 | }, 398 | "dst": { 399 | "$ref": "#/components/schemas/CellRef" 400 | } 401 | }, 402 | "required": ["lhs", "rhs", "dst"] 403 | } 404 | }, 405 | "required": ["TestLessThan"] 406 | }, 407 | { 408 | "type": "object", 409 | "title": "TestLessThanOrEqual", 410 | "properties": { 411 | "TestLessThanOrEqual": { 412 | "type": "object", 413 | "properties": { 414 | "lhs": { 415 | "$ref": "#/components/schemas/ResOperand" 416 | }, 417 | "rhs": { 418 | "$ref": "#/components/schemas/ResOperand" 419 | }, 420 | "dst": { 421 | "$ref": "#/components/schemas/CellRef" 422 | } 423 | }, 424 | "required": ["lhs", "rhs", "dst"] 425 | } 426 | }, 427 | "required": ["TestLessThanOrEqual"] 428 | }, 429 | { 430 | "type": "object", 431 | "title": "TestLessThanOrEqualAddress", 432 | "properties": { 433 | "TestLessThanOrEqualAddress": { 434 | "type": "object", 435 | "properties": { 436 | "lhs": { 437 | "$ref": "#/components/schemas/ResOperand" 438 | }, 439 | "rhs": { 440 | "$ref": "#/components/schemas/ResOperand" 441 | }, 442 | "dst": { 443 | "$ref": "#/components/schemas/CellRef" 444 | } 445 | }, 446 | "required": ["lhs", "rhs", "dst"] 447 | } 448 | }, 449 | "required": ["TestLessThanOrEqualAddress"] 450 | }, 451 | { 452 | "type": "object", 453 | "title": "WideMul128", 454 | "properties": { 455 | "WideMul128": { 456 | "type": "object", 457 | "properties": { 458 | "lhs": { 459 | "$ref": "#/components/schemas/ResOperand" 460 | }, 461 | "rhs": { 462 | "$ref": "#/components/schemas/ResOperand" 463 | }, 464 | "high": { 465 | "$ref": "#/components/schemas/CellRef" 466 | }, 467 | "low": { 468 | "$ref": "#/components/schemas/CellRef" 469 | } 470 | }, 471 | "required": ["lhs", "rhs", "high", "low"] 472 | } 473 | }, 474 | "required": ["WideMul128"] 475 | }, 476 | { 477 | "type": "object", 478 | "title": "DivMod", 479 | "properties": { 480 | "DivMod": { 481 | "type": "object", 482 | "properties": { 483 | "lhs": { 484 | "$ref": "#/components/schemas/ResOperand" 485 | }, 486 | "rhs": { 487 | "$ref": "#/components/schemas/ResOperand" 488 | }, 489 | "quotient": { 490 | "$ref": "#/components/schemas/CellRef" 491 | }, 492 | "remainder": { 493 | "$ref": "#/components/schemas/CellRef" 494 | } 495 | }, 496 | "required": ["lhs", "rhs", "quotient", "remainder"] 497 | } 498 | }, 499 | "required": ["DivMod"] 500 | }, 501 | { 502 | "type": "object", 503 | "title": "Uint256DivMod", 504 | "properties": { 505 | "Uint256DivMod": { 506 | "type": "object", 507 | "properties": { 508 | "dividend0": { 509 | "$ref": "#/components/schemas/ResOperand" 510 | }, 511 | "dividend1": { 512 | "$ref": "#/components/schemas/ResOperand" 513 | }, 514 | "divisor0": { 515 | "$ref": "#/components/schemas/ResOperand" 516 | }, 517 | "divisor1": { 518 | "$ref": "#/components/schemas/ResOperand" 519 | }, 520 | "quotient0": { 521 | "$ref": "#/components/schemas/CellRef" 522 | }, 523 | "quotient1": { 524 | "$ref": "#/components/schemas/CellRef" 525 | }, 526 | "remainder0": { 527 | "$ref": "#/components/schemas/CellRef" 528 | }, 529 | "remainder1": { 530 | "$ref": "#/components/schemas/CellRef" 531 | } 532 | }, 533 | "required": [ 534 | "dividend0", 535 | "dividend1", 536 | "divisor0", 537 | "divisor1", 538 | "quotient0", 539 | "quotient1", 540 | "remainder0", 541 | "remainder1" 542 | ] 543 | } 544 | }, 545 | "required": ["Uint256DivMod"] 546 | }, 547 | { 548 | "type": "object", 549 | "title": "Uint512DivModByUint256", 550 | "properties": { 551 | "Uint512DivModByUint256": { 552 | "type": "object", 553 | "properties": { 554 | "dividend0": { 555 | "$ref": "#/components/schemas/ResOperand" 556 | }, 557 | "dividend1": { 558 | "$ref": "#/components/schemas/ResOperand" 559 | }, 560 | "dividend2": { 561 | "$ref": "#/components/schemas/ResOperand" 562 | }, 563 | "dividend3": { 564 | "$ref": "#/components/schemas/ResOperand" 565 | }, 566 | "divisor0": { 567 | "$ref": "#/components/schemas/ResOperand" 568 | }, 569 | "divisor1": { 570 | "$ref": "#/components/schemas/ResOperand" 571 | }, 572 | "quotient0": { 573 | "$ref": "#/components/schemas/CellRef" 574 | }, 575 | "quotient1": { 576 | "$ref": "#/components/schemas/CellRef" 577 | }, 578 | "quotient2": { 579 | "$ref": "#/components/schemas/CellRef" 580 | }, 581 | "quotient3": { 582 | "$ref": "#/components/schemas/CellRef" 583 | }, 584 | "remainder0": { 585 | "$ref": "#/components/schemas/CellRef" 586 | }, 587 | "remainder1": { 588 | "$ref": "#/components/schemas/CellRef" 589 | } 590 | }, 591 | "required": [ 592 | "dividend0", 593 | "dividend1", 594 | "dividend2", 595 | "dividend3", 596 | "divisor0", 597 | "divisor1", 598 | "quotient0", 599 | "quotient1", 600 | "quotient2", 601 | "quotient3", 602 | "remainder0", 603 | "remainder1" 604 | ] 605 | } 606 | }, 607 | "required": ["Uint512DivModByUint256"] 608 | }, 609 | { 610 | "type": "object", 611 | "title": "SquareRoot", 612 | "properties": { 613 | "SquareRoot": { 614 | "type": "object", 615 | "properties": { 616 | "value": { 617 | "$ref": "#/components/schemas/ResOperand" 618 | }, 619 | "dst": { 620 | "$ref": "#/components/schemas/CellRef" 621 | } 622 | }, 623 | "required": ["value", "dst"] 624 | } 625 | }, 626 | "required": ["SquareRoot"] 627 | }, 628 | { 629 | "type": "object", 630 | "title": "Uint256SquareRoot", 631 | "properties": { 632 | "Uint256SquareRoot": { 633 | "type": "object", 634 | "properties": { 635 | "value_low": { 636 | "$ref": "#/components/schemas/ResOperand" 637 | }, 638 | "value_high": { 639 | "$ref": "#/components/schemas/ResOperand" 640 | }, 641 | "sqrt0": { 642 | "$ref": "#/components/schemas/CellRef" 643 | }, 644 | "sqrt1": { 645 | "$ref": "#/components/schemas/CellRef" 646 | }, 647 | "remainder_low": { 648 | "$ref": "#/components/schemas/CellRef" 649 | }, 650 | "remainder_high": { 651 | "$ref": "#/components/schemas/CellRef" 652 | }, 653 | "sqrt_mul_2_minus_remainder_ge_u128": { 654 | "$ref": "#/components/schemas/CellRef" 655 | } 656 | }, 657 | "required": [ 658 | "value_low", 659 | "value_high", 660 | "sqrt0", 661 | "sqrt1", 662 | "remainder_low", 663 | "remainder_high", 664 | "sqrt_mul_2_minus_remainder_ge_u128" 665 | ] 666 | } 667 | }, 668 | "required": ["Uint256SquareRoot"] 669 | }, 670 | { 671 | "type": "object", 672 | "title": "LinearSplit", 673 | "properties": { 674 | "LinearSplit": { 675 | "type": "object", 676 | "properties": { 677 | "value": { 678 | "$ref": "#/components/schemas/ResOperand" 679 | }, 680 | "scalar": { 681 | "$ref": "#/components/schemas/ResOperand" 682 | }, 683 | "max_x": { 684 | "$ref": "#/components/schemas/ResOperand" 685 | }, 686 | "x": { 687 | "$ref": "#/components/schemas/CellRef" 688 | }, 689 | "y": { 690 | "$ref": "#/components/schemas/CellRef" 691 | } 692 | }, 693 | "required": ["value", "scalar", "max_x", "x", "y"] 694 | } 695 | }, 696 | "required": ["LinearSplit"] 697 | }, 698 | { 699 | "type": "object", 700 | "title": "AllocFelt252Dict", 701 | "properties": { 702 | "AllocFelt252Dict": { 703 | "type": "object", 704 | "properties": { 705 | "segment_arena_ptr": { 706 | "$ref": "#/components/schemas/ResOperand" 707 | } 708 | }, 709 | "required": ["segment_arena_ptr"] 710 | } 711 | }, 712 | "required": ["AllocFelt252Dict"] 713 | }, 714 | { 715 | "type": "object", 716 | "title": "Felt252DictEntryInit", 717 | "properties": { 718 | "Felt252DictEntryInit": { 719 | "type": "object", 720 | "properties": { 721 | "dict_ptr": { 722 | "$ref": "#/components/schemas/ResOperand" 723 | }, 724 | "key": { 725 | "$ref": "#/components/schemas/ResOperand" 726 | } 727 | }, 728 | "required": ["dict_ptr", "key"] 729 | } 730 | }, 731 | "required": ["Felt252DictEntryInit"] 732 | }, 733 | { 734 | "type": "object", 735 | "title": "Felt252DictEntryUpdate", 736 | "properties": { 737 | "Felt252DictEntryUpdate": { 738 | "type": "object", 739 | "properties": { 740 | "dict_ptr": { 741 | "$ref": "#/components/schemas/ResOperand" 742 | }, 743 | "value": { 744 | "$ref": "#/components/schemas/ResOperand" 745 | } 746 | }, 747 | "required": ["dict_ptr", "value"] 748 | } 749 | }, 750 | "required": ["Felt252DictEntryUpdate"] 751 | }, 752 | { 753 | "type": "object", 754 | "title": "GetSegmentArenaIndex", 755 | "properties": { 756 | "GetSegmentArenaIndex": { 757 | "type": "object", 758 | "properties": { 759 | "dict_end_ptr": { 760 | "$ref": "#/components/schemas/ResOperand" 761 | }, 762 | "dict_index": { 763 | "$ref": "#/components/schemas/CellRef" 764 | } 765 | }, 766 | "required": ["dict_end_ptr", "dict_index"] 767 | } 768 | }, 769 | "required": ["GetSegmentArenaIndex"] 770 | }, 771 | { 772 | "type": "object", 773 | "title": "InitSquashData", 774 | "properties": { 775 | "InitSquashData": { 776 | "type": "object", 777 | "properties": { 778 | "dict_accesses": { 779 | "$ref": "#/components/schemas/ResOperand" 780 | }, 781 | "ptr_diff": { 782 | "$ref": "#/components/schemas/ResOperand" 783 | }, 784 | "n_accesses": { 785 | "$ref": "#/components/schemas/ResOperand" 786 | }, 787 | "big_keys": { 788 | "$ref": "#/components/schemas/CellRef" 789 | }, 790 | "first_key": { 791 | "$ref": "#/components/schemas/CellRef" 792 | } 793 | }, 794 | "required": [ 795 | "dict_accesses", 796 | "ptr_diff", 797 | "n_accesses", 798 | "big_keys", 799 | "first_key" 800 | ] 801 | } 802 | }, 803 | "required": ["InitSquashData"] 804 | }, 805 | { 806 | "type": "object", 807 | "title": "GetCurrentAccessIndex", 808 | "properties": { 809 | "GetCurrentAccessIndex": { 810 | "type": "object", 811 | "properties": { 812 | "range_check_ptr": { 813 | "$ref": "#/components/schemas/ResOperand" 814 | } 815 | }, 816 | "required": ["range_check_ptr"] 817 | } 818 | }, 819 | "required": ["GetCurrentAccessIndex"] 820 | }, 821 | { 822 | "type": "object", 823 | "title": "ShouldSkipSquashLoop", 824 | "properties": { 825 | "ShouldSkipSquashLoop": { 826 | "type": "object", 827 | "properties": { 828 | "should_skip_loop": { 829 | "$ref": "#/components/schemas/CellRef" 830 | } 831 | }, 832 | "required": ["should_skip_loop"] 833 | } 834 | }, 835 | "required": ["ShouldSkipSquashLoop"] 836 | }, 837 | { 838 | "type": "object", 839 | "title": "GetCurrentAccessDelta", 840 | "properties": { 841 | "GetCurrentAccessDelta": { 842 | "type": "object", 843 | "properties": { 844 | "index_delta_minus1": { 845 | "$ref": "#/components/schemas/CellRef" 846 | } 847 | }, 848 | "required": ["index_delta_minus1"] 849 | } 850 | }, 851 | "required": ["GetCurrentAccessDelta"] 852 | }, 853 | { 854 | "type": "object", 855 | "title": "ShouldContinueSquashLoop", 856 | "properties": { 857 | "ShouldContinueSquashLoop": { 858 | "type": "object", 859 | "properties": { 860 | "should_continue": { 861 | "$ref": "#/components/schemas/CellRef" 862 | } 863 | }, 864 | "required": ["should_continue"] 865 | } 866 | }, 867 | "required": ["ShouldContinueSquashLoop"] 868 | }, 869 | { 870 | "type": "object", 871 | "title": "GetNextDictKey", 872 | "properties": { 873 | "GetNextDictKey": { 874 | "type": "object", 875 | "properties": { 876 | "next_key": { 877 | "$ref": "#/components/schemas/CellRef" 878 | } 879 | }, 880 | "required": ["next_key"] 881 | } 882 | }, 883 | "required": ["GetNextDictKey"] 884 | }, 885 | { 886 | "type": "object", 887 | "title": "AssertLeFindSmallArcs", 888 | "properties": { 889 | "AssertLeFindSmallArcs": { 890 | "type": "object", 891 | "properties": { 892 | "range_check_ptr": { 893 | "$ref": "#/components/schemas/ResOperand" 894 | }, 895 | "a": { 896 | "$ref": "#/components/schemas/ResOperand" 897 | }, 898 | "b": { 899 | "$ref": "#/components/schemas/ResOperand" 900 | } 901 | }, 902 | "required": ["range_check_ptr", "a", "b"] 903 | } 904 | }, 905 | "required": ["AssertLeFindSmallArcs"] 906 | }, 907 | { 908 | "type": "object", 909 | "title": "AssertLeIsFirstArcExcluded", 910 | "properties": { 911 | "AssertLeIsFirstArcExcluded": { 912 | "type": "object", 913 | "properties": { 914 | "skip_exclude_a_flag": { 915 | "$ref": "#/components/schemas/CellRef" 916 | } 917 | }, 918 | "required": ["skip_exclude_a_flag"] 919 | } 920 | }, 921 | "required": ["AssertLeIsFirstArcExcluded"] 922 | }, 923 | { 924 | "type": "object", 925 | "title": "AssertLeIsSecondArcExcluded", 926 | "properties": { 927 | "AssertLeIsSecondArcExcluded": { 928 | "type": "object", 929 | "properties": { 930 | "skip_exclude_b_minus_a": { 931 | "$ref": "#/components/schemas/CellRef" 932 | } 933 | }, 934 | "required": ["skip_exclude_b_minus_a"] 935 | } 936 | }, 937 | "required": ["AssertLeIsSecondArcExcluded"] 938 | }, 939 | { 940 | "type": "object", 941 | "title": "RandomEcPoint", 942 | "properties": { 943 | "RandomEcPoint": { 944 | "type": "object", 945 | "properties": { 946 | "x": { 947 | "$ref": "#/components/schemas/CellRef" 948 | }, 949 | "y": { 950 | "$ref": "#/components/schemas/CellRef" 951 | } 952 | }, 953 | "required": ["x", "y"] 954 | } 955 | }, 956 | "required": ["RandomEcPoint"] 957 | }, 958 | { 959 | "type": "object", 960 | "title": "FieldSqrt", 961 | "properties": { 962 | "FieldSqrt": { 963 | "type": "object", 964 | "properties": { 965 | "val": { 966 | "$ref": "#/components/schemas/ResOperand" 967 | }, 968 | "sqrt": { 969 | "$ref": "#/components/schemas/CellRef" 970 | } 971 | }, 972 | "required": ["val", "sqrt"] 973 | } 974 | }, 975 | "required": ["FieldSqrt"] 976 | }, 977 | { 978 | "type": "object", 979 | "title": "DebugPrint", 980 | "properties": { 981 | "DebugPrint": { 982 | "type": "object", 983 | "properties": { 984 | "start": { 985 | "$ref": "#/components/schemas/ResOperand" 986 | }, 987 | "end": { 988 | "$ref": "#/components/schemas/ResOperand" 989 | } 990 | }, 991 | "required": ["start", "end"] 992 | } 993 | }, 994 | "required": ["DebugPrint"] 995 | }, 996 | { 997 | "type": "object", 998 | "title": "AllocConstantSize", 999 | "properties": { 1000 | "AllocConstantSize": { 1001 | "type": "object", 1002 | "properties": { 1003 | "size": { 1004 | "$ref": "#/components/schemas/ResOperand" 1005 | }, 1006 | "dst": { 1007 | "$ref": "#/components/schemas/CellRef" 1008 | } 1009 | }, 1010 | "required": ["size", "dst"] 1011 | } 1012 | }, 1013 | "required": ["AllocConstantSize"] 1014 | }, 1015 | { 1016 | "type": "object", 1017 | "title": "U256InvModN", 1018 | "properties": { 1019 | "U256InvModN": { 1020 | "type": "object", 1021 | "properties": { 1022 | "b0": { 1023 | "$ref": "#/components/schemas/ResOperand" 1024 | }, 1025 | "b1": { 1026 | "$ref": "#/components/schemas/ResOperand" 1027 | }, 1028 | "n0": { 1029 | "$ref": "#/components/schemas/ResOperand" 1030 | }, 1031 | "n1": { 1032 | "$ref": "#/components/schemas/ResOperand" 1033 | }, 1034 | "g0_or_no_inv": { 1035 | "$ref": "#/components/schemas/CellRef" 1036 | }, 1037 | "g1_option": { 1038 | "$ref": "#/components/schemas/CellRef" 1039 | }, 1040 | "s_or_r0": { 1041 | "$ref": "#/components/schemas/CellRef" 1042 | }, 1043 | "s_or_r1": { 1044 | "$ref": "#/components/schemas/CellRef" 1045 | }, 1046 | "t_or_k0": { 1047 | "$ref": "#/components/schemas/CellRef" 1048 | }, 1049 | "t_or_k1": { 1050 | "$ref": "#/components/schemas/CellRef" 1051 | } 1052 | }, 1053 | "required": [ 1054 | "b0", 1055 | "b1", 1056 | "n0", 1057 | "n1", 1058 | "g0_or_no_inv", 1059 | "g1_option", 1060 | "s_or_r0", 1061 | "s_or_r1", 1062 | "t_or_k0", 1063 | "t_or_k1" 1064 | ] 1065 | } 1066 | }, 1067 | "required": ["U256InvModN"] 1068 | }, 1069 | { 1070 | "type": "object", 1071 | "title": "EvalCircuit", 1072 | "properties": { 1073 | "EvalCircuit": { 1074 | "type": "object", 1075 | "properties": { 1076 | "n_add_mods": { 1077 | "$ref": "#/components/schemas/ResOperand" 1078 | }, 1079 | "add_mod_builtin": { 1080 | "$ref": "#/components/schemas/ResOperand" 1081 | }, 1082 | "n_mul_mods": { 1083 | "$ref": "#/components/schemas/ResOperand" 1084 | }, 1085 | "mul_mod_builtin": { 1086 | "$ref": "#/components/schemas/ResOperand" 1087 | } 1088 | }, 1089 | "required": [ 1090 | "n_add_mods", 1091 | "add_mod_builtin", 1092 | "n_mul_mods", 1093 | "mul_mod_builtin" 1094 | ] 1095 | } 1096 | }, 1097 | "required": ["EvalCircuit"] 1098 | } 1099 | ] 1100 | }, 1101 | "STARKNET_HINT": { 1102 | "oneOf": [ 1103 | { 1104 | "type": "object", 1105 | "title": "SystemCall", 1106 | "properties": { 1107 | "SystemCall": { 1108 | "type": "object", 1109 | "properties": { 1110 | "system": { 1111 | "$ref": "#/components/schemas/ResOperand" 1112 | } 1113 | }, 1114 | "required": ["system"] 1115 | } 1116 | }, 1117 | "required": ["SystemCall"] 1118 | }, 1119 | { 1120 | "type": "object", 1121 | "title": "Cheatcode", 1122 | "properties": { 1123 | "Cheatcode": { 1124 | "type": "object", 1125 | "properties": { 1126 | "selector": { 1127 | "$ref": "#/components/schemas/NUM_AS_HEX" 1128 | }, 1129 | "input_start": { 1130 | "$ref": "#/components/schemas/ResOperand" 1131 | }, 1132 | "input_end": { 1133 | "$ref": "#/components/schemas/ResOperand" 1134 | }, 1135 | "output_start": { 1136 | "$ref": "#/components/schemas/CellRef" 1137 | }, 1138 | "output_end": { 1139 | "$ref": "#/components/schemas/CellRef" 1140 | } 1141 | }, 1142 | "required": [ 1143 | "selector", 1144 | "input_start", 1145 | "input_end", 1146 | "output_start", 1147 | "output_end" 1148 | ] 1149 | } 1150 | }, 1151 | "required": ["Cheatcode"] 1152 | } 1153 | ] 1154 | }, 1155 | "FELT": { 1156 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/FELT" 1157 | }, 1158 | "NUM_AS_HEX": { 1159 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/NUM_AS_HEX" 1160 | }, 1161 | "DEPRECATED_CAIRO_ENTRY_POINT": { 1162 | "$ref": "./api/starknet_api_openrpc.json#/components/schemas/DEPRECATED_CAIRO_ENTRY_POINT" 1163 | } 1164 | }, 1165 | "errors": { 1166 | "COMPILATION_ERROR": { 1167 | "code": 100, 1168 | "message": "Failed to compile the contract", 1169 | "data": { 1170 | "type": "object", 1171 | "description": "More data about the compilation failure", 1172 | "properties": { 1173 | "compilation_error": { 1174 | "title": "compilation error", 1175 | "type": "string" 1176 | } 1177 | }, 1178 | "required": "compilation_error" 1179 | } 1180 | } 1181 | } 1182 | } 1183 | } 1184 | --------------------------------------------------------------------------------