diff --git a/app/components/UI/AccountList/index.js b/app/components/UI/AccountList/index.js index 19bd4bf76f9..6ce81c61aac 100644 --- a/app/components/UI/AccountList/index.js +++ b/app/components/UI/AccountList/index.js @@ -284,7 +284,7 @@ class AccountList extends PureComponent { getAccounts() { const { accounts, identities, selectedAddress, keyrings, getBalanceError } = this.props; - // This is a temporary fix until we can read the state from GABA + // This is a temporary fix until we can read the state from @metamask/controllers const allKeyrings = keyrings && keyrings.length ? keyrings : Engine.context.KeyringController.state.keyrings; const accountsOrdered = allKeyrings.reduce((list, keyring) => list.concat(keyring.accounts), []); diff --git a/app/components/UI/PersonalSign/index.js b/app/components/UI/PersonalSign/index.js index 9f5edf03caf..de21763d0e4 100644 --- a/app/components/UI/PersonalSign/index.js +++ b/app/components/UI/PersonalSign/index.js @@ -5,7 +5,7 @@ import { colors, fontStyles } from '../../../styles/common'; import Engine from '../../../core/Engine'; import SignatureRequest from '../SignatureRequest'; import ExpandedMessage from '../SignatureRequest/ExpandedMessage'; -import { util } from 'gaba'; +import { util } from '@metamask/controllers'; const styles = StyleSheet.create({ messageText: { diff --git a/app/components/UI/Transactions/index.js b/app/components/UI/Transactions/index.js index e03d52551b9..688f090c2fb 100644 --- a/app/components/UI/Transactions/index.js +++ b/app/components/UI/Transactions/index.js @@ -18,14 +18,14 @@ import TransactionElement from '../TransactionElement'; import Engine from '../../../core/Engine'; import { showAlert } from '../../../actions/alert'; import TransactionsNotificationManager from '../../../core/TransactionsNotificationManager'; -import { CANCEL_RATE, SPEED_UP_RATE } from 'gaba'; +import { CANCEL_RATE, SPEED_UP_RATE, util } from '@metamask/controllers'; import { renderFromWei } from '../../../util/number'; import { safeToChecksumAddress } from '../../../util/address'; import Device from '../../../util/Device'; -import { hexToBN } from 'gaba/dist/util'; import { BN } from 'ethereumjs-util'; import TransactionActionModal from '../TransactionActionModal'; +const { hexToBN } = util; const styles = StyleSheet.create({ wrapper: { backgroundColor: colors.white, diff --git a/app/components/UI/TxNotification/index.js b/app/components/UI/TxNotification/index.js index eb46b81e613..d681a4b5af7 100644 --- a/app/components/UI/TxNotification/index.js +++ b/app/components/UI/TxNotification/index.js @@ -12,14 +12,14 @@ import Device from '../../../util/Device'; import Animated, { Easing } from 'react-native-reanimated'; import ElevatedView from 'react-native-elevated-view'; import { strings } from '../../../../locales/i18n'; -import { CANCEL_RATE, SPEED_UP_RATE, BN } from 'gaba'; +import { CANCEL_RATE, SPEED_UP_RATE, BN, util } from '@metamask/controllers'; import ActionContent from '../ActionModal/ActionContent'; import TransactionActionContent from '../TransactionActionModal/TransactionActionContent'; import { renderFromWei } from '../../../util/number'; import Engine from '../../../core/Engine'; import { safeToChecksumAddress } from '../../../util/address'; -import { hexToBN } from 'gaba/dist/util'; +const { hexToBN } = util; const BROWSER_ROUTE = 'BrowserView'; const styles = StyleSheet.create({ diff --git a/app/components/Views/ApproveView/Approve/index.js b/app/components/Views/ApproveView/Approve/index.js index b82d216e43a..a21ded42b1f 100644 --- a/app/components/Views/ApproveView/Approve/index.js +++ b/app/components/Views/ApproveView/Approve/index.js @@ -27,7 +27,7 @@ import CustomGas from '../../SendFlow/CustomGas'; import ActionModal from '../../../UI/ActionModal'; import { strings } from '../../../../../locales/i18n'; import { setTransactionObject } from '../../../../actions/transaction'; -import { BNToHex, hexToBN } from 'gaba/dist/util'; +import { util } from '@metamask/controllers'; import { renderFromWei, weiToFiatNumber, isBN, renderFromTokenMinimalUnit, isDecimal } from '../../../../util/number'; import { getTicker, @@ -44,6 +44,7 @@ import Identicon from '../../../UI/Identicon'; import Analytics from '../../../../core/Analytics'; import { ANALYTICS_EVENT_OPTS } from '../../../../util/analytics'; +const { BNToHex, hexToBN } = util; const styles = StyleSheet.create({ wrapper: { backgroundColor: colors.white, diff --git a/app/components/Views/ApproveView/Approve/index.test.js b/app/components/Views/ApproveView/Approve/index.test.js index 6e01818738d..23d47208c90 100644 --- a/app/components/Views/ApproveView/Approve/index.test.js +++ b/app/components/Views/ApproveView/Approve/index.test.js @@ -2,7 +2,7 @@ import React from 'react'; import { shallow } from 'enzyme'; import Approve from './'; import configureMockStore from 'redux-mock-store'; -import { BN } from 'gaba'; +import { BN } from '@metamask/controllers'; const mockStore = configureMockStore(); diff --git a/app/components/Views/SendFlow/Amount/index.js b/app/components/Views/SendFlow/Amount/index.js index 645bcb4c925..0dd41e20259 100644 --- a/app/components/Views/SendFlow/Amount/index.js +++ b/app/components/Views/SendFlow/Amount/index.js @@ -39,7 +39,7 @@ import { handleWeiNumber } from '../../../../util/number'; import { getTicker, generateTransferData, getEther } from '../../../../util/transactions'; -import { hexToBN, BNToHex } from 'gaba/dist/util'; +import { util } from '@metamask/controllers'; import FadeIn from 'react-native-fade-in-image'; import ErrorMessage from '../ErrorMessage'; import { fetchBasicGasEstimates, apiEstimateModifiedToWEI } from '../../../../util/custom-gas'; @@ -53,6 +53,8 @@ import { BN } from 'ethereumjs-util'; import Analytics from '../../../../core/Analytics'; import { ANALYTICS_EVENT_OPTS } from '../../../../util/analytics'; +const { hexToBN, BNToHex } = util; + const KEYBOARD_OFFSET = Device.isSmallDevice() ? 80 : 120; const ethLogo = require('../../../../images/eth-logo.png'); // eslint-disable-line diff --git a/app/components/Views/SendFlow/Confirm/index.js b/app/components/Views/SendFlow/Confirm/index.js index 44b5b863a1d..7f02181cc8e 100644 --- a/app/components/Views/SendFlow/Confirm/index.js +++ b/app/components/Views/SendFlow/Confirm/index.js @@ -29,7 +29,7 @@ import { } from '../../../../util/number'; import { getTicker, decodeTransferData } from '../../../../util/transactions'; import StyledButton from '../../../UI/StyledButton'; -import { hexToBN, BNToHex } from 'gaba/dist/util'; +import { util } from '@metamask/controllers'; import { prepareTransaction, resetTransaction } from '../../../../actions/transaction'; import { fetchBasicGasEstimates, convertApiValueToGWEI } from '../../../../util/custom-gas'; import Engine from '../../../../core/Engine'; @@ -51,6 +51,7 @@ import TransactionSummary from '../../TransactionSummary'; import Analytics from '../../../../core/Analytics'; import { ANALYTICS_EVENT_OPTS } from '../../../../util/analytics'; +const { hexToBN, BNToHex } = util; const { CUSTOM_GAS: { AVERAGE_GAS, FAST_GAS, LOW_GAS } } = TransactionTypes; diff --git a/app/components/Views/SendFlow/SendTo/index.js b/app/components/Views/SendFlow/SendTo/index.js index d979daa2d7a..f6619d7554d 100644 --- a/app/components/Views/SendFlow/SendTo/index.js +++ b/app/components/Views/SendFlow/SendTo/index.js @@ -20,10 +20,11 @@ import { getTicker, getEther } from '../../../../util/transactions'; import ErrorMessage from '../ErrorMessage'; import { strings } from '../../../../../locales/i18n'; import WarningMessage from '../WarningMessage'; -import { hexToBN } from 'gaba/dist/util'; +import { util } from '@metamask/controllers'; import Analytics from '../../../../core/Analytics'; import { ANALYTICS_EVENT_OPTS } from '../../../../util/analytics'; +const { hexToBN } = util; const styles = StyleSheet.create({ wrapper: { flex: 1, diff --git a/app/core/Engine.js b/app/core/Engine.js index caeb398a474..155d2b576a0 100644 --- a/app/core/Engine.js +++ b/app/core/Engine.js @@ -17,7 +17,7 @@ import { TokenRatesController, TransactionController, TypedMessageManager -} from 'gaba'; +} from '@metamask/controllers'; import AsyncStorage from '@react-native-community/async-storage'; @@ -34,7 +34,7 @@ const OPENSEA_API_KEY = process.env['MM_OPENSEA_KEY']; // eslint-disable-line do const encryptor = new Encryptor(); let refreshing = false; /** - * Core controller responsible for composing other GABA controllers together + * Core controller responsible for composing other metamask controllers together * and exposing convenience methods for common wallet operations. */ class Engine { diff --git a/app/store/index.js b/app/store/index.js index e6ae998e0ff..eca5db36bb7 100644 --- a/app/store/index.js +++ b/app/store/index.js @@ -6,7 +6,7 @@ import rootReducer from '../reducers'; import AppConstants from '../core/AppConstants'; const migrations = { - // Needed after https://github.com/MetaMask/gaba/pull/152 + // Needed after https://github.com/MetaMask/controllers/pull/152 0: state => { const addressBook = state.engine.backgroundState.AddressBookController.addressBook; const migratedAddressBook = {}; diff --git a/app/util/number.js b/app/util/number.js index 0ed9341e5c0..3ddc60c5763 100644 --- a/app/util/number.js +++ b/app/util/number.js @@ -3,7 +3,7 @@ */ import { BN } from 'ethereumjs-util'; import convert from 'ethjs-unit'; -import { util } from 'gaba'; +import { util } from '@metamask/controllers'; import numberToBN from 'number-to-bn'; import currencySymbols from '../util/currency-symbols.json'; diff --git a/app/util/transactions.js b/app/util/transactions.js index 2dcc7fd9da3..5c4ea2a8564 100644 --- a/app/util/transactions.js +++ b/app/util/transactions.js @@ -4,7 +4,7 @@ import Engine from '../core/Engine'; import { strings } from '../../locales/i18n'; import contractMap from 'eth-contract-metadata'; import { safeToChecksumAddress } from './address'; -import { util } from 'gaba'; +import { util } from '@metamask/controllers'; export const TOKEN_METHOD_TRANSFER = 'transfer'; export const TOKEN_METHOD_APPROVE = 'approve'; diff --git a/package.json b/package.json index b3e47ee6b68..b291099b140 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,7 @@ "react-native-level-fs/**/bl": "^0.9.5" }, "dependencies": { + "@metamask/controllers": "^2.0.0", "@react-native-community/async-storage": "1.9.0", "@react-native-community/clipboard": "^1.2.2", "@react-native-community/netinfo": "4.1.5", @@ -96,7 +97,6 @@ "ethjs-unit": "0.1.6", "events": "3.0.0", "fuse.js": "3.4.4", - "gaba": "1.11.0", "https-browserify": "0.0.1", "json-rpc-engine": "5.1.5", "json-rpc-middleware-stream": "2.1.1", diff --git a/yarn.lock b/yarn.lock index 870b8e723df..00cd174a50e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1348,6 +1348,34 @@ "@types/yargs" "^15.0.0" chalk "^3.0.0" +"@metamask/controllers@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@metamask/controllers/-/controllers-2.0.0.tgz#e57762c213d2722fd178d4c5c288ad98a2ee8bdf" + integrity sha512-J2DSoyyPRAilTdohl43O5tZdqOSMvB94Kx1ApRpkPZxQwtDUIzWHRpTXptyCEwkhaOdkNz9BvWMoaRQxjktfKw== + dependencies: + await-semaphore "^0.1.3" + eth-contract-metadata "^1.11.0" + eth-ens-namehash "^2.0.8" + eth-json-rpc-errors "^2.0.2" + eth-json-rpc-infura "^4.0.1" + eth-keyring-controller "^5.6.1" + eth-method-registry "1.1.0" + eth-phishing-detect "^1.1.13" + eth-query "^2.1.2" + eth-sig-util "^2.3.0" + ethereumjs-util "^6.1.0" + ethereumjs-wallet "0.6.0" + ethjs-query "^0.3.8" + human-standard-collectible-abi "^1.0.2" + human-standard-token-abi "^2.0.0" + isomorphic-fetch "^2.2.1" + jsonschema "^1.2.4" + percentile "^1.2.1" + single-call-balance-checker-abi "^1.0.0" + uuid "^3.3.2" + web3 "^0.20.7" + web3-provider-engine "^15.0.4" + "@metamask/mobile-provider@^1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@metamask/mobile-provider/-/mobile-provider-1.2.0.tgz#d28f58f213ca364c9a732b867eef74301542699a" @@ -4714,14 +4742,14 @@ eth-ens-namehash@^1.0.2: idna-uts46 "^1.0.1" js-sha3 "^0.5.7" -eth-hd-keyring@^3.4.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/eth-hd-keyring/-/eth-hd-keyring-3.4.0.tgz#288e73041f2b3f047b4151fb4b5ab5ad5710b9a6" - integrity sha512-MMKSSwDWuEfItEM/826LHrs2HVjy57qQQfcgSxIYOCJY0vykw++LH8d6QJOBrGFe+xu/gtbHBRMURrFGdqfevw== +eth-hd-keyring@^3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/eth-hd-keyring/-/eth-hd-keyring-3.5.0.tgz#3976d83a27b24305481c389178f290d9264e839d" + integrity sha512-Ix1LcWYxHMxCCSIMz+TLXLtt50zF6ZDd/TRVXthdw91IwOk1ajuf7QHg3bCDcfeUpdf9oEpwIPbL3xjDqEEjYw== dependencies: bip39 "^2.2.0" eth-sig-util "^2.4.4" - eth-simple-keyring "^3.4.0" + eth-simple-keyring "^3.5.0" ethereumjs-abi "^0.6.5" ethereumjs-util "^5.1.1" ethereumjs-wallet "^0.6.0" @@ -4802,17 +4830,17 @@ eth-json-rpc-middleware@4.3.0, eth-json-rpc-middleware@^4.0.0, eth-json-rpc-midd pify "^3.0.0" safe-event-emitter "^1.0.1" -eth-keyring-controller@^5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/eth-keyring-controller/-/eth-keyring-controller-5.3.0.tgz#8d85a67b894360ab7d601222ca71df8ed5f456c6" - integrity sha512-aoqYjKUbdOSgS1s63IsTp69QAMtLPTCqR4VAbCULps71o3yuaA9JRx2W+GAxqVNBtIdyZllxoOJlvErkO4iWNw== +eth-keyring-controller@^5.6.1: + version "5.6.1" + resolved "https://registry.yarnpkg.com/eth-keyring-controller/-/eth-keyring-controller-5.6.1.tgz#7b7268400704c8f5ce98a055910341177dd207ca" + integrity sha512-sxJ87bJg7PvvPzj1sY1jJYHQL1HVUhh84Q/a4QPrcnzAAng1yibvvUfww0pCez4XJfHuMkJvUxfF8eAusJM8fQ== dependencies: bip39 "^2.4.0" bluebird "^3.5.0" browser-passworder "^2.0.3" - eth-hd-keyring "^3.4.0" + eth-hd-keyring "^3.5.0" eth-sig-util "^1.4.0" - eth-simple-keyring "^3.4.0" + eth-simple-keyring "^3.5.0" ethereumjs-util "^5.1.2" loglevel "^1.5.0" obs-store "^4.0.3" @@ -4859,10 +4887,10 @@ eth-sig-util@^2.3.0, eth-sig-util@^2.4.4, eth-sig-util@^2.5.0: tweetnacl "^1.0.0" tweetnacl-util "^0.15.0" -eth-simple-keyring@^3.4.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/eth-simple-keyring/-/eth-simple-keyring-3.4.0.tgz#01464234b070af42a343a3c451dd58b00ae1a042" - integrity sha512-g/ObWqWaTHikrhhm7fNinpkkpEPqBRz02oBXcH81mc3VFkOLb3pjfvNg1Da6Jh+A4wA0kBE4vkiiG7BUwF1zNg== +eth-simple-keyring@^3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/eth-simple-keyring/-/eth-simple-keyring-3.5.0.tgz#c7fa285ca58d31ef44bc7db678b689f9ffd7b453" + integrity sha512-z9IPt9aoMWAw5Zc3Jk/HKbWPJNc7ivZ5ECNtl3ZoQUGRnwoWO71W5+liVPJtXFNacGOOGsBfqTqrXL9C4EnYYQ== dependencies: eth-sig-util "^2.5.0" ethereumjs-abi "^0.6.5" @@ -5877,34 +5905,6 @@ g-status@^2.0.2: matcher "^1.0.0" simple-git "^1.85.0" -gaba@1.11.0: - version "1.11.0" - resolved "https://registry.yarnpkg.com/gaba/-/gaba-1.11.0.tgz#7ff49cad2f2b95941222121a1984bb63783fe076" - integrity sha512-rQcLgR/FHQ8W6oNza/vxFnkbav0vgauBxm6LKqK6BkbjJGB979qoBRVja9fU/H5dUMiYmHJO9CrHjL0ofG/ukA== - dependencies: - await-semaphore "^0.1.3" - eth-contract-metadata "^1.11.0" - eth-ens-namehash "^2.0.8" - eth-json-rpc-errors "^2.0.2" - eth-json-rpc-infura "^4.0.1" - eth-keyring-controller "^5.3.0" - eth-method-registry "1.1.0" - eth-phishing-detect "^1.1.13" - eth-query "^2.1.2" - eth-sig-util "^2.3.0" - ethereumjs-util "^6.1.0" - ethereumjs-wallet "0.6.0" - ethjs-query "^0.3.8" - human-standard-collectible-abi "^1.0.2" - human-standard-token-abi "^2.0.0" - isomorphic-fetch "^2.2.1" - jsonschema "^1.2.4" - percentile "^1.2.1" - single-call-balance-checker-abi "^1.0.0" - uuid "^3.3.2" - web3 "^0.20.7" - web3-provider-engine "^15.0.4" - gauge@~2.7.3: version "2.7.4" resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7"