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(wallet): add metamask #334

Merged
merged 7 commits into from
Oct 7, 2024
Merged

feat(wallet): add metamask #334

merged 7 commits into from
Oct 7, 2024

Conversation

baktun14
Copy link
Contributor

Replacement for: #291

@baktun14 baktun14 requested review from Redm4x and ygrishajev August 23, 2024 16:00
const [metamask, setMetamask] = useState<CosmosMetamaskExtensionWallet[]>([]);

useEffect(() => {
import("@cosmos-kit/cosmos-extension-metamask").then(module => {
Copy link
Contributor

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?

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 because of nextjs and ssr, the package needs the window obj and can't be imported normally. They should fix...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

@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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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?

Copy link
Contributor Author

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.

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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?

@ygrishajev
Copy link
Contributor

@baktun14 just was scanning through PRs and notice this one is 3 weeks old. Just a heads up

@baktun14
Copy link
Contributor Author

baktun14 commented Oct 2, 2024

@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 cosmos-extension-metamask

@schnetzlerjoe
Copy link

@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 cosmos-extension-metamask

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.

@baktun14 baktun14 force-pushed the features/metamask-support branch from 7d5d904 to 41e2b3a Compare October 7, 2024 14:39
@baktun14
Copy link
Contributor Author

baktun14 commented Oct 7, 2024

@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 cosmos-extension-metamask

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.

I just tested and as I mentionned in my previous comment, the package cosmos-extension-metamask does not contain your latest changes or snapper ^0.2.

@schnetzlerjoe
Copy link

@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 cosmos-extension-metamask

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.

I just tested and as I mentionned in my previous comment, the package cosmos-extension-metamask does not contain your latest changes or snapper ^0.2.

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.

@baktun14
Copy link
Contributor Author

baktun14 commented Oct 7, 2024

@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 cosmos-extension-metamask

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.

I just tested and as I mentionned in my previous comment, the package cosmos-extension-metamask does not contain your latest changes or snapper ^0.2.

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 ReferenceError: window is not defined when importing the wallets like the documentation says to do import { wallets as metamask } from "@cosmos-kit/cosmos-extension-metamask";
image

@schnetzlerjoe
Copy link

@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 cosmos-extension-metamask

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.

I just tested and as I mentionned in my previous comment, the package cosmos-extension-metamask does not contain your latest changes or snapper ^0.2.

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 ReferenceError: window is not defined when importing the wallets like the documentation says to do import { wallets as metamask } from "@cosmos-kit/cosmos-extension-metamask";
image

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

@baktun14 baktun14 merged commit bc68df8 into main Oct 7, 2024
5 checks passed
@baktun14 baktun14 deleted the features/metamask-support branch October 7, 2024 20:01
@baktun14 baktun14 changed the title feat(console): add metamask feat(wallet): add metamask Oct 7, 2024
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