Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version v0.0.9 RC #58

Merged
merged 6 commits into from
Mar 13, 2020
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ workflows:
- test-unit
- test-unit-global
- test-mozilla-lint
# - test-e2e-chrome
# - test-e2e-firefox
- test-e2e-chrome
- test-e2e-firefox
- test-integration-flat-chrome
- test-integration-flat-firefox
- benchmark:
Expand All @@ -72,7 +72,7 @@ workflows:
requires:
- prep-deps
- prep-build
# - benchmark
- benchmark
- all-tests-pass
- job-publish-release:
filters:
Expand Down
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ module.exports = {
},

rules: {
'arrow-parens': 'error',
'no-mixed-operators': 'error',
'import/default': 'error',
'import/export': 'error',
'import/named': 'error',
Expand Down
293 changes: 273 additions & 20 deletions CHANGELOG.md

Large diffs are not rendered by default.

33 changes: 30 additions & 3 deletions app/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -622,9 +622,6 @@
"gasLimitTooLow": {
"message": "Gas limit must be at least 21000"
},
"gasLimitTooHigh": {
"message": "Gas limit must be at most 1000000"
},
"gasUsed": {
"message": "Gas Used"
},
Expand Down Expand Up @@ -1618,5 +1615,35 @@
},
"zeroGasPriceOnSpeedUpError": {
"message": "Zero gas price on speed up"
},
"decryptRequest": {
"message": "Decrypt request"
},
"decrypt": {
"message": "Decrypt"
},
"decryptMessageNotice": {
"message": "$1 would like to read this message to complete your action",
"description": "$1 is website or dapp name"
},
"decryptMetamask": {
"message": "Decrypt message"
},
"decryptCopy": {
"message": "Copy encrypted message"
},
"decryptInlineError": {
"message": "This message cannot be decrypted due to error: $1",
"description": "$1 is error message"
},
"provide": {
"message": "Provide"
},
"encryptionPublicKeyRequest": {
"message": "Request encryption public key"
},
"encryptionPublicKeyNotice": {
"message": "$1 would like your public encryption key. By consenting, this site will be able to compose encrypted messages to you.",
"description": "$1 is website or dapp name"
}
}
42 changes: 41 additions & 1 deletion app/_locales/ru/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@
"customRPC": {
"message": "Пользовательский RPC"
},
"dataBackupFoundInfo": {
"message": "Некоторые данные вашей учетной записи были экспортированы во время предыдущей установки MetaMask. Это может включать ваши настройки, контакты и токены. Вы хотите импортировать эти данные сейчас?"
},
"decimalsMustZerotoTen": {
"message": "Количество десятичных разрядов должно быть минимум 0 и максимум 36."
},
Expand Down Expand Up @@ -962,8 +965,11 @@
"noConversionRateAvailable": {
"message": "Курсы валют недоступны"
},
"noThanks": {
"message": "Нет, спасибо"
},
"notEnoughGas": {
"message": "Нехватает газа"
"message": "Не хватает газа"
},
"noWebcamFoundTitle": {
"message": "Веб-камера не найдена"
Expand Down Expand Up @@ -1046,6 +1052,10 @@
"restoreAccountWithSeed": {
"message": "Восстановите свой аккаунт с помощью секретной фразы"
},
"restoreWalletPreferences": {
"message": "Были найдены данные экспортированные от $1. Вы желаете восстановить настройки вашего кошелька?",
"description": "$1 is the date at which the data was backed up"
},
"requestsAwaitingAcknowledgement": {
"message": "запросы, ожидающие подтверждения"
},
Expand Down Expand Up @@ -1339,5 +1349,35 @@
},
"yourPrivateSeedPhrase": {
"message": "Ваша сид-фраза"
},
"decryptRequest": {
"message": "Запрос расшифровки"
},
"decrypt": {
"message": "Расшифровать"
},
"decryptMessageNotice": {
"message": "Для $1 необходимо прочитать это сообщение, чтобы завершить Ваше действие",
"description": "$1 is website or dapp name"
},
"decryptMetamask": {
"message": "Расшифровать сообщение"
},
"decryptCopy": {
"message": "Скопировать расшифрованное сообщение"
},
"decryptInlineError": {
"message": "Это сообщение не может быть дешифровано из-за ошибки: $1",
"description": "$1 is error message"
},
"provide": {
"message": "Предоставить"
},
"encryptionPublicKeyRequest": {
"message": "Запрос публичного ключа шифрования"
},
"encryptionPublicKeyNotice": {
"message": "$1 запрашивает ваш открытый ключ шифрования. По согласованию, этот сайт сможет создавать для Вас зашифрованные сообщения.",
"description": "$1 is website or dapp name"
}
}
3 changes: 0 additions & 3 deletions app/_locales/zh_CN/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,6 @@
"gasLimitTooLow": {
"message": "Gas Limit 至少要 21000"
},
"gasLimitTooHigh": {
"message": "Gas Limit 不能超过 1000000"
},
"gasUsed": {
"message": "已使用然气量"
},
Expand Down
3 changes: 0 additions & 3 deletions app/_locales/zh_TW/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,6 @@
"gasLimitTooLow": {
"message": "Gas 上限至少為 21000"
},
"gasLimitTooHigh": {
"message": "Gas 上限至多為 1000000"
},
"gasUsed": {
"message": "Gas 用量"
},
Expand Down
3 changes: 3 additions & 0 deletions app/images/broken-line.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions app/images/permissions-check.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.8",
"version": "0.0.9",
"manifest_version": 2,
"author": "https://conflux-chain.org",
"description": "__MSG_appDescription__",
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/account-import-strategies/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const accountImporter = {
},

strategies: {
'Private Key': privateKey => {
'Private Key': (privateKey) => {
if (!privateKey) {
throw new Error('Cannot import an empty key.')
}
Expand Down
33 changes: 23 additions & 10 deletions app/scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ initialize().catch(log.error)
* @property {number} unapprovedMsgCount - The number of messages in unapprovedMsgs.
* @property {Object} unapprovedPersonalMsgs - An object of messages associated with the currently selected account, mapping a unique ID to the options.
* @property {number} unapprovedPersonalMsgCount - The number of messages in unapprovedPersonalMsgs.
* @property {Object} EncryptionPublicKeyMsgs - An object of messages associated with the currently selected account, mapping a unique ID to the options.
* @property {number} unapprovedEncryptionPublicKeyMsgCount - The number of messages in EncryptionPublicKeyMsgs.
* @property {Object} unapprovedDecryptMsgs - An object of messages associated with the currently selected account, mapping a unique ID to the options.
* @property {number} unapprovedDecryptMsgCount - The number of messages in unapprovedDecryptMsgs.
* @property {Object} unapprovedTypedMsgs - An object of messages associated with the currently selected account, mapping a unique ID to the options.
* @property {number} unapprovedTypedMsgCount - The number of messages in unapprovedTypedMsgs.
* @property {string[]} keyringTypes - An array of unique keyring identifying strings, representing available strategies for creating accounts.
Expand Down Expand Up @@ -191,7 +195,7 @@ async function loadStateFromPersistence () {
}

// report migration errors to sentry
migrator.on('error', err => {
migrator.on('error', (err) => {
// get vault structure without secrets
const vaultStructure = getObjStructure(versionedData)
sentry.captureException(err, {
Expand Down Expand Up @@ -283,7 +287,7 @@ function setupController (initState, initLangCode) {
debounce(1000),
storeTransform(versionifyData),
createStreamSink(persistData),
error => {
(error) => {
log.error('Conflux Portal - Persistence pipeline failed', error)
}
)
Expand Down Expand Up @@ -396,7 +400,7 @@ function setupController (initState, initLangCode) {
const url = new URL(remotePort.sender.url)
const origin = url.hostname

remotePort.onMessage.addListener(msg => {
remotePort.onMessage.addListener((msg) => {
if (msg.data && msg.data.method === 'eth_requestAccounts') {
requestAccountTabIds[origin] = tabId
}
Expand All @@ -420,6 +424,8 @@ function setupController (initState, initLangCode) {
controller.txController.on('update:badge', updateBadge)
controller.messageManager.on('updateBadge', updateBadge)
controller.personalMessageManager.on('updateBadge', updateBadge)
controller.decryptMessageManager.on('updateBadge', updateBadge)
controller.encryptionPublicKeyManager.on('updateBadge', updateBadge)
controller.typedMessageManager.on('updateBadge', updateBadge)
controller.permissionsController.permissions.subscribe(updateBadge)

Expand All @@ -431,18 +437,25 @@ function setupController (initState, initLangCode) {
let label = ''
const unapprovedTxCount = controller.txController.getUnapprovedTxCount()
const unapprovedMsgCount = controller.messageManager.unapprovedMsgCount
const unapprovedPersonalMsgs =
const unapprovedPersonalMsgCount =
controller.personalMessageManager.unapprovedPersonalMsgCount
const unapprovedTypedMsgs =
const unapprovedDecryptMsgCount =
controller.decryptMessageManager.unapprovedDecryptMsgCount
const unapprovedEncryptionPublicKeyMsgCount =
controller.encryptionPublicKeyManager
.unapprovedEncryptionPublicKeyMsgCount
const unapprovedTypedMessagesCount =
controller.typedMessageManager.unapprovedTypedMessagesCount
const pendingPermissionRequests = Object.keys(
controller.permissionsController.permissions.state.permissionsRequests
).length
const count =
unapprovedTxCount +
unapprovedMsgCount +
unapprovedPersonalMsgs +
unapprovedTypedMsgs +
unapprovedPersonalMsgCount +
unapprovedDecryptMsgCount +
unapprovedEncryptionPublicKeyMsgCount +
unapprovedTypedMessagesCount +
pendingPermissionRequests
if (count) {
label = String(count)
Expand All @@ -462,9 +475,9 @@ function setupController (initState, initLangCode) {
* Opens the browser popup for user confirmation
*/
function triggerUi () {
extension.tabs.query({ active: true }, tabs => {
extension.tabs.query({ active: true }, (tabs) => {
const currentlyActiveMetamaskTab = Boolean(
tabs.find(tab => openMetamaskTabsIDs[tab.id])
tabs.find((tab) => openMetamaskTabsIDs[tab.id])
)
if (!popupIsOpen && !currentlyActiveMetamaskTab && !notificationIsOpen) {
notificationManager.showPopup()
Expand All @@ -479,7 +492,7 @@ function triggerUi () {
*/
function openPopup () {
triggerUi()
return new Promise(resolve => {
return new Promise((resolve) => {
const interval = setInterval(() => {
if (!notificationIsOpen) {
clearInterval(interval)
Expand Down
16 changes: 10 additions & 6 deletions app/scripts/contentscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ import PortStream from 'extension-port-stream'
const fs = require('fs')
const path = require('path')

const inpageContent = fs.readFileSync(path.join(__dirname, '..', '..', 'dist', 'chrome', 'inpage.js'), 'utf8')
const inpageSuffix = '//# sourceURL=' + extension.runtime.getURL('inpage.js') + '\n'
const inpageContent = fs.readFileSync(
path.join(__dirname, '..', '..', 'dist', 'chrome', 'inpage.js'),
'utf8'
)
const inpageSuffix =
'//# sourceURL=' + extension.runtime.getURL('inpage.js') + '\n'
const inpageBundle = inpageContent + inpageSuffix

// Eventually this streaming injection could be replaced with:
Expand Down Expand Up @@ -73,10 +77,10 @@ async function setupStreams () {
const extensionMux = new ObjectMultiplex()
extensionMux.setMaxListeners(25)

pump(pageMux, pageStream, pageMux, err =>
pump(pageMux, pageStream, pageMux, (err) =>
logStreamDisconnectWarning('MetaMask Inpage Multiplex', err)
)
pump(extensionMux, extensionStream, extensionMux, err =>
pump(extensionMux, extensionStream, extensionMux, (err) =>
logStreamDisconnectWarning('MetaMask Background Multiplex', err)
)

Expand All @@ -96,7 +100,7 @@ async function setupStreams () {
function forwardTrafficBetweenMuxers (channelName, muxA, muxB) {
const channelA = muxA.createStream(channelName)
const channelB = muxB.createStream(channelName)
pump(channelA, channelB, channelA, err =>
pump(channelA, channelB, channelA, (err) =>
logStreamDisconnectWarning(
`MetaMask muxed traffic for channel "${channelName}" failed.`,
err
Expand Down Expand Up @@ -232,7 +236,7 @@ async function domIsReady () {
return
}
// wait for load
return new Promise(resolve =>
return new Promise((resolve) =>
window.addEventListener('DOMContentLoaded', resolve, { once: true })
)
}
2 changes: 1 addition & 1 deletion app/scripts/controllers/ConfluxWeb/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default class Web3 extends Conflux {

get eth () {
return {
contract: abi => new FakeContract(this, abi),
contract: (abi) => new FakeContract(this, abi),
}
}
}
2 changes: 1 addition & 1 deletion app/scripts/controllers/app-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class AppStateController {
)
this.timer = null

preferencesStore.subscribe(state => {
preferencesStore.subscribe((state) => {
this._setInactiveTimeout(state.preferences.autoLockTimeLimit)
})

Expand Down
2 changes: 1 addition & 1 deletion app/scripts/controllers/cached-balances.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class CachedBalancesController {
const { cachedBalances } = this.store.getState()
const currentNetworkBalancesToCache = { ...cachedBalances[currentNetwork] }

Object.keys(newAccounts).forEach(accountID => {
Object.keys(newAccounts).forEach((accountID) => {
const account = newAccounts[accountID]

if (account.balance) {
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/controllers/detect-tokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class DetectTokensController {
}
this._preferences = preferences
preferences.store.subscribe(({ tokens = [] }) => {
this.tokenAddresses = tokens.map(obj => {
this.tokenAddresses = tokens.map((obj) => {
return obj.address
})
})
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/controllers/ens/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class EnsController {
}

this.store = new ObservableStore(initState)
networkStore.subscribe(network => {
networkStore.subscribe((network) => {
this.store.putState(initState)
if (Ens.getNetworkEnsSupport(network)) {
this._ens = new Ens({
Expand Down
Loading