1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-21 09:27:02 +01:00

remove exclusions for mismatched object jsdoc type casing (#15351)

This commit is contained in:
Brad Decker 2022-07-27 08:28:05 -05:00 committed by GitHub
parent e24997d67c
commit 652d631cda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
92 changed files with 409 additions and 426 deletions

View File

@ -14,23 +14,6 @@ module.exports = {
'jsdoc/require-returns-type': 'off',
'jsdoc/require-returns': 'off',
'jsdoc/valid-types': 'off',
// jsdoc/check-types now checks for mismatched casing of 'Object' types
// which has a larger impact on typescript projects than javascript ones
// due to the typescript Object type. To prevent large amounts of churn
// these temporary overrides are added which will be removed and casing
// normalized in a future PR.
'jsdoc/check-types': [
'error',
{
exemptTagContexts: [
{ tag: 'property', types: ['Object', 'Object[]', 'Array<Object>'] },
{ tag: 'param', types: ['Object', 'Object[]', 'Array<Object>'] },
{ tag: 'typedef', types: ['Object', 'Object[]', 'Array<Object>'] },
{ tag: 'returns', types: ['Object', 'Object[]', 'Array<Object>'] },
{ tag: 'type', types: ['Object', 'Object[]', 'Array<Object>'] },
],
},
],
},
settings: {
jsdoc: {

View File

@ -114,33 +114,33 @@ if (isManifestV3()) {
* @property {boolean} isInitialized - Whether the first vault has been created.
* @property {boolean} isUnlocked - Whether the vault is currently decrypted and accounts are available for selection.
* @property {boolean} isAccountMenuOpen - Represents whether the main account selection UI is currently displayed.
* @property {Object} identities - An object matching lower-case hex addresses to Identity objects with "address" and "name" (nickname) keys.
* @property {Object} unapprovedTxs - An object mapping transaction hashes to unapproved transactions.
* @property {object} identities - An object matching lower-case hex addresses to Identity objects with "address" and "name" (nickname) keys.
* @property {object} unapprovedTxs - An object mapping transaction hashes to unapproved transactions.
* @property {Array} frequentRpcList - A list of frequently used RPCs, including custom user-provided ones.
* @property {Array} addressBook - A list of previously sent to addresses.
* @property {Object} contractExchangeRates - Info about current token prices.
* @property {object} contractExchangeRates - Info about current token prices.
* @property {Array} tokens - Tokens held by the current user, including their balances.
* @property {Object} send - TODO: Document
* @property {object} send - TODO: Document
* @property {boolean} useBlockie - Indicates preferred user identicon format. True for blockie, false for Jazzicon.
* @property {Object} featureFlags - An object for optional feature flags.
* @property {object} featureFlags - An object for optional feature flags.
* @property {boolean} welcomeScreen - True if welcome screen should be shown.
* @property {string} currentLocale - A locale string matching the user's preferred display language.
* @property {Object} provider - The current selected network provider.
* @property {object} provider - The current selected network provider.
* @property {string} provider.rpcUrl - The address for the RPC API, if using an RPC API.
* @property {string} provider.type - An identifier for the type of network selected, allows MetaMask to use custom provider strategies for known networks.
* @property {string} network - A stringified number of the current network ID.
* @property {Object} accounts - An object mapping lower-case hex addresses to objects with "balance" and "address" keys, both storing hex string values.
* @property {object} accounts - An object mapping lower-case hex addresses to objects with "balance" and "address" keys, both storing hex string values.
* @property {hex} currentBlockGasLimit - The most recently seen block gas limit, in a lower case hex prefixed string.
* @property {TransactionMeta[]} currentNetworkTxList - An array of transactions associated with the currently selected network.
* @property {Object} unapprovedMsgs - An object of messages pending approval, mapping a unique ID to the options.
* @property {object} unapprovedMsgs - An object of messages pending approval, mapping a unique ID to the options.
* @property {number} unapprovedMsgCount - The number of messages in unapprovedMsgs.
* @property {Object} unapprovedPersonalMsgs - An object of messages pending approval, mapping a unique ID to the options.
* @property {object} unapprovedPersonalMsgs - An object of messages pending approval, mapping a unique ID to the options.
* @property {number} unapprovedPersonalMsgCount - The number of messages in unapprovedPersonalMsgs.
* @property {Object} unapprovedEncryptionPublicKeyMsgs - An object of messages pending approval, mapping a unique ID to the options.
* @property {object} unapprovedEncryptionPublicKeyMsgs - An object of messages pending approval, mapping a unique ID to the options.
* @property {number} unapprovedEncryptionPublicKeyMsgCount - The number of messages in EncryptionPublicKeyMsgs.
* @property {Object} unapprovedDecryptMsgs - An object of messages pending approval, mapping a unique ID to the options.
* @property {object} unapprovedDecryptMsgs - An object of messages pending approval, mapping a unique ID to the options.
* @property {number} unapprovedDecryptMsgCount - The number of messages in unapprovedDecryptMsgs.
* @property {Object} unapprovedTypedMsgs - An object of messages pending approval, mapping a unique ID to the options.
* @property {object} unapprovedTypedMsgs - An object of messages pending approval, mapping a unique ID to the options.
* @property {number} unapprovedTypedMsgCount - The number of messages in unapprovedTypedMsgs.
* @property {number} pendingApprovalCount - The number of pending request in the approval controller.
* @property {string[]} keyringTypes - An array of unique keyring identifying strings, representing available strategies for creating accounts.
@ -304,7 +304,7 @@ async function loadStateFromPersistence() {
* Streams emitted state updates to platform-specific storage strategy.
* Creates platform listeners for new Dapps/Contexts, and sets up their data connections to the controller.
*
* @param {Object} initState - The initial state to start the controller with, matches the state that is emitted from the controller.
* @param {object} initState - The initial state to start the controller with, matches the state that is emitted from the controller.
* @param {string} initLangCode - The region code for the language preferred by the current user.
* @param {string} remoteSourcePort - remote application port connecting to extension.
* @returns {Promise} After setup is complete.
@ -361,7 +361,7 @@ function setupController(initState, initLangCode, remoteSourcePort) {
/**
* Assigns the given state to the versioned object (with metadata), and returns that.
*
* @param {Object} state - The state object as emitted by the MetaMaskController.
* @param {object} state - The state object as emitted by the MetaMaskController.
* @returns {VersionedData} The state object wrapped in an object that includes a metadata key.
*/
function versionifyData(state) {

View File

@ -5,16 +5,16 @@ import {
} from '../../../shared/constants/alerts';
/**
* @typedef {Object} AlertControllerInitState
* @property {Object} alertEnabledness - A map of alerts IDs to booleans, where
* @typedef {object} AlertControllerInitState
* @property {object} alertEnabledness - A map of alerts IDs to booleans, where
* `true` indicates that the alert is enabled and shown, and `false` the opposite.
* @property {Object} unconnectedAccountAlertShownOrigins - A map of origin
* @property {object} unconnectedAccountAlertShownOrigins - A map of origin
* strings to booleans indicating whether the "switch to connected" alert has
* been shown (`true`) or otherwise (`false`).
*/
/**
* @typedef {Object} AlertControllerOptions
* @typedef {object} AlertControllerOptions
* @property {AlertControllerInitState} initState - The initial controller state
*/

View File

@ -5,7 +5,7 @@ import { MINUTE } from '../../../shared/constants/time';
export default class AppStateController extends EventEmitter {
/**
* @param {Object} opts
* @param {object} opts
*/
constructor(opts = {}) {
const {

View File

@ -1,10 +1,10 @@
import { ObservableStore } from '@metamask/obs-store';
/**
* @typedef {Object} CachedBalancesOptions
* @property {Object} accountTracker An {@code AccountTracker} reference
* @typedef {object} CachedBalancesOptions
* @property {object} accountTracker An {@code AccountTracker} reference
* @property {Function} getCurrentChainId A function to get the current chain id
* @property {Object} initState The initial controller state
* @property {object} initState The initial controller state
*/
/**
@ -33,7 +33,7 @@ export default class CachedBalancesController {
* Updates the cachedBalances property for the current chain. Cached balances will be updated to those in the passed accounts
* if balances in the passed accounts are truthy.
*
* @param {Object} obj - The the recently updated accounts object for the current chain
* @param {object} obj - The the recently updated accounts object for the current chain
* @param obj.accounts
* @returns {Promise<void>}
*/

View File

@ -23,7 +23,7 @@ export default class DetectTokensController {
/**
* Creates a DetectTokensController
*
* @param {Object} [config] - Options to configure controller
* @param {object} [config] - Options to configure controller
* @param config.interval
* @param config.preferences
* @param config.network
@ -252,7 +252,7 @@ export default class DetectTokensController {
}
/**
* @type {Object}
* @type {object}
*/
set network(network) {
if (!network) {
@ -265,7 +265,7 @@ export default class DetectTokensController {
/**
* In setter when isUnlocked is updated to true, detectNewTokens and restart polling
*
* @type {Object}
* @type {object}
*/
set keyringMemStore(keyringMemStore) {
if (!keyringMemStore) {
@ -283,7 +283,7 @@ export default class DetectTokensController {
}
/**
* @type {Object}
* @type {object}
*/
set tokenList(tokenList) {
if (!tokenList) {
@ -295,7 +295,7 @@ export default class DetectTokensController {
/**
* Internal isActive state
*
* @type {Object}
* @type {object}
*/
get isActive() {
return this.isOpen && this.isUnlocked;

View File

@ -30,7 +30,7 @@ const fetchWithTimeout = getFetchWithTimeout();
*
* Note that this is not an exhaustive type definiton; only the properties we use are defined
*
* @typedef {Object} EtherscanTransaction
* @typedef {object} EtherscanTransaction
* @property {string} blockNumber - The number of the block this transaction was found in, in decimal
* @property {string} from - The hex-prefixed address of the sender
* @property {string} gas - The gas limit, in decimal GWEI

View File

@ -104,7 +104,7 @@ function getMockBlockTracker() {
* Returns a transaction object matching the expected format returned
* by the Etherscan API
*
* @param {Object} [params] - options bag
* @param {object} [params] - options bag
* @param {string} [params.toAddress] - The hex-prefixed address of the recipient
* @param {number} [params.blockNumber] - The block number for the transaction
* @param {boolean} [params.useEIP1559] - Use EIP-1559 gas fields

View File

@ -44,7 +44,7 @@ const exceptionsToFilter = {
*/
/**
* @typedef {Object} MetaMetricsControllerState
* @typedef {object} MetaMetricsControllerState
* @property {string} [metaMetricsId] - The user's metaMetricsId that will be
* attached to all non-anonymized event payloads
* @property {boolean} [participateInMetaMetrics] - The user's preference for
@ -57,9 +57,9 @@ const exceptionsToFilter = {
export default class MetaMetricsController {
/**
* @param {object} options
* @param {Object} options.segment - an instance of analytics-node for tracking
* @param {object} options.segment - an instance of analytics-node for tracking
* events that conform to the new MetaMetrics tracking plan.
* @param {Object} options.preferencesStore - The preferences controller store, used
* @param {object} options.preferencesStore - The preferences controller store, used
* to access and subscribe to preferences that will be attached to events
* @param {Function} options.onNetworkDidChange - Used to attach a listener to the
* networkDidChange event emitted by the networkController
@ -295,7 +295,7 @@ export default class MetaMetricsController {
* Calls this._identify with validated metaMetricsId and user traits if user is participating
* in the MetaMetrics analytics program
*
* @param {Object} userTraits
* @param {object} userTraits
*/
identify(userTraits) {
const { metaMetricsId, participateInMetaMetrics } = this.state;
@ -604,8 +604,8 @@ export default class MetaMetricsController {
* Returns a new object of all valid user traits. For dates, we transform them into ISO-8601 timestamp strings.
*
* @see {@link https://segment.com/docs/connections/spec/common/#timestamps}
* @param {Object} userTraits
* @returns {Object}
* @param {object} userTraits
* @returns {object}
*/
_buildValidTraits(userTraits) {
return Object.entries(userTraits).reduce((validTraits, [key, value]) => {
@ -626,7 +626,7 @@ export default class MetaMetricsController {
* Returns an array of all of the collectibles/NFTs the user
* possesses across all networks and accounts.
*
* @param {Object} allCollectibles
* @param {object} allCollectibles
* @returns {[]}
*/
_getAllNFTsFlattened = memoize((allCollectibles = {}) => {
@ -639,7 +639,7 @@ export default class MetaMetricsController {
* Returns the number of unique collectible/NFT addresses the user
* possesses across all networks and accounts.
*
* @param {Object} allCollectibles
* @param {object} allCollectibles
* @returns {number}
*/
_getAllUniqueNFTAddressesLength(allCollectibles = {}) {
@ -668,7 +668,7 @@ export default class MetaMetricsController {
*
* @see {@link https://segment.com/docs/connections/sources/catalog/libraries/server/node/#identify}
* @private
* @param {Object} userTraits
* @param {object} userTraits
*/
_identify(userTraits) {
const { metaMetricsId } = this.state;

View File

@ -141,7 +141,7 @@ export default class NetworkController extends EventEmitter {
/**
* Method to return the latest block for the current network
*
* @returns {Object} Block header
* @returns {object} Block header
*/
getLatestBlock() {
return new Promise((resolve, reject) => {

View File

@ -2,13 +2,13 @@ import { ObservableStore } from '@metamask/obs-store';
import log from 'loglevel';
/**
* @typedef {Object} InitState
* @typedef {object} InitState
* @property {boolean} seedPhraseBackedUp Indicates whether the user has completed the seed phrase backup challenge
* @property {boolean} completedOnboarding Indicates whether the user has completed the onboarding flow
*/
/**
* @typedef {Object} OnboardingOptions
* @typedef {object} OnboardingOptions
* @property {InitState} initState The initial controller state
*/

View File

@ -27,7 +27,7 @@ export class PermissionLogController {
/**
* Get the restricted method activity log.
*
* @returns {Array<Object>} The activity log.
* @returns {Array<object>} The activity log.
*/
getActivityLog() {
return this.store.getState().permissionActivityLog;
@ -36,7 +36,7 @@ export class PermissionLogController {
/**
* Update the restricted method activity log.
*
* @param {Array<Object>} logs - The new activity log array.
* @param {Array<object>} logs - The new activity log array.
*/
updateActivityLog(logs) {
this.store.updateState({ permissionActivityLog: logs });
@ -45,7 +45,7 @@ export class PermissionLogController {
/**
* Get the permission history log.
*
* @returns {Object} The permissions history log.
* @returns {object} The permissions history log.
*/
getHistory() {
return this.store.getState().permissionHistory;
@ -54,7 +54,7 @@ export class PermissionLogController {
/**
* Update the permission history log.
*
* @param {Object} history - The new permissions history log object.
* @param {object} history - The new permissions history log object.
*/
updateHistory(history) {
this.store.updateState({ permissionHistory: history });
@ -146,7 +146,7 @@ export class PermissionLogController {
/**
* Creates and commits an activity log entry, without response data.
*
* @param {Object} request - The request object.
* @param {object} request - The request object.
* @param {boolean} isInternal - Whether the request is internal.
*/
logRequest(request, isInternal) {
@ -169,8 +169,8 @@ export class PermissionLogController {
* Adds response data to an existing activity log entry.
* Entry assumed already committed (i.e., in the log).
*
* @param {Object} entry - The entry to add a response to.
* @param {Object} response - The response object.
* @param {object} entry - The entry to add a response to.
* @param {object} response - The response object.
* @param {number} time - Output from Date.now()
*/
logResponse(entry, response, time) {
@ -190,7 +190,7 @@ export class PermissionLogController {
* Commit a new entry to the activity log.
* Removes the oldest entry from the log if it exceeds the log limit.
*
* @param {Object} entry - The activity log entry.
* @param {object} entry - The activity log entry.
*/
commitNewActivity(entry) {
const logs = this.getActivityLog();
@ -277,7 +277,7 @@ export class PermissionLogController {
* with the same key (permission name).
*
* @param {string} origin - The requesting origin.
* @param {Object} newEntries - The new entries to commit.
* @param {object} newEntries - The new entries to commit.
*/
commitNewHistory(origin, newEntries) {
// a simple merge updates most permissions
@ -318,7 +318,7 @@ export class PermissionLogController {
/**
* Get all requested methods from a permissions request.
*
* @param {Object} request - The request object.
* @param {object} request - The request object.
* @returns {Array<string>} The names of the requested permissions.
*/
getRequestedMethods(request) {
@ -337,7 +337,7 @@ export class PermissionLogController {
* Get the permitted accounts from an eth_accounts permissions object.
* Returns an empty array if the permission is not eth_accounts.
*
* @param {Object} perm - The permissions object.
* @param {object} perm - The permissions object.
* @returns {Array<string>} The permitted accounts.
*/
getAccountsFromPermission(perm) {
@ -367,7 +367,7 @@ export class PermissionLogController {
*
* @param {Array<string>} accounts - An array of addresses.
* @param {number} time - A time, e.g. Date.now().
* @returns {Object} A string:number map of addresses to time.
* @returns {object} A string:number map of addresses to time.
*/
function getAccountToTimeMap(accounts, time) {
return accounts.reduce((acc, account) => ({ ...acc, [account]: time }), {});

View File

@ -639,9 +639,9 @@ describe('PermissionLogController', () => {
* Validates an activity log entry with respect to a request, response, and
* relevant metadata.
*
* @param {Object} entry - The activity log entry to validate.
* @param {Object} req - The request that generated the entry.
* @param {Object} [res] - The response for the request, if any.
* @param {object} entry - The activity log entry to validate.
* @param {object} req - The request that generated the entry.
* @param {object} [res] - The response for the request, if any.
* @param {'restricted'|'internal'} methodType - The method log controller method type of the request.
* @param {boolean} success - Whether the request succeeded or not.
*/

View File

@ -31,7 +31,7 @@ const CaveatFactories = Object.freeze({
/**
* A PreferencesController identity object.
*
* @typedef {Object} Identity
* @typedef {object} Identity
* @property {string} address - The address of the identity.
* @property {string} name - The name of the identity.
* @property {number} [lastSelected] - Unix timestamp of when the identity was

View File

@ -14,17 +14,17 @@ import { NETWORK_EVENTS } from './network';
export default class PreferencesController {
/**
*
* @typedef {Object} PreferencesController
* @param {Object} opts - Overrides the defaults for the initial state of this.store
* @property {Object} store The stored object containing a users preferences, stored in local storage
* @typedef {object} PreferencesController
* @param {object} opts - Overrides the defaults for the initial state of this.store
* @property {object} store The stored object containing a users preferences, stored in local storage
* @property {Array} store.frequentRpcList A list of custom rpcs to provide the user
* @property {boolean} store.useBlockie The users preference for blockie identicons within the UI
* @property {boolean} store.useNonceField The users preference for nonce field within the UI
* @property {Object} store.featureFlags A key-boolean map, where keys refer to features and booleans to whether the
* @property {object} store.featureFlags A key-boolean map, where keys refer to features and booleans to whether the
* user wishes to see that feature.
*
* Feature flags can be set by the global function `setPreference(feature, enabled)`, and so should not expose any sensitive behavior.
* @property {Object} store.knownMethodData Contains all data methods known by the user
* @property {object} store.knownMethodData Contains all data methods known by the user
* @property {string} store.currentLocale The preferred language locale key
* @property {string} store.selectedAddress A hex string that matches the currently selected address in the app
*/
@ -376,12 +376,12 @@ export default class PreferencesController {
/**
* updates custom RPC details
*
* @param {Object} newRpcDetails - Options bag.
* @param {object} newRpcDetails - Options bag.
* @param {string} newRpcDetails.rpcUrl - The RPC url to add to frequentRpcList.
* @param {string} newRpcDetails.chainId - The chainId of the selected network.
* @param {string} [newRpcDetails.ticker] - Optional ticker symbol of the selected network.
* @param {string} [newRpcDetails.nickname] - Optional nickname of the selected network.
* @param {Object} [newRpcDetails.rpcPrefs] - Optional RPC preferences, such as the block explorer URL
* @param {object} [newRpcDetails.rpcPrefs] - Optional RPC preferences, such as the block explorer URL
*/
async updateRpc(newRpcDetails) {
const rpcList = this.getFrequentRpcListDetail();
@ -456,7 +456,7 @@ export default class PreferencesController {
* @param {string} chainId - The chainId of the selected network.
* @param {string} [ticker] - Ticker symbol of the selected network.
* @param {string} [nickname] - Nickname of the selected network.
* @param {Object} [rpcPrefs] - Optional RPC preferences, such as the block explorer URL
* @param {object} [rpcPrefs] - Optional RPC preferences, such as the block explorer URL
*/
addToFrequentRpcList(
rpcUrl,
@ -550,7 +550,7 @@ export default class PreferencesController {
/**
* A getter for the `preferences` property
*
* @returns {Object} A key-boolean map of user-selected preferences.
* @returns {object} A key-boolean map of user-selected preferences.
*/
getPreferences() {
return this.store.getState().preferences;

View File

@ -883,7 +883,7 @@ export default class SwapsController {
* Calculates the median overallValueOfQuote of a sample of quotes.
*
* @param {Array} _quotes - A sample of quote objects with overallValueOfQuote, ethFee, metaMaskFeeInEth, and ethValueOfTokens properties
* @returns {Object} An object with the ethValueOfTokens, ethFee, and metaMaskFeeInEth of the quote with the median overallValueOfQuote
* @returns {object} An object with the ethValueOfTokens, ethFee, and metaMaskFeeInEth of the quote with the median overallValueOfQuote
*/
function getMedianEthValueQuote(_quotes) {
if (!Array.isArray(_quotes) || _quotes.length === 0) {
@ -960,7 +960,7 @@ function getMedianEthValueQuote(_quotes) {
*
* @param {Array} quotes - A sample of quote objects with overallValueOfQuote, ethFee, metaMaskFeeInEth and
* ethValueOfTokens properties
* @returns {Object} An object with the arithmetic mean each of the ethFee, metaMaskFeeInEth and ethValueOfTokens of
* @returns {object} An object with the arithmetic mean each of the ethFee, metaMaskFeeInEth and ethValueOfTokens of
* the passed quote objects
*/
function meansOfQuotesFeesAndValue(quotes) {

View File

@ -85,7 +85,7 @@ const VALID_UNAPPROVED_TRANSACTION_TYPES = [
const METRICS_STATUS_FAILED = 'failed on-chain';
/**
* @typedef {Object} CustomGasSettings
* @typedef {object} CustomGasSettings
* @property {string} [gas] - The gas limit to use for the transaction
* @property {string} [gasPrice] - The gasPrice to use for a legacy transaction
* @property {string} [maxFeePerGas] - The maximum amount to pay per gas on a
@ -109,16 +109,16 @@ const METRICS_STATUS_FAILED = 'failed on-chain';
* - nonceTracker
* calculating nonces
*
* @param {Object} opts
* @param {Object} opts.initState - initial transaction list default is an empty array
* @param {Object} opts.networkStore - an observable store for network number
* @param {Object} opts.blockTracker - An instance of eth-blocktracker
* @param {Object} opts.provider - A network provider.
* @param {object} opts
* @param {object} opts.initState - initial transaction list default is an empty array
* @param {object} opts.networkStore - an observable store for network number
* @param {object} opts.blockTracker - An instance of eth-blocktracker
* @param {object} opts.provider - A network provider.
* @param {Function} opts.signTransaction - function the signs an @ethereumjs/tx
* @param {Object} opts.getPermittedAccounts - get accounts that an origin has permissions for
* @param {object} opts.getPermittedAccounts - get accounts that an origin has permissions for
* @param {Function} opts.signTransaction - ethTx signer that returns a rawTx
* @param {number} [opts.txHistoryLimit] - number *optional* for limiting how many transactions are in state
* @param {Object} opts.preferencesStore
* @param {object} opts.preferencesStore
*/
export default class TransactionController extends EventEmitter {
@ -313,8 +313,8 @@ export default class TransactionController extends EventEmitter {
* Add a new unapproved transaction to the pipeline
*
* @returns {Promise<string>} the hash of the transaction after being submitted to the network
* @param {Object} txParams - txParams for the transaction
* @param {Object} opts - with the key origin to put the origin on the txMeta
* @param {object} txParams - txParams for the transaction
* @param {object} opts - with the key origin to put the origin on the txMeta
*/
async newUnapprovedTransaction(txParams, opts = {}) {
log.debug(
@ -802,7 +802,7 @@ export default class TransactionController extends EventEmitter {
/**
* Adds the tx gas defaults: gas && gasPrice
*
* @param {Object} txMeta - the txMeta object
* @param {object} txMeta - the txMeta object
* @param getCodeResponse
* @returns {Promise<object>} resolves with txMeta
*/
@ -945,7 +945,7 @@ export default class TransactionController extends EventEmitter {
/**
* Gets default gas fees, or returns `undefined` if gas fees are already set
*
* @param {Object} txMeta - The txMeta object
* @param {object} txMeta - The txMeta object
* @param eip1559Compatibility
* @returns {Promise<string|undefined>} The default gas price
*/
@ -1005,7 +1005,7 @@ export default class TransactionController extends EventEmitter {
/**
* Gets default gas limit, or debug information about why gas estimate failed.
*
* @param {Object} txMeta - The txMeta object
* @param {object} txMeta - The txMeta object
* @param {string} getCodeResponse - The transaction category code response, used for debugging purposes
* @returns {Promise<object>} Object containing the default gas limit, or the simulation failure object
*/
@ -1230,7 +1230,7 @@ export default class TransactionController extends EventEmitter {
/**
* updates the txMeta in the txStateManager
*
* @param {Object} txMeta - the updated txMeta
* @param {object} txMeta - the updated txMeta
*/
async updateTransaction(txMeta) {
this.txStateManager.updateTransaction(
@ -1242,7 +1242,7 @@ export default class TransactionController extends EventEmitter {
/**
* updates and approves the transaction
*
* @param {Object} txMeta
* @param {object} txMeta
*/
async updateAndApproveTransaction(txMeta) {
this.txStateManager.updateTransaction(
@ -1689,7 +1689,7 @@ export default class TransactionController extends EventEmitter {
//
/** maps methods for convenience*/
_mapMethods() {
/** @returns {Object} the state in transaction controller */
/** @returns {object} the state in transaction controller */
this.getState = () => this.memStore.getState();
/** @returns {string|number} the network number stored in networkStore */
@ -2147,8 +2147,8 @@ export default class TransactionController extends EventEmitter {
* @param {TransactionMeta} txMeta - Transaction meta object
* @param {TransactionMetaMetricsEventString} event - The event type that
* triggered fragment creation
* @param {Object} properties - properties to include in the fragment
* @param {Object} [sensitiveProperties] - sensitive properties to include in
* @param {object} properties - properties to include in the fragment
* @param {object} [sensitiveProperties] - sensitive properties to include in
* the fragment
*/
_createTransactionEventFragment(
@ -2261,9 +2261,9 @@ export default class TransactionController extends EventEmitter {
* object and uses them to create and send metrics for various transaction
* events.
*
* @param {Object} txMeta - the txMeta object
* @param {object} txMeta - the txMeta object
* @param {TransactionMetaMetricsEventString} event - the name of the transaction event
* @param {Object} extraParams - optional props and values to include in sensitiveProperties
* @param {object} extraParams - optional props and values to include in sensitiveProperties
*/
async _trackTransactionMetricsEvent(txMeta, event, extraParams = {}) {
if (!txMeta) {

View File

@ -28,8 +28,8 @@ export function migrateFromSnapshotsToDiffs(longHistory) {
* value
* with the first entry having the note and a timestamp when the change took place
*
* @param {Object} previousState - the previous state of the object
* @param {Object} newState - the update object
* @param {object} previousState - the previous state of the object
* @param {object} newState - the update object
* @param {string} [note] - a optional note for the state change
* @returns {Array}
*/
@ -49,7 +49,7 @@ export function generateHistoryEntry(previousState, newState, note) {
* Recovers previous txMeta state obj
*
* @param _shortHistory
* @returns {Object}
* @returns {object}
*/
export function replayHistory(_shortHistory) {
const shortHistory = cloneDeep(_shortHistory);
@ -61,8 +61,8 @@ export function replayHistory(_shortHistory) {
/**
* Snapshot {@code txMeta}
*
* @param {Object} txMeta - the tx metadata object
* @returns {Object} a deep clone without history
* @param {object} txMeta - the tx metadata object
* @returns {object} a deep clone without history
*/
export function snapshotFromTxMeta(txMeta) {
const shallow = { ...txMeta };

View File

@ -32,10 +32,10 @@ export function normalizeAndValidateTxParams(txParams, lowerCase = true) {
/**
* Normalizes the given txParams
*
* @param {Object} txParams - The transaction params
* @param {object} txParams - The transaction params
* @param {boolean} [lowerCase] - Whether to lowercase the 'to' address.
* Default: true
* @returns {Object} the normalized tx params
* @returns {object} the normalized tx params
*/
export function normalizeTxParams(txParams, lowerCase = true) {
// apply only keys in the normalizers
@ -52,7 +52,7 @@ export function normalizeTxParams(txParams, lowerCase = true) {
* Given two fields, ensure that the second field is not included in txParams,
* and if it is throw an invalidParams error.
*
* @param {Object} txParams - the transaction parameters object
* @param {object} txParams - the transaction parameters object
* @param {string} fieldBeingValidated - the current field being validated
* @param {string} mutuallyExclusiveField - the field to ensure is not provided
* @throws {ethErrors.rpc.invalidParams} Throws if mutuallyExclusiveField is
@ -74,7 +74,7 @@ function ensureMutuallyExclusiveFieldsNotProvided(
* Ensures that the provided value for field is a string, throws an
* invalidParams error if field is not a string.
*
* @param {Object} txParams - the transaction parameters object
* @param {object} txParams - the transaction parameters object
* @param {string} field - the current field being validated
* @throws {ethErrors.rpc.invalidParams} Throws if field is not a string
*/
@ -91,7 +91,7 @@ function ensureFieldIsString(txParams, field) {
* given field, if it is provided. If types do not match throws an
* invalidParams error.
*
* @param {Object} txParams - the transaction parameters object
* @param {object} txParams - the transaction parameters object
* @param {'gasPrice' | 'maxFeePerGas' | 'maxPriorityFeePerGas'} field - the
* current field being validated
* @throws {ethErrors.rpc.invalidParams} Throws if type does not match the
@ -126,7 +126,7 @@ function ensureProperTransactionEnvelopeTypeProvided(txParams, field) {
/**
* Validates the given tx parameters
*
* @param {Object} txParams - the tx params
* @param {object} txParams - the tx params
* @param {boolean} eip1559Compatibility - whether or not the current network supports EIP-1559 transactions
* @throws {Error} if the tx params contains invalid fields
*/
@ -227,7 +227,7 @@ export function validateTxParams(txParams, eip1559Compatibility = true) {
/**
* Validates the {@code from} field in the given tx params
*
* @param {Object} txParams
* @param {object} txParams
* @throws {Error} if the from address isn't valid
*/
export function validateFrom(txParams) {
@ -244,8 +244,8 @@ export function validateFrom(txParams) {
/**
* Validates the {@code to} field in the given tx params
*
* @param {Object} txParams - the tx params
* @returns {Object} the tx params
* @param {object} txParams - the tx params
* @returns {object} the tx params
* @throws {Error} if the recipient is invalid OR there isn't tx data
*/
export function validateRecipient(txParams) {

View File

@ -29,14 +29,14 @@ export default class PendingTransactionTracker extends EventEmitter {
droppedBlocksBufferByHash = new Map();
/**
* @param {Object} config - Configuration.
* @param {object} config - Configuration.
* @param {Function} config.approveTransaction - Approves a transaction.
* @param {Function} config.confirmTransaction - Set a transaction as confirmed.
* @param {Function} config.getCompletedTransactions - Returns completed transactions.
* @param {Function} config.getPendingTransactions - Returns an array of pending transactions,
* @param {Object} config.nonceTracker - see nonce tracker
* @param {Object} config.provider - A network provider.
* @param {Object} config.query - An EthQuery instance.
* @param {object} config.nonceTracker - see nonce tracker
* @param {object} config.provider - A network provider.
* @param {object} config.query - An EthQuery instance.
* @param {Function} config.publishTransaction - Publishes a raw transaction,
*/
constructor(config) {
@ -119,7 +119,7 @@ export default class PendingTransactionTracker extends EventEmitter {
*
* Will only attempt to retry the given tx every {@code 2**(txMeta.retryCount)} blocks.
*
* @param {Object} txMeta - the transaction metadata
* @param {object} txMeta - the transaction metadata
* @param {string} latestBlockNumber - the latest block number in hex
* @returns {Promise<string|undefined>} the tx hash if retried
* @fires tx:block-update
@ -160,7 +160,7 @@ export default class PendingTransactionTracker extends EventEmitter {
/**
* Query the network to see if the given {@code txMeta} has been included in a block
*
* @param {Object} txMeta - the transaction metadata
* @param {object} txMeta - the transaction metadata
* @returns {Promise<void>}
* @fires tx:confirmed
* @fires tx:dropped
@ -232,7 +232,7 @@ export default class PendingTransactionTracker extends EventEmitter {
/**
* Checks whether the nonce in the given {@code txMeta} is behind the network nonce
*
* @param {Object} txMeta - the transaction metadata
* @param {object} txMeta - the transaction metadata
* @returns {Promise<boolean>}
* @private
*/
@ -265,7 +265,7 @@ export default class PendingTransactionTracker extends EventEmitter {
/**
* Checks whether the nonce in the given {@code txMeta} is correct against the local set of transactions
*
* @param {Object} txMeta - the transaction metadata
* @param {object} txMeta - the transaction metadata
* @returns {Promise<boolean>}
* @private
*/

View File

@ -8,10 +8,10 @@ import { hexToBn, BnMultiplyByFraction, bnToHex } from '../../lib/util';
* Result of gas analysis, including either a gas estimate for a successful analysis, or
* debug information for a failed analysis.
*
* @typedef {Object} GasAnalysisResult
* @typedef {object} GasAnalysisResult
* @property {string} blockGasLimit - The gas limit of the block used for the analysis
* @property {string} estimatedGasHex - The estimated gas, in hexadecimal
* @property {Object} simulationFails - Debug information about why an analysis failed
* @property {object} simulationFails - Debug information about why an analysis failed
*/
/**
@ -19,7 +19,7 @@ import { hexToBn, BnMultiplyByFraction, bnToHex } from '../../lib/util';
* its passed ethquery
* and used to do things like calculate gas of a tx.
*
* @param {Object} provider - A network provider.
* @param {object} provider - A network provider.
*/
export default class TxGasUtil {
@ -28,7 +28,7 @@ export default class TxGasUtil {
}
/**
* @param {Object} txMeta - the txMeta object
* @param {object} txMeta - the txMeta object
* @returns {GasAnalysisResult} The result of the gas analysis
*/
async analyzeGasUsage(txMeta) {
@ -56,7 +56,7 @@ export default class TxGasUtil {
/**
* Estimates the tx's gas usage
*
* @param {Object} txMeta - the txMeta object
* @param {object} txMeta - the txMeta object
* @returns {string} the estimated gas limit as a hex string
*/
async estimateTxGas(txMeta) {

View File

@ -39,7 +39,7 @@ export const ERROR_SUBMITTING =
*/
/**
* @typedef {Object} TransactionState
* @typedef {object} TransactionState
* @property {Record<string, TransactionMeta>} transactions - TransactionMeta
* keyed by the transaction's id.
*/
@ -49,7 +49,7 @@ export const ERROR_SUBMITTING =
* storing the transaction. It also has some convenience methods for finding
* subsets of transactions.
*
* @param {Object} opts
* @param {object} opts
* @param {TransactionState} [opts.initState={ transactions: {} }] - initial
* transactions list keyed by id
* @param {number} [opts.txHistoryLimit] - limit for how many finished
@ -300,7 +300,7 @@ export default class TransactionStateManager extends EventEmitter {
/**
* updates the txMeta in the list and adds a history entry
*
* @param {Object} txMeta - the txMeta to update
* @param {object} txMeta - the txMeta to update
* @param {string} [note] - a note about the update for history
*/
updateTransaction(txMeta, note) {

View File

@ -1,7 +1,7 @@
/**
* @typedef {Object} FirstTimeState
* @property {Object} config Initial configuration parameters
* @property {Object} NetworkController Network controller state
* @typedef {object} FirstTimeState
* @property {object} config Initial configuration parameters
* @property {object} NetworkController Network controller state
*/
/**

View File

@ -23,12 +23,12 @@ export default class ComposableObservableStore extends ObservableStore {
/**
* Create a new store
*
* @param {Object} options
* @param {Object} [options.config] - Map of internal state keys to child stores
* @param {object} options
* @param {object} [options.config] - Map of internal state keys to child stores
* @param {ControllerMessenger} options.controllerMessenger - The controller
* messenger, used for subscribing to events from BaseControllerV2-based
* controllers.
* @param {Object} [options.state] - The initial store state
* @param {object} [options.state] - The initial store state
* @param {boolean} [options.persist] - Whether or not to apply the persistence for v2 controllers
*/
constructor({ config, controllerMessenger, state, persist }) {
@ -79,7 +79,7 @@ export default class ComposableObservableStore extends ObservableStore {
* Merges all child store state into a single object rather than
* returning an object keyed by child store class name
*
* @returns {Object} Object containing merged child store state
* @returns {object} Object containing merged child store state
*/
getFlatState() {
if (!this.config) {

View File

@ -49,21 +49,21 @@ import { bnToHex } from './util';
*
* It also tracks transaction hashes, and checks their inclusion status on each new block.
*
* @typedef {Object} AccountTracker
* @property {Object} store The stored object containing all accounts to track, as well as the current block's gas limit.
* @property {Object} store.accounts The accounts currently stored in this AccountTracker
* @typedef {object} AccountTracker
* @property {object} store The stored object containing all accounts to track, as well as the current block's gas limit.
* @property {object} store.accounts The accounts currently stored in this AccountTracker
* @property {string} store.currentBlockGasLimit A hex string indicating the gas limit of the current block
* @property {Object} _provider A provider needed to create the EthQuery instance used within this AccountTracker.
* @property {object} _provider A provider needed to create the EthQuery instance used within this AccountTracker.
* @property {EthQuery} _query An EthQuery instance used to access account information from the blockchain
* @property {BlockTracker} _blockTracker A BlockTracker instance. Needed to ensure that accounts and their info updates
* when a new block is created.
* @property {Object} _currentBlockNumber Reference to a property on the _blockTracker: the number (i.e. an id) of the the current block
* @property {object} _currentBlockNumber Reference to a property on the _blockTracker: the number (i.e. an id) of the the current block
*/
export default class AccountTracker {
/**
* @param {Object} opts - Options for initializing the controller
* @param {Object} opts.provider - An EIP-1193 provider instance that uses the current global network
* @param {Object} opts.blockTracker - A block tracker, which emits events for each new block
* @param {object} opts - Options for initializing the controller
* @param {object} opts.provider - An EIP-1193 provider instance that uses the current global network
* @param {object} opts.blockTracker - A block tracker, which emits events for each new block
* @param {Function} opts.getCurrentChainId - A function that returns the `chainId` for the current global network
*/
constructor(opts = {}) {

View File

@ -140,7 +140,7 @@ const createCoinbasePayUrl = (walletAddress, chainId) => {
/**
* Gives the caller a url at which the user can acquire eth, depending on the network they are in
*
* @param {Object} opts - Options required to determine the correct url
* @param {object} opts - Options required to determine the correct url
* @param {string} opts.chainId - The chainId for which to return a url
* @param {string} opts.address - The address the bought ETH should be sent to. Only relevant if chainId === '0x1'.
* @param opts.service

View File

@ -15,11 +15,11 @@ const hexRe = /^[0-9A-Fa-f]+$/gu;
* Represents, and contains data about, an 'eth_decrypt' type decryption request. These are created when a
* decryption for an eth_decrypt call is requested.
*
* @typedef {Object} DecryptMessage
* @typedef {object} DecryptMessage
* @property {number} id An id to track and identify the message object
* @property {Object} msgParams The parameters to pass to the decryptMessage method once the decryption request is
* @property {object} msgParams The parameters to pass to the decryptMessage method once the decryption request is
* approved.
* @property {Object} msgParams.metamaskId Added to msgParams for tracking and identification within MetaMask.
* @property {object} msgParams.metamaskId Added to msgParams for tracking and identification within MetaMask.
* @property {string} msgParams.data A hex string conversion of the raw buffer data of the decryption request
* @property {number} time The epoch time at which the this message was created
* @property {string} status Indicates whether the decryption request is 'unapproved', 'approved', 'decrypted' or 'rejected'
@ -56,7 +56,7 @@ export default class DecryptMessageManager extends EventEmitter {
/**
* A getter for the 'unapproved' DecryptMessages in this.messages
*
* @returns {Object} An index of DecryptMessage ids to DecryptMessages, for all 'unapproved' DecryptMessages in
* @returns {object} An index of DecryptMessage ids to DecryptMessages, for all 'unapproved' DecryptMessages in
* this.messages
*/
getUnapprovedMsgs() {
@ -73,8 +73,8 @@ export default class DecryptMessageManager extends EventEmitter {
* the new DecryptMessage to this.messages, and to save the unapproved DecryptMessages from that list to
* this.memStore.
*
* @param {Object} msgParams - The params for the eth_decrypt call to be made after the message is approved.
* @param {Object} [req] - The original request object possibly containing the origin
* @param {object} msgParams - The params for the eth_decrypt call to be made after the message is approved.
* @param {object} [req] - The original request object possibly containing the origin
* @returns {Promise<Buffer>} The raw decrypted message contents
*/
addUnapprovedMessageAsync(msgParams, req) {
@ -117,8 +117,8 @@ export default class DecryptMessageManager extends EventEmitter {
* the new DecryptMessage to this.messages, and to save the unapproved DecryptMessages from that list to
* this.memStore.
*
* @param {Object} msgParams - The params for the eth_decryptMsg call to be made after the message is approved.
* @param {Object} [req] - The original request object possibly containing the origin
* @param {object} msgParams - The params for the eth_decryptMsg call to be made after the message is approved.
* @param {object} [req] - The original request object possibly containing the origin
* @returns {number} The id of the newly created DecryptMessage.
*/
addUnapprovedMessage(msgParams, req) {
@ -175,8 +175,8 @@ export default class DecryptMessageManager extends EventEmitter {
* Approves a DecryptMessage. Sets the message status via a call to this.setMsgStatusApproved, and returns a promise
* with the message params modified for proper decryption.
*
* @param {Object} msgParams - The msgParams to be used when eth_decryptMsg is called, plus data added by MetaMask.
* @param {Object} msgParams.metamaskId - Added to msgParams for tracking and identification within MetaMask.
* @param {object} msgParams - The msgParams to be used when eth_decryptMsg is called, plus data added by MetaMask.
* @param {object} msgParams.metamaskId - Added to msgParams for tracking and identification within MetaMask.
* @returns {Promise<object>} Promises the msgParams object with metamaskId removed.
*/
approveMessage(msgParams) {
@ -210,7 +210,7 @@ export default class DecryptMessageManager extends EventEmitter {
/**
* Removes the metamaskId property from passed msgParams and returns a promise which resolves the updated msgParams
*
* @param {Object} msgParams - The msgParams to modify
* @param {object} msgParams - The msgParams to modify
* @returns {Promise<object>} Promises the msgParams with the metamaskId property removed
*/
prepMsgForDecryption(msgParams) {

View File

@ -11,11 +11,11 @@ import createId from '../../../shared/modules/random-id';
* Represents, and contains data about, an 'eth_getEncryptionPublicKey' type request. These are created when
* an eth_getEncryptionPublicKey call is requested.
*
* @typedef {Object} EncryptionPublicKey
* @typedef {object} EncryptionPublicKey
* @property {number} id An id to track and identify the message object
* @property {Object} msgParams The parameters to pass to the encryptionPublicKey method once the request is
* @property {object} msgParams The parameters to pass to the encryptionPublicKey method once the request is
* approved.
* @property {Object} msgParams.metamaskId Added to msgParams for tracking and identification within MetaMask.
* @property {object} msgParams.metamaskId Added to msgParams for tracking and identification within MetaMask.
* @property {string} msgParams.data A hex string conversion of the raw buffer data of the request
* @property {number} time The epoch time at which the this message was created
* @property {string} status Indicates whether the request is 'unapproved', 'approved', 'received' or 'rejected'
@ -52,7 +52,7 @@ export default class EncryptionPublicKeyManager extends EventEmitter {
/**
* A getter for the 'unapproved' EncryptionPublicKeys in this.messages
*
* @returns {Object} An index of EncryptionPublicKey ids to EncryptionPublicKeys, for all 'unapproved' EncryptionPublicKeys in
* @returns {object} An index of EncryptionPublicKey ids to EncryptionPublicKeys, for all 'unapproved' EncryptionPublicKeys in
* this.messages
*/
getUnapprovedMsgs() {
@ -69,8 +69,8 @@ export default class EncryptionPublicKeyManager extends EventEmitter {
* the new EncryptionPublicKey to this.messages, and to save the unapproved EncryptionPublicKeys from that list to
* this.memStore.
*
* @param {Object} address - The param for the eth_getEncryptionPublicKey call to be made after the message is approved.
* @param {Object} [req] - The original request object possibly containing the origin
* @param {object} address - The param for the eth_getEncryptionPublicKey call to be made after the message is approved.
* @param {object} [req] - The original request object possibly containing the origin
* @returns {Promise<Buffer>} The raw public key contents
*/
addUnapprovedMessageAsync(address, req) {
@ -110,8 +110,8 @@ export default class EncryptionPublicKeyManager extends EventEmitter {
* the new EncryptionPublicKey to this.messages, and to save the unapproved EncryptionPublicKeys from that list to
* this.memStore.
*
* @param {Object} address - The param for the eth_getEncryptionPublicKey call to be made after the message is approved.
* @param {Object} [req] - The original request object possibly containing the origin
* @param {object} address - The param for the eth_getEncryptionPublicKey call to be made after the message is approved.
* @param {object} [req] - The original request object possibly containing the origin
* @returns {number} The id of the newly created EncryptionPublicKey.
*/
addUnapprovedMessage(address, req) {
@ -164,8 +164,8 @@ export default class EncryptionPublicKeyManager extends EventEmitter {
* Approves a EncryptionPublicKey. Sets the message status via a call to this.setMsgStatusApproved, and returns a promise
* with any the message params modified for proper providing.
*
* @param {Object} msgParams - The msgParams to be used when eth_getEncryptionPublicKey is called, plus data added by MetaMask.
* @param {Object} msgParams.metamaskId - Added to msgParams for tracking and identification within MetaMask.
* @param {object} msgParams - The msgParams to be used when eth_getEncryptionPublicKey is called, plus data added by MetaMask.
* @param {object} msgParams.metamaskId - Added to msgParams for tracking and identification within MetaMask.
* @returns {Promise<object>} Promises the msgParams object with metamaskId removed.
*/
approveMessage(msgParams) {
@ -199,7 +199,7 @@ export default class EncryptionPublicKeyManager extends EventEmitter {
/**
* Removes the metamaskId property from passed msgParams and returns a promise which resolves the updated msgParams
*
* @param {Object} msgParams - The msgParams to modify
* @param {object} msgParams - The msgParams to modify
* @returns {Promise<object>} Promises the msgParams with the metamaskId property removed
*/
prepMsgForEncryptionPublicKey(msgParams) {

View File

@ -16,8 +16,8 @@ import { cloneDeep } from 'lodash';
* Creates an object that represents the structure of the given object. It replaces all values with the result of their
* type.
*
* @param {Object} obj - The object for which a 'structure' will be returned. Usually a plain object and not a class.
* @returns {Object} The "mapped" version of a deep clone of the passed object, with each non-object property value
* @param {object} obj - The object for which a 'structure' will be returned. Usually a plain object and not a class.
* @returns {object} The "mapped" version of a deep clone of the passed object, with each non-object property value
* replaced with the javascript type of that value.
*/
export default function getObjStructure(obj) {
@ -31,9 +31,9 @@ export default function getObjStructure(obj) {
* Modifies all the properties and deeply nested of a passed object. Iterates recursively over all nested objects and
* their properties, and covers the entire depth of the object. At each property value which is not an object is modified.
*
* @param {Object} target - The object to modify
* @param {object} target - The object to modify
* @param {Function} visit - The modifier to apply to each non-object property value
* @returns {Object} The modified object
* @returns {object} The modified object
*/
function deepMap(target = {}, visit) {
Object.entries(target).forEach(([key, value]) => {

View File

@ -34,7 +34,7 @@ export default class ExtensionStore {
/**
* Sets the key in local state
*
* @param {Object} state - The state to set
* @param {object} state - The state to set
* @returns {Promise<void>}
*/
async set(state) {
@ -45,7 +45,7 @@ export default class ExtensionStore {
* Returns all of the keys currently saved
*
* @private
* @returns {Object} the key-value map from local storage
* @returns {object} the key-value map from local storage
*/
_get() {
const { local } = browser.storage;
@ -64,7 +64,7 @@ export default class ExtensionStore {
/**
* Sets the key in local state
*
* @param {Object} obj - The key to set
* @param {object} obj - The key to set
* @returns {Promise<void>}
* @private
*/
@ -86,7 +86,7 @@ export default class ExtensionStore {
/**
* Returns whether or not the given object contains no keys
*
* @param {Object} obj - The object to check
* @param {object} obj - The object to check
* @returns {boolean}
*/
function isEmpty(obj) {

View File

@ -12,10 +12,10 @@ import { EVENT } from '../../../shared/constants/metametrics';
* an eth_sign call is requested.
*
* @see {@link https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign}
* @typedef {Object} Message
* @typedef {object} Message
* @property {number} id An id to track and identify the message object
* @property {Object} msgParams The parameters to pass to the eth_sign method once the signature request is approved.
* @property {Object} msgParams.metamaskId Added to msgParams for tracking and identification within MetaMask.
* @property {object} msgParams The parameters to pass to the eth_sign method once the signature request is approved.
* @property {object} msgParams.metamaskId Added to msgParams for tracking and identification within MetaMask.
* @property {string} msgParams.data A hex string conversion of the raw buffer data of the signature request
* @property {number} time The epoch time at which the this message was created
* @property {string} status Indicates whether the signature request is 'unapproved', 'approved', 'signed' or 'rejected'
@ -52,7 +52,7 @@ export default class MessageManager extends EventEmitter {
/**
* A getter for the 'unapproved' Messages in this.messages
*
* @returns {Object} An index of Message ids to Messages, for all 'unapproved' Messages in this.messages
* @returns {object} An index of Message ids to Messages, for all 'unapproved' Messages in this.messages
*/
getUnapprovedMsgs() {
return this.messages
@ -67,8 +67,8 @@ export default class MessageManager extends EventEmitter {
* Creates a new Message with an 'unapproved' status using the passed msgParams. this.addMsg is called to add the
* new Message to this.messages, and to save the unapproved Messages from that list to this.memStore.
*
* @param {Object} msgParams - The params for the eth_sign call to be made after the message is approved.
* @param {Object} [req] - The original request object possibly containing the origin
* @param {object} msgParams - The params for the eth_sign call to be made after the message is approved.
* @param {object} [req] - The original request object possibly containing the origin
* @returns {promise} after signature has been
*/
async addUnapprovedMessageAsync(msgParams, req) {
@ -106,8 +106,8 @@ export default class MessageManager extends EventEmitter {
* Creates a new Message with an 'unapproved' status using the passed msgParams. this.addMsg is called to add the
* new Message to this.messages, and to save the unapproved Messages from that list to this.memStore.
*
* @param {Object} msgParams - The params for the eth_sign call to be made after the message is approved.
* @param {Object} [req] - The original request object where the origin may be specified
* @param {object} msgParams - The params for the eth_sign call to be made after the message is approved.
* @param {object} [req] - The original request object where the origin may be specified
* @returns {number} The id of the newly created message.
*/
addUnapprovedMessage(msgParams, req) {
@ -158,8 +158,8 @@ export default class MessageManager extends EventEmitter {
* Approves a Message. Sets the message status via a call to this.setMsgStatusApproved, and returns a promise with
* any the message params modified for proper signing.
*
* @param {Object} msgParams - The msgParams to be used when eth_sign is called, plus data added by MetaMask.
* @param {Object} msgParams.metamaskId - Added to msgParams for tracking and identification within MetaMask.
* @param {object} msgParams - The msgParams to be used when eth_sign is called, plus data added by MetaMask.
* @param {object} msgParams.metamaskId - Added to msgParams for tracking and identification within MetaMask.
* @returns {Promise<object>} Promises the msgParams object with metamaskId removed.
*/
approveMessage(msgParams) {
@ -193,7 +193,7 @@ export default class MessageManager extends EventEmitter {
/**
* Removes the metamaskId property from passed msgParams and returns a promise which resolves the updated msgParams
*
* @param {Object} msgParams - The msgParams to modify
* @param {object} msgParams - The msgParams to modify
* @returns {Promise<object>} Promises the msgParams with the metamaskId property removed
*/
prepMsgForSigning(msgParams) {

View File

@ -1,13 +1,13 @@
import EventEmitter from 'events';
/**
* @typedef {Object} Migration
* @typedef {object} Migration
* @property {number} version - The migration version
* @property {Function} migrate - Returns a promise of the migrated data
*/
/**
* @typedef {Object} MigratorOptions
* @typedef {object} MigratorOptions
* @property {Array<Migration>} [migrations] - The list of migrations to apply
* @property {number} [defaultVersion] - The version to use in the initial state
*/
@ -82,7 +82,7 @@ export default class Migrator extends EventEmitter {
/**
* Returns the initial state for the migrator
*
* @param {Object} [data] - The data for the initial state
* @param {object} [data] - The data for the initial state
* @returns {{meta: {version: number}, data: any}}
*/
generateInitialState(data) {

View File

@ -53,7 +53,7 @@ export default class ReadOnlyNetworkStore {
/**
* Set state
*
* @param {Object} state - The state to set
* @param {object} state - The state to set
* @returns {Promise<void>}
*/
async set(state) {

View File

@ -16,11 +16,11 @@ const hexRe = /^[0-9A-Fa-f]+$/gu;
* signature for an personal_sign call is requested.
*
* @see {@link https://web3js.readthedocs.io/en/1.0/web3-eth-personal.html#sign}
* @typedef {Object} PersonalMessage
* @typedef {object} PersonalMessage
* @property {number} id An id to track and identify the message object
* @property {Object} msgParams The parameters to pass to the personal_sign method once the signature request is
* @property {object} msgParams The parameters to pass to the personal_sign method once the signature request is
* approved.
* @property {Object} msgParams.metamaskId Added to msgParams for tracking and identification within MetaMask.
* @property {object} msgParams.metamaskId Added to msgParams for tracking and identification within MetaMask.
* @property {string} msgParams.data A hex string conversion of the raw buffer data of the signature request
* @property {number} time The epoch time at which the this message was created
* @property {string} status Indicates whether the signature request is 'unapproved', 'approved', 'signed' or 'rejected'
@ -57,7 +57,7 @@ export default class PersonalMessageManager extends EventEmitter {
/**
* A getter for the 'unapproved' PersonalMessages in this.messages
*
* @returns {Object} An index of PersonalMessage ids to PersonalMessages, for all 'unapproved' PersonalMessages in
* @returns {object} An index of PersonalMessage ids to PersonalMessages, for all 'unapproved' PersonalMessages in
* this.messages
*/
getUnapprovedMsgs() {
@ -74,8 +74,8 @@ export default class PersonalMessageManager extends EventEmitter {
* the new PersonalMessage to this.messages, and to save the unapproved PersonalMessages from that list to
* this.memStore.
*
* @param {Object} msgParams - The params for the eth_sign call to be made after the message is approved.
* @param {Object} [req] - The original request object possibly containing the origin
* @param {object} msgParams - The params for the eth_sign call to be made after the message is approved.
* @param {object} [req] - The original request object possibly containing the origin
* @returns {promise} When the message has been signed or rejected
*/
addUnapprovedMessageAsync(msgParams, req) {
@ -120,8 +120,8 @@ export default class PersonalMessageManager extends EventEmitter {
* the new PersonalMessage to this.messages, and to save the unapproved PersonalMessages from that list to
* this.memStore.
*
* @param {Object} msgParams - The params for the eth_sign call to be made after the message is approved.
* @param {Object} [req] - The original request object possibly containing the origin
* @param {object} msgParams - The params for the eth_sign call to be made after the message is approved.
* @param {object} [req] - The original request object possibly containing the origin
* @returns {number} The id of the newly created PersonalMessage.
*/
addUnapprovedMessage(msgParams, req) {
@ -178,8 +178,8 @@ export default class PersonalMessageManager extends EventEmitter {
* Approves a PersonalMessage. Sets the message status via a call to this.setMsgStatusApproved, and returns a promise
* with any the message params modified for proper signing.
*
* @param {Object} msgParams - The msgParams to be used when eth_sign is called, plus data added by MetaMask.
* @param {Object} msgParams.metamaskId - Added to msgParams for tracking and identification within MetaMask.
* @param {object} msgParams - The msgParams to be used when eth_sign is called, plus data added by MetaMask.
* @param {object} msgParams.metamaskId - Added to msgParams for tracking and identification within MetaMask.
* @returns {Promise<object>} Promises the msgParams object with metamaskId removed.
*/
approveMessage(msgParams) {
@ -213,7 +213,7 @@ export default class PersonalMessageManager extends EventEmitter {
/**
* Removes the metamaskId property from passed msgParams and returns a promise which resolves the updated msgParams
*
* @param {Object} msgParams - The msgParams to modify
* @param {object} msgParams - The msgParams to modify
* @returns {Promise<object>} Promises the msgParams with the metamaskId property removed
*/
prepMsgForSigning(msgParams) {

View File

@ -16,14 +16,14 @@ const getProviderState = {
export default getProviderState;
/**
* @typedef {Object} ProviderStateHandlerResult
* @typedef {object} ProviderStateHandlerResult
* @property {string} chainId - The current chain ID.
* @property {boolean} isUnlocked - Whether the extension is unlocked or not.
* @property {string} networkVersion - The current network ID.
*/
/**
* @typedef {Object} ProviderStateHandlerOptions
* @typedef {object} ProviderStateHandlerOptions
* @property {() => ProviderStateHandlerResult} getProviderState - A function that
* gets the current provider state.
*/

View File

@ -20,7 +20,7 @@ const logWeb3ShimUsage = {
export default logWeb3ShimUsage;
/**
* @typedef {Object} LogWeb3ShimUsageOptions
* @typedef {object} LogWeb3ShimUsageOptions
* @property {Function} sendMetrics - A function that registers a metrics event.
* @property {Function} getWeb3ShimUsageState - A function that gets web3 shim
* usage state for the given origin.

View File

@ -11,14 +11,14 @@ const watchAsset = {
export default watchAsset;
/**
* @typedef {Object} WatchAssetOptions
* @typedef {object} WatchAssetOptions
* @property {Function} handleWatchAssetRequest - The wallet_watchAsset method implementation.
*/
/**
* @typedef {Object} WatchAssetParam
* @typedef {object} WatchAssetParam
* @property {string} type - The type of the asset to watch.
* @property {Object} options - Watch options for the asset.
* @property {object} options - Watch options for the asset.
*/
/**

View File

@ -15,12 +15,12 @@ import { isValidHexAddress } from '../../../shared/modules/hexstring-utils';
* Represents, and contains data about, an 'eth_signTypedData' type signature request. These are created when a
* signature for an eth_signTypedData call is requested.
*
* @typedef {Object} TypedMessage
* @typedef {object} TypedMessage
* @property {number} id An id to track and identify the message object
* @property {Object} msgParams The parameters to pass to the eth_signTypedData method once the signature request is
* @property {object} msgParams The parameters to pass to the eth_signTypedData method once the signature request is
* approved.
* @property {Object} msgParams.metamaskId Added to msgParams for tracking and identification within MetaMask.
* @property {Object} msgParams.from The address that is making the signature request.
* @property {object} msgParams.metamaskId Added to msgParams for tracking and identification within MetaMask.
* @property {object} msgParams.from The address that is making the signature request.
* @property {string} msgParams.data A hex string conversion of the raw buffer data of the signature request
* @property {number} time The epoch time at which the this message was created
* @property {string} status Indicates whether the signature request is 'unapproved', 'approved', 'signed', 'rejected', or 'errored'
@ -59,7 +59,7 @@ export default class TypedMessageManager extends EventEmitter {
/**
* A getter for the 'unapproved' TypedMessages in this.messages
*
* @returns {Object} An index of TypedMessage ids to TypedMessages, for all 'unapproved' TypedMessages in
* @returns {object} An index of TypedMessage ids to TypedMessages, for all 'unapproved' TypedMessages in
* this.messages
*/
getUnapprovedMsgs() {
@ -76,8 +76,8 @@ export default class TypedMessageManager extends EventEmitter {
* the new TypedMessage to this.messages, and to save the unapproved TypedMessages from that list to
* this.memStore. Before any of this is done, msgParams are validated
*
* @param {Object} msgParams - The params for the eth_sign call to be made after the message is approved.
* @param {Object} [req] - The original request object possibly containing the origin
* @param {object} msgParams - The params for the eth_sign call to be made after the message is approved.
* @param {object} [req] - The original request object possibly containing the origin
* @param version
* @returns {promise} When the message has been signed or rejected
*/
@ -116,8 +116,8 @@ export default class TypedMessageManager extends EventEmitter {
* the new TypedMessage to this.messages, and to save the unapproved TypedMessages from that list to
* this.memStore. Before any of this is done, msgParams are validated
*
* @param {Object} msgParams - The params for the eth_sign call to be made after the message is approved.
* @param {Object} [req] - The original request object possibly containing the origin
* @param {object} msgParams - The params for the eth_sign call to be made after the message is approved.
* @param {object} [req] - The original request object possibly containing the origin
* @param version
* @returns {number} The id of the newly created TypedMessage.
*/
@ -152,7 +152,7 @@ export default class TypedMessageManager extends EventEmitter {
/**
* Helper method for this.addUnapprovedMessage. Validates that the passed params have the required properties.
*
* @param {Object} params - The params to validate
* @param {object} params - The params to validate
*/
validateParams(params) {
assert.ok(
@ -249,8 +249,8 @@ export default class TypedMessageManager extends EventEmitter {
* Approves a TypedMessage. Sets the message status via a call to this.setMsgStatusApproved, and returns a promise
* with any the message params modified for proper signing.
*
* @param {Object} msgParams - The msgParams to be used when eth_sign is called, plus data added by MetaMask.
* @param {Object} msgParams.metamaskId - Added to msgParams for tracking and identification within MetaMask.
* @param {object} msgParams - The msgParams to be used when eth_sign is called, plus data added by MetaMask.
* @param {object} msgParams.metamaskId - Added to msgParams for tracking and identification within MetaMask.
* @returns {Promise<object>} Promises the msgParams object with metamaskId removed.
*/
approveMessage(msgParams) {
@ -284,7 +284,7 @@ export default class TypedMessageManager extends EventEmitter {
/**
* Removes the metamaskId property from passed msgParams and returns a promise which resolves the updated msgParams
*
* @param {Object} msgParams - The msgParams to modify
* @param {object} msgParams - The msgParams to modify
* @returns {Promise<object>} Promises the msgParams with the metamaskId property removed
*/
prepMsgForSigning(msgParams) {

View File

@ -76,7 +76,7 @@ const getPlatform = () => {
* Converts a hex string to a BN object
*
* @param {string} inputHex - A number represented as a hex string
* @returns {Object} A BN object
* @returns {object} A BN object
*/
function hexToBn(inputHex) {
return new BN(stripHexPrefix(inputHex), 16);

View File

@ -74,7 +74,7 @@ try {
* We want to make globals non-writable, and we can't set the `writable`
* property and accessor properties at the same time.
*
* @param {Object} descriptor - The propertyName descriptor to check.
* @param {object} descriptor - The propertyName descriptor to check.
* @returns {boolean} Whether the propertyName descriptor has any accessors.
*/
function hasAccessor(descriptor) {

View File

@ -166,7 +166,7 @@ const PHISHING_SAFELIST = 'metamask-phishing-safelist';
export default class MetamaskController extends EventEmitter {
/**
* @param {Object} opts
* @param {object} opts
*/
constructor(opts) {
super();
@ -1441,9 +1441,9 @@ export default class MetamaskController extends EventEmitter {
/**
* Gets network state relevant for external providers.
*
* @param {Object} [memState] - The MetaMask memState. If not provided,
* @param {object} [memState] - The MetaMask memState. If not provided,
* this function will retrieve the most recent state.
* @returns {Object} An object with relevant network state properties.
* @returns {object} An object with relevant network state properties.
*/
getProviderNetworkState(memState) {
const { network } = memState || this.getState();
@ -1460,7 +1460,7 @@ export default class MetamaskController extends EventEmitter {
/**
* The metamask-state of the various controllers, made available to the UI
*
* @returns {Object} status
* @returns {object} status
*/
getState() {
const { vault } = this.keyringController.store.getState();
@ -1477,7 +1477,7 @@ export default class MetamaskController extends EventEmitter {
* These functions are the interface for the UI.
* The API object can be transmitted over a stream via JSON-RPC.
*
* @returns {Object} Object containing API functions.
* @returns {object} Object containing API functions.
*/
getApi() {
const {
@ -2029,7 +2029,7 @@ export default class MetamaskController extends EventEmitter {
* For example, a mnemonic phrase can generate many accounts, and is a keyring.
*
* @param {string} password
* @returns {Object} vault
* @returns {object} vault
*/
async createNewVaultAndKeychain(password) {
const releaseLock = await this.createVaultMutex.acquire();
@ -2803,8 +2803,8 @@ export default class MetamaskController extends EventEmitter {
* this wrapper needs to exist so we can provide a reference to
* "newUnapprovedTransaction" before "txController" is instantiated
*
* @param {Object} txParams - The transaction parameters.
* @param {Object} [req] - The original request, containing the origin.
* @param {object} txParams - The transaction parameters.
* @param {object} [req] - The original request, containing the origin.
*/
async newUnapprovedTransaction(txParams, req) {
return await this.txController.newUnapprovedTransaction(txParams, req);
@ -2818,8 +2818,8 @@ export default class MetamaskController extends EventEmitter {
* path, since this data can be a transaction, or can leak private key
* information.
*
* @param {Object} msgParams - The params passed to eth_sign.
* @param {Object} [req] - The original request, containing the origin.
* @param {object} msgParams - The params passed to eth_sign.
* @param {object} [req] - The original request, containing the origin.
*/
async newUnsignedMessage(msgParams, req) {
const data = normalizeMsgData(msgParams.data);
@ -2868,7 +2868,7 @@ export default class MetamaskController extends EventEmitter {
/**
* Signifies user intent to complete an eth_sign method.
*
* @param {Object} msgParams - The params passed to eth_call.
* @param {object} msgParams - The params passed to eth_call.
* @returns {Promise<object>} Full state update.
*/
async signMessage(msgParams) {
@ -2910,8 +2910,8 @@ export default class MetamaskController extends EventEmitter {
*
* We currently define our eth_sign and personal_sign mostly for legacy Dapps.
*
* @param {Object} msgParams - The params of the message to sign & return to the Dapp.
* @param {Object} [req] - The original request, containing the origin.
* @param {object} msgParams - The params of the message to sign & return to the Dapp.
* @param {object} [req] - The original request, containing the origin.
*/
async newUnsignedPersonalMessage(msgParams, req) {
const promise = this.personalMessageManager.addUnapprovedMessageAsync(
@ -2927,7 +2927,7 @@ export default class MetamaskController extends EventEmitter {
* Signifies a user's approval to sign a personal_sign message in queue.
* Triggers signing, and the callback function from newUnsignedPersonalMessage.
*
* @param {Object} msgParams - The params of the message to sign & return to the Dapp.
* @param {object} msgParams - The params of the message to sign & return to the Dapp.
* @returns {Promise<object>} A full state update.
*/
async signPersonalMessage(msgParams) {
@ -2969,8 +2969,8 @@ export default class MetamaskController extends EventEmitter {
/**
* Called when a dapp uses the eth_decrypt method.
*
* @param {Object} msgParams - The params of the message to sign & return to the Dapp.
* @param {Object} req - (optional) the original request, containing the origin
* @param {object} msgParams - The params of the message to sign & return to the Dapp.
* @param {object} req - (optional) the original request, containing the origin
* Passed back to the requesting Dapp.
*/
async newRequestDecryptMessage(msgParams, req) {
@ -2986,7 +2986,7 @@ export default class MetamaskController extends EventEmitter {
/**
* Only decrypt message and don't touch transaction state
*
* @param {Object} msgParams - The params of the message to decrypt.
* @param {object} msgParams - The params of the message to decrypt.
* @returns {Promise<object>} A full state update.
*/
async decryptMessageInline(msgParams) {
@ -3012,7 +3012,7 @@ export default class MetamaskController extends EventEmitter {
* Signifies a user's approval to decrypt a message in queue.
* Triggers decrypt, and the callback function from newUnsignedDecryptMessage.
*
* @param {Object} msgParams - The params of the message to decrypt & return to the Dapp.
* @param {object} msgParams - The params of the message to decrypt & return to the Dapp.
* @returns {Promise<object>} A full state update.
*/
async decryptMessage(msgParams) {
@ -3058,8 +3058,8 @@ export default class MetamaskController extends EventEmitter {
/**
* Called when a dapp uses the eth_getEncryptionPublicKey method.
*
* @param {Object} msgParams - The params of the message to sign & return to the Dapp.
* @param {Object} req - (optional) the original request, containing the origin
* @param {object} msgParams - The params of the message to sign & return to the Dapp.
* @param {object} req - (optional) the original request, containing the origin
* Passed back to the requesting Dapp.
*/
async newRequestEncryptionPublicKey(msgParams, req) {
@ -3113,7 +3113,7 @@ export default class MetamaskController extends EventEmitter {
* Signifies a user's approval to receiving encryption public key in queue.
* Triggers receiving, and the callback function from newUnsignedEncryptionPublicKey.
*
* @param {Object} msgParams - The params of the message to receive & return to the Dapp.
* @param {object} msgParams - The params of the message to receive & return to the Dapp.
* @returns {Promise<object>} A full state update.
*/
async encryptionPublicKey(msgParams) {
@ -3160,8 +3160,8 @@ export default class MetamaskController extends EventEmitter {
/**
* Called when a dapp uses the eth_signTypedData method, per EIP 712.
*
* @param {Object} msgParams - The params passed to eth_signTypedData.
* @param {Object} [req] - The original request, containing the origin.
* @param {object} msgParams - The params passed to eth_signTypedData.
* @param {object} [req] - The original request, containing the origin.
* @param version
*/
newUnsignedTypedMessage(msgParams, req, version) {
@ -3179,8 +3179,8 @@ export default class MetamaskController extends EventEmitter {
* The method for a user approving a call to eth_signTypedData, per EIP 712.
* Triggers the callback in newUnsignedTypedMessage.
*
* @param {Object} msgParams - The params passed to eth_signTypedData.
* @returns {Object} Full state update.
* @param {object} msgParams - The params passed to eth_signTypedData.
* @returns {object} Full state update.
*/
async signTypedMessage(msgParams) {
log.info('MetaMaskController - eth_signTypedData');
@ -3245,7 +3245,7 @@ export default class MetamaskController extends EventEmitter {
* ).CustomGasSettings} [customGasSettings] - overrides to use for gas params
* instead of allowing this method to generate them
* @param newTxMetaProps
* @returns {Object} MetaMask state
* @returns {object} MetaMask state
*/
async createCancelTransaction(
originalTxId,
@ -3272,7 +3272,7 @@ export default class MetamaskController extends EventEmitter {
* ).CustomGasSettings} [customGasSettings] - overrides to use for gas params
* instead of allowing this method to generate them
* @param newTxMetaProps
* @returns {Object} MetaMask state
* @returns {object} MetaMask state
*/
async createSpeedUpTransaction(
originalTxId,
@ -3331,14 +3331,14 @@ export default class MetamaskController extends EventEmitter {
* A runtime.MessageSender object, as provided by the browser:
*
* @see https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/MessageSender
* @typedef {Object} MessageSender
* @typedef {object} MessageSender
* @property {string} - The URL of the page or frame hosting the script that sent the message.
*/
/**
* A Snap sender object.
*
* @typedef {Object} SnapSender
* @typedef {object} SnapSender
* @property {string} snapId - The ID of the snap.
*/
@ -3576,7 +3576,7 @@ export default class MetamaskController extends EventEmitter {
/**
* A method for creating a provider that is safely restricted for the requesting subject.
*
* @param {Object} options - Provider engine options
* @param {object} options - Provider engine options
* @param {string} options.origin - The origin of the sender
* @param {MessageSender | SnapSender} options.sender - The sender object.
* @param {string} options.subjectType - The type of the sender subject.
@ -3800,8 +3800,8 @@ export default class MetamaskController extends EventEmitter {
* can be deleted later.
*
* @param {string} origin - The connection's origin string.
* @param {Object} options - Data associated with the connection
* @param {Object} options.engine - The connection's JSON Rpc Engine
* @param {object} options - Data associated with the connection
* @param {object} options.engine - The connection's JSON Rpc Engine
* @returns {string} The connection's id (so that it can be deleted later)
*/
addConnection(origin, { engine }) {
@ -3916,7 +3916,7 @@ export default class MetamaskController extends EventEmitter {
/**
* Handle a KeyringController update
*
* @param {Object} state - the KC state
* @param {object} state - the KC state
* @returns {Promise<void>}
* @private
*/
@ -4102,7 +4102,7 @@ export default class MetamaskController extends EventEmitter {
* @param {string} chainId - The chainId of the selected network.
* @param {string} ticker - The ticker symbol of the selected network.
* @param {string} [nickname] - Nickname of the selected network.
* @param {Object} [rpcPrefs] - RPC preferences.
* @param {object} [rpcPrefs] - RPC preferences.
* @param {string} [rpcPrefs.blockExplorerUrl] - URL of block explorer for the chain.
* @returns {Promise<string>} The RPC Target URL confirmed.
*/
@ -4192,8 +4192,8 @@ export default class MetamaskController extends EventEmitter {
* Returns the first RPC info object that matches at least one field of the
* provided search criteria. Returns null if no match is found
*
* @param {Object} rpcInfo - The RPC endpoint properties and values to check.
* @returns {Object} rpcInfo found in the frequentRpcList
* @param {object} rpcInfo - The RPC endpoint properties and values to check.
* @returns {object} rpcInfo found in the frequentRpcList
*/
findCustomRpcBy(rpcInfo) {
const frequentRpcListDetail = this.preferencesController.getFrequentRpcListDetail();
@ -4238,7 +4238,7 @@ export default class MetamaskController extends EventEmitter {
/**
* A method for initializing storage the first time.
*
* @param {Object} initState - The default state to initialize with.
* @param {object} initState - The default state to initialize with.
* @private
*/
recordFirstTimeInfo(initState) {

View File

@ -198,7 +198,7 @@ function updateChainIds(networkEntries, chainId) {
*
* @param localhostTokens
* @param rpcTokens
* @returns {Array<Object>}
* @returns {Array<object>}
*/
function mergeTokenArrays(localhostTokens, rpcTokens) {
const localhostTokensMap = tokenArrayToMap(localhostTokens);

View File

@ -132,7 +132,7 @@ async function writeJson(obj, file) {
*
* @param {BuildType} buildType - The build type.
* @param {string} platform - The platform (i.e. the browser).
* @returns {Object} The build modificantions for the given build type and platform.
* @returns {object} The build modificantions for the given build type and platform.
*/
async function getBuildModifications(buildType, platform) {
if (!Object.values(BuildType).includes(buildType)) {

View File

@ -10,7 +10,7 @@ const { BuildType } = require('../lib/build-type');
*
* @param {string[]} platforms - A list of browsers to generate versions for.
* @param {string} version - The current version.
* @returns {Object} An object with the browser as the key and the browser-specific version object
* @returns {object} An object with the browser as the key and the browser-specific version object
* as the value. For example, the version `9.6.0-beta.1` would return the object
* `{ firefox: { version: '9.6.0.beta1' }, chrome: { version: '9.6.0.1', version_name: '9.6.0-beta.1' } }`.
*/

View File

@ -3,7 +3,7 @@
* of retries is exceeded, whichever comes first (with an optional delay in
* between retries).
*
* @param {Object} args - A set of arguments and options.
* @param {object} args - A set of arguments and options.
* @param {number} args.retries - The maximum number of times to re-run the
* function on failure.
* @param {number} args.delay - The amount of time (in milliseconds) to wait in

View File

@ -13,7 +13,7 @@ export const GAS_LIMITS = {
};
/**
* @typedef {Object} GasEstimateTypes
* @typedef {object} GasEstimateTypes
* @property {'fee-market'} FEE_MARKET - A gas estimate for a fee market
* transaction generated by our gas estimation API.
* @property {'legacy'} LEGACY - A gas estimate for a legacy Transaction

View File

@ -9,7 +9,7 @@
* event was triggered. Also included as full details of the current page in
* page events.
*
* @typedef {Object} MetaMetricsPageObject
* @typedef {object} MetaMetricsPageObject
* @property {string} [path] - the path of the current page (e.g /home)
* @property {string} [title] - the title of the current page (e.g 'home')
* @property {string} [url] - the fully qualified url of the current page
@ -18,7 +18,7 @@
/**
* For metamask, this is the dapp that triggered an interaction
*
* @typedef {Object} MetaMetricsReferrerObject
* @typedef {object} MetaMetricsReferrerObject
* @property {string} [url] - the origin of the dapp issuing the
* notification
*/
@ -31,8 +31,8 @@
* function, but still provides the consumer a way to override these values if
* necessary.
*
* @typedef {Object} MetaMetricsContext
* @property {Object} app - Application metadata.
* @typedef {object} MetaMetricsContext
* @property {object} app - Application metadata.
* @property {string} app.name - the name of the application tracking the event
* @property {string} app.version - the version of the application
* @property {string} userAgent - the useragent string of the user
@ -43,7 +43,7 @@
*/
/**
* @typedef {Object} MetaMetricsEventPayload
* @typedef {object} MetaMetricsEventPayload
* @property {string} event - event name to track
* @property {string} category - category to associate event to
* @property {string} [environmentType] - The type of environment this event
@ -66,7 +66,7 @@
*/
/**
* @typedef {Object} MetaMetricsEventOptions
* @typedef {object} MetaMetricsEventOptions
* @property {boolean} [isOptIn] - happened during opt in/out workflow
* @property {boolean} [flushImmediately] - When true will automatically flush
* the segment queue after tracking the event. Recommended if the result of
@ -83,7 +83,7 @@
*/
/**
* @typedef {Object} MetaMetricsEventFragment
* @typedef {object} MetaMetricsEventFragment
* @property {string} successEvent - The event name to fire when the fragment
* is closed in an affirmative action.
* @property {string} [failureEvent] - The event name to fire when the fragment
@ -125,19 +125,19 @@
/**
* Represents the shape of data sent to the segment.track method.
*
* @typedef {Object} SegmentEventPayload
* @typedef {object} SegmentEventPayload
* @property {string} [userId] - The metametrics id for the user
* @property {string} [anonymousId] - An anonymousId that is used to track
* sensitive data while preserving anonymity.
* @property {string} event - name of the event to track
* @property {Object} properties - properties to attach to the event
* @property {object} properties - properties to attach to the event
* @property {MetaMetricsContext} context - the context the event occurred in
*/
/**
* @typedef {Object} MetaMetricsPagePayload
* @typedef {object} MetaMetricsPagePayload
* @property {string} name - The name of the page that was viewed
* @property {Object} [params] - The variadic parts of the page url
* @property {object} [params] - The variadic parts of the page url
* example (route: `/asset/:asset`, path: `/asset/ETH`)
* params: { asset: 'ETH' }
* @property {EnvironmentType} environmentType - the environment type that the
@ -148,14 +148,14 @@
*/
/**
* @typedef {Object} MetaMetricsPageOptions
* @typedef {object} MetaMetricsPageOptions
* @property {boolean} [isOptInPath] - is the current path one of the pages in
* the onboarding workflow? If true and participateInMetaMetrics is null track
* the page view
*/
/**
* @typedef {Object} Traits
* @typedef {object} Traits
* @property {'address_book_entries'} ADDRESS_BOOK_ENTRIES - When the user
* adds or modifies addresses in address book the address_book_entries trait
* is identified.
@ -207,7 +207,7 @@ export const TRAITS = {
};
/**
* @typedef {Object} MetaMetricsTraits
* @typedef {object} MetaMetricsTraits
* @property {number} [address_book_entries] - The number of entries in the
* user's address book.
* @property {'ledgerLive' | 'webhid' | 'u2f'} [ledger_connection_type] - the
@ -252,7 +252,7 @@ export const METAMETRICS_BACKGROUND_PAGE_OBJECT = {
};
/**
* @typedef {Object} SegmentInterface
* @typedef {object} SegmentInterface
* @property {SegmentEventPayload[]} queue - A queue of events to be sent when
* the flushAt limit has been reached, or flushInterval occurs
* @property {() => void} flush - Immediately flush the queue, resetting it to

View File

@ -10,7 +10,7 @@ export const LISTED_CONTRACT_ADDRESSES = Object.keys(
).map((address) => address.toLowerCase());
/**
* @typedef {Object} TokenDetails
* @typedef {object} TokenDetails
* @property {string} address - The address of the selected 'TOKEN' or
* 'COLLECTIBLE' contract.
* @property {string} [symbol] - The symbol of the token.

View File

@ -3,7 +3,7 @@ import { MESSAGE_TYPE } from './app';
/**
* Transaction Type is a MetaMask construct used internally
*
* @typedef {Object} TransactionTypes
* @typedef {object} TransactionTypes
* @property {'transfer'} TOKEN_METHOD_TRANSFER - A token transaction where the user
* is sending tokens that they own to another address
* @property {'transferfrom'} TOKEN_METHOD_TRANSFER_FROM - A token transaction
@ -77,7 +77,7 @@ export const TRANSACTION_TYPES = {
* transaction params that were hitherto the only transaction type sent on
* Ethereum.
*
* @typedef {Object} TransactionEnvelopeTypes
* @typedef {object} TransactionEnvelopeTypes
* @property {'0x0'} LEGACY - A legacy transaction, the very first type.
* @property {'0x1'} ACCESS_LIST - EIP-2930 defined the access list transaction
* type that allowed for specifying the state that a transaction would act
@ -103,7 +103,7 @@ export const TRANSACTION_ENVELOPE_TYPES = {
* Transaction Status is a mix of Ethereum and MetaMask terminology, used internally
* for transaction processing.
*
* @typedef {Object} TransactionStatuses
* @typedef {object} TransactionStatuses
* @property {'unapproved'} UNAPPROVED - A new transaction that the user has not
* approved or rejected
* @property {'approved'} APPROVED - The user has approved the transaction in the
@ -155,7 +155,7 @@ export const IN_PROGRESS_TRANSACTION_STATUSES = [
* Transaction Group Status is a MetaMask construct to track the status of groups
* of transactions.
*
* @typedef {Object} TransactionGroupStatuses
* @typedef {object} TransactionGroupStatuses
* @property {'cancelled'} CANCELLED - A cancel type transaction in the group was
* confirmed
* @property {'pending'} PENDING - The primaryTransaction of the group has a status
@ -174,7 +174,7 @@ export const TRANSACTION_GROUP_STATUSES = {
/**
* Statuses that are specific to Smart Transactions.
*
* @typedef {Object} SmartTransactionStatuses
* @typedef {object} SmartTransactionStatuses
* @property {'cancelled'} CANCELLED - It can be cancelled for various reasons.
* @property {'pending'} PENDING - Smart transaction is being processed.
* @property {'success'} SUCCESS - Smart transaction was successfully mined.
@ -193,7 +193,7 @@ export const SMART_TRANSACTION_STATUSES = {
* Transaction Group Category is a MetaMask construct to categorize the intent
* of a group of transactions for purposes of displaying in the UI
*
* @typedef {Object} TransactionGroupCategories
* @typedef {object} TransactionGroupCategories
* @property {'send'} SEND - Transaction group representing ether being sent from
* the user.
* @property {'receive'} RECEIVE - Transaction group representing a deposit/incoming
@ -226,7 +226,7 @@ export const TRANSACTION_GROUP_CATEGORIES = {
};
/**
* @typedef {Object} TxParams
* @typedef {object} TxParams
* @property {string} from - The address the transaction is sent from
* @property {string} to - The address the transaction is sent to
* @property {string} value - The amount of wei, in hexadecimal, to send
@ -237,7 +237,7 @@ export const TRANSACTION_GROUP_CATEGORIES = {
*/
/**
* @typedef {Object} TxError
* @typedef {object} TxError
* @property {string} message - The message from the encountered error.
* @property {any} rpc - The "value" of the error.
* @property {string} [stack] - the stack trace from the error, if available.
@ -246,7 +246,7 @@ export const TRANSACTION_GROUP_CATEGORIES = {
/**
* An object representing a transaction, in whatever state it is in.
*
* @typedef {Object} TransactionMeta
* @typedef {object} TransactionMeta
* @property {string} [blockNumber] - The block number this transaction was
* included in. Currently only present on incoming transactions!
* @property {number} id - An internally unique tx identifier.
@ -263,7 +263,7 @@ export const TRANSACTION_GROUP_CATEGORIES = {
* @property {boolean} loadingDefaults - TODO: Document
* @property {TxParams} txParams - The transaction params as passed to the
* network provider.
* @property {Object[]} history - A history of mutations to this
* @property {object[]} history - A history of mutations to this
* TransactionMeta object.
* @property {string} origin - A string representing the interface that
* suggested the transaction.
@ -271,7 +271,7 @@ export const TRANSACTION_GROUP_CATEGORIES = {
* gas estimation on the transaction metadata.
* @property {boolean} userEditedGasLimit - A boolean representing when the
* user manually edited the gas limit.
* @property {Object} nonceDetails - A metadata object containing information
* @property {object} nonceDetails - A metadata object containing information
* used to derive the suggested nonce, useful for debugging nonce issues.
* @property {string} rawTx - A hex string of the final signed transaction,
* ready to submit to the network.
@ -285,7 +285,7 @@ export const TRANSACTION_GROUP_CATEGORIES = {
/**
* Defines the possible types
*
* @typedef {Object} TransactionMetaMetricsEvents
* @typedef {object} TransactionMetaMetricsEvents
* @property {'Transaction Added'} ADDED - All transactions, except incoming
* ones, are added to the controller state in an unapproved status. When this
* happens we fire the Transaction Added event to show that the transaction
@ -329,7 +329,7 @@ export const TRANSACTION_EVENTS = {
};
/**
* @typedef {Object} AssetTypes
* @typedef {object} AssetTypes
* @property {'NATIVE'} NATIVE - The native asset for the current network, such
* as ETH
* @property {'TOKEN'} TOKEN - An ERC20 token.
@ -363,7 +363,7 @@ export const ERC721 = 'ERC721';
export const ERC1155 = 'ERC1155';
/**
* @typedef {Object} TokenStandards
* @typedef {object} TokenStandards
* @property {'ERC20'} ERC20 - A token that conforms to the ERC20 standard.
* @property {'ERC721'} ERC721 - A token that conforms to the ERC721 standard.
* @property {'ERC1155'} ERC1155 - A token that conforms to the ERC1155

View File

@ -6,7 +6,7 @@
* currency. It should return a single value.
*
* @param {(number | string | BN)} value - The value to convert.
* @param {Object} [options] - Options to specify details of the conversion
* @param {object} [options] - Options to specify details of the conversion
* @param {string} [options.fromCurrency = 'ETH' | 'USD'] - The currency of the passed value
* @param {string} [options.toCurrency = 'ETH' | 'USD'] - The desired currency of the result
* @param {string} [options.fromNumericBase = 'hex' | 'dec' | 'BN'] - The numeric basic of the passed value.
@ -73,7 +73,7 @@ const isValidBase = (base) => {
/**
* Utility method to convert a value between denominations, formats and currencies.
*
* @param {Object} input
* @param {object} input
* @param {string | BigNumber} input.value
* @param {NumericBase} input.fromNumericBase
* @param {EthDenomination} [input.fromDenomination]

View File

@ -23,7 +23,7 @@ export function isBurnAddress(address) {
* provided this method will validate it has the proper checksum formatting.
*
* @param {string} possibleAddress - Input parameter to check against
* @param {Object} [options] - options bag
* @param {object} [options] - options bag
* @param {boolean} [options.allowNonPrefixed] - If true will first ensure '0x'
* is prepended to the string
* @param {boolean} [options.mixedCaseUseChecksum] - If true will treat mixed

View File

@ -7,7 +7,7 @@
* should be included, and a sub-mask implies the property should be further
* masked according to that sub-mask.
*
* @param {Object} object - The object to mask
* @param {object} object - The object to mask
* @param {Object<object | boolean>} mask - The mask to apply to the object
*/
export function maskObject(object, mask) {

View File

@ -15,7 +15,7 @@ import { isEqualCaseInsensitive } from './string-utils';
*/
/**
* @typedef {Object} InferTransactionTypeResult
* @typedef {object} InferTransactionTypeResult
* @property {InferrableTransactionTypes} type - The type of transaction
* @property {string} getCodeResponse - The contract code, in hex format if
* it exists. '0x0' or '0x' are also indicators of non-existent contract
@ -138,7 +138,7 @@ export function parseStandardTokenTransactionData(data) {
* represent specific events that we control from the extension and are added manually
* at transaction creation.
*
* @param {Object} txParams - Parameters for the transaction
* @param {object} txParams - Parameters for the transaction
* @param {EthQuery} query - EthQuery instance
* @returns {InferTransactionTypeResult}
*/

View File

@ -7,9 +7,9 @@ const cssToXPath = require('css-to-xpath');
* Temporary workaround to patch selenium's element handle API with methods
* that match the playwright API for Elements
*
* @param {Object} element - Selenium Element
* @param {object} element - Selenium Element
* @param driver
* @returns {Object} modified Selenium Element
* @returns {object} modified Selenium Element
*/
function wrapElementWithAPI(element, driver) {
element.press = (key) => element.sendKeys(key);

View File

@ -27,7 +27,7 @@ class FirefoxDriver {
/**
* Builds a {@link FirefoxDriver} instance
*
* @param {Object} options - the options for the build
* @param {object} options - the options for the build
* @param options.responsive
* @param options.port
* @returns {Promise<{driver: !ThenableWebDriver, extensionUrl: string, extensionId: string}>}

View File

@ -13,7 +13,7 @@ const DEFAULT_TIMEOUT = 10000;
* @param {import('sinon').stub} stub - A sinon stub of a function
* @param {unknown} [wrappedThis] - The object the stubbed function was called
* on, if any (i.e. the `this` value)
* @param {Object} [options] - Optional configuration
* @param {object} [options] - Optional configuration
* @param {number} [options.callCount] - The number of calls to wait for.
* @param {number|null} [options.timeout] - The timeout, in milliseconds. Pass
* in `null` to disable the timeout.

View File

@ -49,7 +49,7 @@ const CAVEATS = {
* Gets a correctly formatted eth_accounts restrictReturnedAccounts caveat.
*
* @param {Array<string>} accounts - The accounts for the caveat
* @returns {Object} An eth_accounts restrictReturnedAccounts caveats
* @returns {object} An eth_accounts restrictReturnedAccounts caveats
*/
eth_accounts: (accounts) => {
return [
@ -71,21 +71,21 @@ const PERMS = {
*/
requests: {
/**
* @returns {Object} A permissions request object with eth_accounts
* @returns {object} A permissions request object with eth_accounts
*/
eth_accounts: () => {
return { eth_accounts: {} };
},
/**
* @returns {Object} A permissions request object with test_method
* @returns {object} A permissions request object with test_method
*/
test_method: () => {
return { test_method: {} };
},
/**
* @returns {Object} A permissions request object with does_not_exist
* @returns {object} A permissions request object with does_not_exist
*/
does_not_exist: () => {
return { does_not_exist: {} };
@ -100,7 +100,7 @@ const PERMS = {
granted: {
/**
* @param {Array<string>} accounts - The accounts for the eth_accounts permission caveat
* @returns {Object} A granted permissions object with eth_accounts and its caveat
* @returns {object} A granted permissions object with eth_accounts and its caveat
*/
eth_accounts: (accounts) => {
return {
@ -110,7 +110,7 @@ const PERMS = {
},
/**
* @returns {Object} A granted permissions object with test_method
* @returns {object} A granted permissions object with test_method
*/
test_method: () => {
return {
@ -138,7 +138,7 @@ export const getters = deepFreeze({
* @param {string} method - The request method
* @param {Array<any>} params - The request parameters
* @param {string} [id] - The request id
* @returns {Object} An RPC request object
* @returns {object} An RPC request object
*/
custom: (origin, method, params = [], id) => {
const req = {
@ -156,7 +156,7 @@ export const getters = deepFreeze({
* Gets an eth_accounts RPC request object.
*
* @param {string} origin - The origin of the request
* @returns {Object} An RPC request object
* @returns {object} An RPC request object
*/
eth_accounts: (origin) => {
return {
@ -171,7 +171,7 @@ export const getters = deepFreeze({
*
* @param {string} origin - The origin of the request
* @param {boolean} param - The request param
* @returns {Object} An RPC request object
* @returns {object} An RPC request object
*/
test_method: (origin, param = false) => {
return {
@ -185,7 +185,7 @@ export const getters = deepFreeze({
* Gets an eth_requestAccounts RPC request object.
*
* @param {string} origin - The origin of the request
* @returns {Object} An RPC request object
* @returns {object} An RPC request object
*/
eth_requestAccounts: (origin) => {
return {
@ -201,7 +201,7 @@ export const getters = deepFreeze({
*
* @param {string} origin - The origin of the request
* @param {string} permissionName - The name of the permission to request
* @returns {Object} An RPC request object
* @returns {object} An RPC request object
*/
requestPermission: (origin, permissionName) => {
return {
@ -216,8 +216,8 @@ export const getters = deepFreeze({
* for multiple permissions.
*
* @param {string} origin - The origin of the request
* @param {Object} permissions - A permission request object
* @returns {Object} An RPC request object
* @param {object} permissions - A permission request object
* @returns {object} An RPC request object
*/
requestPermissions: (origin, permissions = {}) => {
return {
@ -231,9 +231,9 @@ export const getters = deepFreeze({
* Gets a metamask_sendDomainMetadata RPC request object.
*
* @param {string} origin - The origin of the request
* @param {Object} name - The subjectMetadata name
* @param {object} name - The subjectMetadata name
* @param {Array<any>} [args] - Any other data for the request's subjectMetadata
* @returns {Object} An RPC request object
* @returns {object} An RPC request object
*/
metamask_sendDomainMetadata: (origin, name, ...args) => {
return {

View File

@ -44,7 +44,7 @@ const statusHash = {
/**
* @name getActivities
* @param {Object} transaction - txMeta object
* @param {object} transaction - txMeta object
* @param {boolean} isFirstTransaction - True if the transaction is the first created transaction
* in the list of transactions with the same nonce. If so, we use this transaction to create the
* transactionCreated activity.

View File

@ -11,7 +11,7 @@ import TransactionListItem from '.';
*/
/**
* @param {Object} args
* @param {object} args
* @returns {TransactionGroup}
*/
const getMockTransactionGroup = (args) => {

View File

@ -4,10 +4,10 @@ import PropTypes from 'prop-types';
/**
* @deprecated - Please use ActionableMessage type danger
* @see ActionableMessage
* @param {Object} props
* @param {object} props
* @param {string} props.errorMessage
* @param {string} props.errorKey
* @param {Object} context
* @param {object} context
*/
const ErrorMessage = (props, context) => {
const { errorMessage, errorKey } = props;

View File

@ -400,7 +400,7 @@ export function getSeedPhraseBackedUp(state) {
/**
* Given the redux state object and an address, finds a keyring that contains that address, if one exists
*
* @param {Object} state - the redux state object
* @param {object} state - the redux state object
* @param {string} address - the address to search for among the keyring addresses
* @returns {object | undefined} The keyring which contains the passed address, or undefined
*/
@ -420,7 +420,7 @@ export function findKeyringForAddress(state, address) {
/**
* Given the redux state object, returns the users preferred ledger transport type
*
* @param {Object} state - the redux state object
* @param {object} state - the redux state object
* @returns {string} The users preferred ledger transport type. One of'ledgerLive', 'webhid' or 'u2f'
*/
export function getLedgerTransportType(state) {
@ -430,7 +430,7 @@ export function getLedgerTransportType(state) {
/**
* Given the redux state object and an address, returns a boolean indicating whether the passed address is part of a Ledger keyring
*
* @param {Object} state - the redux state object
* @param {object} state - the redux state object
* @param {string} address - the address to search for among all keyring addresses
* @returns {boolean} true if the passed address is part of a ledger keyring, and false otherwise
*/
@ -444,7 +444,7 @@ export function isAddressLedger(state, address) {
* Given the redux state object, returns a boolean indicating whether the user has any Ledger accounts added to MetaMask (i.e. Ledger keyrings
* in state)
*
* @param {Object} state - the redux state object
* @param {object} state - the redux state object
* @returns {boolean} true if the user has a Ledger account and false otherwise
*/
export function doesUserHaveALedgerAccount(state) {

View File

@ -162,7 +162,7 @@ import {
*/
/**
* @typedef {Object} SendStateStages
* @typedef {object} SendStateStages
* @property {'ADD_RECIPIENT'} ADD_RECIPIENT - The user is selecting which
* address to send an asset to.
* @property {'DRAFT'} DRAFT - The send form is shown for a transaction yet to
@ -188,7 +188,7 @@ export const SEND_STAGES = {
};
/**
* @typedef {Object} DraftTxStatus
* @typedef {object} DraftTxStatus
* @property {'INVALID'} INVALID - The transaction is invalid and cannot be
* submitted. There are a number of cases that would result in an invalid
* send state:
@ -213,7 +213,7 @@ export const SEND_STATUSES = {
};
/**
* @typedef {Object} SendStateGasModes
* @typedef {object} SendStateGasModes
* @property {'BASIC'} BASIC - Shows the basic estimate slow/avg/fast buttons
* when on mainnet and the metaswaps API request is successful.
* @property {'CUSTOM'} CUSTOM - Shows GasFeeDisplay component that is a read
@ -235,7 +235,7 @@ export const GAS_INPUT_MODES = {
};
/**
* @typedef {Object} SendStateAmountModes
* @typedef {object} SendStateAmountModes
* @property {'INPUT'} INPUT - the user provides the amount by typing in the
* field.
* @property {'MAX'} MAX - The user selects the MAX button and amount is
@ -253,7 +253,7 @@ export const AMOUNT_MODES = {
};
/**
* @typedef {Object} SendStateRecipientModes
* @typedef {object} SendStateRecipientModes
* @property {'CONTACT_LIST'} CONTACT_LIST - The user is displayed a list of
* their contacts and addresses they have recently send to.
* @property {'MY_ACCOUNTS'} MY_ACCOUNTS - the user is displayed a list of
@ -271,21 +271,21 @@ export const RECIPIENT_SEARCH_MODES = {
};
/**
* @typedef {Object} Account
* @typedef {object} Account
* @property {string} address - The hex address of the account.
* @property {string} balance - Hex string representing the native asset
* balance of the account the transaction will be sent from.
*/
/**
* @typedef {Object} Amount
* @typedef {object} Amount
* @property {string} [error] - Error to display for the amount field.
* @property {string} value - A hex string representing the amount of the
* selected currency to send.
*/
/**
* @typedef {Object} Asset
* @typedef {object} Asset
* @property {string} balance - A hex string representing the balance
* that the user holds of the asset that they are attempting to send.
* @property {TokenDetails} [details] - An object that describes the
@ -299,7 +299,7 @@ export const RECIPIENT_SEARCH_MODES = {
*/
/**
* @typedef {Object} GasFees
* @typedef {object} GasFees
* @property {string} [error] - error to display for gas fields.
* @property {string} gasLimit - maximum gas needed for tx.
* @property {string} gasPrice - price in wei to pay per gas.
@ -312,7 +312,7 @@ export const RECIPIENT_SEARCH_MODES = {
/**
* An object that describes the intended recipient of a transaction.
*
* @typedef {Object} Recipient
* @typedef {object} Recipient
* @property {string} address - The fully qualified address of the recipient.
* This is set after the recipient.userInput is validated, the userInput field
* is quickly updated to avoid delay between keystrokes and seeing the input
@ -327,7 +327,7 @@ export const RECIPIENT_SEARCH_MODES = {
*/
/**
* @typedef {Object} DraftTransaction
* @typedef {object} DraftTransaction
* @property {Amount} amount - An object containing information about the
* amount of currency to send.
* @property {Asset} asset - An object that describes the asset that the user
@ -398,7 +398,7 @@ export const draftTransactionInitialState = {
/**
* Describes the state tree of the send slice
*
* @typedef {Object} SendState
* @typedef {object} SendState
* @property {MapValuesToUnion<SendStateAmountModes>} amountMode - Describe
* whether the user has manually input an amount or if they have selected max
* to send the maximum amount of the selected currency.
@ -471,9 +471,9 @@ export const initialState = {
* typescript conversions. The metamask key is typed as an object on purpose
* here because I cannot go so far in this work as to type that entire object.
*
* @typedef {Object} MetaMaskState
* @typedef {object} MetaMaskState
* @property {SendState} send - The state of the send flow.
* @property {Object} metamask - The state of the metamask store.
* @property {object} metamask - The state of the metamask store.
*/
const name = 'send';
@ -554,7 +554,7 @@ export const computeEstimatedGasLimit = createAsyncThunk(
);
/**
* @typedef {Object} Asset
* @typedef {object} Asset
* @property {AssetTypesString} type - The type of asset that the user
* is attempting to send. Defaults to 'NATIVE' which represents the native
* asset of the chain. Can also be 'TOKEN' or 'COLLECTIBLE'.
@ -581,8 +581,8 @@ export const initializeSendState = createAsyncThunk(
'send/initializeSendState',
async ({ chainHasChanged = false } = {}, thunkApi) => {
/**
* @typedef {Object} ReduxState
* @property {Object} metamask - Half baked type for the MetaMask object
* @typedef {object} ReduxState
* @property {object} metamask - Half baked type for the MetaMask object
* @property {SendState} send - the send state
*/
@ -717,7 +717,7 @@ export const initializeSendState = createAsyncThunk(
*/
/**
* @typedef {Object} GasFeeUpdateParams
* @typedef {object} GasFeeUpdateParams
* @property {TransactionTypeString} transactionType - The transaction type
* @property {string} [maxFeePerGas] - The maximum amount in hex wei to pay
* per gas on a FEE_MARKET transaction.
@ -734,7 +734,7 @@ export const initializeSendState = createAsyncThunk(
*/
/**
* @typedef {Object} GasEstimateUpdateParams
* @typedef {object} GasEstimateUpdateParams
* @property {GasEstimateType} gasEstimateType - The type of gas estimation
* provided by the controller.
* @property {(
@ -1804,7 +1804,7 @@ export function updateGasPrice(gasPrice) {
* (temporary) send state recipient nickname is consistent with the address book
* nickname which has already been persisted to state.
*
* @param {Object} recipient - Recipient information
* @param {object} recipient - Recipient information
* @param {string} recipient.address - hex address to send the transaction to
* @param {string} [recipient.nickname] - Alias for the address to display
* to the user
@ -1950,7 +1950,7 @@ export function updateSendAmount(amount) {
* object with the appropriate ERC20 details including address, symbol and
* decimals.
*
* @param {Object} payload - action payload
* @param {object} payload - action payload
* @param {string} payload.type - type of asset to send
* @param {TokenDetails} [payload.details] - ERC20 details if sending TOKEN asset
* @returns {ThunkAction<void>}

View File

@ -15,7 +15,7 @@ const missingSubstitutionErrors = {};
* Returns a localized message for the given key
*
* @param {string} localeCode - The code for the current locale
* @param {Object} localeMessages - The map of messages for the current locale
* @param {object} localeMessages - The map of messages for the current locale
* @param {string} key - The message key
* @param {string[]} substitutions - A list of message substitution replacements
* @returns {null|string} The localized message

View File

@ -73,7 +73,7 @@ const PERMISSION_DESCRIPTIONS = deepFreeze({
});
/**
* @typedef {Object} PermissionLabelObject
* @typedef {object} PermissionLabelObject
* @property {string} label - The text label.
* @property {string} leftIcon - The left icon.
* @property {string} rightIcon - The right icon.

View File

@ -131,7 +131,7 @@ export function calcTokenValue(value, decimals) {
* - The '_to' parameter, if present
* - The first parameter, if present
*
* @param {Object} tokenData - ethers Interface token data.
* @param {object} tokenData - ethers Interface token data.
* @returns {string | undefined} A lowercase address string.
*/
export function getTokenAddressParam(tokenData = {}) {
@ -144,7 +144,7 @@ export function getTokenAddressParam(tokenData = {}) {
* Gets the '_value' parameter of the given token transaction data
* (i.e function call) per the Human Standard Token ABI, if present.
*
* @param {Object} tokenData - ethers Interface token data.
* @param {object} tokenData - ethers Interface token data.
* @returns {string | undefined} A decimal string value.
*/
export function getTokenValueParam(tokenData = {}) {
@ -156,7 +156,7 @@ export function getTokenValueParam(tokenData = {}) {
* These are the parsed tokenId values returned by `parseStandardTokenTransactionData` as defined
* in the ERC721 and ERC1155 ABIs from metamask-eth-abis (https://github.com/MetaMask/metamask-eth-abis/tree/main/src/abis)
*
* @param {Object} tokenData - ethers Interface token data.
* @param {object} tokenData - ethers Interface token data.
* @returns {string | undefined} A decimal string value.
*/
export function getTokenIdParam(tokenData = {}) {
@ -169,7 +169,7 @@ export function getTokenIdParam(tokenData = {}) {
* Gets the '_approved' parameter of the given token transaction data
* (i.e function call) per the Human Standard Token ABI, if present.
*
* @param {Object} tokenData - ethers Interface token data.
* @param {object} tokenData - ethers Interface token data.
* @returns {boolean | undefined} A boolean indicating whether the function is being called to approve or revoke access.
*/
export function getTokenApprovedParam(tokenData = {}) {

View File

@ -49,7 +49,7 @@ let registry;
* Attempts to return the method data from the MethodRegistry library, the message registry library and the token abi, in that order of preference
*
* @param {string} fourBytePrefix - The prefix from the method code associated with the data
* @returns {Object}
* @returns {object}
*/
export async function getMethodDataAsync(fourBytePrefix) {
try {
@ -152,8 +152,8 @@ export function isLegacyTransaction(txParams) {
* Returns a status key for a transaction. Requires parsing the txMeta.txReceipt on top of
* txMeta.status because txMeta.status does not reflect on-chain errors.
*
* @param {Object} transaction - The txMeta object of a transaction.
* @param {Object} transaction.txReceipt - The transaction receipt.
* @param {object} transaction - The txMeta object of a transaction.
* @param {object} transaction.txReceipt - The transaction receipt.
* @returns {string}
*/
export function getStatusKey(transaction) {

View File

@ -356,7 +356,7 @@ export function addHexPrefixToObjectValues(obj) {
* @param {string} options.from - A hex address of the tx sender address
* @param {string} options.gas - A hex representation of the gas value for the transaction
* @param {string} options.gasPrice - A hex representation of the gas price for the transaction
* @returns {Object} An object ready for submission to the blockchain, with all values appropriately hex prefixed
* @returns {object} An object ready for submission to the blockchain, with all values appropriately hex prefixed
*/
export function constructTxParams({
sendToken,

View File

@ -24,7 +24,7 @@ import { useCurrencyDisplay } from '../useCurrencyDisplay';
import { useUserPreferencedCurrency } from '../useUserPreferencedCurrency';
/**
* @typedef {Object} GasEstimatesReturnType
* @typedef {object} GasEstimatesReturnType
* @property {string} [estimatedMinimumFiat] - The amount estimated to be paid
* based on current network conditions. Expressed in user's preferred currency.
* @property {string} [estimatedMaximumFiat] - the maximum amount estimated to be paid if current

View File

@ -155,10 +155,10 @@ const hasBalanceError = (minimumCostInHexWei, transaction, ethBalance) => {
};
/**
* @typedef {Object} GasFeeErrorsReturnType
* @property {Object} [gasErrors] - combined map of errors and warnings.
* @typedef {object} GasFeeErrorsReturnType
* @property {object} [gasErrors] - combined map of errors and warnings.
* @property {boolean} [hasGasErrors] - true if there are errors that can block submission.
* @property {Object} gasWarnings - map of gas warnings for EIP-1559 fields.
* @property {object} gasWarnings - map of gas warnings for EIP-1559 fields.
* @property {boolean} [balanceError] - true if user balance is less than transaction value.
* @property {boolean} [estimatesUnavailableWarning] - true if supportsEIP1559 is true and
* estimate is not of type fee-market.

View File

@ -41,7 +41,7 @@ import { useTransactionFunctions } from './useTransactionFunctions';
*/
/**
* @typedef {Object} GasFeeInputReturnType
* @typedef {object} GasFeeInputReturnType
* @property {DecGweiString} [maxFeePerGas] - the maxFeePerGas input value.
* @property {string} [maxFeePerGasFiat] - the maxFeePerGas converted to the
* user's preferred currency.

View File

@ -20,7 +20,7 @@ function getGasPriceEstimate(gasFeeEstimates, gasEstimateType, estimateToUse) {
}
/**
* @typedef {Object} GasPriceInputsReturnType
* @typedef {object} GasPriceInputsReturnType
* @property {DecGweiString} [gasPrice] - the gasPrice input value.
* @property {(DecGweiString) => void} setGasPrice - state setter method to update the gasPrice.
* @property {(boolean) => true} setGasPriceHasBeenManuallySet - state setter method to update gasPriceHasBeenManuallySet

View File

@ -28,7 +28,7 @@ const getMaxFeePerGasFromTransaction = (transaction, gasFeeEstimates) => {
};
/**
* @typedef {Object} MaxFeePerGasInputReturnType
* @typedef {object} MaxFeePerGasInputReturnType
* @property {(DecGweiString) => void} setMaxFeePerGas - state setter method to
* update the maxFeePerGas.
* @property {string} [maxFeePerGasFiat] - the maxFeePerGas converted to the

View File

@ -32,7 +32,7 @@ const getMaxPriorityFeePerGasFromTransaction = (
};
/**
* @typedef {Object} MaxPriorityFeePerGasInputReturnType
* @typedef {object} MaxPriorityFeePerGasInputReturnType
* @property {DecGweiString} [maxPriorityFeePerGas] - the maxPriorityFeePerGas
* input value.
* @property {string} [maxPriorityFeePerGasFiat] - the maxPriorityFeePerGas

View File

@ -16,7 +16,7 @@ import { TEST_NETWORK_TICKER_MAP } from '../../shared/constants/network';
/**
* Defines the shape of the options parameter for useCurrencyDisplay
*
* @typedef {Object} UseCurrencyOptions
* @typedef {object} UseCurrencyOptions
* @property {string} [displayValue] - When present is used in lieu of formatting the inputValue
* @property {string} [prefix] - String to prepend to the final result
* @property {number} [numberOfDecimals] - Number of significant decimals to display
@ -27,7 +27,7 @@ import { TEST_NETWORK_TICKER_MAP } from '../../shared/constants/network';
/**
* Defines the return shape of the second value in the tuple
*
* @typedef {Object} CurrencyDisplayParts
* @typedef {object} CurrencyDisplayParts
* @property {string} [prefix] - string to prepend to the value for display
* @property {string} value - string representing the value, formatted for display
* @property {string} [suffix] - string to append to the value for display

View File

@ -9,7 +9,7 @@ import { getConversionRate } from '../ducks/metamask/metamask';
* Get an Eth amount converted to fiat and formatted for display
*
* @param {string} [ethAmount] - The eth amount to convert
* @param {Object} [overrides] - A configuration object that allows the called to explicitly
* @param {object} [overrides] - A configuration object that allows the called to explicitly
* ensure fiat is shown even if the property is not set in state.
* @param {boolean} [overrides.showFiat] - If truthy, ensures the fiat value is shown even if the showFiat value from state is falsey
* @param {boolean} hideCurrencySymbol - Indicates whether the returned formatted amount should include the trailing currency symbol

View File

@ -15,7 +15,7 @@ import { useSegmentContext } from './useSegmentContext';
* fragment id.
*
* @param {string} existingId
* @param {Object} fragmentOptions
* @param {object} fragmentOptions
* @returns
*/
export function useEventFragment(existingId, fragmentOptions = {}) {

View File

@ -152,10 +152,10 @@ const getBalanceError = (minimumCostInHexWei, transaction, ethBalance) => {
};
/**
* @typedef {Object} GasFeeErrorsReturnType
* @property {Object} [gasErrors] - combined map of errors and warnings.
* @typedef {object} GasFeeErrorsReturnType
* @property {object} [gasErrors] - combined map of errors and warnings.
* @property {boolean} [hasGasErrors] - true if there are errors that can block submission.
* @property {Object} gasWarnings - map of gas warnings for EIP-1559 fields.
* @property {object} gasWarnings - map of gas warnings for EIP-1559 fields.
* @property {boolean} [balanceError] - true if user balance is less than transaction value.
* @property {boolean} [estimatesUnavailableWarning] - true if supportsEIP1559 is true and
* estimate is not of type fee-market.

View File

@ -15,7 +15,7 @@ import { getKnownMethodData } from '../selectors/selectors';
* hit the action more frequently, it should only ever result in a single store update
*
* @param {string} data - the transaction data to find method data for
* @returns {Object} contract method data
* @returns {object} contract method data
*/
export function useMethodData(data) {
const dispatch = useDispatch();

View File

@ -3,7 +3,7 @@ import { getTargetSubjectMetadata } from '../selectors';
import { SUBJECT_TYPES } from '../../shared/constants/app';
/**
* @typedef {Object} OriginMetadata
* @typedef {object} OriginMetadata
* @property {string} hostname - The hostname of the origin (host + port)
* @property {string} origin - The original origin string itself
* @property {string} [iconUrl] - The origin's site icon URL, if available

View File

@ -6,7 +6,7 @@ import { SECOND } from '../../shared/constants/time';
* an effect to check the logic again after the transaction has surpassed 5 seconds
* of queue time.
*
* @param {Object} transactionGroup - the transaction group to check against
* @param {object} transactionGroup - the transaction group to check against
* @param {boolean} isEarliestNonce - Whether this group is currently the earliest nonce
*/
export function useShouldShowSpeedUp(transactionGroup, isEarliestNonce) {

View File

@ -9,7 +9,7 @@ import { getCurrentChainId } from '../selectors';
import { useTokenFiatAmount } from './useTokenFiatAmount';
/**
* @typedef {Object} SwappedTokenValue
* @typedef {object} SwappedTokenValue
* @property {string} swapTokenValue - a primary currency string formatted for display
* @property {string} swapTokenFiatAmount - a secondary currency string formatted for display
* @property {boolean} isViewingReceivedTokenFromSwap - true if user is on the asset page for the

View File

@ -12,7 +12,7 @@ import { parseStandardTokenTransactionData } from '../../shared/modules/transact
* force this hook to return null if it set as false
* which indicates the transaction is not associated
* with a token.
* @returns {Object} Decoded token data
* @returns {object} Decoded token data
*/
export function useTokenData(transactionData, isTokenTransaction = true) {
return useMemo(() => {

View File

@ -8,7 +8,7 @@ import { useTokenData } from './useTokenData';
/**
* Defines the shape for the Token input parameter for useTokenDisplayValue
*
* @typedef {Object} Token
* @typedef {object} Token
* @property {string} symbol - The string to use as a suffix for the token (eg. DAI)
* @property {number} decimals - The number of decimals to show when displaying this type of token
*/

View File

@ -15,7 +15,7 @@ import { isEqualCaseInsensitive } from '../../shared/modules/string-utils';
* @param {string} [tokenAddress] - The token address
* @param {string} [tokenAmount] - The token balance
* @param {string} [tokenSymbol] - The token symbol
* @param {Object} [overrides] - A configuration object that allows the caller to explicitly pass an exchange rate or
* @param {object} [overrides] - A configuration object that allows the caller to explicitly pass an exchange rate or
* ensure fiat is shown even if the property is not set in state.
* @param {number} [overrides.exchangeRate] - An exhchange rate to use instead of the one selected from state
* @param {boolean} [overrides.showFiat] - If truthy, ensures the fiat value is shown even if the showFiat value from state is falsey

View File

@ -63,7 +63,7 @@ const signatureTypes = [
*/
/**
* @typedef {Object} TransactionDisplayData
* @typedef {object} TransactionDisplayData
* @property {string} category - the transaction category that will be used for rendering the icon in the activity list
* @property {string} primaryCurrency - the currency string to display in the primary position
* @property {string} recipientAddress - the Ethereum address of the recipient

View File

@ -11,7 +11,7 @@ import { PRIMARY, SECONDARY, ETH } from '../helpers/constants/common';
/**
* Defines the shape of the options parameter for useUserPreferencedCurrency
*
* @typedef {Object} UseUserPreferencedCurrencyOptions
* @typedef {object} UseUserPreferencedCurrencyOptions
* @property {number} [numberOfDecimals] - Number of significant decimals to display
* @property {number} [ethNumberOfDecimals] - Number of significant decimals to display
* when using ETH
@ -22,7 +22,7 @@ import { PRIMARY, SECONDARY, ETH } from '../helpers/constants/common';
/**
* Defines the return shape of useUserPreferencedCurrency
*
* @typedef {Object} UserPreferredCurrency
* @typedef {object} UserPreferredCurrency
* @property {string} currency - the currency type to use (eg: 'ETH', 'usd')
* @property {number} numberOfDecimals - Number of significant decimals to display
*/

View File

@ -68,7 +68,7 @@ const alertStateReducer = produce((state, action) => {
* outside of this file, but it helps to reduce complexity of the primary
* component.
*
* @param {Object} pendingConfirmation - a pending confirmation waiting for
* @param {object} pendingConfirmation - a pending confirmation waiting for
* user approval
* @returns {[alertState: object, dismissAlert: Function]} A tuple with
* the current alert state and function to dismiss an alert by id

View File

@ -32,12 +32,12 @@ const ALLOWED_TEMPLATE_KEYS = [
];
/**
* @typedef {Object} PendingApproval
* @typedef {object} PendingApproval
* @property {string} id - The randomly generated id of the approval
* @property {string} origin - The origin of the site requesting this approval
* @property {number} time - The time the approval was requested
* @property {string} type - The type of approval being requested
* @property {Object} requestData - The data submitted with the request
* @property {object} requestData - The data submitted with the request
*/
/**
@ -46,7 +46,7 @@ const ALLOWED_TEMPLATE_KEYS = [
* page the alerts returned from the getAlerts method will be set into the
* alertState state object.
*
* @param {Object} pendingApproval - the object representing the confirmation
* @param {object} pendingApproval - the object representing the confirmation
*/
export async function getTemplateAlerts(pendingApproval) {
const fn = APPROVAL_TEMPLATES[pendingApproval.type]?.getAlerts;
@ -78,7 +78,7 @@ async function emptyState() {
* confirmationState state object. Note, this state is not consumed by the page
* itself.
*
* @param {Object} pendingApproval - the object representing the confirmation
* @param {object} pendingApproval - the object representing the confirmation
*/
export async function getTemplateState(pendingApproval) {
const fn = APPROVAL_TEMPLATES[pendingApproval.type]?.getState ?? emptyState;
@ -112,7 +112,7 @@ function getAttenuatedDispatch(dispatch) {
/**
* Returns the templated values to be consumed in the confirmation page
*
* @param {Object} pendingApproval - The pending confirmation object
* @param {object} pendingApproval - The pending confirmation object
* @param {Function} t - Translation function
* @param {Function} dispatch - Redux dispatch function
*/

View File

@ -12,8 +12,8 @@ import {
/**
* Get the permission subjects object.
*
* @param {Object} state - The current state.
* @returns {Object} The permissions subjects object.
* @param {object} state - The current state.
* @returns {object} The permissions subjects object.
*/
export function getPermissionSubjects(state) {
return state.metamask.subjects || {};
@ -23,7 +23,7 @@ export function getPermissionSubjects(state) {
* Selects the permitted accounts from the eth_accounts permission given state
* and an origin.
*
* @param {Object} state - The current state.
* @param {object} state - The current state.
* @param {string} origin - The origin/subject to get the permitted accounts for.
* @returns {Array<string>} An empty array or an array of accounts.
*/
@ -37,7 +37,7 @@ export function getPermittedAccounts(state, origin) {
* Selects the permitted accounts from the eth_accounts permission for the
* origin of the current tab.
*
* @param {Object} state - The current state.
* @param {object} state - The current state.
* @returns {Array<string>} An empty array or an array of accounts.
*/
export function getPermittedAccountsForCurrentTab(state) {
@ -47,8 +47,8 @@ export function getPermittedAccountsForCurrentTab(state) {
/**
* Returns a map of permitted accounts by origin for all origins.
*
* @param {Object} state - The current state.
* @returns {Object} Permitted accounts by origin.
* @param {object} state - The current state.
* @returns {object} Permitted accounts by origin.
*/
export function getPermittedAccountsByOrigin(state) {
const subjects = getPermissionSubjects(state);
@ -68,8 +68,8 @@ export function getPermittedAccountsByOrigin(state) {
* - name
* - icon
*
* @param {Object} state - The current state.
* @returns {Array<Object>} An array of connected subject objects.
* @param {object} state - The current state.
* @returns {Array<object>} An array of connected subject objects.
*/
export function getConnectedSubjectsForSelectedAddress(state) {
const { selectedAddress } = state.metamask;
@ -124,8 +124,8 @@ export function getSubjectsWithPermission(state, permissionName) {
* - iconUrl
* - name
*
* @param {Object} state - The current state.
* @returns {Object} A mapping of addresses to a mapping of origins to
* @param {object} state - The current state.
* @returns {object} A mapping of addresses to a mapping of origins to
* connected subject info.
*/
export function getAddressConnectedSubjectMap(state) {

View File

@ -76,7 +76,7 @@ import { SNAPS_VIEW_ROUTE } from '../helpers/constants/routes';
* This will be used for all cases where this state key is accessed only for that
* purpose.
*
* @param {Object} state - redux state object
* @param {object} state - redux state object
*/
export function isNetworkLoading(state) {
return state.metamask.network === 'loading';
@ -199,7 +199,7 @@ export function checkNetworkOrAccountNotSupports1559(state) {
/**
* Checks if the current wallet is a hardware wallet.
*
* @param {Object} state
* @param {object} state
* @returns {boolean}
*/
export function isHardwareWallet(state) {
@ -210,7 +210,7 @@ export function isHardwareWallet(state) {
/**
* Get a HW wallet type, e.g. "Ledger Hardware"
*
* @param {Object} state
* @param {object} state
* @returns {string | undefined}
*/
export function getHardwareWalletType(state) {
@ -242,7 +242,7 @@ export function getAccountType(state) {
* metadata that predates the switch to using chainId.
*
* @deprecated - use getCurrentChainId instead
* @param {Object} state - redux state object
* @param {object} state - redux state object
*/
export function deprecatedGetCurrentNetworkId(state) {
return state.metamask.network;
@ -639,7 +639,7 @@ export function getWeb3ShimUsageStateForOrigin(state, origin) {
}
/**
* @typedef {Object} SwapsEthToken
* @typedef {object} SwapsEthToken
* @property {string} symbol - The symbol for ETH, namely "ETH"
* @property {string} name - The name of the ETH currency, "Ether"
* @property {string} address - A substitute address for the metaswap-api to
@ -756,7 +756,7 @@ export const getSnapsRouteObjects = createSelector(getSnaps, (snaps) => {
});
/**
* @typedef {Object} Notification
* @typedef {object} Notification
* @property {string} id - A unique identifier for the notification
* @property {string} origin - A string identifing the snap origin
* @property {EpochTimeStamp} createdDate - A date in epochTimeStramps, identifying when the notification was first committed
@ -771,7 +771,7 @@ export const getSnapsRouteObjects = createSelector(getSnaps, (snaps) => {
*
* The returned notifications are sorted by date.
*
* @param {Object} state - the redux state object
* @param {object} state - the redux state object
* @returns {Notification[]} An array of notifications that can be shown to the user
*/
@ -803,8 +803,8 @@ export const getUnreadNotificationsCount = createSelector(
/**
* Get an object of announcement IDs and if they are allowed or not.
*
* @param {Object} state
* @returns {Object}
* @param {object} state
* @returns {object}
*/
function getAllowedAnnouncementIds(state) {
const currentKeyring = getCurrentKeyring(state);
@ -831,7 +831,7 @@ function getAllowedAnnouncementIds(state) {
}
/**
* @typedef {Object} Announcement
* @typedef {object} Announcement
* @property {number} id - A unique identifier for the announcement
* @property {string} date - A date in YYYY-MM-DD format, identifying when the notification was first committed
*/
@ -844,7 +844,7 @@ function getAllowedAnnouncementIds(state) {
*
* The returned announcements are sorted by date.
*
* @param {Object} state - the redux state object
* @param {object} state - the redux state object
* @returns {Announcement[]} An array of announcements that can be shown to the user
*/
@ -917,7 +917,7 @@ export function getTheme(state) {
* To retrieve the tokenList produced by TokenListcontroller
*
* @param {*} state
* @returns {Object}
* @returns {object}
*/
export function getTokenList(state) {
return state.metamask.tokenList;

View File

@ -150,8 +150,8 @@ const insertOrderedNonce = (nonces, nonceToInsert) => {
* @private
* @description Inserts (mutates) a transaction object into an array of ordered transactions, sorted
* in ascending order by time.
* @param {Object[]} transactions - Array of transaction objects.
* @param {Object} transaction - Transaction object to be inserted into the array of transactions.
* @param {object[]} transactions - Array of transaction objects.
* @param {object} transaction - Transaction object to be inserted into the array of transactions.
*/
const insertTransactionByTime = (transactions, transaction) => {
const { time } = transaction;
@ -173,11 +173,11 @@ const insertTransactionByTime = (transactions, transaction) => {
/**
* Contains transactions and properties associated with those transactions of the same nonce.
*
* @typedef {Object} transactionGroup
* @typedef {object} transactionGroup
* @property {string} nonce - The nonce that the transactions within this transactionGroup share.
* @property {Object[]} transactions - An array of transaction (txMeta) objects.
* @property {Object} initialTransaction - The transaction (txMeta) with the lowest "time".
* @property {Object} primaryTransaction - Either the latest transaction or the confirmed
* @property {object[]} transactions - An array of transaction (txMeta) objects.
* @property {object} initialTransaction - The transaction (txMeta) with the lowest "time".
* @property {object} primaryTransaction - Either the latest transaction or the confirmed
* transaction.
* @property {boolean} hasRetried - True if a transaction in the group was a retry transaction.
* @property {boolean} hasCancelled - True if a transaction in the group was a cancel transaction.

View File

@ -100,7 +100,7 @@ export function tryUnlockMetamask(password) {
*
* @param {string} password - The password.
* @param {string} seedPhrase - The seed phrase.
* @returns {Object} The updated state of the keyring controller.
* @returns {object} The updated state of the keyring controller.
*/
export function createNewVaultAndRestore(password, seedPhrase) {
return (dispatch) => {
@ -2980,7 +2980,7 @@ export function requestAccountsPermissionWithId(origin) {
/**
* Approves the permissions request.
*
* @param {Object} request - The permissions request to approve.
* @param {object} request - The permissions request to approve.
*/
export function approvePermissionsRequest(request) {
return (dispatch) => {