Skip to content

Commit

Permalink
Merge pull request #48 from Conflux-Chain/Version-v0.0.8
Browse files Browse the repository at this point in the history
Version v0.0.8 RC
  • Loading branch information
yqrashawn authored Feb 20, 2020
2 parents 2b900e1 + ed5d4d4 commit 2649a93
Show file tree
Hide file tree
Showing 17 changed files with 245 additions and 3,872 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ development/states.js
app/scripts/lib/extension-instance.js
app/scripts/chromereload.js
app/vendor/**
app/scripts/controllers/threebox.js

ui/lib/blockies.js

Expand Down
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# MetaMask Browser Extension
# ConfluxPortal Browser Extension
[![Build Status](https://circleci.com/gh/Conflux-Chain/conflux-portal.svg?style=svg)](https://circleci.com/gh/Conflux-Chain/conflux-portal?branch=cfx-develop)

You can find the latest version of MetaMask on [our official website](https://metamask.io/). For help using MetaMask, visit our [User Support Site](https://metamask.zendesk.com/hc/en-us).
You can find the latest version of ConfluxPortal on [our official website](https://github.com/Conflux-Chain/conflux-portal/releases). For help using ConfluxPortal, visit our [User Support Site](https://github.com/Conflux-Chain/conflux-portal/issues/new/choose).

MetaMask supports Firefox, Google Chrome, and Chromium-based browsers. We recommend using the latest available browser version.
ConfluxPortal supports Firefox, Google Chrome, and Chromium-based browsers. We recommend using the latest available browser version.

For up to the minute news, follow our [Twitter](https://twitter.com/metamask_io) or [Medium](https://medium.com/metamask) pages.

To learn how to develop MetaMask-compatible applications, visit our [Developer Docs](https://conflux-chain.github.io/metamask-docs/).
To learn how to develop ConfluxPortal-compatible applications, visit our [Developer Docs](https://conflux-chain.github.io/conflux-portal-docs/).

To learn how to contribute to the MetaMask project itself, visit our [Internal Docs](https://github.com/Conflux-Chain/conflux-portal/tree/develop/docs).
To learn how to contribute to the ConfluxPortal project itself, visit our [Internal Docs](https://github.com/Conflux-Chain/conflux-portal/tree/develop/docs).

## Building locally

Expand All @@ -29,7 +28,7 @@ Uncompressed builds can be found in `/dist`, compressed builds can be found in `

## Contributing

You can read [our internal docs here](https://conflux-chain.github.io/conflux-portal/).
You can read [our internal docs here](https://github.com/Conflux-Chain/conflux-portal/tree/develop/docs).

### Running Tests

Expand Down Expand Up @@ -60,10 +59,10 @@ yarn dist

- [How to add custom build to Chrome](./docs/add-to-chrome.md)
- [How to add custom build to Firefox](./docs/add-to-firefox.md)
- [How to add a new translation to MetaMask](./docs/translating-guide.md)
- [How to add a new translation to ConfluxPortal](./docs/translating-guide.md)
- [Publishing Guide](./docs/publishing.md)
- [How to port MetaMask to a new platform](./docs/porting_to_new_environment.md)
- [How to port ConfluxPortal to a new platform](./docs/porting_to_new_environment.md)
- [How to use the TREZOR emulator](./docs/trezor-emulator.md)
- [How to generate a visualization of this repository's development](./docs/development-visualization.md)

[1]: http://www.nomnoml.com/#view/%5B%3Cactor%3Euser%5D%0A%0A%5Bmetamask-ui%7C%0A%20%20%20%5Btools%7C%0A%20%20%20%20%20react%0A%20%20%20%20%20redux%0A%20%20%20%20%20thunk%0A%20%20%20%20%20ethUtils%0A%20%20%20%20%20jazzicon%0A%20%20%20%5D%0A%20%20%20%5Bcomponents%7C%0A%20%20%20%20%20app%0A%20%20%20%20%20account-detail%0A%20%20%20%20%20accounts%0A%20%20%20%20%20locked-screen%0A%20%20%20%20%20restore-vault%0A%20%20%20%20%20identicon%0A%20%20%20%20%20config%0A%20%20%20%20%20info%0A%20%20%20%5D%0A%20%20%20%5Breducers%7C%0A%20%20%20%20%20app%0A%20%20%20%20%20metamask%0A%20%20%20%20%20identities%0A%20%20%20%5D%0A%20%20%20%5Bactions%7C%0A%20%20%20%20%20%5BbackgroundConnection%5D%0A%20%20%20%5D%0A%20%20%20%5Bcomponents%5D%3A-%3E%5Bactions%5D%0A%20%20%20%5Bactions%5D%3A-%3E%5Breducers%5D%0A%20%20%20%5Breducers%5D%3A-%3E%5Bcomponents%5D%0A%5D%0A%0A%5Bweb%20dapp%7C%0A%20%20%5Bui%20code%5D%0A%20%20%5Bweb3%5D%0A%20%20%5Bmetamask-inpage%5D%0A%20%20%0A%20%20%5B%3Cactor%3Eui%20developer%5D%0A%20%20%5Bui%20developer%5D-%3E%5Bui%20code%5D%0A%20%20%5Bui%20code%5D%3C-%3E%5Bweb3%5D%0A%20%20%5Bweb3%5D%3C-%3E%5Bmetamask-inpage%5D%0A%5D%0A%0A%5Bmetamask-background%7C%0A%20%20%5Bprovider-engine%5D%0A%20%20%5Bhooked%20wallet%20subprovider%5D%0A%20%20%5Bid%20store%5D%0A%20%20%0A%20%20%5Bprovider-engine%5D%3C-%3E%5Bhooked%20wallet%20subprovider%5D%0A%20%20%5Bhooked%20wallet%20subprovider%5D%3C-%3E%5Bid%20store%5D%0A%20%20%5Bconfig%20manager%7C%0A%20%20%20%20%5Brpc%20configuration%5D%0A%20%20%20%20%5Bencrypted%20keys%5D%0A%20%20%20%20%5Bwallet%20nicknames%5D%0A%20%20%5D%0A%20%20%0A%20%20%5Bprovider-engine%5D%3C-%5Bconfig%20manager%5D%0A%20%20%5Bid%20store%5D%3C-%3E%5Bconfig%20manager%5D%0A%5D%0A%0A%5Buser%5D%3C-%3E%5Bmetamask-ui%5D%0A%0A%5Buser%5D%3C%3A--%3A%3E%5Bweb%20dapp%5D%0A%0A%5Bmetamask-contentscript%7C%0A%20%20%5Bplugin%20restart%20detector%5D%0A%20%20%5Brpc%20passthrough%5D%0A%5D%0A%0A%5Brpc%20%7C%0A%20%20%5Bethereum%20blockchain%20%7C%0A%20%20%20%20%5Bcontracts%5D%0A%20%20%20%20%5Baccounts%5D%0A%20%20%5D%0A%5D%0A%0A%5Bweb%20dapp%5D%3C%3A--%3A%3E%5Bmetamask-contentscript%5D%0A%5Bmetamask-contentscript%5D%3C-%3E%5Bmetamask-background%5D%0A%5Bmetamask-background%5D%3C-%3E%5Bmetamask-ui%5D%0A%5Bmetamask-background%5D%3C-%3E%5Brpc%5D%0A
[1]: http://www.nomnoml.com/#view/%5B%3Cactor%3Euser%5D%0A%0A%5Bconfluxportal-ui%7C%0A%20%20%20%5Btools%7C%0A%20%20%20%20%20react%0A%20%20%20%20%20redux%0A%20%20%20%20%20thunk%0A%20%20%20%20%20ethUtils%0A%20%20%20%20%20jazzicon%0A%20%20%20%5D%0A%20%20%20%5Bcomponents%7C%0A%20%20%20%20%20app%0A%20%20%20%20%20account-detail%0A%20%20%20%20%20accounts%0A%20%20%20%20%20locked-screen%0A%20%20%20%20%20restore-vault%0A%20%20%20%20%20identicon%0A%20%20%20%20%20config%0A%20%20%20%20%20info%0A%20%20%20%5D%0A%20%20%20%5Breducers%7C%0A%20%20%20%20%20app%0A%20%20%20%20%20confluxportal%0A%20%20%20%20%20identities%0A%20%20%20%5D%0A%20%20%20%5Bactions%7C%0A%20%20%20%20%20%5BbackgroundConnection%5D%0A%20%20%20%5D%0A%20%20%20%5Bcomponents%5D%3A-%3E%5Bactions%5D%0A%20%20%20%5Bactions%5D%3A-%3E%5Breducers%5D%0A%20%20%20%5Breducers%5D%3A-%3E%5Bcomponents%5D%0A%5D%0A%0A%5Bweb%20dapp%7C%0A%20%20%5Bui%20code%5D%0A%20%20%5Bjs-conflux-sdk%5D%0A%20%20%5Bconfluxportal-inpage%5D%0A%20%20%0A%20%20%5B%3Cactor%3Eui%20developer%5D%0A%20%20%5Bui%20developer%5D-%3E%5Bui%20code%5D%0A%20%20%5Bui%20code%5D%3C-%3E%5Bjs-conflux-sdk%5D%0A%20%20%5Bjs-conflux-sdk%5D%3C-%3E%5Bconfluxportal-inpage%5D%0A%5D%0A%0A%5Bconfluxportal-background%7C%0A%20%20%5Bprovider-engine%5D%0A%20%20%5Bhooked%20wallet%20subprovider%5D%0A%20%20%5Bid%20store%5D%0A%20%20%0A%20%20%5Bprovider-engine%5D%3C-%3E%5Bhooked%20wallet%20subprovider%5D%0A%20%20%5Bhooked%20wallet%20subprovider%5D%3C-%3E%5Bid%20store%5D%0A%20%20%5Bconfig%20manager%7C%0A%20%20%20%20%5Brpc%20configuration%5D%0A%20%20%20%20%5Bencrypted%20keys%5D%0A%20%20%20%20%5Bwallet%20nicknames%5D%0A%20%20%5D%0A%20%20%0A%20%20%5Bprovider-engine%5D%3C-%5Bconfig%20manager%5D%0A%20%20%5Bid%20store%5D%3C-%3E%5Bconfig%20manager%5D%0A%5D%0A%0A%5Buser%5D%3C-%3E%5Bconfluxportal-ui%5D%0A%0A%5Buser%5D%3C%3A--%3A%3E%5Bweb%20dapp%5D%0A%0A%5Bconfluxportal-contentscript%7C%0A%20%20%5Bplugin%20restart%20detector%5D%0A%20%20%5Brpc%20passthrough%5D%0A%5D%0A%0A%5Brpc%20%7C%0A%20%20%5Bethereum%20blockchain%20%7C%0A%20%20%20%20%5Bcontracts%5D%0A%20%20%20%20%5Baccounts%5D%0A%20%20%5D%0A%5D%0A%0A%5Bweb%20dapp%5D%3C%3A--%3A%3E%5Bconfluxportal-contentscript%5D%0A%5Bconfluxportal-contentscript%5D%3C-%3E%5Bconfluxportal-background%5D%0A%5Bconfluxportal-background%5D%3C-%3E%5Bconfluxportal-ui%5D%0A%5Bconfluxportal-background%5D%3C-%3E%5Brpc%5D%0A
2 changes: 1 addition & 1 deletion app/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "__MSG_appName__",
"short_name": "__MSG_appName__",
"version": "0.0.7",
"version": "0.0.8",
"manifest_version": 2,
"author": "https://conflux-chain.org",
"description": "__MSG_appDescription__",
Expand Down
8 changes: 4 additions & 4 deletions app/scripts/controllers/ConfluxWeb/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const ConfluxWeb = require('js-conflux-sdk')
import { Conflux } from 'js-conflux-sdk/dist/js-conflux-sdk.umd.min.js'

class FakeContract {
constructor (cfx, abi) {
Expand All @@ -11,7 +11,7 @@ class FakeContract {
}
}

module.exports = class Web3 extends ConfluxWeb {
export default class Web3 extends Conflux {
constructor () {
if (arguments[0] && arguments[0]._confluxWebProvider) {
super(arguments[0]._confluxWebProvider)
Expand All @@ -22,13 +22,13 @@ module.exports = class Web3 extends ConfluxWeb {

setProvider () {
if (arguments[0] && arguments[0]._confluxWebProvider) {
return ConfluxWeb.prototype.setProvider.call(
return Conflux.prototype.setProvider.call(
this,
arguments[0]._confluxWebProvider.url,
{ ...arguments[0]._confluxWebProvider }
)
} else {
return ConfluxWeb.prototype.setProvider.call(this, ...arguments)
return Conflux.prototype.setProvider.call(this, ...arguments)
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/scripts/controllers/transactions/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import EventEmitter from 'safe-event-emitter'
import ObservableStore from 'obs-store'
import ethUtil from 'ethereumjs-util'
import Transaction from 'js-conflux-sdk/src/Transaction'
import { Transaction } from 'js-conflux-sdk/dist/js-conflux-sdk.umd.min.js'
import EthQuery from '../../ethjs-query'
import { ethErrors } from 'eth-json-rpc-errors'
import abi from 'human-standard-token-abi'
Expand Down
3 changes: 1 addition & 2 deletions app/scripts/inpage.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ cleanContextForImports()
import log from 'loglevel'
import LocalMessageDuplexStream from 'post-message-stream'
import ConfluxPortalInpageProvider from '@yqrashawn/conflux-portal-inpage-provider'
import ConfluxJS from 'js-conflux-sdk/dist/js-conflux-sdk.umd.min.js'
// import ConfluxJS from 'js-conflux-sdk'
import { Conflux as ConfluxJS } from 'js-conflux-sdk/dist/js-conflux-sdk.umd.min.js'
import setupDappAutoReload from './lib/auto-reload.js'

restoreContextAfterImports()
Expand Down
100 changes: 50 additions & 50 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import AppStateController from './controllers/app-state'
import InfuraController from './controllers/infura'
import CachedBalancesController from './controllers/cached-balances'
import OnboardingController from './controllers/onboarding'
import ThreeBoxController from './controllers/threebox'
// import ThreeBoxController from './controllers/threebox'
import RecentBlocksController from './controllers/recent-blocks'
import IncomingTransactionsController from './controllers/incoming-transactions'
import MessageManager from './lib/message-manager'
Expand Down Expand Up @@ -240,16 +240,16 @@ export default class MetamaskController extends EventEmitter {
initState.AddressBookController
)

this.threeBoxController = new ThreeBoxController({
preferencesController: this.preferencesController,
addressBookController: this.addressBookController,
keyringController: this.keyringController,
initState: initState.ThreeBoxController,
getKeyringControllerState: this.keyringController.memStore.getState.bind(
this.keyringController.memStore
),
version,
})
// this.threeBoxController = new ThreeBoxController({
// preferencesController: this.preferencesController,
// addressBookController: this.addressBookController,
// keyringController: this.keyringController,
// initState: initState.ThreeBoxController,
// getKeyringControllerState: this.keyringController.memStore.getState.bind(
// this.keyringController.memStore
// ),
// version,
// })

this.txController = new TransactionController({
initState:
Expand Down Expand Up @@ -337,7 +337,7 @@ export default class MetamaskController extends EventEmitter {
ABTestController: this.abTestController.store,
PermissionsController: this.permissionsController.permissions,
PermissionsMetadata: this.permissionsController.store,
ThreeBoxController: this.threeBoxController.store,
// ThreeBoxController: this.threeBoxController.store,
})

this.memStore = new ComposableObservableStore(null, {
Expand All @@ -361,7 +361,7 @@ export default class MetamaskController extends EventEmitter {
IncomingTransactionsController: this.incomingTransactionsController.store,
PermissionsController: this.permissionsController.permissions,
PermissionsMetadata: this.permissionsController.store,
ThreeBoxController: this.threeBoxController.store,
// ThreeBoxController: this.threeBoxController.store,
ABTestController: this.abTestController.store,
// ENS Controller
EnsController: this.ensController.store,
Expand Down Expand Up @@ -470,7 +470,7 @@ export default class MetamaskController extends EventEmitter {
const onboardingController = this.onboardingController
const permissionsController = this.permissionsController
const preferencesController = this.preferencesController
const threeBoxController = this.threeBoxController
// const threeBoxController = this.threeBoxController
const abTestController = this.abTestController
const txController = this.txController

Expand Down Expand Up @@ -646,27 +646,27 @@ export default class MetamaskController extends EventEmitter {
),

// 3Box
setThreeBoxSyncingPermission: nodeify(
threeBoxController.setThreeBoxSyncingPermission,
threeBoxController
),
restoreFromThreeBox: nodeify(
threeBoxController.restoreFromThreeBox,
threeBoxController
),
setShowRestorePromptToFalse: nodeify(
threeBoxController.setShowRestorePromptToFalse,
threeBoxController
),
getThreeBoxLastUpdated: nodeify(
threeBoxController.getLastUpdated,
threeBoxController
),
turnThreeBoxSyncingOn: nodeify(
threeBoxController.turnThreeBoxSyncingOn,
threeBoxController
),
initializeThreeBox: nodeify(this.initializeThreeBox, this),
// setThreeBoxSyncingPermission: nodeify(
// threeBoxController.setThreeBoxSyncingPermission,
// threeBoxController
// ),
// restoreFromThreeBox: nodeify(
// threeBoxController.restoreFromThreeBox,
// threeBoxController
// ),
// setShowRestorePromptToFalse: nodeify(
// threeBoxController.setShowRestorePromptToFalse,
// threeBoxController
// ),
// getThreeBoxLastUpdated: nodeify(
// threeBoxController.getLastUpdated,
// threeBoxController
// ),
// turnThreeBoxSyncingOn: nodeify(
// threeBoxController.turnThreeBoxSyncingOn,
// threeBoxController
// ),
// initializeThreeBox: nodeify(this.initializeThreeBox, this),

// a/b test controller
getAssignedABTestGroupName: nodeify(
Expand Down Expand Up @@ -925,18 +925,18 @@ export default class MetamaskController extends EventEmitter {
await this.preferencesController.syncAddresses(accounts)
await this.txController.pendingTxTracker.updatePendingTxs()

try {
const threeBoxSyncingAllowed = this.threeBoxController.getThreeBoxSyncingState()
if (threeBoxSyncingAllowed && !this.threeBoxController.box) {
// 'await' intentionally omitted to avoid waiting for initialization
this.threeBoxController.init()
this.threeBoxController.turnThreeBoxSyncingOn()
} else if (threeBoxSyncingAllowed && this.threeBoxController.box) {
this.threeBoxController.turnThreeBoxSyncingOn()
}
} catch (error) {
log.error(error)
}
// try {
// const threeBoxSyncingAllowed = this.threeBoxController.getThreeBoxSyncingState()
// if (threeBoxSyncingAllowed && !this.threeBoxController.box) {
// // 'await' intentionally omitted to avoid waiting for initialization
// this.threeBoxController.init()
// this.threeBoxController.turnThreeBoxSyncingOn()
// } else if (threeBoxSyncingAllowed && this.threeBoxController.box) {
// this.threeBoxController.turnThreeBoxSyncingOn()
// }
// } catch (error) {
// log.error(error)
// }

return this.keyringController.fullUpdate()
}
Expand Down Expand Up @@ -2056,9 +2056,9 @@ export default class MetamaskController extends EventEmitter {
await this.preferencesController.removeFromFrequentRpcList(rpcTarget)
}

async initializeThreeBox () {
await this.threeBoxController.init()
}
// async initializeThreeBox () {
// await this.threeBoxController.init()
// }

/**
* Sets whether or not to use the blockie identicon format.
Expand Down
2 changes: 1 addition & 1 deletion docs/add-to-chrome.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Check "Developer mode".
* Alternatively, use the URL `chrome://extensions/` in your address bar
* At the top, click `Load Unpacked Extension`.
* Navigate to your `metamask-plugin/dist/chrome` folder.
* Navigate to your `conflux-portal/dist/chrome` folder.
* Click `Select`.
* Change to your locale via `chrome://settings/languages`
* Restart the browser and test the plugin in your locale
Expand Down
2 changes: 1 addition & 1 deletion docs/add-to-firefox.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Click the button `Load Temporary Add-On`.

Select the file `dist/firefox/manifest.json`.

You can optionally enable debugging, and click `Debug`, for a console window that logs all of Metamask's processes to a single console.
You can optionally enable debugging, and click `Debug`, for a console window that logs all of Conflux-portal's processes to a single console.

If you have problems debugging, try connecting to the IRC channel `#webextensions` on `irc.mozilla.org`.

Expand Down
Binary file modified docs/architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 2649a93

Please sign in to comment.