Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def report_init(text):
ui.display.clear()
ui.header(text)
async def require_confirm_memo(ctx, memo_type: int, memo_text: str):
text = Text("Confirm memo", ui.ICON_CONFIRM, icon_color=ui.GREEN)
if memo_type == consts.MEMO_TYPE_TEXT:
text.bold("Memo (TEXT)")
elif memo_type == consts.MEMO_TYPE_ID:
text.bold("Memo (ID)")
elif memo_type == consts.MEMO_TYPE_HASH:
text.bold("Memo (HASH)")
elif memo_type == consts.MEMO_TYPE_RETURN:
text.bold("Memo (RETURN)")
else: # MEMO_TYPE_NONE
text.bold("No memo set!")
text.normal("Important: Many exchanges require a memo when depositing")
if memo_type != consts.MEMO_TYPE_NONE:
text.mono(*split(memo_text))
await require_confirm(ctx, text, ButtonRequestType.ConfirmOutput)
async def require_confirm_init(
ctx, address: str, network_passphrase: str, accounts_match: bool
):
text = Text("Confirm Stellar", ui.ICON_SEND, ui.GREEN)
text.normal("Initialize signing with")
if accounts_match:
text.normal("your account")
text.mono(*split(trim_to_rows(address, 3)))
else:
text.mono(*split(address))
await require_confirm(ctx, text, ButtonRequestType.ConfirmOutput)
network = get_network_warning(network_passphrase)
if network:
text = Text("Confirm network", ui.ICON_CONFIRM, ui.GREEN)
text.normal("Transaction is on")
text.bold(network)
await require_confirm(ctx, text, ButtonRequestType.ConfirmOutput)
def mono_bold(self, *content):
self.content.append(ui.MONO_BOLD)
self.content.extend(content)
def fingerprint():
ui.display.bar(0, 60, 240, 128, ui.BLACK)
ui.display.text(10, 76, 'Fingerprint:', ui.BOLD, ui.GREY, ui.BLACK)
ui.display.bar(10, 82, 220, 102, ui.DARK_GREY)
s = 105
ui.display.text(15, s, '5764715dbcf8ed88', ui.MONO, ui.GREY, ui.DARK_GREY)
ui.display.text(15, s + 1 * 23, 'bc0ae1c2f715277f', ui.MONO, ui.GREY, ui.DARK_GREY)
ui.display.text(15, s + 2 * 23, '22b67f26c15e1f75', ui.MONO, ui.GREY, ui.DARK_GREY)
ui.display.text(15, s + 3 * 23, '43b2b44913b5c255', ui.MONO, ui.GREY, ui.DARK_GREY)
def func_top(foreground):
ui.display.bar(102, 214, 36, 4, foreground, ui.BLACK, 2)
async def require_confirm_sign_identity(ctx, identity, challenge_visual):
lines = chunks(identity, 18)
content = Text('Sign identity', ui.ICON_DEFAULT,
challenge_visual,
ui.MONO, *lines, max_lines=5)
await require_confirm(ctx, content)
def on_render(self) -> None:
if self.repaint:
ui.header(
self.header_text,
self.header_icon,
ui.TITLE_GREY,
ui.BG,
self.icon_color,
)
render_text(self.content, self.new_lines, self.max_lines)
self.repaint = False
)
async def show_group_threshold_reached(ctx: wire.GenericContext) -> None:
await show_warning(
ctx,
(
"Threshold of this",
"group has been reached.",
"Input share from",
"different group",
),
)
class RecoveryHomescreen(ui.Component):
def __init__(self, text: str, subtext: str = None):
self.text = text
self.subtext = subtext
self.dry_run = storage.recovery.is_dry_run()
self.repaint = True
def on_render(self) -> None:
if not self.repaint:
return
if self.dry_run:
heading = "SEED CHECK"
else:
heading = "RECOVERY MODE"
ui.header_warning(heading, clear=False)
def _require_confirm_action(
ctx: wire.Context, msg: ChangeWipeCode, has_wipe_code: bool
) -> None:
if msg.remove and has_wipe_code:
text = Text("Disable wipe code", ui.ICON_CONFIG)
text.normal("Do you really want to")
text.bold("disable wipe code")
text.bold("protection?")
return require_confirm(ctx, text)
if not msg.remove and has_wipe_code:
text = Text("Change wipe code", ui.ICON_CONFIG)
text.normal("Do you really want to")
text.bold("change the wipe code?")
return require_confirm(ctx, text)
if not msg.remove and not has_wipe_code:
text = Text("Set wipe code", ui.ICON_CONFIG)
text.normal("Do you really want to")
text.bold("set the wipe code?")
return require_confirm(ctx, text)