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

[Bug]: sdk and other properties are undefined when using useSDK() #995

Open
ozgurrgul opened this issue Aug 23, 2024 · 0 comments
Open

[Bug]: sdk and other properties are undefined when using useSDK() #995

ozgurrgul opened this issue Aug 23, 2024 · 0 comments
Assignees
Labels
Bug Triage Issues to be triaged in the next session

Comments

@ozgurrgul
Copy link

ozgurrgul commented Aug 23, 2024

SDK

React-Native

Provide environment information

 "@metamask/sdk-react-native": "^0.3.6",
 "node-libs-react-native": "^1.2.1",
 "react-native": "0.72.13",
 "react-native-get-random-values": "^1.11.0",
"react-native-url-polyfill": "^2.0.0",
"eciesjs": "^0.4.7",
 "ethers": "5.7.2",

MetaMask REACTREACT SDK Version

0.3.6

MetaMask Mobile app Version

v7.28.1(1386)

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

Hello, following the basic tutorial for to implement Metamask SDK into our React native app: https://docs.metamask.io/wallet/how-to/use-sdk/javascript/react-native/

When I simply log the outcome of the hook, everything is undefined.

import { useSDK } from '@metamask/sdk-react-native';

// consume hook
const { sdk, connected } = useSDK();
console.log({sdk})

output:

{"sdk": undefined}

Expected Behavior

It should not be undefined so that we can call sdk?.connect(() method

Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster

No response

To Reproduce

Simply follow the tutorial. Also note that your tutorial has incorrect usage and needs to be updated since connect() method and others moved into the sdk https://docs.metamask.io/wallet/how-to/use-sdk/javascript/react-native/#7-use-the-sdk

@ozgurrgul ozgurrgul changed the title [Bug]: [Bug]: sdk and other properties are undefined when using useSDK() Aug 23, 2024
@christopherferreira9 christopherferreira9 added the Bug Triage Issues to be triaged in the next session label Aug 26, 2024
@christopherferreira9 christopherferreira9 self-assigned this Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Triage Issues to be triaged in the next session
Projects
None yet
Development

No branches or pull requests

3 participants
@ozgurrgul @christopherferreira9 and others