Skip to content

Commit

Permalink
Multisig Wallets (#569)
Browse files Browse the repository at this point in the history
* temp

* use api key

* wallet: set display name based on wallet type

* ui: change copy button text on copy

* ducks: add more wallet properties

* onboarding: create multisig wallet

* onboarding: import multisig wallet

* wallet: refactor to use walletProxy

* wallet: parse tx and multisigProxy

* multisig: setup and keys table

* multisig: tx viewer modal

* multisig: add modal to inspect tx

* ui: do not show success notifs if partial signed tx

* ui: hide elements in uninitialised wallets

* atomic-swap: add transaction file select

* ui: disable features not supported with multisig

* multisig: add i18n context

* wallet: remove unused tx create code

* i18n: extract strings

* onboarding: refactor CreateNewAccount

* wallet: only add redeem script to LedgerInput if p2sh

* multisig: only show export in modal after signing

* multisig: check tx before broadcast from modal

* multisig: success notification after broadcast

* onboarding: limit multisig N to max 15

* multisig: error when adding existing key

* Fixed line 107 of package.js (#3)

* Fixed line 107 of package.js

Changed claims.js to notifications.js in scripts/package.js

* Added both claims and notifications to package.js and .sh

Co-authored-by: Nathan Woodburn <contact@nathan.woodburn.id.au>

* ui: do not show success notification if not broadcasting

* multisig: handle incomplete txs with negative fee

* multisig: new multisig section in tx viewer

* multisig: copy tx hex in modal

For debugging and palmreader users

* ui: do not show error if user cancelled modal

* multisig: consider 0 bid as valid

* i18n: extract strings from multisig components
  • Loading branch information
rithvikvibhu authored Jan 30, 2023
1 parent 9009b28 commit 03c8162
Show file tree
Hide file tree
Showing 61 changed files with 3,288 additions and 1,019 deletions.
1 change: 0 additions & 1 deletion app/background/ledger/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export async function withLedger(network, action) {
});

await device.open();
// TODO: this network parameter should be passed dynamically.
ledger = new LedgerHSD({device, network});
} catch (e) {
console.error('failed to open ledger', e);
Expand Down
75 changes: 0 additions & 75 deletions app/background/wallet/bulk-renewal.js

This file was deleted.

140 changes: 0 additions & 140 deletions app/background/wallet/bulk-transfer.js

This file was deleted.

3 changes: 3 additions & 0 deletions app/background/wallet/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,14 @@ export const clientStub = ipcRendererInjector => makeClient(ipcRendererInjector,
'lock',
'unlock',
'isLocked',
'addSharedKey',
'removeSharedKey',
'getNonce',
'importNonce',
'zap',
'importName',
'rpcGetWalletInfo',
'loadTransaction',
'listWallets',
'getStats',
'isReady',
Expand Down
63 changes: 0 additions & 63 deletions app/background/wallet/create-register-all.js
Original file line number Diff line number Diff line change
@@ -1,67 +1,4 @@
const MTX = require('hsd/lib/primitives/mtx');
const {states} = require('hsd/lib/covenants/namestate');
const rules = require('hsd/lib/covenants/rules');
const {types} = rules;
const Output = require('hsd/lib/primitives/output');
const EMPTY = Buffer.alloc(0);

/** @param {import('hsd/lib/wallet/wallet')} wallet */
export const createRegisterAll = async (wallet) => {
const height = wallet.wdb.height + 1;
const network = wallet.network;
const names = await wallet.txdb.getNames();
const mtx = new MTX();

for (let i = 0; i < names.length; i++) {
const ns = names[i];
const {owner} = ns;

const coin = await wallet.getUnspentCoin(owner.hash, owner.index);

if (coin) {
if (!coin)
continue;

if (ns.isExpired(height, network))
continue;

// Is local?
if (coin.height < ns.height)
continue;

if (!coin.covenant.isReveal() && !coin.covenant.isClaim())
continue;

if (coin.covenant.isClaim()) {
if (height < coin.height + network.coinbaseMaturity)
continue;
}

const state = ns.state(height, network);

if (state !== states.CLOSED)
continue;

const output = new Output();
output.address = coin.address;
output.value = ns.value;

output.covenant.type = types.REGISTER;
output.covenant.pushHash(ns.nameHash);
output.covenant.pushU32(ns.height);
output.covenant.push(EMPTY);
output.covenant.pushHash(await wallet.wdb.getRenewalBlock());

mtx.addOutpoint(ns.owner);
mtx.outputs.push(output);
}
}

if (mtx.outputs.length === 0)
throw new Error('No reveals to register.');

return mtx;
}


/** @param {import('hsd/lib/wallet/wallet')} wallet */
Expand Down
Loading

0 comments on commit 03c8162

Please sign in to comment.