Currently, I am in the process of developing a webpack+pnpm+typescript+react website. All the versions being used are LTS and my preferred IDE is VSCode. According to the guide provided by Metamask here, it seems like I need to follow these steps:
npm i @metamask/sdk
After installing the SDK, the next step is to incorporate it into the project with the following code snippet:
import { MetaMaskSDK } from '@metamask/sdk';
const MMSDK = new MetaMaskSDK(options);
const ethereum = MMSDK.getProvider();
However, when I attempted to import the SDK using "import { MetaMaskSDK } from '@metamask/sdk'", I encountered an issue where there was no type hinting and received a warning message:
There was a problem locating a declaration file for module '@metamask/sdk'. It appears that the 'project/node_modules/.pnpm/@[email protected]_@Email me@[email protected][email protected]/node_modules/@metamask/sdk/dist/node/cjs/metamask-sdk.js' module implicitly has an 'any' type. You can try running
if available or create a new declaration (.d.ts) file containingnpm i --save-dev @types/metamask__sdk
declare module '@metamask/sdk';
ts(7016)
To my knowledge, there doesn't seem to be any module declarations within the SDK's module folder. There are several subfolders like "browser/es" present instead. How should I correctly import the Metamask SDK into a web application?