Skip to content

Commit

Permalink
Add optional spec version param to all requests
Browse files Browse the repository at this point in the history
* Add error for api version not supported
* Add error for account already deployed
  • Loading branch information
amanusk committed May 23, 2024
1 parent cf2a8c2 commit 4127d20
Showing 1 changed file with 137 additions and 7 deletions.
144 changes: 137 additions & 7 deletions wallet-api/wallet_rpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -50,7 +58,14 @@
"required": []
}
},
"errors": []
"errors": [
{
"$ref": "#/components/errors/WALLET_API_VERSION_NOT_SUPPORTED"
},
{
"$ref": "#/components/errors/UNKNOWN_ERROR"
}
]
},
{
"name": "wallet_requestAccounts",
Expand All @@ -63,6 +78,13 @@
"schema": {
"type": "boolean"
}
},
{
"name": "wallet_api_version",
"required": false,
"schema": {
"$ref": "#/components/schemas/WALLET_API_VERSION"
}
}
],
"result": {
Expand All @@ -77,25 +99,55 @@
"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",
"schema": {
"$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": {
Expand All @@ -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"
Expand All @@ -121,6 +176,13 @@
"schema": {
"$ref": "#/components/schemas/CHAIN_ID"
}
},
{
"name": "wallet_api_version",
"required": false,
"schema": {
"$ref": "#/components/schemas/WALLET_API_VERSION"
}
}
],
"result": {
Expand All @@ -138,6 +200,9 @@
{
"$ref": "#/components/errors/USER_REFUSED_OP"
},
{
"$ref": "#/components/errors/WALLET_API_VERSION_NOT_SUPPORTED"
},
{
"$ref": "#/components/errors/UNKNOWN_ERROR"
}
Expand All @@ -154,6 +219,13 @@
"schema": {
"$ref": "#/components/schemas/ASSET"
}
},
{
"name": "wallet_api_version",
"required": false,
"schema": {
"$ref": "#/components/schemas/WALLET_API_VERSION"
}
}
],
"result": {
Expand All @@ -174,6 +246,9 @@
{
"$ref": "#/components/errors/USER_REFUSED_OP"
},
{
"$ref": "#/components/errors/WALLET_API_VERSION_NOT_SUPPORTED"
},
{
"$ref": "#/components/errors/UNKNOWN_ERROR"
}
Expand All @@ -190,6 +265,13 @@
"schema": {
"$ref": "#/components/schemas/STARKNET_CHAIN"
}
},
{
"name": "wallet_api_version",
"required": false,
"schema": {
"$ref": "#/components/schemas/WALLET_API_VERSION"
}
}
],
"result": {
Expand All @@ -207,6 +289,9 @@
{
"$ref": "#/components/errors/USER_REFUSED_OP"
},
{
"$ref": "#/components/errors/WALLET_API_VERSION_NOT_SUPPORTED"
},
{
"$ref": "#/components/errors/UNKNOWN_ERROR"
}
Expand All @@ -226,6 +311,13 @@
"$ref": "#/components/schemas/INVOKE_CALL"
}
}
},
{
"name": "wallet_api_version",
"required": false,
"schema": {
"$ref": "#/components/schemas/WALLET_API_VERSION"
}
}
],
"result": {
Expand All @@ -249,6 +341,9 @@
{
"$ref": "#/components/errors/USER_REFUSED_OP"
},
{
"$ref": "#/components/errors/WALLET_API_VERSION_NOT_SUPPORTED"
},
{
"$ref": "#/components/errors/UNKNOWN_ERROR"
}
Expand All @@ -265,6 +360,13 @@
"schema": {
"$ref": "#/components/schemas/DECLARE_TXN"
}
},
{
"name": "wallet_api_version",
"required": false,
"schema": {
"$ref": "#/components/schemas/WALLET_API_VERSION"
}
}
],
"result": {
Expand Down Expand Up @@ -292,6 +394,9 @@
{
"$ref": "#/components/errors/USER_REFUSED_OP"
},
{
"$ref": "#/components/errors/WALLET_API_VERSION_NOT_SUPPORTED"
},
{
"$ref": "#/components/errors/UNKNOWN_ERROR"
}
Expand All @@ -308,6 +413,13 @@
"schema": {
"$ref": "#/components/schemas/TYPED_DATA"
}
},
{
"name": "wallet_api_version",
"required": false,
"schema": {
"$ref": "#/components/schemas/WALLET_API_VERSION"
}
}
],
"result": {
Expand All @@ -325,6 +437,9 @@
{
"$ref": "#/components/errors/USER_REFUSED_OP"
},
{
"$ref": "#/components/errors/WALLET_API_VERSION_NOT_SUPPORTED"
},
{
"$ref": "#/components/errors/UNKNOWN_ERROR"
}
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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)",
Expand Down

0 comments on commit 4127d20

Please sign in to comment.