Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report offerlist in /session call if possible #1328

Merged
merged 2 commits into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions docs/api/wallet-rpc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,25 @@ 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
nickname:
type: string
ListUtxosResponse:
type: object
properties:
Expand Down
30 changes: 22 additions & 8 deletions jmclient/jmclient/wallet_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,18 +590,30 @@ def session(self, request):
session = not self.cookie==None
maker_running = self.coinjoin_state == CJ_MAKER_RUNNING
coinjoin_in_process = self.coinjoin_state == CJ_TAKER_RUNNING

# fields which may or may not be available:
schedule = None
offer_list = None
nickname = 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.
if self.taker is not None and not self.taker.aborted:
schedule = self.taker.schedule
# 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 auth_header is not None:
if self.coinjoin_state == CJ_TAKER_RUNNING and \
self.tumbler_options is not None:
if self.taker is not None and not self.taker.aborted:
schedule = self.taker.schedule
elif maker_running:
offer_list = self.services["maker"].yieldgen.offerlist
# maker's nick is useful for tracking; so we only report
# it if authed and maker running:
if jm_single().nickname is not None:
nickname = jm_single().nickname

else:
wallet_name = "not yet loaded"
else:
Expand All @@ -611,7 +623,9 @@ 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,
nickname=nickname)

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