UI support for hardware wallets (#4539)
* Add parity_hardwareAccountsInfo * Ledger Promise interface wrapper * Initial hardwarestore * Move ~/views/historyStore to ~/mobx * split scanLedger * test createEntry * Also scan via parity_hardwareAccountsInfo * Explanation for scanning options * react-intl-inify tooltips * add hwstore * Listen for hw walet updates * Return arrays from scanning * Readability * add u2f-api polyfill * check response.errorCode * Support hardware types in state.personal * Tooltips (to be split into sep. PR) * Tooltips support intl strings * FormattedMessage for strings to Tooltip * Fix TabBar tooltip display * signLedger * Use wallets as an object map * PendingForm -> FormattedMessage * Pending form doesn't render password for hardware * Groundwork for JS API signing * Show hardware accounts in list * Cleanup rendering conditions * Update RequestPending rendering tests (verification) * Tests for extended signer middleware * sign properly & handle response, error * Align outputs between Parity & Ledger u2f * Ledger returns checksummed addresses * Update ethereum-tx for EIP155 support * Update construction of tx * Updates after sanity checks (thanks @tomusdrw) * Allow display for disabled IdentityIcon * Disabled accounts * Disabled auto-disabling * Password button ebaled for hardware * Don't display password hint for hardware * Disable non-applicable options when not connected * Fix failing test * Confirmation via ledger (u2f) * Confirm on device message * Cleanups & support checks * Mark u2f as unsupported (until https) * rewording * Pass account & disabled flags * Render attach device message * Use isConnected for checking availability * Show hardware accounts in defaults list * Pass signerstore * Update u2f to correct version * remove debug u2f lib * Update test (prop name change) * Add ETC path (future work) * new Buffer -> Buffer.from (thanks @derhuerst)
This commit is contained in:
@@ -128,6 +128,18 @@ export function outLog (log) {
|
||||
return log;
|
||||
}
|
||||
|
||||
export function outHwAccountInfo (infos) {
|
||||
return Object
|
||||
.keys(infos)
|
||||
.reduce((ret, _address) => {
|
||||
const address = outAddress(_address);
|
||||
|
||||
ret[address] = infos[_address];
|
||||
|
||||
return ret;
|
||||
}, {});
|
||||
}
|
||||
|
||||
export function outNumber (number) {
|
||||
return new BigNumber(number || 0);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
import BigNumber from 'bignumber.js';
|
||||
|
||||
import { outBlock, outAccountInfo, outAddress, outChainStatus, outDate, outHistogram, outNumber, outPeer, outPeers, outReceipt, outRecentDapps, outSyncing, outTransaction, outTrace, outVaultMeta } from './output';
|
||||
import { outBlock, outAccountInfo, outAddress, outChainStatus, outDate, outHistogram, outHwAccountInfo, outNumber, outPeer, outPeers, outReceipt, outRecentDapps, outSyncing, outTransaction, outTrace, outVaultMeta } from './output';
|
||||
import { isAddress, isBigNumber, isInstanceOf } from '../../../test/types';
|
||||
|
||||
describe('api/format/output', () => {
|
||||
@@ -163,6 +163,16 @@ describe('api/format/output', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('outHwAccountInfo', () => {
|
||||
it('returns objects with formatted addresses', () => {
|
||||
expect(outHwAccountInfo(
|
||||
{ '0x63cf90d3f0410092fc0fca41846f596223979195': { manufacturer: 'mfg', name: 'type' } }
|
||||
)).to.deep.equal({
|
||||
'0x63Cf90D3f0410092FC0fca41846f596223979195': { manufacturer: 'mfg', name: 'type' }
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('outNumber', () => {
|
||||
it('returns a BigNumber equalling the value', () => {
|
||||
const bn = outNumber('0x123456');
|
||||
|
||||
Reference in New Issue
Block a user