|
|
@ -229,8 +229,10 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
|
|
|
|
|
|
|
|
// now we can initialize the RPC provider, which other controllers require
|
|
|
|
// now we can initialize the RPC provider, which other controllers require
|
|
|
|
this.initializeProvider(); |
|
|
|
this.initializeProvider(); |
|
|
|
this.provider = this.networkController.getProviderAndBlockTracker().provider; |
|
|
|
this.provider = |
|
|
|
this.blockTracker = this.networkController.getProviderAndBlockTracker().blockTracker; |
|
|
|
this.networkController.getProviderAndBlockTracker().provider; |
|
|
|
|
|
|
|
this.blockTracker = |
|
|
|
|
|
|
|
this.networkController.getProviderAndBlockTracker().blockTracker; |
|
|
|
|
|
|
|
|
|
|
|
this.preferencesController = new PreferencesController({ |
|
|
|
this.preferencesController = new PreferencesController({ |
|
|
|
initState: initState.PreferencesController, |
|
|
|
initState: initState.PreferencesController, |
|
|
@ -276,16 +278,19 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
|
|
|
|
|
|
|
|
this.collectiblesController = new CollectiblesController( |
|
|
|
this.collectiblesController = new CollectiblesController( |
|
|
|
{ |
|
|
|
{ |
|
|
|
onPreferencesStateChange: this.preferencesController.store.subscribe.bind( |
|
|
|
onPreferencesStateChange: |
|
|
|
|
|
|
|
this.preferencesController.store.subscribe.bind( |
|
|
|
this.preferencesController.store, |
|
|
|
this.preferencesController.store, |
|
|
|
), |
|
|
|
), |
|
|
|
onNetworkStateChange: this.networkController.store.subscribe.bind( |
|
|
|
onNetworkStateChange: this.networkController.store.subscribe.bind( |
|
|
|
this.networkController.store, |
|
|
|
this.networkController.store, |
|
|
|
), |
|
|
|
), |
|
|
|
getERC721AssetName: this.assetsContractController.getERC721AssetName.bind( |
|
|
|
getERC721AssetName: |
|
|
|
|
|
|
|
this.assetsContractController.getERC721AssetName.bind( |
|
|
|
this.assetsContractController, |
|
|
|
this.assetsContractController, |
|
|
|
), |
|
|
|
), |
|
|
|
getERC721AssetSymbol: this.assetsContractController.getERC721AssetSymbol.bind( |
|
|
|
getERC721AssetSymbol: |
|
|
|
|
|
|
|
this.assetsContractController.getERC721AssetSymbol.bind( |
|
|
|
this.assetsContractController, |
|
|
|
this.assetsContractController, |
|
|
|
), |
|
|
|
), |
|
|
|
getERC721TokenURI: this.assetsContractController.getERC721TokenURI.bind( |
|
|
|
getERC721TokenURI: this.assetsContractController.getERC721TokenURI.bind( |
|
|
@ -294,10 +299,12 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
getERC721OwnerOf: this.assetsContractController.getERC721OwnerOf.bind( |
|
|
|
getERC721OwnerOf: this.assetsContractController.getERC721OwnerOf.bind( |
|
|
|
this.assetsContractController, |
|
|
|
this.assetsContractController, |
|
|
|
), |
|
|
|
), |
|
|
|
getERC1155BalanceOf: this.assetsContractController.getERC1155BalanceOf.bind( |
|
|
|
getERC1155BalanceOf: |
|
|
|
|
|
|
|
this.assetsContractController.getERC1155BalanceOf.bind( |
|
|
|
this.assetsContractController, |
|
|
|
this.assetsContractController, |
|
|
|
), |
|
|
|
), |
|
|
|
getERC1155TokenURI: this.assetsContractController.getERC1155TokenURI.bind( |
|
|
|
getERC1155TokenURI: |
|
|
|
|
|
|
|
this.assetsContractController.getERC1155TokenURI.bind( |
|
|
|
this.assetsContractController, |
|
|
|
this.assetsContractController, |
|
|
|
), |
|
|
|
), |
|
|
|
onCollectibleAdded: ({ address, symbol, tokenId, standard, source }) => |
|
|
|
onCollectibleAdded: ({ address, symbol, tokenId, standard, source }) => |
|
|
@ -327,14 +334,16 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
{ |
|
|
|
{ |
|
|
|
onCollectiblesStateChange: (listener) => |
|
|
|
onCollectiblesStateChange: (listener) => |
|
|
|
this.collectiblesController.subscribe(listener), |
|
|
|
this.collectiblesController.subscribe(listener), |
|
|
|
onPreferencesStateChange: this.preferencesController.store.subscribe.bind( |
|
|
|
onPreferencesStateChange: |
|
|
|
|
|
|
|
this.preferencesController.store.subscribe.bind( |
|
|
|
this.preferencesController.store, |
|
|
|
this.preferencesController.store, |
|
|
|
), |
|
|
|
), |
|
|
|
onNetworkStateChange: this.networkController.store.subscribe.bind( |
|
|
|
onNetworkStateChange: this.networkController.store.subscribe.bind( |
|
|
|
this.networkController.store, |
|
|
|
this.networkController.store, |
|
|
|
), |
|
|
|
), |
|
|
|
getOpenSeaApiKey: () => this.collectiblesController.openSeaApiKey, |
|
|
|
getOpenSeaApiKey: () => this.collectiblesController.openSeaApiKey, |
|
|
|
getBalancesInSingleCall: this.assetsContractController.getBalancesInSingleCall.bind( |
|
|
|
getBalancesInSingleCall: |
|
|
|
|
|
|
|
this.assetsContractController.getBalancesInSingleCall.bind( |
|
|
|
this.assetsContractController, |
|
|
|
this.assetsContractController, |
|
|
|
), |
|
|
|
), |
|
|
|
addCollectible: this.collectiblesController.addCollectible.bind( |
|
|
|
addCollectible: this.collectiblesController.addCollectible.bind( |
|
|
@ -385,12 +394,12 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
this.networkController, |
|
|
|
this.networkController, |
|
|
|
NETWORK_EVENTS.NETWORK_DID_CHANGE, |
|
|
|
NETWORK_EVENTS.NETWORK_DID_CHANGE, |
|
|
|
), |
|
|
|
), |
|
|
|
getCurrentNetworkEIP1559Compatibility: this.networkController.getEIP1559Compatibility.bind( |
|
|
|
getCurrentNetworkEIP1559Compatibility: |
|
|
|
|
|
|
|
this.networkController.getEIP1559Compatibility.bind( |
|
|
|
this.networkController, |
|
|
|
this.networkController, |
|
|
|
), |
|
|
|
), |
|
|
|
getCurrentAccountEIP1559Compatibility: this.getCurrentAccountEIP1559Compatibility.bind( |
|
|
|
getCurrentAccountEIP1559Compatibility: |
|
|
|
this, |
|
|
|
this.getCurrentAccountEIP1559Compatibility.bind(this), |
|
|
|
), |
|
|
|
|
|
|
|
legacyAPIEndpoint: `${gasApiBaseUrl}/networks/<chain_id>/gasPrices`, |
|
|
|
legacyAPIEndpoint: `${gasApiBaseUrl}/networks/<chain_id>/gasPrices`, |
|
|
|
EIP1559APIEndpoint: `${gasApiBaseUrl}/networks/<chain_id>/suggestedGasFees`, |
|
|
|
EIP1559APIEndpoint: `${gasApiBaseUrl}/networks/<chain_id>/suggestedGasFees`, |
|
|
|
getCurrentNetworkLegacyGasAPICompatibility: () => { |
|
|
|
getCurrentNetworkLegacyGasAPICompatibility: () => { |
|
|
@ -587,7 +596,8 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
const accountsMissingIdentities = accounts.filter( |
|
|
|
const accountsMissingIdentities = accounts.filter( |
|
|
|
(address) => !identities[address], |
|
|
|
(address) => !identities[address], |
|
|
|
); |
|
|
|
); |
|
|
|
const keyringTypesWithMissingIdentities = accountsMissingIdentities.map( |
|
|
|
const keyringTypesWithMissingIdentities = |
|
|
|
|
|
|
|
accountsMissingIdentities.map( |
|
|
|
(address) => |
|
|
|
(address) => |
|
|
|
this.keyringController.getKeyringForAccount(address)?.type, |
|
|
|
this.keyringController.getKeyringForAccount(address)?.type, |
|
|
|
); |
|
|
|
); |
|
|
@ -790,12 +800,12 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
getProviderConfig: this.networkController.getProviderConfig.bind( |
|
|
|
getProviderConfig: this.networkController.getProviderConfig.bind( |
|
|
|
this.networkController, |
|
|
|
this.networkController, |
|
|
|
), |
|
|
|
), |
|
|
|
getCurrentNetworkEIP1559Compatibility: this.networkController.getEIP1559Compatibility.bind( |
|
|
|
getCurrentNetworkEIP1559Compatibility: |
|
|
|
|
|
|
|
this.networkController.getEIP1559Compatibility.bind( |
|
|
|
this.networkController, |
|
|
|
this.networkController, |
|
|
|
), |
|
|
|
), |
|
|
|
getCurrentAccountEIP1559Compatibility: this.getCurrentAccountEIP1559Compatibility.bind( |
|
|
|
getCurrentAccountEIP1559Compatibility: |
|
|
|
this, |
|
|
|
this.getCurrentAccountEIP1559Compatibility.bind(this), |
|
|
|
), |
|
|
|
|
|
|
|
networkStore: this.networkController.networkStore, |
|
|
|
networkStore: this.networkController.networkStore, |
|
|
|
getCurrentChainId: this.networkController.getCurrentChainId.bind( |
|
|
|
getCurrentChainId: this.networkController.getCurrentChainId.bind( |
|
|
|
this.networkController, |
|
|
|
this.networkController, |
|
|
@ -813,10 +823,12 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
updateEventFragment: this.metaMetricsController.updateEventFragment.bind( |
|
|
|
updateEventFragment: this.metaMetricsController.updateEventFragment.bind( |
|
|
|
this.metaMetricsController, |
|
|
|
this.metaMetricsController, |
|
|
|
), |
|
|
|
), |
|
|
|
finalizeEventFragment: this.metaMetricsController.finalizeEventFragment.bind( |
|
|
|
finalizeEventFragment: |
|
|
|
|
|
|
|
this.metaMetricsController.finalizeEventFragment.bind( |
|
|
|
this.metaMetricsController, |
|
|
|
this.metaMetricsController, |
|
|
|
), |
|
|
|
), |
|
|
|
getEventFragmentById: this.metaMetricsController.getEventFragmentById.bind( |
|
|
|
getEventFragmentById: |
|
|
|
|
|
|
|
this.metaMetricsController.getEventFragmentById.bind( |
|
|
|
this.metaMetricsController, |
|
|
|
this.metaMetricsController, |
|
|
|
), |
|
|
|
), |
|
|
|
trackMetaMetricsEvent: this.metaMetricsController.trackEvent.bind( |
|
|
|
trackMetaMetricsEvent: this.metaMetricsController.trackEvent.bind( |
|
|
@ -824,15 +836,14 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
), |
|
|
|
), |
|
|
|
getParticipateInMetrics: () => |
|
|
|
getParticipateInMetrics: () => |
|
|
|
this.metaMetricsController.state.participateInMetaMetrics, |
|
|
|
this.metaMetricsController.state.participateInMetaMetrics, |
|
|
|
getEIP1559GasFeeEstimates: this.gasFeeController.fetchGasFeeEstimates.bind( |
|
|
|
getEIP1559GasFeeEstimates: |
|
|
|
this.gasFeeController, |
|
|
|
this.gasFeeController.fetchGasFeeEstimates.bind(this.gasFeeController), |
|
|
|
), |
|
|
|
getExternalPendingTransactions: |
|
|
|
getExternalPendingTransactions: this.getExternalPendingTransactions.bind( |
|
|
|
this.getExternalPendingTransactions.bind(this), |
|
|
|
this, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
getAccountType: this.getAccountType.bind(this), |
|
|
|
getAccountType: this.getAccountType.bind(this), |
|
|
|
getDeviceModel: this.getDeviceModel.bind(this), |
|
|
|
getDeviceModel: this.getDeviceModel.bind(this), |
|
|
|
getTokenStandardAndDetails: this.assetsContractController.getTokenStandardAndDetails.bind( |
|
|
|
getTokenStandardAndDetails: |
|
|
|
|
|
|
|
this.assetsContractController.getTokenStandardAndDetails.bind( |
|
|
|
this.assetsContractController, |
|
|
|
this.assetsContractController, |
|
|
|
), |
|
|
|
), |
|
|
|
}); |
|
|
|
}); |
|
|
@ -844,7 +855,8 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
status === TRANSACTION_STATUSES.FAILED |
|
|
|
status === TRANSACTION_STATUSES.FAILED |
|
|
|
) { |
|
|
|
) { |
|
|
|
const txMeta = this.txController.txStateManager.getTransaction(txId); |
|
|
|
const txMeta = this.txController.txStateManager.getTransaction(txId); |
|
|
|
const frequentRpcListDetail = this.preferencesController.getFrequentRpcListDetail(); |
|
|
|
const frequentRpcListDetail = |
|
|
|
|
|
|
|
this.preferencesController.getFrequentRpcListDetail(); |
|
|
|
let rpcPrefs = {}; |
|
|
|
let rpcPrefs = {}; |
|
|
|
if (txMeta.chainId) { |
|
|
|
if (txMeta.chainId) { |
|
|
|
const rpcSettings = frequentRpcListDetail.find( |
|
|
|
const rpcSettings = frequentRpcListDetail.find( |
|
|
@ -971,9 +983,8 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
getCurrentChainId: this.networkController.getCurrentChainId.bind( |
|
|
|
getCurrentChainId: this.networkController.getCurrentChainId.bind( |
|
|
|
this.networkController, |
|
|
|
this.networkController, |
|
|
|
), |
|
|
|
), |
|
|
|
getEIP1559GasFeeEstimates: this.gasFeeController.fetchGasFeeEstimates.bind( |
|
|
|
getEIP1559GasFeeEstimates: |
|
|
|
this.gasFeeController, |
|
|
|
this.gasFeeController.fetchGasFeeEstimates.bind(this.gasFeeController), |
|
|
|
), |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
this.smartTransactionsController = new SmartTransactionsController( |
|
|
|
this.smartTransactionsController = new SmartTransactionsController( |
|
|
|
{ |
|
|
|
{ |
|
|
@ -986,9 +997,8 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
getNonceLock: this.txController.nonceTracker.getNonceLock.bind( |
|
|
|
getNonceLock: this.txController.nonceTracker.getNonceLock.bind( |
|
|
|
this.txController.nonceTracker, |
|
|
|
this.txController.nonceTracker, |
|
|
|
), |
|
|
|
), |
|
|
|
confirmExternalTransaction: this.txController.confirmExternalTransaction.bind( |
|
|
|
confirmExternalTransaction: |
|
|
|
this.txController, |
|
|
|
this.txController.confirmExternalTransaction.bind(this.txController), |
|
|
|
), |
|
|
|
|
|
|
|
provider: this.provider, |
|
|
|
provider: this.provider, |
|
|
|
trackMetaMetricsEvent: this.metaMetricsController.trackEvent.bind( |
|
|
|
trackMetaMetricsEvent: this.metaMetricsController.trackEvent.bind( |
|
|
|
this.metaMetricsController, |
|
|
|
this.metaMetricsController, |
|
|
@ -1065,8 +1075,8 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
CurrencyController: this.currencyRateController, |
|
|
|
CurrencyController: this.currencyRateController, |
|
|
|
AlertController: this.alertController.store, |
|
|
|
AlertController: this.alertController.store, |
|
|
|
OnboardingController: this.onboardingController.store, |
|
|
|
OnboardingController: this.onboardingController.store, |
|
|
|
IncomingTransactionsController: this.incomingTransactionsController |
|
|
|
IncomingTransactionsController: |
|
|
|
.store, |
|
|
|
this.incomingTransactionsController.store, |
|
|
|
PermissionController: this.permissionController, |
|
|
|
PermissionController: this.permissionController, |
|
|
|
PermissionLogController: this.permissionLogController.store, |
|
|
|
PermissionLogController: this.permissionLogController.store, |
|
|
|
SubjectMetadataController: this.subjectMetadataController, |
|
|
|
SubjectMetadataController: this.subjectMetadataController, |
|
|
@ -1353,7 +1363,8 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
{ suppressUnauthorizedError = true } = {}, |
|
|
|
{ suppressUnauthorizedError = true } = {}, |
|
|
|
) => { |
|
|
|
) => { |
|
|
|
if (origin === ORIGIN_METAMASK) { |
|
|
|
if (origin === ORIGIN_METAMASK) { |
|
|
|
const selectedAddress = this.preferencesController.getSelectedAddress(); |
|
|
|
const selectedAddress = |
|
|
|
|
|
|
|
this.preferencesController.getSelectedAddress(); |
|
|
|
return selectedAddress ? [selectedAddress] : []; |
|
|
|
return selectedAddress ? [selectedAddress] : []; |
|
|
|
} else if (this.isUnlocked()) { |
|
|
|
} else if (this.isUnlocked()) { |
|
|
|
return await this.getPermittedAccounts(origin, { |
|
|
|
return await this.getPermittedAccounts(origin, { |
|
|
@ -1381,9 +1392,8 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
}, |
|
|
|
}, |
|
|
|
})[0], |
|
|
|
})[0], |
|
|
|
}; |
|
|
|
}; |
|
|
|
const providerProxy = this.networkController.initializeProvider( |
|
|
|
const providerProxy = |
|
|
|
providerOpts, |
|
|
|
this.networkController.initializeProvider(providerOpts); |
|
|
|
); |
|
|
|
|
|
|
|
return providerProxy; |
|
|
|
return providerProxy; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1525,7 +1535,8 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
setUseTokenDetection: preferencesController.setUseTokenDetection.bind( |
|
|
|
setUseTokenDetection: preferencesController.setUseTokenDetection.bind( |
|
|
|
preferencesController, |
|
|
|
preferencesController, |
|
|
|
), |
|
|
|
), |
|
|
|
setUseCollectibleDetection: preferencesController.setUseCollectibleDetection.bind( |
|
|
|
setUseCollectibleDetection: |
|
|
|
|
|
|
|
preferencesController.setUseCollectibleDetection.bind( |
|
|
|
preferencesController, |
|
|
|
preferencesController, |
|
|
|
), |
|
|
|
), |
|
|
|
setOpenSeaEnabled: preferencesController.setOpenSeaEnabled.bind( |
|
|
|
setOpenSeaEnabled: preferencesController.setOpenSeaEnabled.bind( |
|
|
@ -1534,7 +1545,8 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
setIpfsGateway: preferencesController.setIpfsGateway.bind( |
|
|
|
setIpfsGateway: preferencesController.setIpfsGateway.bind( |
|
|
|
preferencesController, |
|
|
|
preferencesController, |
|
|
|
), |
|
|
|
), |
|
|
|
setParticipateInMetaMetrics: metaMetricsController.setParticipateInMetaMetrics.bind( |
|
|
|
setParticipateInMetaMetrics: |
|
|
|
|
|
|
|
metaMetricsController.setParticipateInMetaMetrics.bind( |
|
|
|
metaMetricsController, |
|
|
|
metaMetricsController, |
|
|
|
), |
|
|
|
), |
|
|
|
setCurrentLocale: preferencesController.setCurrentLocale.bind( |
|
|
|
setCurrentLocale: preferencesController.setCurrentLocale.bind( |
|
|
@ -1559,32 +1571,24 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
forgetDevice: this.forgetDevice.bind(this), |
|
|
|
forgetDevice: this.forgetDevice.bind(this), |
|
|
|
checkHardwareStatus: this.checkHardwareStatus.bind(this), |
|
|
|
checkHardwareStatus: this.checkHardwareStatus.bind(this), |
|
|
|
unlockHardwareWalletAccount: this.unlockHardwareWalletAccount.bind(this), |
|
|
|
unlockHardwareWalletAccount: this.unlockHardwareWalletAccount.bind(this), |
|
|
|
setLedgerTransportPreference: this.setLedgerTransportPreference.bind( |
|
|
|
setLedgerTransportPreference: |
|
|
|
this, |
|
|
|
this.setLedgerTransportPreference.bind(this), |
|
|
|
), |
|
|
|
attemptLedgerTransportCreation: |
|
|
|
attemptLedgerTransportCreation: this.attemptLedgerTransportCreation.bind( |
|
|
|
this.attemptLedgerTransportCreation.bind(this), |
|
|
|
this, |
|
|
|
establishLedgerTransportPreference: |
|
|
|
), |
|
|
|
this.establishLedgerTransportPreference.bind(this), |
|
|
|
establishLedgerTransportPreference: this.establishLedgerTransportPreference.bind( |
|
|
|
|
|
|
|
this, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// qr hardware devices
|
|
|
|
// qr hardware devices
|
|
|
|
submitQRHardwareCryptoHDKey: qrHardwareKeyring.submitCryptoHDKey.bind( |
|
|
|
submitQRHardwareCryptoHDKey: |
|
|
|
qrHardwareKeyring, |
|
|
|
qrHardwareKeyring.submitCryptoHDKey.bind(qrHardwareKeyring), |
|
|
|
), |
|
|
|
submitQRHardwareCryptoAccount: |
|
|
|
submitQRHardwareCryptoAccount: qrHardwareKeyring.submitCryptoAccount.bind( |
|
|
|
qrHardwareKeyring.submitCryptoAccount.bind(qrHardwareKeyring), |
|
|
|
qrHardwareKeyring, |
|
|
|
cancelSyncQRHardware: |
|
|
|
), |
|
|
|
qrHardwareKeyring.cancelSync.bind(qrHardwareKeyring), |
|
|
|
cancelSyncQRHardware: qrHardwareKeyring.cancelSync.bind( |
|
|
|
submitQRHardwareSignature: |
|
|
|
qrHardwareKeyring, |
|
|
|
qrHardwareKeyring.submitSignature.bind(qrHardwareKeyring), |
|
|
|
), |
|
|
|
cancelQRHardwareSignRequest: |
|
|
|
submitQRHardwareSignature: qrHardwareKeyring.submitSignature.bind( |
|
|
|
qrHardwareKeyring.cancelSignRequest.bind(qrHardwareKeyring), |
|
|
|
qrHardwareKeyring, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
cancelQRHardwareSignRequest: qrHardwareKeyring.cancelSignRequest.bind( |
|
|
|
|
|
|
|
qrHardwareKeyring, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// mobile
|
|
|
|
// mobile
|
|
|
|
fetchInfoToSync: this.fetchInfoToSync.bind(this), |
|
|
|
fetchInfoToSync: this.fetchInfoToSync.bind(this), |
|
|
@ -1594,12 +1598,10 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
verifyPassword: this.verifyPassword.bind(this), |
|
|
|
verifyPassword: this.verifyPassword.bind(this), |
|
|
|
|
|
|
|
|
|
|
|
// network management
|
|
|
|
// network management
|
|
|
|
setProviderType: networkController.setProviderType.bind( |
|
|
|
setProviderType: |
|
|
|
networkController, |
|
|
|
networkController.setProviderType.bind(networkController), |
|
|
|
), |
|
|
|
rollbackToPreviousProvider: |
|
|
|
rollbackToPreviousProvider: networkController.rollbackToPreviousProvider.bind( |
|
|
|
networkController.rollbackToPreviousProvider.bind(networkController), |
|
|
|
networkController, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
setCustomRpc: this.setCustomRpc.bind(this), |
|
|
|
setCustomRpc: this.setCustomRpc.bind(this), |
|
|
|
updateAndSetCustomRpc: this.updateAndSetCustomRpc.bind(this), |
|
|
|
updateAndSetCustomRpc: this.updateAndSetCustomRpc.bind(this), |
|
|
|
delCustomRpc: this.delCustomRpc.bind(this), |
|
|
|
delCustomRpc: this.delCustomRpc.bind(this), |
|
|
@ -1610,12 +1612,10 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
preferencesController, |
|
|
|
preferencesController, |
|
|
|
), |
|
|
|
), |
|
|
|
addToken: tokensController.addToken.bind(tokensController), |
|
|
|
addToken: tokensController.addToken.bind(tokensController), |
|
|
|
rejectWatchAsset: tokensController.rejectWatchAsset.bind( |
|
|
|
rejectWatchAsset: |
|
|
|
tokensController, |
|
|
|
tokensController.rejectWatchAsset.bind(tokensController), |
|
|
|
), |
|
|
|
acceptWatchAsset: |
|
|
|
acceptWatchAsset: tokensController.acceptWatchAsset.bind( |
|
|
|
tokensController.acceptWatchAsset.bind(tokensController), |
|
|
|
tokensController, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
updateTokenType: tokensController.updateTokenType.bind(tokensController), |
|
|
|
updateTokenType: tokensController.updateTokenType.bind(tokensController), |
|
|
|
setAccountLabel: preferencesController.setAccountLabel.bind( |
|
|
|
setAccountLabel: preferencesController.setAccountLabel.bind( |
|
|
|
preferencesController, |
|
|
|
preferencesController, |
|
|
@ -1630,7 +1630,8 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
addKnownMethodData: preferencesController.addKnownMethodData.bind( |
|
|
|
addKnownMethodData: preferencesController.addKnownMethodData.bind( |
|
|
|
preferencesController, |
|
|
|
preferencesController, |
|
|
|
), |
|
|
|
), |
|
|
|
setDismissSeedBackUpReminder: preferencesController.setDismissSeedBackUpReminder.bind( |
|
|
|
setDismissSeedBackUpReminder: |
|
|
|
|
|
|
|
preferencesController.setDismissSeedBackUpReminder.bind( |
|
|
|
preferencesController, |
|
|
|
preferencesController, |
|
|
|
), |
|
|
|
), |
|
|
|
setAdvancedGasFee: preferencesController.setAdvancedGasFee.bind( |
|
|
|
setAdvancedGasFee: preferencesController.setAdvancedGasFee.bind( |
|
|
@ -1640,7 +1641,8 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
preferencesController, |
|
|
|
preferencesController, |
|
|
|
), |
|
|
|
), |
|
|
|
setTheme: preferencesController.setTheme.bind(preferencesController), |
|
|
|
setTheme: preferencesController.setTheme.bind(preferencesController), |
|
|
|
setCustomNetworkListEnabled: preferencesController.setCustomNetworkListEnabled.bind( |
|
|
|
setCustomNetworkListEnabled: |
|
|
|
|
|
|
|
preferencesController.setCustomNetworkListEnabled.bind( |
|
|
|
preferencesController, |
|
|
|
preferencesController, |
|
|
|
), |
|
|
|
), |
|
|
|
// AssetsContractController
|
|
|
|
// AssetsContractController
|
|
|
@ -1651,11 +1653,13 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
collectiblesController, |
|
|
|
collectiblesController, |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
addCollectibleVerifyOwnership: collectiblesController.addCollectibleVerifyOwnership.bind( |
|
|
|
addCollectibleVerifyOwnership: |
|
|
|
|
|
|
|
collectiblesController.addCollectibleVerifyOwnership.bind( |
|
|
|
collectiblesController, |
|
|
|
collectiblesController, |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
removeAndIgnoreCollectible: collectiblesController.removeAndIgnoreCollectible.bind( |
|
|
|
removeAndIgnoreCollectible: |
|
|
|
|
|
|
|
collectiblesController.removeAndIgnoreCollectible.bind( |
|
|
|
collectiblesController, |
|
|
|
collectiblesController, |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
@ -1663,11 +1667,13 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
collectiblesController, |
|
|
|
collectiblesController, |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
checkAndUpdateAllCollectiblesOwnershipStatus: collectiblesController.checkAndUpdateAllCollectiblesOwnershipStatus.bind( |
|
|
|
checkAndUpdateAllCollectiblesOwnershipStatus: |
|
|
|
|
|
|
|
collectiblesController.checkAndUpdateAllCollectiblesOwnershipStatus.bind( |
|
|
|
collectiblesController, |
|
|
|
collectiblesController, |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
checkAndUpdateSingleCollectibleOwnershipStatus: collectiblesController.checkAndUpdateSingleCollectibleOwnershipStatus.bind( |
|
|
|
checkAndUpdateSingleCollectibleOwnershipStatus: |
|
|
|
|
|
|
|
collectiblesController.checkAndUpdateSingleCollectibleOwnershipStatus.bind( |
|
|
|
collectiblesController, |
|
|
|
collectiblesController, |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
@ -1682,37 +1688,41 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
// AppStateController
|
|
|
|
// AppStateController
|
|
|
|
setLastActiveTime: appStateController.setLastActiveTime.bind( |
|
|
|
setLastActiveTime: |
|
|
|
appStateController, |
|
|
|
appStateController.setLastActiveTime.bind(appStateController), |
|
|
|
), |
|
|
|
setDefaultHomeActiveTabName: |
|
|
|
setDefaultHomeActiveTabName: appStateController.setDefaultHomeActiveTabName.bind( |
|
|
|
appStateController.setDefaultHomeActiveTabName.bind(appStateController), |
|
|
|
|
|
|
|
setConnectedStatusPopoverHasBeenShown: |
|
|
|
|
|
|
|
appStateController.setConnectedStatusPopoverHasBeenShown.bind( |
|
|
|
appStateController, |
|
|
|
appStateController, |
|
|
|
), |
|
|
|
), |
|
|
|
setConnectedStatusPopoverHasBeenShown: appStateController.setConnectedStatusPopoverHasBeenShown.bind( |
|
|
|
setRecoveryPhraseReminderHasBeenShown: |
|
|
|
|
|
|
|
appStateController.setRecoveryPhraseReminderHasBeenShown.bind( |
|
|
|
appStateController, |
|
|
|
appStateController, |
|
|
|
), |
|
|
|
), |
|
|
|
setRecoveryPhraseReminderHasBeenShown: appStateController.setRecoveryPhraseReminderHasBeenShown.bind( |
|
|
|
setRecoveryPhraseReminderLastShown: |
|
|
|
|
|
|
|
appStateController.setRecoveryPhraseReminderLastShown.bind( |
|
|
|
appStateController, |
|
|
|
appStateController, |
|
|
|
), |
|
|
|
), |
|
|
|
setRecoveryPhraseReminderLastShown: appStateController.setRecoveryPhraseReminderLastShown.bind( |
|
|
|
setShowTestnetMessageInDropdown: |
|
|
|
|
|
|
|
appStateController.setShowTestnetMessageInDropdown.bind( |
|
|
|
appStateController, |
|
|
|
appStateController, |
|
|
|
), |
|
|
|
), |
|
|
|
setShowTestnetMessageInDropdown: appStateController.setShowTestnetMessageInDropdown.bind( |
|
|
|
setCollectiblesDetectionNoticeDismissed: |
|
|
|
|
|
|
|
appStateController.setCollectiblesDetectionNoticeDismissed.bind( |
|
|
|
appStateController, |
|
|
|
appStateController, |
|
|
|
), |
|
|
|
), |
|
|
|
setCollectiblesDetectionNoticeDismissed: appStateController.setCollectiblesDetectionNoticeDismissed.bind( |
|
|
|
setEnableEIP1559V2NoticeDismissed: |
|
|
|
|
|
|
|
appStateController.setEnableEIP1559V2NoticeDismissed.bind( |
|
|
|
appStateController, |
|
|
|
appStateController, |
|
|
|
), |
|
|
|
), |
|
|
|
setEnableEIP1559V2NoticeDismissed: appStateController.setEnableEIP1559V2NoticeDismissed.bind( |
|
|
|
updateCollectibleDropDownState: |
|
|
|
appStateController, |
|
|
|
appStateController.updateCollectibleDropDownState.bind( |
|
|
|
), |
|
|
|
|
|
|
|
updateCollectibleDropDownState: appStateController.updateCollectibleDropDownState.bind( |
|
|
|
|
|
|
|
appStateController, |
|
|
|
appStateController, |
|
|
|
), |
|
|
|
), |
|
|
|
// EnsController
|
|
|
|
// EnsController
|
|
|
|
tryReverseResolveAddress: ensController.reverseResolveAddress.bind( |
|
|
|
tryReverseResolveAddress: |
|
|
|
ensController, |
|
|
|
ensController.reverseResolveAddress.bind(ensController), |
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// KeyringController
|
|
|
|
// KeyringController
|
|
|
|
setLocked: this.setLocked.bind(this), |
|
|
|
setLocked: this.setLocked.bind(this), |
|
|
@ -1723,44 +1733,34 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
// txController
|
|
|
|
// txController
|
|
|
|
cancelTransaction: txController.cancelTransaction.bind(txController), |
|
|
|
cancelTransaction: txController.cancelTransaction.bind(txController), |
|
|
|
updateTransaction: txController.updateTransaction.bind(txController), |
|
|
|
updateTransaction: txController.updateTransaction.bind(txController), |
|
|
|
updateAndApproveTransaction: txController.updateAndApproveTransaction.bind( |
|
|
|
updateAndApproveTransaction: |
|
|
|
txController, |
|
|
|
txController.updateAndApproveTransaction.bind(txController), |
|
|
|
), |
|
|
|
approveTransactionsWithSameNonce: |
|
|
|
approveTransactionsWithSameNonce: txController.approveTransactionsWithSameNonce.bind( |
|
|
|
txController.approveTransactionsWithSameNonce.bind(txController), |
|
|
|
txController, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
createCancelTransaction: this.createCancelTransaction.bind(this), |
|
|
|
createCancelTransaction: this.createCancelTransaction.bind(this), |
|
|
|
createSpeedUpTransaction: this.createSpeedUpTransaction.bind(this), |
|
|
|
createSpeedUpTransaction: this.createSpeedUpTransaction.bind(this), |
|
|
|
estimateGas: this.estimateGas.bind(this), |
|
|
|
estimateGas: this.estimateGas.bind(this), |
|
|
|
getNextNonce: this.getNextNonce.bind(this), |
|
|
|
getNextNonce: this.getNextNonce.bind(this), |
|
|
|
addUnapprovedTransaction: txController.addUnapprovedTransaction.bind( |
|
|
|
addUnapprovedTransaction: |
|
|
|
txController, |
|
|
|
txController.addUnapprovedTransaction.bind(txController), |
|
|
|
), |
|
|
|
createTransactionEventFragment: |
|
|
|
createTransactionEventFragment: txController.createTransactionEventFragment.bind( |
|
|
|
txController.createTransactionEventFragment.bind(txController), |
|
|
|
txController, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
getTransactions: txController.getTransactions.bind(txController), |
|
|
|
getTransactions: txController.getTransactions.bind(txController), |
|
|
|
|
|
|
|
|
|
|
|
updateEditableParams: txController.updateEditableParams.bind( |
|
|
|
updateEditableParams: |
|
|
|
txController, |
|
|
|
txController.updateEditableParams.bind(txController), |
|
|
|
), |
|
|
|
updateTransactionGasFees: |
|
|
|
updateTransactionGasFees: txController.updateTransactionGasFees.bind( |
|
|
|
txController.updateTransactionGasFees.bind(txController), |
|
|
|
txController, |
|
|
|
updateTransactionSendFlowHistory: |
|
|
|
), |
|
|
|
txController.updateTransactionSendFlowHistory.bind(txController), |
|
|
|
updateTransactionSendFlowHistory: txController.updateTransactionSendFlowHistory.bind( |
|
|
|
|
|
|
|
txController, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateSwapApprovalTransaction: txController.updateSwapApprovalTransaction.bind( |
|
|
|
updateSwapApprovalTransaction: |
|
|
|
txController, |
|
|
|
txController.updateSwapApprovalTransaction.bind(txController), |
|
|
|
), |
|
|
|
updateSwapTransaction: |
|
|
|
updateSwapTransaction: txController.updateSwapTransaction.bind( |
|
|
|
txController.updateSwapTransaction.bind(txController), |
|
|
|
txController, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updatePreviousGasParams: txController.updatePreviousGasParams.bind( |
|
|
|
updatePreviousGasParams: |
|
|
|
txController, |
|
|
|
txController.updatePreviousGasParams.bind(txController), |
|
|
|
), |
|
|
|
|
|
|
|
// messageManager
|
|
|
|
// messageManager
|
|
|
|
signMessage: this.signMessage.bind(this), |
|
|
|
signMessage: this.signMessage.bind(this), |
|
|
|
cancelMessage: this.cancelMessage.bind(this), |
|
|
|
cancelMessage: this.cancelMessage.bind(this), |
|
|
@ -1783,53 +1783,45 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
cancelEncryptionPublicKey: this.cancelEncryptionPublicKey.bind(this), |
|
|
|
cancelEncryptionPublicKey: this.cancelEncryptionPublicKey.bind(this), |
|
|
|
|
|
|
|
|
|
|
|
// onboarding controller
|
|
|
|
// onboarding controller
|
|
|
|
setSeedPhraseBackedUp: onboardingController.setSeedPhraseBackedUp.bind( |
|
|
|
setSeedPhraseBackedUp: |
|
|
|
onboardingController, |
|
|
|
onboardingController.setSeedPhraseBackedUp.bind(onboardingController), |
|
|
|
), |
|
|
|
completeOnboarding: |
|
|
|
completeOnboarding: onboardingController.completeOnboarding.bind( |
|
|
|
onboardingController.completeOnboarding.bind(onboardingController), |
|
|
|
onboardingController, |
|
|
|
setFirstTimeFlowType: |
|
|
|
), |
|
|
|
onboardingController.setFirstTimeFlowType.bind(onboardingController), |
|
|
|
setFirstTimeFlowType: onboardingController.setFirstTimeFlowType.bind( |
|
|
|
|
|
|
|
onboardingController, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// alert controller
|
|
|
|
// alert controller
|
|
|
|
setAlertEnabledness: alertController.setAlertEnabledness.bind( |
|
|
|
setAlertEnabledness: |
|
|
|
alertController, |
|
|
|
alertController.setAlertEnabledness.bind(alertController), |
|
|
|
), |
|
|
|
setUnconnectedAccountAlertShown: |
|
|
|
setUnconnectedAccountAlertShown: alertController.setUnconnectedAccountAlertShown.bind( |
|
|
|
alertController.setUnconnectedAccountAlertShown.bind(alertController), |
|
|
|
alertController, |
|
|
|
setWeb3ShimUsageAlertDismissed: |
|
|
|
), |
|
|
|
alertController.setWeb3ShimUsageAlertDismissed.bind(alertController), |
|
|
|
setWeb3ShimUsageAlertDismissed: alertController.setWeb3ShimUsageAlertDismissed.bind( |
|
|
|
|
|
|
|
alertController, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 3Box
|
|
|
|
// 3Box
|
|
|
|
setThreeBoxSyncingPermission: threeBoxController.setThreeBoxSyncingPermission.bind( |
|
|
|
setThreeBoxSyncingPermission: |
|
|
|
threeBoxController, |
|
|
|
threeBoxController.setThreeBoxSyncingPermission.bind( |
|
|
|
), |
|
|
|
|
|
|
|
restoreFromThreeBox: threeBoxController.restoreFromThreeBox.bind( |
|
|
|
|
|
|
|
threeBoxController, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
setShowRestorePromptToFalse: threeBoxController.setShowRestorePromptToFalse.bind( |
|
|
|
|
|
|
|
threeBoxController, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
getThreeBoxLastUpdated: threeBoxController.getLastUpdated.bind( |
|
|
|
|
|
|
|
threeBoxController, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
turnThreeBoxSyncingOn: threeBoxController.turnThreeBoxSyncingOn.bind( |
|
|
|
|
|
|
|
threeBoxController, |
|
|
|
threeBoxController, |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
restoreFromThreeBox: |
|
|
|
|
|
|
|
threeBoxController.restoreFromThreeBox.bind(threeBoxController), |
|
|
|
|
|
|
|
setShowRestorePromptToFalse: |
|
|
|
|
|
|
|
threeBoxController.setShowRestorePromptToFalse.bind(threeBoxController), |
|
|
|
|
|
|
|
getThreeBoxLastUpdated: |
|
|
|
|
|
|
|
threeBoxController.getLastUpdated.bind(threeBoxController), |
|
|
|
|
|
|
|
turnThreeBoxSyncingOn: |
|
|
|
|
|
|
|
threeBoxController.turnThreeBoxSyncingOn.bind(threeBoxController), |
|
|
|
initializeThreeBox: this.initializeThreeBox.bind(this), |
|
|
|
initializeThreeBox: this.initializeThreeBox.bind(this), |
|
|
|
|
|
|
|
|
|
|
|
// permissions
|
|
|
|
// permissions
|
|
|
|
removePermissionsFor: permissionController.revokePermissions.bind( |
|
|
|
removePermissionsFor: |
|
|
|
permissionController, |
|
|
|
permissionController.revokePermissions.bind(permissionController), |
|
|
|
), |
|
|
|
approvePermissionsRequest: |
|
|
|
approvePermissionsRequest: permissionController.acceptPermissionsRequest.bind( |
|
|
|
permissionController.acceptPermissionsRequest.bind( |
|
|
|
permissionController, |
|
|
|
permissionController, |
|
|
|
), |
|
|
|
), |
|
|
|
rejectPermissionsRequest: permissionController.rejectPermissionsRequest.bind( |
|
|
|
rejectPermissionsRequest: |
|
|
|
|
|
|
|
permissionController.rejectPermissionsRequest.bind( |
|
|
|
permissionController, |
|
|
|
permissionController, |
|
|
|
), |
|
|
|
), |
|
|
|
...getPermissionBackgroundApiMethods(permissionController), |
|
|
|
...getPermissionBackgroundApiMethods(permissionController), |
|
|
@ -1847,79 +1839,70 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
///: END:ONLY_INCLUDE_IN
|
|
|
|
///: END:ONLY_INCLUDE_IN
|
|
|
|
|
|
|
|
|
|
|
|
// swaps
|
|
|
|
// swaps
|
|
|
|
fetchAndSetQuotes: swapsController.fetchAndSetQuotes.bind( |
|
|
|
fetchAndSetQuotes: |
|
|
|
swapsController, |
|
|
|
swapsController.fetchAndSetQuotes.bind(swapsController), |
|
|
|
), |
|
|
|
setSelectedQuoteAggId: |
|
|
|
setSelectedQuoteAggId: swapsController.setSelectedQuoteAggId.bind( |
|
|
|
swapsController.setSelectedQuoteAggId.bind(swapsController), |
|
|
|
swapsController, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
resetSwapsState: swapsController.resetSwapsState.bind(swapsController), |
|
|
|
resetSwapsState: swapsController.resetSwapsState.bind(swapsController), |
|
|
|
setSwapsTokens: swapsController.setSwapsTokens.bind(swapsController), |
|
|
|
setSwapsTokens: swapsController.setSwapsTokens.bind(swapsController), |
|
|
|
clearSwapsQuotes: swapsController.clearSwapsQuotes.bind(swapsController), |
|
|
|
clearSwapsQuotes: swapsController.clearSwapsQuotes.bind(swapsController), |
|
|
|
setApproveTxId: swapsController.setApproveTxId.bind(swapsController), |
|
|
|
setApproveTxId: swapsController.setApproveTxId.bind(swapsController), |
|
|
|
setTradeTxId: swapsController.setTradeTxId.bind(swapsController), |
|
|
|
setTradeTxId: swapsController.setTradeTxId.bind(swapsController), |
|
|
|
setSwapsTxGasPrice: swapsController.setSwapsTxGasPrice.bind( |
|
|
|
setSwapsTxGasPrice: |
|
|
|
swapsController, |
|
|
|
swapsController.setSwapsTxGasPrice.bind(swapsController), |
|
|
|
), |
|
|
|
setSwapsTxGasLimit: |
|
|
|
setSwapsTxGasLimit: swapsController.setSwapsTxGasLimit.bind( |
|
|
|
swapsController.setSwapsTxGasLimit.bind(swapsController), |
|
|
|
swapsController, |
|
|
|
setSwapsTxMaxFeePerGas: |
|
|
|
), |
|
|
|
swapsController.setSwapsTxMaxFeePerGas.bind(swapsController), |
|
|
|
setSwapsTxMaxFeePerGas: swapsController.setSwapsTxMaxFeePerGas.bind( |
|
|
|
setSwapsTxMaxFeePriorityPerGas: |
|
|
|
swapsController, |
|
|
|
swapsController.setSwapsTxMaxFeePriorityPerGas.bind(swapsController), |
|
|
|
), |
|
|
|
safeRefetchQuotes: |
|
|
|
setSwapsTxMaxFeePriorityPerGas: swapsController.setSwapsTxMaxFeePriorityPerGas.bind( |
|
|
|
swapsController.safeRefetchQuotes.bind(swapsController), |
|
|
|
swapsController, |
|
|
|
stopPollingForQuotes: |
|
|
|
), |
|
|
|
swapsController.stopPollingForQuotes.bind(swapsController), |
|
|
|
safeRefetchQuotes: swapsController.safeRefetchQuotes.bind( |
|
|
|
setBackgroundSwapRouteState: |
|
|
|
swapsController, |
|
|
|
swapsController.setBackgroundSwapRouteState.bind(swapsController), |
|
|
|
), |
|
|
|
resetPostFetchState: |
|
|
|
stopPollingForQuotes: swapsController.stopPollingForQuotes.bind( |
|
|
|
swapsController.resetPostFetchState.bind(swapsController), |
|
|
|
swapsController, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
setBackgroundSwapRouteState: swapsController.setBackgroundSwapRouteState.bind( |
|
|
|
|
|
|
|
swapsController, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
resetPostFetchState: swapsController.resetPostFetchState.bind( |
|
|
|
|
|
|
|
swapsController, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
setSwapsErrorKey: swapsController.setSwapsErrorKey.bind(swapsController), |
|
|
|
setSwapsErrorKey: swapsController.setSwapsErrorKey.bind(swapsController), |
|
|
|
setInitialGasEstimate: swapsController.setInitialGasEstimate.bind( |
|
|
|
setInitialGasEstimate: |
|
|
|
swapsController, |
|
|
|
swapsController.setInitialGasEstimate.bind(swapsController), |
|
|
|
), |
|
|
|
setCustomApproveTxData: |
|
|
|
setCustomApproveTxData: swapsController.setCustomApproveTxData.bind( |
|
|
|
swapsController.setCustomApproveTxData.bind(swapsController), |
|
|
|
swapsController, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
setSwapsLiveness: swapsController.setSwapsLiveness.bind(swapsController), |
|
|
|
setSwapsLiveness: swapsController.setSwapsLiveness.bind(swapsController), |
|
|
|
setSwapsFeatureFlags: swapsController.setSwapsFeatureFlags.bind( |
|
|
|
setSwapsFeatureFlags: |
|
|
|
swapsController, |
|
|
|
swapsController.setSwapsFeatureFlags.bind(swapsController), |
|
|
|
), |
|
|
|
setSwapsUserFeeLevel: |
|
|
|
setSwapsUserFeeLevel: swapsController.setSwapsUserFeeLevel.bind( |
|
|
|
swapsController.setSwapsUserFeeLevel.bind(swapsController), |
|
|
|
swapsController, |
|
|
|
setSwapsQuotesPollingLimitEnabled: |
|
|
|
), |
|
|
|
swapsController.setSwapsQuotesPollingLimitEnabled.bind(swapsController), |
|
|
|
setSwapsQuotesPollingLimitEnabled: swapsController.setSwapsQuotesPollingLimitEnabled.bind( |
|
|
|
|
|
|
|
swapsController, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Smart Transactions
|
|
|
|
// Smart Transactions
|
|
|
|
setSmartTransactionsOptInStatus: smartTransactionsController.setOptInState.bind( |
|
|
|
setSmartTransactionsOptInStatus: |
|
|
|
|
|
|
|
smartTransactionsController.setOptInState.bind( |
|
|
|
smartTransactionsController, |
|
|
|
smartTransactionsController, |
|
|
|
), |
|
|
|
), |
|
|
|
fetchSmartTransactionFees: smartTransactionsController.getFees.bind( |
|
|
|
fetchSmartTransactionFees: smartTransactionsController.getFees.bind( |
|
|
|
smartTransactionsController, |
|
|
|
smartTransactionsController, |
|
|
|
), |
|
|
|
), |
|
|
|
submitSignedTransactions: smartTransactionsController.submitSignedTransactions.bind( |
|
|
|
submitSignedTransactions: |
|
|
|
|
|
|
|
smartTransactionsController.submitSignedTransactions.bind( |
|
|
|
smartTransactionsController, |
|
|
|
smartTransactionsController, |
|
|
|
), |
|
|
|
), |
|
|
|
cancelSmartTransaction: smartTransactionsController.cancelSmartTransaction.bind( |
|
|
|
cancelSmartTransaction: |
|
|
|
|
|
|
|
smartTransactionsController.cancelSmartTransaction.bind( |
|
|
|
smartTransactionsController, |
|
|
|
smartTransactionsController, |
|
|
|
), |
|
|
|
), |
|
|
|
fetchSmartTransactionsLiveness: smartTransactionsController.fetchLiveness.bind( |
|
|
|
fetchSmartTransactionsLiveness: |
|
|
|
|
|
|
|
smartTransactionsController.fetchLiveness.bind( |
|
|
|
smartTransactionsController, |
|
|
|
smartTransactionsController, |
|
|
|
), |
|
|
|
), |
|
|
|
updateSmartTransaction: smartTransactionsController.updateSmartTransaction.bind( |
|
|
|
updateSmartTransaction: |
|
|
|
|
|
|
|
smartTransactionsController.updateSmartTransaction.bind( |
|
|
|
smartTransactionsController, |
|
|
|
smartTransactionsController, |
|
|
|
), |
|
|
|
), |
|
|
|
setStatusRefreshInterval: smartTransactionsController.setStatusRefreshInterval.bind( |
|
|
|
setStatusRefreshInterval: |
|
|
|
|
|
|
|
smartTransactionsController.setStatusRefreshInterval.bind( |
|
|
|
smartTransactionsController, |
|
|
|
smartTransactionsController, |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
@ -1941,9 +1924,8 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
// approval controller
|
|
|
|
// approval controller
|
|
|
|
resolvePendingApproval: approvalController.accept.bind( |
|
|
|
resolvePendingApproval: |
|
|
|
approvalController, |
|
|
|
approvalController.accept.bind(approvalController), |
|
|
|
), |
|
|
|
|
|
|
|
rejectPendingApproval: async (id, error) => { |
|
|
|
rejectPendingApproval: async (id, error) => { |
|
|
|
approvalController.reject( |
|
|
|
approvalController.reject( |
|
|
|
id, |
|
|
|
id, |
|
|
@ -1957,25 +1939,22 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
// GasFeeController
|
|
|
|
// GasFeeController
|
|
|
|
getGasFeeEstimatesAndStartPolling: gasFeeController.getGasFeeEstimatesAndStartPolling.bind( |
|
|
|
getGasFeeEstimatesAndStartPolling: |
|
|
|
|
|
|
|
gasFeeController.getGasFeeEstimatesAndStartPolling.bind( |
|
|
|
gasFeeController, |
|
|
|
gasFeeController, |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
disconnectGasFeeEstimatePoller: gasFeeController.disconnectPoller.bind( |
|
|
|
disconnectGasFeeEstimatePoller: |
|
|
|
gasFeeController, |
|
|
|
gasFeeController.disconnectPoller.bind(gasFeeController), |
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getGasFeeTimeEstimate: gasFeeController.getTimeEstimate.bind( |
|
|
|
getGasFeeTimeEstimate: |
|
|
|
gasFeeController, |
|
|
|
gasFeeController.getTimeEstimate.bind(gasFeeController), |
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addPollingTokenToAppState: appStateController.addPollingToken.bind( |
|
|
|
addPollingTokenToAppState: |
|
|
|
appStateController, |
|
|
|
appStateController.addPollingToken.bind(appStateController), |
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
removePollingTokenFromAppState: appStateController.removePollingToken.bind( |
|
|
|
removePollingTokenFromAppState: |
|
|
|
appStateController, |
|
|
|
appStateController.removePollingToken.bind(appStateController), |
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// DetectTokenController
|
|
|
|
// DetectTokenController
|
|
|
|
detectNewTokens: detectTokensController.detectNewTokens.bind( |
|
|
|
detectNewTokens: detectTokensController.detectNewTokens.bind( |
|
|
@ -1990,19 +1969,20 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
: null, |
|
|
|
: null, |
|
|
|
|
|
|
|
|
|
|
|
/** Token Detection V2 */ |
|
|
|
/** Token Detection V2 */ |
|
|
|
addDetectedTokens: tokensController.addDetectedTokens.bind( |
|
|
|
addDetectedTokens: |
|
|
|
tokensController, |
|
|
|
tokensController.addDetectedTokens.bind(tokensController), |
|
|
|
), |
|
|
|
|
|
|
|
addImportedTokens: tokensController.addTokens.bind(tokensController), |
|
|
|
addImportedTokens: tokensController.addTokens.bind(tokensController), |
|
|
|
ignoreTokens: tokensController.ignoreTokens.bind(tokensController), |
|
|
|
ignoreTokens: tokensController.ignoreTokens.bind(tokensController), |
|
|
|
getBalancesInSingleCall: assetsContractController.getBalancesInSingleCall.bind( |
|
|
|
getBalancesInSingleCall: |
|
|
|
|
|
|
|
assetsContractController.getBalancesInSingleCall.bind( |
|
|
|
assetsContractController, |
|
|
|
assetsContractController, |
|
|
|
), |
|
|
|
), |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async getTokenStandardAndDetails(address, userAddress, tokenId) { |
|
|
|
async getTokenStandardAndDetails(address, userAddress, tokenId) { |
|
|
|
const details = await this.assetsContractController.getTokenStandardAndDetails( |
|
|
|
const details = |
|
|
|
|
|
|
|
await this.assetsContractController.getTokenStandardAndDetails( |
|
|
|
address, |
|
|
|
address, |
|
|
|
userAddress, |
|
|
|
userAddress, |
|
|
|
tokenId, |
|
|
|
tokenId, |
|
|
@ -2159,9 +2139,8 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
ethQuery, |
|
|
|
ethQuery, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const primaryKeyring = keyringController.getKeyringsByType( |
|
|
|
const primaryKeyring = |
|
|
|
'HD Key Tree', |
|
|
|
keyringController.getKeyringsByType('HD Key Tree')[0]; |
|
|
|
)[0]; |
|
|
|
|
|
|
|
if (!primaryKeyring) { |
|
|
|
if (!primaryKeyring) { |
|
|
|
throw new Error('MetamaskController - No HD Key Tree found'); |
|
|
|
throw new Error('MetamaskController - No HD Key Tree found'); |
|
|
|
} |
|
|
|
} |
|
|
@ -2186,7 +2165,8 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
// keyring's iframe and have the setting initialized properly
|
|
|
|
// keyring's iframe and have the setting initialized properly
|
|
|
|
// Optimistically called to not block MetaMask login due to
|
|
|
|
// Optimistically called to not block MetaMask login due to
|
|
|
|
// Ledger Keyring GitHub downtime
|
|
|
|
// Ledger Keyring GitHub downtime
|
|
|
|
const transportPreference = this.preferencesController.getLedgerTransportPreference(); |
|
|
|
const transportPreference = |
|
|
|
|
|
|
|
this.preferencesController.getLedgerTransportPreference(); |
|
|
|
this.setLedgerTransportPreference(transportPreference); |
|
|
|
this.setLedgerTransportPreference(transportPreference); |
|
|
|
|
|
|
|
|
|
|
|
// set new identities
|
|
|
|
// set new identities
|
|
|
@ -2280,12 +2260,10 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// Accounts
|
|
|
|
// Accounts
|
|
|
|
const hdKeyring = this.keyringController.getKeyringsByType( |
|
|
|
const hdKeyring = |
|
|
|
'HD Key Tree', |
|
|
|
this.keyringController.getKeyringsByType('HD Key Tree')[0]; |
|
|
|
)[0]; |
|
|
|
const simpleKeyPairKeyrings = |
|
|
|
const simpleKeyPairKeyrings = this.keyringController.getKeyringsByType( |
|
|
|
this.keyringController.getKeyringsByType('Simple Key Pair'); |
|
|
|
'Simple Key Pair', |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
const hdAccounts = await hdKeyring.getAccounts(); |
|
|
|
const hdAccounts = await hdKeyring.getAccounts(); |
|
|
|
const simpleKeyPairKeyringAccounts = await Promise.all( |
|
|
|
const simpleKeyPairKeyringAccounts = await Promise.all( |
|
|
|
simpleKeyPairKeyrings.map((keyring) => keyring.getAccounts()), |
|
|
|
simpleKeyPairKeyrings.map((keyring) => keyring.getAccounts()), |
|
|
@ -2342,7 +2320,8 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
const threeBoxSyncingAllowed = this.threeBoxController.getThreeBoxSyncingState(); |
|
|
|
const threeBoxSyncingAllowed = |
|
|
|
|
|
|
|
this.threeBoxController.getThreeBoxSyncingState(); |
|
|
|
if (threeBoxSyncingAllowed && !this.threeBoxController.box) { |
|
|
|
if (threeBoxSyncingAllowed && !this.threeBoxController.box) { |
|
|
|
// 'await' intentionally omitted to avoid waiting for initialization
|
|
|
|
// 'await' intentionally omitted to avoid waiting for initialization
|
|
|
|
this.threeBoxController.init(); |
|
|
|
this.threeBoxController.init(); |
|
|
@ -2358,7 +2337,8 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
// keyring's iframe and have the setting initialized properly
|
|
|
|
// keyring's iframe and have the setting initialized properly
|
|
|
|
// Optimistically called to not block MetaMask login due to
|
|
|
|
// Optimistically called to not block MetaMask login due to
|
|
|
|
// Ledger Keyring GitHub downtime
|
|
|
|
// Ledger Keyring GitHub downtime
|
|
|
|
const transportPreference = this.preferencesController.getLedgerTransportPreference(); |
|
|
|
const transportPreference = |
|
|
|
|
|
|
|
this.preferencesController.getLedgerTransportPreference(); |
|
|
|
|
|
|
|
|
|
|
|
this.setLedgerTransportPreference(transportPreference); |
|
|
|
this.setLedgerTransportPreference(transportPreference); |
|
|
|
|
|
|
|
|
|
|
@ -2454,7 +2434,8 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async establishLedgerTransportPreference() { |
|
|
|
async establishLedgerTransportPreference() { |
|
|
|
const transportPreference = this.preferencesController.getLedgerTransportPreference(); |
|
|
|
const transportPreference = |
|
|
|
|
|
|
|
this.preferencesController.getLedgerTransportPreference(); |
|
|
|
return await this.setLedgerTransportPreference(transportPreference); |
|
|
|
return await this.setLedgerTransportPreference(transportPreference); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -2626,9 +2607,8 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
* @returns {} keyState |
|
|
|
* @returns {} keyState |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
async addNewAccount() { |
|
|
|
async addNewAccount() { |
|
|
|
const primaryKeyring = this.keyringController.getKeyringsByType( |
|
|
|
const primaryKeyring = |
|
|
|
'HD Key Tree', |
|
|
|
this.keyringController.getKeyringsByType('HD Key Tree')[0]; |
|
|
|
)[0]; |
|
|
|
|
|
|
|
if (!primaryKeyring) { |
|
|
|
if (!primaryKeyring) { |
|
|
|
throw new Error('MetamaskController - No HD Key Tree found'); |
|
|
|
throw new Error('MetamaskController - No HD Key Tree found'); |
|
|
|
} |
|
|
|
} |
|
|
@ -2661,9 +2641,8 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
* encoded as an array of UTF-8 bytes. |
|
|
|
* encoded as an array of UTF-8 bytes. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
async verifySeedPhrase() { |
|
|
|
async verifySeedPhrase() { |
|
|
|
const primaryKeyring = this.keyringController.getKeyringsByType( |
|
|
|
const primaryKeyring = |
|
|
|
'HD Key Tree', |
|
|
|
this.keyringController.getKeyringsByType('HD Key Tree')[0]; |
|
|
|
)[0]; |
|
|
|
|
|
|
|
if (!primaryKeyring) { |
|
|
|
if (!primaryKeyring) { |
|
|
|
throw new Error('MetamaskController - No HD Key Tree found'); |
|
|
|
throw new Error('MetamaskController - No HD Key Tree found'); |
|
|
|
} |
|
|
|
} |
|
|
@ -3098,7 +3077,8 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
default: { |
|
|
|
default: { |
|
|
|
const promise = this.encryptionPublicKeyManager.addUnapprovedMessageAsync( |
|
|
|
const promise = |
|
|
|
|
|
|
|
this.encryptionPublicKeyManager.addUnapprovedMessageAsync( |
|
|
|
msgParams, |
|
|
|
msgParams, |
|
|
|
req, |
|
|
|
req, |
|
|
|
); |
|
|
|
); |
|
|
@ -3640,7 +3620,8 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
subjectType, |
|
|
|
subjectType, |
|
|
|
|
|
|
|
|
|
|
|
// Miscellaneous
|
|
|
|
// Miscellaneous
|
|
|
|
addSubjectMetadata: this.subjectMetadataController.addSubjectMetadata.bind( |
|
|
|
addSubjectMetadata: |
|
|
|
|
|
|
|
this.subjectMetadataController.addSubjectMetadata.bind( |
|
|
|
this.subjectMetadataController, |
|
|
|
this.subjectMetadataController, |
|
|
|
), |
|
|
|
), |
|
|
|
getProviderState: this.getProviderState.bind(this), |
|
|
|
getProviderState: this.getProviderState.bind(this), |
|
|
@ -3650,7 +3631,8 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
handleWatchAssetRequest: this.tokensController.watchAsset.bind( |
|
|
|
handleWatchAssetRequest: this.tokensController.watchAsset.bind( |
|
|
|
this.tokensController, |
|
|
|
this.tokensController, |
|
|
|
), |
|
|
|
), |
|
|
|
requestUserApproval: this.approvalController.addAndShowApprovalRequest.bind( |
|
|
|
requestUserApproval: |
|
|
|
|
|
|
|
this.approvalController.addAndShowApprovalRequest.bind( |
|
|
|
this.approvalController, |
|
|
|
this.approvalController, |
|
|
|
), |
|
|
|
), |
|
|
|
sendMetrics: this.metaMetricsController.trackEvent.bind( |
|
|
|
sendMetrics: this.metaMetricsController.trackEvent.bind( |
|
|
@ -3667,12 +3649,14 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
this.permissionController, |
|
|
|
this.permissionController, |
|
|
|
origin, |
|
|
|
origin, |
|
|
|
), |
|
|
|
), |
|
|
|
requestAccountsPermission: this.permissionController.requestPermissions.bind( |
|
|
|
requestAccountsPermission: |
|
|
|
|
|
|
|
this.permissionController.requestPermissions.bind( |
|
|
|
this.permissionController, |
|
|
|
this.permissionController, |
|
|
|
{ origin }, |
|
|
|
{ origin }, |
|
|
|
{ eth_accounts: {} }, |
|
|
|
{ eth_accounts: {} }, |
|
|
|
), |
|
|
|
), |
|
|
|
requestPermissionsForOrigin: this.permissionController.requestPermissions.bind( |
|
|
|
requestPermissionsForOrigin: |
|
|
|
|
|
|
|
this.permissionController.requestPermissions.bind( |
|
|
|
this.permissionController, |
|
|
|
this.permissionController, |
|
|
|
{ origin }, |
|
|
|
{ origin }, |
|
|
|
), |
|
|
|
), |
|
|
@ -3718,7 +3702,8 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
getWeb3ShimUsageState: this.alertController.getWeb3ShimUsageState.bind( |
|
|
|
getWeb3ShimUsageState: this.alertController.getWeb3ShimUsageState.bind( |
|
|
|
this.alertController, |
|
|
|
this.alertController, |
|
|
|
), |
|
|
|
), |
|
|
|
setWeb3ShimUsageRecorded: this.alertController.setWeb3ShimUsageRecorded.bind( |
|
|
|
setWeb3ShimUsageRecorded: |
|
|
|
|
|
|
|
this.alertController.setWeb3ShimUsageRecorded.bind( |
|
|
|
this.alertController, |
|
|
|
this.alertController, |
|
|
|
), |
|
|
|
), |
|
|
|
}), |
|
|
|
}), |
|
|
@ -3736,9 +3721,8 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
origin, |
|
|
|
origin, |
|
|
|
), |
|
|
|
), |
|
|
|
requestPermissions: async (requestedPermissions) => { |
|
|
|
requestPermissions: async (requestedPermissions) => { |
|
|
|
const [ |
|
|
|
const [approvedPermissions] = |
|
|
|
approvedPermissions, |
|
|
|
await this.permissionController.requestPermissions( |
|
|
|
] = await this.permissionController.requestPermissions( |
|
|
|
|
|
|
|
{ origin }, |
|
|
|
{ origin }, |
|
|
|
requestedPermissions, |
|
|
|
requestedPermissions, |
|
|
|
); |
|
|
|
); |
|
|
@ -4031,10 +4015,8 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
* @returns {Promise<number>} |
|
|
|
* @returns {Promise<number>} |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
async getPendingNonce(address) { |
|
|
|
async getPendingNonce(address) { |
|
|
|
const { |
|
|
|
const { nonceDetails, releaseLock } = |
|
|
|
nonceDetails, |
|
|
|
await this.txController.nonceTracker.getNonceLock(address); |
|
|
|
releaseLock, |
|
|
|
|
|
|
|
} = await this.txController.nonceTracker.getNonceLock(address); |
|
|
|
|
|
|
|
const pendingNonce = nonceDetails.params.highestSuggested; |
|
|
|
const pendingNonce = nonceDetails.params.highestSuggested; |
|
|
|
|
|
|
|
|
|
|
|
releaseLock(); |
|
|
|
releaseLock(); |
|
|
@ -4150,7 +4132,8 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
nickname = '', |
|
|
|
nickname = '', |
|
|
|
rpcPrefs = {}, |
|
|
|
rpcPrefs = {}, |
|
|
|
) { |
|
|
|
) { |
|
|
|
const frequentRpcListDetail = this.preferencesController.getFrequentRpcListDetail(); |
|
|
|
const frequentRpcListDetail = |
|
|
|
|
|
|
|
this.preferencesController.getFrequentRpcListDetail(); |
|
|
|
const rpcSettings = frequentRpcListDetail.find( |
|
|
|
const rpcSettings = frequentRpcListDetail.find( |
|
|
|
(rpc) => rpcUrl === rpc.rpcUrl, |
|
|
|
(rpc) => rpcUrl === rpc.rpcUrl, |
|
|
|
); |
|
|
|
); |
|
|
@ -4199,7 +4182,8 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
* @returns {object} rpcInfo found in the frequentRpcList |
|
|
|
* @returns {object} rpcInfo found in the frequentRpcList |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
findCustomRpcBy(rpcInfo) { |
|
|
|
findCustomRpcBy(rpcInfo) { |
|
|
|
const frequentRpcListDetail = this.preferencesController.getFrequentRpcListDetail(); |
|
|
|
const frequentRpcListDetail = |
|
|
|
|
|
|
|
this.preferencesController.getFrequentRpcListDetail(); |
|
|
|
for (const existingRpcInfo of frequentRpcListDetail) { |
|
|
|
for (const existingRpcInfo of frequentRpcListDetail) { |
|
|
|
for (const key of Object.keys(rpcInfo)) { |
|
|
|
for (const key of Object.keys(rpcInfo)) { |
|
|
|
if (existingRpcInfo[key] === rpcInfo[key]) { |
|
|
|
if (existingRpcInfo[key] === rpcInfo[key]) { |
|
|
@ -4220,10 +4204,10 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
* @param {string} transportType - The Ledger transport type. |
|
|
|
* @param {string} transportType - The Ledger transport type. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
async setLedgerTransportPreference(transportType) { |
|
|
|
async setLedgerTransportPreference(transportType) { |
|
|
|
const currentValue = this.preferencesController.getLedgerTransportPreference(); |
|
|
|
const currentValue = |
|
|
|
const newValue = this.preferencesController.setLedgerTransportPreference( |
|
|
|
this.preferencesController.getLedgerTransportPreference(); |
|
|
|
transportType, |
|
|
|
const newValue = |
|
|
|
); |
|
|
|
this.preferencesController.setLedgerTransportPreference(transportType); |
|
|
|
|
|
|
|
|
|
|
|
const keyring = await this.getKeyringForDevice(DEVICE_NAMES.LEDGER); |
|
|
|
const keyring = await this.getKeyringForDevice(DEVICE_NAMES.LEDGER); |
|
|
|
if (keyring?.updateTransportMethod) { |
|
|
|
if (keyring?.updateTransportMethod) { |
|
|
@ -4289,9 +4273,8 @@ export default class MetamaskController extends EventEmitter { |
|
|
|
onEnvironmentTypeClosed(environmentType) { |
|
|
|
onEnvironmentTypeClosed(environmentType) { |
|
|
|
const appStatePollingTokenType = |
|
|
|
const appStatePollingTokenType = |
|
|
|
POLLING_TOKEN_ENVIRONMENT_TYPES[environmentType]; |
|
|
|
POLLING_TOKEN_ENVIRONMENT_TYPES[environmentType]; |
|
|
|
const pollingTokensToDisconnect = this.appStateController.store.getState()[ |
|
|
|
const pollingTokensToDisconnect = |
|
|
|
appStatePollingTokenType |
|
|
|
this.appStateController.store.getState()[appStatePollingTokenType]; |
|
|
|
]; |
|
|
|
|
|
|
|
pollingTokensToDisconnect.forEach((pollingToken) => { |
|
|
|
pollingTokensToDisconnect.forEach((pollingToken) => { |
|
|
|
this.gasFeeController.disconnectPoller(pollingToken); |
|
|
|
this.gasFeeController.disconnectPoller(pollingToken); |
|
|
|
this.appStateController.removePollingToken( |
|
|
|
this.appStateController.removePollingToken( |
|
|
|