{"library":"mipd","title":"EIP-6963 Multi-Injected Provider Discovery Utilities","description":"mipd (Multi Injected Provider Discovery) is a TypeScript utility library from the wevm (formerly wagmi-dev) ecosystem, designed to facilitate the discovery and management of EIP-6963 compliant Ethereum wallet providers within dapps. EIP-6963 standardizes how multiple injected wallets announce themselves via custom DOM events, moving beyond the single `window.ethereum` paradigm. Currently at version 0.0.7, mipd offers a reactive store (`createStore`) that accumulates announced `EIP6963ProviderDetail` objects and allows dapps to subscribe to updates or retrieve the current list of providers. It includes essential TypeScript types such as `EIP6963ProviderDetail` and `EIP6963AnnounceProviderEvent`, and also provides a `/window` polyfill for enhanced type inference on global event listeners. Its release cadence is likely tied to updates within the broader wevm stack and EIP-6963 evolution. mipd is a foundational component for building robust multi-wallet dapps, complementing libraries like wagmi and viem by abstracting EIP-6963 complexities.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install mipd"],"cli":null},"imports":["import { createStore } from 'mipd';","import type { EIP6963ProviderDetail } from 'mipd';","import type { EIP6963AnnounceProviderEvent } from 'mipd';","import 'mipd/window';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { createStore } from 'mipd';\nimport type { EIP6963ProviderDetail } from 'mipd';\nimport 'mipd/window'; // Import to augment window types for EIP-6963 events\n\n// Create a new EIP-6963 provider store\nconst mipdStore = createStore();\n\n// Subscribe to provider changes (e.g., when a wallet announces itself or is removed)\nconst unsubscribe = mipdStore.subscribe((providers: EIP6963ProviderDetail[]) => {\n  console.log('EIP-6963 Providers updated:', providers);\n  if (providers.length > 0) {\n    console.log('First provider UUID:', providers[0].info.uuid);\n    console.log('First provider Name:', providers[0].info.name);\n    // You can now use providers[0].provider for interactions if needed\n  }\n});\n\n// Get current providers immediately\nconst initialProviders = mipdStore.getProviders();\nconsole.log('Initial EIP-6963 Providers:', initialProviders);\n\n// Example of how you might stop listening after some time (in a real app, this would be on unmount)\nsetTimeout(() => {\n  unsubscribe();\n  console.log('Unsubscribed from mipd store updates.');\n}, 10000);\n\n// In a React component (using React 18+ useSyncExternalStore):\n// import { useSyncExternalStore } from 'react';\n// import { createStore } from 'mipd';\n\n// const store = createStore();\n\n// function MyWalletConnector() {\n//   const providers = useSyncExternalStore(store.subscribe, store.getProviders);\n//   return (\n//     <div>\n//       <h2>Detected EIP-6963 Wallets:</h2>\n//       {providers.length === 0 ? (\n//         <p>No EIP-6963 wallets found.</p>\n//       ) : (\n//         <ul>\n//           {providers.map((providerDetail) => (\n//             <li key={providerDetail.info.uuid}>\n//               <img src={providerDetail.info.icon} alt={providerDetail.info.name} width=\"24\" height=\"24\" />\n//               {providerDetail.info.name} ({providerDetail.info.rdns})\n//             </li>\n//           ))}\n//         </ul>\n//       )}\n//     </div>\n//   );\n// }","lang":"typescript","description":"Demonstrates how to initialize the EIP-6963 store, subscribe to provider announcements, retrieve current providers, and includes a conceptual React example using `useSyncExternalStore`.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}