Ejemplo n.º 1
0
async def return_spare(walletID, depositAddress):
    balanceraw = await get_balance(depositAddress)
    balanceint = int(balanceraw) / 10**29
    if balanceint == 0:
        return None
    else:
        print("\nThe temporary deposit address still has " + str(balanceint) +
              "ban remaining!")
        while Validations.get_banano_address(returnAddr) is not None:
            returnAddr = input(
                "Enter the banano address you would like to return the spare to \n"
            )
            returnAddr = Validations.get_banano_address(returnAddr)
            if Validations.validate_address(returnAddr) is True:
                print("Sending remaining bans to: " + returnAddr)
                break
            else:
                print(returnAddr + " is not a valid account")
        try:
            await send_payment(walletID, depositAddress, returnAddr,
                               balanceraw)
        except Exception as e:
            print(e)
            print(
                "Publishing block failed. Funds remain in distribution address\n"
            )
Ejemplo n.º 2
0
async def load_addresses():
    filename = input("Enter the csv payment list here: \n")
    try:
        data = pd.read_csv(filename)
        addresses = list(data["addresses"])
        valid_addresses = set()

        for address in addresses:
            if Validations.get_banano_address(address) is not None:
                valid_addresses.add(Validations.get_banano_address(address))
        print("Total addresses: " + str(len(valid_addresses)))
        try:
            f = open("paid.txt", "r")
        except:
            open("paid.txt", "x")
            f = open("paid.txt", "r")
        previous = set(f.read().splitlines())
        unpaid = valid_addresses.difference(previous)
        print(len(unpaid), "unpaid:")
        print(unpaid)
        input("Press enter to continue")
        return unpaid
    except Exception as e:
        print(e)

    valid_addresses = set()
    return valid_addresses
Ejemplo n.º 3
0
async def main():
    filename = input("Enter the csv payment list here: \n")
    data = pd.read_csv(filename)
    amounts = list(data["amount"])
    total = 0
    for amount in amounts:
        total = total + amount
    print("Total: " + str(total))
    print(data)

    walletID = await get_wallet()
    paymentadd = await account_create(walletID)

    while not await enough_bans(paymentadd, total):
        input("Please ensure " + str(paymentadd) + " has enough bans to pay " + str(total) + "banano\n")

    f = open("paid.txt", "a+")
    for index, row in data.iterrows():
        print(row[0]) # address
        if Validations.get_banano_address(row[0]) is not None:
            print("IT'S AN ADDRESS")
            print("Sending " + str(row[1]) + "ban to " + row[0] + " - " + str(index+1) + "/" + str(len(data)))
            block = await send_payment(walletID, paymentadd, row[0], row[1])
            f.write(row[0] + " - " + str(row[1]) + "\n Block: " + block + "\n")

        else:
            print("nonvalid")
    f.close()


    await destroy_wallet(walletID)
Ejemplo n.º 4
0
async def send_funds(walletID, source):
    valid_addresses = []
    async with aiofiles.open("addresses.txt") as file:
        async for line in file:
            if Validations.get_banano_address(line) is not None:
                account = Validations.get_banano_address(line)
                if Validations.validate_address(account) is True:
                    valid_addresses.append(account)
                else:
                    print(account + " is not a valid account")
            else:
                print(account + " does not fit the form of an address")
    num_addresses = len(valid_addresses)
    sourcebal = await get_balance(source)
    sourcebal = int(sourcebal) / 10**29
    remainder = sourcebal % num_addresses
    banperacc = (sourcebal - remainder) / num_addresses
    print("Sending " + str(banperacc) + "ban to " + str(num_addresses) +
          " accounts!")
    for account in valid_addresses:
        account = account.strip()
        print("Sending " + str(banperacc) + "ban to " + account)
        await send_payment(walletID, source, account,
                           str(int(banperacc) * 10**29))