aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers/preferences.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/scripts/controllers/preferences.js')
-rw-r--r--app/scripts/controllers/preferences.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/scripts/controllers/preferences.js b/app/scripts/controllers/preferences.js
index 2faf8220b..fa162c21f 100644
--- a/app/scripts/controllers/preferences.js
+++ b/app/scripts/controllers/preferences.js
@@ -19,6 +19,7 @@ class PreferencesController {
* @property {boolean} store.useBlockie The users preference for blockie identicons within the UI
* @property {object} store.featureFlags A key-boolean map, where keys refer to features and booleans to whether the
* user wishes to see that feature
+ * @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
*
@@ -36,6 +37,7 @@ class PreferencesController {
betaUI: true,
skipAnnounceBetaUI: true,
},
+ knownMethodData: {},
currentLocale: opts.initLangCode,
identities: {},
lostIdentities: {},
@@ -99,6 +101,18 @@ class PreferencesController {
}
/**
+ * Add new methodData to state, to avoid requesting this information again through Infura
+ *
+ * @param {string} fourBytePrefix Four-byte method signature
+ * @param {string} methodData Corresponding data method
+ */
+ addKnownMethodData (fourBytePrefix, methodData) {
+ const knownMethodData = this.store.getState().knownMethodData
+ knownMethodData[fourBytePrefix] = methodData
+ this.store.updateState({ knownMethodData })
+ }
+
+ /**
* RPC engine middleware for requesting new asset added
*
* @param req