def initialTip(self): """ send a tip from the correct horse battery staple agent to get the new agent funded """ try: response = self.chbsagent.tip(self.agentAddress, netvend.convert_value(1, 'satoshi', 'usat'), None) except netvend.NetvendResponseError as e: self.writeConsole('Failed to tip new agent - ' + str(e)) return
def getBalance(self): """ get the balance for the logged in agent """ self.unit = db.getSetting(self, 'unit', 'satoshi') try: self.agentBalance = netvend.convert_value(self.agent.fetch_balance(), 'usat', self.unit) except netvend.NetvendResponseError: self.agentBalance = 0 return
def initialTip(self): """ send a tip from the correct horse battery staple agent to get the new agent funded """ try: response = self.chbsagent.tip( self.agentAddress, netvend.convert_value(1, 'satoshi', 'usat'), None) except netvend.NetvendResponseError as e: self.writeConsole('Failed to tip new agent - ' + str(e)) return
def commandTip(self, command): """ Tip a nickname, address or post_id nickname tipping still in progress """ if not util.checkLogin(self): return elif len(command) < 2: self.writeConsole('You need to supply the detail of the agent or post you wish to tip.') return #command[1] could be an address, a nickname or a post id #we can identify addresses so do that first if util.isAddress(command[1]): #we know it's an address tipAddress = command[1] postId = None #otherwise test for nickname elif util.getAddressFromNick(command[1]) is not False: tipAddress = util.getAddressFromNick(command[1]) postId = None #all it can be after that is a post id else: tipAddress = util.getAddressFromPostID(self, command[1]) if tipAddress is False: self.writeConsole('Tip Failed - ' + command[1] + ' was not a nickname, address or post id') return postId = command[1] try: response = self.agent.tip(tipAddress, netvend.convert_value(int(self.tipAmount), str(self.unit), 'usat'), postId) if response['success'] == 1: try: self.agentBalance = self.agent.fetch_balance() except netvend.NetvendResponseError as e: self.agentBalance = 0 self.writeConsole( 'Tip successful.\nTip ID : ' + str(response['command_result']) + ' - New Balance : ' + str( self.agentBalance)) else: self.writeConsole('Tip Failed') return except netvend.NetvendResponseError as e: self.writeConsole('Tip failed - ' + str(e)) return