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

signMessage is not a function #72

Closed
ymc182 opened this issue Sep 14, 2021 · 1 comment
Closed

signMessage is not a function #72

ymc182 opened this issue Sep 14, 2021 · 1 comment

Comments

@ymc182
Copy link

ymc182 commented Sep 14, 2021

image
image

I am trying to sign a message and it worked once I am not sure why but most of the time it return error saying sendMessage is not a function

@jordaaash
Copy link
Collaborator

That's because signMessage is an optional interface method -- Phantom is the first wallet to support it. You need to check if the method is defined before you use it, e.g. if (signMessage) { ... }

Please see the example package for how this is done, and try viewing the UI examples at https://solana-labs.github.io/wallet-adapter/example/

You'll see that the button to sign a message only appears when Phantom is selected and is only enabled when it's connected.

If you know you're only going to use wallets that support this optional API, you can pass only Phantom for now to your wallets array, and then you can use the method as long as it's connected.

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

No branches or pull requests

2 participants