From 8c8ce7298d8ca18c855b2f22643efabc0f228b1e Mon Sep 17 00:00:00 2001 From: amanusk Date: Sun, 22 Dec 2024 14:32:39 +0200 Subject: [PATCH 1/2] Additional descriptions of wallet behaviors for wallet_rpc API --- wallet-api/wallet_rpc.json | 48 ++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/wallet-api/wallet_rpc.json b/wallet-api/wallet_rpc.json index 2bdc5c3..c3803bd 100644 --- a/wallet-api/wallet_rpc.json +++ b/wallet-api/wallet_rpc.json @@ -1,7 +1,7 @@ { "openrpc": "1.0.0-rc1", "info": { - "version": "0.8.0-rc.0", + "version": "0.8.0-rc.2", "title": "Starknet Wallet API", "license": {} }, @@ -10,6 +10,7 @@ { "name": "wallet_supportedWalletApi", "summary": "Returns a list of wallet api versions compatible with the wallet. Notice this might be different from Starknet JSON-RPC spec", + "description": "When wallet is locked, return values. When Dapp is not approved, return values. When wallet is connected and unlocked, return values.", "params": [], "result": { "name": "result", @@ -28,6 +29,7 @@ { "name": "wallet_supportedSpecs", "summary": "Returns a list of rpc spec versions compatible with the wallet", + "description": "When wallet is locked, return values. When Dapp is not approved, return values. When wallet is connected and unlocked, return values.", "params": [], "result": { "name": "result", @@ -46,6 +48,7 @@ { "name": "wallet_getPermissions", "summary": "Get the existing permissions for the Dapp from the wallet", + "description": "When wallet is locked, return empty array. When Dapp is not approved, return empty array. When wallet is connected and unlocked, return values.", "params": [ { "name": "api_version", @@ -87,11 +90,12 @@ }, { "name": "wallet_requestAccounts", - "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.", + "summary": "Get the account addresses of the wallet active account", + "description": "When wallet is locked, open wallet-unlock UI. When Dapp is not approved, display Dapp-approve UI. When wallet is connected and unlocked, return values.", "params": [ { "name": "silent_mode", - "summary": "if true, the wallet will not show the wallet-unlock UI in case of a locked wallet, nor the Dapp-approve UI in case of a non-allowed Dapp", + "summary": "If true, the wallet will not show the wallet-unlock UI in case of a locked wallet, nor the Dapp-approve UI in case of a non-allowed Dapp, and will return an empty array", "required": false, "schema": { "type": "boolean" @@ -129,6 +133,7 @@ { "name": "wallet_requestChainId", "summary": "Request the current Chain Id", + "description": "When wallet is locked, return values. When Dapp is not approved, return values. When wallet is connected and unlocked, return values.", "params": [ { "name": "api_version", @@ -157,6 +162,7 @@ { "name": "wallet_deploymentData", "summary": "Request from the current wallet the data required to deploy the account at the current address", + "description": "When wallet is locked, return error DEPLOYMENT_DATA_NOT_AVAILABLE. When Dapp is not approved, return error DEPLOYMENT_DATA_NOT_AVAILABLE. When wallet is connected and unlocked, return values.", "params": [ { "name": "api_version", @@ -176,6 +182,9 @@ { "$ref": "#/components/errors/ACCOUNT_ALREADY_DEPLOYED" }, + { + "$ref": "#/components/errors/DEPLOYMENT_DATA_NOT_AVAILABLE" + }, { "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED" }, @@ -187,6 +196,7 @@ { "name": "wallet_switchStarknetChain", "summary": "Change the current network of the wallet, a permission request will be displayed on the wallet UI.", + "description": "When wallet is locked, open wallet-unlock UI. When Dapp is not approved, display Dapp-approve UI. When wallet is connected and unlocked, display switch-chain UI.", "params": [ { "name": "chainId", @@ -195,6 +205,14 @@ "$ref": "#/components/schemas/CHAIN_ID" } }, + { + "name": "silent_mode", + "summary": "If true, the wallet will not show the wallet-unlock UI in case of a locked wallet, nor the Dapp-approve UI in case of a non-allowed Dapp, and will return an error CHAIN_ID_NOT_SUPPORTED", + "required": false, + "schema": { + "type": "boolean" + } + }, { "name": "api_version", "required": false, @@ -229,6 +247,7 @@ { "name": "wallet_watchAsset", "summary": "Add a token in the list of assets displayed by the wallet, the wallet will show an approval UI", + "description": "When wallet is locked, open wallet-unlock UI. When Dapp is not approved, display Dapp-approve UI. When wallet is connected and unlocked, display watch-asset UI.", "params": [ { "name": "Asset to add", @@ -275,6 +294,7 @@ { "name": "wallet_addStarknetChain", "summary": "Add a new network in the list of networks of the wallet, a permission request will be displayed on the wallet UI.", + "description": "When wallet is locked, open wallet-unlock UI. When Dapp is not approved, display Dapp-approve UI. When wallet is connected and unlocked, display add-chain UI.", "params": [ { "name": "Starknet Chain to add", @@ -318,6 +338,7 @@ { "name": "wallet_addInvokeTransaction", "summary": "Submit a new transaction to be added to the chain", + "description": "When wallet is locked, open wallet-unlock UI. When Dapp is not approved, display Dapp-approve UI. When wallet is connected and unlocked, display invoke-tx UI.", "params": [ { "name": "invoke_transaction", @@ -370,6 +391,7 @@ { "name": "wallet_addDeclareTransaction", "summary": "Submit a declare transaction", + "description": "When wallet is locked, open wallet-unlock UI. When Dapp is not approved, display Dapp-approve UI. When wallet is connected and unlocked, display declare-tx UI.", "params": [ { "name": "declare_transaction", @@ -423,6 +445,7 @@ { "name": "wallet_signTypedData", "summary": "Sign typed data using the wallet", + "description": "When wallet is locked, open wallet-unlock UI. When Dapp is not approved, display Dapp-approve UI. When wallet is connected and unlocked, display sign-typed-data UI.", "params": [ { "name": "typed_data", @@ -551,7 +574,11 @@ "allOf": [ { "type": "string", - "enum": ["0x534e5f4d41494e", "0x534e5f474f45524c49", "0x534e5f5345504f4c4941"] + "enum": [ + "0x534e5f4d41494e", + "0x534e5f474f45524c49", + "0x534e5f5345504f4c4941" + ] }, { "$ref": "#/components/schemas/CHAIN_ID" @@ -835,7 +862,8 @@ }, "USER_REFUSED_OP": { "code": 113, - "message": "An error occurred (USER_REFUSED_OP)" + "message": "An error occurred (USER_REFUSED_OP)", + "description": "The user refused the operation in the wallet" }, "INVALID_REQUEST_PAYLOAD": { "code": 114, @@ -845,6 +873,16 @@ "code": 115, "message": "An error occurred (ACCOUNT_ALREADY_DEPLOYED)" }, + "DEPLOYMENT_DATA_NOT_AVAILABLE": { + "code": 116, + "message": "An error occurred (DEPLOYMENT_DATA_NOT_AVAILABLE)", + "description": "The deployment data is not available or no supported" + }, + "CHAIN_ID_NOT_SUPPORTED": { + "code": 117, + "message": "An error occurred (CHAIN_ID_NOT_SUPPORTED)", + "description": "The requested chain ID is not supported by the wallet" + }, "API_VERSION_NOT_SUPPORTED": { "code": 162, "message": "An error occurred (API_VERSION_NOT_SUPPORTED)", From c9deddea3d40ba6e16d0f7e15f8f4bbc3ab448a0 Mon Sep 17 00:00:00 2001 From: amanusk Date: Mon, 30 Dec 2024 09:28:43 +0200 Subject: [PATCH 2/2] Add Chain not supported. Remove goerli --- wallet-api/wallet_rpc.json | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/wallet-api/wallet_rpc.json b/wallet-api/wallet_rpc.json index c3803bd..b0e4976 100644 --- a/wallet-api/wallet_rpc.json +++ b/wallet-api/wallet_rpc.json @@ -239,6 +239,9 @@ { "$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED" }, + { + "$ref": "#/components/errors/CHAIN_ID_NOT_SUPPORTED" + }, { "$ref": "#/components/errors/UNKNOWN_ERROR" } @@ -574,11 +577,7 @@ "allOf": [ { "type": "string", - "enum": [ - "0x534e5f4d41494e", - "0x534e5f474f45524c49", - "0x534e5f5345504f4c4941" - ] + "enum": ["0x534e5f4d41494e", "0x534e5f5345504f4c4941"] }, { "$ref": "#/components/schemas/CHAIN_ID"