Skip to content

Commit

Permalink
sign transaction support for WTF
Browse files Browse the repository at this point in the history
  • Loading branch information
gaudren authored and SamWilsn committed Feb 29, 2024
1 parent 98ef67a commit a05f250
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 3 deletions.
3 changes: 3 additions & 0 deletions ui/components/Shared/SharedAddress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import SharedTooltip from "./SharedTooltip"
import { trimWithEllipsis } from "../../utils/textUtils"

type SharedAddressProps = {
id?: string
address: string
name?: string | undefined
elide: boolean
Expand All @@ -31,6 +32,7 @@ type SharedAddressProps = {
* `nameResolverSystem` prop is ignored.
*/
export default function SharedAddress({
id,
name,
address,
elide,
Expand All @@ -48,6 +50,7 @@ export default function SharedAddress({

return (
<button
id={id}
type="button"
onClick={copyAddress}
title={`Copy to clipboard:\n${address}`}
Expand Down
4 changes: 3 additions & 1 deletion ui/components/Shared/SharedCurrentAccountInformation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useAreInternalSignersUnlocked } from "../../hooks/signing-hooks"
import SharedAvatar from "./SharedAvatar"

type Props = {
address: string
shortenedAddress: string
name: string | undefined
avatarURL: string | undefined
Expand All @@ -13,6 +14,7 @@ type Props = {
}

export default function SharedCurrentAccountInformation({
address,
shortenedAddress,
name,
avatarURL,
Expand All @@ -23,7 +25,7 @@ export default function SharedCurrentAccountInformation({
const icon = areInternalSignersUnlocked ? "unlock" : "lock"
return (
<div className={classNames("account_info_wrap", { hover: showHoverStyle })}>
<span className="account_info_label ellipsis">
<span title={address} className="account_info_label ellipsis">
{name ?? shortenedAddress}
</span>
<SharedAvatar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import SharedCurrentAccountInformation from "../SharedCurrentAccountInformation"
import { renderWithProviders } from "../../../tests/test-utils"

const name = "Name"
const address = "0x208e0000000000000000000000000000000090cd"
const shortenedAddress = "0x208e…090cd"
const keyringId = "lock"
const lock = "lock"
Expand All @@ -14,6 +15,7 @@ describe("SharedCurrentAccountInformation", () => {
const ui = renderWithProviders(
<SharedCurrentAccountInformation
name={name}
address=""
shortenedAddress=""
avatarURL={undefined}
/>,
Expand All @@ -26,6 +28,7 @@ describe("SharedCurrentAccountInformation", () => {
const ui = renderWithProviders(
<SharedCurrentAccountInformation
name={undefined}
address={address}
shortenedAddress={shortenedAddress}
avatarURL={undefined}
/>,
Expand All @@ -38,6 +41,7 @@ describe("SharedCurrentAccountInformation", () => {
const ui = renderWithProviders(
<SharedCurrentAccountInformation
name={name}
address=""
shortenedAddress=""
avatarURL={undefined}
showLockStatus={false}
Expand All @@ -52,6 +56,7 @@ describe("SharedCurrentAccountInformation", () => {
const ui = renderWithProviders(
<SharedCurrentAccountInformation
name={name}
address=""
shortenedAddress=""
avatarURL={undefined}
showLockStatus
Expand All @@ -68,6 +73,7 @@ describe("SharedCurrentAccountInformation", () => {
const ui = renderWithProviders(
<SharedCurrentAccountInformation
name={name}
address=""
shortenedAddress=""
avatarURL={undefined}
showLockStatus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function TransferSummaryBase({
<div className="container">
<div className="label">{t("sendTo")}</div>
<div className="send_to">
<SharedAddress address={recipientAddress} name={recipientName} />
<SharedAddress id="recipientAddress" address={recipientAddress} name={recipientName} />
</div>
</div>
<div className="divider" />
Expand Down
3 changes: 2 additions & 1 deletion ui/components/Signing/Signer/SignerBaseFrame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ export default function SignerBaseFrame({
<>
<div className="signature-details">{children}</div>
<footer>
<TransactionButton size="large" type="secondary" onClick={onReject}>
<TransactionButton id="reject" size="large" type="secondary" onClick={onReject}>
{t("reject")}
</TransactionButton>

<TransactionButton
id="sign"
type="primaryGreen"
size="large"
onClick={onConfirm}
Expand Down
2 changes: 2 additions & 0 deletions ui/components/Signing/Signer/TransactionButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export type TransactionButtonProps = SharedButtonProps & {

// TODO: Rename this to signing button
export default function TransactionButton({
id,
type,
size,
isDisabled,
Expand Down Expand Up @@ -93,6 +94,7 @@ export default function TransactionButton({

const renderButton = () => (
<SharedButton
id={id}
type={type}
size={size}
onClick={onClick}
Expand Down
1 change: 1 addition & 0 deletions ui/components/Signing/SigningNetworkAccountInfoTopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default function SigningNetworkAccountInfoTopBar({
</div>
<div className="row_part account">
<SharedCurrentAccountInformation
address={accountTotal.address}
shortenedAddress={shortenedAddress}
name={name}
avatarURL={avatarURL}
Expand Down
1 change: 1 addition & 0 deletions ui/components/TopMenu/TopMenuProfileButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export default function TopMenuProfileButton(props: {
>
{truncatedAddress !== undefined && (
<SharedCurrentAccountInformation
address={address ?? ""}
shortenedAddress={truncatedAddress}
name={name}
avatarURL={avatarURL}
Expand Down

0 comments on commit a05f250

Please sign in to comment.