-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Allow connecting Truffle Dashboard via WalletConnect #4926
Conversation
These markers are there for possible change points.
Also amended the browserlist as it causes an issue with craco and the current version of the library: wevm/wagmi#220 for more info. Committing yarn.lock file also as part of this install.
Code and all elements changed to use wagmi features. Added new code into connector component to also use walletconnct. Tested connections to both metamask and walletconnect to infinity wallet and its working as expected. Still to fully test the transaction loading code from the CLI to the dashboard.
added .idea folder to .gitignore file. reverting yarn.lock as some ursa-optional compiler errors were happening locally.
Web3Provider is now fixed and working as it was with web3react. useProvider hook is not working, had to call connector.getProvider() instead.
Walletconnect RPC return variables are not transformed as they aren't the same as metmask ones.
button to allow disconnecting the wallet and resetting state in app.
@dkillen will be doing a final bit of log cleanup and then this will be good to go. Generally the code is good for review. We will be cleaning up a few log elements prior to it being read to merge. |
packages/dashboard/src/Dashboard.tsx
Outdated
import { useWeb3React } from "@web3-react/core"; | ||
import { useEffect, useState } from "react"; | ||
import { getPorts } from "./utils/utils"; | ||
import {useEffect, useState} from "react"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like your linter settings are off from what the standard is for the team. There should be spaces around the brackets, and I believe this is causing a few changes to appear in the diff that aren't actually relevant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where are the settings I can use?
packages/dashboard/src/Dashboard.tsx
Outdated
const [dashboardProviderRequests, setDashboardProviderRequests] = useState< | ||
DashboardProviderMessage[] | ||
>([]); | ||
const [dashboardProviderRequests, setDashboardProviderRequests] = useState<DashboardProviderMessage[]>([]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's another change that's just the linter behaving differently on your configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as above.
|
||
return ( | ||
<header className="grid grid-cols-2 py-2 px-4 border-b-2 border-truffle-light text-md uppercase"> | ||
<div className="flex justify-start items-center"> | ||
<span className="inline-flex items-center gap-3"> | ||
<img src="/truffle-logomark.svg" width="32px" /> | ||
<img src={"/truffle-logomark.svg"} width="32px" alt={'Truffle Logo'}/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<img src={"/truffle-logomark.svg"} width="32px" alt={'Truffle Logo'}/> | |
<img src="/truffle-logomark.svg" width="32px" alt="Truffle Logo"/> |
Is there a reason for these to be in braces? Also making consistent by replacing '
with "
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding the { around the url makes my linter pass as the url with a relative path pushes up a warning in intellijs linters which are based on eslint.
if we have an eslint and prettier config I can use both here and with the pre-commit hooks this would all go away.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all fixed.
address: string | ||
) => { | ||
const ensName = await reverseLookup(library, address); | ||
const ensName = await reverseLookup(provider, address); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you get this working? It seems to only be returning undefined
for me, and I have reverse lookup setup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have an ens name, we can debug this one together if that would be easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There were some stylistic changes (increasing the Button size which increases the header height) that I'm not too picky about, but I'd definitely want more eyes on. Since we'll have a lot of dashboard changes coming through from the task force, I want to be sure we're being stylistically consistent.
@MicaiahReid prettier ran, button sizing fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixes made as per @MicaiahReid's feedback.
payload, | ||
result | ||
}); | ||
if (connectorId === "injected") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MicaiahReid this is needed to distinguish between walletconnect and injected as they return different RPC responses.
|
||
return ( | ||
<header className="grid grid-cols-2 py-2 px-4 border-b-2 border-truffle-light text-md uppercase"> | ||
<div className="flex justify-start items-center"> | ||
<span className="inline-flex items-center gap-3"> | ||
<img src="/truffle-logomark.svg" width="32px" /> | ||
<img src={"/truffle-logomark.svg"} width="32px" alt={'Truffle Logo'}/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding the { around the url makes my linter pass as the url with a relative path pushes up a warning in intellijs linters which are based on eslint.
if we have an eslint and prettier config I can use both here and with the pre-commit hooks this would all go away.
address: string | ||
) => { | ||
const ensName = await reverseLookup(library, address); | ||
const ensName = await reverseLookup(provider, address); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have an ens name, we can debug this one together if that would be easier.
packages/dashboard/src/Dashboard.tsx
Outdated
import { useWeb3React } from "@web3-react/core"; | ||
import { useEffect, useState } from "react"; | ||
import { getPorts } from "./utils/utils"; | ||
import {useEffect, useState} from "react"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where are the settings I can use?
packages/dashboard/src/Dashboard.tsx
Outdated
const [dashboardProviderRequests, setDashboardProviderRequests] = useState< | ||
DashboardProviderMessage[] | ||
>([]); | ||
const [dashboardProviderRequests, setDashboardProviderRequests] = useState<DashboardProviderMessage[]>([]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as above.
@@ -8,7 +8,7 @@ interface Props { | |||
function Button({ onClick, text }: Props) { | |||
return ( | |||
<button | |||
className="rounded p-2 bg-truffle-blue text-truffle-brown uppercase hover:bg-white" | |||
className="rounded p-2 mx-2 bg-truffle-blue text-truffle-brown uppercase hover:bg-white" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MicaiahReid reverted the change in this button.
|
||
return ( | ||
<header className="grid grid-cols-2 py-2 px-4 border-b-2 border-truffle-light text-md uppercase"> | ||
<div className="flex justify-start items-center"> | ||
<span className="inline-flex items-center gap-3"> | ||
<img src="/truffle-logomark.svg" width="32px" /> | ||
<img src={"/truffle-logomark.svg"} width="32px" alt={'Truffle Logo'}/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! If we want to get this merged sooner, maybe we could pull out the ENS name bit for another PR? I suppose there's no harm done in it not working currently, so maybe we can leave it in and add an issue to get it working ¯_(ツ)_/¯
lets leave it in and get people trying it, it might be a simple fix once we have a few people playing with it, we can pair on this once merged if you have an ENS we can test with. |
Initial POC on integrating WAGMI and WalletConnect into the dashboard codebase.
Still to do some testing on the walletconnect side against some of the wallets but normal metamask code is working as expected no we fixed a few things with the provider library selectors/hooks in the code.