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

Remove personal_* calls from dapps #2860

Merged
merged 2 commits into from
Oct 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 3 additions & 2 deletions js/src/dapps/basiccoin/Application/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import React, { Component, PropTypes } from 'react';

import { api } from '../parity';
// import { api } from '../parity';
import { attachInstances } from '../services';

import Header from './Header';
Expand Down Expand Up @@ -83,9 +83,10 @@ export default class Application extends Component {
Promise
.all([
attachInstances(),
api.personal.accountsInfo()
null // api.personal.accountsInfo()
])
.then(([{ managerInstance, registryInstance, tokenregInstance }, accountsInfo]) => {
accountsInfo = accountsInfo || {};
this.setState({
loading: false,
managerInstance,
Expand Down
9 changes: 5 additions & 4 deletions js/src/dapps/gavcoin/Application/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,12 @@ export default class Application extends Component {
return Promise
.all([
registry.getAddress.call({}, [api.util.sha3('gavcoin'), 'A']),
api.personal.listAccounts(),
api.personal.accountsInfo()
api.eth.accounts(),
null // api.personal.accountsInfo()
]);
})
.then(([address, addresses, infos]) => {
infos = infos || {};
console.log(`gavcoin was found at ${address}`);

const contract = api.newContract(abis.gavcoin, address);
Expand All @@ -220,11 +221,11 @@ export default class Application extends Component {
contract,
instance: contract.instance,
accounts: addresses.map((address) => {
const info = infos[address];
const info = infos[address] || {};

return {
address,
name: info.name || 'Unnamed',
name: info.name,
uuid: info.uuid
};
})
Expand Down
2 changes: 1 addition & 1 deletion js/src/dapps/gavcoin/Events/Event/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default class Event extends Component {
const { accounts } = this.context;
const account = accounts.find((_account) => _account.address === address);

if (account) {
if (account && account.name) {
return (
<div className={ styles.name }>
{ account.name }
Expand Down
9 changes: 5 additions & 4 deletions js/src/dapps/githubhint/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,22 @@ export function attachInterface () {
return Promise
.all([
registry.getAddress.call({}, [api.util.sha3('githubhint'), 'A']),
api.personal.listAccounts(),
api.personal.accountsInfo()
api.eth.accounts(),
null // api.personal.accountsInfo()
]);
})
.then(([address, addresses, accountsInfo]) => {
accountsInfo = 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 info = accountsInfo[address] || {};

return Object.assign(obj, {
[address]: {
address,
name: info.name || 'Unnamed',
name: info.name,
uuid: info.uuid
}
});
Expand Down
13 changes: 5 additions & 8 deletions js/src/dapps/registry/addresses/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,13 @@ export const set = (addresses) => ({ type: 'addresses set', addresses });
export const fetch = () => (dispatch) => {
return Promise
.all([
api.personal.listAccounts(),
api.personal.accountsInfo()
api.eth.accounts(),
null // api.personal.accountsInfo()
])
.then(([ accounts, data ]) => {
const addresses = Object.keys(data)
.filter((address) => data[address] && !data[address].meta.deleted)
.map((address) => ({
...data[address], address,
isAccount: accounts.includes(address)
}));
const addresses = accounts.map((address) => {
return { address, isAccount: true };
});
dispatch(set(addresses));
})
.catch((error) => {
Expand Down
4 changes: 2 additions & 2 deletions js/src/dapps/registry/ui/address.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ const align = {
export default (address, accounts, contacts, shortenHash = true) => {
let caption;
if (accounts[address]) {
caption = (<abbr title={ address } style={ align }>{ accounts[address].name }</abbr>);
caption = (<abbr title={ address } style={ align }>{ accounts[address].name || address }</abbr>);
} else if (contacts[address]) {
caption = (<abbr title={ address } style={ align }>{ contacts[address].name }</abbr>);
caption = (<abbr title={ address } style={ align }>{ contacts[address].name || address }</abbr>);
} else {
caption = (<code style={ align }>{ shortenHash ? renderHash(address) : address }</code>);
}
Expand Down
7 changes: 4 additions & 3 deletions js/src/dapps/signaturereg/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,17 @@ export function attachInterface (callback) {
return Promise
.all([
registry.getAddress.call({}, [api.util.sha3('signaturereg'), 'A']),
api.personal.listAccounts(),
api.personal.accountsInfo()
api.eth.accounts(),
null // api.personal.accountsInfo()
]);
})
.then(([address, addresses, accountsInfo]) => {
accountsInfo = 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];
const info = accountsInfo[address] || {};

return Object.assign(obj, {
[address]: {
Expand Down
8 changes: 4 additions & 4 deletions js/src/dapps/tokenreg/Accounts/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ export const setSelectedAccount = (address) => ({
export const loadAccounts = () => (dispatch) => {
Promise
.all([
api.personal.listAccounts(),
api.personal.accountsInfo()
api.eth.accounts(),
null // api.personal.accountsInfo()
])
.then(results => {
const [ accounts, accountsInfo ] = results;
.then(([ accounts, accountsInfo ]) => {
accountsInfo = accountsInfo || {};

const accountsList = accounts
.map(address => ({
Expand Down
2 changes: 1 addition & 1 deletion js/src/dapps/tokenreg/Status/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const loadContractDetails = () => (dispatch, getState) => {

Promise
.all([
api.personal.listAccounts(),
api.eth.accounts(),
instance.owner.call(),
instance.fee.call()
])
Expand Down