本文整理汇总了Python中wallet.Wallet类的典型用法代码示例。如果您正苦于以下问题:Python Wallet类的具体用法?Python Wallet怎么用?Python Wallet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Wallet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: restore_multisig_wallet
def restore_multisig_wallet(self, storage, wallet_type):
# FIXME: better handling of duplicate keys
m, n = Wallet.multisig_type(wallet_type)
key_list = self.request_many(n - 1)
need_password = any(Wallet.should_encrypt(text) for text in key_list)
password = self.request_password() if need_password else None
return Wallet.from_multisig(key_list, password, storage, wallet_type)
开发者ID:santiagorp,项目名称:electrum,代码行数:7,代码来源:wizard.py
示例2: load_wallet
def load_wallet(self, config):
path = config.get_wallet_path()
if path in self.wallets:
wallet = self.wallets[path]
else:
storage = WalletStorage(path)
wallet = Wallet(storage)
wallet.start_threads(self.network)
self.wallets[path] = wallet
return wallet
开发者ID:ttytyper,项目名称:electrum,代码行数:10,代码来源:daemon.py
示例3: register_plugin_wallet
def register_plugin_wallet(self, name, gui_good, details):
from wallet import Wallet
def dynamic_constructor(storage):
return self.wallet_plugin_loader(name).wallet_class(storage)
if details[0] == 'hardware':
self.hw_wallets[name] = (gui_good, details)
self.print_error("registering wallet %s: %s" %(name, details))
Wallet.register_plugin_wallet(details[0], details[1],
dynamic_constructor)
开发者ID:santiagorp,项目名称:electrum,代码行数:11,代码来源:plugins.py
示例4: verify_transaction
def verify_transaction(transaction, get_balance, check_funds=True):
"""Verify a transaction by checking whether the sender has sufficient coins.
Arguments:
:transaction: The transaction that should be verified.
"""
if check_funds:
sender_balance = get_balance(transaction.sender)
return sender_balance >= transaction.amount and Wallet.verify_transaction(transaction)
else:
return Wallet.verify_transaction(transaction)
开发者ID:HariKumarValluru,项目名称:Blockchain,代码行数:11,代码来源:verification.py
示例5: load_wallet
def load_wallet(self, path, wizard=None):
if path in self.wallets:
wallet = self.wallets[path]
else:
if wizard:
wallet = wizard.open_wallet(self.network, path)
else:
storage = WalletStorage(path)
wallet = Wallet(storage)
wallet.start_threads(self.network)
if wallet:
self.wallets[path] = wallet
return wallet
开发者ID:Kefkius,项目名称:electrum,代码行数:13,代码来源:daemon.py
示例6: load_wallet
def load_wallet(self, path):
if path in self.wallets:
wallet = self.wallets[path]
return wallet
storage = WalletStorage(path)
if not storage.file_exists:
return
wallet = Wallet(storage)
action = wallet.get_action()
if action:
return
wallet.start_threads(self.network)
self.wallets[path] = wallet
return wallet
开发者ID:Marcdnd,项目名称:electrum-cesc,代码行数:14,代码来源:daemon.py
示例7: load_wallet
def load_wallet(self, path):
# wizard will be launched if we return
if path in self.wallets:
wallet = self.wallets[path]
return wallet
storage = WalletStorage(path)
if not storage.file_exists:
return
if storage.requires_split() or storage.requires_upgrade() or storage.get_action():
return
wallet = Wallet(storage)
wallet.start_threads(self.network)
self.wallets[path] = wallet
return wallet
开发者ID:opendime,项目名称:electrum,代码行数:14,代码来源:daemon.py
示例8: __init__
def __init__(self,):
QObject.__init__(self,)
self.thread = None
self._balance = '<b>0.00</b>000000'
self._fiatSymbol = u'€'
self._fiatRate = 0
self._fiatBalance = u'0 €'
self._wallet = Wallet()
self._wallet.onNewTransaction.connect(self.notifyNewTx)
self._walletUnlocked = False
self.settings = Settings()
self.addressesModel = AddressesModel()
self.transactionsModel = TransactionsModel()
self.timer = QTimer(self)
self.timer.setInterval(900000) # 15 min update
self.timer.timeout.connect(self.update)
self.timer.start()
if self.settings.storePassKey:
self._currentPassKey = self.settings.passKey
try:
self.unlockWallet(self._currentPassKey)
except:
self.onError.emit('Stored pass phrase is invalid')
else:
self._currentPassKey = None
self._currentAddressIndex = 0
开发者ID:donSchoe,项目名称:BitPurse,代码行数:27,代码来源:walletcontroller.py
示例9: create_or_restore
def create_or_restore(self, storage):
'''After querying the user what they wish to do, create or restore
a wallet and return it.'''
self.remove_from_recently_open(storage.path)
# Filter out any unregistered wallet kinds
registered_kinds = Wallet.categories()
kinds, descriptions = zip(*[pair for pair in WizardBase.wallet_kinds
if pair[0] in registered_kinds])
action, kind_index = self.query_create_or_restore(descriptions)
assert action in WizardBase.user_actions
kind = kinds[kind_index]
if kind == 'multisig':
wallet_type = self.query_multisig(action)
elif kind == 'hardware':
# The create/restore distinction is not obvious for hardware
# wallets; so we ask for the action again and default based
# on the prior choice :)
hw_wallet_types, choices = self.plugins.hardware_wallets(action)
msg = _('Select the type of hardware wallet: ')
action, choice = self.query_hw_wallet_choice(msg, action, choices)
wallet_type = hw_wallet_types[choice]
elif kind == 'twofactor':
wallet_type = '2fa'
else:
wallet_type = 'standard'
if action == 'create':
wallet = self.create_wallet(storage, wallet_type, kind)
else:
wallet = self.restore_wallet(storage, wallet_type, kind)
return action, wallet
开发者ID:santiagorp,项目名称:electrum,代码行数:35,代码来源:wizard.py
示例10: add_cosigners
def add_cosigners(self, wallet):
# FIXME: better handling of duplicate keys
m, n = Wallet.multisig_type(wallet.wallet_type)
xpub1 = wallet.master_public_keys.get("x1/")
xpubs = self.request_many(n - 1, xpub1)
for i, xpub in enumerate(xpubs):
wallet.add_master_public_key("x%d/" % (i + 2), xpub)
开发者ID:santiagorp,项目名称:electrum,代码行数:7,代码来源:wizard.py
示例11: run
def run(self, network, storage):
'''The main entry point of the wizard. Open a wallet from the given
filename. If the file doesn't exist launch the GUI-specific
install wizard proper, created by calling create_wizard().'''
need_sync = False
is_restore = False
if storage.file_exists:
wallet = Wallet(storage)
if wallet.imported_keys:
self.update_wallet_format(wallet)
else:
cr, wallet = self.create_or_restore(storage)
if not wallet:
return
need_sync = True
is_restore = (cr == 'restore')
while True:
action = wallet.get_action()
if not action:
break
need_sync = True
self.run_wallet_action(wallet, action)
# Save the wallet after each action
wallet.storage.write()
if network:
# Show network dialog if config does not exist
if self.config.get('auto_connect') is None:
self.choose_server(network)
else:
self.show_warning(_('You are offline'))
if need_sync:
self.create_addresses(wallet)
# start wallet threads
if network:
wallet.start_threads(network)
if is_restore:
self.show_restore(wallet, network)
self.finished()
return wallet
开发者ID:santiagorp,项目名称:electrum,代码行数:47,代码来源:wizard.py
示例12: main
def main():
try:
wallet_id = sys.argv[1]
sample_wallet = None
try:
sample_wallet = Wallet(wallet_label=wallet_id,
iterate_until_send=True)
except http.WalletNotFoundError:
print "Couldn't find that wallet."
sys.exit()
for utxos in sample_wallet:
print "UTXOs: %s" % str(utxos)
print("Desired Spend (in satoshis): %d" %
sample_wallet.get_current_desired_spend())
except Exception as err:
print "Error: %s" % str(err)
print "Usage: print.py 3562f0c16b41b2f9"
开发者ID:kristovatlas,项目名称:wallet-simulator,代码行数:18,代码来源:print.py
示例13: load_wallet
def load_wallet(self, path, get_wizard=None):
if path in self.wallets:
wallet = self.wallets[path]
else:
storage = WalletStorage(path)
if storage.file_exists:
wallet = Wallet(storage)
action = wallet.get_action()
else:
action = 'new'
if action:
if get_wizard is None:
return None
wizard = get_wizard()
wallet = wizard.run(self.network, storage)
else:
wallet.start_threads(self.network)
if wallet:
self.wallets[path] = wallet
return wallet
开发者ID:FairCoinTeam,项目名称:electrum-fair,代码行数:20,代码来源:daemon.py
示例14: open_wallet
def open_wallet(self, network, filename):
'''The main entry point of the wizard. Open a wallet from the given
filename. If the file doesn't exist launch the GUI-specific
install wizard proper.'''
storage = WalletStorage(filename)
if storage.file_exists:
wallet = Wallet(storage)
self.update_wallet_format(wallet)
task = None
else:
cr, wallet = self.create_or_restore(storage)
if not wallet:
return
task = lambda: self.show_restore(wallet, network, cr)
need_sync = False
while True:
action = wallet.get_action()
if not action:
break
need_sync = True
self.run_wallet_action(wallet, action)
# Save the wallet after each action
wallet.storage.write()
if network:
self.choose_server(network)
else:
self.show_warning(_('You are offline'))
if need_sync:
self.create_addresses(wallet)
# start wallet threads
if network:
wallet.start_threads(network)
if task:
task()
return wallet
开发者ID:MarcoPon,项目名称:electrum,代码行数:41,代码来源:wizard.py
示例15: __init__
class Cashier:
_exchanges = exchanges.actived_exchanges
def __init__(self):
self.wallet = Wallet()
self.qty_per_order = config.configuration['qty_per_order']
def post_transfers(self, buy_account, sell_account):
'''交易完成以后的比特币转账
流程:
1. 检查钱包是否有足够余额
2.1 有余额则先发送比特币给卖方
2. 买方转移比特币到钱包
'''
buy_ex = Trader._exchanges[buy_account.name]
sell_ex = Trader._exchanges[sell_account.name]
wallet_balance = self.wallet.balance()
if wallet_balance > self.qty_per_order:
self.wallet.withdraw(sell_account.stock_deposit_address, self.qty_per_order)
buy_ex.withdraw_stock(self.qty_per_order)
def make_balance(self, accounts):
wallet_balance = self.wallet.balance()
for a in accounts:
if a.stock_balance < self.qty_per_order and wallet_balance > self.qty_per_order:
_logger.info('[CASHIER]\t\t Transfering BTC from wallet to account "{0}", qty={1}'
.format(a.name, self.qty_per_order))
self.wallet.withdraw(a.stock_deposit_address, self.qty_per_order)
wallet_balance -= self.qty_per_order
开发者ID:LaiYongqiang,项目名称:brickmover,代码行数:29,代码来源:main.py
示例16: verify_transaction
def verify_transaction(transaction, get_balance, check_funds=True):
"""Verify sender has sufficient balance to allow transaction to be processed"""
if check_funds:
sender_balance = get_balance(transaction.sender)
if sender_balance < transaction.amount:
print('Transaction amount {} exceeds balance {}'.format(transaction.amount,
sender_balance))
print('Insufficient balance!')
return False
if not Wallet.verify_transaction(transaction):
print('Bad signature => %s' % transaction.signature)
print('Signature verification failed!')
return False
return True
开发者ID:almacro,项目名称:snippets,代码行数:14,代码来源:verification.py
示例17: load_wallet
def load_wallet(self, path, password):
# wizard will be launched if we return
if path in self.wallets:
wallet = self.wallets[path]
return wallet
storage = WalletStorage(path)
if not storage.file_exists():
return
if storage.is_encrypted():
if not password:
return
storage.decrypt(password)
if storage.requires_split():
return
if storage.requires_upgrade():
self.print_error('upgrading wallet format')
storage.upgrade()
if storage.get_action():
return
wallet = Wallet(storage)
wallet.start_threads(self.network)
self.wallets[path] = wallet
return wallet
开发者ID:Matoking,项目名称:electrum,代码行数:23,代码来源:daemon.py
示例18: new
def new(self):
name = os.path.basename(self.storage.path)
title = _("Welcome to the Electrum installation wizard.")
message = '\n'.join([
_("The wallet '%s' does not exist.") % name,
_("What kind of wallet do you want to create?")
])
wallet_kinds = [
('standard', _("Standard wallet")),
('twofactor', _("Wallet with two-factor authentication")),
('multisig', _("Multi-signature wallet")),
]
registered_kinds = Wallet.categories()
choices = wallet_kinds#[pair for pair in wallet_kinds if pair[0] in registered_kinds]
self.choice_dialog(title=title, message=message, choices=choices, run_next=self.on_wallet_type)
开发者ID:opendime,项目名称:electrum,代码行数:15,代码来源:base_wizard.py
示例19: Application
class Application(QtGui.QApplication):
STATUS_REPLENISH = 0
STATUS_CONFIRMATION = 1
STATUS_WORK = 2
statusChanged = QtCore.pyqtSignal(int, int, name='changeStatus')
def __init__(self, args):
QtGui.QApplication.__init__(self, [])
self.isTestNet = args['testnet']
self.dataDir = args['datadir']
self._status = None
def _install_i18n(self):
import __builtin__
__builtin__.__dict__["_"] = lambda x: x
def exec_(self):
self._install_i18n()
from wallet import Wallet
self.wallet = Wallet(self.dataDir, self.isTestNet)
self.wallet.balanceUpdated.connect(self._check_status)
from mainwindow import MainWindow
self.mainWindow = MainWindow()
self.mainWindow.show()
self.wallet.sync_start()
QtCore.QTimer.singleShot(0, self._check_status)
retval = super(QtGui.QApplication, self).exec_()
self.mainWindow.chatpage.sync_stop()
self.wallet.sync_stop()
return retval
def _check_status(self):
moniker = clubAsset['monikers'][0]
available_balance = self.wallet.get_available_balance(moniker)
unconfirmed_balance = self.wallet.get_unconfirmed_balance(moniker)
if available_balance > 0:
self._set_new_status(self.STATUS_WORK)
else:
if unconfirmed_balance > 0:
self._set_new_status(self.STATUS_CONFIRMATION)
else:
self._set_new_status(self.STATUS_REPLENISH)
def _set_new_status(self, status):
if self._status == status:
return
oldStatus = self._status
self._status = status
self.statusChanged.emit(oldStatus, status)
开发者ID:fanatid,项目名称:chromaclub,代码行数:54,代码来源:application.py
示例20: exec_
def exec_(self):
self._install_i18n()
from wallet import Wallet
self.wallet = Wallet(self.dataDir, self.isTestNet)
self.wallet.balanceUpdated.connect(self._check_status)
from mainwindow import MainWindow
self.mainWindow = MainWindow()
self.mainWindow.show()
self.wallet.sync_start()
QtCore.QTimer.singleShot(0, self._check_status)
retval = super(QtGui.QApplication, self).exec_()
self.mainWindow.chatpage.sync_stop()
self.wallet.sync_stop()
return retval
开发者ID:fanatid,项目名称:chromaclub,代码行数:17,代码来源:application.py
注:本文中的wallet.Wallet类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论