From e73c9071d5f78f20a56615541bb75fc3b0131b12 Mon Sep 17 00:00:00 2001 From: Daniel McCartney Date: Fri, 9 Jun 2023 01:23:39 -0700 Subject: [PATCH] feat: more directly deep-link into the safe app --- web/src/components/SafeSweepCard.js | 23 ++++++++++++++++++----- web/src/utils.js | 3 ++- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/web/src/components/SafeSweepCard.js b/web/src/components/SafeSweepCard.js index f7ae0d0..37b51c5 100644 --- a/web/src/components/SafeSweepCard.js +++ b/web/src/components/SafeSweepCard.js @@ -26,7 +26,7 @@ import { import _ from "lodash"; import { useState } from "react"; import { ethers } from "ethers"; -import { useAccount } from "wagmi"; +import { useAccount, useEnsName } from "wagmi"; import SafeAppsSDK from "@safe-global/safe-apps-sdk"; import { BNSortComparator, @@ -221,7 +221,9 @@ function useSortedMinipoolDetails(nodeAddress) { .value(); } -function SafeAlert({ sx, label, safeAddress }) { +function SafeAlert({ sx, label, nodeAddress, safeAddress }) { + let { data: name } = useEnsName({ address: nodeAddress }); + let nodeAddressOrName = name || nodeAddress; let { connector } = useAccount(); if (connector?.id === "safe") { // No alert when it is already open as a Safe app. @@ -229,7 +231,10 @@ function SafeAlert({ sx, label, safeAddress }) { } return ( - + } title={"Open as Safe App"} @@ -294,10 +299,18 @@ function SweepCardContent({ sx, nodeAddress }) { )} {hasSafeNodeAddress && ( - + )} {hasSafeWithdrawalAddress && ( - + )} {unupgradedMps.length > 0 && (