Fix wallet command
This commit is contained in:
parent
79caec1680
commit
917ef5c886
|
@ -238,21 +238,26 @@ class GenericCommands(object):
|
||||||
msg(dumps(rtrn))
|
msg(dumps(rtrn))
|
||||||
|
|
||||||
class wallet(object):
|
class wallet(object):
|
||||||
|
@staticmethod
|
||||||
|
def got_wallet(wallet_output, msg, asset):
|
||||||
|
if not wallet_output["success"]:
|
||||||
|
msg(f"Error getting {asset} wallet details.")
|
||||||
|
return
|
||||||
|
if not wallet_output["response"]:
|
||||||
|
msg(f"Error getting {asset} wallet details.")
|
||||||
|
return
|
||||||
|
balance = wallet_output["response"]["data"]["total"]["balance"]
|
||||||
|
msg(f"{asset} wallet balance: {balance}")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run(cmd, spl, length, authed, msg, agora, tx, ux, xmr, caller):
|
def run(cmd, spl, length, authed, msg, agora, tx, ux, xmr, caller):
|
||||||
if xmr:
|
if xmr:
|
||||||
rtrn_xmr = caller.wallet_balance_xmr()
|
rtrn_xmr = caller.wallet_balance_xmr()
|
||||||
if not rtrn_xmr["success"]:
|
rtrn_xmr.addCallback(GenericCommands.wallet.got_wallet, msg, "XMR")
|
||||||
msg("Error getting XMR wallet details.")
|
|
||||||
return
|
else:
|
||||||
balance_xmr = rtrn_xmr["response"]["data"]["total"]["balance"]
|
rtrn_btc = caller.wallet_balance()
|
||||||
msg(f"XMR wallet balance: {balance_xmr}")
|
rtrn_btc.addCallback(GenericCommands.wallet.got_wallet, msg, "BTC")
|
||||||
rtrn_btc = caller.wallet_balance()
|
|
||||||
if not rtrn_btc["success"]:
|
|
||||||
msg("Error getting BTC wallet details.")
|
|
||||||
return
|
|
||||||
balance_btc = rtrn_btc["response"]["data"]["total"]["balance"]
|
|
||||||
msg(f"BTC wallet balance: {balance_btc}")
|
|
||||||
|
|
||||||
|
|
||||||
class IRCCommands(object):
|
class IRCCommands(object):
|
||||||
|
@ -396,13 +401,20 @@ class IRCCommands(object):
|
||||||
helptext = "Get total account balance from Sinks and Agora."
|
helptext = "Get total account balance from Sinks and Agora."
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
def got_total(total_output, msg):
|
||||||
totals_all = tx.money.get_total()
|
if not total_output:
|
||||||
totals = totals_all[0]
|
msg("Error getting total output")
|
||||||
wallets = totals_all[1]
|
return
|
||||||
|
totals = total_output[0]
|
||||||
|
wallets = total_output[1]
|
||||||
msg(f"Totals: SEK: {totals[0]} | USD: {totals[1]} | GBP: {totals[2]}")
|
msg(f"Totals: SEK: {totals[0]} | USD: {totals[1]} | GBP: {totals[2]}")
|
||||||
msg(f"Wallets: XMR USD: {wallets[0]} | BTC USD: {wallets[1]}")
|
msg(f"Wallets: XMR USD: {wallets[0]} | BTC USD: {wallets[1]}")
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
|
totals_all = tx.money.get_total()
|
||||||
|
totals_all.addCallback(IRCCommands.total.got_total, msg)
|
||||||
|
|
||||||
class ping(object):
|
class ping(object):
|
||||||
name = "ping"
|
name = "ping"
|
||||||
authed = False
|
authed = False
|
||||||
|
@ -541,7 +553,7 @@ class IRCCommands(object):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
GenericCommands.wallet.run(cmd, spl, length, authed, msg, agora, tx, ux, True, agora.agora)
|
GenericCommands.wallet.run(cmd, spl, length, authed, msg, agora, tx, ux, True, agora.api)
|
||||||
|
|
||||||
class lwallet(object):
|
class lwallet(object):
|
||||||
authed = True
|
authed = True
|
||||||
|
@ -550,7 +562,7 @@ class IRCCommands(object):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
GenericCommands.wallet.run(cmd, spl, length, authed, msg, agora, tx, ux, False, tx.lbtc.lbtc)
|
GenericCommands.wallet.run(cmd, spl, length, authed, msg, agora, tx, ux, False, tx.lbtc.api)
|
||||||
|
|
||||||
class apubads(object):
|
class apubads(object):
|
||||||
authed = True
|
authed = True
|
||||||
|
|
Loading…
Reference in New Issue