diff --git a/docs/typescript-example.md b/docs/typescript-example.md new file mode 100644 index 0000000..eb6f67b --- /dev/null +++ b/docs/typescript-example.md @@ -0,0 +1,18 @@ +# TypeScript Example + +```ts +import detectEthereumProvider from "@metamask/detect-provider"; + +async function main() { + const provider = await detectEthereumProvider(); + + if (!provider) { + console.error("No injected provider found"); + return; + } + + const chainId = await provider.request({ method: "eth_chainId" }); + console.log("chainId:", chainId); +} + +main().catch(console.error);