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,