Make Wallet first-class citizens (#3990)

* Fixed hint in Address Select + Wallet as first-class-citizen

* Separate Owned and not Owned Wallets

* Fix balance not updating

* Fix MethodDecoding for Contract Deployment

* Fix TypedInput params

* Fix Token Transfer for Wallet

* Small change to contracts

* Fix wallets shown twice

* Fix separation of accounts and wallets in Accounts

* Fix linting

* Execute contract methods from Wallet ✓

* Fixing linting

* Wallet as first-class citizen: Part 1 (Manual) #3784

* Lower level wallet transaction convertion

* Fix linting

* Proper autoFocus on right Signer input

* PR Grumble: don't show Wallets in dApps Permissions

* Add postTransaction and gasEstimate wrapper methods

* Extract Wallet postTx and gasEstimate to utils + PATCH api

* Remove invalid test

It's totally valid for input's length not to be a multiple of 32 bytes. EG. for Wallet Contracts

* Merge master

* Fix linting

* Fix merge issue

* Rename Portal

* Rename Protal => Portal (typo)
This commit is contained in:
Nicolas Gotchac
2016-12-30 12:28:12 +01:00
committed by Gav Wood
parent 88c0329a31
commit fd41a10319
46 changed files with 570 additions and 230 deletions

View File

@@ -64,13 +64,14 @@ class Wallet extends Component {
};
static propTypes = {
setVisibleAccounts: PropTypes.func.isRequired,
address: PropTypes.string.isRequired,
balance: nullableProptype(PropTypes.object.isRequired),
images: PropTypes.object.isRequired,
address: PropTypes.string.isRequired,
wallets: PropTypes.object.isRequired,
isTest: PropTypes.bool.isRequired,
owned: PropTypes.bool.isRequired,
setVisibleAccounts: PropTypes.func.isRequired,
wallet: PropTypes.object.isRequired,
isTest: PropTypes.bool.isRequired
walletAccount: nullableProptype(PropTypes.object).isRequired
};
state = {
@@ -104,28 +105,26 @@ class Wallet extends Component {
}
render () {
const { wallets, balance, address } = this.props;
const { walletAccount, balance, wallet } = this.props;
const wallet = (wallets || {})[address];
if (!wallet) {
if (!walletAccount) {
return null;
}
const { owners, require, dailylimit } = this.props.wallet;
const { owners, require, dailylimit } = wallet;
return (
<div className={ styles.wallet }>
{ this.renderEditDialog(wallet) }
{ this.renderEditDialog(walletAccount) }
{ this.renderSettingsDialog() }
{ this.renderTransferDialog() }
{ this.renderDeleteDialog(wallet) }
{ this.renderDeleteDialog(walletAccount) }
{ this.renderActionbar() }
<Page>
<div className={ styles.info }>
<Header
className={ styles.header }
account={ wallet }
account={ walletAccount }
balance={ balance }
isContract
>
@@ -209,32 +208,47 @@ class Wallet extends Component {
}
renderActionbar () {
const { balance } = this.props;
const { balance, owned } = this.props;
const showTransferButton = !!(balance && balance.tokens);
const buttons = [
<Button
key='transferFunds'
icon={ <ContentSend /> }
label='transfer'
disabled={ !showTransferButton }
onClick={ this.onTransferClick } />,
const buttons = [];
if (owned) {
buttons.push(
<Button
key='transferFunds'
icon={ <ContentSend /> }
label='transfer'
disabled={ !showTransferButton }
onClick={ this.onTransferClick } />
);
}
buttons.push(
<Button
key='delete'
icon={ <ActionDelete /> }
label='delete'
onClick={ this.showDeleteDialog } />,
onClick={ this.showDeleteDialog } />
);
buttons.push(
<Button
key='editmeta'
icon={ <ContentCreate /> }
label='edit'
onClick={ this.onEditClick } />,
<Button
key='settings'
icon={ <SettingsIcon /> }
label='settings'
onClick={ this.onSettingsClick } />
];
onClick={ this.onEditClick } />
);
if (owned) {
buttons.push(
<Button
key='settings'
icon={ <SettingsIcon /> }
label='settings'
onClick={ this.onSettingsClick } />
);
}
return (
<Actionbar
@@ -293,12 +307,11 @@ class Wallet extends Component {
return null;
}
const { wallets, balance, images, address } = this.props;
const wallet = wallets[address];
const { walletAccount, balance, images } = this.props;
return (
<Transfer
account={ wallet }
account={ walletAccount }
balance={ balance }
images={ images }
onClose={ this.onTransferClose }
@@ -342,20 +355,27 @@ function mapStateToProps (_, initProps) {
return (state) => {
const { isTest } = state.nodeStatus;
const { wallets } = state.personal;
const { accountsInfo = {}, accounts = {} } = state.personal;
const { balances } = state.balances;
const { images } = state;
const walletAccount = accounts[address] || accountsInfo[address] || null;
if (walletAccount) {
walletAccount.address = address;
}
const wallet = state.wallet.wallets[address] || {};
const balance = balances[address] || null;
const owned = !!accounts[address];
return {
isTest,
wallets,
address,
balance,
images,
address,
wallet
isTest,
owned,
wallet,
walletAccount
};
};
}