magic.solana.signMessage fails on react-native
See original GitHub issue✅ Prerequisites
- [ ✅ ] Did you perform a cursory search of open issues? Is this bug already reported elsewhere?
Mentioned in https://github.com/magiclabs/magic-js/issues/354 but closed - I do not think the issue is resolved.
- [ ✅ ] Are you running the latest SDK version?
- [ ✅ ] Are you reporting to the correct repository (
magic-sdk
)?
🐛 Description
The web codesandbox here https://codesandbox.io/s/ma-otp-forked-8yt5e7 works but copied line-for-line into react native, and changing
-import { Magic } from "magic-sdk";
+import { Magic } from "magic-sdk/react-native
- await magicClient.auth.loginWithMagicLink({
- email: email,
- });
+ await magicClient.auth.loginWithSms({
+ phoneNumber: phoneNumber,
+ });
Seems to break it.
The Magic client instantiates, Logging in with magic works, but the signMessage
method throws that error no matter what I provide as an argument.
For example:
const bytes = new Uint8Array([72, 101, 108, 108, 111]); // "Hello"
const signature = await magicClient.solana.signMessage(bytes);
throws
[Error: Magic RPC Error: [-32603] Internal error: unexpected type, use Uint8Array]
Do you have an example of this working in a react-native environment?
🤔 Expected behavior
signMessage
returns a signed message
😮 Actual behavior
Throws
[Error: Magic RPC Error: [-32603] Internal error: unexpected type, use Uint8Array]
🌎 Environment
Software | Version(s) |
---|---|
magic-sdk/react-native |
10.0.0 |
ios | 15.5 |
iPhone | 13 pro |
npm |
8.12.2 |
react-native | >=0.68.1 |
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Cannot verify Wallet signed messages (JS) using Solana-py ...
Describe the bug Signed messages (JS) cannot be verified using Solana-py (Python) To Reproduce Sign a message using Solana's wallet adapter ...
Read more >Unable to verify message signed by sol-wallet-adapter
For iOS, solana.request will cause error. Use solana.signMessage and base58 encode the signature. var _signature = ''; try { signedMessage ...
Read more >How to Authenticate Users with Solana Wallet Adapter
This tutorial covers how to create full-stack Web3 authentication for the Solana wallet adaptor, using the popular NextJS framework.
Read more >Newest 'solana-wallet-adapter' Questions
I'm getting an error while trying to a /buy_now using the Magic Eden API. My app is made in React and I'm using...
Read more >How to Connect Users to Your dApp with the Solana Wallet ...
1. Been building on Solana and ready to bring your dApp to the web? You're going to need a way to connec... 2....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@kelly-ry4n, the issue is caused by
JSON.stringify
mangling the original typed data structure. I’ll make a patch soon, and it may requires you to update the Magic RN SDK🚀 Issue was released in
@magic-sdk/react-native@10.0.1
🚀