Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Backporting to beta #3525

Merged
merged 17 commits into from
Nov 18, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix dapp account selection (#3399)
* Fix GHH accounts (filter non accounts)

* SignatureReg handle undefined ABI names gracefully

* SignatureReg fix accounts (filter non accounts)

* TokenReg fix accounts (filter non accounts)

* Registry fix accounts (filter non accounts)
  • Loading branch information
jacogr authored and arkpar committed Nov 18, 2016
commit d3adfb7d71527d7cb1eb8fb00594d58221718bc8
26 changes: 13 additions & 13 deletions js/src/dapps/githubhint/services.js
Original file line number Diff line number Diff line change
@@ -28,26 +28,26 @@ export function attachInterface () {
return Promise
.all([
registry.getAddress.call({}, [api.util.sha3('githubhint'), 'A']),
api.eth.accounts(),
api.parity.accounts()
]);
})
.then(([address, addresses, accountsInfo]) => {
accountsInfo = accountsInfo || {};
.then(([address, accountsInfo]) => {
console.log(`githubhint was found at ${address}`);

const contract = api.newContract(abis.githubhint, address);
const accounts = addresses.reduce((obj, address) => {
const info = accountsInfo[address] || {};
const accounts = Object
.keys(accountsInfo)
.filter((address) => accountsInfo[address].uuid)
.reduce((obj, address) => {
const account = accountsInfo[address];

return Object.assign(obj, {
[address]: {
address,
name: info.name,
uuid: info.uuid
}
});
}, {});
return Object.assign(obj, {
[address]: {
address,
name: account.name
}
});
}, {});
const fromAddress = Object.keys(accounts)[0];

return {
20 changes: 9 additions & 11 deletions js/src/dapps/registry/addresses/actions.js
Original file line number Diff line number Diff line change
@@ -19,18 +19,16 @@ import { api } from '../parity';
export const set = (addresses) => ({ type: 'addresses set', addresses });

export const fetch = () => (dispatch) => {
return Promise
.all([
api.eth.accounts(),
api.parity.accounts()
])
.then(([ accounts, data ]) => {
data = data || {};
const addresses = Object.keys(data)
.filter((address) => data[address] && !data[address].meta.deleted)
return api.parity
.accounts()
.then((accountsInfo) => {
const addresses = Object
.keys(accountsInfo)
.filter((address) => accountsInfo[address] && !accountsInfo[address].meta.deleted)
.map((address) => ({
...data[address], address,
isAccount: accounts.includes(address)
...accountsInfo[address],
address,
isAccount: !!accountsInfo[address].uuid
}));
dispatch(set(addresses));
})
2 changes: 1 addition & 1 deletion js/src/dapps/signaturereg/Import/import.js
Original file line number Diff line number Diff line change
@@ -146,7 +146,7 @@ export default class Import extends Component {
}

sortFunctions = (a, b) => {
return a.name.localeCompare(b.name);
return (a.name || '').localeCompare(b.name || '');
}

countFunctions () {
28 changes: 14 additions & 14 deletions js/src/dapps/signaturereg/services.js
Original file line number Diff line number Diff line change
@@ -49,26 +49,26 @@ export function attachInterface (callback) {
return Promise
.all([
registry.getAddress.call({}, [api.util.sha3('signaturereg'), 'A']),
api.eth.accounts(),
api.parity.accounts()
]);
})
.then(([address, addresses, accountsInfo]) => {
accountsInfo = accountsInfo || {};
.then(([address, accountsInfo]) => {
console.log(`signaturereg was found at ${address}`);

const contract = api.newContract(abis.signaturereg, address);
const accounts = addresses.reduce((obj, address) => {
const info = accountsInfo[address] || {};

return Object.assign(obj, {
[address]: {
address,
name: info.name || 'Unnamed',
uuid: info.uuid
}
});
}, {});
const accounts = Object
.keys(accountsInfo)
.filter((address) => accountsInfo[address].uuid)
.reduce((obj, address) => {
const info = accountsInfo[address] || {};

return Object.assign(obj, {
[address]: {
address,
name: info.name || 'Unnamed'
}
});
}, {});
const fromAddress = Object.keys(accounts)[0];

return {
17 changes: 7 additions & 10 deletions js/src/dapps/tokenreg/Accounts/actions.js
Original file line number Diff line number Diff line change
@@ -35,16 +35,13 @@ export const setSelectedAccount = (address) => ({
});

export const loadAccounts = () => (dispatch) => {
Promise
.all([
api.eth.accounts(),
api.parity.accounts()
])
.then(([ accounts, accountsInfo ]) => {
accountsInfo = accountsInfo || {};

const accountsList = accounts
.map(address => ({
api.parity
.accounts()
.then((accountsInfo) => {
const accountsList = Object
.keys(accountsInfo)
.filter((address) => accountsInfo[address].uuid)
.map((address) => ({
...accountsInfo[address],
address
}));