Switched to integrated addresses

This commit is contained in:
koalaKoolaid 2020-04-10 17:08:10 -04:00
parent a97587a4d7
commit e449fed8cc
2 changed files with 21 additions and 11 deletions

View File

@ -22,19 +22,22 @@ from tipbot.command_manager import *
last_wallet_update_time = None
def GetTipbotAddress():
def GetTipbotIntAddress():
try:
j = SendWalletJSONRPCCommand("getaddress",None)
j = SendWalletJSONRPCCommand("make_integrated_address",None)
if not "result" in j:
log_error('GetTipbotAddress: No result found in getaddress reply')
log_error('GetTipbotIntAddress: No result found in make_integrated_address reply')
return None
result = j["result"]
if not "address" in result:
log_error('GetTipbotAddress: No address found in getaddress reply')
if not "integrated_address" in result:
log_error('GetTipbotIntAddress: No integrated_address found in make_integrated_address reply')
return None
return result["address"]
if not "payment_id" in result:
log_error('GetTipbotIntAddress: No payment_id found in make_integrated_address reply')
return None
return result
except Exception,e:
log_error("GetTipbotAddress: Error retrieving %s's address: %s" % (config.tipbot_name, str(e)))
log_error("GetTipbotIntAddress: Error retrieving %s's int_address: %s" % (config.tipbot_name, str(e)))
return None
def UpdateCoin(data):
@ -167,12 +170,12 @@ def RandomPaymentID(link,cmd):
def Help(link):
GetAccount(link.identity())
link.send_private("You can send %s to your account using this address AND payment ID:" % coinspecs.name);
address=GetTipbotAddress() or 'ERROR'
link.send_private(" Address: %s" % address)
result=GetTipbotIntAddress() or 'ERROR'
link.send_private(" Address: %s" % result["integrated_address"])
if config.openalias_address != None:
link.send_private(" (or %s when using OpenAlias)" % config.openalias_address)
link.send_private(" Use your primary payment ID: %s" % GetPaymentID(link))
link.send_private(" OR generate random payment ids at will with: !randompid")
SetPaymentID(link,result["payment_id"])
link.send_private(" Use your primary payment ID: %s" % result["payment_id"])
link.send_private("Incoming transactions are credited after %d confirmations" % config.payment_confirmations)
RegisterModule({

View File

@ -57,6 +57,13 @@ def GetParam(parms,idx):
return parms[idx]
return None
def SetPaymentID(link,pid):
try:
redis_hset("paymentid",pid,link.identity())
except Exception,e:
log_error('GetPaymentID: failed to set payment ID for %s to redis: %s' % (link.identity(),str(e)))
return
def GetPaymentID(link,random=False):
salt="2u3g55bkwrui32fi3g4bGR$j5g4ugnujb-"+coinspecs.name+"-";
if random: