Skip to content

Commit

Permalink
Return to mainn screenn from removal of account
Browse files Browse the repository at this point in the history
  • Loading branch information
vbaranov committed Mar 20, 2020
1 parent aadaa79 commit 2007e2a
Show file tree
Hide file tree
Showing 17 changed files with 128 additions and 85 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Current Master

- [#332](https://github.com/poanetwork/nifty-wallet/pull/332) - (Chore) Return to main screen from removal of imported account
- [#330](https://github.com/poanetwork/nifty-wallet/pull/330) - (Fix) Derive correct addresses for custom networks (RSK/ETC)
- [#329](https://github.com/poanetwork/nifty-wallet/pull/329) - (Fix) Connect to unknown private network fix
- [#326](https://github.com/poanetwork/nifty-wallet/pull/326) - (Chore) HTTP2 RPC endpoints for POA and xDai
Expand Down
4 changes: 2 additions & 2 deletions docs/form_persisting_architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ To use this class, simply take your form component (the component that renders `

You can see an example of this in use in `ui/app/first-time/restore-vault.js`.

Additionally, any field whose value should be persisted, should have a `persistentFormId` attribute, which needs to be assigned under a `dataset` key on the main `attributes` hash. For example:
Additionally, any field whose value should be persisted, should have a `persistentFormid` attribute, which needs to be assigned under a `dataset` key on the main `attributes` hash. For example:

```javascript
return h('textarea.twelve-word-phrase.letter-spacey', {
dataset: {
persistentFormId: 'wallet-seed',
persistentFormid: 'wallet-seed',
},
})
```
Expand Down
2 changes: 0 additions & 2 deletions notices/archive/notice_0.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ When you log in to Nifty Wallet, your current account's address is visible to ev

For your privacy, for now, please sign out of Nifty Wallet when you're done using a site.

There have been several instances of high-profile legitimate websites such as BTC Manager and Games Workshop that have had their websites temporarily compromised. This involves showing a fake Nifty Wallet window on the page asking for user's seed phrases. Nifty Wallet will never open itself in this way.

## Related Links ##

**[Terms of Service](https://github.com/poanetwork/metamask-extension/wiki/Terms-of-Service)**
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class AccountsDropdownItemView extends Component {
onClick={(event) => {
event.preventDefault()
event.stopPropagation()
this.props.actions.showDeleteImportedAccount(identity)
this.props.actions.showDeleteImportedAccount(identity, keyring)
this.props.closeMenu()
}}
/>) : null
Expand Down Expand Up @@ -157,7 +157,7 @@ const mapDispatchToProps = (dispatch) => {
return {
actions: {
showAccountDetail: (address) => dispatch(actions.showAccountDetail(address)),
showDeleteImportedAccount: (identity) => dispatch(actions.showDeleteImportedAccount(identity)),
showDeleteImportedAccount: (identity, keyring) => dispatch(actions.showDeleteImportedAccount(identity, keyring)),
getContract: (addr) => dispatch(actions.getContract(addr)),
connectHardwareAndUnlockAddress: (deviceName, hdPath, address) => {
return dispatch(actions.connectHardwareAndUnlockAddress(deviceName, hdPath, address))
Expand Down
44 changes: 34 additions & 10 deletions old-ui/app/components/delete-imported-account.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,58 @@ import ConfirmScreen from './confirm'
import React from 'react'
import { connect } from 'react-redux'
import actions from '../../../ui/app/actions'
import { ifContractAcc } from '../util'

class DeleteImportedAccount extends ConfirmScreen {
static propTypes = {
}

render () {
const withDescription = !ifContractAcc(this.props.keyring)
return (
<ConfirmScreen
subtitle="Delete Imported Account"
withDescription={true}
withDescription={withDescription}
description="Be sure, that you saved a private key or JSON keystore file of this account in a safe place. Otherwise, you will not be able to restore this account."
question={`Are you sure to delete imported ${this.props.identity.name} (${this.props.identity.address})?`}
onCancelClick={() => this.props.dispatch(actions.showConfigPage())}
onNoClick={() => this.props.dispatch(actions.showConfigPage())}
onYesClick={() => {
this.props.dispatch(actions.removeAccount(this.props.identity.address, this.props.metamask.network))
.then(() => {
this.props.dispatch(actions.showConfigPage())
})
}}
onCancelClick={() => this.onCancelClick()}
onNoClick={() => this.onNoClick()}
onYesClick={() => this.onYesClick()}
/>
)
}

onCancelClick () {
this.props.showAccountsPage()
}

onNoClick () {
this.props.showAccountsPage()
}

onYesClick () {
this.props.removeAccount(this.props.identity.address, this.props.metamask.network)
.then(() => {
this.props.showAccountsPage()
})
}

}

function mapStateToProps (state) {
return {
metamask: state.metamask,
identity: state.appState.identity,
keyring: state.appState.keyring,
provider: state.metamask.provider,
}
}

module.exports = connect(mapStateToProps)(DeleteImportedAccount)
const mapDispatchToProps = dispatch => {
return {
removeAccount: (address, network) => dispatch(actions.removeAccount(address, network)),
showAccountsPage: () => dispatch(actions.showAccountsPage()),
}
}

module.exports = connect(mapStateToProps, mapDispatchToProps)(DeleteImportedAccount)
5 changes: 2 additions & 3 deletions old-ui/app/components/send/send-contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ import ErrorComponent from '../error'
import ToastComponent from '../toast'
import Select from 'react-select'
import actions from '../../../../ui/app/actions'
import { AbiCoder } from 'web3-eth-abi'
import abi from 'web3-eth-abi'
import Web3 from 'web3'
import copyToClipboard from 'copy-to-clipboard'
import CopyButton from '../copy/copy-button'
const abiEncoder = new AbiCoder()

class SendTransactionField extends Component {
constructor (props) {
Expand Down Expand Up @@ -430,7 +429,7 @@ class SendTransactionScreen extends PersistentForm {
const inputValuesArray = Object.keys(inputValues).map(key => inputValues[key])
let txData
try {
txData = abiEncoder.encodeFunctionCall(methodABI, inputValuesArray)
txData = abi.encodeFunctionCall(methodABI, inputValuesArray)
this.props.hideWarning()
} catch (e) {
this.props.hideToast()
Expand Down
4 changes: 2 additions & 2 deletions old-ui/app/components/send/send.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ SendTransactionScreen.prototype.render = function () {
marginRight: '6px',
},
dataset: {
persistentFormId: 'tx-amount',
persistentFormid: 'tx-amount',
},
}),

Expand Down Expand Up @@ -137,7 +137,7 @@ SendTransactionScreen.prototype.render = function () {
resize: 'none',
},
dataset: {
persistentFormId: 'tx-data',
persistentFormid: 'tx-data',
},
}),
]),
Expand Down
4 changes: 2 additions & 2 deletions old-ui/app/components/shapeshift-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ ShapeshiftForm.prototype.renderMain = function () {
list: 'coinList',
autoFocus: true,
dataset: {
persistentFormId: 'input-coin',
persistentFormid: 'input-coin',
},
style: {
boxSizing: 'border-box',
Expand Down Expand Up @@ -149,7 +149,7 @@ ShapeshiftForm.prototype.renderRefundAddressForCoin = function (coin) {
type: 'text',
placeholder: `Your ${coin} Refund Address`,
dataset: {
persistentFormId: 'refund-address',
persistentFormid: 'refund-address',

},
style: {
Expand Down
4 changes: 2 additions & 2 deletions old-ui/app/keychains/hd/restore-vault.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ RestoreVaultScreen.prototype.render = function () {
id: 'password-box',
placeholder: 'New Password (min 8 chars)',
dataset: {
persistentFormId: 'password',
persistentFormid: 'password',
},
style: {
width: '100%',
Expand All @@ -86,7 +86,7 @@ RestoreVaultScreen.prototype.render = function () {
placeholder: 'Confirm Password',
onKeyPress: this.createOnEnter.bind(this),
dataset: {
persistentFormId: 'password-confirmation',
persistentFormid: 'password-confirmation',
},
style: {
width: '100%',
Expand Down
103 changes: 62 additions & 41 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@
"url-parse": "^1.4.4",
"valid-url": "^1.0.9",
"vreme": "^3.0.2",
"web3": "^0.20.1",
"web3-eth-abi": "^1.0.0-beta.55",
"web3-stream-provider": "^3.0.1",
"web3": "^0.20.7",
"web3-eth-abi": "^1.2.6",
"web3-stream-provider": "^4.0.0",
"xtend": "^4.0.1"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit 2007e2a

Please sign in to comment.