MetaMask / MetaMask/metamask-sdk
[Bug]: sdk and other properties are undefined when using `useSDK()`
@christopherferreira9 is already working on this.
Since Aug 26, 2024.
- Dominant language
- TypeScript
- Stars
- 338
- Forks
- 260
- PR merge metrics
- No merged PRs in 30d
Description
### SDK
React-Native
### Provide environment information
``` json
"@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.
``` ts
import { useSDK } from '@metamask/sdk-react-native';
// consume hook
const { sdk, connected } = useSDK();
console.log({sdk})
```
output:
``` js
{"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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.