Skip to content

Commit

Permalink
feat: Add information about the destination contract for voucher-cont…
Browse files Browse the repository at this point in the history
…ent area.
  • Loading branch information
brunomenezes committed Sep 23, 2024
1 parent c3760c2 commit 4e1c148
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion apps/web/src/components/inputs/inputDetailsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import { Voucher } from "../../graphql/rollups/types";
import getConfiguredChainId from "../../lib/getConfiguredChain";
import { useConnectionConfig } from "../../providers/connectionConfig/hooks";
import { theme } from "../../providers/theme";
import { useBlockExplorerData } from "../BlockExplorerLink";
import AddressEl from "../address";
import { NewSpecificationButton } from "../specification/components/NewSpecificationButton";
import { findSpecificationFor } from "../specification/conditionals";
import { Envelope, decodePayload } from "../specification/decoder";
Expand Down Expand Up @@ -225,9 +227,15 @@ const InputDetailsView: FC<ApplicationInputDataProps> = ({ input }) => {
},
] = useDecodingOnInput(input, selectedSpec);

const voucherDestination = destinationOrString(vouchers) as Hex;
const voucherBlockExplorer = useBlockExplorerData(
"address",
voucherDestination,
);

const voucherDecoderRes = useVoucherDecoder({
payload: payloadOrString(vouchers) as Hex,
destination: destinationOrString(vouchers) as Hex,
destination: voucherDestination,
chainId: chainId,
});

Expand Down Expand Up @@ -439,6 +447,22 @@ const InputDetailsView: FC<ApplicationInputDataProps> = ({ input }) => {
});
},
}}
middlePosition={
isNotNilOrEmpty(voucherDestination) && (
<Group
gap="xs"
data-testid="voucher-destination-block-explorer-link"
>
<Text fw="bold">Destination Address:</Text>
<AddressEl
value={voucherDestination}
href={voucherBlockExplorer.url}
hrefTarget="_blank"
shorten
/>
</Group>
)
}
>
{showVoucherForExecution ? (
<VoucherExecution
Expand Down

0 comments on commit 4e1c148

Please sign in to comment.