|
|
|
@ -63,7 +63,6 @@ import accountImporter from './account-import-strategies' |
|
|
|
|
import selectChainId from './lib/select-chain-id' |
|
|
|
|
import seedPhraseVerifier from './lib/seed-phrase-verifier' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import backgroundMetaMetricsEvent from './lib/background-metametrics' |
|
|
|
|
|
|
|
|
|
export default class MetamaskController extends EventEmitter { |
|
|
|
@ -274,7 +273,6 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
|
this.encryptionPublicKeyManager = new EncryptionPublicKeyManager() |
|
|
|
|
this.typedMessageManager = new TypedMessageManager({ networkController: this.networkController }) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.store.updateStructure({ |
|
|
|
|
AppStateController: this.appStateController.store, |
|
|
|
|
TransactionController: this.txController.store, |
|
|
|
@ -407,7 +405,7 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
|
*/ |
|
|
|
|
getState () { |
|
|
|
|
const { vault } = this.keyringController.store.getState() |
|
|
|
|
const isInitialized = !!vault |
|
|
|
|
const isInitialized = Boolean(vault) |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
...{ isInitialized }, |
|
|
|
@ -929,7 +927,6 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
|
return { ...keyState, identities } |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Account Management
|
|
|
|
|
//
|
|
|
|
@ -1029,7 +1026,6 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
|
return address |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Imports an account with the specified import strategy. |
|
|
|
|
* These are defined in app/scripts/account-import-strategies |
|
|
|
@ -1116,10 +1112,10 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
|
cancelMessage (msgId, cb) { |
|
|
|
|
const { messageManager } = this |
|
|
|
|
messageManager.rejectMsg(msgId) |
|
|
|
|
if (cb && typeof cb === 'function') { |
|
|
|
|
cb(null, this.getState()) |
|
|
|
|
if (!cb || typeof cb !== 'function') { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
cb(null, this.getState()) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// personal_sign methods:
|
|
|
|
@ -1175,10 +1171,10 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
|
cancelPersonalMessage (msgId, cb) { |
|
|
|
|
const messageManager = this.personalMessageManager |
|
|
|
|
messageManager.rejectMsg(msgId) |
|
|
|
|
if (cb && typeof cb === 'function') { |
|
|
|
|
cb(null, this.getState()) |
|
|
|
|
if (!cb || typeof cb !== 'function') { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
cb(null, this.getState()) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// eth_decrypt methods
|
|
|
|
@ -1260,10 +1256,10 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
|
cancelDecryptMessage (msgId, cb) { |
|
|
|
|
const messageManager = this.decryptMessageManager |
|
|
|
|
messageManager.rejectMsg(msgId) |
|
|
|
|
if (cb && typeof cb === 'function') { |
|
|
|
|
cb(null, this.getState()) |
|
|
|
|
if (!cb || typeof cb !== 'function') { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
cb(null, this.getState()) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// eth_getEncryptionPublicKey methods
|
|
|
|
@ -1318,10 +1314,10 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
|
cancelEncryptionPublicKey (msgId, cb) { |
|
|
|
|
const messageManager = this.encryptionPublicKeyManager |
|
|
|
|
messageManager.rejectMsg(msgId) |
|
|
|
|
if (cb && typeof cb === 'function') { |
|
|
|
|
cb(null, this.getState()) |
|
|
|
|
if (!cb || typeof cb !== 'function') { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
cb(null, this.getState()) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// eth_signTypedData methods
|
|
|
|
@ -1379,10 +1375,10 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
|
cancelTypedMessage (msgId, cb) { |
|
|
|
|
const messageManager = this.typedMessageManager |
|
|
|
|
messageManager.rejectMsg(msgId) |
|
|
|
|
if (cb && typeof cb === 'function') { |
|
|
|
|
cb(null, this.getState()) |
|
|
|
|
if (!cb || typeof cb !== 'function') { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
cb(null, this.getState()) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
@ -1872,6 +1868,7 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
|
return |
|
|
|
|
} catch (err) { |
|
|
|
|
cb(err) |
|
|
|
|
// eslint-disable-next-line no-useless-return
|
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1892,7 +1889,6 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
|
return rpcUrl |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* A method for selecting a custom URL for an ethereum RPC provider. |
|
|
|
|
* @param {string} rpcTarget - A URL for a valid Ethereum RPC API. |
|
|
|
@ -1938,6 +1934,7 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
|
return |
|
|
|
|
} catch (err) { |
|
|
|
|
cb(err) |
|
|
|
|
// eslint-disable-next-line no-useless-return
|
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1954,6 +1951,7 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
|
return |
|
|
|
|
} catch (err) { |
|
|
|
|
cb(err) |
|
|
|
|
// eslint-disable-next-line no-useless-return
|
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1970,6 +1968,7 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
|
return |
|
|
|
|
} catch (err) { |
|
|
|
|
cb(err) |
|
|
|
|
// eslint-disable-next-line no-useless-return
|
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1986,6 +1985,7 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
|
return |
|
|
|
|
} catch (err) { |
|
|
|
|
cb(err) |
|
|
|
|
// eslint-disable-next-line no-useless-return
|
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -2002,6 +2002,7 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
|
return |
|
|
|
|
} catch (err) { |
|
|
|
|
cb(err) |
|
|
|
|
// eslint-disable-next-line no-useless-return
|
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -2013,6 +2014,7 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
|
return |
|
|
|
|
} catch (err) { |
|
|
|
|
cb(err) |
|
|
|
|
// eslint-disable-next-line no-useless-return
|
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -2029,11 +2031,11 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
|
return |
|
|
|
|
} catch (err) { |
|
|
|
|
cb(err) |
|
|
|
|
// eslint-disable-next-line no-useless-return
|
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* A method for setting a user's current locale, affecting the language rendered. |
|
|
|
|
* @param {string} key - Locale identifier. |
|
|
|
@ -2046,6 +2048,7 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
|
return |
|
|
|
|
} catch (err) { |
|
|
|
|
cb(err) |
|
|
|
|
// eslint-disable-next-line no-useless-return
|
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|