Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/XLabs/wormscan-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinoConti committed Feb 10, 2025
2 parents a3c2167 + baa3b99 commit 549b436
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/api/guardian-network/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ export interface GetOperationsOutput {
fee?: string;
fromAddress?: string | null;
parsedPayload?: any;
payload?: string;
payload?: any;
payloadId?: number;
payloadType?: number;
toAddress?: string;
Expand Down
18 changes: 18 additions & 0 deletions src/pages/Tx/Information/Overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ const Overview = ({
resultLog,
setShowOverview,
showMetaMaskBtn,
showMinReceivedTooltip,
showSignatures,
sourceAddress,
sourceFee,
Expand Down Expand Up @@ -910,6 +911,23 @@ const Overview = ({
network={currentNetwork}
/>
)}
{showMinReceivedTooltip && (
<Tooltip
type="info"
tooltip={
<div>
<p>
This is the minimum amount of tokens that will be received. Actual
value can be higher
</p>
</div>
}
>
<span>
<InfoCircleIcon />
</span>
</Tooltip>
)}
{!!showMetaMaskBtn && (
<AddToMetaMaskBtn
className="tx-overview-metamask"
Expand Down
10 changes: 9 additions & 1 deletion src/pages/Tx/Information/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
ETH_BRIDGE_APP_ID,
GATEWAY_APP_ID,
GR_APP_ID,
LIQUIDITY_LAYER_APP_ID,
MAYAN_APP_ID,
PORTAL_APP_ID,
txType,
Expand All @@ -36,6 +37,7 @@ import AdvancedView from "./AdvancedView";
import ProgressView from "./ProgressView";
import Summary from "./Summary";
import "./styles.scss";
import { OverviewProps } from "src/utils/txPageUtils";

interface Props {
blockData: GetBlockData;
Expand Down Expand Up @@ -419,7 +421,12 @@ const Information = ({
const showVerifyRedemption =
status === "pending_redeem" && (isJustPortalUnknown || isConnect || isGateway);

const overviewAndDetailProps = {
const showMinReceivedTooltip = !!(
data.content?.standarizedProperties?.appIds?.includes(LIQUIDITY_LAYER_APP_ID) &&
data.content?.payload?.payload?.parsedRedeemerMessage?.outputToken?.swap?.limitAmount
);

const overviewAndDetailProps: OverviewProps = {
action,
amountSent,
amountSentUSD,
Expand Down Expand Up @@ -459,6 +466,7 @@ const Information = ({
showMetaMaskBtn,
showSignatures: !(appIds && appIds.includes(CCTP_MANUAL_APP_ID)),
showVerifyRedemption,
showMinReceivedTooltip,
sourceFee,
sourceFeeUSD,
sourceSymbol,
Expand Down
39 changes: 39 additions & 0 deletions src/pages/Tx/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
chainToChainId,
toChainId,
chainIdToChain,
UniversalAddress,
} from "@wormhole-foundation/sdk";
import { useEnvironment } from "src/context/EnvironmentContext";
import { Loader } from "src/components/atoms";
Expand Down Expand Up @@ -732,6 +733,44 @@ const Tx = () => {
}
}
}

if (data?.content?.standarizedProperties?.appIds?.includes(LIQUIDITY_LAYER_APP_ID)) {
if (
data.content.payload?.payload?.payloadId === 1 &&
data.content.payload?.payload?.parsedRedeemerMessage?.outputToken?.address
) {
const outputTokenAddress =
data.content.payload?.payload?.parsedRedeemerMessage?.outputToken?.address;

const targetTokenAddress = new UniversalAddress(outputTokenAddress)
.toNative(chainIdToChain(data.content.standarizedProperties?.toChain))
?.toString();

const targetTokenInfo = await getTokenInformation(
data.content.standarizedProperties?.toChain,
environment,
targetTokenAddress,
);

if (targetTokenInfo) {
data.content.standarizedProperties.overwriteTargetTokenAddress = targetTokenAddress;
data.content.standarizedProperties.overwriteTargetSymbol = targetTokenInfo.symbol;
data.content.standarizedProperties.overwriteTargetTokenChain =
data.content.standarizedProperties?.toChain;

if (
targetTokenInfo.tokenDecimals &&
data.content.payload?.payload?.parsedRedeemerMessage?.outputToken?.swap?.limitAmount
) {
data.content.standarizedProperties.overwriteRedeemAmount = `${
+data.content.payload?.payload?.parsedRedeemerMessage?.outputToken?.swap
?.limitAmount /
10 ** targetTokenInfo.tokenDecimals
}`;
}
}
}
}
// ----

// Check Standard Relayer
Expand Down
1 change: 1 addition & 0 deletions src/utils/txPageUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export type OverviewProps = {
resultLog?: string;
setShowOverview?: (newView: "overview" | "advanced" | "progress") => void;
showMetaMaskBtn?: boolean;
showMinReceivedTooltip?: boolean;
showSignatures?: boolean;
showVerifyRedemption?: boolean;
sourceAddress?: string;
Expand Down

0 comments on commit 549b436

Please sign in to comment.