-
Notifications
You must be signed in to change notification settings - Fork 428
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
Showing
16 changed files
with
260 additions
and
183 deletions.
There are no files selected for viewing
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
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
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
42 changes: 42 additions & 0 deletions
42
src/components/transactions/TxDetails/Summary/SafeTxHashDataRow/index.tsx
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,42 @@ | ||
import { TypedDataEncoder } from 'ethers' | ||
import { TxDataRow, generateDataRowValue } from '../TxDataRow' | ||
import { type SafeTransactionData, type SafeVersion } from '@safe-global/safe-core-sdk-types' | ||
import { getEip712TxTypes } from '@safe-global/protocol-kit/dist/src/utils' | ||
import useSafeAddress from '@/hooks/useSafeAddress' | ||
import useChainId from '@/hooks/useChainId' | ||
|
||
export const SafeTxHashDataRow = ({ | ||
safeTxHash, | ||
safeTxData, | ||
safeVersion, | ||
}: { | ||
safeTxHash: string | ||
safeTxData?: SafeTransactionData | ||
safeVersion: SafeVersion | ||
}) => { | ||
const chainId = useChainId() | ||
const safeAddress = useSafeAddress() | ||
const domainHash = TypedDataEncoder.hashDomain({ | ||
chainId, | ||
verifyingContract: safeAddress, | ||
}) | ||
const messageHash = safeTxData | ||
? TypedDataEncoder.hashStruct('SafeTx', { SafeTx: getEip712TxTypes(safeVersion).SafeTx }, safeTxData) | ||
: undefined | ||
|
||
return ( | ||
<> | ||
<TxDataRow datatestid="tx-safe-hash" title="safeTxHash:"> | ||
{generateDataRowValue(safeTxHash, 'hash')} | ||
</TxDataRow> | ||
<TxDataRow datatestid="tx-domain-hash" title="Domain hash:"> | ||
{generateDataRowValue(domainHash, 'hash')} | ||
</TxDataRow> | ||
{messageHash && ( | ||
<TxDataRow datatestid="tx-message-hash" title="Message hash:"> | ||
{generateDataRowValue(messageHash, 'hash')} | ||
</TxDataRow> | ||
)} | ||
</> | ||
) | ||
} |
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
Oops, something went wrong.