Commit b899324f authored by Andras Fuchs's avatar Andras Fuchs Committed by Jeremy Bokobza

Fixed a the name query parameter for API call wallet/general-info (#359)

* Fixed a the name query parameter for API call wallet/general-info

The name query parameter was incorrectly "walletName".
Also added a example request and response.

* Unified formatting, wallet names, wallet passwords

Unified formatting, wallet names, wallet passwords and request ports

* wallet/create API fix

Fixed the wallet/create API description and example.

* Changed the deprecated /wallet/sensitive API to /wallet/extpubkey

Changed the deprecated /wallet/sensitive API to /wallet/extpubkey. Sensitive is no longer available.

* /wallet/extpubkey example URL fix

/wallet/extpubkey example URL fix: the default account name contains a space (unfortunately)
parent 2a5b33c3
...@@ -3,9 +3,7 @@ ...@@ -3,9 +3,7 @@
## Request/Response ## Request/Response
RESPONSE: response code (`200` for all successful requests, `4xx`/`5xx` if error, see later) RESPONSE: response code (`200` for all successful requests, `4xx`/`5xx` if error, see later)
HEADERS: `Content-Type:application/json`
HEADERS
`Content-Type:application/json`
## Errors ## Errors
...@@ -20,7 +18,7 @@ Depending on the circumstance the API will either return an error at the first e ...@@ -20,7 +18,7 @@ Depending on the circumstance the API will either return an error at the first e
"errors": [ "errors": [
{ {
"status": 400, "status": 400,
"message": "No wallet file found at Wallets\\myFirstWallet.json", "message": "No wallet file found at Wallets\\testwallet.json",
"description": "System.ArgumentException: No wallet file found at..." "description": "System.ArgumentException: No wallet file found at..."
} }
] ]
...@@ -55,7 +53,7 @@ This error message comes at all request if the wallet is not loaded yet, except ...@@ -55,7 +53,7 @@ This error message comes at all request if the wallet is not loaded yet, except
``` ```
GET /wallet/general-info - Displays general information on the wallet GET /wallet/general-info - Displays general information on the wallet
GET /wallet/sensitive - Displays sensitive information on the wallet GET /wallet/extpubkey - Displays the extpubkey of the specified account
GET /wallet/status - Displays dynamic information on the wallet GET /wallet/status - Displays dynamic information on the wallet
POST /wallet/create - Creates the wallet POST /wallet/create - Creates the wallet
POST /wallet/load - Loads the wallet and starts syncing POST /wallet/load - Loads the wallet and starts syncing
...@@ -92,13 +90,11 @@ POST /wallet/send-transaction - Attempts to send a transaction ...@@ -92,13 +90,11 @@ POST /wallet/send-transaction - Attempts to send a transaction
### Query parameters ### Query parameters
`language` (optional) - the language for the words in the mnemonic. Options are: English, French, Spanish, Japanese, ChineseSimplified and ChineseTraditional. The default is 'English'. `language` (optional) - the language for the words in the mnemonic. Options are: English, French, Spanish, Japanese, ChineseSimplified and ChineseTraditional. The default is 'English'.
`wordcount` (optional) - the number of words in the mnemonic. Options are: 12,15,18,21 or 24. the default is 12. `wordcount` (optional) - the number of words in the mnemonic. Options are: 12,15,18,21 or 24. the default is 12.
### Examples ### Examples
request request
``` ```
http://localhost:5000/api/wallet/mnemonic?wordcount=15&language=French http://localhost:37220/api/wallet/mnemonic?wordcount=15&language=French
``` ```
response response
``` ```
...@@ -107,7 +103,7 @@ response ...@@ -107,7 +103,7 @@ response
request request
``` ```
http://localhost:5000/api/wallet/mnemonic?wordcount=12&language=english http://localhost:37220/api/wallet/mnemonic?wordcount=12&language=english
``` ```
response response
``` ```
...@@ -118,33 +114,43 @@ response ...@@ -118,33 +114,43 @@ response
## GET /wallet/general-info - Displays general information on the wallet ## GET /wallet/general-info - Displays general information on the wallet
### Query parameters ### Query parameters
`walletName` (required) - the name of the wallet. `name` (required) - the name of the wallet.
### Responses ### Examples
#### Request
```
http://localhost:37220/api/wallet/general-info?name=testwallet
```
#### Response
``` ```
{ {
"walletFilePath":"path to the wallet file", "walletFilePath":null,
"network":"main", //"testnet", "stratismain", "stratistest" "network":"testnet", //"main", "testnet", "stratismain", "stratistest"
"creationTime":"2017-03-21", "creationTime":"1511169493",
"isDecrypted":true, "isDecrypted":true,
"lastBlockHeight":123234, "lastBlockSyncedHeight":1231116,
"chainTip": 173721, "chainTip":1231116,
"connectedNodes": 5 "isChainSynced":true,
"connectedNodes":8
} }
``` ```
## GET /wallet/sensitive - Displays sensitive information on the wallet
### Parameters ## GET /wallet/extpubkey - Displays the extpubkey of the specified account
### Query parameters
`walletName` (required) - the name of the wallet.
### Examples
#### Request
``` ```
{ http://localhost:37220/api/wallet/extpubkey?walletName=testwallet&accountName=account%200
"password": "password"
}
``` ```
### Responses
#### Response
Returns the public key hash of the account.
``` ```
{ "tpubDDVB7J4oNpyWFUVp91UcQnxUVJExWPV5NecBFTzQVH6d3A9pcrYCvu8jGzCHVAzyD99Sk3g3kLYMx6MocpzmtusmDgpbx27Msc5iCKefMUm"
"extkey": "sadwqdpqoijedqcdoijsadoijsadisa",
"extpubkey": "dalkdsaklkjdlkjdsaljlkjdsalkjdsalk",
}
``` ```
## GET /wallet/status - Displays dynamic information on the wallet ## GET /wallet/status - Displays dynamic information on the wallet
### Responses ### Responses
...@@ -163,15 +169,18 @@ response ...@@ -163,15 +169,18 @@ response
## POST /wallet/create - Creates the wallet ## POST /wallet/create - Creates the wallet
### Parameters ### Parameters
`name` - case-sensitive name of the wallet to be created.
`password` - password for the wallet to be created.
`mnemonic` (optional) - the user's mnemonic for the wallet.
``` ```
{ {
"network": "main", // "main" or "testnet" "name": "testwallet",
"password": "password", "password": "testpassword",
"name": "wallet-btc", "mnemonic": "gravity sock glove cage divert creek mountain connect small banana depend thunder"
"mnemonic": "gravity sock glove cage divert creek mountain connect small banana depend thunder" // optional
} }
``` ```
### Responses ### Responses
Returns the mnemonic for the wallet. If there was no mnemonic defined as input then a newly generated word list will be returned.
``` ```
{ {
"mnemonic": "gravity sock glove cage divert creek mountain connect small banana depend thunder", "mnemonic": "gravity sock glove cage divert creek mountain connect small banana depend thunder",
...@@ -181,9 +190,9 @@ response ...@@ -181,9 +190,9 @@ response
### Parameters ### Parameters
``` ```
{ {
"password": "123456",
"folderPath": "Wallets", // optional, if the folder path is not the default one "folderPath": "Wallets", // optional, if the folder path is not the default one
"name": "myWallet" "name": "testwallet",
"password": "testpassword"
} }
``` ```
...@@ -196,11 +205,11 @@ response ...@@ -196,11 +205,11 @@ response
### Parameters ### Parameters
``` ```
{ {
"network": "main", // "main" or "testnet" "network": "testnet", // "main" or "testnet"
"password": "password",
"mnemonic": "foo bar buz",
"name": "testwallet-recovered",
"folderPath": "Wallets", // optional, if the folder path is not the default one "folderPath": "Wallets", // optional, if the folder path is not the default one
"name": "testwallet-recovered",
"password": "testpassword",
"mnemonic": "gravity sock glove cage divert creek mountain connect small banana depend thunder",
"creationTime": "2017-02-25 16:20:33" // date from which to start looking for transactions "creationTime": "2017-02-25 16:20:33" // date from which to start looking for transactions
} }
``` ```
...@@ -218,9 +227,9 @@ This endpoint will get the first account containing no transaction or will creat ...@@ -218,9 +227,9 @@ This endpoint will get the first account containing no transaction or will creat
### Parameters ### Parameters
``` ```
{ {
"walletName": "myFirstWallet", "walletName": "testwallet",
"password": "123456", "password": "testpassword",
"coinType": 105 "coinType": 105 // 0 - Bitcoin, 105 - Stratis
} }
``` ```
### Responses ### Responses
...@@ -233,9 +242,7 @@ This endpoint will get the first account containing no transaction or will creat ...@@ -233,9 +242,7 @@ This endpoint will get the first account containing no transaction or will creat
This endpoint will get the last address containing no transaction or will create a new address. This endpoint will get the last address containing no transaction or will create a new address.
### Query parameters ### Query parameters
`walletName` (required) - the name of the wallet in which this address is contained. `walletName` (required) - the name of the wallet in which this address is contained.
`coinType` (required) - the type of coin for which to get the address, e.g 0 for bitcoin, 105 for stratis. `coinType` (required) - the type of coin for which to get the address, e.g 0 for bitcoin, 105 for stratis.
`accountName` (required) - the name of the account in which this address is contained. `accountName` (required) - the name of the account in which this address is contained.
### Responses ### Responses
``` ```
...@@ -262,9 +269,7 @@ This endpoint will get the last address containing no transaction or will create ...@@ -262,9 +269,7 @@ This endpoint will get the last address containing no transaction or will create
## GET /wallet/history - Displays the history of the specified wallet account ## GET /wallet/history - Displays the history of the specified wallet account
### Query parameters ### Query parameters
`walletName` (required) - the name of the wallet. `walletName` (required) - the name of the wallet.
`coinType` (required) - the type of coin, e.g 0 for bitcoin, 105 for stratis. `coinType` (required) - the type of coin, e.g 0 for bitcoin, 105 for stratis.
### Responses ### Responses
``` ```
{ {
...@@ -298,10 +303,14 @@ This endpoint will get the last address containing no transaction or will create ...@@ -298,10 +303,14 @@ This endpoint will get the last address containing no transaction or will create
## GET /wallet/balance - Displays the balances of the specified wallet account ## GET /wallet/balance - Displays the balances of the specified wallet account
### Query parameters ### Query parameters
`walletName` (required) - the name of the wallet. `walletName` (required) - the name of the wallet.
`coinType` (required) - the type of coin, e.g 0 for bitcoin, 105 for stratis. `coinType` (required) - the type of coin, e.g 0 for bitcoin, 105 for stratis.
### Responses ### Examples
#### Request
```
http://localhost:37220/api/wallet/balance?walletName=testwallet
```
#### Response
``` ```
{ {
"balances": [ "balances": [
...@@ -322,7 +331,7 @@ Unconfirmed balance is the difference of unconfirmed incoming and outgoing trans ...@@ -322,7 +331,7 @@ Unconfirmed balance is the difference of unconfirmed incoming and outgoing trans
### Parameters ### Parameters
``` ```
{ {
"walletName": "myFirstWallet", "walletName": "testwallet",
"accountName": "account 0", "accountName": "account 0",
"coinType": 0, "coinType": 0,
"password": "password", "password": "password",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment