コード例 #1
0
ファイル: ui.py プロジェクト: theotherside/junction
def broadcast():
    wallet = MultisigWallet.open(wallet_name)
    wallet.broadcast()
    wallet.remove_psbt()
    wallet.save()
    flash_success('transaction broadcasted successfully')
    return redirect(url_for('wallet'))
コード例 #2
0
ファイル: ui.py プロジェクト: theotherside/junction
def sign_psbt(fingerprint):
    wallet = MultisigWallet.open(wallet_name)
    client, device = get_client_and_device(fingerprint)
    psbt = wallet.psbt
    raw_signed_psbt = client.sign_tx(wallet.psbt)['psbt']
    new_psbt = serializations.PSBT()
    new_psbt.deserialize(raw_signed_psbt)
    wallet.psbt = new_psbt
    wallet.save()
    # FIXME: display the signer name here ...
    flash_success(f'{device["type"]} signed successfully')
    return redirect(url_for('wallet'))
コード例 #3
0
def settings():
    if request.method == 'POST':
        rpc_settings = dict(request.form)
        if test_rpc(rpc_settings):
            update_settings(rpc_settings)
            flash_success('Settings updated')
            return redirect(url_for('wallet'))
        else:
            flash_error('Invalid settings')
            return redirect(url_for('settings'))
    else:
        settings = get_settings()
        return render_template("settings.html", settings=settings)
コード例 #4
0
ファイル: ui.py プロジェクト: theotherside/junction
def create_wallet():
    global wallet_name
    if request.method == 'GET':
        return render_template('create-wallet.html')
    else:
        try:
            wallet_name = request.form['name']
            m = int(request.form['m'])
            n = int(request.form['n'])
            MultisigWallet.create(wallet_name, m, n)
            flash_success('Wallet created')
        except JunctionError as e:
            flash_error(str(e))
            return render_template('create-wallet.html')
        return redirect(url_for('wallet'))
コード例 #5
0
ファイル: ui.py プロジェクト: theotherside/junction
def set_pin():
    global trezor_client
    # construct pin
    pin = ''
    map = {v: k for k, v in request.form.items()}
    for k in sorted(map.keys()):
        pin += map[k]
    # test pin
    result = trezor_client.send_pin(pin)
    if result['success']:
        flash_success('Device unlocked')
        del trezor_client
    else:
        flash_error('Bad pin')
    return redirect(url_for('devices'))
コード例 #6
0
ファイル: ui.py プロジェクト: theotherside/junction
def settings():
    if request.method == 'POST':
        rpc_settings = request.form.to_dict()
        try:
            test_rpc(rpc_settings)
            update_settings(rpc_settings)
            flash_success('Settings updated')
            return redirect(url_for('wallet'))
        except JunctionWarning as jw:
            update_settings(rpc_settings)
            flash_success('Settings Updated but: {}'.format(jw))
            return redirect(url_for('settings'))
        except JunctionError as je:
            flash_error('Error: {}'.format(je))
            return redirect(url_for('settings'))
    else:
        settings = get_settings()
        return render_template("settings.html", settings=settings)
コード例 #7
0
ファイル: ui.py プロジェクト: theotherside/junction
def add_signer(fingerprint):
    wallet = MultisigWallet.open(wallet_name)
    client, device = get_client_and_device(fingerprint)

    # Add a "signer" to the wallet
    account_path = "m/44h/1h/0h"
    base_key = client.get_pubkey_at_path(account_path)['xpub']
    wallet.add_signer(device['type'], device['fingerprint'], base_key,
                      account_path)

    # FIXME: only works when coldcard added last
    if device['type'] == 'coldcard':
        client.close()
        coldcard_enroll(wallet)

    msg = f"Signer \"{device['type']}\" has been added to your \"{wallet.name}\" wallet"
    flash_success(msg)

    return redirect(url_for('wallet'))