Global

Members

(constant) initialState :FirstTimeState

Source:
Type:

Methods

blacklistedDomainCheck() → {boolean}

Source:

Checks if the current domain is blacklisted

Returns:

{@code true} if the current domain is blacklisted

Type
boolean

BnMultiplyByFraction(targetBN, numerator, denominator) → {BN}

Source:

Used to multiply a BN by a fraction

Parameters:
Name Type Description
targetBN BN

The number to multiply by a fraction

numerator number | string

The numerator of the fraction multiplier

denominator number | string

The denominator of the fraction multiplier

Returns:

The product of the multiplication

Type
BN

bnToHex(inputBn) → {string}

Source:

Converts a BN object to a hex string with a '0x' prefix

Parameters:
Name Type Description
inputBn BN

The BN to convert to a hex string

Returns:

A '0x' prefixed hex string

Type
string

cleanContextForImports()

Source:

Caches reference to global define object and deletes it to avoid conflicts with other global define objects, such as AMD's define function

cleanErrorStack(err) → {Error}

Source:

Returns error without stack trace for better UI display

Parameters:
Name Type Description
err Error

error

Returns:

Error with clean stack trace.

Type
Error

connectToAccountManager(connectionStream, cb)

Source:

Establishes streamed connections to background scripts and a Web3 provider

Parameters:
Name Type Description
connectionStream PortDuplexStream

PortStream instance establishing a background connection

cb function

Called when controller connection is established

createLoggerMiddleware(opts) → {function}

Source:

Returns a middleware that logs RPC activity

Parameters:
Name Type Description
opts Object

The middleware options

Returns:
Type
function

createOriginMiddleware(opts) → {function}

Source:

Returns a middleware that appends the DApp origin to request

Parameters:
Name Type Description
opts Object

The middleware options

Returns:
Type
function

createProviderMiddleware(config)

Source:

Forwards an HTTP request to the current Web3 provider

Parameters:
Name Type Description
config Object

Configuration containing current Web3 provider

deepMap(target, visit) → {object}

Source:

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.

Parameters:
Name Type Description
target object

The object to modify

visit function

The modifier to apply to each non-object property value

Returns:

The modified object

Type
object

doctypeCheck() → {boolean}

Source:

Checks the doctype of the current document if it exists

Returns:

{@code true} if the doctype is html or if none exists

Type
boolean

documentElementCheck() → {boolean}

Source:

Checks the documentElement of the current document

Returns:

{@code true} if the documentElement is an html node or if none exists

Type
boolean

extractEthjsErrorMessage(errorMessage) → {string}

Source:

Extracts the important part of an ethjs-rpc error message. If the passed error is not an isEthjsRpcError, the error is returned unchanged.

Example
// returns 'Transaction Failed: replacement transaction underpriced'
extractEthjsErrorMessage(`Error: [ethjs-rpc] rpc error with payload {"id":3947817945380,"jsonrpc":"2.0","params":["0xf8eb8208708477359400830398539406012c8cf97bead5deae237070f9587f8e7a266d80b8843d7d3f5a0000000000000000000000000000000000000000000000000000000000081d1a000000000000000000000000000000000000000000000000001ff973cafa800000000000000000000000000000000000000000000000000000038d7ea4c68000000000000000000000000000000000000000000000000000000000000003f48025a04c32a9b630e0d9e7ff361562d850c86b7a884908135956a7e4a336fa0300d19ca06830776423f25218e8d19b267161db526e66895567147015b1f3fc47aef9a3c7"],"method":"eth_sendRawTransaction"} Error: replacement transaction underpriced`)
Parameters:
Name Type Description
errorMessage string

The error message to parse

Returns:

Returns an error message, either the same as was passed, or the ending message portion of an isEthjsRpcError

Type
string

getBuyEthUrl(opts) → {string|undefined}

Source:

Gives the caller a url at which the user can acquire eth, depending on the network they are in

Parameters:
Name Type Description
opts object

Options required to determine the correct url

Properties
Name Type Description
network string

The network for which to return a url

amount string

The amount of ETH to buy on coinbase. Only relevant if network === '1'.

address string

The address the bought ETH should be sent to. Only relevant if network === '1'.

Returns:

The url at which the user can access ETH, while in the given network. If the passed network does not match any of the specified cases, or if no network is given, returns undefined.

Type
string | undefined

getEnvironmentType() → {string}

Source:

Used to determine the window type through which the app is being viewed.

  • 'popup' refers to the extension opened through the browser app icon (in top right corner in chrome and firefox)
  • 'responsive' refers to the main browser window
  • 'notification' refers to the popup that appears in its own window when taking action outside of metamask
Returns:

A single word label that represents the type of window through which the app is being viewed

Type
string

(async) getFirstPreferredLangCode() → {Promise.<string>}

Source:

Returns a preferred language code, based on settings within the user's browser. If we have no translations for the users preferred locales, 'en' is returned.

Returns:

Promises a locale code, either one from the user's preferred list that we have a translation for, or 'en'

Type
Promise.<string>

getObjStructure(obj) → {object}

Source:

Creates an object that represents the structure of the given object. It replaces all values with the result of their type.

Parameters:
Name Type Description
obj object

The object for which a 'structure' will be returned. Usually a plain object and not a class.

Returns:

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.

Type
object

getPlatform() → {string}

Source:

Returns the platform (browser) where the extension is running.

Returns:

the platform ENUM

Type
string

getStack() → {string}

Source:

Generates an example stack trace

Returns:

A stack trace

Type
string

hexToBn(inputHex) → {Object}

Source:

Converts a hex string to a BN object

Parameters:
Name Type Description
inputHex string

A number represented as a hex string

Returns:

A BN object

Type
Object

(async) initialize() → {Promise}

Source:

Initializes the MetaMask controller, and sets up all platform configuration.

Returns:

Setup complete.

Type
Promise

initializePopup(config, cb)

Source:

Asynchronously initializes the MetaMask popup UI

Parameters:
Name Type Description
config Object

Popup configuration object

cb function

Called when initialization is complete

isEmpty(obj) → {boolean}

Source:

Returns whether or not the given object contains no keys

Parameters:
Name Type Description
obj object

The object to check

Returns:
Type
boolean

jsonParseStream() → {stream.Transform}

Source:

Returns a stream transform that parses JSON strings passing through

Returns:
Type
stream.Transform

jsonStringifyStream() → {stream.Transform}

Source:

Returns a stream transform that calls {@code JSON.stringify} on objects passing through

Returns:

the stream transform

Type
stream.Transform

(async) loadStateFromPersistence() → {Promise.<MetaMaskState>}

Source:

Loads any stored data, prioritizing the latest storage strategy. Migrates that data schema in case it was last loaded on an older version.

Returns:

Last data emitted from previous instance of MetaMask.

Type
Promise.<MetaMaskState>

logStreamDisconnectWarning(remoteLabel, err)

Source:

Error handler for page to plugin stream disconnections

Parameters:
Name Type Description
remoteLabel string

Remote stream name

err Error

Stream connection error

normalizeMsgData(data) → {string}

Source:

A helper function that converts raw buffer data to a hex, or just returns the data if it is already formatted as a hex.

Parameters:
Name Type Description
data any

The buffer data to convert to a hex

Returns:

A hex string conversion of the buffer data

Type
string

normalizeMsgData(data) → {string}

Source:

A helper function that converts raw buffer data to a hex, or just returns the data if it is already formatted as a hex.

Parameters:
Name Type Description
data any

The buffer data to convert to a hex

Returns:

A hex string conversion of the buffer data

Type
string

normalizeMsgData(data) → {string}

Source:

A helper function that converts raw buffer data to a hex, or just returns the data if it is already formatted as a hex.

Parameters:
Name Type Description
data any

The buffer data to convert to a hex

Returns:

A hex string conversion of the buffer data

Type
string

redirectToPhishingWarning()

Source:

Redirects the current page to a phishing information page

restoreContextAfterImports()

Source:

Restores global define object from cached reference

setupController(initState, initLangCode) → {Promise}

Source:

Initializes the MetaMask Controller with any initial state and default language. Configures platform-specific error reporting strategy. 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.

Parameters:
Name Type Description
initState Object

The initial state to start the controller with, matches the state that is emitted from the controller.

initLangCode String

The region code for the language preferred by the current user.

Returns:

After setup is complete.

Type
Promise

setupControllerConnection(connectionStream, cb)

Source:

Establishes a streamed connection to the background account manager

Parameters:
Name Type Description
connectionStream PortDuplexStream

PortStream instance establishing a background connection

cb function

Called when the remote account manager connection is established

setupInjection()

Source:

Creates a script tag that injects inpage.js

setupMetamaskMeshMetrics()

Source:

Injects an iframe into the current document for testing

setupMultiplex(connectionStream) → {stream.Stream}

Source:

Sets up stream multiplexing for the given stream

Parameters:
Name Type Description
connectionStream any

the stream to mux

Returns:

the multiplexed stream

Type
stream.Stream

setupStreams()

Source:

Sets up two-way communication streams between the browser extension and local per-page browser context

setupWeb3Connection(connectionStream)

Source:

Establishes a streamed connection to a Web3 provider

Parameters:
Name Type Description
connectionStream PortDuplexStream

PortStream instance establishing a background connection

shouldInjectWeb3() → {boolean}

Source:

Determines if Web3 should be injected

Returns:

{@code true} if Web3 should be injected

Type
boolean

showWatchAssetUi()

Source:

Opens the browser popup for user confirmation of watchAsset then it waits until user interact with the UI

sufficientBalance(txParams, hexBalance) → {boolean}

Source:

Checks whether a given balance of ETH, represented as a hex string, is sufficient to pay a value plus a gas fee

Parameters:
Name Type Description
txParams object

Contains data about a transaction

Properties
Name Type Description
gas string

The gas for a transaction

gasPrice string

The price per gas for the transaction

value string

The value of ETH to send

hexBalance string

A balance of ETH represented as a hex string

Returns:

Whether the balance is greater than or equal to the value plus the value of gas times gasPrice

Type
boolean

suffixCheck() → {boolean}

Source:

Checks the current document extension

Returns:

{@code true} if the current extension is not prohibited

Type
boolean

triggerUi()

Source:

Opens the browser popup for user confirmation

Type Definitions

Account

Source:
Properties:
Name Type Description
string

privateKey - The private key of the account.

An account object

AccountTracker

Source:
Properties:
Name Type Description
store Object

The stored object containing all accounts to track, as well as the current block's gas limit.

Properties
Name Type Description
accounts Object

The accounts currently stored in this AccountTracker

currentBlockGasLimit string

A hex string indicating the gas limit of the current block

_provider Object

A provider needed to create the EthQuery instance used within this AccountTracker.

_query EthQuery

An EthQuery instance used to access account information from the blockchain

_blockTracker BlockTracker

A BlockTracker instance. Needed to ensure that accounts and their info updates when a new block is created.

_currentBlockNumber Object

Reference to a property on the _blockTracker: the number (i.e. an id) of the the current block

This module is responsible for tracking any number of accounts and caching their current balances & transaction counts.

It also tracks transaction hashes, and checks their inclusion status on each new block.

Type:
  • Object

AddedToken

Source:
Properties:
Name Type Description
address string

The hex address for the token contract. Will be all lower cased and hex-prefixed.

symbol string

The symbol of the token, usually 3 or 4 capitalized letters https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md#symbol

decimals boolean

The number of decimals the token uses. https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md#decimals

Contains data about tokens users add to their account.

Type:
  • Object

AddressBookController

Source:
Properties:
Name Type Description
opts.initState array

initializes the the state of the AddressBookController. Can contain an addressBook property to initialize the addressBook array

opts.preferencesStore object

the {@code PreferencesController} store

store object

The the store of the current users address book

Properties
Name Type Description
addressBook array

An array of addresses and nicknames. These are set by the user when sending to a new address.

Controller in charge of managing the address book functionality from the recipients field on the send screen. Manages a history of all saved addresses and all currently owned addresses.

Type:
  • Object

BalanceController

Source:
Properties:
Name Type Description
address string

A base 16 hex string. The account address which has the balance managed by this BalanceController.

accountTracker AccountTracker

Stores and updates the users accounts for which this BalanceController manages balance.

txController TransactionController

Stores, tracks and manages transactions. Here used to create a listener for transaction updates.

blockTracker BlockTracker

Tracks updates to blocks. On new blocks, this BalanceController updates its balance

store Object

The store for the ethBalance

Properties
Name Type Description
ethBalance string

A base 16 hex string. The balance for the current account.

balanceCalc PendingBalanceCalculator

Used to calculate the accounts balance with possible pending transaction costs taken into account.

Controller responsible for storing and updating an account's balance.

Type:
  • Object

BlacklistController

Source:
Properties:
Name Type Description
store object

The the store of the current phishing config

Properties
Name Type Description
phishing object

Contains fuzzylist, whitelist and blacklist arrays. @see https://github.com/MetaMask/eth-phishing-detect/blob/master/src/config.json

_phishingDetector object

The PhishingDetector instantiated by passing store.phishing to PhishingDetector.

_phishingUpdateIntervalRef object

Id of the interval created to periodically update the blacklist

Responsible for polling for and storing an up to date 'eth-phishing-detect' config.json file, while exposing a method that can check whether a given url is a phishing attempt. The 'eth-phishing-detect' config.json file contains a fuzzylist, whitelist and blacklist.

Type:
  • Object

ComputedBalancesOptions

Source:
Properties:
Name Type Description
accountTracker Object

Account tracker store reference

txController Object

Token controller reference

blockTracker Object

Block tracker reference

initState Object

Initial state to populate this internal store with

Type:
  • Object

CurrencyController

Source:
Properties:
Name Type Description
opts.initState array

initializes the the state of the CurrencyController. Can contain an currentCurrency, conversionRate and conversionDate properties

currentCurrency string

A 2-4 character shorthand that describes a specific currency, currently selected by the user

conversionRate number

The conversion rate from ETH to the selected currency.

conversionDate string

The date at which the conversion rate was set. Expressed in in milliseconds since midnight of January 1, 1970

conversionInterval number

The id of the interval created by the scheduleConversionInterval method. Used to clear an existing interval on subsequent calls of that method.

Controller responsible for managing data associated with the currently selected currency.

Type:
  • Object

FirstTimeState

Source:
Properties:
Name Type Description
config Object

Initial configuration parameters

NetworkController Object

Network controller state

Type:
  • Object

highestContinuousFrom

Source:
Properties:
Type Description
string

name the name for how the nonce was calculated based on the data used

number

nonce the next suggested nonce

object

details the provided starting nonce that was used (for debugging)

Type:
  • object

Message

Source:
See:
Properties:
Name Type Description
id number

An id to track and identify the message object

msgParams Object

The parameters to pass to the eth_sign method once the signature request is approved.

Properties
Name Type Description
metamaskId Object

Added to msgParams for tracking and identification within MetaMask.

data string

A hex string conversion of the raw buffer data of the signature request

time number

The epoch time at which the this message was created

status string

Indicates whether the signature request is 'unapproved', 'approved', 'signed' or 'rejected'

type string

The json-prc signing method for which a signature request has been made. A 'Message' with always have a 'eth_sign' type.

Represents, and contains data about, an 'eth_sign' type signature request. These are created when a signature for an eth_sign call is requested.

Type:
  • Object

Message

Source:
See:
Properties:
Name Type Description
id number

An id to track and identify the message object

msgParams Object

The parameters to pass to the eth_sign method once the signature request is approved.

Properties
Name Type Description
metamaskId Object

Added to msgParams for tracking and identification within MetaMask.

data string

A hex string conversion of the raw buffer data of the signature request

time number

The epoch time at which the this message was created

status string

Indicates whether the signature request is 'unapproved', 'approved', 'signed' or 'rejected'

type string

The json-prc signing method for which a signature request has been made. A 'Message' with always have a 'eth_sign' type.

Represents, and contains data about, an 'eth_sign' type signature request. These are created when a signature for an eth_sign call is requested.

Type:
  • Object

Message

Source:
See:
Properties:
Name Type Description
id number

An id to track and identify the message object

msgParams Object

The parameters to pass to the eth_sign method once the signature request is approved.

Properties
Name Type Description
metamaskId Object

Added to msgParams for tracking and identification within MetaMask.

data string

A hex string conversion of the raw buffer data of the signature request

time number

The epoch time at which the this message was created

status string

Indicates whether the signature request is 'unapproved', 'approved', 'signed' or 'rejected'

type string

The json-prc signing method for which a signature request has been made. A 'Message' with always have a 'eth_sign' type.

Represents, and contains data about, an 'eth_sign' type signature request. These are created when a signature for an eth_sign call is requested.

Type:
  • Object

MessageManager

Source:
Properties:
Name Type Description
memStore Object

The observable store where Messages are saved.

Properties
Name Type Description
unapprovedMsgs Object

A collection of all Messages in the 'unapproved' state

unapprovedMsgCount number

The count of all Messages in this.memStore.unapprobedMsgs

messages array

Holds all messages that have been created by this MessageManager

Controller in charge of managing - storing, adding, removing, updating - Messages.

Type:
  • Object

MessageManager

Source:
Properties:
Name Type Description
memStore Object

The observable store where Messages are saved.

Properties
Name Type Description
unapprovedMsgs Object

A collection of all Messages in the 'unapproved' state

unapprovedMsgCount number

The count of all Messages in this.memStore.unapprobedMsgs

messages array

Holds all messages that have been created by this MessageManager

Controller in charge of managing - storing, adding, removing, updating - Messages.

Type:
  • Object

MetaMaskState

Source:
Properties:
Name Type Description
isInitialized boolean

Whether the first vault has been created.

isUnlocked boolean

Whether the vault is currently decrypted and accounts are available for selection.

isAccountMenuOpen boolean

Represents whether the main account selection UI is currently displayed.

isMascara boolean

True if the current context is the extensionless MetaMascara project.

isPopup boolean

Returns true if the current view is an externally-triggered notification.

rpcTarget string

DEPRECATED - The URL of the current RPC provider.

identities Object

An object matching lower-case hex addresses to Identity objects with "address" and "name" (nickname) keys.

unapprovedTxs Object

An object mapping transaction hashes to unapproved transactions.

noActiveNotices boolean

False if there are notices the user should confirm before using the application.

frequentRpcList Array

A list of frequently used RPCs, including custom user-provided ones.

addressBook Array

A list of previously sent to addresses.

selectedTokenAddress address

Used to indicate if a token is globally selected. Should be deprecated in favor of UI-centric token selection.

tokenExchangeRates Object

Info about current token prices.

tokens Array

Tokens held by the current user, including their balances.

send Object

TODO: Document

coinOptions Object

TODO: Document

useBlockie boolean

Indicates preferred user identicon format. True for blockie, false for Jazzicon.

featureFlags Object

An object for optional feature flags.

networkEndpointType string

TODO: Document

isRevealingSeedWords boolean

True if seed words are currently being recovered, and should be shown to user.

welcomeScreen boolean

True if welcome screen should be shown.

currentLocale string

A locale string matching the user's preferred display language.

provider Object

The current selected network provider.

Properties
Name Type Description
rpcTarget string

The address for the RPC API, if using an RPC API.

type string

An identifier for the type of network selected, allows MetaMask to use custom provider strategies for known networks.

network string

A stringified number of the current network ID.

accounts Object

An object mapping lower-case hex addresses to objects with "balance" and "address" keys, both storing hex string values.

currentBlockGasLimit hex

The most recently seen block gas limit, in a lower case hex prefixed string.

selectedAddressTxList Array.<TransactionMeta>

An array of transactions associated with the currently selected account.

unapprovedMsgs Object

An object of messages associated with the currently selected account, mapping a unique ID to the options.

unapprovedMsgCount number

The number of messages in unapprovedMsgs.

unapprovedPersonalMsgs Object

An object of messages associated with the currently selected account, mapping a unique ID to the options.

unapprovedPersonalMsgCount number

The number of messages in unapprovedPersonalMsgs.

unapprovedTypedMsgs Object

An object of messages associated with the currently selected account, mapping a unique ID to the options.

unapprovedTypedMsgCount number

The number of messages in unapprovedTypedMsgs.

keyringTypes Array.<string>

An array of unique keyring identifying strings, representing available strategies for creating accounts.

keyrings Array.<Keyring>

An array of keyring descriptions, summarizing the accounts that are available for use, and what keyrings they belong to.

computedBalances Object

Maps accounts to their balances, accounting for balance changes from pending transactions.

currentAccountTab string

A view identifying string for displaying the current displayed view, allows user to have a preferred tab in the old UI (between tokens and history).

selectedAddress string

A lower case hex string of the currently selected address.

currentCurrency string

A string identifying the user's preferred display currency, for use in showing conversion rates.

conversionRate number

A number representing the current exchange rate from the user's preferred currency to Ether.

conversionDate number

A unix epoch date (ms) for the time the current conversion rate was last retrieved.

infuraNetworkStatus Object

An object of infura network status checks.

recentBlocks Array.<Block>

An array of recent blocks, used to calculate an effective but cheap gas price.

shapeShiftTxList Array

An array of objects describing shapeshift exchange attempts.

lostAccounts Array

TODO: Remove this feature. A leftover from the version-3 migration where our seed-phrase library changed to fix a bug where some accounts were mis-generated, but we recovered the old accounts as "lost" instead of losing them.

forgottenPassword boolean

Returns true if the user has initiated the password recovery screen, is recovering from seed phrase.

The data emitted from the MetaMaskController.store EventEmitter, also used to initialize the MetaMaskController. Available in UI on React state as state.metamask.

Migration

Source:
Properties:
Name Type Description
version number

The migration version

migrate function

Returns a promise of the migrated data

Type:
  • object

MigratorOptions

Source:
Properties:
Name Type Attributes Description
migrations Array.<Migration> <optional>

The list of migrations to apply

defaultVersion number <optional>

The version to use in the initial state

Type:
  • object

NonceDetails

Source:
Properties:
Name Type Description
highestLocallyConfirmed number

A hex string of the highest nonce on a confirmed transaction.

nextNetworkNonce number

The next nonce suggested by the eth_getTransactionCount method.

highestSuggested number

The maximum between the other two, the number returned.

NotificationManager

Source:

A collection of methods for controlling the showing and hiding of the notification popup.

Type:
  • Object

PendingBalanceCalculator

Source:

Used for calculating a users "pending balance": their current balance minus the total possible cost of all their pending transactions.

Type:
  • Object

PersonalMessage

Source:
See:
Properties:
Name Type Description
id number

An id to track and identify the message object

msgParams Object

The parameters to pass to the personal_sign method once the signature request is approved.

Properties
Name Type Description
metamaskId Object

Added to msgParams for tracking and identification within MetaMask.

data string

A hex string conversion of the raw buffer data of the signature request

time number

The epoch time at which the this message was created

status string

Indicates whether the signature request is 'unapproved', 'approved', 'signed' or 'rejected'

type string

The json-prc signing method for which a signature request has been made. A 'Message' will always have a 'personal_sign' type.

Represents, and contains data about, an 'personal_sign' type signature request. These are created when a signature for an personal_sign call is requested.

Type:
  • Object

PersonalMessageManager

Source:
Properties:
Name Type Description
memStore Object

The observable store where PersonalMessage are saved with persistance.

Properties
Name Type Description
unapprovedPersonalMsgs Object

A collection of all PersonalMessages in the 'unapproved' state

unapprovedPersonalMsgCount number

The count of all PersonalMessages in this.memStore.unapprobedMsgs

messages array

Holds all messages that have been created by this PersonalMessageManager

Controller in charge of managing - storing, adding, removing, updating - PersonalMessage.

Type:
  • Object

Port

Source:
See:

A runtime.Port object, as provided by the browser:

Type:
  • Object

PreferencesController

Source:
Properties:
Name Type Description
store object

The stored object containing a users preferences, stored in local storage

Properties
Name Type Description
frequentRpcList array

A list of custom rpcs to provide the user

currentAccountTab string

Indicates the selected tab in the ui

tokens array

The tokens the user wants display in their token lists

accountTokens object

The tokens stored per account and then per network type

assetImages object

Contains assets objects related to assets added

useBlockie boolean

The users preference for blockie identicons within the UI

featureFlags object

A key-boolean map, where keys refer to features and booleans to whether the user wishes to see that feature

currentLocale string

The preferred language locale key

selectedAddress string

A hex string that matches the currently selected address in the app

Type:
  • Object

RecentBlocksController

Source:
Properties:
Name Type Description
blockTracker BlockTracker

Points to the passed BlockTracker. On RecentBlocksController construction, listens for 'latest' events so that new blocks can be processed and added to storage.

ethQuery EthQuery

Points to the EthQuery instance created with the passed provider

historyLength number

The maximum length of blocks to track

store object

Stores the recentBlocks

Properties
Name Type Description
recentBlocks array

Contains all recent blocks, up to a total that is equal to this.historyLength

Controller responsible for storing, updating and managing the recent history of blocks. Blocks are back filled upon the controller's construction and then the list is updated when the given block tracker gets a 'latest' event (indicating that there is a new block to process).

Type:
  • Object

ShapeshiftController

Source:
Properties:
Name Type Description
opts.initState array

initializes the the state of the ShapeshiftController. Can contain an shapeShiftTxList array.

shapeShiftTxList array

An array of ShapeShiftTx objects

Controller responsible for managing the list of shapeshift transactions. On construction, it initiates a poll that queries a shapeshift.io API for updates to any pending shapeshift transactions

Type:
  • Object

ShapeShiftTx

Source:
Properties:
Name Type Description
depositAddress string

An address at which to send a crypto deposit, so that eth can be sent to the user's Metamask account

depositType string

An abbreviation of the type of crypto currency to be deposited.

key string

The 'shapeshift' key differentiates this from other types of txs in Metamask

time number

The time at which the tx was created

response object

Initiated as an empty object, which will be replaced by a Response object. @see https://developer.mozilla.org/en-US/docs/Web/API/Response

Represents, and contains data about, a single shapeshift transaction.

Type:
  • Object

SignController

Source:
Properties:
Name Type Description
memStore Object

The observable store where Messages are saved.

Properties
Name Type Description
unapprovedMsgs Object

A collection of all Messages in the 'unapproved' state

unapprovedMsgCount number

The count of all Messages in this.memStore.unapprobedMsgs

messages array

Holds all messages that have been created by this SignController

Controller in charge of managing - storing, adding, removing, updating - Messages.

Type:
  • Object

TransactionMeta

Source:
Properties:
Name Type Description
id number

An internally unique tx identifier.

time number

Time the tx was first suggested, in unix epoch time (ms).

status string

The current transaction status (unapproved, signed, submitted, dropped, failed, rejected), as defined in tx-state-manager.js.

metamaskNetworkId string

The transaction's network ID, used for EIP-155 compliance.

loadingDefaults boolean

TODO: Document

txParams Object

The tx params as passed to the network provider.

history Array.<Object>

A history of mutations to this TransactionMeta object.

gasPriceSpecified boolean

True if the suggesting dapp specified a gas price, prevents auto-estimation.

gasLimitSpecified boolean

True if the suggesting dapp specified a gas limit, prevents auto-estimation.

estimatedGas string

A hex string represented the estimated gas limit required to complete the transaction.

origin string

A string representing the interface that suggested the transaction.

nonceDetails Object

A metadata object containing information used to derive the suggested nonce, useful for debugging nonce issues.

rawTx string

A hex string of the final signed transaction, ready to submit to the network.

hash string

A hex string of the transaction hash, used to identify the transaction on the network.

submittedTime number

The time the transaction was submitted to the network, in Unix epoch time (ms).

An object representing a transaction, in whatever state it is in.

TypedMessage

Source:
Properties:
Name Type Description
id number

An id to track and identify the message object

msgParams Object

The parameters to pass to the eth_signTypedData method once the signature request is approved.

Properties
Name Type Description
metamaskId Object

Added to msgParams for tracking and identification within MetaMask.

from Object

The address that is making the signature request.

data string

A hex string conversion of the raw buffer data of the signature request

time number

The epoch time at which the this message was created

status string

Indicates whether the signature request is 'unapproved', 'approved', 'signed' or 'rejected'

type string

The json-prc signing method for which a signature request has been made. A 'Message' will always have a 'eth_signTypedData' type.

Represents, and contains data about, an 'eth_signTypedData' type signature request. These are created when a signature for an eth_signTypedData call is requested.

Type:
  • Object

TypedMessage

Source:
Properties:
Name Type Description
memStore Object

The observable store where TypedMessage are saved.

Properties
Name Type Description
unapprovedTypedMessages Object

A collection of all TypedMessages in the 'unapproved' state

unapprovedTypedMessagesCount number

The count of all TypedMessages in this.memStore.unapprobedMsgs

messages array

Holds all messages that have been created by this TypedMessage

Controller in charge of managing - storing, adding, removing, updating - TypedMessage.

Type:
  • Object

VersionedData

Source:
Properties:
Name Type Description
data MetaMaskState

The data emitted from MetaMask controller, or used to initialize it.

version Number

The latest migration version that has been run.