DetectTokensController

DetectTokensController

A controller that polls for token exchange rates based on a user's current token list

Constructor

new DetectTokensController(configopt)

Source:

Creates a DetectTokensController

Parameters:
Name Type Attributes Description
config Object <optional>

Options to configure controller

Members

interval :Number

Source:
Type:
  • Number

isActive :Object

Source:

Internal isActive state

Type:
  • Object

keyringMemStore :Object

Source:

In setter when isUnlocked is updated to true, detectNewTokens and restart polling

Type:
  • Object

network :Object

Source:
Type:
  • Object

preferences :Object

Source:

In setter when selectedAddress is changed, detectNewTokens and restart polling

Type:
  • Object

Methods

(async) detectNewTokens()

Source:

For each token in eth-contract-metada, find check selectedAddress balance.

(async) detectTokenBalance(contractAddress) → {boolean}

Source:

Find if selectedAddress has tokens with contract in contractAddress.

Parameters:
Name Type Description
contractAddress string

Hex address of the token contract to explore.

Returns:

If balance is detected, token is added.

Type
boolean

restartTokenDetection()

Source:

Restart token detection polling period and call detectNewTokens in case of address change or user session initialization.