Skip to content

Commit

Permalink
Report offerlist in /session call if possible
Browse files Browse the repository at this point in the history
This partially addresses #1326. If the maker service is running,
we return the offerlist in the /session API call, as suggested there.
  • Loading branch information
AdamISZ committed Aug 8, 2022
1 parent 32a4ac5 commit 8ee6b39
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
17 changes: 17 additions & 0 deletions docs/api/wallet-rpc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,23 @@ components:
wallet_name:
type: string
example: wallet.jmdat
offer_list:
type: array
items:
type: object
properties:
oid:
type: integer
ordertype:
type: string
minsize:
type: integer
maxsize:
type: integer
txfee:
type: integer
cjfee:
type: string
ListUtxosResponse:
type: object
properties:
Expand Down
17 changes: 10 additions & 7 deletions jmclient/jmclient/wallet_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,17 +591,19 @@ def session(self, request):
maker_running = self.coinjoin_state == CJ_MAKER_RUNNING
coinjoin_in_process = self.coinjoin_state == CJ_TAKER_RUNNING
schedule = None

offer_list = None
if self.services["wallet"]:
if self.services["wallet"].isRunning():
wallet_name = self.wallet_name
if self.coinjoin_state == CJ_TAKER_RUNNING and self.tumbler_options is not None:
auth_header = request.getHeader('Authorization')
if auth_header is not None:
# At this point if an `auth_header` is present, it has been checked
# by the call to `check_cookie_if_present` above.
# At this point if an `auth_header` is present, it has been checked
# by the call to `check_cookie_if_present` above.
auth_header = request.getHeader('Authorization')
if self.coinjoin_state == CJ_TAKER_RUNNING and \
self.tumbler_options is not None and auth_header is not None:
if self.taker is not None and not self.taker.aborted:
schedule = self.taker.schedule
elif maker_running and auth_header is not None:
offer_list = self.services["maker"].yieldgen.offerlist
else:
wallet_name = "not yet loaded"
else:
Expand All @@ -611,7 +613,8 @@ def session(self, request):
maker_running=maker_running,
coinjoin_in_process=coinjoin_in_process,
schedule=schedule,
wallet_name=wallet_name)
wallet_name=wallet_name,
offer_list=offer_list)

@app.route('/wallet/<string:walletname>/taker/direct-send', methods=['POST'])
def directsend(self, request, walletname):
Expand Down

0 comments on commit 8ee6b39

Please sign in to comment.