Merge pull request #8927 from MetaMask/Version-v8.0.3

Version v8.0.3 RC
feature/default_network_editable
Mark Stacey 4 years ago committed by GitHub
commit dd6dd9f284
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      CHANGELOG.md
  2. 216
      app/_locales/it/messages.json
  3. 2
      app/manifest/_base.json
  4. 13
      app/scripts/controllers/network/createInfuraClient.js
  5. 26
      app/scripts/controllers/permissions/index.js
  6. 2
      app/scripts/metamask-controller.js
  7. 8
      package.json
  8. 7
      test/unit/app/controllers/permissions/permissions-controller-test.js
  9. 8
      ui/app/pages/connected-sites/connected-sites.container.js
  10. 6
      ui/app/pages/permissions-connect/permissions-connect.component.js
  11. 5
      ui/app/pages/permissions-connect/permissions-connect.container.js
  12. 4
      ui/app/store/actions.js
  13. 32
      yarn.lock

@ -2,6 +2,12 @@
## Current Develop Branch ## Current Develop Branch
## 8.0.3 Mon Jul 06 2020
- [#8921](https://github.com/MetaMask/metamask-extension/pull/8921): Restore missing 'data' provider event, and fix 'notification' event
- [#8923](https://github.com/MetaMask/metamask-extension/pull/8923): Normalize the 'from' parameter for `eth_sendTransaction`
- [#8924](https://github.com/MetaMask/metamask-extension/pull/8924): Fix handling of multiple `eth_requestAccount` messages from the same domain
- [#8917](https://github.com/MetaMask/metamask-extension/pull/8917): Update Italian translations
## 8.0.2 Fri Jul 03 2020 ## 8.0.2 Fri Jul 03 2020
- [#8907](https://github.com/MetaMask/metamask-extension/pull/8907): Tolerate missing or falsey substitutions - [#8907](https://github.com/MetaMask/metamask-extension/pull/8907): Tolerate missing or falsey substitutions
- [#8908](https://github.com/MetaMask/metamask-extension/pull/8908): Fix activity log inline buttons - [#8908](https://github.com/MetaMask/metamask-extension/pull/8908): Fix activity log inline buttons

@ -1,4 +1,69 @@
{ {
"acceptTermsOfUse": {
"message": "Ho letto e accetto i $1",
"description": "$1 is the `terms` message"
},
"eth_accounts": {
"message": "Accesso agli indirizzi dei tuoi account autorizzati (richiesto)",
"description": "The description for the `eth_accounts` permission"
},
"connectedSites": {
"message": "Siti connessi"
},
"connectedSitesDescription": {
"message": "$1 è connesso a questi siti che hanno accesso all'indirizzo del tuo account.",
"description": "$1 is the account name"
},
"connectedSitesEmptyDescription": {
"message": "$1 non è connesso ad alcun sito.",
"description": "$1 is the account name"
},
"connectedAccountsDescriptionSingular": {
"message": "Hai un account connesso a questo sito."
},
"connectedAccountsDescriptionPlural": {
"message": "Hai $1 account connessi a questo sito.",
"description": "$1 is the number of accounts"
},
"connectedAccountsEmptyDescription": {
"message": "MetaMask non è connesso a questo sito. Per connetterti ad un sito web3, trova il pulsante di connessione."
},
"currentAccountNotConnected": {
"message": "Il tuo account corrente non è connesso"
},
"switchToThisAccount": {
"message": " Passa a questo account"
},
"disconnectThisAccount": {
"message": "Disconnetti questo account"
},
"permissions": {
"message": "Permessi"
},
"showPermissions": {
"message": "Mostra permessi"
},
"authorizedPermissions": {
"message": "Hai autorizzato i seguenti permessi"
},
"connectManually": {
"message": "Connettiti al sito manualmente"
},
"disconnect": {
"message": "Disconnetti"
},
"disconnectAllAccounts": {
"message": "Disconnetti tutti gli account"
},
"disconnectPrompt": {
"message": "Disconnetti $1"
},
"disconnectAllAccountsConfirmationDescription": {
"message": "Sicuro di volerti disconnettere? Il sito potrebbe non funzionare correttamente."
},
"dismiss": {
"message": "Ignora"
},
"showIncomingTransactions": { "showIncomingTransactions": {
"message": "Mostra Transazioni in Ingresso" "message": "Mostra Transazioni in Ingresso"
}, },
@ -8,13 +73,32 @@
"chartOnlyAvailableEth": { "chartOnlyAvailableEth": {
"message": "Grafico disponibile solo per le reti Ethereum." "message": "Grafico disponibile solo per le reti Ethereum."
}, },
"connectedSites": { "connecting": {
"message": "Siti connessi" "message": "Connessione..."
},
"connectWithMetaMask": {
"message": "Connetti con MetaMask"
}, },
"connectTo": { "connectTo": {
"message": "Collegati a $1", "message": "Connettiti a $1",
"description": "$1 is the name/origin of a site/dapp that the user can connect to metamask" "description": "$1 is the name/origin of a site/dapp that the user can connect to metamask"
}, },
"connectToAll": {
"message": "Connettiti a tutti i tuoi $1",
"description": "$1 will be replaced by the translation of connectToAllAccounts"
},
"connectToAllAccounts": {
"message": "account",
"description": "will replace $1 in connectToAll, completing the sentence 'connect to all of your accounts', will be text that shows list of accounts on hover"
},
"connectToMultiple": {
"message": "Connettiti a $1",
"description": "$1 will be replaced by the translation of connectToMultipleNumberOfAccounts"
},
"connectToMultipleNumberOfAccounts": {
"message": "$1 account",
"description": "$1 is the number of accounts to which the web3 site/application is asking to connect; this will substitute $1 in connectToMultiple"
},
"contractInteraction": { "contractInteraction": {
"message": "Interazione Contratto" "message": "Interazione Contratto"
}, },
@ -52,6 +136,12 @@
"accountSelectionRequired": { "accountSelectionRequired": {
"message": "Devi selezionare un account!" "message": "Devi selezionare un account!"
}, },
"active": {
"message": "Attivo"
},
"activity": {
"message": "Attività"
},
"activityLog": { "activityLog": {
"message": "log attività" "message": "log attività"
}, },
@ -91,10 +181,28 @@
"addAcquiredTokens": { "addAcquiredTokens": {
"message": "Aggiungi i token che hai acquistato usando MetaMask" "message": "Aggiungi i token che hai acquistato usando MetaMask"
}, },
"alerts": {
"message": "Avvisi"
},
"alertsSettingsDescription": {
"message": "Attiva o disattiva ogni avviso"
},
"alertSettingsUnconnectedAccount": {
"message": "Navigazione su un sito con un account non connesso"
},
"alertSettingsUnconnectedAccountDescription": {
"message": "Questo avviso è mostrato nel popup quando stai visitando un sito Web3, ma l'account selezionato non è connesso al sito."
},
"allowOriginSpendToken": { "allowOriginSpendToken": {
"message": "Vuoi consentire a $1 di spendere $2?", "message": "Vuoi consentire a $1 di spendere $2?",
"description": "$1 is the url of the site and $2 is the symbol of the token they are requesting to spend" "description": "$1 is the url of the site and $2 is the symbol of the token they are requesting to spend"
}, },
"allowThisSiteTo": {
"message": "Permetti a questo sito di:"
},
"allowExternalExtensionTo": {
"message": "Permetti a questa estensione di:"
},
"allowWithdrawAndSpend": { "allowWithdrawAndSpend": {
"message": "Consenti a $1 di ritirare e spendere fino a questo importo:", "message": "Consenti a $1 di ritirare e spendere fino a questo importo:",
"description": "The url of the site that requested permission to 'withdraw and spend'" "description": "The url of the site that requested permission to 'withdraw and spend'"
@ -122,6 +230,9 @@
"asset": { "asset": {
"message": "Asset" "message": "Asset"
}, },
"assets": {
"message": "Patrimonio"
},
"attemptingConnect": { "attemptingConnect": {
"message": "Tentativo di connessione alla blockchain." "message": "Tentativo di connessione alla blockchain."
}, },
@ -258,6 +369,9 @@
"congratulations": { "congratulations": {
"message": "Congratulazioni" "message": "Congratulazioni"
}, },
"connectAccountOrCreate": {
"message": "Connetti un account o creane uno nuovo"
},
"connectHardwareWallet": { "connectHardwareWallet": {
"message": "Connetti Portafoglio Hardware" "message": "Connetti Portafoglio Hardware"
}, },
@ -333,6 +447,9 @@
"currencyConversion": { "currencyConversion": {
"message": "Conversione Moneta" "message": "Conversione Moneta"
}, },
"currentExtension": {
"message": "Pagina estensione corrente"
},
"currentLanguage": { "currentLanguage": {
"message": "Lingua Corrente" "message": "Lingua Corrente"
}, },
@ -387,6 +504,9 @@
"done": { "done": {
"message": "Finito" "message": "Finito"
}, },
"dontShowThisAgain": {
"message": "Non mostrare di nuovo"
},
"downloadGoogleChrome": { "downloadGoogleChrome": {
"message": "Scarica Google Chrome" "message": "Scarica Google Chrome"
}, },
@ -519,6 +639,9 @@
"failed": { "failed": {
"message": "Fallita" "message": "Fallita"
}, },
"failureMessage": {
"message": "Qualcosa è andato storto e non è possibile completare l'azione"
},
"fast": { "fast": {
"message": "Veloce" "message": "Veloce"
}, },
@ -542,6 +665,10 @@
"from": { "from": {
"message": "Da" "message": "Da"
}, },
"fromAddress": {
"message": "Da: $1",
"description": "$1 is the address to include in the From label. It is typically shortened first using shortenAddress"
},
"functionApprove": { "functionApprove": {
"message": "Funzione: Approve" "message": "Funzione: Approve"
}, },
@ -627,6 +754,10 @@
"hide": { "hide": {
"message": "Nascondi" "message": "Nascondi"
}, },
"hideTokenSymbol": {
"message": "Nascondi $1",
"description": "$1 is the symbol for a token (e.g. 'DAI')"
},
"hideTokenPrompt": { "hideTokenPrompt": {
"message": "Nascondi Token?" "message": "Nascondi Token?"
}, },
@ -777,6 +908,15 @@
"message": { "message": {
"message": "Messaggio" "message": "Messaggio"
}, },
"metaMaskConnectStatusParagraphOne": {
"message": "Ora hai piu controllo sulle connessioni del tuo account in MetaMask."
},
"metaMaskConnectStatusParagraphTwo": {
"message": "Il bottone di stato della connessione mostra se il sito che stai visitando è connesso all'account corrente"
},
"metaMaskConnectStatusParagraphThree": {
"message": "Clicca per gestire i tuo account connessi."
},
"metamaskDescription": { "metamaskDescription": {
"message": "MetaMask è una cassaforte sicura per identità su Ethereum." "message": "MetaMask è una cassaforte sicura per identità su Ethereum."
}, },
@ -863,6 +1003,9 @@
"onlyConnectTrust": { "onlyConnectTrust": {
"message": "Connettiti solo con siti di cui ti fidi." "message": "Connettiti solo con siti di cui ti fidi."
}, },
"onlyAddTrustedNetworks": {
"message": "Una rete Ethereum malevola può mentire sullo stato della blockchain e registrare le tue azioni. Aggiungi solo reti fidate."
},
"optionalChainId": { "optionalChainId": {
"message": "ChainID (opzionale)" "message": "ChainID (opzionale)"
}, },
@ -894,6 +1037,9 @@
"noThanks": { "noThanks": {
"message": "No Grazie" "message": "No Grazie"
}, },
"notCurrentAccount": {
"message": "È questo l'account corretto? È diverso dall'account selezionato nel tuo portafoglio"
},
"notEnoughGas": { "notEnoughGas": {
"message": "Gas Non Sufficiente" "message": "Gas Non Sufficiente"
}, },
@ -937,9 +1083,19 @@
"pending": { "pending": {
"message": "in corso" "message": "in corso"
}, },
"permissionCheckedIconDescription": {
"message": "Hai approvato questo permesso"
},
"permissionUncheckedIconDescription": {
"message": "Non hai approvato questo permesso"
},
"personalAddressDetected": { "personalAddressDetected": {
"message": "Rilevato indirizzo personale. Inserisci l'indirizzo del contratto del token." "message": "Rilevato indirizzo personale. Inserisci l'indirizzo del contratto del token."
}, },
"plusXMore": {
"message": "+ $1 elementi",
"description": "$1 is a number of additional but unshown items in a list- this message will be shown in place of those items"
},
"prev": { "prev": {
"message": "Precedente" "message": "Precedente"
}, },
@ -968,12 +1124,18 @@
"queue": { "queue": {
"message": "Coda" "message": "Coda"
}, },
"queued": {
"message": "In coda"
},
"readdToken": { "readdToken": {
"message": "Puoi aggiungere nuovamente questo token in futuro andando in “Aggiungi token” nel menu delle opzioni del tuo account." "message": "Puoi aggiungere nuovamente questo token in futuro andando in “Aggiungi token” nel menu delle opzioni del tuo account."
}, },
"recents": { "recents": {
"message": "Recenti" "message": "Recenti"
}, },
"receive": {
"message": "Ricevi"
},
"recipientAddress": { "recipientAddress": {
"message": "Indirizzo Destinatario" "message": "Indirizzo Destinatario"
}, },
@ -1110,9 +1272,24 @@
"seedPhrasePlaceholder": { "seedPhrasePlaceholder": {
"message": "Separa ogni parola con un singolo spazio" "message": "Separa ogni parola con un singolo spazio"
}, },
"seedPhrasePlaceholderPaste": {
"message": "Incolla frase seed dagli appunti"
},
"showSeedPhrase": {
"message": "Mostra frase seed"
},
"seedPhraseReq": { "seedPhraseReq": {
"message": "le frasi seed sono lunghe 12 parole" "message": "le frasi seed sono lunghe 12 parole"
}, },
"selectingAllWillAllow": {
"message": "Selezionare tutto consentirà al sito di avere accesso a tutti i tuoi account. Assicurati di fidarti del sito."
},
"selectAccounts": {
"message": "Seleziona account"
},
"selectAll": {
"message": "Seleziona tutti"
},
"selectCurrency": { "selectCurrency": {
"message": "Seleziona Moneta" "message": "Seleziona Moneta"
}, },
@ -1125,6 +1302,9 @@
"selectType": { "selectType": {
"message": "Seleziona Tipo" "message": "Seleziona Tipo"
}, },
"buy": {
"message": "Compra"
},
"send": { "send": {
"message": "Invia" "message": "Invia"
}, },
@ -1143,6 +1323,10 @@
"sentTokens": { "sentTokens": {
"message": "tokens inviati" "message": "tokens inviati"
}, },
"sendSpecifiedTokens": {
"message": "Invia $1",
"description": "Symbol of the specified token"
},
"separateEachWord": { "separateEachWord": {
"message": "Separa ogni parola con un solo spazio" "message": "Separa ogni parola con un solo spazio"
}, },
@ -1252,6 +1436,12 @@
"stateLogError": { "stateLogError": {
"message": "Errore nel recupero dei log di stato." "message": "Errore nel recupero dei log di stato."
}, },
"statusConnected": {
"message": "Connesso"
},
"statusNotConnected": {
"message": "Non connesso"
},
"step1HardwareWallet": { "step1HardwareWallet": {
"message": "1. Connetti Portafoglio Hardware" "message": "1. Connetti Portafoglio Hardware"
}, },
@ -1333,6 +1523,10 @@
"to": { "to": {
"message": "A" "message": "A"
}, },
"toAddress": {
"message": "A: $1",
"description": "$1 is the address to include in the To label. It is typically shortened first using shortenAddress"
},
"toWithColon": { "toWithColon": {
"message": "To:" "message": "To:"
}, },
@ -1345,6 +1539,9 @@
"tokenContractAddress": { "tokenContractAddress": {
"message": "Indirizzo Contratto Token" "message": "Indirizzo Contratto Token"
}, },
"tokenOptions": {
"message": "Opzioni token"
},
"tokenSymbol": { "tokenSymbol": {
"message": "Simbolo Token" "message": "Simbolo Token"
}, },
@ -1393,6 +1590,9 @@
"transactionTime": { "transactionTime": {
"message": "Tempo Conferma Transazione" "message": "Tempo Conferma Transazione"
}, },
"showTransactionTimeDescription": {
"message": "Seleziona per mostrare nella scheda attività una stima dei tempi di transazione per le transazioni in corso sulla rete Ethereum principale. Nota: la stima è approssimativa basata sulle condizioni della rete."
},
"transfer": { "transfer": {
"message": "Trasferisci" "message": "Trasferisci"
}, },
@ -1419,6 +1619,9 @@
"unapproved": { "unapproved": {
"message": "Non approvata" "message": "Non approvata"
}, },
"alertDisableTooltip": {
"message": "Può essere cambiato in \"Impostazioni > Avvisi\""
},
"units": { "units": {
"message": "unità" "message": "unità"
}, },
@ -1497,9 +1700,16 @@
"welcome": { "welcome": {
"message": "Benvenuto nella Beta di MetaMask" "message": "Benvenuto nella Beta di MetaMask"
}, },
"whatsThis": {
"message": "Cos'è?"
},
"writePhrase": { "writePhrase": {
"message": "Scrivi questa frase su un foglio di carta e conservala in un posto sicuro. Se vuoi ancora più sicurezza, scrivila su più fogli e conserva ognuno in 2 o 3 posti diversi. " "message": "Scrivi questa frase su un foglio di carta e conservala in un posto sicuro. Se vuoi ancora più sicurezza, scrivila su più fogli e conserva ognuno in 2 o 3 posti diversi. "
}, },
"xOfY": {
"message": "$1 di $2",
"description": "$1 and $2 are intended to be two numbers, where $2 is a total, and $1 is a count towards that total"
},
"yesLetsTry": { "yesLetsTry": {
"message": "Si, proviamo" "message": "Si, proviamo"
}, },

@ -1,7 +1,7 @@
{ {
"name": "__MSG_appName__", "name": "__MSG_appName__",
"short_name": "__MSG_appName__", "short_name": "__MSG_appName__",
"version": "8.0.2", "version": "8.0.3",
"manifest_version": 2, "manifest_version": 2,
"author": "https://metamask.io", "author": "https://metamask.io",
"description": "__MSG_appDescription__", "description": "__MSG_appDescription__",

@ -8,6 +8,7 @@ import createBlockTrackerInspectorMiddleware from 'eth-json-rpc-middleware/block
import providerFromMiddleware from 'eth-json-rpc-middleware/providerFromMiddleware' import providerFromMiddleware from 'eth-json-rpc-middleware/providerFromMiddleware'
import createInfuraMiddleware from 'eth-json-rpc-infura' import createInfuraMiddleware from 'eth-json-rpc-infura'
import BlockTracker from 'eth-block-tracker' import BlockTracker from 'eth-block-tracker'
import * as networkEnums from './enums'
export default function createInfuraClient ({ network }) { export default function createInfuraClient ({ network }) {
const infuraMiddleware = createInfuraMiddleware({ network, maxAttempts: 5, source: 'metamask' }) const infuraMiddleware = createInfuraMiddleware({ network, maxAttempts: 5, source: 'metamask' })
@ -32,23 +33,23 @@ function createNetworkAndChainIdMiddleware ({ network }) {
switch (network) { switch (network) {
case 'mainnet': case 'mainnet':
netId = '1' netId = networkEnums.MAINNET_NETWORK_ID.toString()
chainId = '0x01' chainId = '0x01'
break break
case 'ropsten': case 'ropsten':
netId = '3' netId = networkEnums.ROPSTEN_NETWORK_ID.toString()
chainId = '0x03' chainId = '0x03'
break break
case 'rinkeby': case 'rinkeby':
netId = '4' netId = networkEnums.RINKEBY_NETWORK_ID.toString()
chainId = '0x04' chainId = '0x04'
break break
case 'kovan': case 'kovan':
netId = '42' netId = networkEnums.KOVAN_NETWORK_ID.toString()
chainId = '0x2a' chainId = networkEnums.KOVAN_CHAIN_ID
break break
case 'goerli': case 'goerli':
netId = '5' netId = networkEnums.GOERLI_NETWORK_ID.toString()
chainId = '0x05' chainId = '0x05'
break break
default: default:

@ -110,12 +110,12 @@ export class PermissionsController {
/** /**
* Request {@code eth_accounts} permissions * Request {@code eth_accounts} permissions
* @param {string} origin - The origin * @param {string} origin - The requesting origin
* @returns {Promise<string>} the request ID * @returns {Promise<string>} The permissions request ID
*/ */
async requestAccountsPermission (origin) { async requestAccountsPermissionWithId (origin) {
const id = nanoid() const id = nanoid()
this._requestPermissions({ origin, id }, { eth_accounts: {} }) this._requestPermissions({ origin }, { eth_accounts: {} }, id)
return id return id
} }
@ -168,18 +168,26 @@ export class PermissionsController {
/** /**
* Submits a permissions request to rpc-cap. Internal, background use only. * Submits a permissions request to rpc-cap. Internal, background use only.
* *
* @param {IOriginMetadata} metadata - The origin metadata. * @param {IOriginMetadata} domain - The external domain metadata.
* @param {IRequestedPermissions} permissions - The requested permissions. * @param {IRequestedPermissions} permissions - The requested permissions.
* @param {string} [id] - The desired id of the permissions request, if any.
* @returns {Promise<IOcapLdCapability[]>} A Promise that resolves with the
* approved permissions, or rejects with an error.
*/ */
_requestPermissions (metadata, permissions) { _requestPermissions (domain, permissions, id) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// rpc-cap assigns an id to the request if there is none, as expected by // rpc-cap assigns an id to the request if there is none, as expected by
// requestUserApproval below // requestUserApproval below
const req = { method: 'wallet_requestPermissions', params: [permissions] } const req = {
id,
method: 'wallet_requestPermissions',
params: [permissions],
}
const res = {} const res = {}
this.permissions.providerMiddlewareFunction( this.permissions.providerMiddlewareFunction(
metadata, req, res, () => {}, _end domain, req, res, () => {}, _end
) )
function _end (_err) { function _end (_err) {
@ -716,7 +724,7 @@ export class PermissionsController {
* @param {string} req - The internal rpc-cap user request object. * @param {string} req - The internal rpc-cap user request object.
*/ */
requestUserApproval: async (req) => { requestUserApproval: async (req) => {
const { origin, metadata: { id } } = req const { metadata: { id, origin } } = req
if (this.pendingApprovalOrigins.has(origin)) { if (this.pendingApprovalOrigins.has(origin)) {
throw ethErrors.rpc.resourceUnavailable( throw ethErrors.rpc.resourceUnavailable(

@ -563,7 +563,7 @@ export default class MetamaskController extends EventEmitter {
removePermissionsFor: permissionsController.removePermissionsFor.bind(permissionsController), removePermissionsFor: permissionsController.removePermissionsFor.bind(permissionsController),
addPermittedAccount: nodeify(permissionsController.addPermittedAccount, permissionsController), addPermittedAccount: nodeify(permissionsController.addPermittedAccount, permissionsController),
removePermittedAccount: nodeify(permissionsController.removePermittedAccount, permissionsController), removePermittedAccount: nodeify(permissionsController.removePermittedAccount, permissionsController),
requestAccountsPermission: nodeify(permissionsController.requestAccountsPermission, permissionsController), requestAccountsPermissionWithId: nodeify(permissionsController.requestAccountsPermissionWithId, permissionsController),
} }
} }

@ -78,7 +78,7 @@
"@metamask/eth-ledger-bridge-keyring": "^0.2.6", "@metamask/eth-ledger-bridge-keyring": "^0.2.6",
"@metamask/eth-token-tracker": "^2.0.0", "@metamask/eth-token-tracker": "^2.0.0",
"@metamask/etherscan-link": "^1.1.0", "@metamask/etherscan-link": "^1.1.0",
"@metamask/inpage-provider": "^5.2.1", "@metamask/inpage-provider": "^6.0.0",
"@popperjs/core": "^2.4.0", "@popperjs/core": "^2.4.0",
"@reduxjs/toolkit": "^1.3.2", "@reduxjs/toolkit": "^1.3.2",
"@sentry/browser": "^5.11.1", "@sentry/browser": "^5.11.1",
@ -106,7 +106,7 @@
"eth-json-rpc-errors": "^2.0.2", "eth-json-rpc-errors": "^2.0.2",
"eth-json-rpc-filters": "^4.1.1", "eth-json-rpc-filters": "^4.1.1",
"eth-json-rpc-infura": "^4.0.2", "eth-json-rpc-infura": "^4.0.2",
"eth-json-rpc-middleware": "^5.0.1", "eth-json-rpc-middleware": "^5.0.2",
"eth-keyring-controller": "^6.0.1", "eth-keyring-controller": "^6.0.1",
"eth-method-registry": "^1.2.0", "eth-method-registry": "^1.2.0",
"eth-phishing-detect": "^1.1.4", "eth-phishing-detect": "^1.1.4",
@ -168,7 +168,7 @@
"redux": "^4.0.5", "redux": "^4.0.5",
"redux-thunk": "^2.3.0", "redux-thunk": "^2.3.0",
"reselect": "^3.0.1", "reselect": "^3.0.1",
"rpc-cap": "^2.1.0", "rpc-cap": "^3.0.1",
"safe-event-emitter": "^1.0.1", "safe-event-emitter": "^1.0.1",
"safe-json-stringify": "^1.2.0", "safe-json-stringify": "^1.2.0",
"single-call-balance-checker-abi": "^1.0.0", "single-call-balance-checker-abi": "^1.0.0",
@ -189,7 +189,7 @@
"@babel/register": "^7.5.5", "@babel/register": "^7.5.5",
"@metamask/eslint-config": "^1.1.0", "@metamask/eslint-config": "^1.1.0",
"@metamask/forwarder": "^1.1.0", "@metamask/forwarder": "^1.1.0",
"@metamask/test-dapp": "^2.2.0", "@metamask/test-dapp": "3.0.0",
"@sentry/cli": "^1.49.0", "@sentry/cli": "^1.49.0",
"@storybook/addon-actions": "^5.3.14", "@storybook/addon-actions": "^5.3.14",
"@storybook/addon-backgrounds": "^5.3.14", "@storybook/addon-backgrounds": "^5.3.14",

@ -1526,12 +1526,13 @@ describe('permissions controller', function () {
permController = initPermController() permController = initPermController()
}) })
it('requestAccountsPermission calls _requestAccountsPermission with an explicit request ID', async function () { it('requestAccountsPermissionWithId calls _requestAccountsPermission with an explicit request ID', async function () {
const _requestPermissions = sinon.stub(permController, '_requestPermissions').resolves() const _requestPermissions = sinon.stub(permController, '_requestPermissions').resolves()
await permController.requestAccountsPermission('example.com') await permController.requestAccountsPermissionWithId('example.com')
assert.ok(_requestPermissions.calledOnceWithExactly( assert.ok(_requestPermissions.calledOnceWithExactly(
sinon.match.object.and(sinon.match.has('origin')).and(sinon.match.has('id')), sinon.match.object.and(sinon.match.has('origin')),
{ eth_accounts: {} }, { eth_accounts: {} },
sinon.match.string.and(sinon.match.truthy),
)) ))
_requestPermissions.restore() _requestPermissions.restore()
}) })

@ -2,7 +2,7 @@ import { connect } from 'react-redux'
import ConnectedSites from './connected-sites.component' import ConnectedSites from './connected-sites.component'
import { import {
getOpenMetamaskTabsIds, getOpenMetamaskTabsIds,
requestAccountsPermission, requestAccountsPermissionWithId,
removePermissionsFor, removePermissionsFor,
removePermittedAccount, removePermittedAccount,
} from '../../store/actions' } from '../../store/actions'
@ -61,7 +61,7 @@ const mapDispatchToProps = (dispatch) => {
[domainKey]: permissionMethodNames, [domainKey]: permissionMethodNames,
})) }))
}, },
requestAccountsPermission: (origin) => dispatch(requestAccountsPermission(origin)), requestAccountsPermissionWithId: (origin) => dispatch(requestAccountsPermissionWithId(origin)),
} }
} }
@ -76,7 +76,7 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => {
const { const {
disconnectAccount, disconnectAccount,
disconnectAllAccounts, disconnectAllAccounts,
requestAccountsPermission: dispatchRequestAccountsPermission, requestAccountsPermissionWithId,
} = dispatchProps } = dispatchProps
const { history } = ownProps const { history } = ownProps
@ -100,7 +100,7 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => {
} }
}, },
requestAccountsPermission: async () => { requestAccountsPermission: async () => {
const id = await dispatchRequestAccountsPermission(tabToConnect.origin) const id = await requestAccountsPermissionWithId(tabToConnect.origin)
history.push(`${CONNECT_ROUTE}/${id}`) history.push(`${CONNECT_ROUTE}/${id}`)
}, },
} }

@ -26,7 +26,7 @@ export default class PermissionConnect extends Component {
addressLastConnectedMap: PropTypes.object.isRequired, addressLastConnectedMap: PropTypes.object.isRequired,
lastConnectedInfo: PropTypes.object.isRequired, lastConnectedInfo: PropTypes.object.isRequired,
permissionsRequestId: PropTypes.string, permissionsRequestId: PropTypes.string,
hasPendingPermissionsRequests: PropTypes.bool.isRequired, hasAdditionalPermissionsRequests: PropTypes.bool.isRequired,
history: PropTypes.object.isRequired, history: PropTypes.object.isRequired,
connectPath: PropTypes.string.isRequired, connectPath: PropTypes.string.isRequired,
confirmPermissionPath: PropTypes.string.isRequired, confirmPermissionPath: PropTypes.string.isRequired,
@ -143,10 +143,10 @@ export default class PermissionConnect extends Component {
} }
_doRedirect () { _doRedirect () {
const { history, hasPendingPermissionsRequests } = this.props const { history, hasAdditionalPermissionsRequests } = this.props
if ( if (
!hasPendingPermissionsRequests && !hasAdditionalPermissionsRequests &&
getEnvironmentType() === ENVIRONMENT_TYPE_NOTIFICATION getEnvironmentType() === ENVIRONMENT_TYPE_NOTIFICATION
) { ) {
global.platform.closeCurrentWindow() global.platform.closeCurrentWindow()

@ -34,7 +34,8 @@ const mapStateToProps = (state, ownProps) => {
const permissionsRequest = permissionsRequests const permissionsRequest = permissionsRequests
.find((permissionsRequest) => permissionsRequest.metadata.id === permissionsRequestId) .find((permissionsRequest) => permissionsRequest.metadata.id === permissionsRequestId)
const hasPendingPermissionsRequests = permissionsRequest // used to determine whether to redirect or show the next permissions request
const hasAdditionalPermissionsRequests = permissionsRequest
? permissionsRequests.length > 1 ? permissionsRequests.length > 1
: permissionsRequests.length > 0 : permissionsRequests.length > 0
@ -82,7 +83,7 @@ const mapStateToProps = (state, ownProps) => {
return { return {
permissionsRequest, permissionsRequest,
permissionsRequestId, permissionsRequestId,
hasPendingPermissionsRequests, hasAdditionalPermissionsRequests,
accounts: accountsWithLabels, accounts: accountsWithLabels,
currentAddress, currentAddress,
origin, origin,

@ -2056,9 +2056,9 @@ export function setPendingTokens (pendingTokens) {
// Permissions // Permissions
export function requestAccountsPermission (origin) { export function requestAccountsPermissionWithId (origin) {
return async (dispatch) => { return async (dispatch) => {
const id = await promisifiedBackground.requestAccountsPermission(origin) const id = await promisifiedBackground.requestAccountsPermissionWithId(origin)
await forceUpdateMetamaskState(dispatch) await forceUpdateMetamaskState(dispatch)
return id return id
} }

@ -1696,10 +1696,10 @@
resolved "https://registry.yarnpkg.com/@metamask/forwarder/-/forwarder-1.1.0.tgz#13829d8244bbf19ea658c0b20d21a77b67de0bdd" resolved "https://registry.yarnpkg.com/@metamask/forwarder/-/forwarder-1.1.0.tgz#13829d8244bbf19ea658c0b20d21a77b67de0bdd"
integrity sha512-Hggj4y0QIjDzKGTXzarhEPIQyFSB2bi2y6YLJNwaT4JmP30UB5Cj6gqoY0M4pj3QT57fzp0BUuGp7F/AUe28tw== integrity sha512-Hggj4y0QIjDzKGTXzarhEPIQyFSB2bi2y6YLJNwaT4JmP30UB5Cj6gqoY0M4pj3QT57fzp0BUuGp7F/AUe28tw==
"@metamask/inpage-provider@^5.2.1": "@metamask/inpage-provider@^6.0.0":
version "5.2.1" version "6.0.0"
resolved "https://registry.yarnpkg.com/@metamask/inpage-provider/-/inpage-provider-5.2.1.tgz#526352fae3541da0952dbf7caa97763558e2d20c" resolved "https://registry.yarnpkg.com/@metamask/inpage-provider/-/inpage-provider-6.0.0.tgz#84a95d30cad77ac1d70507915f6bea04a72e6c4f"
integrity sha512-GP0XuPCxtkAJ+mtOj5CEaSTncXDsMS79pyTiIbIC5RcZ2AMKGCyKcEovQlFm5fkbO6fE5uFnco4fpgMmY7XsTQ== integrity sha512-487gjVIdIKEgqNXu5Q7dtVvv48nwZCLSBxDVoL8NUeQOIw1HARzG5kPusWnOhcOfKdpUCZLl+Mp/c+XhEtZM6Q==
dependencies: dependencies:
eth-json-rpc-errors "^2.0.2" eth-json-rpc-errors "^2.0.2"
fast-deep-equal "^2.0.1" fast-deep-equal "^2.0.1"
@ -1711,10 +1711,10 @@
pump "^3.0.0" pump "^3.0.0"
safe-event-emitter "^1.0.1" safe-event-emitter "^1.0.1"
"@metamask/test-dapp@^2.2.0": "@metamask/test-dapp@3.0.0":
version "2.2.0" version "3.0.0"
resolved "https://registry.yarnpkg.com/@metamask/test-dapp/-/test-dapp-2.2.0.tgz#e48ea589db7ab028ea222ae47ee814c4687e02c6" resolved "https://registry.yarnpkg.com/@metamask/test-dapp/-/test-dapp-3.0.0.tgz#4e9678c872e0f379b4178032a6c4bfac6131a360"
integrity sha512-KX8ZhR/yLBO6yzx/9/BDxHdrTV6nNoOb8LvpUGm8GiLu6jOXETKZj0qfgvL5quWnQ/LRJMEXeuOZWjtXgcVofg== integrity sha512-aXiN68DDjrMpHYIx3uE47HUzLIO327zsqMPFlv/SVEmYiuZgt7Ypndb25llPBJsLQ5cWPwiln6MoTb9DbxaSeA==
"@mrmlnc/readdir-enhanced@^2.2.1": "@mrmlnc/readdir-enhanced@^2.2.1":
version "2.2.1" version "2.2.1"
@ -10180,10 +10180,10 @@ eth-json-rpc-middleware@^4.1.4, eth-json-rpc-middleware@^4.1.5:
pify "^3.0.0" pify "^3.0.0"
safe-event-emitter "^1.0.1" safe-event-emitter "^1.0.1"
eth-json-rpc-middleware@^5.0.1: eth-json-rpc-middleware@^5.0.2:
version "5.0.1" version "5.0.2"
resolved "https://registry.yarnpkg.com/eth-json-rpc-middleware/-/eth-json-rpc-middleware-5.0.1.tgz#0fdebb873337f01dc839ff3d8a5858ecc2c87e6f" resolved "https://registry.yarnpkg.com/eth-json-rpc-middleware/-/eth-json-rpc-middleware-5.0.2.tgz#f8c2c3478e1b28bf85ed48209e543d6335420de2"
integrity sha512-8vIhggej+B331jZG96Qql0GAJBy0HVSHnSCvnzlX7lhVoWcoBfOjt5vnJp07gVoz2QQlpedG+aiGPZwL1PbihA== integrity sha512-Ezx+wphVQJbrkRSx3Z2EPQZa4JgzA0o0ZCPOdoGtYTTT0SpdzC4BnvafxMS7H2o+QsRcvOvOJmzu7hbf2eVR7w==
dependencies: dependencies:
btoa "^1.2.1" btoa "^1.2.1"
clone "^2.1.1" clone "^2.1.1"
@ -23895,10 +23895,10 @@ rn-host-detect@^1.1.5:
resolved "https://registry.yarnpkg.com/rn-host-detect/-/rn-host-detect-1.1.5.tgz#fbecb982b73932f34529e97932b9a63e58d8deb6" resolved "https://registry.yarnpkg.com/rn-host-detect/-/rn-host-detect-1.1.5.tgz#fbecb982b73932f34529e97932b9a63e58d8deb6"
integrity sha512-ufk2dFT3QeP9HyZ/xTuMtW27KnFy815CYitJMqQm+pgG3ZAtHBsrU8nXizNKkqXGy3bQmhEoloVbrfbvMJMqkg== integrity sha512-ufk2dFT3QeP9HyZ/xTuMtW27KnFy815CYitJMqQm+pgG3ZAtHBsrU8nXizNKkqXGy3bQmhEoloVbrfbvMJMqkg==
rpc-cap@^2.1.0: rpc-cap@^3.0.1:
version "2.1.0" version "3.0.1"
resolved "https://registry.yarnpkg.com/rpc-cap/-/rpc-cap-2.1.0.tgz#c53e9bd925cb23c86b1591d621a68692c58070c0" resolved "https://registry.yarnpkg.com/rpc-cap/-/rpc-cap-3.0.1.tgz#127fdc37563736f3e15c4550af31f6866490dd85"
integrity sha512-k4GLWk3IT6r5zETyhiH9tjHqX2sEJ8MdGWv5C4v7wL32hCsx+AnEykbkeVG+EfMox+Vf32C9ieTQPNLKzKwS7A== integrity sha512-egeRnp+QVennA3obsOhVi/XhNSR4qQk8LHu0YFBiEpUHcm+68FqBkjvx0U/3CSXBmrRc8WRLo6kE3T64gWW02w==
dependencies: dependencies:
clone "^2.1.2" clone "^2.1.2"
eth-json-rpc-errors "^2.0.2" eth-json-rpc-errors "^2.0.2"

Loading…
Cancel
Save