From 3a9898c29fdd22255b48b929ca476879abbc96fd Mon Sep 17 00:00:00 2001 From: apanizo Date: Thu, 27 Sep 2018 16:17:55 +0200 Subject: [PATCH] Generating nonce from safe --- src/routes/safe/component/AddOwner/index.jsx | 3 +-- src/routes/safe/component/RemoveOwner/index.jsx | 3 +-- src/test/safe.redux.transactions.test.js | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/routes/safe/component/AddOwner/index.jsx b/src/routes/safe/component/AddOwner/index.jsx index 69e0381b..15d1e18f 100644 --- a/src/routes/safe/component/AddOwner/index.jsx +++ b/src/routes/safe/component/AddOwner/index.jsx @@ -7,7 +7,6 @@ import { type Safe } from '~/routes/safe/store/model/safe' import { type Owner, makeOwner } from '~/routes/safe/store/model/owner' import { setOwners } from '~/utils/localStorage' import { getSafeEthereumInstance, createTransaction } from '~/logic/safe/safeFrontendOperations' -import { signaturesViaMetamask } from '~/config' import AddOwnerForm, { NAME_PARAM, OWNER_ADDRESS_PARAM, INCREASE_PARAM } from './AddOwnerForm' import Review from './Review' import selector, { type SelectorProps } from './selector' @@ -39,7 +38,7 @@ const getOwnerAddressesFrom = (owners: List) => { export const addOwner = async (values: Object, safe: Safe, threshold: number, executor: string) => { const safeAddress = safe.get('address') const gnosisSafe = await getSafeEthereumInstance(safeAddress) - const nonce = signaturesViaMetamask() ? await gnosisSafe.nonce() : Date.now() + const nonce = await gnosisSafe.nonce() const newThreshold = values[INCREASE_PARAM] ? threshold + 1 : threshold const newOwnerAddress = values[OWNER_ADDRESS_PARAM] diff --git a/src/routes/safe/component/RemoveOwner/index.jsx b/src/routes/safe/component/RemoveOwner/index.jsx index 92157ddb..87bb48a0 100644 --- a/src/routes/safe/component/RemoveOwner/index.jsx +++ b/src/routes/safe/component/RemoveOwner/index.jsx @@ -4,7 +4,6 @@ import Stepper from '~/components/Stepper' import { connect } from 'react-redux' import { type Safe } from '~/routes/safe/store/model/safe' import { getSafeEthereumInstance, createTransaction } from '~/logic/safe/safeFrontendOperations' -import { signaturesViaMetamask } from '~/config' import RemoveOwnerForm, { DECREASE_PARAM } from './RemoveOwnerForm' import Review from './Review' import selector, { type SelectorProps } from './selector' @@ -44,7 +43,7 @@ export const removeOwner = async ( ) => { const safeAddress = safe.get('address') const gnosisSafe = await getSafeEthereumInstance(safeAddress) - const nonce = signaturesViaMetamask() ? await gnosisSafe.nonce() : Date.now() + const nonce = await gnosisSafe.nonce() const newThreshold = values[DECREASE_PARAM] ? threshold - 1 : threshold const storedOwners = await gnosisSafe.getOwners() const index = storedOwners.findIndex(ownerAddress => ownerAddress === userToRemove) diff --git a/src/test/safe.redux.transactions.test.js b/src/test/safe.redux.transactions.test.js index cde151fb..d812fdee 100644 --- a/src/test/safe.redux.transactions.test.js +++ b/src/test/safe.redux.transactions.test.js @@ -12,7 +12,6 @@ import { promisify } from '~/utils/promisify' import { getWeb3 } from '~/logic/wallets/getWeb3' import { safeTransactionsSelector } from '~/routes/safe/store/selectors' import fetchSafe from '~/routes/safe/store/actions/fetchSafe' -import { signaturesViaMetamask } from '~/config' import { testTransactionFrom, testSizeOfTransactions } from './utils/historyServiceHelper' @@ -35,7 +34,7 @@ describe('Transactions Suite', () => { const gnosisSafe = await getSafeEthereumInstance(safeAddress) const firstTxData = gnosisSafe.contract.addOwnerWithThreshold.getData(accounts[1], 2) const executor = accounts[0] - const nonce = signaturesViaMetamask() ? await gnosisSafe.nonce() : Date.now() + const nonce = await gnosisSafe.nonce() const firstTxHash = await createTransaction(safe, 'Add Owner Second account', safeAddress, 0, nonce, executor, firstTxData) await store.dispatch(fetchSafe(safe)) safe = getSafeFrom(store.getState(), safeAddress)