Bitcoin->Zclassic BTC->ZCL in ui

This commit is contained in:
Jon Layton 2018-01-14 23:43:33 -05:00
parent 1dad9e8893
commit 9eb67a6394
13 changed files with 45 additions and 45 deletions

View File

@ -154,7 +154,7 @@ class ElectrumWindow(App):
self._trigger_update_history() self._trigger_update_history()
def _get_bu(self): def _get_bu(self):
return self.electrum_config.get('base_unit', 'mBTC') return self.electrum_config.get('base_unit', 'mZCL')
def _set_bu(self, value): def _set_bu(self, value):
assert value in base_units.keys() assert value in base_units.keys()

View File

@ -46,13 +46,13 @@ Builder.load_string('''
SettingsItem: SettingsItem:
bu: app.base_unit bu: app.base_unit
title: _('Denomination') + ': ' + self.bu title: _('Denomination') + ': ' + self.bu
description: _("Base unit for Bitcoin amounts.") description: _("Base unit for Zclassic amounts.")
action: partial(root.unit_dialog, self) action: partial(root.unit_dialog, self)
CardSeparator CardSeparator
SettingsItem: SettingsItem:
status: root.fee_status() status: root.fee_status()
title: _('Fees') + ': ' + self.status title: _('Fees') + ': ' + self.status
description: _("Fees paid to the Bitcoin miners.") description: _("Fees paid to the Zclassic miners.")
action: partial(root.fee_dialog, self) action: partial(root.fee_dialog, self)
CardSeparator CardSeparator
SettingsItem: SettingsItem:

View File

@ -180,7 +180,7 @@ class SendScreen(CScreen):
try: try:
uri = electrum.util.parse_URI(text, self.app.on_pr) uri = electrum.util.parse_URI(text, self.app.on_pr)
except: except:
self.app.show_info(_("Not a Bitcoin URI")) self.app.show_info(_("Not a Zclassic URI"))
return return
amount = uri.get('amount') amount = uri.get('amount')
self.screen.address = uri.get('address', '') self.screen.address = uri.get('address', '')
@ -250,10 +250,10 @@ class SendScreen(CScreen):
else: else:
address = str(self.screen.address) address = str(self.screen.address)
if not address: if not address:
self.app.show_error(_('Recipient not specified.') + ' ' + _('Please scan a Bitcoin address or a payment request')) self.app.show_error(_('Recipient not specified.') + ' ' + _('Please scan a Zclassic address or a payment request'))
return return
if not bitcoin.is_address(address): if not bitcoin.is_address(address):
self.app.show_error(_('Invalid Bitcoin Address') + ':\n' + address) self.app.show_error(_('Invalid Zclassic Address') + ':\n' + address)
return return
try: try:
amount = self.app.get_amount(self.screen.amount) amount = self.app.get_amount(self.screen.amount)
@ -370,7 +370,7 @@ class ReceiveScreen(CScreen):
def do_share(self): def do_share(self):
uri = self.get_URI() uri = self.get_URI()
self.app.do_share(uri, _("Share Bitcoin Request")) self.app.do_share(uri, _("Share Zclassic Request"))
def do_copy(self): def do_copy(self):
uri = self.get_URI() uri = self.get_URI()

View File

@ -68,7 +68,7 @@ ReceiveScreen:
pos_hint: {'center_y': .5} pos_hint: {'center_y': .5}
BlueButton: BlueButton:
id: address_label id: address_label
text: s.address if s.address else _('Bitcoin Address') text: s.address if s.address else _('Zclassic Address')
shorten: True shorten: True
disabled: True disabled: True
CardSeparator: CardSeparator:

View File

@ -82,9 +82,9 @@ class BTCAmountEdit(AmountEdit):
def _base_unit(self): def _base_unit(self):
p = self.decimal_point() p = self.decimal_point()
if p == 8: if p == 8:
return 'BTC' return 'ZCL'
if p == 5: if p == 5:
return 'mBTC' return 'mZCL'
if p == 2: if p == 2:
return 'bits' return 'bits'
raise Exception('Unknown base unit') raise Exception('Unknown base unit')
@ -108,7 +108,7 @@ class FeerateEdit(BTCAmountEdit):
def _base_unit(self): def _base_unit(self):
p = self.decimal_point() p = self.decimal_point()
if p == 2: if p == 2:
return 'mBTC/kB' return 'mZCL/kB'
if p == 0: if p == 0:
return 'sat/byte' return 'sat/byte'
raise Exception('Unknown base unit') raise Exception('Unknown base unit')

View File

@ -24,7 +24,7 @@ class GoBack(Exception):
MSG_GENERATING_WAIT = _("Electrum is generating your addresses, please wait...") MSG_GENERATING_WAIT = _("Electrum is generating your addresses, please wait...")
MSG_ENTER_ANYTHING = _("Please enter a seed phrase, a master key, a list of " MSG_ENTER_ANYTHING = _("Please enter a seed phrase, a master key, a list of "
"Bitcoin addresses, or a list of private keys") "Zclassic addresses, or a list of private keys")
MSG_ENTER_SEED_OR_MPK = _("Please enter a seed phrase or a master key (xpub or xprv):") MSG_ENTER_SEED_OR_MPK = _("Please enter a seed phrase or a master key (xpub or xprv):")
MSG_COSIGNER = _("Please enter the master public key of cosigner #%d:") MSG_COSIGNER = _("Please enter the master public key of cosigner #%d:")
MSG_ENTER_PASSWORD = _("Choose a password to encrypt your wallet keys.") + '\n'\ MSG_ENTER_PASSWORD = _("Choose a password to encrypt your wallet keys.") + '\n'\

View File

@ -381,8 +381,8 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
if self.wallet.is_watching_only(): if self.wallet.is_watching_only():
msg = ' '.join([ msg = ' '.join([
_("This wallet is watching-only."), _("This wallet is watching-only."),
_("This means you will not be able to spend Bitcoins with it."), _("This means you will not be able to spend Zclassic with it."),
_("Make sure you own the seed phrase or the private keys, before you request Bitcoins to be sent to this wallet.") _("Make sure you own the seed phrase or the private keys, before you request Zclassic to be sent to this wallet.")
]) ])
self.show_warning(msg, title=_('Information')) self.show_warning(msg, title=_('Information'))
@ -536,7 +536,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
def show_about(self): def show_about(self):
QMessageBox.about(self, "Electrum", QMessageBox.about(self, "Electrum",
_("Version")+" %s" % (self.wallet.electrum_version) + "\n\n" + _("Version")+" %s" % (self.wallet.electrum_version) + "\n\n" +
_("Electrum's focus is speed, with low resource usage and simplifying Bitcoin. You do not need to perform regular backups, because your wallet can be recovered from a secret phrase that you can memorize or write on paper. Startup times are instant because it operates in conjunction with high-performance servers that handle the most complicated parts of the Bitcoin system." + "\n\n" + _("Electrum's focus is speed, with low resource usage and simplifying Zclassic. You do not need to perform regular backups, because your wallet can be recovered from a secret phrase that you can memorize or write on paper. Startup times are instant because it operates in conjunction with high-performance servers that handle the most complicated parts of the Zclassic system." + "\n\n" +
_("Uses icons from the Icons8 icon pack (icons8.com)."))) _("Uses icons from the Icons8 icon pack (icons8.com).")))
def show_report_bug(self): def show_report_bug(self):
@ -638,9 +638,9 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
if self.decimal_point == 2: if self.decimal_point == 2:
return 'bits' return 'bits'
if self.decimal_point == 5: if self.decimal_point == 5:
return 'mBTC' return 'mZCL'
if self.decimal_point == 8: if self.decimal_point == 8:
return 'BTC' return 'ZCL'
raise Exception('Unknown base unit') raise Exception('Unknown base unit')
def connect_fields(self, window, btc_e, fiat_e, fee_e): def connect_fields(self, window, btc_e, fiat_e, fee_e):
@ -764,7 +764,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
self.receive_address_e = ButtonsLineEdit() self.receive_address_e = ButtonsLineEdit()
self.receive_address_e.addCopyButton(self.app) self.receive_address_e.addCopyButton(self.app)
self.receive_address_e.setReadOnly(True) self.receive_address_e.setReadOnly(True)
msg = _('Bitcoin address where the payment should be received. Note that each payment request uses a different Bitcoin address.') msg = _('Zclassic address where the payment should be received. Note that each payment request uses a different Zclassic address.')
self.receive_address_label = HelpLabel(_('Receiving address'), msg) self.receive_address_label = HelpLabel(_('Receiving address'), msg)
self.receive_address_e.textChanged.connect(self.update_receive_qr) self.receive_address_e.textChanged.connect(self.update_receive_qr)
self.receive_address_e.setFocusPolicy(Qt.NoFocus) self.receive_address_e.setFocusPolicy(Qt.NoFocus)
@ -794,7 +794,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
msg = ' '.join([ msg = ' '.join([
_('Expiration date of your request.'), _('Expiration date of your request.'),
_('This information is seen by the recipient if you send them a signed payment request.'), _('This information is seen by the recipient if you send them a signed payment request.'),
_('Expired requests have to be deleted manually from your list, in order to free the corresponding Bitcoin addresses.'), _('Expired requests have to be deleted manually from your list, in order to free the corresponding Zclassic addresses.'),
_('The bitcoin address never expires and will always be part of this electrum wallet.'), _('The bitcoin address never expires and will always be part of this electrum wallet.'),
]) ])
grid.addWidget(HelpLabel(_('Request expires'), msg), 3, 0) grid.addWidget(HelpLabel(_('Request expires'), msg), 3, 0)
@ -1010,7 +1010,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
self.amount_e = BTCAmountEdit(self.get_decimal_point) self.amount_e = BTCAmountEdit(self.get_decimal_point)
self.payto_e = PayToEdit(self) self.payto_e = PayToEdit(self)
msg = _('Recipient of the funds.') + '\n\n'\ msg = _('Recipient of the funds.') + '\n\n'\
+ _('You may enter a Bitcoin address, a label from your list of contacts (a list of completions will be proposed), or an alias (email-like address that forwards to a Bitcoin address)') + _('You may enter a Zclassic address, a label from your list of contacts (a list of completions will be proposed), or an alias (email-like address that forwards to a Zclassic address)')
payto_label = HelpLabel(_('Pay to'), msg) payto_label = HelpLabel(_('Pay to'), msg)
grid.addWidget(payto_label, 1, 0) grid.addWidget(payto_label, 1, 0)
grid.addWidget(self.payto_e, 1, 1, 1, -1) grid.addWidget(self.payto_e, 1, 1, 1, -1)
@ -1057,7 +1057,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
hbox.addStretch(1) hbox.addStretch(1)
grid.addLayout(hbox, 4, 4) grid.addLayout(hbox, 4, 4)
msg = _('Bitcoin transactions are in general not free. A transaction fee is paid by the sender of the funds.') + '\n\n'\ msg = _('Zclassic transactions are in general not free. A transaction fee is paid by the sender of the funds.') + '\n\n'\
+ _('The amount of fee can be decided freely by the sender. However, transactions with low fees take more time to be processed.') + '\n\n'\ + _('The amount of fee can be decided freely by the sender. However, transactions with low fees take more time to be processed.') + '\n\n'\
+ _('A suggested fee is automatically added to this field. You may override it. The suggested fee increases with the size of the transaction.') + _('A suggested fee is automatically added to this field. You may override it. The suggested fee increases with the size of the transaction.')
self.fee_e_label = HelpLabel(_('Fee'), msg) self.fee_e_label = HelpLabel(_('Fee'), msg)
@ -1389,10 +1389,10 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
for _type, addr, amount in outputs: for _type, addr, amount in outputs:
if addr is None: if addr is None:
self.show_error(_('Bitcoin Address is None')) self.show_error(_('Zclassic Address is None'))
return return
if _type == TYPE_ADDRESS and not bitcoin.is_address(addr): if _type == TYPE_ADDRESS and not bitcoin.is_address(addr):
self.show_error(_('Invalid Bitcoin Address')) self.show_error(_('Invalid Zclassic Address'))
return return
if amount is None: if amount is None:
self.show_error(_('Invalid Amount')) self.show_error(_('Invalid Amount'))
@ -2028,7 +2028,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
address = address.text().strip() address = address.text().strip()
message = message.toPlainText().strip() message = message.toPlainText().strip()
if not bitcoin.is_address(address): if not bitcoin.is_address(address):
self.show_message(_('Invalid Bitcoin address.')) self.show_message(_('Invalid Zclassic address.'))
return return
if not self.wallet.is_mine(address): if not self.wallet.is_mine(address):
self.show_message(_('Address not in wallet.')) self.show_message(_('Address not in wallet.'))
@ -2048,7 +2048,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
address = address.text().strip() address = address.text().strip()
message = message.toPlainText().strip().encode('utf-8') message = message.toPlainText().strip().encode('utf-8')
if not bitcoin.is_address(address): if not bitcoin.is_address(address):
self.show_message(_('Invalid Bitcoin address.')) self.show_message(_('Invalid Zclassic address.'))
return return
try: try:
# This can throw on invalid base64 # This can throw on invalid base64
@ -2616,7 +2616,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
self.fee_unit = self.config.get('fee_unit', 0) self.fee_unit = self.config.get('fee_unit', 0)
fee_unit_label = HelpLabel(_('Fee Unit') + ':', '') fee_unit_label = HelpLabel(_('Fee Unit') + ':', '')
fee_unit_combo = QComboBox() fee_unit_combo = QComboBox()
fee_unit_combo.addItems([_('sat/byte'), _('mBTC/kB')]) fee_unit_combo.addItems([_('sat/byte'), _('mZCL/kB')])
fee_unit_combo.setCurrentIndex(self.fee_unit) fee_unit_combo.setCurrentIndex(self.fee_unit)
def on_fee_unit(x): def on_fee_unit(x):
self.fee_unit = x self.fee_unit = x
@ -2675,9 +2675,9 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
SSL_id_e.setReadOnly(True) SSL_id_e.setReadOnly(True)
id_widgets.append((SSL_id_label, SSL_id_e)) id_widgets.append((SSL_id_label, SSL_id_e))
units = ['BTC', 'mBTC', 'bits'] units = ['ZCL', 'mZCL', 'bits']
msg = _('Base unit of your wallet.')\ msg = _('Base unit of your wallet.')\
+ '\n1BTC=1000mBTC.\n' \ + '\n1ZCL=1000mZCL.\n' \
+ _(' These settings affects the fields in the Send tab')+' ' + _(' These settings affects the fields in the Send tab')+' '
unit_label = HelpLabel(_('Base unit') + ':', msg) unit_label = HelpLabel(_('Base unit') + ':', msg)
unit_combo = QComboBox() unit_combo = QComboBox()
@ -2689,9 +2689,9 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
return return
edits = self.amount_e, self.fee_e, self.receive_amount_e edits = self.amount_e, self.fee_e, self.receive_amount_e
amounts = [edit.get_amount() for edit in edits] amounts = [edit.get_amount() for edit in edits]
if unit_result == 'BTC': if unit_result == 'ZCL':
self.decimal_point = 8 self.decimal_point = 8
elif unit_result == 'mBTC': elif unit_result == 'mZCL':
self.decimal_point = 5 self.decimal_point = 5
elif unit_result == 'bits': elif unit_result == 'bits':
self.decimal_point = 2 self.decimal_point = 2

View File

@ -163,7 +163,7 @@ class ElectrumGui:
def do_send(self): def do_send(self):
if not is_address(self.str_recipient): if not is_address(self.str_recipient):
print(_('Invalid Bitcoin address')) print(_('Invalid Zclassic address'))
return return
try: try:
amount = int(Decimal(self.str_amount) * COIN) amount = int(Decimal(self.str_amount) * COIN)

View File

@ -320,7 +320,7 @@ class ElectrumGui:
def do_send(self): def do_send(self):
if not is_address(self.str_recipient): if not is_address(self.str_recipient):
self.show_message(_('Invalid Bitcoin address')) self.show_message(_('Invalid Zclassic address'))
return return
try: try:
amount = int(Decimal(self.str_amount) * COIN) amount = int(Decimal(self.str_amount) * COIN)

View File

@ -84,7 +84,7 @@ class BaseWizard(object):
('standard', _("Standard wallet")), ('standard', _("Standard wallet")),
('2fa', _("Wallet with two-factor authentication")), ('2fa', _("Wallet with two-factor authentication")),
('multisig', _("Multi-signature wallet")), ('multisig', _("Multi-signature wallet")),
('imported', _("Import Bitcoin addresses or private keys")), ('imported', _("Import Zclassic addresses or private keys")),
] ]
choices = [pair for pair in wallet_kinds if pair[0] in wallet_types] choices = [pair for pair in wallet_kinds if pair[0] in wallet_types]
self.choice_dialog(title=title, message=message, choices=choices, run_next=self.on_wallet_type) self.choice_dialog(title=title, message=message, choices=choices, run_next=self.on_wallet_type)
@ -141,8 +141,8 @@ class BaseWizard(object):
def import_addresses_or_keys(self): def import_addresses_or_keys(self):
v = lambda x: keystore.is_address_list(x) or keystore.is_private_key_list(x) v = lambda x: keystore.is_address_list(x) or keystore.is_private_key_list(x)
title = _("Import Bitcoin Addresses") title = _("Import Zclassic Addresses")
message = _("Enter a list of Bitcoin addresses (this will create a watching-only wallet), or a list of private keys.") message = _("Enter a list of Zclassic addresses (this will create a watching-only wallet), or a list of private keys.")
self.add_xpub_dialog(title=title, message=message, run_next=self.on_import, self.add_xpub_dialog(title=title, message=message, run_next=self.on_import,
is_valid=v, allow_multi=True) is_valid=v, allow_multi=True)

View File

@ -569,7 +569,7 @@ class Commands:
PR_PAID: 'Paid', PR_PAID: 'Paid',
PR_EXPIRED: 'Expired', PR_EXPIRED: 'Expired',
} }
out['amount (BTC)'] = format_satoshis(out.get('amount')) out['amount (ZCL)'] = format_satoshis(out.get('amount'))
out['status'] = pr_str[out.get('status', PR_UNKNOWN)] out['status'] = pr_str[out.get('status', PR_UNKNOWN)]
return out return out
@ -679,8 +679,8 @@ class Commands:
param_descriptions = { param_descriptions = {
'privkey': 'Private key. Type \'?\' to get a prompt.', 'privkey': 'Private key. Type \'?\' to get a prompt.',
'destination': 'Bitcoin address, contact or alias', 'destination': 'Zclassic address, contact or alias',
'address': 'Bitcoin address', 'address': 'Zclassic address',
'seed': 'Seed phrase', 'seed': 'Seed phrase',
'txid': 'Transaction ID', 'txid': 'Transaction ID',
'pos': 'Position', 'pos': 'Position',
@ -690,8 +690,8 @@ param_descriptions = {
'pubkey': 'Public key', 'pubkey': 'Public key',
'message': 'Clear text message. Use quotes if it contains spaces.', 'message': 'Clear text message. Use quotes if it contains spaces.',
'encrypted': 'Encrypted message', 'encrypted': 'Encrypted message',
'amount': 'Amount to be sent (in BTC). Type \'!\' to send the maximum available.', 'amount': 'Amount to be sent (in ZCL). Type \'!\' to send the maximum available.',
'requested_amount': 'Requested amount (in BTC).', 'requested_amount': 'Requested amount (in ZCL).',
'outputs': 'list of ["address", amount]', 'outputs': 'list of ["address", amount]',
'redeem_script': 'redeem script (hexadecimal)', 'redeem_script': 'redeem script (hexadecimal)',
} }
@ -708,7 +708,7 @@ command_options = {
'labels': ("-l", "Show the labels of listed addresses"), 'labels': ("-l", "Show the labels of listed addresses"),
'nocheck': (None, "Do not verify aliases"), 'nocheck': (None, "Do not verify aliases"),
'imax': (None, "Maximum number of inputs"), 'imax': (None, "Maximum number of inputs"),
'fee': ("-f", "Transaction fee (in BTC)"), 'fee': ("-f", "Transaction fee (in ZCL)"),
'from_addr': ("-F", "Source address (must be a wallet address; use sweep to spend from non-wallet address)."), 'from_addr': ("-F", "Source address (must be a wallet address; use sweep to spend from non-wallet address)."),
'change_addr': ("-c", "Change address. Default is a spare address, or the source address if it's not in the wallet"), 'change_addr': ("-c", "Change address. Default is a spare address, or the source address if it's not in the wallet"),
'nbits': (None, "Number of bits of entropy"), 'nbits': (None, "Number of bits of entropy"),

View File

@ -87,7 +87,7 @@ class Contacts(dict):
'type': 'openalias', 'type': 'openalias',
'validated': validated 'validated': validated
} }
raise Exception("Invalid Bitcoin address or alias", k) raise Exception("Invalid Zclassic address or alias", k)
def resolve_openalias(self, url): def resolve_openalias(self, url):
# support email-style addresses, per the OA standard # support email-style addresses, per the OA standard

View File

@ -40,7 +40,7 @@ def inv_dict(d):
return {v: k for k, v in d.items()} return {v: k for k, v in d.items()}
base_units = {'BTC':8, 'mBTC':5, 'uBTC':2} base_units = {'ZCL':8, 'mZCL':5, 'uZCL':2}
fee_levels = [_('Within 25 blocks'), _('Within 10 blocks'), _('Within 5 blocks'), _('Within 2 blocks'), _('In the next block')] fee_levels = [_('Within 25 blocks'), _('Within 10 blocks'), _('Within 5 blocks'), _('Within 2 blocks'), _('In the next block')]
def normalize_version(v): def normalize_version(v):
@ -492,7 +492,7 @@ def parse_URI(uri, on_pr=None):
if ':' not in uri: if ':' not in uri:
if not bitcoin.is_address(uri): if not bitcoin.is_address(uri):
raise BaseException("Not a bitcoin address") raise BaseException("Not a Zclassic address")
return {'address': uri} return {'address': uri}
u = urllib.parse.urlparse(uri) u = urllib.parse.urlparse(uri)
@ -514,7 +514,7 @@ def parse_URI(uri, on_pr=None):
out = {k: v[0] for k, v in pq.items()} out = {k: v[0] for k, v in pq.items()}
if address: if address:
if not bitcoin.is_address(address): if not bitcoin.is_address(address):
raise BaseException("Invalid bitcoin address:" + address) raise BaseException("Invalid Zclassic address:" + address)
out['address'] = address out['address'] = address
if 'amount' in out: if 'amount' in out:
am = out['amount'] am = out['amount']