WA-238 rename createTransaction to storeTransaction
This commit is contained in:
parent
abb949702c
commit
f42aa0722f
|
@ -6,7 +6,7 @@ import { sleep } from '~/utils/timer'
|
||||||
import { type Safe } from '~/routes/safe/store/model/safe'
|
import { type Safe } from '~/routes/safe/store/model/safe'
|
||||||
import actions, { type Actions } from './actions'
|
import actions, { type Actions } from './actions'
|
||||||
import selector, { type SelectorProps } from './selector'
|
import selector, { type SelectorProps } from './selector'
|
||||||
import transaction, { createTransaction, TX_NAME_PARAM, TX_DESTINATION_PARAM, TX_VALUE_PARAM } from './transactions'
|
import transaction, { storeTransaction, TX_NAME_PARAM, TX_DESTINATION_PARAM, TX_VALUE_PARAM } from './transactions'
|
||||||
import MultisigForm from './MultisigForm'
|
import MultisigForm from './MultisigForm'
|
||||||
import ReviewTx from './ReviewTx'
|
import ReviewTx from './ReviewTx'
|
||||||
|
|
||||||
|
@ -38,9 +38,9 @@ class Transactions extends React.Component<Props, State> {
|
||||||
const destination = values[TX_DESTINATION_PARAM]
|
const destination = values[TX_DESTINATION_PARAM]
|
||||||
const value = values[TX_VALUE_PARAM]
|
const value = values[TX_VALUE_PARAM]
|
||||||
const tx = await transaction(safe.get('address'), destination, value, nonce, userAddress)
|
const tx = await transaction(safe.get('address'), destination, value, nonce, userAddress)
|
||||||
await createTransaction(
|
await storeTransaction(
|
||||||
values[TX_NAME_PARAM], nonce, destination, value, userAddress,
|
values[TX_NAME_PARAM], nonce, destination, value, userAddress,
|
||||||
safe.get('owners'), tx, safe.get('address'), safe.get('confirmations'),
|
safe.get('owners'), tx.tx, safe.get('address'), safe.get('confirmations'),
|
||||||
)
|
)
|
||||||
await sleep(1500)
|
await sleep(1500)
|
||||||
this.props.fetchTransactions()
|
this.props.fetchTransactions()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// @flow
|
// @flow
|
||||||
import { List, Map } from 'immutable'
|
import { List, Map } from 'immutable'
|
||||||
import { createTransaction } from '~/routes/safe/component/Transactions/transactions'
|
import { storeTransaction } from '~/routes/safe/component/Transactions/transactions'
|
||||||
import { type Transaction } from '~/routes/safe/store/model/transaction'
|
import { type Transaction } from '~/routes/safe/store/model/transaction'
|
||||||
import { SafeFactory } from '~/routes/safe/store/test/builder/safe.builder'
|
import { SafeFactory } from '~/routes/safe/store/test/builder/safe.builder'
|
||||||
import { type Safe } from '~/routes/safe/store/model/safe'
|
import { type Safe } from '~/routes/safe/store/model/safe'
|
||||||
|
@ -31,7 +31,7 @@ describe('Transactions Suite', () => {
|
||||||
// GIVEN
|
// GIVEN
|
||||||
const txName = 'Buy butteries for project'
|
const txName = 'Buy butteries for project'
|
||||||
const nonce: number = 10
|
const nonce: number = 10
|
||||||
createTransaction(txName, nonce, destination, value, 'foo', owners, '', safe.get('address'), safe.get('confirmations'))
|
storeTransaction(txName, nonce, destination, value, 'foo', owners, '', safe.get('address'), safe.get('confirmations'))
|
||||||
|
|
||||||
// WHEN
|
// WHEN
|
||||||
const transactions: Map<string, List<Transaction>> = loadSafeTransactions()
|
const transactions: Map<string, List<Transaction>> = loadSafeTransactions()
|
||||||
|
@ -51,11 +51,11 @@ describe('Transactions Suite', () => {
|
||||||
const firstTxName = 'Buy butteries for project'
|
const firstTxName = 'Buy butteries for project'
|
||||||
const firstNonce: number = Date.now()
|
const firstNonce: number = Date.now()
|
||||||
const safeAddress = safe.get('address')
|
const safeAddress = safe.get('address')
|
||||||
createTransaction(firstTxName, firstNonce, destination, value, 'foo', owners, '', safeAddress, safe.get('confirmations'))
|
storeTransaction(firstTxName, firstNonce, destination, value, 'foo', owners, '', safeAddress, safe.get('confirmations'))
|
||||||
|
|
||||||
const secondTxName = 'Buy printers for project'
|
const secondTxName = 'Buy printers for project'
|
||||||
const secondNonce: number = firstNonce + 100
|
const secondNonce: number = firstNonce + 100
|
||||||
createTransaction(secondTxName, secondNonce, destination, value, 'foo', owners, '', safeAddress, safe.get('confirmations'))
|
storeTransaction(secondTxName, secondNonce, destination, value, 'foo', owners, '', safeAddress, safe.get('confirmations'))
|
||||||
|
|
||||||
// WHEN
|
// WHEN
|
||||||
const transactions: Map<string, List<Transaction>> = loadSafeTransactions()
|
const transactions: Map<string, List<Transaction>> = loadSafeTransactions()
|
||||||
|
@ -75,13 +75,13 @@ describe('Transactions Suite', () => {
|
||||||
const txName = 'Buy batteris for Alplha project'
|
const txName = 'Buy batteris for Alplha project'
|
||||||
const nonce = 10
|
const nonce = 10
|
||||||
const safeAddress = safe.address
|
const safeAddress = safe.address
|
||||||
createTransaction(txName, nonce, destination, value, 'foo', owners, '', safeAddress, safe.get('confirmations'))
|
storeTransaction(txName, nonce, destination, value, 'foo', owners, '', safeAddress, safe.get('confirmations'))
|
||||||
|
|
||||||
const secondSafe = SafeFactory.dailyLimitSafe(10, 2)
|
const secondSafe = SafeFactory.dailyLimitSafe(10, 2)
|
||||||
const txSecondName = 'Buy batteris for Beta project'
|
const txSecondName = 'Buy batteris for Beta project'
|
||||||
const txSecondNonce = 10
|
const txSecondNonce = 10
|
||||||
const secondSafeAddress = secondSafe.address
|
const secondSafeAddress = secondSafe.address
|
||||||
createTransaction(
|
storeTransaction(
|
||||||
txSecondName, txSecondNonce, destination, value, '0x03db1a8b26d08df23337e9276a36b474510f0023',
|
txSecondName, txSecondNonce, destination, value, '0x03db1a8b26d08df23337e9276a36b474510f0023',
|
||||||
secondSafe.get('owners'), '', secondSafeAddress, secondSafe.get('confirmations'),
|
secondSafe.get('owners'), '', secondSafeAddress, secondSafe.get('confirmations'),
|
||||||
)
|
)
|
||||||
|
@ -100,7 +100,7 @@ describe('Transactions Suite', () => {
|
||||||
// WHEN
|
// WHEN
|
||||||
const txFirstName = 'Buy paper for Alplha project'
|
const txFirstName = 'Buy paper for Alplha project'
|
||||||
const txFirstNonce = 11
|
const txFirstNonce = 11
|
||||||
createTransaction(
|
storeTransaction(
|
||||||
txFirstName, txFirstNonce, destination, value, 'foo',
|
txFirstName, txFirstNonce, destination, value, 'foo',
|
||||||
safe.get('owners'), '', safe.get('address'), safe.get('confirmations'),
|
safe.get('owners'), '', safe.get('address'), safe.get('confirmations'),
|
||||||
)
|
)
|
||||||
|
@ -136,10 +136,10 @@ describe('Transactions Suite', () => {
|
||||||
// GIVEN
|
// GIVEN
|
||||||
const txName = 'Buy butteries for project'
|
const txName = 'Buy butteries for project'
|
||||||
const nonce: number = 10
|
const nonce: number = 10
|
||||||
createTransaction(txName, nonce, destination, value, 'foo', owners, '', safe.get('address'), safe.get('confirmations'))
|
storeTransaction(txName, nonce, destination, value, 'foo', owners, '', safe.get('address'), safe.get('confirmations'))
|
||||||
|
|
||||||
// WHEN
|
// WHEN
|
||||||
const createTxFnc = () => createTransaction(txName, nonce, destination, value, 'foo', owners, '', safe.get('address'), safe.get('confirmations'))
|
const createTxFnc = () => storeTransaction(txName, nonce, destination, value, 'foo', owners, '', safe.get('address'), safe.get('confirmations'))
|
||||||
expect(createTxFnc).toThrow(/Transaction with same nonce/)
|
expect(createTxFnc).toThrow(/Transaction with same nonce/)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ describe('Transactions Suite', () => {
|
||||||
// GIVEN
|
// GIVEN
|
||||||
const txName = 'Buy butteries for project'
|
const txName = 'Buy butteries for project'
|
||||||
const nonce: number = 10
|
const nonce: number = 10
|
||||||
createTransaction(txName, nonce, destination, value, 'foo', owners, '', safe.get('address'), safe.get('confirmations'))
|
storeTransaction(txName, nonce, destination, value, 'foo', owners, '', safe.get('address'), safe.get('confirmations'))
|
||||||
|
|
||||||
// WHEN
|
// WHEN
|
||||||
const transactions: Map<string, List<Transaction>> = loadSafeTransactions()
|
const transactions: Map<string, List<Transaction>> = loadSafeTransactions()
|
||||||
|
@ -161,7 +161,7 @@ describe('Transactions Suite', () => {
|
||||||
const txName = 'Buy butteries for project'
|
const txName = 'Buy butteries for project'
|
||||||
const nonce: number = 10
|
const nonce: number = 10
|
||||||
const ownerName = 'invented'
|
const ownerName = 'invented'
|
||||||
const createTxFnc = () => createTransaction(txName, nonce, destination, value, ownerName, owners, '', safe.get('address'), safe.get('confirmations'))
|
const createTxFnc = () => storeTransaction(txName, nonce, destination, value, ownerName, owners, '', safe.get('address'), safe.get('confirmations'))
|
||||||
|
|
||||||
expect(createTxFnc).toThrow(/The creator of the tx is not an owner/)
|
expect(createTxFnc).toThrow(/The creator of the tx is not an owner/)
|
||||||
})
|
})
|
||||||
|
@ -172,7 +172,7 @@ describe('Transactions Suite', () => {
|
||||||
const txName = 'Buy butteries for project'
|
const txName = 'Buy butteries for project'
|
||||||
const nonce: number = 10
|
const nonce: number = 10
|
||||||
const tx = ''
|
const tx = ''
|
||||||
const createTxFnc = () => createTransaction(txName, nonce, destination, value, ownerName, oneOwnerSafe.get('owners'), tx, oneOwnerSafe.get('address'), oneOwnerSafe.get('confirmations'))
|
const createTxFnc = () => storeTransaction(txName, nonce, destination, value, ownerName, oneOwnerSafe.get('owners'), tx, oneOwnerSafe.get('address'), oneOwnerSafe.get('confirmations'))
|
||||||
|
|
||||||
expect(createTxFnc).toThrow(/The tx should be mined before storing it in safes with one owner/)
|
expect(createTxFnc).toThrow(/The tx should be mined before storing it in safes with one owner/)
|
||||||
})
|
})
|
||||||
|
|
|
@ -23,7 +23,7 @@ const buildConfirmationsFrom = (owners: List<Owner>, creator: string): List<Conf
|
||||||
return owners.map((owner: Owner) => makeConfirmation({ owner, status: owner.get('address') === creator }))
|
return owners.map((owner: Owner) => makeConfirmation({ owner, status: owner.get('address') === creator }))
|
||||||
}
|
}
|
||||||
|
|
||||||
export const createTransaction = (
|
export const storeTransaction = (
|
||||||
name: string,
|
name: string,
|
||||||
nonce: number,
|
nonce: number,
|
||||||
destination: string,
|
destination: string,
|
||||||
|
|
Loading…
Reference in New Issue