Пример #1
0
async def ms_wallet_electrum_export(menu, label, item):
    # create a JSON file that Electrum can use. Challenges:
    # - file contains a derivation path that we don't really know.
    # - electrum is using BIP43 with purpose=48 (purpose48_derivation) to make paths like:
    #       m/48'/1'/0'/2'
    # - other signers might not be coldcards (we don't know)
    # solution:
    # - (much earlier) when exporting, include all the paths needed.
    # - when building air-gap, pick address type at that point, and matching path to suit
    # - require a common prefix path here
    # - could check path prefix and addr_fmt make sense together, but meh.
    ms = item.arg
    from actions import electrum_export_story

    prefix = ms.common_prefix
    if not prefix:
        return await ux_show_story(
            "We don't know the common derivation path for "
            "these keys, so cannot create Electrum wallet.")

    msg = 'The new wallet will have derivation path:\n  %s\n and use %s addresses.\n' % (
        prefix, MultisigWallet.render_addr_fmt(ms.addr_fmt))

    if await ux_show_story(electrum_export_story(msg)) != 'y':
        return

    await ms.export_electrum()
async def ms_wallet_electrum_export(menu, label, item):
    # create a JSON file that Electrum can use. Challenges:
    # - file contains derivation paths for each co-signer to use
    # - electrum is using BIP43 with purpose=48 (purpose48_derivation) to make paths like:
    #       m/48'/1'/0'/2'
    # - other signers might not be coldcards (we don't know)
    # solution: 
    # - when building air-gap, pick address type at that point, and matching path to suit
    # - could check path prefix and addr_fmt make sense together, but meh.
    ms = item.arg
    from actions import electrum_export_story

    derivs, dsum = ms.get_deriv_paths()

    msg = 'The new wallet will have derivation path:\n  %s\n and use %s addresses.\n' % (
            dsum, MultisigWallet.render_addr_fmt(ms.addr_fmt) )

    if await ux_show_story(electrum_export_story(msg)) != 'y':
        return

    await ms.export_electrum()