From a9fb2788b286fbd95fcb3548d1b10989f9782679 Mon Sep 17 00:00:00 2001 From: amanusk Date: Thu, 28 Mar 2024 15:19:28 +0200 Subject: [PATCH 01/17] Add wallet rpc for wallet dapp communication --- wallet-api/wallet_rpc.json | 752 +++++++++++++++++++++++++++++++++++++ 1 file changed, 752 insertions(+) create mode 100644 wallet-api/wallet_rpc.json diff --git a/wallet-api/wallet_rpc.json b/wallet-api/wallet_rpc.json new file mode 100644 index 0000000..2eed977 --- /dev/null +++ b/wallet-api/wallet_rpc.json @@ -0,0 +1,752 @@ +{ + "openrpc": "1.0.0-rc1", + "info": { + "version": "0.1.0", + "title": "Starknet Wallet API", + "license": {} + }, + "servers": [], + "methods": [ + { + "name": "starknet_supportedSpecs", + "summary": "Returns a list of rpc spec versions compatible with the wallet", + "params": [], + "result": { + "name": "result", + "description": "Semver of Starknet's JSON-RPC supported by the wallet", + "required": true, + "schema": { + "type": "array", + "properties": { + "items": { + "$ref": "#/components/schemas/SPEC_VERSION" + } + } + } + } + }, + { + "name": "wallet_getPermissions", + "summary": "Opens a window in the wallet and ask the authorization to connect your DAPP", + "params": [], + "result": { + "name": "result", + "schema": { + "title": "Wallet permissions", + "oneOf": [ + { + "type": "array", + "properties": { + "items": { + "$ref": "#/components/schemas/PERMISSION" + } + } + }, + { + "type": "array", + "title": "Empty array" + } + ], + "required": [] + } + }, + "errors": [] + }, + { + "name": "wallet_requestAccounts", + "summary": "Get the account address of the wallet active account", + "paramStructure": "by-name", + "params": [ + { + "name": "silent_mode", + "summary": "if true, the wallet will not show the wallet-unlock UI in case of a locked wallet, nor the dApp-approve UI in case of a non-allowed dApp", + "required": false, + "schema": { + "type": "boolean" + } + } + ], + "result": { + "name": "result", + "description": "The active account of the wallet", + "schema": { + "title": "Wallet Accounts", + "type": "array", + "items": { + "$ref": "#/components/schemas/ADDRESS" + }, + "required": [] + } + }, + "errors": [] + }, + { + "name": "wallet_deploymentData", + "summary": "Request from the current wallet the data required to deploy the account at the current address", + "params": [], + "result": { + "name": "result", + "schema": { + "title": "GetDeploymentDataResult", + "$ref": "#/components/schemas/ACCOUNT_DEPLOYMENT_DATA" + } + }, + "errors": [] + }, + { + "name": "wallet_switchStarknetChain", + "summary": "Change the current network of the wallet", + "paramStructure": "by-name", + "params": [ + { + "name": "chainId", + "required": true, + "schema": { + "$ref": "#/components/schemas/CHAIN_ID" + } + } + ], + "result": { + "name": "response", + "summary": "If wallet agrees to change network, return true. If the current network is selected, return true. If network is inconsistent, return false", + "required": true, + "schema": { + "type": "boolean" + } + }, + "errors": [] + }, + { + "name": "wallet_requestAccounts", + "summary": "Get the account address of the wallet active account", + "paramStructure": "by-name", + "params": [ + { + "name": "silent_mode", + "summary": "if true, the wallet will not show the wallet-unlock UI in case of a locked wallet, nor the dApp-approve UI in case of a non-allowed dApp", + "required": false, + "schema": { + "type": "boolean" + } + } + ], + "result": { + "name": "result", + "description": "The active account of the wallet", + "schema": { + "title": "Wallet Accounts", + "type": "array", + "items": { + "$ref": "#/components/schemas/ADDRESS" + }, + "required": [] + } + }, + "errors": [] + }, + { + "name": "wallet_watchAsset", + "summary": "Add a token in the list of assets displayed by the wallet", + "params": [ + { + "name": "WatchAssetParameters", + "description": "Information needed to add asset", + "required": true, + "schema": { + "$ref": "#/components/schemas/ASSET" + } + } + ], + "result": { + "name": "response", + "summary": "If adding a token is agreed, return true", + "required": true, + "schema": { + "type": "boolean" + } + }, + "errors": [ + { + "$ref": "#/components/errors/NOT_ERC20" + } + ] + }, + { + "name": "wallet_addStarknetChain", + "summary": "Add a new network in the list of networks of the wallet", + "params": [ + { + "name": "AddStarknetChainParameters", + "description": "Information for the chain to add to the wallet", + "required": true, + "schema": { + "$ref": "#/components/schemas/STARKNET_CHAIN" + } + } + ], + "result": { + "name": "response", + "summary": "If agreed, return true. Inconsistent return false", + "required": true, + "schema": { + "type": "boolean" + } + }, + "errors": [ + { + "$ref": "#/components/errors/INCORRECT_NETWORK" + } + ] + }, + { + "name": "starknet_addInvokeTransaction", + "summary": "Submit a new transaction to be added to the chain", + "params": [ + { + "name": "invoke_transaction", + "description": "The information needed to invoke the function (or account, for version 1 transactions)", + "required": true, + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/INVOKE_CALL" + } + } + } + ], + "result": { + "name": "result", + "description": "The result of the transaction submission", + "schema": { + "type": "object", + "properties": { + "transaction_hash": { + "title": "The hash of the invoke transaction", + "$ref": "#/components/schemas/TXN_HASH" + } + }, + "required": ["transaction_hash"] + } + }, + "errors": [ + { + "$ref": "#/components/errors/UNEXPECTED_ERROR" + } + ] + }, + { + "name": "starknet_addDeclareTransaction", + "summary": "Submit a declare transaction", + "params": [ + { + "name": "declare_transaction", + "description": "The information needed to declare a new class", + "required": true, + "schema": { + "$ref": "#/components/schemas/DECLARE_TXN" + } + } + ], + "result": { + "name": "result", + "description": "The result of the transaction submission", + "schema": { + "type": "object", + "properties": { + "transaction_hash": { + "title": "The hash of the declare transaction", + "$ref": "#/components/schemas/TXN_HASH" + }, + "class_hash": { + "title": "The hash of the declared class", + "$ref": "#/components/schemas/FELT" + } + }, + "required": ["transaction_hash", "class_hash"] + } + }, + "errors": [ + { + "$ref": "#/components/errors/UNEXPECTED_ERROR" + } + ] + }, + { + "name": "starknet_addDeployAccountTransaction", + "summary": "Deploy a new account in the current network. It's not linked to the type of accounts provided by the wallet ; you have to define which class to use", + "params": [ + { + "name": "deploy_account_transaction", + "description": "The deploy account transaction", + "required": true, + "schema": { + "$ref": "#/components/schemas/DEPLOY_ACCOUNT_TXN" + } + } + ], + "result": { + "name": "result", + "description": "The result of the transaction submission", + "schema": { + "type": "object", + "properties": { + "transaction_hash": { + "title": "The hash of the deploy transaction", + "$ref": "#/components/schemas/TXN_HASH" + }, + "contract_address": { + "title": "The address of the new contract", + "$ref": "#/components/schemas/FELT" + } + }, + "required": ["transaction_hash", "contract_address"] + } + }, + "errors": [ + { + "$ref": "#/components/errors/UNEXPECTED_ERROR" + } + ] + }, + { + "name": "starknet_signTypedData", + "summary": "Sign typed data using the wallet", + "params": [ + { + "name": "typed_data", + "description": "The typed data to sign", + "required": true, + "schema": { + "$ref": "#/components/schemas/TYPED_DATA" + } + } + ], + "result": { + "name": "response", + "summary": "The signature over the typed data", + "required": true, + "schema": { + "$ref": "#/components/schemas/SIGNATURE" + } + }, + "errors": [ + { + "$ref": "#/components/errors/UNEXPECTED_ERROR" + } + ] + } + ], + "components": { + "contentDescriptors": {}, + "schemas": { + "TXN_HASH": { + "title": "Transaction hash", + "description": "The transaction hash, as assigned in StarkNet", + "$ref": "#/components/schemas/FELT" + }, + "ADDRESS": { + "title": "Address", + "$ref": "#/components/schemas/FELT" + }, + "SYMBOL": { + "title": "ERC20 Token Symbol", + "description": "The symbol of an contract", + "type": "string", + "minLength": 2, + "maxLength": 6, + "pattern": "^[A-Za-z0-9]{1,5}$" + }, + "SPEC_VERSION": { + "title": "Starknet Spec Version", + "description": "A Starknet RPC spec version, only two numbers are provided", + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+$" + }, + "PERMISSION": { + "title": "Wallet permission", + "type": "string", + "enum": ["accounts"], + "description": "Optional wallet permissions" + }, + "ASSET": { + "title": "Starknet Token", + "description": "Details of an onchain Starknet token", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["ERC20"] + }, + "options": { + "type": "object", + "properties": { + "address": { + "title": "Token Address", + "$ref": "#/components/schemas/ADDRESS" + }, + "symbol": { + "title": "Token Symbol", + "$ref": "#/components/schemas/SYMBOL" + }, + "decimals": { + "type": "number", + "minimum": 0 + }, + "image": { + "type": "string", + "format": "uri" + }, + "name": { + "type": "string" + } + }, + "required": ["address"] + } + }, + "required": ["type", "options"] + }, + "CHAIN_ID": { + "title": "Chain id", + "description": "StarkNet chain id, given in hex representation.", + "type": "string", + "pattern": "^0x[a-fA-F0-9]+$" + }, + "STARKNET_CHAIN_ID": { + "title": "Starknet Chain id", + "description": "Only chain IDs supported by Starknet officialy", + "allOf": [ + { + "type": "string", + "enum": ["0x534e5f4d41494e", "0x534e5f474f45524c49", "0x534e5f5345504f4c4941"] + }, + { + "$ref": "#/components/schemas/CHAIN_ID" + } + ] + }, + "ACCOUNT_DEPLOYMENT_DATA": { + "title": "Account Deployment Data", + "description": "Data required to deploy an account at and address", + "type": "object", + "properties": { + "address": { + "title": "Address", + "description": "The expected address to be depolyed, used to double check", + "$ref": "#/components/schemas/ADDRESS" + }, + "class_hash": { + "title": "Class hash", + "description": "The hash of the deployed contract's class", + "$ref": "#/components/schemas/FELT" + }, + "salt": { + "title": "Class hash", + "description": "The hash of the deployed contract's class", + "$ref": "#/components/schemas/FELT" + }, + "calldata": { + "type": "array", + "description": "The parameters passed to the constructor", + "title": "Constructor calldata", + "items": { + "$ref": "#/components/schemas/FELT" + } + }, + "sigdata": { + "title": "Signature Data", + "type": "array", + "description": "Optional array of felts to be added to the signature", + "items": { + "$ref": "#/components/schemas/FELT" + } + }, + "version": { + "title": "Contract Version", + "description": "The Cairo version of the contract 0 or 1", + "type": "integer", + "enum": [0, 1] + } + }, + "required": ["address", "class_hash", "salt", "calldata", "version"] + }, + "INVOKE_CALL": { + "title": "Invoke transaction", + "description": "initiates a transaction from a given account", + "type": "object", + "properties": { + "contract_address": { + "title": "sender address", + "$ref": "#/components/schemas/ADDRESS" + }, + "entry_point": { + "title": "Contract entry point", + "$ref": "#/components/schemas/FELT" + }, + "calldata": { + "type": "array", + "title": "calldata", + "description": "Calldata to be passed to the entrypoint", + "items": { + "$ref": "#/components/schemas/FELT" + } + } + }, + "required": ["contract_address", "calldata", "entry_point"] + }, + "DECLARE_TXN": { + "title": "Declare Transaction", + "description": "Declare Contract Transaction", + "type": "object", + "properties": { + "compiled_class_hash": { + "title": "Compiled class hash", + "description": "The hash of the Cairo assembly resulting from the Sierra compilation", + "$ref": "#/components/schemas/FELT" + }, + "contract_class": { + "title": "Contract class", + "description": "The class to be declared", + "$ref": "#/components/schemas/CONTRACT_CLASS" + } + }, + "required": ["compiled_class_hash", "contract_class"] + }, + "DEPLOY_ACCOUNT_TXN": { + "title": "Deploy account transaction", + "description": "Deploys an account contract, charges fee from the pre-funded account addresses", + "type": "object", + "properties": { + "contract_address_salt": { + "title": "Contract address salt", + "description": "The salt for the address of the deployed contract", + "$ref": "#/components/schemas/FELT" + }, + "constructor_calldata": { + "type": "array", + "description": "The parameters passed to the constructor", + "title": "Constructor calldata", + "items": { + "$ref": "#/components/schemas/FELT" + } + }, + "class_hash": { + "title": "Class hash", + "description": "The hash of the deployed contract's class", + "$ref": "#/components/schemas/FELT" + } + }, + "required": ["contract_address_salt", "constructor_calldata", "class_hash"] + }, + "STARKNET_CHAIN": { + "title": "AddStarknetChainParameters", + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "chainId": { + "title": "Starknet Chain Id", + "$ref": "#/components/schemas/CHAIN_ID" + }, + "chainName": { + "type": "string" + }, + "rpcUrls": { + "type": "array", + "items": { + "type": "string", + "format": "uri" + }, + "minItems": 1, + "uniqueItems": true + }, + "blockExplorerUrls": { + "type": "array", + "items": { + "type": "string", + "format": "uri" + }, + "minItems": 1, + "uniqueItems": true + }, + "nativeCurrency": { + "title": "Native Currency", + "$ref": "#/components/schemas/ASSET" + }, + "iconUrls": { + "type": "array", + "items": { + "type": "string", + "format": "uri" + }, + "minItems": 1, + "uniqueItems": true + } + }, + "required": ["id", "chainId", "chainName"] + }, + "SIERRA_ENTRY_POINT": { + "title": "Sierra entry point", + "type": "object", + "properties": { + "selector": { + "title": "Selector", + "description": "A unique identifier of the entry point (function) in the program", + "$ref": "#/components/schemas/FELT" + }, + "function_idx": { + "title": "Function index", + "description": "The index of the function in the program", + "type": "integer" + } + }, + "required": ["selector", "function_idx"] + }, + "STARKNET_MERKLE_TYPE": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string", + "enum": ["merkletree"] + }, + "contains": { + "type": "string" + } + }, + "required": ["name", "type", "contains"] + }, + "STARKNET_TYPE": { + "description": "A single type, as part of a struct. The `type` field can be any of the EIP-712 supported types", + "schema": { + "anyOf": [ + { + "type": "object", + "properties": { + "name": { "type": "string" }, + "type": { "type": "string" } + }, + "required": ["name", "type"] + }, + { + "$ref": "#/components/schemas/STARKNET_MERKLE_TYPE" + } + ] + } + }, + "TYPED_DATA": { + "title": "TypedData", + "type": "object", + "properties": { + "types": { + "description": "primaryType represents the top-level type of the object in the message", + "type": "array", + "itmes": { + "$ref": "#/components/schemas/STARKNET_TYPE" + } + }, + "primaryType": { + "type": "string", + "description": "primaryType represents the top-level type of the object in the message" + }, + "domain": { + "description": "The EIP712 domain struct. Any of these fields are optional, but it must contain at least one field", + "$ref": "#/components/schemas/STARKNET_DOMAIN" + }, + "message": { + "type": "object", + "description": "The message to be signed" + } + }, + "required": ["types", "primaryType", "domain", "message"] + }, + "STARKNET_DOMAIN": { + "type": "object", + "minProperties": 1, + "properties": { + "name": { "type": "string" }, + "version": { "type": "string" }, + "chainId": { + "anyOf": [{ "type": "string" }, { "type": "number" }] + } + } + }, + "CONTRACT_CLASS": { + "title": "Contract class", + "type": "object", + "properties": { + "sierra_program": { + "title": "Sierra program", + "type": "array", + "description": "The list of Sierra instructions of which the program consists", + "items": { + "$ref": "#/components/schemas/FELT" + } + }, + "contract_class_version": { + "title": "Contract class version", + "type": "string", + "description": "The version of the contract class object. Currently, the Starknet OS supports version 0.1.0" + }, + "entry_points_by_type": { + "title": "Entry points by type", + "type": "object", + "properties": { + "CONSTRUCTOR": { + "type": "array", + "title": "Constructor", + "items": { + "$ref": "#/components/schemas/SIERRA_ENTRY_POINT" + } + }, + "EXTERNAL": { + "title": "External", + "type": "array", + "items": { + "$ref": "#/components/schemas/SIERRA_ENTRY_POINT" + } + }, + "L1_HANDLER": { + "title": "L1 handler", + "type": "array", + "items": { + "$ref": "#/components/schemas/SIERRA_ENTRY_POINT" + } + } + }, + "required": ["CONSTRUCTOR", "EXTERNAL", "L1_HANDLER"] + }, + "abi": { + "title": "ABI", + "type": "string", + "description": "The class ABI, as supplied by the user declaring the class" + } + }, + "required": ["sierra_program", "contract_class_version", "entry_points_by_type"] + }, + "SIGNATURE": { + "$ref": "./api/starknet_api_openrpc.json#/components/schemas/SIGNATURE" + }, + "FELT": { + "$ref": "./api/starknet_api_openrpc.json#/components/schemas/FELT" + } + }, + "errors": { + "NOT_ERC20": { + "code": 11, + "message": "Asset is not an ERC20" + }, + "INCORRECT_NETWORK": { + "code": 12, + "message": "Network details are incorrect" + }, + "UNEXPECTED_ERROR": { + "code": 63, + "message": "An unexpected error occurred", + "data": "string" + } + } + } +} From c174decc4a1981eac33043c49efa478737fa1820 Mon Sep 17 00:00:00 2001 From: amanusk Date: Thu, 28 Mar 2024 15:26:40 +0200 Subject: [PATCH 02/17] add file to ci --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9e4d38c..eae5611 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "url": "https://github.com/starkware-libs/starknet-specs.git" }, "scripts": { - "validate_all": "node validate.js api/starknet_api_openrpc.json && node validate.js api/starknet_write_api.json && node validate.js api/starknet_trace_api_openrpc.json" + "validate_all": "node validate.js api/starknet_api_openrpc.json && node validate.js api/starknet_write_api.json && node validate.js api/starknet_trace_api_openrpc.json && node validate.js ./wallet-api/wallet_rpc.json" }, "author": "Lior Schejter", "license": "MIT", @@ -16,4 +16,4 @@ "fs-extra": "10.1.0", "@json-schema-tools/dereferencer": "1.5.4" } -} \ No newline at end of file +} From d584e478c7248c0323b8791a69753ee4eaa30390 Mon Sep 17 00:00:00 2001 From: amanusk Date: Thu, 28 Mar 2024 15:38:28 +0200 Subject: [PATCH 03/17] Add wallet_requestChainId --- wallet-api/wallet_rpc.json | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/wallet-api/wallet_rpc.json b/wallet-api/wallet_rpc.json index 2eed977..b0d93ec 100644 --- a/wallet-api/wallet_rpc.json +++ b/wallet-api/wallet_rpc.json @@ -55,7 +55,6 @@ { "name": "wallet_requestAccounts", "summary": "Get the account address of the wallet active account", - "paramStructure": "by-name", "params": [ { "name": "silent_mode", @@ -80,6 +79,19 @@ }, "errors": [] }, + { + "name": "wallet_requestChainId", + "summary": "Request the current Chain Id", + "params": [], + "result": { + "name": "result", + "description": "The active chainId", + "schema": { + "$ref": "#/components/schemas/STARKNET_CHAIN_ID" + } + }, + "errors": [] + }, { "name": "wallet_deploymentData", "summary": "Request from the current wallet the data required to deploy the account at the current address", From d7722ab4d3813d8c32fec652e98d2b928a86a682 Mon Sep 17 00:00:00 2001 From: amanusk Date: Sun, 31 Mar 2024 09:12:42 +0300 Subject: [PATCH 04/17] Reuse known components --- wallet-api/wallet_rpc.json | 134 +++++++++++++------------------------ 1 file changed, 48 insertions(+), 86 deletions(-) diff --git a/wallet-api/wallet_rpc.json b/wallet-api/wallet_rpc.json index b0d93ec..1a7d770 100644 --- a/wallet-api/wallet_rpc.json +++ b/wallet-api/wallet_rpc.json @@ -54,7 +54,7 @@ }, { "name": "wallet_requestAccounts", - "summary": "Get the account address of the wallet active account", + "summary": "Get the account addresses of the wallet active account", "params": [ { "name": "silent_mode", @@ -99,7 +99,6 @@ "result": { "name": "result", "schema": { - "title": "GetDeploymentDataResult", "$ref": "#/components/schemas/ACCOUNT_DEPLOYMENT_DATA" } }, @@ -108,7 +107,6 @@ { "name": "wallet_switchStarknetChain", "summary": "Change the current network of the wallet", - "paramStructure": "by-name", "params": [ { "name": "chainId", @@ -126,12 +124,18 @@ "type": "boolean" } }, - "errors": [] + "errors": [ + { + "$ref": "#/components/errors/INCORRECT_NETWORK" + }, + { + "$ref": "#/components/errors/USER_REFUSED" + } + ] }, { "name": "wallet_requestAccounts", "summary": "Get the account address of the wallet active account", - "paramStructure": "by-name", "params": [ { "name": "silent_mode", @@ -161,7 +165,7 @@ "summary": "Add a token in the list of assets displayed by the wallet", "params": [ { - "name": "WatchAssetParameters", + "name": "Asset to add", "description": "Information needed to add asset", "required": true, "schema": { @@ -188,7 +192,7 @@ "summary": "Add a new network in the list of networks of the wallet", "params": [ { - "name": "AddStarknetChainParameters", + "name": "Starknet Chain Id to add", "description": "Information for the chain to add to the wallet", "required": true, "schema": { @@ -207,6 +211,9 @@ "errors": [ { "$ref": "#/components/errors/INCORRECT_NETWORK" + }, + { + "$ref": "#/components/errors/USER_REFUSED" } ] }, @@ -233,7 +240,7 @@ "type": "object", "properties": { "transaction_hash": { - "title": "The hash of the invoke transaction", + "title": "Transaction Hash", "$ref": "#/components/schemas/TXN_HASH" } }, @@ -241,6 +248,9 @@ } }, "errors": [ + { + "$ref": "#/components/errors/USER_REFUSED" + }, { "$ref": "#/components/errors/UNEXPECTED_ERROR" } @@ -278,6 +288,9 @@ } }, "errors": [ + { + "$ref": "#/components/errors/USER_REFUSED" + }, { "$ref": "#/components/errors/UNEXPECTED_ERROR" } @@ -315,6 +328,9 @@ } }, "errors": [ + { + "$ref": "#/components/errors/USER_REFUSED" + }, { "$ref": "#/components/errors/UNEXPECTED_ERROR" } @@ -342,6 +358,9 @@ } }, "errors": [ + { + "$ref": "#/components/errors/USER_REFUSED" + }, { "$ref": "#/components/errors/UNEXPECTED_ERROR" } @@ -353,7 +372,7 @@ "schemas": { "TXN_HASH": { "title": "Transaction hash", - "description": "The transaction hash, as assigned in StarkNet", + "description": "The transaction hash, as assigned in Starknet", "$ref": "#/components/schemas/FELT" }, "ADDRESS": { @@ -366,7 +385,7 @@ "type": "string", "minLength": 2, "maxLength": 6, - "pattern": "^[A-Za-z0-9]{1,5}$" + "pattern": "^[A-Za-z0-9]{1,6}$" }, "SPEC_VERSION": { "title": "Starknet Spec Version", @@ -419,13 +438,13 @@ }, "CHAIN_ID": { "title": "Chain id", - "description": "StarkNet chain id, given in hex representation.", + "description": "Starknet chain id, given in hex representation.", "type": "string", "pattern": "^0x[a-fA-F0-9]+$" }, "STARKNET_CHAIN_ID": { "title": "Starknet Chain id", - "description": "Only chain IDs supported by Starknet officialy", + "description": "Only officially supported Starknet IDs", "allOf": [ { "type": "string", @@ -443,7 +462,7 @@ "properties": { "address": { "title": "Address", - "description": "The expected address to be depolyed, used to double check", + "description": "The expected address to be deployed, used to double check", "$ref": "#/components/schemas/ADDRESS" }, "class_hash": { @@ -550,7 +569,7 @@ "required": ["contract_address_salt", "constructor_calldata", "class_hash"] }, "STARKNET_CHAIN": { - "title": "AddStarknetChainParameters", + "title": "Starknet Chain", "type": "object", "properties": { "id": { @@ -597,24 +616,8 @@ }, "required": ["id", "chainId", "chainName"] }, - "SIERRA_ENTRY_POINT": { - "title": "Sierra entry point", - "type": "object", - "properties": { - "selector": { - "title": "Selector", - "description": "A unique identifier of the entry point (function) in the program", - "$ref": "#/components/schemas/FELT" - }, - "function_idx": { - "title": "Function index", - "description": "The index of the function in the program", - "type": "integer" - } - }, - "required": ["selector", "function_idx"] - }, "STARKNET_MERKLE_TYPE": { + "title": "Starknet Merkle Type", "type": "object", "properties": { "name": { @@ -631,6 +634,7 @@ "required": ["name", "type", "contains"] }, "STARKNET_TYPE": { + "title": "Starknet Type", "description": "A single type, as part of a struct. The `type` field can be any of the EIP-712 supported types", "schema": { "anyOf": [ @@ -649,7 +653,7 @@ } }, "TYPED_DATA": { - "title": "TypedData", + "title": "Typed Data", "type": "object", "properties": { "types": { @@ -675,6 +679,7 @@ "required": ["types", "primaryType", "domain", "message"] }, "STARKNET_DOMAIN": { + "title": "Starknet Domain", "type": "object", "minProperties": 1, "properties": { @@ -685,58 +690,11 @@ } } }, + "SIERRA_ENTRY_POINT": { + "$ref": "./api/starknet_api_openrpc.json#/components/schemas/SIERRA_ENTRY_POINT" + }, "CONTRACT_CLASS": { - "title": "Contract class", - "type": "object", - "properties": { - "sierra_program": { - "title": "Sierra program", - "type": "array", - "description": "The list of Sierra instructions of which the program consists", - "items": { - "$ref": "#/components/schemas/FELT" - } - }, - "contract_class_version": { - "title": "Contract class version", - "type": "string", - "description": "The version of the contract class object. Currently, the Starknet OS supports version 0.1.0" - }, - "entry_points_by_type": { - "title": "Entry points by type", - "type": "object", - "properties": { - "CONSTRUCTOR": { - "type": "array", - "title": "Constructor", - "items": { - "$ref": "#/components/schemas/SIERRA_ENTRY_POINT" - } - }, - "EXTERNAL": { - "title": "External", - "type": "array", - "items": { - "$ref": "#/components/schemas/SIERRA_ENTRY_POINT" - } - }, - "L1_HANDLER": { - "title": "L1 handler", - "type": "array", - "items": { - "$ref": "#/components/schemas/SIERRA_ENTRY_POINT" - } - } - }, - "required": ["CONSTRUCTOR", "EXTERNAL", "L1_HANDLER"] - }, - "abi": { - "title": "ABI", - "type": "string", - "description": "The class ABI, as supplied by the user declaring the class" - } - }, - "required": ["sierra_program", "contract_class_version", "entry_points_by_type"] + "$ref": "./api/starknet_api_openrpc.json#/components/schemas/CONTRACT_CLASS" }, "SIGNATURE": { "$ref": "./api/starknet_api_openrpc.json#/components/schemas/SIGNATURE" @@ -747,15 +705,19 @@ }, "errors": { "NOT_ERC20": { - "code": 11, + "code": 111, "message": "Asset is not an ERC20" }, "INCORRECT_NETWORK": { - "code": 12, + "code": 112, "message": "Network details are incorrect" }, + "USER_REFUSED": { + "code": 113, + "message": "User refused the operation" + }, "UNEXPECTED_ERROR": { - "code": 63, + "code": 163, "message": "An unexpected error occurred", "data": "string" } From 7e601501e37ba7c491fe844a21bbc252d294ae6a Mon Sep 17 00:00:00 2001 From: amanusk Date: Mon, 8 Apr 2024 04:48:08 +0300 Subject: [PATCH 05/17] Fixes and additional errors * Change all prefixes to wallet_ * Remove deployAccount trasnaction and component * Add error for invalid input parameters --- wallet-api/wallet_rpc.json | 207 ++++++++++++++----------------------- 1 file changed, 78 insertions(+), 129 deletions(-) diff --git a/wallet-api/wallet_rpc.json b/wallet-api/wallet_rpc.json index 1a7d770..85ef456 100644 --- a/wallet-api/wallet_rpc.json +++ b/wallet-api/wallet_rpc.json @@ -8,7 +8,7 @@ "servers": [], "methods": [ { - "name": "starknet_supportedSpecs", + "name": "wallet_supportedSpecs", "summary": "Returns a list of rpc spec versions compatible with the wallet", "params": [], "result": { @@ -27,7 +27,7 @@ }, { "name": "wallet_getPermissions", - "summary": "Opens a window in the wallet and ask the authorization to connect your DAPP", + "summary": "Get the existing permissions for the Dapp from the wallet", "params": [], "result": { "name": "result", @@ -54,11 +54,11 @@ }, { "name": "wallet_requestAccounts", - "summary": "Get the account addresses of the wallet active account", + "summary": "Get the account addresses of the wallet active account, if the Dapp isn't yet permissioned to receive this information, a permission request will be displayed on the wallet UI.", "params": [ { "name": "silent_mode", - "summary": "if true, the wallet will not show the wallet-unlock UI in case of a locked wallet, nor the dApp-approve UI in case of a non-allowed dApp", + "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", "required": false, "schema": { "type": "boolean" @@ -87,7 +87,7 @@ "name": "result", "description": "The active chainId", "schema": { - "$ref": "#/components/schemas/STARKNET_CHAIN_ID" + "$ref": "#/components/schemas/CHAIN_ID" } }, "errors": [] @@ -102,11 +102,18 @@ "$ref": "#/components/schemas/ACCOUNT_DEPLOYMENT_DATA" } }, - "errors": [] + "errors": [ + { + "$ref": "#/components/errors/USER_REFUSED_OP" + }, + { + "$ref": "#/components/errors/UNEXPECTED_ERROR" + } + ] }, { "name": "wallet_switchStarknetChain", - "summary": "Change the current network of the wallet", + "summary": "Change the current network of the wallet, a permission request will be displayed on the wallet UI.", "params": [ { "name": "chainId", @@ -118,7 +125,7 @@ ], "result": { "name": "response", - "summary": "If wallet agrees to change network, return true. If the current network is selected, return true. If network is inconsistent, return false", + "summary": "If wallet agrees to change network, return true. If the current network is selected, return true. If network is not added to wallet, return false", "required": true, "schema": { "type": "boolean" @@ -126,43 +133,19 @@ }, "errors": [ { - "$ref": "#/components/errors/INCORRECT_NETWORK" + "$ref": "#/components/errors/UNLISTED_NETWORK" }, { - "$ref": "#/components/errors/USER_REFUSED" - } - ] - }, - { - "name": "wallet_requestAccounts", - "summary": "Get the account address of the wallet active account", - "params": [ + "$ref": "#/components/errors/USER_REFUSED_OP" + }, { - "name": "silent_mode", - "summary": "if true, the wallet will not show the wallet-unlock UI in case of a locked wallet, nor the dApp-approve UI in case of a non-allowed dApp", - "required": false, - "schema": { - "type": "boolean" - } - } - ], - "result": { - "name": "result", - "description": "The active account of the wallet", - "schema": { - "title": "Wallet Accounts", - "type": "array", - "items": { - "$ref": "#/components/schemas/ADDRESS" - }, - "required": [] + "$ref": "#/components/errors/UNEXPECTED_ERROR" } - }, - "errors": [] + ] }, { "name": "wallet_watchAsset", - "summary": "Add a token in the list of assets displayed by the wallet", + "summary": "Add a token in the list of assets displayed by the wallet, the wallet will show an approval UI", "params": [ { "name": "Asset to add", @@ -175,7 +158,7 @@ ], "result": { "name": "response", - "summary": "If adding a token is agreed, return true", + "summary": "If adding a token is agreed, or if token is already displayed, return true", "required": true, "schema": { "type": "boolean" @@ -184,15 +167,24 @@ "errors": [ { "$ref": "#/components/errors/NOT_ERC20" + }, + { + "$ref": "#/components/errors/INVALID_REQUEST_PAYLOAD" + }, + { + "$ref": "#/components/errors/USER_REFUSED_OP" + }, + { + "$ref": "#/components/errors/UNEXPECTED_ERROR" } ] }, { "name": "wallet_addStarknetChain", - "summary": "Add a new network in the list of networks of the wallet", + "summary": "Add a new network in the list of networks of the wallet, a permission request will be displayed on the wallet UI.", "params": [ { - "name": "Starknet Chain Id to add", + "name": "Starknet Chain to add", "description": "Information for the chain to add to the wallet", "required": true, "schema": { @@ -202,7 +194,7 @@ ], "result": { "name": "response", - "summary": "If agreed, return true. Inconsistent return false", + "summary": "If user agreed, and network added successfully, or if network already listed, return true", "required": true, "schema": { "type": "boolean" @@ -210,20 +202,23 @@ }, "errors": [ { - "$ref": "#/components/errors/INCORRECT_NETWORK" + "$ref": "#/components/errors/INVALID_REQUEST_PAYLOAD" }, { - "$ref": "#/components/errors/USER_REFUSED" + "$ref": "#/components/errors/USER_REFUSED_OP" + }, + { + "$ref": "#/components/errors/UNEXPECTED_ERROR" } ] }, { - "name": "starknet_addInvokeTransaction", + "name": "wallet_addInvokeTransaction", "summary": "Submit a new transaction to be added to the chain", "params": [ { "name": "invoke_transaction", - "description": "The information needed to invoke the function (or account, for version 1 transactions)", + "description": "A list of calls to invoke in an invoke transaction", "required": true, "schema": { "type": "array", @@ -249,7 +244,10 @@ }, "errors": [ { - "$ref": "#/components/errors/USER_REFUSED" + "$ref": "#/components/errors/INVALID_REQUEST_PAYLOAD" + }, + { + "$ref": "#/components/errors/USER_REFUSED_OP" }, { "$ref": "#/components/errors/UNEXPECTED_ERROR" @@ -257,7 +255,7 @@ ] }, { - "name": "starknet_addDeclareTransaction", + "name": "wallet_addDeclareTransaction", "summary": "Submit a declare transaction", "params": [ { @@ -289,45 +287,11 @@ }, "errors": [ { - "$ref": "#/components/errors/USER_REFUSED" + "$ref": "#/components/errors/INVALID_REQUEST_PAYLOAD" }, { - "$ref": "#/components/errors/UNEXPECTED_ERROR" - } - ] - }, - { - "name": "starknet_addDeployAccountTransaction", - "summary": "Deploy a new account in the current network. It's not linked to the type of accounts provided by the wallet ; you have to define which class to use", - "params": [ - { - "name": "deploy_account_transaction", - "description": "The deploy account transaction", - "required": true, - "schema": { - "$ref": "#/components/schemas/DEPLOY_ACCOUNT_TXN" - } - } - ], - "result": { - "name": "result", - "description": "The result of the transaction submission", - "schema": { - "type": "object", - "properties": { - "transaction_hash": { - "title": "The hash of the deploy transaction", - "$ref": "#/components/schemas/TXN_HASH" - }, - "contract_address": { - "title": "The address of the new contract", - "$ref": "#/components/schemas/FELT" - } - }, - "required": ["transaction_hash", "contract_address"] - } - }, - "errors": [ + "$ref": "#/components/errors/USER_REFUSED_OP" + }, { "$ref": "#/components/errors/USER_REFUSED" }, @@ -337,7 +301,7 @@ ] }, { - "name": "starknet_signTypedData", + "name": "wallet_signTypedData", "summary": "Sign typed data using the wallet", "params": [ { @@ -359,7 +323,10 @@ }, "errors": [ { - "$ref": "#/components/errors/USER_REFUSED" + "$ref": "#/components/errors/INVALID_REQUEST_PAYLOAD" + }, + { + "$ref": "#/components/errors/USER_REFUSED_OP" }, { "$ref": "#/components/errors/UNEXPECTED_ERROR" @@ -383,7 +350,7 @@ "title": "ERC20 Token Symbol", "description": "The symbol of an contract", "type": "string", - "minLength": 2, + "minLength": 1, "maxLength": 6, "pattern": "^[A-Za-z0-9]{1,6}$" }, @@ -401,7 +368,7 @@ }, "ASSET": { "title": "Starknet Token", - "description": "Details of an onchain Starknet token", + "description": "Details of an onchain Starknet ERC20 token", "type": "object", "properties": { "type": { @@ -522,7 +489,7 @@ } } }, - "required": ["contract_address", "calldata", "entry_point"] + "required": ["contract_address", "entry_point"] }, "DECLARE_TXN": { "title": "Declare Transaction", @@ -542,32 +509,6 @@ }, "required": ["compiled_class_hash", "contract_class"] }, - "DEPLOY_ACCOUNT_TXN": { - "title": "Deploy account transaction", - "description": "Deploys an account contract, charges fee from the pre-funded account addresses", - "type": "object", - "properties": { - "contract_address_salt": { - "title": "Contract address salt", - "description": "The salt for the address of the deployed contract", - "$ref": "#/components/schemas/FELT" - }, - "constructor_calldata": { - "type": "array", - "description": "The parameters passed to the constructor", - "title": "Constructor calldata", - "items": { - "$ref": "#/components/schemas/FELT" - } - }, - "class_hash": { - "title": "Class hash", - "description": "The hash of the deployed contract's class", - "$ref": "#/components/schemas/FELT" - } - }, - "required": ["contract_address_salt", "constructor_calldata", "class_hash"] - }, "STARKNET_CHAIN": { "title": "Starknet Chain", "type": "object", @@ -575,14 +516,14 @@ "id": { "type": "string" }, - "chainId": { + "chain_id": { "title": "Starknet Chain Id", "$ref": "#/components/schemas/CHAIN_ID" }, - "chainName": { + "chain_name": { "type": "string" }, - "rpcUrls": { + "rpc_urls": { "type": "array", "items": { "type": "string", @@ -591,7 +532,7 @@ "minItems": 1, "uniqueItems": true }, - "blockExplorerUrls": { + "block_explorer_url": { "type": "array", "items": { "type": "string", @@ -600,11 +541,11 @@ "minItems": 1, "uniqueItems": true }, - "nativeCurrency": { + "native_currency": { "title": "Native Currency", "$ref": "#/components/schemas/ASSET" }, - "iconUrls": { + "icon_urls": { "type": "array", "items": { "type": "string", @@ -614,7 +555,7 @@ "uniqueItems": true } }, - "required": ["id", "chainId", "chainName"] + "required": ["id", "chain_id", "chain_name"] }, "STARKNET_MERKLE_TYPE": { "title": "Starknet Merkle Type", @@ -663,7 +604,7 @@ "$ref": "#/components/schemas/STARKNET_TYPE" } }, - "primaryType": { + "primary_type": { "type": "string", "description": "primaryType represents the top-level type of the object in the message" }, @@ -676,7 +617,7 @@ "description": "The message to be signed" } }, - "required": ["types", "primaryType", "domain", "message"] + "required": ["types", "primary_type", "domain", "message"] }, "STARKNET_DOMAIN": { "title": "Starknet Domain", @@ -685,7 +626,7 @@ "properties": { "name": { "type": "string" }, "version": { "type": "string" }, - "chainId": { + "chain_id": { "anyOf": [{ "type": "string" }, { "type": "number" }] } } @@ -706,11 +647,19 @@ "errors": { "NOT_ERC20": { "code": 111, - "message": "Asset is not an ERC20" + "message": "Asset is not an ERC20, or contract not deployed" }, - "INCORRECT_NETWORK": { + "UNLISTED_NETWORK": { "code": 112, - "message": "Network details are incorrect" + "message": "The network is not supported by the wallet" + }, + "USER_REFUSED_OP": { + "code": 113, + "message": "User refused the operation" + }, + "INVALID_REQUEST_PAYLOAD": { + "code": 114, + "message": "Request payload parameters are invalid or incorrect" }, "USER_REFUSED": { "code": 113, From 1c87e7dc6004b9d16a79271c961604b5d344178f Mon Sep 17 00:00:00 2001 From: amanusk Date: Mon, 8 Apr 2024 04:57:59 +0300 Subject: [PATCH 06/17] Add class_hash as optional param for addDeclareTransaction --- wallet-api/wallet_rpc.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wallet-api/wallet_rpc.json b/wallet-api/wallet_rpc.json index 85ef456..ed8b410 100644 --- a/wallet-api/wallet_rpc.json +++ b/wallet-api/wallet_rpc.json @@ -501,6 +501,11 @@ "description": "The hash of the Cairo assembly resulting from the Sierra compilation", "$ref": "#/components/schemas/FELT" }, + "class_hash": { + "title": "Class hash", + "description": "The hash of the declared class", + "$ref": "#/components/schemas/FELT" + }, "contract_class": { "title": "Contract class", "description": "The class to be declared", From 235e30899a8de16543a64643de1c7f9950f18450 Mon Sep 17 00:00:00 2001 From: amanusk Date: Tue, 9 Apr 2024 10:08:36 +0300 Subject: [PATCH 07/17] Update error messages --- wallet-api/wallet_rpc.json | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/wallet-api/wallet_rpc.json b/wallet-api/wallet_rpc.json index ed8b410..c3ef496 100644 --- a/wallet-api/wallet_rpc.json +++ b/wallet-api/wallet_rpc.json @@ -107,7 +107,7 @@ "$ref": "#/components/errors/USER_REFUSED_OP" }, { - "$ref": "#/components/errors/UNEXPECTED_ERROR" + "$ref": "#/components/errors/UNKNOWN_ERROR" } ] }, @@ -139,7 +139,7 @@ "$ref": "#/components/errors/USER_REFUSED_OP" }, { - "$ref": "#/components/errors/UNEXPECTED_ERROR" + "$ref": "#/components/errors/UNKNOWN_ERROR" } ] }, @@ -175,7 +175,7 @@ "$ref": "#/components/errors/USER_REFUSED_OP" }, { - "$ref": "#/components/errors/UNEXPECTED_ERROR" + "$ref": "#/components/errors/UNKNOWN_ERROR" } ] }, @@ -208,7 +208,7 @@ "$ref": "#/components/errors/USER_REFUSED_OP" }, { - "$ref": "#/components/errors/UNEXPECTED_ERROR" + "$ref": "#/components/errors/UNKNOWN_ERROR" } ] }, @@ -250,7 +250,7 @@ "$ref": "#/components/errors/USER_REFUSED_OP" }, { - "$ref": "#/components/errors/UNEXPECTED_ERROR" + "$ref": "#/components/errors/UNKNOWN_ERROR" } ] }, @@ -293,10 +293,7 @@ "$ref": "#/components/errors/USER_REFUSED_OP" }, { - "$ref": "#/components/errors/USER_REFUSED" - }, - { - "$ref": "#/components/errors/UNEXPECTED_ERROR" + "$ref": "#/components/errors/UNKNOWN_ERROR" } ] }, @@ -329,7 +326,7 @@ "$ref": "#/components/errors/USER_REFUSED_OP" }, { - "$ref": "#/components/errors/UNEXPECTED_ERROR" + "$ref": "#/components/errors/UNKNOWN_ERROR" } ] } @@ -652,27 +649,23 @@ "errors": { "NOT_ERC20": { "code": 111, - "message": "Asset is not an ERC20, or contract not deployed" + "message": "An error occured (NOT_ERC20)" }, "UNLISTED_NETWORK": { "code": 112, - "message": "The network is not supported by the wallet" + "message": "An error occurred (INLISTED_NETWORK)" }, "USER_REFUSED_OP": { "code": 113, - "message": "User refused the operation" + "message": "An error occurred (USER_REFUSED_OP)" }, "INVALID_REQUEST_PAYLOAD": { "code": 114, - "message": "Request payload parameters are invalid or incorrect" - }, - "USER_REFUSED": { - "code": 113, - "message": "User refused the operation" + "message": "An error occured (INVALID_REQUEST_PAYLOAD)" }, - "UNEXPECTED_ERROR": { + "UNKNOWN_ERROR": { "code": 163, - "message": "An unexpected error occurred", + "message": "An error occurred (UNKNOWN_ERROR)", "data": "string" } } From 9245fa67c84a5c9c2b5b5f727ba2d4aa1383bd9a Mon Sep 17 00:00:00 2001 From: amanusk Date: Tue, 9 Apr 2024 12:58:16 +0300 Subject: [PATCH 08/17] Update felt to padded felt * return padded felt for transaction hash * Accept a named selector for contract calls --- wallet-api/wallet_rpc.json | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/wallet-api/wallet_rpc.json b/wallet-api/wallet_rpc.json index c3ef496..1f57ef7 100644 --- a/wallet-api/wallet_rpc.json +++ b/wallet-api/wallet_rpc.json @@ -279,7 +279,7 @@ }, "class_hash": { "title": "The hash of the declared class", - "$ref": "#/components/schemas/FELT" + "$ref": "#/components/schemas/PADDED_FELT" } }, "required": ["transaction_hash", "class_hash"] @@ -337,7 +337,7 @@ "TXN_HASH": { "title": "Transaction hash", "description": "The transaction hash, as assigned in Starknet", - "$ref": "#/components/schemas/FELT" + "$ref": "#/components/schemas/PADDED_FELT" }, "ADDRESS": { "title": "Address", @@ -470,12 +470,13 @@ "type": "object", "properties": { "contract_address": { - "title": "sender address", + "title": "The contract address to interact with", "$ref": "#/components/schemas/ADDRESS" }, "entry_point": { "title": "Contract entry point", - "$ref": "#/components/schemas/FELT" + "description": "A string correlating the selector name of the contract, e.g. 'transfer'", + "type": "string" }, "calldata": { "type": "array", @@ -600,7 +601,7 @@ "type": "object", "properties": { "types": { - "description": "primaryType represents the top-level type of the object in the message", + "description": "Defines the types of the typed data object", "type": "array", "itmes": { "$ref": "#/components/schemas/STARKNET_TYPE" @@ -633,6 +634,13 @@ } } }, + "PADDED_FELT": { + "type": "string", + "title": "Padded felt", + "$comment": "A felt represented as a string of zero padded hex digits", + "description": "Represented as up to 62 hex digits, 3 bits, and 5 leading zeroes.", + "pattern": "^0x(0|[0-7]{1}[a-fA-F0-9]{0,62}$)" + }, "SIERRA_ENTRY_POINT": { "$ref": "./api/starknet_api_openrpc.json#/components/schemas/SIERRA_ENTRY_POINT" }, From b2f35797745bf1d92862c7c579a6b4c2d3fef708 Mon Sep 17 00:00:00 2001 From: amanusk Date: Tue, 9 Apr 2024 13:34:15 +0300 Subject: [PATCH 09/17] remove comment --- wallet-api/wallet_rpc.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wallet-api/wallet_rpc.json b/wallet-api/wallet_rpc.json index 1f57ef7..607d329 100644 --- a/wallet-api/wallet_rpc.json +++ b/wallet-api/wallet_rpc.json @@ -637,8 +637,7 @@ "PADDED_FELT": { "type": "string", "title": "Padded felt", - "$comment": "A felt represented as a string of zero padded hex digits", - "description": "Represented as up to 62 hex digits, 3 bits, and 5 leading zeroes.", + "description": "A padded felt represented as up to 62 hex digits, 3 bits, and 5 leading zeroes.", "pattern": "^0x(0|[0-7]{1}[a-fA-F0-9]{0,62}$)" }, "SIERRA_ENTRY_POINT": { From 48e77bf4aaf687388b40b8198e3105401941517a Mon Sep 17 00:00:00 2001 From: amanusk Date: Tue, 9 Apr 2024 13:59:00 +0300 Subject: [PATCH 10/17] fix typo --- wallet-api/wallet_rpc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wallet-api/wallet_rpc.json b/wallet-api/wallet_rpc.json index 607d329..c6850fa 100644 --- a/wallet-api/wallet_rpc.json +++ b/wallet-api/wallet_rpc.json @@ -660,7 +660,7 @@ }, "UNLISTED_NETWORK": { "code": 112, - "message": "An error occurred (INLISTED_NETWORK)" + "message": "An error occurred (UNLISTED_NETWORK)" }, "USER_REFUSED_OP": { "code": 113, From 2ea89f5379ad9df80690fe6cb610437433b06c4a Mon Sep 17 00:00:00 2001 From: amanusk Date: Tue, 16 Apr 2024 13:22:02 +0300 Subject: [PATCH 11/17] Fix typo Co-authored-by: Toni Tabak --- wallet-api/wallet_rpc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wallet-api/wallet_rpc.json b/wallet-api/wallet_rpc.json index c6850fa..771e4ef 100644 --- a/wallet-api/wallet_rpc.json +++ b/wallet-api/wallet_rpc.json @@ -656,7 +656,7 @@ "errors": { "NOT_ERC20": { "code": 111, - "message": "An error occured (NOT_ERC20)" + "message": "An error occurred (NOT_ERC20)" }, "UNLISTED_NETWORK": { "code": 112, From cdd4a2b7239b7727cdbed0c597cb105f5b2b4131 Mon Sep 17 00:00:00 2001 From: amanusk Date: Tue, 16 Apr 2024 13:22:26 +0300 Subject: [PATCH 12/17] Fix typo Co-authored-by: Toni Tabak --- wallet-api/wallet_rpc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wallet-api/wallet_rpc.json b/wallet-api/wallet_rpc.json index 771e4ef..e1a2a08 100644 --- a/wallet-api/wallet_rpc.json +++ b/wallet-api/wallet_rpc.json @@ -668,7 +668,7 @@ }, "INVALID_REQUEST_PAYLOAD": { "code": 114, - "message": "An error occured (INVALID_REQUEST_PAYLOAD)" + "message": "An error occurred (INVALID_REQUEST_PAYLOAD)" }, "UNKNOWN_ERROR": { "code": 163, From 78c90527a371c576fcbb2d8b84d0f786c32a219c Mon Sep 17 00:00:00 2001 From: amanusk Date: Wed, 17 Apr 2024 08:47:20 +0300 Subject: [PATCH 13/17] Fix padded felt regex, remove dangling entry_point --- wallet-api/wallet_rpc.json | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/wallet-api/wallet_rpc.json b/wallet-api/wallet_rpc.json index e1a2a08..e2c370a 100644 --- a/wallet-api/wallet_rpc.json +++ b/wallet-api/wallet_rpc.json @@ -637,11 +637,8 @@ "PADDED_FELT": { "type": "string", "title": "Padded felt", - "description": "A padded felt represented as up to 62 hex digits, 3 bits, and 5 leading zeroes.", - "pattern": "^0x(0|[0-7]{1}[a-fA-F0-9]{0,62}$)" - }, - "SIERRA_ENTRY_POINT": { - "$ref": "./api/starknet_api_openrpc.json#/components/schemas/SIERRA_ENTRY_POINT" + "description": "A padded felt represented as 62 hex digits, 3 bits, and 5 leading zero bits.", + "pattern": "^0x(0[0-7]{1}[a-fA-F0-9]{62}$)" }, "CONTRACT_CLASS": { "$ref": "./api/starknet_api_openrpc.json#/components/schemas/CONTRACT_CLASS" From cf2a8c263f44c758113f227a722cbdf2b16d944e Mon Sep 17 00:00:00 2001 From: amanusk Date: Wed, 24 Apr 2024 05:04:34 +0300 Subject: [PATCH 14/17] * Fix types in SNIP 12 to be an object * Add revisions to TYPED_DATA * Change SYMBOL to TOKEN_SYMBOL * Change TXN_HASH to PADDED_TXN_HASH * Rename chain_id to chainId and primary_type to primaryType to fit SNIP 12 definitions --- wallet-api/wallet_rpc.json | 57 ++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/wallet-api/wallet_rpc.json b/wallet-api/wallet_rpc.json index e2c370a..9d09136 100644 --- a/wallet-api/wallet_rpc.json +++ b/wallet-api/wallet_rpc.json @@ -236,7 +236,7 @@ "properties": { "transaction_hash": { "title": "Transaction Hash", - "$ref": "#/components/schemas/TXN_HASH" + "$ref": "#/components/schemas/PADDED_TXN_HASH" } }, "required": ["transaction_hash"] @@ -275,7 +275,7 @@ "properties": { "transaction_hash": { "title": "The hash of the declare transaction", - "$ref": "#/components/schemas/TXN_HASH" + "$ref": "#/components/schemas/PADDED_TXN_HASH" }, "class_hash": { "title": "The hash of the declared class", @@ -334,18 +334,18 @@ "components": { "contentDescriptors": {}, "schemas": { - "TXN_HASH": { - "title": "Transaction hash", - "description": "The transaction hash, as assigned in Starknet", + "PADDED_TXN_HASH": { + "title": "Padded Transaction Hash", + "description": "The transaction hash, as assigned in Starknet, padded to 64 hex digits", "$ref": "#/components/schemas/PADDED_FELT" }, "ADDRESS": { "title": "Address", "$ref": "#/components/schemas/FELT" }, - "SYMBOL": { + "TOKEN_SYMBOL": { "title": "ERC20 Token Symbol", - "description": "The symbol of an contract", + "description": "The symbol of the token", "type": "string", "minLength": 1, "maxLength": 6, @@ -381,7 +381,7 @@ }, "symbol": { "title": "Token Symbol", - "$ref": "#/components/schemas/SYMBOL" + "$ref": "#/components/schemas/TOKEN_SYMBOL" }, "decimals": { "type": "number", @@ -577,6 +577,23 @@ }, "required": ["name", "type", "contains"] }, + "STARKNET_ENUM_TYPE": { + "title": "Starknet Enum Type", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string", + "enum": ["enum"] + }, + "contains": { + "type": "string" + } + }, + "required": ["name", "type", "contains"] + }, "STARKNET_TYPE": { "title": "Starknet Type", "description": "A single type, as part of a struct. The `type` field can be any of the EIP-712 supported types", @@ -592,6 +609,9 @@ }, { "$ref": "#/components/schemas/STARKNET_MERKLE_TYPE" + }, + { + "$ref": "#/components/schemas/STARKNET_ENUM_TYPE" } ] } @@ -602,12 +622,15 @@ "properties": { "types": { "description": "Defines the types of the typed data object", - "type": "array", - "itmes": { - "$ref": "#/components/schemas/STARKNET_TYPE" + "type": "object", + "additionalProperties": { + "type": "array", + "itmes": { + "$ref": "#/components/schemas/STARKNET_TYPE" + } } }, - "primary_type": { + "primaryType": { "type": "string", "description": "primaryType represents the top-level type of the object in the message" }, @@ -620,7 +643,7 @@ "description": "The message to be signed" } }, - "required": ["types", "primary_type", "domain", "message"] + "required": ["types", "primaryType", "domain", "message"] }, "STARKNET_DOMAIN": { "title": "Starknet Domain", @@ -629,8 +652,12 @@ "properties": { "name": { "type": "string" }, "version": { "type": "string" }, - "chain_id": { + "chainId": { "anyOf": [{ "type": "string" }, { "type": "number" }] + }, + "revision": { + "type": "string", + "enum": ["0", "1"] } } }, @@ -638,7 +665,7 @@ "type": "string", "title": "Padded felt", "description": "A padded felt represented as 62 hex digits, 3 bits, and 5 leading zero bits.", - "pattern": "^0x(0[0-7]{1}[a-fA-F0-9]{62}$)" + "pattern": "^0x(0[0-8]{1}[a-fA-F0-9]{62}$)" }, "CONTRACT_CLASS": { "$ref": "./api/starknet_api_openrpc.json#/components/schemas/CONTRACT_CLASS" From 4127d20d0807bd9f8ea54b23d7236e384fd03658 Mon Sep 17 00:00:00 2001 From: amanusk Date: Thu, 23 May 2024 08:07:30 +0300 Subject: [PATCH 15/17] Add optional spec version param to all requests * Add error for api version not supported * Add error for account already deployed --- wallet-api/wallet_rpc.json | 144 +++++++++++++++++++++++++++++++++++-- 1 file changed, 137 insertions(+), 7 deletions(-) diff --git a/wallet-api/wallet_rpc.json b/wallet-api/wallet_rpc.json index 9d09136..04d8ae1 100644 --- a/wallet-api/wallet_rpc.json +++ b/wallet-api/wallet_rpc.json @@ -28,7 +28,15 @@ { "name": "wallet_getPermissions", "summary": "Get the existing permissions for the Dapp from the wallet", - "params": [], + "params": [ + { + "name": "wallet_api_version", + "required": false, + "schema": { + "$ref": "#/components/schemas/WALLET_API_VERSION" + } + } + ], "result": { "name": "result", "schema": { @@ -50,7 +58,14 @@ "required": [] } }, - "errors": [] + "errors": [ + { + "$ref": "#/components/errors/WALLET_API_VERSION_NOT_SUPPORTED" + }, + { + "$ref": "#/components/errors/UNKNOWN_ERROR" + } + ] }, { "name": "wallet_requestAccounts", @@ -63,6 +78,13 @@ "schema": { "type": "boolean" } + }, + { + "name": "wallet_api_version", + "required": false, + "schema": { + "$ref": "#/components/schemas/WALLET_API_VERSION" + } } ], "result": { @@ -77,12 +99,27 @@ "required": [] } }, - "errors": [] + "errors": [ + { + "$ref": "#/components/errors/WALLET_API_VERSION_NOT_SUPPORTED" + }, + { + "$ref": "#/components/errors/UNKNOWN_ERROR" + } + ] }, { "name": "wallet_requestChainId", "summary": "Request the current Chain Id", - "params": [], + "params": [ + { + "name": "wallet_api_version", + "required": false, + "schema": { + "$ref": "#/components/schemas/WALLET_API_VERSION" + } + } + ], "result": { "name": "result", "description": "The active chainId", @@ -90,12 +127,27 @@ "$ref": "#/components/schemas/CHAIN_ID" } }, - "errors": [] + "errors": [ + { + "$ref": "#/components/errors/WALLET_API_VERSION_NOT_SUPPORTED" + }, + { + "$ref": "#/components/errors/UNKNOWN_ERROR" + } + ] }, { "name": "wallet_deploymentData", "summary": "Request from the current wallet the data required to deploy the account at the current address", - "params": [], + "params": [ + { + "name": "wallet_api_version", + "required": false, + "schema": { + "$ref": "#/components/schemas/WALLET_API_VERSION" + } + } + ], "result": { "name": "result", "schema": { @@ -104,7 +156,10 @@ }, "errors": [ { - "$ref": "#/components/errors/USER_REFUSED_OP" + "$ref": "#/components/errors/ACCOUNT_ALREADY_DEPLOYED" + }, + { + "$ref": "#/components/errors/WALLET_API_VERSION_NOT_SUPPORTED" }, { "$ref": "#/components/errors/UNKNOWN_ERROR" @@ -121,6 +176,13 @@ "schema": { "$ref": "#/components/schemas/CHAIN_ID" } + }, + { + "name": "wallet_api_version", + "required": false, + "schema": { + "$ref": "#/components/schemas/WALLET_API_VERSION" + } } ], "result": { @@ -138,6 +200,9 @@ { "$ref": "#/components/errors/USER_REFUSED_OP" }, + { + "$ref": "#/components/errors/WALLET_API_VERSION_NOT_SUPPORTED" + }, { "$ref": "#/components/errors/UNKNOWN_ERROR" } @@ -154,6 +219,13 @@ "schema": { "$ref": "#/components/schemas/ASSET" } + }, + { + "name": "wallet_api_version", + "required": false, + "schema": { + "$ref": "#/components/schemas/WALLET_API_VERSION" + } } ], "result": { @@ -174,6 +246,9 @@ { "$ref": "#/components/errors/USER_REFUSED_OP" }, + { + "$ref": "#/components/errors/WALLET_API_VERSION_NOT_SUPPORTED" + }, { "$ref": "#/components/errors/UNKNOWN_ERROR" } @@ -190,6 +265,13 @@ "schema": { "$ref": "#/components/schemas/STARKNET_CHAIN" } + }, + { + "name": "wallet_api_version", + "required": false, + "schema": { + "$ref": "#/components/schemas/WALLET_API_VERSION" + } } ], "result": { @@ -207,6 +289,9 @@ { "$ref": "#/components/errors/USER_REFUSED_OP" }, + { + "$ref": "#/components/errors/WALLET_API_VERSION_NOT_SUPPORTED" + }, { "$ref": "#/components/errors/UNKNOWN_ERROR" } @@ -226,6 +311,13 @@ "$ref": "#/components/schemas/INVOKE_CALL" } } + }, + { + "name": "wallet_api_version", + "required": false, + "schema": { + "$ref": "#/components/schemas/WALLET_API_VERSION" + } } ], "result": { @@ -249,6 +341,9 @@ { "$ref": "#/components/errors/USER_REFUSED_OP" }, + { + "$ref": "#/components/errors/WALLET_API_VERSION_NOT_SUPPORTED" + }, { "$ref": "#/components/errors/UNKNOWN_ERROR" } @@ -265,6 +360,13 @@ "schema": { "$ref": "#/components/schemas/DECLARE_TXN" } + }, + { + "name": "wallet_api_version", + "required": false, + "schema": { + "$ref": "#/components/schemas/WALLET_API_VERSION" + } } ], "result": { @@ -292,6 +394,9 @@ { "$ref": "#/components/errors/USER_REFUSED_OP" }, + { + "$ref": "#/components/errors/WALLET_API_VERSION_NOT_SUPPORTED" + }, { "$ref": "#/components/errors/UNKNOWN_ERROR" } @@ -308,6 +413,13 @@ "schema": { "$ref": "#/components/schemas/TYPED_DATA" } + }, + { + "name": "wallet_api_version", + "required": false, + "schema": { + "$ref": "#/components/schemas/WALLET_API_VERSION" + } } ], "result": { @@ -325,6 +437,9 @@ { "$ref": "#/components/errors/USER_REFUSED_OP" }, + { + "$ref": "#/components/errors/WALLET_API_VERSION_NOT_SUPPORTED" + }, { "$ref": "#/components/errors/UNKNOWN_ERROR" } @@ -357,6 +472,12 @@ "type": "string", "pattern": "^[0-9]+\\.[0-9]+$" }, + "WALLET_API_VERSION": { + "title": "Wallet API version", + "description": "The version of wallet API the request expecting. If not specified, the latest is assumed", + "type": "string", + "pattern": "^[0-9]+\\.[0-9]+$" + }, "PERMISSION": { "title": "Wallet permission", "type": "string", @@ -694,6 +815,15 @@ "code": 114, "message": "An error occurred (INVALID_REQUEST_PAYLOAD)" }, + "ACCOUNT_ALREADY_DEPLOYED": { + "code": 115, + "message": "An error occurred (ACCOUNT_ALREADY_DEPLOYED)" + }, + "WALLET_API_VERSION_NOT_SUPPORTED": { + "code": 162, + "message": "An error occurred (WALLET_API_VERSION_NOT_SUPPORTED)", + "data": "string" + }, "UNKNOWN_ERROR": { "code": 163, "message": "An error occurred (UNKNOWN_ERROR)", From b2c10424820bd6c88cec3731a035c362508a6c8a Mon Sep 17 00:00:00 2001 From: amanusk Date: Sun, 26 May 2024 10:52:16 +0300 Subject: [PATCH 16/17] Drop wallet_ prefix from wallet_api_version --- wallet-api/wallet_rpc.json | 84 +++++++++++++++++++++++--------------- 1 file changed, 51 insertions(+), 33 deletions(-) diff --git a/wallet-api/wallet_rpc.json b/wallet-api/wallet_rpc.json index 04d8ae1..74874a6 100644 --- a/wallet-api/wallet_rpc.json +++ b/wallet-api/wallet_rpc.json @@ -25,15 +25,33 @@ } } }, + { + "name": "wallet_supportedWalletApi", + "summary": "Returns a list of wallet api versions compatible with the wallet. Notic this might be different from Starknet JSON-RPC spec", + "params": [], + "result": { + "name": "result", + "description": "Semver of the wallet api versions supported by the wallet", + "required": true, + "schema": { + "type": "array", + "properties": { + "items": { + "$ref": "#/components/schemas/API_VERSION" + } + } + } + } + }, { "name": "wallet_getPermissions", "summary": "Get the existing permissions for the Dapp from the wallet", "params": [ { - "name": "wallet_api_version", + "name": "api_version", "required": false, "schema": { - "$ref": "#/components/schemas/WALLET_API_VERSION" + "$ref": "#/components/schemas/API_VERSION" } } ], @@ -60,7 +78,7 @@ }, "errors": [ { - "$ref": "#/components/errors/WALLET_API_VERSION_NOT_SUPPORTED" + "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED" }, { "$ref": "#/components/errors/UNKNOWN_ERROR" @@ -80,10 +98,10 @@ } }, { - "name": "wallet_api_version", + "name": "api_version", "required": false, "schema": { - "$ref": "#/components/schemas/WALLET_API_VERSION" + "$ref": "#/components/schemas/API_VERSION" } } ], @@ -101,7 +119,7 @@ }, "errors": [ { - "$ref": "#/components/errors/WALLET_API_VERSION_NOT_SUPPORTED" + "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED" }, { "$ref": "#/components/errors/UNKNOWN_ERROR" @@ -113,10 +131,10 @@ "summary": "Request the current Chain Id", "params": [ { - "name": "wallet_api_version", + "name": "api_version", "required": false, "schema": { - "$ref": "#/components/schemas/WALLET_API_VERSION" + "$ref": "#/components/schemas/API_VERSION" } } ], @@ -129,7 +147,7 @@ }, "errors": [ { - "$ref": "#/components/errors/WALLET_API_VERSION_NOT_SUPPORTED" + "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED" }, { "$ref": "#/components/errors/UNKNOWN_ERROR" @@ -141,10 +159,10 @@ "summary": "Request from the current wallet the data required to deploy the account at the current address", "params": [ { - "name": "wallet_api_version", + "name": "api_version", "required": false, "schema": { - "$ref": "#/components/schemas/WALLET_API_VERSION" + "$ref": "#/components/schemas/API_VERSION" } } ], @@ -159,7 +177,7 @@ "$ref": "#/components/errors/ACCOUNT_ALREADY_DEPLOYED" }, { - "$ref": "#/components/errors/WALLET_API_VERSION_NOT_SUPPORTED" + "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED" }, { "$ref": "#/components/errors/UNKNOWN_ERROR" @@ -178,10 +196,10 @@ } }, { - "name": "wallet_api_version", + "name": "api_version", "required": false, "schema": { - "$ref": "#/components/schemas/WALLET_API_VERSION" + "$ref": "#/components/schemas/API_VERSION" } } ], @@ -201,7 +219,7 @@ "$ref": "#/components/errors/USER_REFUSED_OP" }, { - "$ref": "#/components/errors/WALLET_API_VERSION_NOT_SUPPORTED" + "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED" }, { "$ref": "#/components/errors/UNKNOWN_ERROR" @@ -221,10 +239,10 @@ } }, { - "name": "wallet_api_version", + "name": "api_version", "required": false, "schema": { - "$ref": "#/components/schemas/WALLET_API_VERSION" + "$ref": "#/components/schemas/API_VERSION" } } ], @@ -247,7 +265,7 @@ "$ref": "#/components/errors/USER_REFUSED_OP" }, { - "$ref": "#/components/errors/WALLET_API_VERSION_NOT_SUPPORTED" + "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED" }, { "$ref": "#/components/errors/UNKNOWN_ERROR" @@ -267,10 +285,10 @@ } }, { - "name": "wallet_api_version", + "name": "api_version", "required": false, "schema": { - "$ref": "#/components/schemas/WALLET_API_VERSION" + "$ref": "#/components/schemas/API_VERSION" } } ], @@ -290,7 +308,7 @@ "$ref": "#/components/errors/USER_REFUSED_OP" }, { - "$ref": "#/components/errors/WALLET_API_VERSION_NOT_SUPPORTED" + "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED" }, { "$ref": "#/components/errors/UNKNOWN_ERROR" @@ -313,10 +331,10 @@ } }, { - "name": "wallet_api_version", + "name": "api_version", "required": false, "schema": { - "$ref": "#/components/schemas/WALLET_API_VERSION" + "$ref": "#/components/schemas/API_VERSION" } } ], @@ -342,7 +360,7 @@ "$ref": "#/components/errors/USER_REFUSED_OP" }, { - "$ref": "#/components/errors/WALLET_API_VERSION_NOT_SUPPORTED" + "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED" }, { "$ref": "#/components/errors/UNKNOWN_ERROR" @@ -362,10 +380,10 @@ } }, { - "name": "wallet_api_version", + "name": "api_version", "required": false, "schema": { - "$ref": "#/components/schemas/WALLET_API_VERSION" + "$ref": "#/components/schemas/API_VERSION" } } ], @@ -395,7 +413,7 @@ "$ref": "#/components/errors/USER_REFUSED_OP" }, { - "$ref": "#/components/errors/WALLET_API_VERSION_NOT_SUPPORTED" + "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED" }, { "$ref": "#/components/errors/UNKNOWN_ERROR" @@ -415,10 +433,10 @@ } }, { - "name": "wallet_api_version", + "name": "api_version", "required": false, "schema": { - "$ref": "#/components/schemas/WALLET_API_VERSION" + "$ref": "#/components/schemas/API_VERSION" } } ], @@ -438,7 +456,7 @@ "$ref": "#/components/errors/USER_REFUSED_OP" }, { - "$ref": "#/components/errors/WALLET_API_VERSION_NOT_SUPPORTED" + "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED" }, { "$ref": "#/components/errors/UNKNOWN_ERROR" @@ -472,7 +490,7 @@ "type": "string", "pattern": "^[0-9]+\\.[0-9]+$" }, - "WALLET_API_VERSION": { + "API_VERSION": { "title": "Wallet API version", "description": "The version of wallet API the request expecting. If not specified, the latest is assumed", "type": "string", @@ -819,9 +837,9 @@ "code": 115, "message": "An error occurred (ACCOUNT_ALREADY_DEPLOYED)" }, - "WALLET_API_VERSION_NOT_SUPPORTED": { + "API_VERSION_NOT_SUPPORTED": { "code": 162, - "message": "An error occurred (WALLET_API_VERSION_NOT_SUPPORTED)", + "message": "An error occurred (API_VERSION_NOT_SUPPORTED)", "data": "string" }, "UNKNOWN_ERROR": { From ff18f985fb9f1d7f20aa7b00873498601a6ff83e Mon Sep 17 00:00:00 2001 From: amanusk Date: Sun, 26 May 2024 14:31:13 +0300 Subject: [PATCH 17/17] Add shortstring and number for options of revisions in snip 12 --- wallet-api/wallet_rpc.json | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/wallet-api/wallet_rpc.json b/wallet-api/wallet_rpc.json index 74874a6..4e38644 100644 --- a/wallet-api/wallet_rpc.json +++ b/wallet-api/wallet_rpc.json @@ -1,43 +1,43 @@ { "openrpc": "1.0.0-rc1", "info": { - "version": "0.1.0", + "version": "0.7.2", "title": "Starknet Wallet API", "license": {} }, "servers": [], "methods": [ { - "name": "wallet_supportedSpecs", - "summary": "Returns a list of rpc spec versions compatible with the wallet", + "name": "wallet_supportedWalletApi", + "summary": "Returns a list of wallet api versions compatible with the wallet. Notice this might be different from Starknet JSON-RPC spec", "params": [], "result": { "name": "result", - "description": "Semver of Starknet's JSON-RPC supported by the wallet", + "description": "Semver of the wallet api versions supported by the wallet", "required": true, "schema": { "type": "array", "properties": { "items": { - "$ref": "#/components/schemas/SPEC_VERSION" + "$ref": "#/components/schemas/API_VERSION" } } } } }, { - "name": "wallet_supportedWalletApi", - "summary": "Returns a list of wallet api versions compatible with the wallet. Notic this might be different from Starknet JSON-RPC spec", + "name": "wallet_supportedSpecs", + "summary": "Returns a list of rpc spec versions compatible with the wallet", "params": [], "result": { "name": "result", - "description": "Semver of the wallet api versions supported by the wallet", + "description": "Semver of Starknet's JSON-RPC supported by the wallet", "required": true, "schema": { "type": "array", "properties": { "items": { - "$ref": "#/components/schemas/API_VERSION" + "$ref": "#/components/schemas/SPEC_VERSION" } } } @@ -492,7 +492,7 @@ }, "API_VERSION": { "title": "Wallet API version", - "description": "The version of wallet API the request expecting. If not specified, the latest is assumed", + "description": "The version of wallet API expected by the request. If not specified, the latest is assumed", "type": "string", "pattern": "^[0-9]+\\.[0-9]+$" }, @@ -795,8 +795,16 @@ "anyOf": [{ "type": "string" }, { "type": "number" }] }, "revision": { - "type": "string", - "enum": ["0", "1"] + "oneOf": [ + { + "type": "string", + "enum": ["2"] + }, + { + "type": "number", + "enum": [0, 1] + } + ] } } },