WA-521 Just fetching transactions from a given safe address
This commit is contained in:
parent
cd9c759de9
commit
1c07e31a34
|
@ -58,7 +58,7 @@ class AddOwner extends React.Component<Props, State> {
|
|||
safe, threshold, userAddress, fetchTransactions,
|
||||
} = this.props
|
||||
await addOwner(values, safe, threshold, userAddress)
|
||||
fetchTransactions()
|
||||
fetchTransactions(safe.get('address'))
|
||||
this.setState({ done: true })
|
||||
} catch (error) {
|
||||
this.setState({ done: false })
|
||||
|
|
|
@ -40,7 +40,7 @@ class EditDailyLimit extends React.PureComponent<Props, State> {
|
|||
const to = await getDailyLimitAddress(safeAddress)
|
||||
const nonce = Date.now()
|
||||
await createTransaction(safe, `Change Safe's daily limit to ${newDailyLimit} [${nonce}]`, to, 0, nonce, userAddress, data)
|
||||
await this.props.fetchTransactions()
|
||||
await this.props.fetchTransactions(safeAddress)
|
||||
this.setState({ done: true })
|
||||
} catch (error) {
|
||||
this.setState({ done: false })
|
||||
|
|
|
@ -65,7 +65,7 @@ class RemoveOwner extends React.Component<Props, State> {
|
|||
safe, threshold, executor, fetchTransactions, userToRemove, name,
|
||||
} = this.props
|
||||
await removeOwner(values, safe, threshold, userToRemove, name, executor)
|
||||
fetchTransactions()
|
||||
fetchTransactions(safe.get('address'))
|
||||
this.setState({ done: true })
|
||||
} catch (error) {
|
||||
this.setState({ done: false })
|
||||
|
|
|
@ -67,7 +67,7 @@ class SendToken extends React.Component<Props, State> {
|
|||
|
||||
await processTokenTransfer(safe, token, destination, amount, userAddress)
|
||||
await sleep(1500)
|
||||
this.props.fetchTransactions()
|
||||
this.props.fetchTransactions(safe.get('address'))
|
||||
this.setState({ done: true })
|
||||
} catch (error) {
|
||||
this.setState({ done: false })
|
||||
|
|
|
@ -34,11 +34,12 @@ class Threshold extends React.PureComponent<Props, State> {
|
|||
try {
|
||||
const { safe, userAddress } = this.props // , fetchThreshold } = this.props
|
||||
const newThreshold = values[THRESHOLD_PARAM]
|
||||
const gnosisSafe = await getSafeEthereumInstance(safe.get('address'))
|
||||
const safeAddress = safe.get('address')
|
||||
const gnosisSafe = await getSafeEthereumInstance(safeAddress)
|
||||
const nonce = Date.now()
|
||||
const data = gnosisSafe.contract.changeThreshold.getData(newThreshold)
|
||||
await createTransaction(safe, `Change Safe's threshold [${nonce}]`, safe.get('address'), 0, nonce, userAddress, data)
|
||||
await this.props.fetchTransactions()
|
||||
await createTransaction(safe, `Change Safe's threshold [${nonce}]`, safeAddress, 0, nonce, userAddress, data)
|
||||
await this.props.fetchTransactions(safeAddress)
|
||||
this.setState({ done: true })
|
||||
} catch (error) {
|
||||
this.setState({ done: false })
|
||||
|
|
|
@ -35,7 +35,7 @@ class Transactions extends React.Component<Props, {}> {
|
|||
}
|
||||
|
||||
await processTransaction(safeAddress, tx, alreadyConfirmed, userAddress, threshold)
|
||||
fetchTransactions()
|
||||
fetchTransactions(safeAddress)
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
|
@ -34,7 +34,7 @@ class Withdraw extends React.Component<Props, State> {
|
|||
try {
|
||||
const { safe, userAddress, fetchTransactions } = this.props
|
||||
await withdraw(values, safe, userAddress)
|
||||
fetchTransactions()
|
||||
fetchTransactions(safe.get('address'))
|
||||
|
||||
this.setState({ done: true })
|
||||
} catch (error) {
|
||||
|
|
|
@ -20,8 +20,8 @@ export const EDIT_INDEX = 4
|
|||
export const WITHDRAW_INDEX = 5
|
||||
export const LIST_TXS_INDEX = 6
|
||||
|
||||
export const listTxsClickingOn = async (store: Store, seeTxsButton: Element) => {
|
||||
await store.dispatch(fetchTransactions())
|
||||
export const listTxsClickingOn = async (store: Store, seeTxsButton: Element, safeAddress: string) => {
|
||||
await store.dispatch(fetchTransactions(safeAddress))
|
||||
await sleep(1200)
|
||||
expect(seeTxsButton.getElementsByTagName('span')[0].innerHTML).toEqual(SEE_MULTISIG_BUTTON_TEXT)
|
||||
TestUtils.Simulate.click(seeTxsButton)
|
||||
|
@ -88,8 +88,8 @@ export const checkPendingTx = async (
|
|||
}
|
||||
}
|
||||
|
||||
export const refreshTransactions = async (store: Store<GlobalState>) => {
|
||||
await store.dispatch(fetchTransactions())
|
||||
export const refreshTransactions = async (store: Store<GlobalState>, safeAddress: string) => {
|
||||
await store.dispatch(fetchTransactions(safeAddress))
|
||||
await sleep(1500)
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ describe('DOM > Feature > SAFE MULTISIG Transactions', () => {
|
|||
await sendChangeThresholdForm(SafeDom, safeButtons[EDIT_THRESHOLD_INDEX], '2')
|
||||
|
||||
// THEN
|
||||
await listTxsClickingOn(store, safeButtons[LIST_TXS_INDEX])
|
||||
await listTxsClickingOn(store, safeButtons[LIST_TXS_INDEX], address)
|
||||
const transactions = TestUtils.scryRenderedComponentsWithType(SafeDom, Transaction)
|
||||
|
||||
checkMinedMoveFundsTx(transactions[0], 'Send 0.01 ETH to')
|
||||
|
@ -53,7 +53,7 @@ describe('DOM > Feature > SAFE MULTISIG Transactions', () => {
|
|||
await sendWithdrawForm(SafeDom, safeButtons[WITHDRAW_INDEX], '0.01', accounts[3])
|
||||
|
||||
// THEN
|
||||
await listTxsClickingOn(store, safeButtons[LIST_TXS_INDEX])
|
||||
await listTxsClickingOn(store, safeButtons[LIST_TXS_INDEX], address)
|
||||
const transactions = TestUtils.scryRenderedComponentsWithType(SafeDom, Transaction)
|
||||
|
||||
const statusses = ['Adol Metamask 2 [Not confirmed]', 'Adol 1 Eth Account [Confirmed]']
|
||||
|
@ -76,7 +76,7 @@ describe('DOM > Feature > SAFE MULTISIG Transactions', () => {
|
|||
// WHEN... processing pending TXs
|
||||
await processTransaction(address, transactions[4].props.transaction, 1, accounts[1], 3)
|
||||
await processTransaction(address, transactions[5].props.transaction, 1, accounts[1], 3)
|
||||
await refreshTransactions(store)
|
||||
await refreshTransactions(store, address)
|
||||
|
||||
// THEN
|
||||
checkMinedMoveFundsTx(transactions[4], 'Send 0.01 ETH to')
|
||||
|
@ -88,28 +88,28 @@ describe('DOM > Feature > SAFE MULTISIG Transactions', () => {
|
|||
await sendRemoveOwnerForm(SafeDom, safeButtons[EXPAND_OWNERS_INDEX])
|
||||
|
||||
// THEN
|
||||
await listTxsClickingOn(store, safeButtons[LIST_TXS_INDEX])
|
||||
await listTxsClickingOn(store, safeButtons[LIST_TXS_INDEX], address)
|
||||
transactions = TestUtils.scryRenderedComponentsWithType(SafeDom, Transaction)
|
||||
expect(transactions.length).toBe(8)
|
||||
let statusses = ['Adol Metamask 3 [Not confirmed]', 'Adol Metamask 2 [Not confirmed]', 'Adol 1 Eth Account [Confirmed]']
|
||||
await checkPendingRemoveOwnerTx(transactions[7], 3, 'Remove Owner Adol Metamask 3', statusses)
|
||||
|
||||
await processTransaction(address, transactions[7].props.transaction, 1, accounts[1], 3)
|
||||
await refreshTransactions(store)
|
||||
await refreshTransactions(store, address)
|
||||
transactions = TestUtils.scryRenderedComponentsWithType(SafeDom, Transaction)
|
||||
statusses = ['Adol Metamask 3 [Not confirmed]', 'Adol Metamask 2 [Confirmed]', 'Adol 1 Eth Account [Confirmed]']
|
||||
await checkPendingRemoveOwnerTx(transactions[7], 2, 'Remove Owner Adol Metamask 3', statusses)
|
||||
await checkThresholdOf(address, 3)
|
||||
|
||||
await processTransaction(address, transactions[7].props.transaction, 2, accounts[2], 3)
|
||||
await refreshTransactions(store)
|
||||
await refreshTransactions(store, address)
|
||||
await checkThresholdOf(address, 2)
|
||||
transactions = TestUtils.scryRenderedComponentsWithType(SafeDom, Transaction)
|
||||
await checkMinedRemoveOwnerTx(transactions[7], 'Remove Owner')
|
||||
|
||||
// WHEN... changing threshold
|
||||
await sendChangeThresholdForm(SafeDom, safeButtons[EDIT_THRESHOLD_INDEX], '1')
|
||||
await listTxsClickingOn(store, safeButtons[LIST_TXS_INDEX])
|
||||
await listTxsClickingOn(store, safeButtons[LIST_TXS_INDEX], address)
|
||||
|
||||
// THEN
|
||||
transactions = TestUtils.scryRenderedComponentsWithType(SafeDom, Transaction)
|
||||
|
|
|
@ -38,7 +38,7 @@ describe('Transactions Suite', () => {
|
|||
const secondTxHash = await createTransaction(safe, 'Add Owner Third account', safeAddress, 0, nonce + 100, executor, secondTxData)
|
||||
|
||||
// WHEN
|
||||
store.dispatch(fetchTransactions())
|
||||
store.dispatch(fetchTransactions(safeAddress))
|
||||
let transactions = safeTransactionsSelector(store.getState(), { safeAddress })
|
||||
testSizeOfTransactions(transactions, 2)
|
||||
|
||||
|
@ -63,7 +63,7 @@ describe('Transactions Suite', () => {
|
|||
|
||||
localStorage.clear()
|
||||
|
||||
store.dispatch(fetchTransactions())
|
||||
store.dispatch(fetchTransactions(safeAddress))
|
||||
transactions = safeTransactionsSelector(store.getState(), { safeAddress })
|
||||
testSizeOfTransactions(transactions, 2)
|
||||
testTransactionFrom(transactions, 0, 'Unknown', nonce, 0, safeAddress, firstTxData, true, firstTxConfirmations)
|
||||
|
|
Loading…
Reference in New Issue