This repository was archived by the owner on Nov 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 357
(Feature) [Spending Limits] Transaction List details #1271
Merged
mmv08
merged 24 commits into
feature/#413-SpendingLimit-in-app
from
feature/#691-txList-SpendingLimit
Sep 9, 2020
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
7ca838d
WIP: first attempt to send funds using spending limit module
fernandomg bbacc8b
fix: avoid signature request
fernandomg d228c03
refactor: remove duplicated type file
fernandomg 3380816
add missing type to parameters
fernandomg 96d0776
load module transactions in the store
fernandomg 6411d5d
refactor: move logic and types from `routes` to `logic`
fernandomg e100876
update module's reducer to only add new txs
fernandomg 7d5cd59
define type for SafeModuleTransaction
fernandomg f7f3dc2
add moduleTxs to the list of txs
fernandomg 0aa49d9
add ExpandedModuleTx component
fernandomg a7b5953
identify spendingLimitTxs
fernandomg 0ea23b3
Merge branch 'feature/#693-sendFunds-SpendingLimit' into feature/#691…
fernandomg 91167fc
Merge branch 'feature/#693-sendFunds-SpendingLimit' into feature/#691…
fernandomg 08faadb
Merge branch 'feature/#693-sendFunds-SpendingLimit' into feature/#691…
fernandomg 80d0948
fix: properly verify existence of moduleTransactions
fernandomg c141d52
fix: remove unnecessary state access from within `loadModuleTransacti…
fernandomg a549155
fix: rewrite explanation why there's a filter in the module's tx reducer
fernandomg f2668fa
fix: remove `as any` and unnecessary params in createTransaction acti…
fernandomg b138c4d
fix: remove index from key
fernandomg ef439dd
refactor: rename constants
fernandomg 5840ae9
Merge branch 'feature/#413-SpendingLimit-in-app' into feature/#691-tx…
fernandomg ce681b8
fix: support ETH for spending limit transactions
fernandomg 6c56e9b
Merge branch 'feature/#413-SpendingLimit-in-app' into feature/#691-tx…
fernandomg b58b648
fix types after merge
fernandomg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { createAction } from 'redux-actions' | ||
| import { ModuleTxServiceModel } from 'src/logic/safe/store/actions/transactions/fetchTransactions/loadModuleTransactions' | ||
|
|
||
| export const ADD_MODULE_TRANSACTIONS = 'ADD_MODULE_TRANSACTIONS' | ||
|
|
||
| export type AddModuleTransactionsAction = { | ||
| payload: { | ||
| safeAddress: string | ||
| modules: ModuleTxServiceModel[] | ||
| } | ||
| } | ||
|
|
||
| export const addModuleTransactions = createAction(ADD_MODULE_TRANSACTIONS) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,18 @@ | ||
| import { backOff } from 'exponential-backoff' | ||
| import { batch } from 'react-redux' | ||
| import { ThunkAction, ThunkDispatch } from 'redux-thunk' | ||
| import { AnyAction } from 'redux' | ||
| import { backOff } from 'exponential-backoff' | ||
|
|
||
| import { addIncomingTransactions } from '../../addIncomingTransactions' | ||
|
|
||
| import { loadIncomingTransactions } from './loadIncomingTransactions' | ||
| import { loadOutgoingTransactions } from './loadOutgoingTransactions' | ||
| import { ThunkAction, ThunkDispatch } from 'redux-thunk' | ||
|
|
||
| import { addIncomingTransactions } from 'src/logic/safe/store/actions/addIncomingTransactions' | ||
| import { addModuleTransactions } from 'src/logic/safe/store/actions/addModuleTransactions' | ||
| import { addOrUpdateCancellationTransactions } from 'src/logic/safe/store/actions/transactions/addOrUpdateCancellationTransactions' | ||
| import { addOrUpdateTransactions } from 'src/logic/safe/store/actions/transactions/addOrUpdateTransactions' | ||
| import { AppReduxState } from 'src/store' | ||
|
|
||
| import { loadIncomingTransactions } from './loadIncomingTransactions' | ||
| import { loadModuleTransactions } from './loadModuleTransactions' | ||
| import { loadOutgoingTransactions } from './loadOutgoingTransactions' | ||
|
|
||
| const noFunc = () => {} | ||
|
|
||
| export default (safeAddress: string): ThunkAction<Promise<void>, AppReduxState, undefined, AnyAction> => async ( | ||
|
|
@@ -44,6 +45,12 @@ export default (safeAddress: string): ThunkAction<Promise<void>, AppReduxState, | |
| if (safeIncomingTxs?.size) { | ||
| dispatch(addIncomingTransactions(incomingTransactions)) | ||
| } | ||
|
|
||
| const moduleTransactions = await loadModuleTransactions(safeAddress) | ||
|
|
||
| if (moduleTransactions.length) { | ||
| dispatch(addModuleTransactions({ modules: moduleTransactions, safeAddress })) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Little inconsistency in naming, transactions get passed as |
||
| } | ||
| } catch (error) { | ||
| console.log('Error fetching transactions:', error) | ||
| } | ||
|
|
||
35 changes: 35 additions & 0 deletions
35
src/logic/safe/store/actions/transactions/fetchTransactions/loadModuleTransactions.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import fetchTransactions from 'src/logic/safe/store/actions/transactions/fetchTransactions/fetchTransactions' | ||
| import { TransactionTypes } from 'src/logic/safe/store/models/types/transaction' | ||
| import { DataDecoded, Operation } from 'src/logic/safe/store/models/types/transactions.d' | ||
|
|
||
| export type ModuleTxServiceModel = { | ||
| created: string | ||
| executionDate: string | ||
| blockNumber: number | ||
| transactionHash: string | ||
| safe: string | ||
| module: string | ||
| to: string | ||
| value: string | ||
| data: string | ||
| operation: Operation | ||
| dataDecoded: DataDecoded | ||
| } | ||
|
|
||
| type ETag = string | null | ||
|
|
||
| let previousETag: ETag = null | ||
| export const loadModuleTransactions = async (safeAddress: string): Promise<ModuleTxServiceModel[]> => { | ||
| if (!safeAddress) { | ||
| return [] | ||
| } | ||
|
|
||
| const { eTag, results }: { eTag: ETag; results: ModuleTxServiceModel[] } = await fetchTransactions( | ||
| TransactionTypes.MODULE, | ||
| safeAddress, | ||
| previousETag, | ||
| ) | ||
| previousETag = eTag | ||
|
|
||
| return results | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
src/logic/safe/store/actions/transactions/utils/newTransactionsHelpers.ts
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to export this keyof typeof thing to a separate type