const render = require('react-dom').render const h = require('react-hyperscript') const Root = require('./app/root') const actions = require('./app/actions') const configureStore = require('./app/store') const txHelper = require('./lib/tx-helper') const { fetchLocale } = require('./i18n-helper') const { OLD_UI_NETWORK_TYPE, BETA_UI_NETWORK_TYPE, } = require('../app/scripts/controllers/network/enums') const log = require('loglevel') module.exports = launchMetamaskUi log.setLevel(global.METAMASK_DEBUG ? 'debug' : 'warn') function launchMetamaskUi (opts, cb) { var accountManager = opts.accountManager actions._setBackgroundConnection(accountManager) // check if we are unlocked first accountManager.getState(function (err, metamaskState) { if (err) return cb(err) startApp(metamaskState, accountManager, opts) .then((store) => { cb(null, store) }) }) } async function startApp (metamaskState, accountManager, opts) { // parse opts if (!metamaskState.featureFlags) metamaskState.featureFlags = {} const currentLocaleMessages = metamaskState.currentLocale ? await fetchLocale(metamaskState.currentLocale) : {} const enLocaleMessages = await fetchLocale('en') const store = configureStore({ // metamaskState represents the cross-tab state metamask: metamaskState, // appState represents the current tab's popup state appState: {}, localeMessages: { current: currentLocaleMessages, en: enLocaleMessages, }, // Which blockchain we are using: networkVersion: opts.networkVersion, }) const useBetaUi = metamaskState.featureFlags.betaUI const networkEndpointType = useBetaUi ? BETA_UI_NETWORK_TYPE : OLD_UI_NETWORK_TYPE store.dispatch(actions.setNetworkEndpoints(networkEndpointType)) // if unconfirmed txs, start on txConf page const unapprovedTxsAll = txHelper(metamaskState.unapprovedTxs, metamaskState.unapprovedMsgs, metamaskState.unapprovedPersonalMsgs, metamaskState.unapprovedTypedMessages, metamaskState.network) const numberOfUnapprivedTx = unapprovedTxsAll.length if (numberOfUnapprivedTx > 0) { store.dispatch(actions.showConfTxPage({ id: unapprovedTxsAll[numberOfUnapprivedTx - 1].id, })) } accountManager.on('update', function (metamaskState) { store.dispatch(actions.updateMetamaskState(metamaskState)) }) // global metamask api - used by tooling global.metamask = { updateCurrentLocale: (code) => { store.dispatch(actions.updateCurrentLocale(code)) }, setProviderType: (type) => { store.dispatch(actions.setProviderType(type)) }, } // start app render( h(Root, { // inject initial state store: store, } ), opts.container) return store } ion value='2022Q4'>2022Q4 FreeBSD Ports (https://github.com/freebsd/freebsd-ports)
aboutsummaryrefslogtreecommitdiffstats
path: root/devel
Commit message (Expand)AuthorAgeFilesLines
* devel/binutils@aarch64: unbreak on powerpc64pkubaj2020-01-211-1/+0
* devel/hadoop2: patch to build with OpenSSL 1.1kbowling2020-01-212-9/+135
* devel/cgit: Update to 1.1.2meta2020-01-212-9/+9
* devel/py-subvertpy: fix build on GCC architecturespkubaj2020-01-211-1/+1
* devel/py-libzfs: fix build on GCC architecturespkubaj2020-01-211-6/+1
* Change my mail address to mikael@FreeBSD.orgmikael2020-01-211-1/+1
* Update to 44.0.0sunpoet2020-01-212-5/+4
* Update to 1.40sunpoet2020-01-212-4/+4
* Update to 1.14sunpoet2020-01-213-7/+7
* Update to 0.04sunpoet2020-01-213-7/+11
* Update to 11.1.0sunpoet2020-01-212-4/+4
* Update to 2.11.420sunpoet2020-01-212-4/+4
* Update to 2.11.420sunpoet2020-01-212-4/+4
* Update to 2.11.420sunpoet2020-01-212-4/+4
* Update to 1.266.0sunpoet2020-01-212-4/+4
* Update to 2.0.0sunpoet2020-01-212-7/+8
* Update RUN_DEPENDS for py-twine 3.1.1 updatesunpoet2020-01-211-2/+10
* Update to 0.9.23sunpoet2020-01-212-21/+12
* Update RUN_DEPENDS for py-cmd2 0.9.23 updatesunpoet2020-01-211-2/+8
* Update to 1.01sunpoet2020-01-212-6/+9
* Update to 3.5sunpoet2020-01-212-4/+4
* Add py-twine1 1.15.0 (copied from py-twine)sunpoet2020-01-214-0/+37
* Add py-immutables 0.11sunpoet2020-01-214-0/+37
* Add py-cmd208 0.8.9 (copied from py-cmd2)sunpoet2020-01-214-0/+51
* Update to 1.9.2joneum2020-01-212-4/+4
* devel/monodevelop: unexpire by updating libgit2 and recalculating the checksums.rene2020-01-205-173/+165
* - Update to 2.215lwhsu2020-01-202-4/+4
* Simplify port-specific manpages location after r523104jbeich2020-01-203-6/+6
* - Update to 1.18.0tota2020-01-202-4/+4
* Update to experimental-20200102antoine2020-01-202-4/+4
* Update to 20140808antoine2020-01-202-5/+4
* Drop python27 dependencyantoine2020-01-20