本文整理汇总了Python中wallet.Wallet.save方法的典型用法代码示例。如果您正苦于以下问题:Python Wallet.save方法的具体用法?Python Wallet.save怎么用?Python Wallet.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wallet.Wallet
的用法示例。
在下文中一共展示了Wallet.save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from wallet import Wallet [as 别名]
# 或者: from wallet.Wallet import save [as 别名]
#.........这里部分代码省略.........
buff = DisplayBuffer(DISPLAY_WIDTH, DISPLAY_HEIGHT)
display = Display(buff, spi=args.shield, virtual=not args.shield)
display.init()
# Initialize layout driver
layout = Layout(buff)
# Startup state machine and switch it to default state
machine = StateMachine(wallet, layout)
#tx1 = proto.TxOutput(address='1BRMLAB7nryYgFGrG8x9SYaokb8r2ZwAsX', amount=112000000)
#tx2 = proto.TxOutput(address='1MarekMKDKRb6PEeHeVuiCGayk9avyBGBB', amount=12340123400)
#layout.show_transactions([tx1, tx2 ], False)
display.refresh()
# Main cycle
while True:
#d=datetime.now()
#layout.show_message([d.strftime("%d %B %Y %H:%M:%S")],question=False)
# Set True if device does something
# False = device will sleep for a moment
is_active = False
try:
# Read button states
button = but.read()
except KeyboardInterrupt:
# User requested to close the app
break
# Handle debug link connection
msg = debug_transport.read()
if msg is not None:
print "Received debuglink", msg.__class__.__name__, msg
if isinstance(msg, proto.DebugLinkDecision):
# Press the button
button = msg.yes_no
else:
resp = machine.process_message(msg)
if resp is not None:
print "Sending debuglink", resp.__class__.__name__, resp
debug_transport.write(resp)
is_active = True
'''
elif isinstance(msg, proto.DebugLinkGetState):
# Report device state
resp = machine.get_state(msg)
print "Sending debuglink", resp.__class__.__name__, resp
debug_transport.write(resp)
else:
raise Exception("Got unexpected object %s" % msg.__class__.__name__)
'''
if button is not None:
print "Button", button
is_active = True
resp = machine.press_button(button)
if resp is not None:
print "Sending", resp
transport.write(resp)
'''
if button == True:
layout.show_transactions([tx1, tx2 ], False)
layout.show_question_dummy()
if button == False:
layout.show_logo(logo)
'''
# Handle main connection
msg = transport.read()
if msg is not None:
print "Received", msg.__class__.__name__, msg
resp = machine.process_message(msg)
if resp is not None:
print "Sending", resp.__class__.__name__, resp
transport.write(resp)
is_active = True
# Display scrolling
is_active |= layout.update()
if layout.need_refresh:
# Update display
display.refresh()
if not is_active:
# Nothing to do, sleep for a moment
time.sleep(0.1)
# Save wallet file
wallet.save()
# Close transports
transport.close()
debug_transport.close()
示例2: Wallet
# 需要导入模块: from wallet import Wallet [as 别名]
# 或者: from wallet.Wallet import save [as 别名]
from block import StartBlock
from output import Output
from transaction import StartTransaction
from wallet import Wallet
start_wallet = Wallet()
start_wallet.save("private.pem", "public.pem")
start_output = Output(100, start_wallet.public_key)
start_transaction = StartTransaction(outputs=[start_output])
start_block = StartBlock(transactions=[start_transaction])