diff --git a/jmclient/jmclient/wallet-rpc-api.md b/jmclient/jmclient/wallet-rpc-api.md index d36494d..2729309 100644 --- a/jmclient/jmclient/wallet-rpc-api.md +++ b/jmclient/jmclient/wallet-rpc-api.md @@ -268,6 +268,7 @@ create and broadcast a transaction (without coinjoin) | ---- | ----------- | | 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. | @@ -301,6 +302,7 @@ Start the yield generator service with the configuration settings specified in t | 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. | | 503 | The server is not ready to process the request. | ##### Security @@ -333,6 +335,7 @@ stop the yield generator service | 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 @@ -374,6 +377,38 @@ initiate a coinjoin as taker | --- | --- | | 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 diff --git a/jmclient/jmclient/wallet-rpc-api.yaml b/jmclient/jmclient/wallet-rpc-api.yaml index 588c08f..4223d64 100644 --- a/jmclient/jmclient/wallet-rpc-api.yaml +++ b/jmclient/jmclient/wallet-rpc-api.yaml @@ -224,6 +224,8 @@ paths: $ref: '#/components/responses/400-BadRequest' '401': $ref: '#/components/responses/401-Unauthorized' + '404': + $ref: '#/components/responses/404-NotFound' '409': $ref: '#/components/responses/409-TransactionFailed' /wallet/{walletname}/maker/start: @@ -255,6 +257,8 @@ paths: $ref: '#/components/responses/400-BadRequest' '401': $ref: '#/components/responses/401-Unauthorized' + '404': + $ref: '#/components/responses/404-NotFound' '503': $ref: '#/components/responses/503-ServiceUnavailable' /wallet/{walletname}/maker/stop: @@ -278,6 +282,8 @@ paths: $ref: '#/components/responses/400-BadRequest' '401': $ref: "#/components/responses/401-Unauthorized" + '404': + $ref: '#/components/responses/404-NotFound' /wallet/{walletname}/taker/coinjoin: post: security: @@ -311,6 +317,29 @@ paths: $ref: '#/components/responses/409-NoConfig' '503': $ref: '#/components/responses/503-ServiceUnavailable' + /wallet/{walletname}/taker/stop: + get: + security: + - bearerAuth: [] + summary: stop a running coinjoin attempt + operationId: stopcoinjoin + description: stop a running coinjoin attempt + parameters: + - name: walletname + in: path + description: name of wallet including .jmdat + required: true + schema: + type: string + responses: + '202': + $ref: "#/components/responses/202-Accepted" + '400': + $ref: '#/components/responses/400-BadRequest' + '401': + $ref: "#/components/responses/401-Unauthorized" + '404': + $ref: '#/components/responses/404-NotFound' /wallet/{walletname}/configset: post: security: diff --git a/jmclient/jmclient/wallet_rpc.py b/jmclient/jmclient/wallet_rpc.py index 219ac36..df9ee0d 100644 --- a/jmclient/jmclient/wallet_rpc.py +++ b/jmclient/jmclient/wallet_rpc.py @@ -790,8 +790,21 @@ class JMWalletDaemon(Service): utxos_response = self.get_listutxos_response(utxos) return make_jmwalletd_response(request, utxos=utxos_response) + # route to abort a currently running coinjoin + @app.route('/wallet//taker/stop', methods=['GET']) + def stopcoinjoin(self, request, walletname): + self.check_cookie(request) + if not self.wallet_service: + raise NoWalletFound() + if not self.wallet_name == walletname: + raise InvalidRequestFormat() + if not self.coinjoin_state == CJ_TAKER_RUNNING: + raise ServiceNotStarted() + self.taker_finished(False) + return make_jmwalletd_response(request, status=202) + #route to start a coinjoin transaction - @app.route('/wallet//taker/coinjoin',methods=['POST']) + @app.route('/wallet//taker/coinjoin', methods=['POST']) def docoinjoin(self, request, walletname): self.check_cookie(request) if not self.wallet_service: