Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add safe wallet support #77

Merged
merged 24 commits into from
Mar 7, 2024
Merged

feat: Add safe wallet support #77

merged 24 commits into from
Mar 7, 2024

Conversation

chrstph-dvx
Copy link
Contributor

@chrstph-dvx chrstph-dvx commented Mar 1, 2024

Summary

  • Add support for safe wallet
  • Add Sepolia support in recover funds
  • Add rainbow kit
  • Bump wagmi version to 0.12

@chrstph-dvx chrstph-dvx self-assigned this Mar 1, 2024
Copy link

vercel bot commented Mar 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
retryable-tx-panel ✅ Ready (Inspect) Visit Preview Mar 7, 2024 11:42am

@chrstph-dvx chrstph-dvx changed the title Add safe wallet support feat: Add safe wallet support Mar 1, 2024
@chrstph-dvx chrstph-dvx marked this pull request as draft March 1, 2024 21:36
@chrstph-dvx chrstph-dvx marked this pull request as ready for review March 4, 2024 18:27
Comment on lines +3 to +10
if (config.plugins) {
config.plugins.push(
new context.webpack.IgnorePlugin({
resourceRegExp: /^(lokijs|pino-pretty|encoding)$/,
}),
);
}
return config;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix error in building for nextjs: WalletConnect/walletconnect-monorepo#1908 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

best if we add a link to this in the file

package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
src/components/Providers.tsx Show resolved Hide resolved
src/app/global.css Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i was extremely confused by the UX here

image

clicking the submit button on this page should not bring the user to
http://localhost:3001/retryables-tracker/{address}, which it currently does

As a user, I am expecting to stay on this page after clicking "Submit" because the address it was showing was initially my MM address because I connected to the site using it first

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Enter the destination address" is not clear enough for a normie user
I would put Enter which address you want to send the funds to on Arbitrum One
and also add a red warning
"CAUTION: Only put an address you are 100% sure you control on Arbitrum One, or your funds will be lost forever!"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should avoid showing the chain id directly to users, and always use network name

},
};

const { provider, webSocketProvider } = configureChains(
const { provider, chains } = configureChains(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for some reason i managed to connect via WalletConnect (Sepolia Safe) the first time, but then WC wouldn't show me a QR code very time I tried.... I am not sure what's happening??

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's the same issue as the bridge, I'll clear the localStorage on first load

Copy link
Member

@fionnachan fionnachan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested the tool with my Sepolia Safe and it works

@@ -25,8 +39,11 @@ function RecoverFundsButton({
}) {
const [message, setMessage] = useState('');
const [loading, setLoading] = useState(false);
const { isSmartContractWallet } = useAccountType();
const { chain } = useNetwork();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this the connected chain or the first chain from the config?? i'm slightly confused about this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useNetwork return the currently connected chain https://1.x.wagmi.sh/react/hooks/useNetwork

const { chain } = useNetwork();
const { data: signer } = useSigner({ chainId: chain?.id });
const { data: signer } = useSigner({
chainId: getL1ChainIdFromL2ChainId(chain?.id),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why wouldn't we use the chainID prop directly here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chainID is the L2 network, and we need to do the transaction on L1

@@ -25,8 +39,11 @@ function RecoverFundsButton({
}) {
const [message, setMessage] = useState('');
const [loading, setLoading] = useState(false);
const { isSmartContractWallet } = useAccountType();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if we need to use isLoading from this to show the UI because users who are on this page probably have a history of not loading isSmartContractWallet quickly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only use this flag to show the popup "To continue, please approve tx on your smart contract wallet.", by this time, user had already made a transaction, so most likely the loading has been completed, but I added the loading flag just in case

aliasedAddress,
chainId,
};
} catch (e) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the RPC fails for whatever reason, the page will tell the user that there are no funds to recover, but that might be misleading.
Is there any other reason why the flow would catch an error here?
If a faulty RPC is the only reason, I would maybe log/show an internal error somewhere, instead of returning a 0 balance.

Comment on lines +192 to +199
<div className="flex flex-col">
<span>
<b>
To continue, please approve tx on your smart contract wallet.
</b>{' '}
If you have k of n signers, then k of n will need to sign.
</span>
</div>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: text appear aligned to the left, not centered like the rest of the texts

Copy link

@TucksonDev TucksonDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Performed e2e test on Sepolia and it worked, but after executing the transaction, the page didn't load the success message, it stayed in the "Recover" page, with the button disabled.
  • Reviewed the recovering logic and it looks good
  • Checked the crafted transaction sent to the Inbox contract and it looks good
  • Left two minor non-blocking comment

@chrstph-dvx chrstph-dvx merged commit a6b8d0e into master Mar 7, 2024
2 checks passed
@fionnachan fionnachan deleted the add-safe-support branch July 2, 2024 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants