-
Notifications
You must be signed in to change notification settings - Fork 56
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(wallet): add metamask #334
Conversation
const [metamask, setMetamask] = useState<CosmosMetamaskExtensionWallet[]>([]); | ||
|
||
useEffect(() => { | ||
import("@cosmos-kit/cosmos-extension-metamask").then(module => { |
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.
why not importing it synchronously?
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 think it's because of nextjs and ssr, the package needs the window obj and can't be imported normally. They should fix...
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 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.
@schnetzlerjoe Hey, is it possible to make it compatible with nextjs? The error seems to be coming from https://github.com/cosmos/snap/blob/32c3b724f3f2254218181c11572bc18d6afdadaf/packages/snapper/package.json
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 doesn't work as per the documentation https://docs.cosmology.zone/cosmos-kit/integrating-wallets/cosmos-metamask-extension
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.
@baktun14 Let me push and ping them. But what are you getting in the override?
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.
You can checkout the branch and test it out, but from what I understand, it only works for first npm install with a package-lock and there's also issues with workspaces.
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.
@baktun14 I got it to work deleting package-lock, setting the below in ./apps/deploy-web/package.json, and running npm i.
"overrides": {
"@radix-ui/react-dismissable-layer": "^1.0.5",
"@radix-ui/react-focus-scope": "^1.0.4",
"@cosmsnap/snapper": "0.2.7",
"@cosmos-kit/cosmos-extension-metamask": {
"@cosmsnap/snapper": "0.2.7"
}
}
Try that and let me know how it goes.
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.
@schnetzlerjoe I prefer not to regenerate the package-lock file as it may have unintended effects to the dependencies of console apps.
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.
@schnetzlerjoe Any update on the new version of cosmos-extension-metamask
?
@baktun14 just was scanning through PRs and notice this one is 3 weeks old. Just a heads up |
I know thanks for the heads up, I was waiting for @schnetzlerjoe on a new version of |
What are you waiting on? Maybe I missed something but I mentioned above over a month ago that it's been pushed. Cosmos kit uses the most recent version of snapper ^0.2 which has all the updates we discussed in this thread. |
7d5d904
to
41e2b3a
Compare
I just tested and as I mentionned in my previous comment, the package |
Your version is probably being cached then via lock or yarn cache etc. https://github.com/cosmology-tech/cosmos-kit/blob/main/wallets%2Fcosmos-extension-metamask%2Fpackage.json#L65 you will have to clear the cache, regenerate lock, or edit it manually. |
I have 0.2.6 locally and I still get the error |
Latest version is 0.2.7 I believe so that's the problem then. All .7 does is support dynamic ssr compilation for your guys use case. Try updating to that and it should clear that error @baktun14 |
Replacement for: #291