mirror of
https://git.wownero.com/wownero/tippero.git
synced 2024-08-15 00:33:14 +00:00
withdraw: add support for payment id
This commit is contained in:
parent
c8b6ade388
commit
b5b775e90c
1 changed files with 19 additions and 4 deletions
|
@ -52,13 +52,24 @@ def Withdraw(link,cmd):
|
||||||
try:
|
try:
|
||||||
address=cmd[1]
|
address=cmd[1]
|
||||||
except Exception,e:
|
except Exception,e:
|
||||||
link.send("Usage: withdraw address [amount]")
|
link.send("Usage: withdraw address [amount] [paymentid]")
|
||||||
return
|
return
|
||||||
|
|
||||||
if not IsValidAddress(address):
|
if not IsValidAddress(address):
|
||||||
link.send("Invalid address")
|
link.send("Invalid address")
|
||||||
return
|
return
|
||||||
amount = GetParam(cmd,2)
|
|
||||||
|
if GetParam(cmd,3):
|
||||||
|
amount = GetParam(cmd,2)
|
||||||
|
paymentid = GetParam(cmd,3)
|
||||||
|
else:
|
||||||
|
if IsValidPaymentID(GetParam(cmd,2)):
|
||||||
|
amount = None
|
||||||
|
paymentid = GetParam(cmd,2)
|
||||||
|
else:
|
||||||
|
amount = GetParam(cmd,2)
|
||||||
|
paymentid = None
|
||||||
|
|
||||||
if amount:
|
if amount:
|
||||||
try:
|
try:
|
||||||
amount = StringToUnits(amount)
|
amount = StringToUnits(amount)
|
||||||
|
@ -68,6 +79,10 @@ def Withdraw(link,cmd):
|
||||||
except Exception,e:
|
except Exception,e:
|
||||||
link.send("Invalid amount")
|
link.send("Invalid amount")
|
||||||
return
|
return
|
||||||
|
if paymentid != None:
|
||||||
|
if not IsValidPaymentID(paymentid):
|
||||||
|
link.send("Invalid payment ID")
|
||||||
|
return
|
||||||
|
|
||||||
log_info("Withdraw: %s wants to withdraw %s to %s" % (identity, AmountToString(amount) if amount else "all", address))
|
log_info("Withdraw: %s wants to withdraw %s to %s" % (identity, AmountToString(amount) if amount else "all", address))
|
||||||
|
|
||||||
|
@ -106,7 +121,7 @@ def Withdraw(link,cmd):
|
||||||
log_info('Withdraw: fee: %s, to pay: %s' % (AmountToString(fee), AmountToString(topay)))
|
log_info('Withdraw: fee: %s, to pay: %s' % (AmountToString(fee), AmountToString(topay)))
|
||||||
params = {
|
params = {
|
||||||
'destinations': [{'address': address, 'amount': topay}],
|
'destinations': [{'address': address, 'amount': topay}],
|
||||||
'payment_id': GetPaymentID(link),
|
'payment_id': paymentid,
|
||||||
'fee': coinspecs.min_withdrawal_fee,
|
'fee': coinspecs.min_withdrawal_fee,
|
||||||
'mixin': config.withdrawal_mixin,
|
'mixin': config.withdrawal_mixin,
|
||||||
'unlock_time': 0,
|
'unlock_time': 0,
|
||||||
|
@ -153,7 +168,7 @@ RegisterModule({
|
||||||
RegisterCommand({
|
RegisterCommand({
|
||||||
'module': __name__,
|
'module': __name__,
|
||||||
'name': 'withdraw',
|
'name': 'withdraw',
|
||||||
'parms': '<address> [<amount>]',
|
'parms': '<address> [<amount>] [paymentid]',
|
||||||
'function': Withdraw,
|
'function': Withdraw,
|
||||||
'registered': True,
|
'registered': True,
|
||||||
'help': "withdraw part or all of your balance"
|
'help': "withdraw part or all of your balance"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue