-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1094 from DarkFlorist/use-input-component-where-a…
…ppropriaet Use input component where appropriate
- Loading branch information
Showing
7 changed files
with
81 additions
and
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { EnrichedEthereumInputData } from '../../types/EnrichedEthereumData.js' | ||
import { AddressBookEntry } from '../../types/addressBookTypes.js' | ||
import { RenameAddressCallBack } from '../../types/user-interface-types.js' | ||
import { dataStringWith0xStart } from '../../utils/bigint.js' | ||
import { ParsedInputData } from '../simulationExplaining/Transactions.js' | ||
import { ViewSelector } from './ViewSelector.js' | ||
import { SmallAddress } from './address.js' | ||
|
||
type TransactionInputParams = { | ||
addressMetaData: readonly AddressBookEntry[] | ||
parsedInputData: EnrichedEthereumInputData | ||
input: Uint8Array | ||
to: AddressBookEntry | undefined | ||
renameAddressCallBack: RenameAddressCallBack | ||
} | ||
export function TransactionInput({ parsedInputData, input, to, addressMetaData, renameAddressCallBack }: TransactionInputParams) { | ||
return <ViewSelector id = 'transaction_input'> | ||
{ parsedInputData?.type === 'Parsed' ? ( <> | ||
<ViewSelector.List> | ||
<ViewSelector.View title = 'View Parsed' value = 'parsed'> | ||
<ParsedInputData inputData = { parsedInputData } addressMetaData = { addressMetaData } renameAddressCallBack = { renameAddressCallBack }/> | ||
</ViewSelector.View> | ||
<ViewSelector.View title = 'View Raw' value = 'raw'> | ||
<pre>{ dataStringWith0xStart(input) }</pre> | ||
</ViewSelector.View> | ||
</ViewSelector.List> | ||
<ViewSelector.Triggers /> | ||
</> ) : <> | ||
<ViewSelector.List> | ||
<ViewSelector.View title = 'View Parsed' value = 'parsed'> | ||
<div style = 'display: flex;'> | ||
{ to !== undefined ? <> | ||
<p class = 'paragraph' style = 'color: var(--subtitle-text-color)'>No ABI available for </p> | ||
<SmallAddress addressBookEntry = { to} renameAddressCallBack = { renameAddressCallBack } /> | ||
</> : <> | ||
<p class = 'paragraph' style = 'color: var(--subtitle-text-color)'>No ABI available</p> | ||
</> } | ||
</div> | ||
</ViewSelector.View> | ||
<ViewSelector.View title = 'View Raw' value = 'raw'> | ||
<pre>{ dataStringWith0xStart(input) }</pre> | ||
</ViewSelector.View> | ||
</ViewSelector.List> | ||
<ViewSelector.Triggers /> | ||
</> } | ||
</ViewSelector> | ||
} |
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