1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 03:12:42 +02:00
This commit is contained in:
Whymarrh Whitby 2020-07-20 14:32:49 -02:30 committed by GitHub
parent 7cd609b86b
commit 2ae4720443
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 47 additions and 48 deletions

View File

@ -25,8 +25,7 @@ export default class DetectTokensController {
}
/**
* For each token in eth-contract-metada, find check selectedAddress balance.
*
* For each token in eth-contract-metadata, find check selectedAddress balance.
*/
async detectNewTokens () {
if (!this.isActive) {

View File

@ -31,7 +31,7 @@ txMeta = {
"time": 1524094064821, // time of creation
"status": "confirmed",
"metamaskNetworkId": "1524091532133", //the network id for the transaction
"loadingDefaults": false, // used to tell the ui when we are done calculatyig gass defaults
"loadingDefaults": false, // used to tell the ui when we are done calculating gas defaults
"txParams": { // the txParams object
"from": "0x8acce2391c0d510a6c5e5d8f819a678f79b7e675",
"to": "0x8acce2391c0d510a6c5e5d8f819a678f79b7e675",

View File

@ -23,7 +23,7 @@ export function migrateFromSnapshotsToDiffs (longHistory) {
Generates an array of history objects sense the previous state.
The object has the keys
op (the operation performed),
path (the key and if a nested object then each key will be seperated with a `/`)
path (the key and if a nested object then each key will be separated with a `/`)
value
with the first entry having the note and a timestamp when the change took place
@param {Object} previousState - the previous state of the object

View File

@ -7,7 +7,7 @@ import log from 'loglevel'
* debug information for a failed analysis.
* @typedef {Object} GasAnalysisResult
* @property {string} blockGasLimit - The gas limit of the block used for the analysis
* @property {string} estimatedGasHex - The estimated gas, in hexidecimal
* @property {string} estimatedGasHex - The estimated gas, in hexadecimal
* @property {Object} simulationFails - Debug information about why an analysis failed
*/

View File

@ -100,7 +100,7 @@ export default class TransactionStateManager extends EventEmitter {
}
/**
@returns {array} - the tx list whos status is unapproved
@returns {array} - the tx list whose status is unapproved
*/
getUnapprovedTxList () {
const txList = this.getTxsByMetaData('status', 'unapproved')
@ -112,7 +112,7 @@ export default class TransactionStateManager extends EventEmitter {
/**
@param [address] {string} - hex prefixed address to sort the txMetas for [optional]
@returns {array} - the tx list whos status is approved if no address is provide
@returns {array} - the tx list whose status is approved if no address is provide
returns all txMetas who's status is approved for the current network
*/
getApprovedTransactions (address) {
@ -125,7 +125,7 @@ export default class TransactionStateManager extends EventEmitter {
/**
@param [address] {string} - hex prefixed address to sort the txMetas for [optional]
@returns {array} - the tx list whos status is submitted if no address is provide
@returns {array} - the tx list whose status is submitted if no address is provide
returns all txMetas who's status is submitted for the current network
*/
getPendingTransactions (address) {
@ -138,7 +138,7 @@ export default class TransactionStateManager extends EventEmitter {
/**
@param [address] {string} - hex prefixed address to sort the txMetas for [optional]
@returns {array} - the tx list whos status is confirmed if no address is provide
@returns {array} - the tx list whose status is confirmed if no address is provide
returns all txMetas who's status is confirmed for the current network
*/
getConfirmedTransactions (address) {
@ -153,7 +153,7 @@ export default class TransactionStateManager extends EventEmitter {
Adds the txMeta to the list of transactions in the store.
if the list is over txHistoryLimit it will remove a transaction that
is in its final state
it will allso add the key `history` to the txMeta with the snap shot of the original
it will also add the key `history` to the txMeta with the snap shot of the original
object
@param {Object} txMeta
@returns {Object} - the txMeta

View File

@ -9,7 +9,7 @@ class AsyncWritableStream extends WritableStream {
this._asyncWriteFn = asyncWriteFn
}
// write from incomming stream to state
// write from incoming stream to state
_write (chunk, encoding, callback) {
promiseToCallback(this._asyncWriteFn(chunk, encoding))(callback)
}

View File

@ -30,9 +30,9 @@ export default class DecryptMessageManager extends EventEmitter {
* Controller in charge of managing - storing, adding, removing, updating - DecryptMessage.
*
* @typedef {Object} DecryptMessageManager
* @property {Object} memStore The observable store where DecryptMessage are saved with persistance.
* @property {Object} memStore The observable store where DecryptMessage are saved.
* @property {Object} memStore.unapprovedDecryptMsgs A collection of all DecryptMessages in the 'unapproved' state
* @property {number} memStore.unapprovedDecryptMsgCount The count of all DecryptMessages in this.memStore.unapprobedMsgs
* @property {number} memStore.unapprovedDecryptMsgCount The count of all DecryptMessages in this.memStore.unapprovedDecryptMsgs
* @property {array} messages Holds all messages that have been created by this DecryptMessageManager
*
*/

View File

@ -32,7 +32,7 @@ export default class MessageManager extends EventEmitter {
* @param {Object} opts @deprecated
* @property {Object} memStore The observable store where Messages are saved.
* @property {Object} memStore.unapprovedMsgs A collection of all Messages in the 'unapproved' state
* @property {number} memStore.unapprovedMsgCount The count of all Messages in this.memStore.unapprobedMsgs
* @property {number} memStore.unapprovedMsgCount The count of all Messages in this.memStore.unapprovedMsgs
* @property {array} messages Holds all messages that have been created by this MessageManager
*
*/
@ -99,7 +99,7 @@ export default class MessageManager extends EventEmitter {
* new Message to this.messages, and to save the unapproved Messages from that list to this.memStore.
*
* @param {Object} msgParams - The params for the eth_sign call to be made after the message is approved.
* @param {Object} req (optional) The original request object where the origin may be specificied
* @param {Object} req (optional) The original request object where the origin may be specified
* @returns {number} - The id of the newly created message.
*
*/

View File

@ -68,7 +68,7 @@ export default class NotificationManager {
* type 'popup')
*
* @private
* @param {Function} cb - A node style callback that to whcih the found notification window will be passed.
* @param {Function} cb - A node style callback that to which the found notification window will be passed.
*
*/
async _getPopup () {

View File

@ -33,7 +33,7 @@ export default class PersonalMessageManager extends EventEmitter {
*
* @typedef {Object} PersonalMessageManager
* @param {Object} opts @deprecated
* @property {Object} memStore The observable store where PersonalMessage are saved with persistance.
* @property {Object} memStore The observable store where PersonalMessage are saved.
* @property {Object} memStore.unapprovedPersonalMsgs A collection of all PersonalMessages in the 'unapproved' state
* @property {number} memStore.unapprovedPersonalMsgCount The count of all PersonalMessages in this.memStore.unapprobedMsgs
* @property {array} messages Holds all messages that have been created by this PersonalMessageManager

View File

@ -134,7 +134,7 @@ function BnMultiplyByFraction (targetBN, numerator, denominator) {
/**
* Returns an Error if extension.runtime.lastError is present
* this is a workaround for the non-standard error object thats used
* this is a workaround for the non-standard error object that's used
* @returns {Error}
*/
function checkForError () {

View File

@ -1199,7 +1199,7 @@ export default class MetamaskController extends EventEmitter {
}
/**
* Only decypt message and don't touch transaction state
* Only decrypt message and don't touch transaction state
*
* @param {Object} msgParams - The params of the message to decrypt.
* @returns {Promise<Object>} - A full state update.

View File

@ -15,7 +15,7 @@ const SYMBOLS = {
Quarter: '▎',
Eighth: '▏',
RightHalf: '▐',
RightEigth: '▕',
RightEighth: '▕',
}
function setupTaskDisplay (taskEvents) {
@ -141,7 +141,7 @@ function getSymbolNormalRight (value) {
} else if (rounded === 1 / 2) {
return SYMBOLS.RightHalf
} else if (rounded === 7 / 8) {
return SYMBOLS.RightEigth
return SYMBOLS.RightEighth
} else if (rounded === 1) {
return SYMBOLS.Space
} else {

View File

@ -22,6 +22,7 @@ _int () {
trap _term SIGTERM
trap _int SIGINT
# shellcheck disable=SC2086
$ganache_cli --noVMErrorsOnRPCResponse --networkId 5777 --mnemonic "$seed_phrase" ${GANACHE_ARGS:-} &
child=$!

View File

@ -10,5 +10,5 @@ You can optionally enable debugging, and click `Debug`, for a console window tha
If you have problems debugging, try connecting to the IRC channel `#webextensions` on `irc.mozilla.org`.
For longer questions, use the StackOverfow tag `firefox-addons`.
For longer questions, use the StackOverflow tag `firefox-addons`.

View File

@ -43,7 +43,7 @@ const standardDeviationResult = calculateResult((array) => {
const squareDiffs = array.map((value) => Math.pow(value - average, 2))
return Math.sqrt(calculateAverage(squareDiffs))
})
// 95% margin of error calculated using Student's t-distrbution
// 95% margin of error calculated using Student's t-distribution
const calculateMarginOfError = (array) => ttest(array).confidence()[1] - calculateAverage(array)
const marginOfErrorResult = calculateResult((array) => calculateMarginOfError(array))

View File

@ -1111,7 +1111,7 @@ describe('MetaMask', function () {
})
})
describe('Tranfers a custom token from dapp when no gas value is specified', function () {
describe('Transfers a custom token from dapp when no gas value is specified', function () {
it('transfers an already created token, without specifying gas', async function () {
const windowHandles = await driver.getAllWindowHandles()
const extension = windowHandles[0]

View File

@ -51,7 +51,7 @@ describe('MetaMask', function () {
await driver.quit()
})
describe('successfuly signs typed data', function () {
describe('successfully signs typed data', function () {
let extension
let popup
let dapp

View File

@ -89,8 +89,8 @@ describe('DetectTokensController', function () {
controller.isOpen = true
controller.isUnlocked = true
const contractAddressses = Object.keys(contracts)
const erc20ContractAddresses = contractAddressses
const contractAddresses = Object.keys(contracts)
const erc20ContractAddresses = contractAddresses
.filter((contractAddress) => contracts[contractAddress].erc20 === true)
const existingTokenAddress = erc20ContractAddresses[0]
@ -100,7 +100,7 @@ describe('DetectTokensController', function () {
const tokenAddressToAdd = erc20ContractAddresses[1]
const tokenToAdd = contracts[tokenAddressToAdd]
const contractAddresssesToDetect = contractAddressses
const contractAddresssesToDetect = contractAddresses
.filter((address) => address !== existingTokenAddress)
const indexOfTokenToAdd = contractAddresssesToDetect.indexOf(tokenAddressToAdd)

View File

@ -361,7 +361,7 @@ describe('TransactionStateManager', function () {
}
const result = txStateManager.getTxList()
assert.equal(result.length, limit, `limit of ${limit} txs enforced`)
assert.equal(result[0].id, 1, 'early txs truncted')
assert.equal(result[0].id, 1, 'early txs truncated')
})
it('cuts off early txs beyond a limit whether or not it is confirmed or rejected', function () {
@ -372,7 +372,7 @@ describe('TransactionStateManager', function () {
}
const result = txStateManager.getTxList()
assert.equal(result.length, limit, `limit of ${limit} txs enforced`)
assert.equal(result[0].id, 1, 'early txs truncted')
assert.equal(result[0].id, 1, 'early txs truncated')
})
it('cuts off early txs beyond a limit but does not cut unapproved txs', function () {
@ -387,7 +387,7 @@ describe('TransactionStateManager', function () {
assert.equal(result.length, limit, `limit of ${limit} txs enforced`)
assert.equal(result[0].id, 0, 'first tx should still be there')
assert.equal(result[0].status, 'unapproved', 'first tx should be unapproved')
assert.equal(result[1].id, 2, 'early txs truncted')
assert.equal(result[1].id, 2, 'early txs truncated')
})
})

View File

@ -68,31 +68,31 @@ describe('storage is migrated successfully and the proper transactions are remov
leftoverNonDeletableTxCount++
}
})
assert.equal(leftoverNonDeletableTxCount, nonDeletableCount, 'migration shouldnt delete transactions we want to keep')
assert.equal(leftoverNonDeletableTxCount, nonDeletableCount, "migration shouldn't delete transactions we want to keep")
assert((migratedTransactions.length >= 40), `should be equal or greater to 40 if they are non deletable states got ${migratedTransactions.length} transactions`)
done()
}).catch(done)
})
it('should not remove any transactions because 40 is the expectable limit', function (done) {
it('should not remove any transactions because 40 is the expected limit', function (done) {
storage.meta.version = 22
storage.data.TransactionController.transactions = transactions40
migration23.migrate(storage)
.then((migratedData) => {
const migratedTransactions = migratedData.data.TransactionController.transactions
assert.equal(migratedTransactions.length, 40, 'migration shouldnt delete when at limit')
assert.equal(migratedTransactions.length, 40, "migration shouldn't delete when at limit")
done()
}).catch(done)
})
it('should not remove any transactions because 20 txs is under the expectable limit', function (done) {
it('should not remove any transactions because 20 txs is under the expected limit', function (done) {
storage.meta.version = 22
storage.data.TransactionController.transactions = transactions20
migration23.migrate(storage)
.then((migratedData) => {
const migratedTransactions = migratedData.data.TransactionController.transactions
assert.equal(migratedTransactions.length, 20, 'migration shouldnt delete when under limit')
assert.equal(migratedTransactions.length, 20, "migration shouldn't delete when under limit")
done()
}).catch(done)
})

View File

@ -12,7 +12,6 @@ describe('MetaMask Reducers', function () {
it('locks MetaMask', function () {
const unlockMetaMaskState = {
isUnlocked: true,
isInitialzed: false,
selectedAddress: 'test address',
}
const lockMetaMask = reduceMetamask(unlockMetaMaskState, {

View File

@ -74,7 +74,7 @@ describe('Advanced Gas Inputs', function () {
assert.equal(props.updateCustomGasLimit.calledWith(21000), true)
})
it('errors when insuffientBalance under gas price and gas limit', function () {
it('errors when insufficientBalance under gas price and gas limit', function () {
wrapper.setProps({ insufficientBalance: true })
const renderError = wrapper.find('.advanced-gas-inputs__gas-edit-row__error-text')
assert.equal(renderError.length, 2)

View File

@ -33,7 +33,7 @@ describe('Confirm Reset Account', function () {
assert(props.hideModal.calledOnce)
})
it('resets account and hidels modal when reset button is clicked', function (done) {
it('resets account and hides modal when reset button is clicked', function (done) {
const reset = wrapper.find('.btn-danger.modal-container__footer-button')
reset.simulate('click')

View File

@ -3,7 +3,7 @@ import { combineTransactionHistories, getActivities } from '../transaction-activ
describe('TransactionActivityLog utils', function () {
describe('combineTransactionHistories', function () {
it('should return no activites for an empty list of transactions', function () {
it('should return no activities for an empty list of transactions', function () {
assert.deepEqual(combineTransactionHistories([]), [])
})

View File

@ -171,7 +171,7 @@ export function getActivities (transaction, isFirstTransaction = false) {
return acc
}, [])
// If txReceipt.status is '0x0', that means that an on-chain error occured for the transaction,
// If txReceipt.status is '0x0', that means that an on-chain error occurred for the transaction,
// so we add an error entry to the Activity Log.
return status === '0x0'
? historyActivities.concat({ id, hash, eventKey: TRANSACTION_ERRORED_EVENT })

View File

@ -27,7 +27,7 @@ describe('UnitInput Component', function () {
assert.equal(wrapper.find('.unit-input__suffix').text(), 'ETH')
})
it('should render properly with a child omponent', function () {
it('should render properly with a child component', function () {
const wrapper = shallow(
<UnitInput>
<div className="testing">

View File

@ -21,7 +21,7 @@ describe('useCancelTransaction', function () {
dispatch.resetHistory()
})
describe('when account has insufficent balance to cover gas', function () {
describe('when account has insufficient balance to cover gas', function () {
before(function () {
useSelector = sinon.stub(reactRedux, 'useSelector')
useSelector.callsFake((selector) => {

View File

@ -18,7 +18,7 @@ const returnToOnboardingInitiatorTab = async (onboardingInitiator) => {
if (!tab) {
// this case can happen if the tab was closed since being checked with `extension.tabs.get`
log.warn(`Setting current tab to onboarding initator has failed; falling back to redirect`)
log.warn(`Setting current tab to onboarding initiator has failed; falling back to redirect`)
window.location.assign(onboardingInitiator.location)
} else {
window.close()

View File

@ -56,7 +56,7 @@ describe('SendHeader Component', function () {
})
describe('render', function () {
it('should render a PageContainerHeader compenent', function () {
it('should render a PageContainerHeader component', function () {
assert.equal(wrapper.find(PageContainerHeader).length, 1)
})

View File

@ -198,7 +198,7 @@ describe('send utils', function () {
})
describe('calcTokenBalance()', function () {
it('should return the calculated token blance', function () {
it('should return the calculated token balance', function () {
assert.equal(calcTokenBalance({
sendToken: {
address: '0x0',

View File

@ -76,7 +76,7 @@ export default class UnlockPage extends Component {
eventOpts: {
category: 'Navigation',
action: 'Unlock',
name: 'Incorrect Passowrd',
name: 'Incorrect Password',
},
customVariables: {
numberOfTokens: newState.tokens.length,

View File

@ -61,7 +61,7 @@ describe('Confirm Transaction Selector', function () {
},
}
it('returns calulcated token amount based on token value and token decimals and recipient address', function () {
it('returns calculated token amount based on token value and token decimals and recipient address', function () {
assert.deepEqual(tokenAmountAndToAddressSelector(state),
{ toAddress: '0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc', tokenAmount: 0.01 })
})