Skip to content

Commit

Permalink
Merge pull request #261 from amanusk/feat/wallet_unhappy_path
Browse files Browse the repository at this point in the history
Additional descriptions of wallet behaviors for wallet_rpc API (#261)
  • Loading branch information
ArielElp authored Jan 12, 2025
2 parents 49b9e9f + c9dedde commit bbefcd1
Showing 1 changed file with 42 additions and 5 deletions.
47 changes: 42 additions & 5 deletions wallet-api/wallet_rpc.json
Original file line number Diff line number Diff line change
@@ -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": {}
},
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -176,6 +182,9 @@
{
"$ref": "#/components/errors/ACCOUNT_ALREADY_DEPLOYED"
},
{
"$ref": "#/components/errors/DEPLOYMENT_DATA_NOT_AVAILABLE"
},
{
"$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED"
},
Expand All @@ -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",
Expand All @@ -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,
Expand All @@ -221,6 +239,9 @@
{
"$ref": "#/components/errors/API_VERSION_NOT_SUPPORTED"
},
{
"$ref": "#/components/errors/CHAIN_ID_NOT_SUPPORTED"
},
{
"$ref": "#/components/errors/UNKNOWN_ERROR"
}
Expand All @@ -229,6 +250,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",
Expand Down Expand Up @@ -275,6 +297,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",
Expand Down Expand Up @@ -318,6 +341,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",
Expand Down Expand Up @@ -370,6 +394,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",
Expand Down Expand Up @@ -423,6 +448,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",
Expand Down Expand Up @@ -551,7 +577,7 @@
"allOf": [
{
"type": "string",
"enum": ["0x534e5f4d41494e", "0x534e5f474f45524c49", "0x534e5f5345504f4c4941"]
"enum": ["0x534e5f4d41494e", "0x534e5f5345504f4c4941"]
},
{
"$ref": "#/components/schemas/CHAIN_ID"
Expand Down Expand Up @@ -835,7 +861,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,
Expand All @@ -845,6 +872,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)",
Expand Down

0 comments on commit bbefcd1

Please sign in to comment.