-
Notifications
You must be signed in to change notification settings - Fork 892
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2089660
commit ca9e7ad
Showing
5 changed files
with
50 additions
and
22 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
components/brave_wallet_ui/common/hooks/use-transactions-network.ts
This file contains 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,17 @@ | ||
import * as React from 'react' | ||
import { useSelector } from 'react-redux' | ||
import { BraveWallet, WalletState } from '../../constants/types' | ||
import { getNetworkFromTXDataUnion } from '../../utils/network-utils' | ||
|
||
export const useTransactionsNetwork = (transaction: BraveWallet.TransactionInfo) => { | ||
// redux | ||
const { | ||
defaultNetworks, selectedNetwork | ||
} = useSelector(({ wallet }: { wallet: WalletState }) => wallet) | ||
|
||
const txNetwork = React.useMemo(() => { | ||
return getNetworkFromTXDataUnion(transaction.txDataUnion, defaultNetworks, selectedNetwork) | ||
}, [defaultNetworks, transaction, selectedNetwork]) | ||
|
||
return txNetwork | ||
} |
This file contains 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 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 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 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