Skip to content

Commit

Permalink
Merge pull request #332 from poanetwork/vb-fix-remove-acc
Browse files Browse the repository at this point in the history
Return to main screen after removal of imported account
  • Loading branch information
vbaranov committed Mar 21, 2020
2 parents 371787a + 71fb4e1 commit fd1e6c9
Show file tree
Hide file tree
Showing 45 changed files with 15,946 additions and 12,196 deletions.
4 changes: 0 additions & 4 deletions .babelrc

This file was deleted.

6 changes: 0 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,6 @@ jobs:
- run:
name: sentry sourcemaps upload
command: npm run sentry:publish
# - run:
# name: github gh-pages docs publish
# command: >
# git config user.name metamaskbot
# git config user.email admin@metamask.io
# gh-pages -d docs/jsdocs

test-unit:
docker:
Expand Down
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
},

"plugins": [
"babel",
"mocha",
"chai",
"react",
"json"
],
Expand Down
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: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@

Uncompressed builds can be found in `/dist`, compressed builds can be found in `/builds` once they're built.

## Contributing

You can re-generate the docs locally by running `npm run doc`, and contributors can update the hosted docs by running `npm run publish-docs`.

### Running Tests

Requires `mocha` installed. Run `npm install -g mocha`.
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/platforms/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class ExtensionPlatform {
})
}

_subscribeToNotificationClicked = () => {
_subscribeToNotificationClicked () {
if (extension.notifications.onClicked.hasListener(this._viewOnExplorer)) {
extension.notifications.onClicked.removeListener(this._viewOnExplorer)
}
Expand Down
25 changes: 25 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module.exports = function (api) {
api.cache(false)
return {
presets: [
[
'@babel/preset-env',
{
targets: {
browsers: [
'chrome >= 58',
'firefox >= 56.2',
],
},
},
],
'@babel/preset-react',
],
plugins: [
'@babel/plugin-transform-runtime',
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-proposal-optional-chaining',
],
}
}
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
22 changes: 14 additions & 8 deletions mascara/src/app/first-time/import-account-screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,19 @@ import classnames from 'classnames'
import LoadingScreen from './loading-screen'
import {importNewAccount, hideWarning} from '../../../../ui/app/actions'

const Input = ({ label, placeholder, onChange, errorMessage, type = 'text' }) => (
class Input extends Component {

static propTypes = {
label: PropTypes.string.isRequired,
placeholder: PropTypes.string.isRequired,
type: PropTypes.string.isRequired,
errorMessage: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired,
}

render () {
const {label, type, placeholder, errorMessage, onChange} = this.props
return (
<div className="import-account__input-wrapper">
<div className="import-account__input-label">{label}</div>
<input
Expand All @@ -19,14 +31,8 @@ const Input = ({ label, placeholder, onChange, errorMessage, type = 'text' }) =>
<div className="import-account__input-error-message">{errorMessage}</div>
</div>
)

Input.prototype.propTypes = {
label: PropTypes.string.isRequired,
placeholder: PropTypes.string.isRequired,
type: PropTypes.string.isRequired,
errorMessage: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired,
}
}

class ImportAccountScreen extends Component {
static OPTIONS = {
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
1 change: 1 addition & 0 deletions old-ui/app/components/add-token/add-token.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export default class AddTokenScreen extends Component {
address: PropTypes.string,
dispatch: PropTypes.func,
network: PropTypes.string,
addToken: PropTypes.func,
}

constructor (props) {
Expand Down
2 changes: 2 additions & 0 deletions old-ui/app/components/app-bar/networks-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class NetworksMenu extends Component {
provider: PropTypes.any.isRequired,
frequentRpcList: PropTypes.array.isRequired,
isNetworkMenuOpen: PropTypes.bool,
setProviderType: PropTypes.function,
showDeleteRPC: PropTypes.function,
}

render () {
Expand Down
5 changes: 5 additions & 0 deletions old-ui/app/components/buy-button-subview.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ import PropTypes from 'prop-types'
import { getMetaMaskAccounts } from '../../../ui/app/selectors'

class BuyButtonSubview extends Component {
static propTypes = {
isSubLoading: PropTypes.bool,
identity: PropTypes.object,
account: PropTypes.object,
}
render () {
return (
<div style={{ width: '100%' }}>
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: 5 additions & 0 deletions old-ui/app/components/fiat-value.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import PropTypes from 'prop-types'
import { DAI_CODE, POA_SOKOL_CODE, RSK_TESTNET_CODE, GOERLI_TESTNET_CODE } from '../../../app/scripts/controllers/network/enums'

class FiatValue extends Component {
static propTypes = {
value: PropTypes.number,
valueStyle: PropTypes.object,
dimStyle: PropTypes.object,
}
render = () => {
const props = this.props
let { conversionRate } = props
Expand Down
8 changes: 8 additions & 0 deletions old-ui/app/components/pending-msg-details.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import React, {Component} from 'react'
import AccountPanel from './account-panel'
import PropTypes from 'prop-types'

export default class PendingMsgDetails extends Component {
static propTypes = {
txData: PropTypes.object,
selectedAddress: PropTypes.string,
identities: PropTypes.object,
accounts: PropTypes.array,
imageifyIdenticons: PropTypes.any,
}
render () {
var state = this.props
var msgData = state.txData
Expand Down
7 changes: 7 additions & 0 deletions old-ui/app/components/pending-msg.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import React, { Component } from 'react'
import PendingTxDetails from './pending-msg-details'
import PropTypes from 'prop-types'

export default class PendingMsg extends Component {
static propTypes = {
txData: PropTypes.object,
cancelMessage: PropTypes.function,
signMessage: PropTypes.function,
}

render () {
var state = this.props
var msgData = state.txData
Expand Down
9 changes: 9 additions & 0 deletions old-ui/app/components/pending-personal-msg-details.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import React, {Component} from 'react'
import AccountPanel from './account-panel'
import BinaryRenderer from './binary-renderer'
import PropTypes from 'prop-types'

export default class PendingMsgDetails extends Component {
static propTypes = {
txData: PropTypes.object,
selectedAddress: PropTypes.string,
identities: PropTypes.object,
accounts: PropTypes.object,
imageifyIdenticons: PropTypes.object,
}

render () {
var state = this.props
var msgData = state.txData
Expand Down
7 changes: 7 additions & 0 deletions old-ui/app/components/pending-personal-msg.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import React, { Component } from 'react'
import PendingTxDetails from './pending-personal-msg-details'
import PropTypes from 'prop-types'

export default class PendingMsg extends Component {
static propTypes = {
txData: PropTypes.object,
cancelPersonalMessage: PropTypes.function,
signPersonalMessage: PropTypes.function,
}

render () {
var state = this.props
var msgData = state.txData
Expand Down
9 changes: 9 additions & 0 deletions old-ui/app/components/pending-typed-msg-details.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import React, {Component} from 'react'
import AccountPanel from './account-panel'
import TypedMessageRenderer from './typed-message-renderer'
import PropTypes from 'prop-types'

export default class PendingMsgDetails extends Component {
static propTypes = {
txData: PropTypes.object,
selectedAddress: PropTypes.string,
identities: PropTypes.object,
accounts: PropTypes.array,
imageifyIdenticons: PropTypes.any,
}

render () {
var state = this.props
var msgData = state.txData
Expand Down
7 changes: 7 additions & 0 deletions old-ui/app/components/pending-typed-msg.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import React, { Component } from 'react'
import PendingTxDetails from './pending-typed-msg-details'
import PropTypes from 'prop-types'

export default class PendingMsg extends Component {
static propTypes = {
txData: PropTypes.object,
cancelTypedMessage: PropTypes.function,
signTypedMessage: PropTypes.function,
}

render () {
var state = this.props
var msgData = state.txData
Expand Down
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
Loading

0 comments on commit fd1e6c9

Please sign in to comment.