2021-02-18 19:52:05 -08:00
|
|
|
import React from "react";
|
2020-08-02 10:44:47 -07:00
|
|
|
import { Link } from "react-router-dom";
|
|
|
|
import { TransactionSignature } from "@solana/web3.js";
|
|
|
|
import { clusterPath } from "utils/url";
|
2021-02-18 19:52:05 -08:00
|
|
|
import { Copyable } from "./Copyable";
|
2020-08-02 10:44:47 -07:00
|
|
|
|
2020-08-04 05:44:16 -07:00
|
|
|
type Props = {
|
|
|
|
signature: TransactionSignature;
|
|
|
|
alignRight?: boolean;
|
|
|
|
link?: boolean;
|
2020-12-03 12:23:28 -08:00
|
|
|
truncate?: boolean;
|
2020-08-04 05:44:16 -07:00
|
|
|
};
|
2020-08-02 10:44:47 -07:00
|
|
|
|
2020-12-03 12:23:28 -08:00
|
|
|
export function Signature({ signature, alignRight, link, truncate }: Props) {
|
2020-08-02 10:44:47 -07:00
|
|
|
return (
|
2020-08-04 05:44:16 -07:00
|
|
|
<div
|
|
|
|
className={`d-flex align-items-center ${
|
|
|
|
alignRight ? "justify-content-end" : ""
|
|
|
|
}`}
|
|
|
|
>
|
2021-02-18 19:52:05 -08:00
|
|
|
<Copyable text={signature} replaceText={!alignRight}>
|
|
|
|
<span className="text-monospace">
|
|
|
|
{link ? (
|
|
|
|
<Link
|
|
|
|
className={truncate ? "text-truncate signature-truncate" : ""}
|
|
|
|
to={clusterPath(`/tx/${signature}`)}
|
|
|
|
>
|
|
|
|
{signature}
|
|
|
|
</Link>
|
|
|
|
) : (
|
|
|
|
signature
|
|
|
|
)}
|
|
|
|
</span>
|
|
|
|
</Copyable>
|
2020-08-02 10:44:47 -07:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|