main.py 文件源码

python
阅读 16 收藏 0 点赞 0 评论 0

项目:CTPrivAPI 作者: doubleelforbes 项目源码 文件源码
def withdraw():
    global privapi
    currency = simpledialog.askstring("Currency Required", "Please provide the currency to withdraw(eg. 'DOT' or '2')")
    if currency == "" or not currency:
        debugout("ERROR! - Cannot withdraw without a currency.")
    else:
        currency = currency.upper()
        address = simpledialog.askstring("Withdrawal Address Required", "Please provide the address to withdraw the " +
                                         currency + " to")
        if address == "" or not address:
            debugout("ERROR! - Withdrawal Address not provided.")
        else:
            amount = simpledialog.askfloat("Amount Required", "Please provide an amount of " + currency +
                                           " to send to: " + address)
            if not amount:
                debugout("ERROR! - Cannot Withdraw without an amount.")
            else:
                amount = "{0:.8f}".format(amount)
                payidreq = messagebox.askyesno("PaymentID for CryptoNote currencies",
                                               "Would you like to provide a Payment ID?\r\n" +
                                               "Only required for CryptoNote.")
                if payidreq:
                    payid = simpledialog.askstring("PaymentID Entry",
                                                   "You have requested Payment ID Entry please provide it.")
                    if payid == "" or not payid:
                        debugout("ERROR! - User requested a Payment ID but failed to provide it.")
                    else:
                        debugout(amount + " " + currency + " withdrawal requested to: " + address + " with PaymentID: "
                                 + payid)
                        response = privapi.submitwithdraw(currency, address, amount, payid)
                        if isinstance(response, str):
                            debugout("Withdrawal submitted under ID: " + response)
                        else:
                            debugout(str(response) + " is a " + str(type(response)))
                        gettransactions()
                else:
                    debugout(amount + " " + currency + " withdrawal requested to: " + address)
                    response = privapi.submitwithdraw(currency, address, amount)
                    # API returns an int ID for the transaction
                    debugout("Withdrawal submitted under ID: " + str(response))
                    gettransactions()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号