Skip to content

Commit

Permalink
Merge pull request #488 from valory-xyz/fix/add-backup-wallet-safe-page
Browse files Browse the repository at this point in the history
Fix lint errors around adding backup wallets to safe
  • Loading branch information
truemiller authored Nov 22, 2024
2 parents a2d4ae2 + 8af9e30 commit 8af742d
Show file tree
Hide file tree
Showing 4 changed files with 151 additions and 112 deletions.
24 changes: 19 additions & 5 deletions frontend/components/Pages/AddBackupWalletViaSafePage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { Card, Flex, Typography } from 'antd';
import { isNil } from 'lodash';

import { CardTitle } from '@/components/Card/CardTitle';
import { UNICODE_SYMBOLS } from '@/constants/symbols';
import { DISCORD_TICKET_URL } from '@/constants/urls';
import { ChainId } from '@/enums/Chain';
import { MasterSafe } from '@/enums/Wallet';
import { useServices } from '@/hooks/useServices';
import { useMasterWalletContext } from '@/hooks/useWallet';

import { GoToMainPageButton } from '../GoToMainPageButton';

Expand All @@ -20,10 +22,22 @@ const safeChainPrefix = {
[ChainId.Gnosis]: 'gno',
};

export const AddBackupWalletViaSafePage = (masterSafe: MasterSafe) => {
const { chainId, address } = masterSafe;
export const AddBackupWalletViaSafePage = () => {
const {
selectedAgentConfig: { homeChainId },
} = useServices();
const { masterSafes } = useMasterWalletContext();

const safePrefix = safeChainPrefix[chainId];
const masterSafe = masterSafes?.find(
({ chainId }) => homeChainId === chainId,
);

const safePrefix =
masterSafe?.chainId && safeChainPrefix[masterSafe?.chainId];

if (isNil(masterSafe)) {
return null;
}

return (
<Card
Expand All @@ -36,7 +50,7 @@ export const AddBackupWalletViaSafePage = (masterSafe: MasterSafe) => {
<Text>Manually add backup wallet via Safe interface:</Text>
<a
target="_blank"
href={`https://app.safe.global/settings/setup?safe=${safePrefix}:${address}`}
href={`https://app.safe.global/settings/setup?safe=${safePrefix}:${masterSafe.address}`}
>
Add backup wallet {UNICODE_SYMBOLS.EXTERNAL_LINK}
</a>
Expand Down
20 changes: 11 additions & 9 deletions frontend/components/YourWalletPage/Titles.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Flex, Typography } from 'antd';

import { InfoTooltip } from '@/components/InfoTooltip';
import { TokenSymbol } from '@/enums/Token';
import { Address } from '@/types/Address';

import { AddressLink } from '../AddressLink';
Expand All @@ -17,8 +18,8 @@ export const SignerTitle = ({
Signer&nbsp;
<InfoTooltip>
<Paragraph className="text-sm">
Your wallet and agents wallet use Safe, a multi-signature wallet. The
app is designed to trigger transactions on these Safe wallets via
Your wallet and agent&apos;s wallet use Safe, a multi-signature wallet.
The app is designed to trigger transactions on these Safe wallets via
Signers.
</Paragraph>
<Paragraph className="text-sm">
Expand All @@ -43,23 +44,24 @@ export const OlasTitle = () => (
<InfoTooltip>
<Paragraph className="text-sm m-0">
Agent rewards accumulate in the staking contract. The agent is designed
to claim rewards periodically. Withdrawal of claimed rewards isnt
to claim rewards periodically. Withdrawal of claimed rewards isn&apos;t
available yet.
</Paragraph>
</InfoTooltip>
</Flex>
);

export const XdaiTitle = () => (
export const NativeTokenTitle = ({ symbol }: { symbol: TokenSymbol }) => (
<Flex align="center">
<Title level={5} className="m-0 text-sm">
XDAI
{symbol}
</Title>
&nbsp;
<InfoTooltip>
{/* TODO: address multi-agent tooltip, specfic to agent config */}
<Paragraph className="text-sm m-0">
XDAI is used by the agent to engage in prediction markets. This amount
will fluctuate based on your agents performance.
{symbol} is used by the agent to engage in prediction markets. This
amount will fluctuate based on your agent&apos;s performance.
</Paragraph>
</InfoTooltip>
</Flex>
Expand All @@ -75,7 +77,7 @@ export const OwnershipNftTitle = () => (
</Text>
<Paragraph className="text-sm m-0">
Agents are minted through the Olas Registry. Each agent has an NFT
that gives its owner control over the agents settings.
that gives its owner control over the agent&apos;s settings.
</Paragraph>
</Flex>
</InfoTooltip>
Expand All @@ -88,7 +90,7 @@ export const ServiceIdTitle = () => (
<InfoTooltip placement="topRight">
<Paragraph className="text-sm m-0">
Each minted agent gets a unique ID. Technically, agents are referred to
as services.
as &apos;services&apos;.
</Paragraph>
</InfoTooltip>
</Text>
Expand Down
Loading

0 comments on commit 8af742d

Please sign in to comment.