Browse Source

Merge #1153: API documentation via ReDoc

91c2c48 API documentation via ReDoc (Dennis Reimann)
master
Adam Gibson 4 years ago
parent
commit
12784c5de7
No known key found for this signature in database
GPG Key ID: 141001A1AF77F20B
  1. 8
      docs/JSON-RPC-API-using-jmwalletd.md
  2. 15
      docs/api/index.html
  3. 0
      docs/api/wallet-rpc.yaml
  4. 653
      jmclient/jmclient/wallet-rpc-api.md

8
docs/JSON-RPC-API-using-jmwalletd.md

@ -26,7 +26,7 @@ Note that for some methods, it's particularly important to deal with the HTTP re
Current API version: v1.
The [OpenAPI](https://github.com/OAI/OpenAPI-Specification) spec is given in [this yaml file](../jmclient/jmclient/wallet-rpc-api.yaml). Human readable documentation of the API is provided in [this document](../jmclient/jmclient/wallet-rpc-api.md), which is auto-generated with the node utility [swagger-markdown](https://www.npmjs.com/package/swagger-markdown).
The [OpenAPI](https://github.com/OAI/OpenAPI-Specification) spec is given in [this yaml file](./api/wallet-rpc.yaml). Human readable documentation of the API is provided in the [documentation](https://JoinMarket-Org.github.io/joinmarket-clientserver/api).
Those wishing to write client code should adhere to that specification.
@ -71,8 +71,8 @@ When the backend switches from doing nothing, to running a coinjoin as taker ove
where the values are:
0 - Taker running
1 - Maker running
0 - Taker running
1 - Maker running
2 - Neither are running
#### Transaction event
@ -80,7 +80,7 @@ where the values are:
When a transaction is seen for the first time in the Joinmarket wallet, a notification is sent to the client over the websocket as encoded json, containing the txid and a detailed human-readable deserialization of the transaction details. See this example:
```
{"txid": "ca606efc5ba8f6669ba15e9262e5d38e745345ea96106d5a919688d1ff0da0cc",
{"txid": "ca606efc5ba8f6669ba15e9262e5d38e745345ea96106d5a919688d1ff0da0cc",
"txdetails": {
"hex": "02000000000102578770b2732aed421ffe62d54fd695cf281ca336e4f686d2adbb2e8c3bedb2570000000000ffffffff4719a259786b4237f92460629181edcc3424419592529103143090f07d85ec330100000000ffffffff0324fd9b0100000000160014d38fa4a6ac8db7495e5e2b5d219dccd412dd9bae24fd9b0100000000160014564aead56de8f4d445fc5b74a61793b5c8a819667af6c208000000001600146ec55c2e1d1a7a868b5ec91822bf40bba842bac502473044022078f8106a5645cc4afeef36d4addec391a5b058cc51053b42c89fcedf92f4db1002200cdf1b66a922863fba8dc1b1b1a0dce043d952fa14dcbe86c427fda25e930a53012102f1f750bfb73dbe4c7faec2c9c301ad0e02176cd47bcc909ff0a117e95b2aad7b02483045022100b9a6c2295a1b0f7605381d416f6ed8da763bd7c20f2402dd36b62dd9dd07375002207d40eaff4fc6ee219a7498abfab6bdc54b7ce006ac4b978b64bff960fbf5f31e012103c2a7d6e44acdbd503c578ec7d1741a44864780be0186e555e853eee86e06f11f00000000",
"inputs": [

15
docs/api/index.html

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JoinMarket Wallet RPC API Reference</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body { margin: 0; padding: 0; }
</style>
</head>
<body>
<redoc spec-url="./wallet-rpc.yaml"></redoc>
<script src="https://cdn.jsdelivr.net/npm/redoc@latest/bundles/redoc.standalone.min.js"></script>
</body>
</html>

0
jmclient/jmclient/wallet-rpc-api.yaml → docs/api/wallet-rpc.yaml

653
jmclient/jmclient/wallet-rpc-api.md

@ -1,653 +0,0 @@
# Joinmarket wallet API
Joinmarket wallet API
## Version: 1
### /wallet/create
#### POST
##### Summary
create a new wallet
##### Description
Give a filename (.jmdat must be included) and a password, create the wallet and get back the seedphrase for the newly persisted wallet file. The wallettype variable must be one of "sw" - segwit native, "sw-legacy" - segwit legacy or "sw-fb" - segwit native with fidelity bonds supported, the last of which is the default. Note that this operation cannot be performed when a wallet is already loaded (unlocked).
##### Responses
| Code | Description |
| ---- | ----------- |
| 201 | wallet created successfully |
| 400 | Bad request format. |
| 401 | Unable to authorise the credentials that were supplied. |
| 409 | Unable to complete request because object already exists. |
### /wallet/{walletname}/unlock
#### POST
##### Summary
decrypt an existing wallet
##### Description
Give the password for the specified (existing) wallet file, and it will be decrypted ready for use. Note that this operation cannot be performed when another wallet is already loaded (unlocked).
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ---- |
| walletname | path | name of wallet including .jmdat | Yes | string |
##### Responses
| Code | Description |
| ---- | ----------- |
| 200 | wallet unlocked successfully |
| 400 | Bad request format. |
| 401 | Unable to authorise the credentials that were supplied. |
| 404 | Item not found. |
| 409 | Unable to complete request because object already exists. |
### /wallet/{walletname}/lock
#### GET
##### Summary
block access to a currently decrypted wallet
##### Description
After this (authenticated) action, the wallet will not be readable or writeable.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ---- |
| walletname | path | name of wallet including .jmdat | Yes | string |
##### Responses
| Code | Description |
| ---- | ----------- |
| 200 | wallet unlocked successfully |
| 400 | Bad request format. |
| 401 | Unable to authorise the credentials that were supplied. |
##### Security
| Security Schema | Scopes |
| --- | --- |
| bearerAuth | |
### /wallet/{walletname}/display
#### GET
##### Summary
get detailed breakdown of wallet contents by account.
##### Description
get detailed breakdown of wallet contents by account.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ---- |
| walletname | path | name of wallet including .jmdat | Yes | string |
##### Responses
| Code | Description |
| ---- | ----------- |
| 200 | wallet display contents retrieved successfully. |
| 400 | Bad request format. |
| 401 | Unable to authorise the credentials that were supplied. |
| 404 | Item not found. |
##### Security
| Security Schema | Scopes |
| --- | --- |
| bearerAuth | |
### /session
#### GET
##### Summary
get current status of backend
##### Description
get whether a wallet is loaded and whether coinjoin/maker are happening.
##### Responses
| Code | Description |
| ---- | ----------- |
| 200 | successful heartbeat response |
### /wallet/all
#### GET
##### Summary
get current available wallets
##### Description
get all wallet filenames in standard location as a list
##### Responses
| Code | Description |
| ---- | ----------- |
| 200 | successful response to listwallets |
### /wallet/{walletname}/address/new/{mixdepth}
#### GET
##### Summary
get a fresh address in the given account for depositing funds.
##### Description
get a fresh address in the given account for depositing funds.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ---- |
| walletname | path | name of wallet including .jmdat | Yes | string |
| mixdepth | path | account or mixdepth to source the address from (0..4) | Yes | string |
##### Responses
| Code | Description |
| ---- | ----------- |
| 200 | successful retrieval of new address |
| 400 | Bad request format. |
| 401 | Unable to authorise the credentials that were supplied. |
| 404 | Item not found. |
##### Security
| Security Schema | Scopes |
| --- | --- |
| bearerAuth | |
### /wallet/{walletname}/address/timelock/new/{lockdate}
#### GET
##### Summary
get a fresh timelock address
##### Description
get a new timelocked address, for depositing funds, to create a fidelity bond, which will automatically be used when the maker is started. specify the date in YYYY-mm as the last path parameter. Note that mixdepth is not specified as timelock addresses are always in mixdepth(account) zero.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ---- |
| walletname | path | name of wallet including .jmdat | Yes | string |
| lockdate | path | month whose first day will be the end of the timelock, for this address. | Yes | string |
##### Responses
| Code | Description |
| ---- | ----------- |
| 200 | successful retrieval of new address |
| 400 | Bad request format. |
| 401 | Unable to authorise the credentials that were supplied. |
| 404 | Item not found. |
##### Security
| Security Schema | Scopes |
| --- | --- |
| bearerAuth | |
### /wallet/{walletname}/utxos
#### GET
##### Summary
list details of all utxos currently in the wallet.
##### Description
list details of all utxos currently in the wallet.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ---- |
| walletname | path | name of wallet including .jmdat | Yes | string |
##### Responses
| Code | Description |
| ---- | ----------- |
| 200 | successful retrieval of utxo list |
| 400 | Bad request format. |
| 401 | Unable to authorise the credentials that were supplied. |
| 404 | Item not found. |
##### Security
| Security Schema | Scopes |
| --- | --- |
| bearerAuth | |
### /wallet/{walletname}/taker/direct-send
#### POST
##### Summary
create and broadcast a transaction (without coinjoin)
##### Description
create and broadcast a transaction (without coinjoin)
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ---- |
| walletname | path | name of wallet including .jmdat | Yes | string |
##### Responses
| Code | Description |
| ---- | ----------- |
| 200 | transaction broadcast OK. |
| 400 | Bad request format. |
| 404 | Item not found. |
| 401 | Unable to authorise the credentials that were supplied. |
| 409 | Transaction failed to broadcast. |
##### Security
| Security Schema | Scopes |
| --- | --- |
| bearerAuth | |
### /wallet/{walletname}/maker/start
#### POST
##### Summary
Start the yield generator service.
##### Description
Start the yield generator service with the configuration settings specified in the POST request. Note that if fidelity bonds are enabled in the wallet, and a timelock address has been generated, and then funded, the fidelity bond will automatically be advertised without any specific configuration in this request. Note that if the wallet does not have confirmed coins, or another taker or maker coinjoin service is already running, the maker will not start.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ---- |
| walletname | path | name of wallet including .jmdat | Yes | string |
##### Responses
| Code | Description |
| ---- | ----------- |
| 202 | The request has been submitted successfully for processing, but the processing has not been completed. |
| 400 | Bad request format. |
| 401 | Unable to authorise the credentials that were supplied. |
| 404 | Item not found. |
| 409 | Maker could not start without confirmed balance. |
| 503 | The server is not ready to process the request. |
##### Security
| Security Schema | Scopes |
| --- | --- |
| bearerAuth | |
### /wallet/{walletname}/maker/stop
#### GET
##### Summary
stop the yield generator service
##### Description
stop the yield generator service
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ---- |
| walletname | path | name of wallet including .jmdat | Yes | string |
##### Responses
| Code | Description |
| ---- | ----------- |
| 202 | The request has been submitted successfully for processing, but the processing has not been completed. |
| 400 | Bad request format. |
| 401 | Unable to authorise the credentials that were supplied. |
| 404 | Item not found. |
##### Security
| Security Schema | Scopes |
| --- | --- |
| bearerAuth | |
### /wallet/{walletname}/taker/coinjoin
#### POST
##### Summary
initiate a coinjoin as taker
##### Description
initiate a coinjoin as taker
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ---- |
| walletname | path | name of wallet including .jmdat | Yes | string |
##### Responses
| Code | Description |
| ---- | ----------- |
| 202 | The request has been submitted successfully for processing, but the processing has not been completed. |
| 400 | Bad request format. |
| 401 | Unable to authorise the credentials that were supplied. |
| 404 | Item not found. |
| 409 | Unable to complete request because config settings are missing. |
| 503 | The server is not ready to process the request. |
##### Security
| Security Schema | Scopes |
| --- | --- |
| bearerAuth | |
### /wallet/{walletname}/taker/stop
#### GET
##### Summary
stop a running coinjoin attempt
##### Description
stop a running coinjoin attempt
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ---- |
| walletname | path | name of wallet including .jmdat | Yes | string |
##### Responses
| Code | Description |
| ---- | ----------- |
| 202 | The request has been submitted successfully for processing, but the processing has not been completed. |
| 400 | Bad request format. |
| 401 | Unable to authorise the credentials that were supplied. |
| 404 | Item not found. |
##### Security
| Security Schema | Scopes |
| --- | --- |
| bearerAuth | |
### /wallet/{walletname}/configset
#### POST
##### Summary
change a config variable
##### Description
change a config variable (for the duration of this backend daemon process instance)
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ---- |
| walletname | path | name of wallet including .jmdat | Yes | string |
##### Responses
| Code | Description |
| ---- | ----------- |
| 200 | successful update of config value |
| 400 | Bad request format. |
| 401 | Unable to authorise the credentials that were supplied. |
| 409 | Unable to complete request because config settings are missing. |
##### Security
| Security Schema | Scopes |
| --- | --- |
| bearerAuth | |
### /wallet/{walletname}/configget
#### POST
##### Summary
get the value of a specific config setting
##### Description
Get the value of a specific config setting. Note values are always returned as string.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ---- |
| walletname | path | name of wallet including .jmdat | Yes | string |
##### Responses
| Code | Description |
| ---- | ----------- |
| 200 | successful retrieval of config value |
| 400 | Bad request format. |
| 401 | Unable to authorise the credentials that were supplied. |
| 409 | Unable to complete request because config settings are missing. |
##### Security
| Security Schema | Scopes |
| --- | --- |
| bearerAuth | |
### /wallet/{walletname}/getseed
#### GET
##### Summary
get the mnemonic recovery phrase with the optional passphrase
##### Description
Get the mnemonic recovery phrase with the optional passphrase. Not the response is a sentence with few line breaks.
##### Parameters
| Name | Located in | Description | Required | Schema |
| ---- | ---------- | ----------- | -------- | ---- |
| walletname | path | name of the wallet including .jmdat | Yes | string |
##### Responses
| Code | Description |
| ---- | ----------- |
| 200 | seedphrase retrieved successfully |
| 400 | Bad request format. |
| 401 | Unable to authorise the credentials that were supplied. |
##### Security
| Security Schema | Scopes |
| --- | --- |
| bearerAuth | |
### Models
#### ConfigSetRequest
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| section | string | | Yes |
| field | string | | Yes |
| value | string | | Yes |
#### ConfigGetRequest
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| section | string | | Yes |
| field | string | | Yes |
#### ConfigGetResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| configvalue | string | | Yes |
#### ConfigSetResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| ConfigSetResponse | object | | |
#### DoCoinjoinRequest
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| mixdepth | integer | _Example:_ `0` | Yes |
| amount_sats | integer |_Example:_ `100000000` | Yes |
| counterparties | integer | _Example:_ `9` | Yes |
| destination | string | _Example:_ `"bcrt1qujp2x2fv437493sm25gfjycns7d39exjnpptzw"` | Yes |
#### StartMakerRequest
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| txfee | string | _Example:_ `"0"` | Yes |
| cjfee_a | string |_Example:_ `"5000"` | Yes |
| cjfee_r | string |_Example:_ `"0.00004"` | Yes |
| ordertype | string | _Example:_ `"reloffer"` | Yes |
| minsize | string | _Example:_ `"8000000"` | Yes |
#### GetAddressResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| GetAddressResponse | string | | |
**Example**
<pre>bcrt1qujp2x2fv437493sm25gfjycns7d39exjnpptzw</pre>
#### ListWalletsResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| wallets | [ string ] | | No |
#### SessionResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| session | boolean | | Yes |
| maker_running | boolean | | Yes |
| coinjoin_in_process | boolean | | Yes |
| wallet_name | string |_Example:_ `"wallet.jmdat"` | Yes |
#### ListUtxosResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| utxos | [ object ] | | No |
#### WalletDisplayResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| walletname | string | | Yes |
| walletinfo | object | | Yes |
#### CreateWalletResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| walletname | string | _Example:_ `"wallet.jmdat"` | Yes |
| token | byte | | Yes |
| seedphrase | string | | Yes |
#### UnlockWalletResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| walletname | string | _Example:_ `"wallet.jmdat"` | Yes |
| token | byte | | Yes |
#### DirectSendResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| txinfo | object | | Yes |
#### GetSeedResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| seedphrase | string | | Yes |
#### LockWalletResponse
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| walletname | string | _Example:_ `"wallet.jmdat"` | Yes |
| already_locked | boolean |_Example:_ `false` | Yes |
#### CreateWalletRequest
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| walletname | string | _Example:_ `"wallet.jmdat"` | Yes |
| password | password | _Example:_ `"hunter2"` | Yes |
| wallettype | string | _Example:_ `"sw-fb"` | Yes |
#### UnlockWalletRequest
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| password | password | _Example:_ `"hunter2"` | Yes |
#### DirectSendRequest
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| mixdepth | integer | _Example:_ `0` | Yes |
| amount_sats | integer |_Example:_ `100000000` | Yes |
| destination | string | _Example:_ `"bcrt1qu7k4dppungsqp95nwc7ansqs9m0z95h72j9mze"` | Yes |
#### ErrorMessage
| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| message | string | | No |
Loading…
Cancel
Save