-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Link swaps and swap claims in the UI (#773)
* Rename some vars * Create new Pill and TransactionId components * Populate transaction_ids_by_nullifier * Render a link to the original swap from the swap claim * Use new TransactionPerspective propertY * Rewrite a bit * Rewrite more concisely * Refactor a bit * Add todo * Revert unneeded change * Fix use of maps * Fix typings * Fix import issue * Bump IDB version * Revert unneeded changes * Remove unneeded comment * Revert idb version bump * Address linting issues * Add transactions table * Incorporate Gabe's refactors * Fix linter complaint
- Loading branch information
1 parent
e273093
commit e202610
Showing
8 changed files
with
217 additions
and
25 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,28 @@ | ||
import { TransactionId } from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/core/txhash/v1/txhash_pb'; | ||
import { Pill } from '../../pill'; | ||
import { uint8ArrayToHex } from '@penumbra-zone/types/src/hex'; | ||
import { shorten } from '@penumbra-zone/types/src/string'; | ||
import { ReactNode } from 'react'; | ||
|
||
/** | ||
* Renders a SHA-256 hash of a transaction ID in a pill. | ||
*/ | ||
export const TransactionIdComponent = ({ | ||
transactionId, | ||
prefix, | ||
shaClassName, | ||
}: { | ||
transactionId: TransactionId; | ||
/** Anything to render before the SHA, like a label and/or icon */ | ||
prefix?: ReactNode; | ||
/** Classes to apply to the <span> wrapping the SHA */ | ||
shaClassName?: string; | ||
}) => { | ||
const sha = uint8ArrayToHex(transactionId.inner); | ||
return ( | ||
<Pill to={`/tx/${sha}`}> | ||
{prefix} | ||
<span className={shaClassName}>{shorten(sha, 8)}</span> | ||
</Pill> | ||
); | ||
}; |
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