addMockSafeCreationTx as an action wip

This commit is contained in:
Mikhail Mikheev 2020-04-29 15:03:49 +04:00
parent 27ee734db0
commit 480da937b4
4 changed files with 36 additions and 48 deletions

View File

@ -1,26 +1,34 @@
// @flow
const addMockSafeCreationTx = (safeAddress): Array<TxServiceModel> => [
{
blockNumber: null,
baseGas: 0,
confirmations: [],
data: null,
executionDate: null,
gasPrice: 0,
gasToken: '0x0000000000000000000000000000000000000000',
isExecuted: true,
nonce: null,
operation: 0,
refundReceiver: '0x0000000000000000000000000000000000000000',
safe: safeAddress,
safeTxGas: 0,
safeTxHash: '',
signatures: null,
submissionDate: null,
executor: '',
to: '',
transactionHash: null,
value: 0,
creationTx: true,
},
]
import type { Dispatch as ReduxDispatch } from 'redux'
import { type GlobalState } from '~/store'
const getMockCreationTx = (safeAddress: string) => ({
blockNumber: null,
baseGas: 0,
confirmations: [],
data: null,
executionDate: null,
gasPrice: 0,
gasToken: '0x0000000000000000000000000000000000000000',
isExecuted: true,
nonce: null,
operation: 0,
refundReceiver: '0x0000000000000000000000000000000000000000',
safe: safeAddress,
safeTxGas: 0,
safeTxHash: '',
signatures: null,
submissionDate: null,
executor: '',
to: '',
transactionHash: null,
value: 0,
creationTx: true,
})
const addMockSafeCreationTx = (safeAddress: string) => (dispatch: ReduxDispatch<GlobalState>) => {
dispatch(addTransaction(getMockCreationTx(safeAddress)))
}
export default addMockSafeCreationTx

View File

@ -6,7 +6,7 @@ import type { Dispatch as ReduxDispatch } from 'redux'
import { addIncomingTransactions } from '../addIncomingTransactions'
import { addTransactions } from '../addTransactions'
import { type SafeTransactionsType, TxServiceModel, loadOutgoingTransactions } from './loadOutgoingTransactions'
import { type SafeTransactionsType, loadOutgoingTransactions } from './loadOutgoingTransactions'
import { addCancellationTransactions } from '~/routes/safe/store/actions/transactions/addCancellationTransactions'
import { type IncomingTransaction } from '~/routes/safe/store/models/incomingTransaction'

View File

@ -6,17 +6,7 @@ import updateSafe from './updateSafe'
import { type GlobalState } from '~/store'
// the selector uses ownProps argument/router props to get the address of the safe
// so in order to use it I had to recreate the same structure
// const generateMatchProps = (safeAddress: string) => ({
// match: {
// params: {
// [SAFE_PARAM_ADDRESS]: safeAddress,
// },
// },
// })
const updateActiveAssets = (safeAddress: string, activeAssets: Set<string>) => async (
const updateActiveAssets = (safeAddress: string, activeAssets: Set<string>) => (
dispatch: ReduxDispatch<GlobalState>,
) => {
dispatch(updateSafe({ address: safeAddress, activeAssets }))

View File

@ -6,17 +6,7 @@ import updateSafe from './updateSafe'
import { type GlobalState } from '~/store'
// the selector uses ownProps argument/router props to get the address of the safe
// so in order to use it I had to recreate the same structure
// const generateMatchProps = (safeAddress: string) => ({
// match: {
// params: {
// [SAFE_PARAM_ADDRESS]: safeAddress,
// },
// },
// })
const updateActiveTokens = (safeAddress: string, activeTokens: Set<string>) => async (
const updateActiveTokens = (safeAddress: string, activeTokens: Set<string>) => (
dispatch: ReduxDispatch<GlobalState>,
) => {
dispatch(updateSafe({ address: safeAddress, activeTokens }))