@ -10,7 +10,7 @@ class PreferencesController {
/ * *
/ * *
*
*
* @ typedef { Object } PreferencesController
* @ typedef { Object } PreferencesController
* @ param { o bject} opts Overrides the defaults for the initial state of this . store
* @ param { O bject} 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 { 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 { array } store . frequentRpcList A list of custom rpcs to provide the user
* @ property { string } store . currentAccountTab Indicates the selected tab in the ui
* @ property { string } store . currentAccountTab Indicates the selected tab in the ui
@ -79,7 +79,7 @@ class PreferencesController {
/ * *
/ * *
* Sets the { @ code forgottenPassword } state property
* Sets the { @ code forgottenPassword } state property
* @ param { boolean } forgottenPassword whether or not the user has forgotten their password
* @ param { boolean } forgottenPassword - whether or not the user has forgotten their password
* /
* /
setPasswordForgotten ( forgottenPassword ) {
setPasswordForgotten ( forgottenPassword ) {
this . store . updateState ( { forgottenPassword } )
this . store . updateState ( { forgottenPassword } )
@ -88,7 +88,7 @@ class PreferencesController {
/ * *
/ * *
* Setter for the ` useBlockie ` property
* Setter for the ` useBlockie ` property
*
*
* @ param { boolean } val Whether or not the user prefers blockie indicators
* @ param { boolean } val - Whether or not the user prefers blockie indicators
*
*
* /
* /
setUseBlockie ( val ) {
setUseBlockie ( val ) {
@ -98,7 +98,7 @@ class PreferencesController {
/ * *
/ * *
* Setter for the ` useNonceField ` property
* Setter for the ` useNonceField ` property
*
*
* @ param { boolean } val Whether or not the user prefers to set nonce
* @ param { boolean } val - Whether or not the user prefers to set nonce
*
*
* /
* /
setUseNonceField ( val ) {
setUseNonceField ( val ) {
@ -108,8 +108,8 @@ class PreferencesController {
/ * *
/ * *
* Setter for the ` participateInMetaMetrics ` property
* Setter for the ` participateInMetaMetrics ` property
*
*
* @ param { boolean } bool Whether or not the user wants to participate in MetaMetrics
* @ param { boolean } bool - Whether or not the user wants to participate in MetaMetrics
* @ returns { string | null } the string of the new metametrics id , or null if not set
* @ returns { string | null } - the string of the new metametrics id , or null if not set
*
*
* /
* /
setParticipateInMetaMetrics ( bool ) {
setParticipateInMetaMetrics ( bool ) {
@ -135,7 +135,7 @@ class PreferencesController {
/ * *
/ * *
* Setter for the ` firstTimeFlowType ` property
* Setter for the ` firstTimeFlowType ` property
*
*
* @ param { S tring} type Indicates the type of first time flow - create or import - the user wishes to follow
* @ param { s tring} type - Indicates the type of first time flow - create or import - the user wishes to follow
*
*
* /
* /
setFirstTimeFlowType ( type ) {
setFirstTimeFlowType ( type ) {
@ -164,8 +164,8 @@ class PreferencesController {
/ * *
/ * *
* Add new methodData to state , to avoid requesting this information again through Infura
* Add new methodData to state , to avoid requesting this information again through Infura
*
*
* @ param { string } fourBytePrefix Four - byte method signature
* @ param { string } fourBytePrefix - Four - byte method signature
* @ param { string } methodData Corresponding data method
* @ param { string } methodData - Corresponding data method
* /
* /
addKnownMethodData ( fourBytePrefix , methodData ) {
addKnownMethodData ( fourBytePrefix , methodData ) {
const knownMethodData = this . store . getState ( ) . knownMethodData
const knownMethodData = this . store . getState ( ) . knownMethodData
@ -208,7 +208,7 @@ class PreferencesController {
/ * *
/ * *
* Setter for the ` currentLocale ` property
* Setter for the ` currentLocale ` property
*
*
* @ param { string } key he preferred language locale key
* @ param { string } key - he preferred language locale key
*
*
* /
* /
setCurrentLocale ( key ) {
setCurrentLocale ( key ) {
@ -224,7 +224,7 @@ class PreferencesController {
* Updates identities to only include specified addresses . Removes identities
* Updates identities to only include specified addresses . Removes identities
* not included in addresses array
* not included in addresses array
*
*
* @ param { string [ ] } addresses An array of hex addresses
* @ param { string [ ] } addresses - An array of hex addresses
*
*
* /
* /
setAddresses ( addresses ) {
setAddresses ( addresses ) {
@ -247,8 +247,8 @@ class PreferencesController {
/ * *
/ * *
* Removes an address from state
* Removes an address from state
*
*
* @ param { string } address A hex address
* @ param { string } address - A hex address
* @ returns { string } the address that was removed
* @ returns { string } - the address that was removed
* /
* /
removeAddress ( address ) {
removeAddress ( address ) {
const identities = this . store . getState ( ) . identities
const identities = this . store . getState ( ) . identities
@ -273,7 +273,7 @@ class PreferencesController {
/ * *
/ * *
* Adds addresses to the identities object without removing identities
* Adds addresses to the identities object without removing identities
*
*
* @ param { string [ ] } addresses An array of hex addresses
* @ param { string [ ] } addresses - An array of hex addresses
*
*
* /
* /
addAddresses ( addresses ) {
addAddresses ( addresses ) {
@ -297,8 +297,8 @@ class PreferencesController {
* Synchronizes identity entries with known accounts .
* Synchronizes identity entries with known accounts .
* Removes any unknown identities , and returns the resulting selected address .
* Removes any unknown identities , and returns the resulting selected address .
*
*
* @ param { Array < string > } addresses known to the vault .
* @ param { Array < string > } addresses - known to the vault .
* @ returns { Promise < string > } selectedAddress the selected address .
* @ returns { Promise < string > } - selectedAddress the selected address .
* /
* /
syncAddresses ( addresses ) {
syncAddresses ( addresses ) {
const { identities , lostIdentities } = this . store . getState ( )
const { identities , lostIdentities } = this . store . getState ( )
@ -349,8 +349,8 @@ class PreferencesController {
/ * *
/ * *
* Setter for the ` selectedAddress ` property
* Setter for the ` selectedAddress ` property
*
*
* @ param { string } _address A new hex address for an account
* @ param { string } _address - A new hex address for an account
* @ returns { Promise < void > } Promise resolves with tokens
* @ returns { Promise < void > } - Promise resolves with tokens
*
*
* /
* /
setSelectedAddress ( _address ) {
setSelectedAddress ( _address ) {
@ -364,7 +364,7 @@ class PreferencesController {
/ * *
/ * *
* Getter for the ` selectedAddress ` property
* Getter for the ` selectedAddress ` property
*
*
* @ returns { string } The hex address for the currently selected account
* @ returns { string } - The hex address for the currently selected account
*
*
* /
* /
getSelectedAddress ( ) {
getSelectedAddress ( ) {
@ -386,10 +386,10 @@ class PreferencesController {
* Modifies the existing tokens array from the store . All objects in the tokens array array AddedToken objects .
* Modifies the existing tokens array from the store . All objects in the tokens array array AddedToken objects .
* @ see AddedToken { @ link AddedToken }
* @ see AddedToken { @ link AddedToken }
*
*
* @ param { string } rawAddress Hex address of the token contract . May or may not be a checksum address .
* @ param { string } rawAddress - Hex address of the token contract . May or may not be a checksum address .
* @ param { string } symbol The symbol of the token
* @ param { string } symbol - The symbol of the token
* @ param { number } decimals The number of decimals the token uses .
* @ param { number } decimals - The number of decimals the token uses .
* @ returns { Promise < array > } Promises the new array of AddedToken objects .
* @ returns { Promise < array > } - Promises the new array of AddedToken objects .
*
*
* /
* /
async addToken ( rawAddress , symbol , decimals , image ) {
async addToken ( rawAddress , symbol , decimals , image ) {
@ -415,8 +415,8 @@ class PreferencesController {
/ * *
/ * *
* Removes a specified token from the tokens array .
* Removes a specified token from the tokens array .
*
*
* @ param { string } rawAddress Hex address of the token contract to remove .
* @ param { string } rawAddress - Hex address of the token contract to remove .
* @ returns { Promise < array > } The new array of AddedToken objects
* @ returns { Promise < array > } - The new array of AddedToken objects
*
*
* /
* /
removeToken ( rawAddress ) {
removeToken ( rawAddress ) {
@ -431,7 +431,7 @@ class PreferencesController {
/ * *
/ * *
* A getter for the ` tokens ` property
* A getter for the ` tokens ` property
*
*
* @ returns { array } The current array of AddedToken objects
* @ returns { array } - The current array of AddedToken objects
*
*
* /
* /
getTokens ( ) {
getTokens ( ) {
@ -440,9 +440,9 @@ class PreferencesController {
/ * *
/ * *
* Sets a custom label for an account
* Sets a custom label for an account
* @ param { string } account the account to set a label for
* @ param { string } account - the account to set a label for
* @ param { string } label the custom label for the account
* @ param { string } label - the custom label for the account
* @ return { Promise < string > }
* @ returns { Promise < string > }
* /
* /
setAccountLabel ( account , label ) {
setAccountLabel ( account , label ) {
if ( ! account ) {
if ( ! account ) {
@ -459,8 +459,8 @@ class PreferencesController {
/ * *
/ * *
* Setter for the ` currentAccountTab ` property
* Setter for the ` currentAccountTab ` property
*
*
* @ param { string } currentAccountTab Specifies the new tab to be marked as current
* @ param { string } currentAccountTab - Specifies the new tab to be marked as current
* @ returns { Promise < void > } Promise resolves with undefined
* @ returns { Promise < void > } - Promise resolves with undefined
*
*
* /
* /
setCurrentAccountTab ( currentAccountTab ) {
setCurrentAccountTab ( currentAccountTab ) {
@ -473,11 +473,11 @@ class PreferencesController {
/ * *
/ * *
* updates custom RPC details
* updates custom RPC details
*
*
* @ param { string } url The RPC url to add to frequentRpcList .
* @ param { string } url - The RPC url to add to frequentRpcList .
* @ param { number } chainId Optional chainId of the selected network .
* @ param { number } chainId - Optional chainId of the selected network .
* @ param { string } ticker Optional ticker symbol of the selected network .
* @ param { string } ticker - Optional ticker symbol of the selected network .
* @ param { string } nickname Optional nickname of the selected network .
* @ param { string } nickname - Optional nickname of the selected network .
* @ returns { Promise < array > } Promise resolving to updated frequentRpcList .
* @ returns { Promise < array > } - Promise resolving to updated frequentRpcList .
*
*
* /
* /
@ -501,11 +501,11 @@ class PreferencesController {
/ * *
/ * *
* Adds custom RPC url to state .
* Adds custom RPC url to state .
*
*
* @ param { string } url The RPC url to add to frequentRpcList .
* @ param { string } url - The RPC url to add to frequentRpcList .
* @ param { number } chainId Optional chainId of the selected network .
* @ param { number } chainId - Optional chainId of the selected network .
* @ param { string } ticker Optional ticker symbol of the selected network .
* @ param { string } ticker - Optional ticker symbol of the selected network .
* @ param { string } nickname Optional nickname of the selected network .
* @ param { string } nickname - Optional nickname of the selected network .
* @ returns { Promise < array > } Promise resolving to updated frequentRpcList .
* @ returns { Promise < array > } - Promise resolving to updated frequentRpcList .
*
*
* /
* /
addToFrequentRpcList ( url , chainId , ticker = 'ETH' , nickname = '' , rpcPrefs = { } ) {
addToFrequentRpcList ( url , chainId , ticker = 'ETH' , nickname = '' , rpcPrefs = { } ) {
@ -530,8 +530,8 @@ class PreferencesController {
/ * *
/ * *
* Removes custom RPC url from state .
* Removes custom RPC url from state .
*
*
* @ param { string } url The RPC url to remove from frequentRpcList .
* @ param { string } url - The RPC url to remove from frequentRpcList .
* @ returns { Promise < array > } Promise resolving to updated frequentRpcList .
* @ returns { Promise < array > } - Promise resolving to updated frequentRpcList .
*
*
* /
* /
removeFromFrequentRpcList ( url ) {
removeFromFrequentRpcList ( url ) {
@ -549,7 +549,7 @@ class PreferencesController {
/ * *
/ * *
* Getter for the ` frequentRpcListDetail ` property .
* Getter for the ` frequentRpcListDetail ` property .
*
*
* @ returns { array < array > } An array of rpc urls .
* @ returns { array < array > } - An array of rpc urls .
*
*
* /
* /
getFrequentRpcListDetail ( ) {
getFrequentRpcListDetail ( ) {
@ -559,9 +559,9 @@ class PreferencesController {
/ * *
/ * *
* Updates the ` featureFlags ` property , which is an object . One property within that object will be set to a boolean .
* Updates the ` featureFlags ` property , which is an object . One property within that object will be set to a boolean .
*
*
* @ param { string } feature A key that corresponds to a UI feature .
* @ param { string } feature - A key that corresponds to a UI feature .
* @ param { boolean } activated Indicates whether or not the UI feature should be displayed
* @ param { boolean } activated - Indicates whether or not the UI feature should be displayed
* @ returns { Promise < object > } Promises a new object ; the updated featureFlags object .
* @ returns { Promise < object > } - Promises a new object ; the updated featureFlags object .
*
*
* /
* /
setFeatureFlag ( feature , activated ) {
setFeatureFlag ( feature , activated ) {
@ -579,9 +579,9 @@ class PreferencesController {
/ * *
/ * *
* Updates the ` preferences ` property , which is an object . These are user - controlled features
* Updates the ` preferences ` property , which is an object . These are user - controlled features
* found in the settings page .
* found in the settings page .
* @ param { string } preference The preference to enable or disable .
* @ param { string } preference - The preference to enable or disable .
* @ param { boolean } value Indicates whether or not the preference should be enabled or disabled .
* @ param { boolean } value - Indicates whether or not the preference should be enabled or disabled .
* @ returns { Promise < object > } Promises a new object ; the updated preferences object .
* @ returns { Promise < object > } - Promises a new object ; the updated preferences object .
* /
* /
setPreference ( preference , value ) {
setPreference ( preference , value ) {
const currentPreferences = this . getPreferences ( )
const currentPreferences = this . getPreferences ( )
@ -596,7 +596,7 @@ class PreferencesController {
/ * *
/ * *
* A getter for the ` preferences ` property
* 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 ( ) {
getPreferences ( ) {
return this . store . getState ( ) . preferences
return this . store . getState ( ) . preferences
@ -613,7 +613,7 @@ class PreferencesController {
/ * *
/ * *
* A getter for the ` ipfsGateway ` property
* A getter for the ` ipfsGateway ` property
* @ returns { string } The current IPFS gateway domain
* @ returns { string } - The current IPFS gateway domain
* /
* /
getIpfsGateway ( ) {
getIpfsGateway ( ) {
return this . store . getState ( ) . ipfsGateway
return this . store . getState ( ) . ipfsGateway
@ -621,8 +621,8 @@ class PreferencesController {
/ * *
/ * *
* A setter for the ` ipfsGateway ` property
* A setter for the ` ipfsGateway ` property
* @ param { string } domain The new IPFS gateway domain
* @ param { string } domain - The new IPFS gateway domain
* @ returns { Promise < string > } A promise of the update IPFS gateway domain
* @ returns { Promise < string > } - A promise of the update IPFS gateway domain
* /
* /
setIpfsGateway ( domain ) {
setIpfsGateway ( domain ) {
this . store . updateState ( { ipfsGateway : domain } )
this . store . updateState ( { ipfsGateway : domain } )
@ -648,7 +648,7 @@ class PreferencesController {
/ * *
/ * *
* Updates ` accountTokens ` and ` tokens ` of current account and network according to it .
* Updates ` accountTokens ` and ` tokens ` of current account and network according to it .
*
*
* @ param { array } tokens Array of tokens to be updated .
* @ param { array } tokens - Array of tokens to be updated .
*
*
* /
* /
_updateAccountTokens ( tokens , assetImages ) {
_updateAccountTokens ( tokens , assetImages ) {
@ -660,7 +660,7 @@ class PreferencesController {
/ * *
/ * *
* Updates ` tokens ` of current account and network .
* Updates ` tokens ` of current account and network .
*
*
* @ param { string } selectedAddress Account address to be updated with .
* @ param { string } selectedAddress - Account address to be updated with .
*
*
* /
* /
_updateTokens ( selectedAddress ) {
_updateTokens ( selectedAddress ) {
@ -672,7 +672,7 @@ class PreferencesController {
* A getter for ` tokens ` and ` accountTokens ` related states .
* A getter for ` tokens ` and ` accountTokens ` related states .
*
*
* @ param { string } [ selectedAddress ] A new hex address for an account
* @ param { string } [ selectedAddress ] A new hex address for an account
* @ returns { Object . < array , object , string , string > } States to interact with tokens in ` accountTokens `
* @ returns { Object . < array , object , string , string > } - States to interact with tokens in ` accountTokens `
*
*
* /
* /
_getTokenRelatedStates ( selectedAddress ) {
_getTokenRelatedStates ( selectedAddress ) {
@ -694,7 +694,7 @@ class PreferencesController {
/ * *
/ * *
* Handle the suggestion of an ERC20 asset through ` watchAsset `
* Handle the suggestion of an ERC20 asset through ` watchAsset `
* *
* *
* @ param { Promise } promise Promise according to addition of ERC20 token
* @ param { Promise } promise - Promise according to addition of ERC20 token
*
*
* /
* /
async _handleWatchAssetERC20 ( options ) {
async _handleWatchAssetERC20 ( options ) {
@ -716,7 +716,7 @@ class PreferencesController {
/ * *
/ * *
* Validates that the passed options for suggested token have all required properties .
* Validates that the passed options for suggested token have all required properties .
*
*
* @ param { Object } opts The options object to validate
* @ param { Object } opts - The options object to validate
* @ throws { string } Throw a custom error indicating that address , symbol and / or decimals
* @ throws { string } Throw a custom error indicating that address , symbol and / or decimals
* doesn ' t fulfill requirements
* doesn ' t fulfill requirements
*
*