本文整理汇总了Python中electrum.wallet.Wallet.send_tx方法的典型用法代码示例。如果您正苦于以下问题:Python Wallet.send_tx方法的具体用法?Python Wallet.send_tx怎么用?Python Wallet.send_tx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类electrum.wallet.Wallet
的用法示例。
在下文中一共展示了Wallet.send_tx方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from electrum.wallet import Wallet [as 别名]
# 或者: from electrum.wallet.Wallet import send_tx [as 别名]
#.........这里部分代码省略.........
+ self.str_fee
+ ", desc: "
+ self.str_description
)
def enter_order(self):
self.str_recipient = raw_input("Pay to: ")
self.str_description = raw_input("Description : ")
self.str_amount = raw_input("Amount: ")
self.str_fee = raw_input("Fee: ")
def send_order(self):
self.do_send()
def print_banner(self):
for i, x in enumerate(self.wallet.network.banner.split("\n")):
print (x)
def print_list(self, list, firstline):
self.maxpos = len(list)
if not self.maxpos:
return
print (firstline)
for i in range(self.maxpos):
msg = list[i] if i < len(list) else ""
print (msg)
def main(self):
while self.done == 0:
self.main_command()
def do_send(self):
if not is_valid(self.str_recipient):
print (_("Invalid Bitcoin address"))
return
try:
amount = int(Decimal(self.str_amount) * COIN)
except Exception:
print (_("Invalid Amount"))
return
try:
fee = int(Decimal(self.str_fee) * COIN)
except Exception:
print (_("Invalid Fee"))
return
if self.wallet.use_encryption:
password = self.password_dialog()
if not password:
return
else:
password = None
c = ""
while c != "y":
c = raw_input("ok to send (y/n)?")
if c == "n":
return
try:
tx = self.wallet.mktx([(TYPE_ADDRESS, self.str_recipient, amount)], password, self.config, fee)
except Exception as e:
print (str(e))
return
if self.str_description:
self.wallet.labels[tx.hash()] = self.str_description
h = self.wallet.send_tx(tx)
print (_("Please wait..."))
self.wallet.tx_event.wait()
status, msg = self.wallet.receive_tx(h, tx)
if status:
print (_("Payment sent."))
# self.do_clear()
# self.update_contacts_tab()
else:
print (_("Error"))
def network_dialog(self):
print ("use 'electrum setconfig server/proxy' to change your network settings")
return True
def settings_dialog(self):
print ("use 'electrum setconfig' to change your settings")
return True
def password_dialog(self):
return getpass.getpass()
# XXX unused
def run_receive_tab(self, c):
# if c == 10:
# out = self.run_popup('Address', ["Edit label", "Freeze", "Prioritize"])
return
def run_contacts_tab(self, c):
pass