def getutxos(self, addr, nconf): # nconf 0 or 1 # limited to 100 utxos self.getData("get_tx_unspent", addr) self.checkapiresp() addrutxos = self.getKey("data/txs") selutxos = [] # translate inputs from sochain to pylitecoinlib for utxo in addrutxos: selutxos.append( { "value": shift_10(utxo["value"], LTC_units), "output": utxo["txid"] + ":" + str(utxo["output_no"]), } ) return selutxos
def transfer(self, amount, to_account, fee_priority): # Transfer x unit to an account, pay if self.eth.ERC20: gazlimit = ETH_wallet.GAZ_LIMIT_ERC_20_TX else: gazlimit = ETH_wallet.GAZ_LIMIT_SIMPLE_TX if to_account.startswith("0x"): to_account = to_account[2:] gaz_price = self.eth.api.get_gasprice() # wei per gaz unit if fee_priority == 0: gaz_price = int(gaz_price * 0.9) elif fee_priority == 1: gaz_price = int(gaz_price * 1.1) elif fee_priority == 2: gaz_price = int(gaz_price * 1.6) else: Exception("fee_priority must be 0, 1 or 2 (slow, normal, fast)") tx_data = self.build_tx( shift_10(amount, self.eth.decimals), gaz_price, gazlimit, to_account ) return "\nDONE, txID : " + self.broadcast_tx(tx_data)
def transfer(self, amount, to_account, priority_fee): # Transfer x unit to an account, pay tx_data = self.build_tx(shift_10(amount, self.sol.decimals), to_account) return "\nDONE, txID : " + self.broadcast_tx(tx_data)
def transfer(self, amount, to_account, fee_priority): # Transfer x base unit to an account, pay fee = self.assess_fee(fee_priority) return self.raw_tx(shift_10(amount, LTC_units), fee, to_account)
def test_shift10(data_test): assert shift_10(data_test[0], data_test[1]) == data_test[2]