{"_id":"mipd","_rev":"13-b43722a25b777b7fb37b7f1e33ce7088","name":"mipd","dist-tags":{"latest":"0.0.7","canary":"0.1.0-canary.20240404T022200"},"versions":{"0.0.0":{"name":"mipd","version":"0.0.0","_id":"mipd@0.0.0","_integrity":"sha512-BNg5ThIUjmPP3zPR0DkAGsBe9QB/0Em7RRJ5ZJ+Qcn/nP90pvCRi8IcJ0jk73oF3qydOQJZXXRDGjZjlryVQew==","_resolved":"/private/var/folders/6y/t77n7mhx7w96645q79sg26040000gn/T/6af4f835e417d7c551caa3f8136c3308/mipd-0.0.0.tgz","_from":"file:mipd-0.0.0.tgz","_nodeVersion":"20.2.0","_npmVersion":"9.6.6","dist":{"integrity":"sha512-BNg5ThIUjmPP3zPR0DkAGsBe9QB/0Em7RRJ5ZJ+Qcn/nP90pvCRi8IcJ0jk73oF3qydOQJZXXRDGjZjlryVQew==","shasum":"1f5aad93988e2bfe029f47ec488fce3f6b4d11ff","tarball":"https://registry.npmjs.org/mipd/-/mipd-0.0.0.tgz","fileCount":1,"unpackedSize":42,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCQA+BS/O8FsTlcpjI3qhsfqSUkJ8THO16T/etXyk6RBAIhALFSwKmDxsC4VMTm4pCFQOcJnS5StjfutOAunwDTOopw"}]},"_npmUser":{"name":"jmoxey","email":"jakemoxey@gmail.com"},"directories":{},"maintainers":[{"name":"jmoxey","email":"jakemoxey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mipd_0.0.0_1686357016862_0.7617981279796238"},"_hasShrinkwrap":false},"0.0.1":{"name":"mipd","description":"TypeScript Utilities for EIP-6963","dependencies":{"viem":"^1.1.4"},"peerDependencies":{"typescript":">=5.0.4"},"version":"0.0.1","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","default":"./dist/cjs/index.js"},"./window":{"types":"./dist/types/window.d.ts","import":"./dist/esm/window.js","default":"./dist/cjs/window.js"},"./package.json":"./package.json"},"main":"./dist/cjs/index.js","module":"./dist/esm/index.js","types":"./dist/types/index.d.ts","typings":"./dist/types/index.d.ts","typesVersions":{"*":{"window":["./src/window.d.ts"]}},"sideEffects":false,"license":"MIT","repository":{"type":"git","url":"git+https://github.com/wagmi-dev/mipd.git"},"authors":["awkweb.eth","jxom.eth"],"keywords":["eth","ethereum","dapps","wallet","web3"],"bugs":{"url":"https://github.com/wagmi-dev/mipd/issues"},"homepage":"https://github.com/wagmi-dev/mipd#readme","_id":"mipd@0.0.1","_integrity":"sha512-HXet/WIRPnz0Yfz1kHyyP1BhiQmJAPf10OIJ7JSkBeDMcnrob6AMSADlYeVFOIAHk26eehZ/dRkUMqFUK0Dxag==","_resolved":"/private/var/folders/6y/t77n7mhx7w96645q79sg26040000gn/T/078a4213595464ac24f88888a38eda41/mipd-0.0.1.tgz","_from":"file:mipd-0.0.1.tgz","_nodeVersion":"20.2.0","_npmVersion":"9.6.6","dist":{"integrity":"sha512-HXet/WIRPnz0Yfz1kHyyP1BhiQmJAPf10OIJ7JSkBeDMcnrob6AMSADlYeVFOIAHk26eehZ/dRkUMqFUK0Dxag==","shasum":"3c5cbb18e3695080657ab4fd59916c5d39792267","tarball":"https://registry.npmjs.org/mipd/-/mipd-0.0.1.tgz","fileCount":26,"unpackedSize":29816,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH0iyoF8C5Oc5blmuo8UkqZ3M5QwYSKlp5/2E2uo/OOLAiBM6YWxDvDOM+nLzbcL61mLnmHHRW6JQGx/j+PUBe58TQ=="}]},"_npmUser":{"name":"jmoxey","email":"jakemoxey@gmail.com"},"directories":{},"maintainers":[{"name":"jmoxey","email":"jakemoxey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mipd_0.0.1_1688100598154_0.793252690521554"},"_hasShrinkwrap":false},"0.0.2":{"name":"mipd","description":"TypeScript Utilities for EIP-6963","dependencies":{"viem":"^1.1.4"},"peerDependencies":{"typescript":">=5.0.4"},"version":"0.0.2","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","default":"./dist/cjs/index.js"},"./window":{"types":"./dist/types/window.d.ts","import":"./dist/esm/window.js","default":"./dist/cjs/window.js"},"./package.json":"./package.json"},"main":"./dist/cjs/index.js","module":"./dist/esm/index.js","types":"./dist/types/index.d.ts","typings":"./dist/types/index.d.ts","typesVersions":{"*":{"window":["./src/window.d.ts"]}},"sideEffects":false,"license":"MIT","repository":{"type":"git","url":"git+https://github.com/wagmi-dev/mipd.git"},"authors":["awkweb.eth","jxom.eth"],"keywords":["eth","ethereum","dapps","wallet","web3"],"bugs":{"url":"https://github.com/wagmi-dev/mipd/issues"},"homepage":"https://github.com/wagmi-dev/mipd#readme","_id":"mipd@0.0.2","_integrity":"sha512-j+qGLgML6Xgo9CYtkE1dTZgstakCJx/jOLAg4bAzc8kREFkVCyvRhZ/n10Xr6r5j+7ydVzXvslRTJRCeE1+NGg==","_resolved":"/private/var/folders/6y/t77n7mhx7w96645q79sg26040000gn/T/5cae7ffc559b4acffd319040efbcdbe7/mipd-0.0.2.tgz","_from":"file:mipd-0.0.2.tgz","_nodeVersion":"20.2.0","_npmVersion":"9.6.6","dist":{"integrity":"sha512-j+qGLgML6Xgo9CYtkE1dTZgstakCJx/jOLAg4bAzc8kREFkVCyvRhZ/n10Xr6r5j+7ydVzXvslRTJRCeE1+NGg==","shasum":"b19122024d68bf1101ed92fb3e1e0c88a1aa3a30","tarball":"https://registry.npmjs.org/mipd/-/mipd-0.0.2.tgz","fileCount":26,"unpackedSize":33368,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDPviwjiBNndtpf6zsbwJXqM8KHjIQSIjqwBBwGMH9HzgIhAJJUzAUjUAyqBZHbSt1q85pzNSmnZK25doHg+jNGNIUO"}]},"_npmUser":{"name":"jmoxey","email":"jakemoxey@gmail.com"},"directories":{},"maintainers":[{"name":"jmoxey","email":"jakemoxey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mipd_0.0.2_1688171824519_0.7285802893619084"},"_hasShrinkwrap":false},"0.0.3":{"name":"mipd","description":"TypeScript Utilities for EIP-6963","dependencies":{"viem":"^1.1.4"},"peerDependencies":{"typescript":">=5.0.4"},"version":"0.0.3","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","default":"./dist/cjs/index.js"},"./window":{"types":"./dist/types/window.d.ts","import":"./dist/esm/window.js","default":"./dist/cjs/window.js"},"./package.json":"./package.json"},"main":"./dist/cjs/index.js","module":"./dist/esm/index.js","types":"./dist/types/index.d.ts","typings":"./dist/types/index.d.ts","typesVersions":{"*":{"window":["./src/window.d.ts"]}},"sideEffects":false,"license":"MIT","repository":{"type":"git","url":"git+https://github.com/wagmi-dev/mipd.git"},"authors":["awkweb.eth","jxom.eth"],"keywords":["eth","ethereum","dapps","wallet","web3"],"bugs":{"url":"https://github.com/wagmi-dev/mipd/issues"},"homepage":"https://github.com/wagmi-dev/mipd#readme","_id":"mipd@0.0.3","_integrity":"sha512-vMoNlGydrcVjxVdGRAsr8iIuuXLwwNrZlBsSjb+Eb0iVOAYVK93ZaSsSjt75EkJzc+16yHt0ugawtGM9cdRfqQ==","_resolved":"/private/var/folders/6y/t77n7mhx7w96645q79sg26040000gn/T/bcfd30f54714fb8319f2c6dfed72f16b/mipd-0.0.3.tgz","_from":"file:mipd-0.0.3.tgz","_nodeVersion":"20.2.0","_npmVersion":"9.6.6","dist":{"integrity":"sha512-vMoNlGydrcVjxVdGRAsr8iIuuXLwwNrZlBsSjb+Eb0iVOAYVK93ZaSsSjt75EkJzc+16yHt0ugawtGM9cdRfqQ==","shasum":"f4181d094d843d1580d8efaff3dd4a65d854cfda","tarball":"https://registry.npmjs.org/mipd/-/mipd-0.0.3.tgz","fileCount":34,"unpackedSize":41271,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCT48BCHcxhI+FG2qm5ttEAyFz0Q4aFEoGMOJG6rGwUTQIgXuBEKHQYc+vajJk3kwJPuPTm87Z+C9dbUFY8jgN8PQI="}]},"_npmUser":{"name":"jmoxey","email":"jakemoxey@gmail.com"},"directories":{},"maintainers":[{"name":"jmoxey","email":"jakemoxey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mipd_0.0.3_1688173318619_0.9506594362628453"},"_hasShrinkwrap":false},"0.0.4":{"name":"mipd","description":"TypeScript Utilities for EIP-6963","dependencies":{"viem":"^1.1.4"},"peerDependencies":{"typescript":">=5.0.4"},"version":"0.0.4","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","default":"./dist/cjs/index.js"},"./window":{"types":"./dist/types/window.d.ts","import":"./dist/esm/window.js","default":"./dist/cjs/window.js"},"./package.json":"./package.json"},"main":"./dist/cjs/index.js","module":"./dist/esm/index.js","types":"./dist/types/index.d.ts","typings":"./dist/types/index.d.ts","typesVersions":{"*":{"window":["./src/window.d.ts"]}},"sideEffects":false,"license":"MIT","repository":{"type":"git","url":"git+https://github.com/wagmi-dev/mipd.git"},"authors":["awkweb.eth","jxom.eth"],"keywords":["eth","ethereum","dapps","wallet","web3"],"bugs":{"url":"https://github.com/wagmi-dev/mipd/issues"},"homepage":"https://github.com/wagmi-dev/mipd#readme","_id":"mipd@0.0.4","_integrity":"sha512-4YjCmjz4UpcSIF6vhnDPuW0CBBEd74rAo+eARbc3m6Zdf86TPPfoBFBP6JhwJysEJg3WIvDxNKEdUmcb0Xmh0Q==","_resolved":"/private/var/folders/6y/t77n7mhx7w96645q79sg26040000gn/T/a17fd7d4a2c7ad84c866e316135652eb/mipd-0.0.4.tgz","_from":"file:mipd-0.0.4.tgz","_nodeVersion":"20.2.0","_npmVersion":"9.6.6","dist":{"integrity":"sha512-4YjCmjz4UpcSIF6vhnDPuW0CBBEd74rAo+eARbc3m6Zdf86TPPfoBFBP6JhwJysEJg3WIvDxNKEdUmcb0Xmh0Q==","shasum":"1c4244f53bd293b3ce38368b8db95100bd06514f","tarball":"https://registry.npmjs.org/mipd/-/mipd-0.0.4.tgz","fileCount":28,"unpackedSize":34287,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC5S0x9OAcZgGAkuU60aV88EOVI+LOnTZ2xZCy/+QKfLgIgW+pOswbBQ0L9ToOF/H3jVOytyv/nhgsFOLULgv2XZsg="}]},"_npmUser":{"name":"jmoxey","email":"jakemoxey@gmail.com"},"directories":{},"maintainers":[{"name":"jmoxey","email":"jakemoxey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mipd_0.0.4_1688270233030_0.614845286127129"},"_hasShrinkwrap":false},"0.1.0-canary.20230704T065839":{"name":"mipd","description":"TypeScript Utilities for EIP-6963","version":"0.1.0-canary.20230704T065839","license":"MIT","repository":{"type":"git","url":"git+https://github.com/wagmi-dev/mipd.git"},"sideEffects":false,"main":"./dist/cjs/index.js","module":"./dist/esm/index.js","types":"./dist/types/index.d.ts","typings":"./dist/types/index.d.ts","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","default":"./dist/cjs/index.js"},"./window":{"types":"./dist/types/window.d.ts","import":"./dist/esm/window.js","default":"./dist/cjs/window.js"},"./package.json":"./package.json"},"typesVersions":{"*":{"window":["./src/window.d.ts"]}},"peerDependencies":{"typescript":">=5.0.4"},"peerDependenciesMeta":{"typescript":{"optional":true}},"dependencies":{"viem":"^1.1.4"},"contributors":[{"name":"jxom.eth","email":"j@wagmi.sh"},{"name":"awkweb.eth","email":"t@wagmi.sh"}],"funding":[{"type":"github","url":"https://github.com/sponsors/wagmi-dev"}],"keywords":["eth","ethereum","dapps","wallet","web3","eip","6963"],"readme":"<br/>\n\n<p align=\"center\">\n    <picture>\n      <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://github.com/wagmi-dev/mipd/blob/main/.github/mipd-dark-hug.svg\">\n      <img alt=\"mipd logo\" src=\"https://github.com/wagmi-dev/mipd/blob/main/.github/mipd-light-hug.svg\" width=\"auto\" height=\"60\">\n    </picture>\n</p>\n\n<p align=\"center\">\n  TypeScript Utilities for <a href=\"https://eips.ethereum.org/EIPS/eip-6963\">EIP-6963: Multi Injected Provider Discovery</a>\n<p>\n\n## Contents\n\n- [Install](#install)\n- [Store](#store)\n- [Utilities](#utilities)\n  - [`requestProviders`](#requestproviders)\n  - [`announceProvider`](#announceprovider)\n- [`window` Type Polyfill](#window-polyfill)\n- [Types](#types)\n- [Configuration](#configuration)\n\n## Install\n\n```bash\nnpm i mipd\n```\n\n```bash\npnpm add mipd\n```\n\n```bash\nyarn add mipd\n```\n\n## Store\n\nThe MIPD Store stores the Providers that have been emitted by a Wallet (or other source), and provides a way to subscribe to the store and retrieve the Providers.\n\n### Overview\n\n```ts\nimport { createStore } from 'mipd'\n\n// Set up a MIPD Store, and request Providers.\nconst store = createStore()\n\n// Subscribe to the MIPD Store.\nstore.subscribe(providerDetails => {\n  console.log(providerDetails)\n  // => [EIP6963ProviderDetail, EIP6963ProviderDetail, ...]\n})\n\n// Retrieve emitted Providers.\nstore.getProviders()\n// => [EIP6963ProviderDetail, EIP6963ProviderDetail, ...]\n\n// Find a Provider Detail.\nstore.findProvider({ rdns: 'com.example' })\n// => EIP6963ProviderDetail | undefined\n\n// Clear the store, including all Providers.\nstore.clear()\n\n// Reset the store, and emit an event to request Providers.\nstore.reset()\n\n// Destroy the store, and remove all Providers and event listeners.\nstore.destroy()\n```\n\n### Usage\n\n#### Vanilla JS\n\n```tsx\nimport { useSyncExternalStore } from 'react'\nimport { createStore } from 'mipd'\n\nconst store = createStore()\n\nlet providers = store.getProviders()\nstore.subscribe(providerDetails => (providers = providerDetails))\n```\n\n#### React\n\n```tsx\nimport { useSyncExternalStore } from 'react'\nimport { createStore } from 'mipd'\n\nconst store = createStore()\n\nfunction Example() {\n  const providers = useSyncExternalStore(store.subscribe, store.getProviders)\n  // ...\n}\n```\n\n#### Svelte\n\n```html\n<script lang=\"ts\">\n  import { readable } from 'svelte/store'\n  import { createStore } from 'mipd'\n  \n  const store = createStore()\n  const providers = readable(store.getProviders(), store.subscribe)\n</script>\n\n<!-- ... -->\n```\n\n#### Vue\n\n```html\n<script setup lang=\"ts\">\n  import { reactive } from 'vue'\n  import { createStore } from 'mipd'\n\n  const store = createStore()\n  const state = reactive({ providers: store.getProviders() })\n  store.subscribe(providers => (state.providers = providers))\n</script>\n\n<!-- ... -->\n```\n\n### API\n\n#### createStore()\n\nCreates a MIPD Store, and emits an event to request Providers from the Wallet(s).\n\n```ts\nconst store = createStore()\n```\n\n#### store.subscribe(listener, args)\n\nSubscribes to the MIPD Store, and returns a function to unsubscribe.\n\n```ts\nconst unsubscribe = store.subscribe(providers => {\n  console.log(providers)\n  // => [EIP6963ProviderDetail, EIP6963ProviderDetail, ...]\n})\n```\n\n**Definition**\n\n```ts\nexport type Listener = (\n  // The updated Providers store.\n  providerDetails: EIP6963ProviderDetail[],\n  meta?: {\n    // The Providers that were added to the store.\n    added?: EIP6963ProviderDetail[]\n    // The Providers that were removed from the store.\n    removed?: EIP6963ProviderDetail[]\n  },\n) => void\n\nfunction subscribe(\n  // The listener function.\n  listener: Listener, \n  args?: { \n    // If `true`, the listener will be called immediately with the stored Providers.\n    emitImmediately?: boolean \n  }\n): () => void // Returns an unsubscribe function.\n```\n\n#### store.getProviders()\n\nReturns the current Providers.\n\n```ts\nconst providers = store.getProviders()\n// => [EIP6963ProviderDetail, EIP6963ProviderDetail, ...]\n```\n\n**Definition**\n\n```ts\nfunction getProviders(): EIP6963ProviderDetail[]\n```\n\n#### store.findProvider(args)\n\nFinds a provider detail by its RDNS (Reverse Domain Name Identifier).\n\n```ts\nconst provider = store.findProvider({ rdns: 'com.example' })\n```\n\n**Definition**\n\n```ts\nfunction findProvider(args: { \n  // The RDNS of the Provider Detail to find.\n  rdns: string \n}): EIP6963ProviderDetail | undefined\n```\n\n#### store.clear()\n\nClears the store, including all Providers.\n\n```ts\nstore.clear()\n```\n\n**Definition**\n\n```ts\nfunction clear(): void\n```\n\n#### store.reset()\n\nResets the store, and emits an event to request Providers from the Wallet(s).\n\n```ts\nstore.reset()\n```\n\n**Definition**\n\n```ts\nfunction reset(): void\n```\n\n#### store.destroy()\n\nDestroys the store, and removes all Providers and event listeners.\n\n```ts\nstore.destroy()\n```\n\n**Definition**\n\n```ts\nfunction destroy(): void\n```\n\n## Utilities\n\n### requestProviders\n\nThe `requestProviders` utility emits an event to request Providers from the Wallet(s). It returns an `unsubscribe` function to clean up event listeners.\n\n```ts\nimport { requestProviders } from 'mipd'\n\nlet providers = []\n\nconst unsubscribe = requestProviders(providerDetail => providers.push(providerDetail))\n```\n\n**Definition**\n\n```ts\nfunction requestProviders(\n  // The listener.\n  listener: (providerDetail: EIP6963ProviderDetail) => void\n// Unsubscribe function to clean up the listener.\n): () => void\n```\n\n### announceProvider\n\nThe `announceProvider` utility emits an event to announce a Provider to the Wallet(s), and also listen for incoming requests. It returns an `unsubscribe` function to clean up event listeners.\n\n```ts\nimport { announceProvider } from 'mipd'\n\nconst unsubscribe = announceProvider({\n  info: {\n    icon: 'https://example.com/icon.png',\n    name: 'Example',\n    rdns: 'com.example',\n    uuid: '00000000-0000-0000-0000-000000000000'\n  },\n  provider: new EIP1193Provider()\n})\n```\n\n**Definition**\n\n```ts\nfunction requestProviders(\n  // The EIP-1193 Provider and Provider Info.\n  detail: EIP6963ProviderDetail\n// Unsubscribe function to clean up the listener.\n): () => void\n```\n\n## `window` Polyfill\n\nBy importing the `mipd/window` Polyfill, the types on `window.addEventListener` will be inferred to include the `EIP6963AnnounceProviderEvent` and `EIP6963RequestProviderEvent` types.\n\n```ts\nimport 'mipd/window'\n\nwindow.addEventListener(\n  'eip6963:announceProvider'\n  // ^? 'eip6963:announceProvider' | 'eip6963:requestProvider' | 'click' | ...\n\n  event => {\n  // ^? EIP6963AnnounceProviderEvent\n\n    event.type\n    //    ^? 'eip6963:announceProvider'\n    event.detail\n    //    ^? EIP6963ProviderDetail\n    event.detail.info\n    //           ^? EIP6963ProviderInfo\n    event.detail.provider\n    //           ^? EIP1193Provider\n  }\n)\n\nwindow.addEventListener(\n  'eip6963:requestProvider'\n  // ^? 'eip6963:announceProvider' | 'eip6963:requestProvider' | 'click' | ...\n\n  event => {\n  // ^? EIP6963RequestProviderEvent\n\n    event.type\n    //    ^? 'eip6963:requestProvider'\n  }\n)\n```\n\n## Types\n\n### EIP6963ProviderDetail\n\nEvent detail from `eip6963:announceProvider`.\n\n#### Import\n\n```ts\nimport { type EIP6963ProviderDetail } from 'mipd'\n```\n\n#### Definition\n\n```ts\nexport interface EIP6963ProviderDetail<TProvider = Config['EIP1193Provider']> {\n  info: EIP6963ProviderInfo\n  provider: TProvider\n}\n```\n\n### EIP6963ProviderInfo\n\nMetadata of the EIP-1193 Provider.\n\n#### Import\n\n```ts\nimport { type EIP6963ProviderInfo } from 'mipd'\n```\n\n#### Definition\n\n```ts\nexport interface EIP6963ProviderInfo {\n  icon: string\n  name: string\n  rdns?: ... | (string & {})\n  uuid: string\n}\n```\n\n### EIP6963AnnounceProviderEvent\n\nEvent type to announce an EIP-1193 Provider.\n\n#### Import\n\n```ts\nimport { type EIP6963AnnounceProviderEvent } from 'mipd'\n```\n\n#### Definition\n\n```ts\nexport interface EIP6963AnnounceProviderEvent<TProvider = DefaultProvider>\n  extends CustomEvent<EIP6963ProviderDetail<TProvider>> {\n  type: 'eip6963:announceProvider'\n}\n```\n\n### EIP6963RequestProviderEvent\n\nEvent type to request EIP-1193 Providers.\n\n#### Import\n\n```ts\nimport { type EIP6963RequestProviderEvent } from 'mipd'\n```\n\n#### Definition\n\n```ts\nexport interface EIP6963RequestProviderEvent extends Event {\n  type: 'eip6963:requestProvider'\n}\n```\n\n## Configuration\n\nIn some cases you might want to tune the global types (e.g. the `EIP1193Provider`). To do this, the following configuration options are available:\n\n| Type                | Default                                                        | Description            |\n| ------------------- | -------------------------------------------------------------- | ---------------------- |\n| `provider`          | `import('viem').EIP1193Provider`                               | The EIP-1193 Provider. |\n| `rdns`              | `'com.coinbase' | 'com.enkrypt' | 'io.metamask' | 'io.zerion'` | Deterministic identifier for the Provider in the form of an rDNS (Reverse Domain Name Notation) |\n\nConfiguration options are customizable using [declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html). Extend the `Register` interface either directly in your code or in a `d.ts` file (e.g. `eip6963.d.ts`):\n\n```ts\nimport { type EIP1193Provider } from './eip1193-provider'\n\ndeclare module 'mipd' {\n  interface Register {\n    provider: EIP1193Provider\n  }\n}\n```\n\n## Authors\n\n- [@jxom](https://github.com/jxom) (jxom.eth, [Twitter](https://twitter.com/jakemoxey))\n- [@tmm](https://github.com/tmm) (awkweb.eth, [Twitter](https://twitter.com/awkweb))\n\n## License\n\n[MIT](/LICENSE) License\n","readmeFilename":"README.md","gitHead":"4ce3665a560df76ce89e6a42d0aad3436bdb3dde","bugs":{"url":"https://github.com/wagmi-dev/mipd/issues"},"homepage":"https://github.com/wagmi-dev/mipd#readme","_id":"mipd@0.1.0-canary.20230704T065839","_nodeVersion":"18.16.1","_npmVersion":"9.5.1","dist":{"integrity":"sha512-jM0Bsp0OuN51fnGr2LDtoHIbFKeexXfXesfdAC+x85lA4xjNS9qFv9+NBw5SFsunex9pJsQfVub7FXJkwepAHg==","shasum":"1ec63708b0e940eafd7c070a484ca248fa46cf54","tarball":"https://registry.npmjs.org/mipd/-/mipd-0.1.0-canary.20230704T065839.tgz","fileCount":47,"unpackedSize":39742,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFhdN2pMg2DrL0uJaqGO2V7g3QOOv8VpUbqBxwhU6nNTAiB5gSb7e8+XlEXC1JTzesK7lQn10oUme7xVUJELaAsdJw=="}]},"_npmUser":{"name":"jmoxey","email":"jakemoxey@gmail.com"},"directories":{},"maintainers":[{"name":"awkweb","email":"tom@meagher.co"},{"name":"jmoxey","email":"jakemoxey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mipd_0.1.0-canary.20230704T065839_1688453930713_0.5407026023478674"},"_hasShrinkwrap":false},"0.0.5":{"name":"mipd","description":"TypeScript Utilities for EIP-6963","version":"0.0.5","license":"MIT","repository":{"type":"git","url":"git+https://github.com/wagmi-dev/mipd.git"},"sideEffects":false,"main":"./dist/cjs/index.js","module":"./dist/esm/index.js","types":"./dist/types/index.d.ts","typings":"./dist/types/index.d.ts","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","default":"./dist/cjs/index.js"},"./window":{"types":"./dist/types/window.d.ts","import":"./dist/esm/window.js","default":"./dist/cjs/window.js"},"./package.json":"./package.json"},"typesVersions":{"*":{"window":["./src/window.d.ts"]}},"peerDependencies":{"typescript":">=5.0.4"},"peerDependenciesMeta":{"typescript":{"optional":true}},"dependencies":{"viem":"^1.1.4"},"contributors":[{"name":"jxom.eth","email":"j@wagmi.sh"},{"name":"awkweb.eth","email":"t@wagmi.sh"}],"funding":[{"type":"github","url":"https://github.com/sponsors/wagmi-dev"}],"keywords":["eth","ethereum","dapps","wallet","web3","eip","6963"],"bugs":{"url":"https://github.com/wagmi-dev/mipd/issues"},"homepage":"https://github.com/wagmi-dev/mipd#readme","_id":"mipd@0.0.5","_integrity":"sha512-gbKA784D2WKb5H/GtqEv+Ofd1S9Zj+Z/PGDIl1u1QAbswkxD28BQ5bSXQxkeBzPBABg1iDSbiwGG1XqlOxRspA==","_resolved":"/tmp/82740766ff61054e4b8b58a77815284a/mipd-0.0.5.tgz","_from":"file:mipd-0.0.5.tgz","_nodeVersion":"18.16.1","_npmVersion":"9.5.1","dist":{"integrity":"sha512-gbKA784D2WKb5H/GtqEv+Ofd1S9Zj+Z/PGDIl1u1QAbswkxD28BQ5bSXQxkeBzPBABg1iDSbiwGG1XqlOxRspA==","shasum":"367ee796531c23f0631f129038700b1406663aec","tarball":"https://registry.npmjs.org/mipd/-/mipd-0.0.5.tgz","fileCount":48,"unpackedSize":40378,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDh+CscgK8IVblSa4A8z7pCFA6zozY3OW/Z43ASjgX9xwIhAMhZI5kztg1nuWEF+zt50gX/XMuas4Cug/yiEgnp3Hz5"}]},"_npmUser":{"name":"jmoxey","email":"jakemoxey@gmail.com"},"directories":{},"maintainers":[{"name":"awkweb","email":"tom@meagher.co"},{"name":"jmoxey","email":"jakemoxey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mipd_0.0.5_1688453933213_0.1557617479229496"},"_hasShrinkwrap":false},"0.1.0-canary.20230720T053946":{"name":"mipd","description":"TypeScript Utilities for EIP-6963","version":"0.1.0-canary.20230720T053946","license":"MIT","repository":{"type":"git","url":"git+https://github.com/wagmi-dev/mipd.git"},"sideEffects":false,"main":"./dist/cjs/index.js","module":"./dist/esm/index.js","types":"./dist/types/index.d.ts","typings":"./dist/types/index.d.ts","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","default":"./dist/cjs/index.js"},"./window":{"types":"./dist/types/window.d.ts","import":"./dist/esm/window.js","default":"./dist/cjs/window.js"},"./package.json":"./package.json"},"typesVersions":{"*":{"window":["./src/window.d.ts"]}},"peerDependencies":{"typescript":">=5.0.4"},"peerDependenciesMeta":{"typescript":{"optional":true}},"dependencies":{"viem":"^1.1.4"},"contributors":[{"name":"jxom.eth","email":"j@wagmi.sh"},{"name":"awkweb.eth","email":"t@wagmi.sh"}],"funding":[{"type":"github","url":"https://github.com/sponsors/wagmi-dev"}],"keywords":["eth","ethereum","dapps","wallet","web3","eip","6963"],"readme":"<br/>\n\n<p align=\"center\">\n    <picture>\n      <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://github.com/wagmi-dev/mipd/blob/main/.github/mipd-dark-hug.svg\">\n      <img alt=\"mipd logo\" src=\"https://github.com/wagmi-dev/mipd/blob/main/.github/mipd-light-hug.svg\" width=\"auto\" height=\"60\">\n    </picture>\n</p>\n\n<p align=\"center\">\n  TypeScript Utilities for <a href=\"https://eips.ethereum.org/EIPS/eip-6963\">EIP-6963: Multi Injected Provider Discovery</a>\n<p>\n\n## Contents\n\n- [Install](#install)\n- [Store](#store)\n- [Utilities](#utilities)\n  - [`requestProviders`](#requestproviders)\n  - [`announceProvider`](#announceprovider)\n- [`window` Type Polyfill](#window-polyfill)\n- [Types](#types)\n- [Configuration](#configuration)\n\n## Install\n\n```bash\nnpm i mipd\n```\n\n```bash\npnpm add mipd\n```\n\n```bash\nyarn add mipd\n```\n\n## Store\n\nThe MIPD Store stores the Providers that have been emitted by a Wallet (or other source), and provides a way to subscribe to the store and retrieve the Providers.\n\n### Overview\n\n```ts\nimport { createStore } from 'mipd'\n\n// Set up a MIPD Store, and request Providers.\nconst store = createStore()\n\n// Subscribe to the MIPD Store.\nstore.subscribe(providerDetails => {\n  console.log(providerDetails)\n  // => [EIP6963ProviderDetail, EIP6963ProviderDetail, ...]\n})\n\n// Retrieve emitted Providers.\nstore.getProviders()\n// => [EIP6963ProviderDetail, EIP6963ProviderDetail, ...]\n\n// Find a Provider Detail.\nstore.findProvider({ rdns: 'com.example' })\n// => EIP6963ProviderDetail | undefined\n\n// Clear the store, including all Providers.\nstore.clear()\n\n// Reset the store, and emit an event to request Providers.\nstore.reset()\n\n// Destroy the store, and remove all Providers and event listeners.\nstore.destroy()\n```\n\n### Usage\n\n#### Vanilla JS\n\n```tsx\nimport { useSyncExternalStore } from 'react'\nimport { createStore } from 'mipd'\n\nconst store = createStore()\n\nlet providers = store.getProviders()\nstore.subscribe(providerDetails => (providers = providerDetails))\n```\n\n#### React\n\n```tsx\nimport { useSyncExternalStore } from 'react'\nimport { createStore } from 'mipd'\n\nconst store = createStore()\n\nfunction Example() {\n  const providers = useSyncExternalStore(store.subscribe, store.getProviders)\n  // ...\n}\n```\n\n#### Svelte\n\n```html\n<script lang=\"ts\">\n  import { readable } from 'svelte/store'\n  import { createStore } from 'mipd'\n  \n  const store = createStore()\n  const providers = readable(store.getProviders(), store.subscribe)\n</script>\n\n<!-- ... -->\n```\n\n#### Vue\n\n```html\n<script setup lang=\"ts\">\n  import { reactive } from 'vue'\n  import { createStore } from 'mipd'\n\n  const store = createStore()\n  const state = reactive({ providers: store.getProviders() })\n  store.subscribe(providers => (state.providers = providers))\n</script>\n\n<!-- ... -->\n```\n\n### API\n\n#### createStore()\n\nCreates a MIPD Store, and emits an event to request Providers from the Wallet(s).\n\n```ts\nconst store = createStore()\n```\n\n#### store.subscribe(listener, args)\n\nSubscribes to the MIPD Store, and returns a function to unsubscribe.\n\n```ts\nconst unsubscribe = store.subscribe(providers => {\n  console.log(providers)\n  // => [EIP6963ProviderDetail, EIP6963ProviderDetail, ...]\n})\n```\n\n**Definition**\n\n```ts\nexport type Listener = (\n  // The updated Providers store.\n  providerDetails: EIP6963ProviderDetail[],\n  meta?: {\n    // The Providers that were added to the store.\n    added?: EIP6963ProviderDetail[]\n    // The Providers that were removed from the store.\n    removed?: EIP6963ProviderDetail[]\n  },\n) => void\n\nfunction subscribe(\n  // The listener function.\n  listener: Listener, \n  args?: { \n    // If `true`, the listener will be called immediately with the stored Providers.\n    emitImmediately?: boolean \n  }\n): () => void // Returns an unsubscribe function.\n```\n\n#### store.getProviders()\n\nReturns the current Providers.\n\n```ts\nconst providers = store.getProviders()\n// => [EIP6963ProviderDetail, EIP6963ProviderDetail, ...]\n```\n\n**Definition**\n\n```ts\nfunction getProviders(): EIP6963ProviderDetail[]\n```\n\n#### store.findProvider(args)\n\nFinds a provider detail by its RDNS (Reverse Domain Name Identifier).\n\n```ts\nconst provider = store.findProvider({ rdns: 'com.example' })\n```\n\n**Definition**\n\n```ts\nfunction findProvider(args: { \n  // The RDNS of the Provider Detail to find.\n  rdns: string \n}): EIP6963ProviderDetail | undefined\n```\n\n#### store.clear()\n\nClears the store, including all Providers.\n\n```ts\nstore.clear()\n```\n\n**Definition**\n\n```ts\nfunction clear(): void\n```\n\n#### store.reset()\n\nResets the store, and emits an event to request Providers from the Wallet(s).\n\n```ts\nstore.reset()\n```\n\n**Definition**\n\n```ts\nfunction reset(): void\n```\n\n#### store.destroy()\n\nDestroys the store, and removes all Providers and event listeners.\n\n```ts\nstore.destroy()\n```\n\n**Definition**\n\n```ts\nfunction destroy(): void\n```\n\n## Utilities\n\n### requestProviders\n\nThe `requestProviders` utility emits an event to request Providers from the Wallet(s). It returns an `unsubscribe` function to clean up event listeners.\n\n```ts\nimport { requestProviders } from 'mipd'\n\nlet providers = []\n\nconst unsubscribe = requestProviders(providerDetail => providers.push(providerDetail))\n```\n\n**Definition**\n\n```ts\nfunction requestProviders(\n  // The listener.\n  listener: (providerDetail: EIP6963ProviderDetail) => void\n// Unsubscribe function to clean up the listener.\n): () => void\n```\n\n### announceProvider\n\nThe `announceProvider` utility emits an event to announce a Provider to the Wallet(s), and also listen for incoming requests. It returns an `unsubscribe` function to clean up event listeners.\n\n```ts\nimport { announceProvider } from 'mipd'\n\nconst unsubscribe = announceProvider({\n  info: {\n    icon: 'https://example.com/icon.png',\n    name: 'Example',\n    rdns: 'com.example',\n    uuid: '00000000-0000-0000-0000-000000000000'\n  },\n  provider: new EIP1193Provider()\n})\n```\n\n**Definition**\n\n```ts\nfunction requestProviders(\n  // The EIP-1193 Provider and Provider Info.\n  detail: EIP6963ProviderDetail\n// Unsubscribe function to clean up the listener.\n): () => void\n```\n\n## `window` Polyfill\n\nBy importing the `mipd/window` Polyfill, the types on `window.addEventListener` will be inferred to include the `EIP6963AnnounceProviderEvent` and `EIP6963RequestProviderEvent` types.\n\n```ts\nimport 'mipd/window'\n\nwindow.addEventListener(\n  'eip6963:announceProvider'\n  // ^? 'eip6963:announceProvider' | 'eip6963:requestProvider' | 'click' | ...\n\n  event => {\n  // ^? EIP6963AnnounceProviderEvent\n\n    event.type\n    //    ^? 'eip6963:announceProvider'\n    event.detail\n    //    ^? EIP6963ProviderDetail\n    event.detail.info\n    //           ^? EIP6963ProviderInfo\n    event.detail.provider\n    //           ^? EIP1193Provider\n  }\n)\n\nwindow.addEventListener(\n  'eip6963:requestProvider'\n  // ^? 'eip6963:announceProvider' | 'eip6963:requestProvider' | 'click' | ...\n\n  event => {\n  // ^? EIP6963RequestProviderEvent\n\n    event.type\n    //    ^? 'eip6963:requestProvider'\n  }\n)\n```\n\n## Types\n\n### EIP6963ProviderDetail\n\nEvent detail from `eip6963:announceProvider`.\n\n#### Import\n\n```ts\nimport { type EIP6963ProviderDetail } from 'mipd'\n```\n\n#### Definition\n\n```ts\nexport interface EIP6963ProviderDetail<TProvider = Config['EIP1193Provider']> {\n  info: EIP6963ProviderInfo\n  provider: TProvider\n}\n```\n\n### EIP6963ProviderInfo\n\nMetadata of the EIP-1193 Provider.\n\n#### Import\n\n```ts\nimport { type EIP6963ProviderInfo } from 'mipd'\n```\n\n#### Definition\n\n```ts\nexport interface EIP6963ProviderInfo {\n  icon: string\n  name: string\n  rdns?: ... | (string & {})\n  uuid: string\n}\n```\n\n### EIP6963AnnounceProviderEvent\n\nEvent type to announce an EIP-1193 Provider.\n\n#### Import\n\n```ts\nimport { type EIP6963AnnounceProviderEvent } from 'mipd'\n```\n\n#### Definition\n\n```ts\nexport interface EIP6963AnnounceProviderEvent<TProvider = DefaultProvider>\n  extends CustomEvent<EIP6963ProviderDetail<TProvider>> {\n  type: 'eip6963:announceProvider'\n}\n```\n\n### EIP6963RequestProviderEvent\n\nEvent type to request EIP-1193 Providers.\n\n#### Import\n\n```ts\nimport { type EIP6963RequestProviderEvent } from 'mipd'\n```\n\n#### Definition\n\n```ts\nexport interface EIP6963RequestProviderEvent extends Event {\n  type: 'eip6963:requestProvider'\n}\n```\n\n## Configuration\n\nIn some cases you might want to tune the global types (e.g. the `EIP1193Provider`). To do this, the following configuration options are available:\n\n| Type                | Default                                                        | Description            |\n| ------------------- | -------------------------------------------------------------- | ---------------------- |\n| `provider`          | `import('viem').EIP1193Provider`                               | The EIP-1193 Provider. |\n| `rdns`              | `'com.coinbase' \\| 'com.enkrypt' \\| 'io.metamask' \\| 'io.zerion' \\| (string & {})` | Deterministic identifier for the Provider in the form of an rDNS (Reverse Domain Name Notation) |\n\nConfiguration options are customizable using [declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html). Extend the `Register` interface either directly in your code or in a `d.ts` file (e.g. `eip6963.d.ts`):\n\n```ts\nimport { type EIP1193Provider } from './eip1193-provider'\n\ndeclare module 'mipd' {\n  interface Register {\n    provider: EIP1193Provider\n  }\n}\n```\n\n## Authors\n\n- [@jxom](https://github.com/jxom) (jxom.eth, [Twitter](https://twitter.com/jakemoxey))\n- [@tmm](https://github.com/tmm) (awkweb.eth, [Twitter](https://twitter.com/awkweb))\n\n## License\n\n[MIT](/LICENSE) License\n","readmeFilename":"README.md","gitHead":"e434322810750ed5d4ba4993f25e68f7fcd50086","bugs":{"url":"https://github.com/wagmi-dev/mipd/issues"},"homepage":"https://github.com/wagmi-dev/mipd#readme","_id":"mipd@0.1.0-canary.20230720T053946","_nodeVersion":"18.16.1","_npmVersion":"9.5.1","dist":{"integrity":"sha512-NMotRWadcW5yPEFwO8LpVIdqml1Zi2D0GCa8cUcW9vU42JUK3nSDznQV15+TxRbmVGP8QZu2wE+7AjyfbRd1XA==","shasum":"886830898c627e8173ac4546e8e56558c4e803a3","tarball":"https://registry.npmjs.org/mipd/-/mipd-0.1.0-canary.20230720T053946.tgz","fileCount":47,"unpackedSize":39762,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDJgwESJyj8wuh/L/UJ3mYvKbdq0tGkT3GZquLlxGgymAiB01Wa1Wj1kNwfjt+cR+079aAPBQC1J26mLecLp0I9WbA=="}]},"_npmUser":{"name":"jmoxey","email":"jakemoxey@gmail.com"},"directories":{},"maintainers":[{"name":"awkweb","email":"tom@meagher.co"},{"name":"jmoxey","email":"jakemoxey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mipd_0.1.0-canary.20230720T053946_1689831597461_0.39878023563235554"},"_hasShrinkwrap":false},"0.1.0-canary.20230825T175705":{"name":"mipd","description":"TypeScript Utilities for EIP-6963","version":"0.1.0-canary.20230825T175705","license":"MIT","repository":{"type":"git","url":"git+https://github.com/wagmi-dev/mipd.git"},"sideEffects":false,"main":"./dist/cjs/index.js","module":"./dist/esm/index.js","types":"./dist/types/index.d.ts","typings":"./dist/types/index.d.ts","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","default":"./dist/cjs/index.js"},"./window":{"types":"./dist/types/window.d.ts","import":"./dist/esm/window.js","default":"./dist/cjs/window.js"},"./package.json":"./package.json"},"typesVersions":{"*":{"window":["./src/window.d.ts"]}},"peerDependencies":{"typescript":">=5.0.4"},"peerDependenciesMeta":{"typescript":{"optional":true}},"dependencies":{"viem":"^1.1.4"},"contributors":[{"name":"jxom.eth","email":"j@wagmi.sh"},{"name":"awkweb.eth","email":"t@wagmi.sh"}],"funding":[{"type":"github","url":"https://github.com/sponsors/wagmi-dev"}],"keywords":["eth","ethereum","dapps","wallet","web3","eip","6963"],"readme":"<br/>\n\n<p align=\"center\">\n    <picture>\n      <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://github.com/wagmi-dev/mipd/blob/main/.github/mipd-dark-hug.svg\">\n      <img alt=\"mipd logo\" src=\"https://github.com/wagmi-dev/mipd/blob/main/.github/mipd-light-hug.svg\" width=\"auto\" height=\"60\">\n    </picture>\n</p>\n\n<p align=\"center\">\n  TypeScript Utilities for <a href=\"https://eips.ethereum.org/EIPS/eip-6963\">EIP-6963: Multi Injected Provider Discovery</a>\n<p>\n\n## Contents\n\n- [Install](#install)\n- [Store](#store)\n- [Utilities](#utilities)\n  - [`requestProviders`](#requestproviders)\n  - [`announceProvider`](#announceprovider)\n- [`window` Type Polyfill](#window-polyfill)\n- [Types](#types)\n- [Configuration](#configuration)\n\n## Install\n\n```bash\nnpm i mipd\n```\n\n```bash\npnpm add mipd\n```\n\n```bash\nyarn add mipd\n```\n\n## Store\n\nThe MIPD Store stores the Providers that have been emitted by a Wallet (or other source), and provides a way to subscribe to the store and retrieve the Providers.\n\n### Overview\n\n```ts\nimport { createStore } from 'mipd'\n\n// Set up a MIPD Store, and request Providers.\nconst store = createStore()\n\n// Subscribe to the MIPD Store.\nstore.subscribe(providerDetails => {\n  console.log(providerDetails)\n  // => [EIP6963ProviderDetail, EIP6963ProviderDetail, ...]\n})\n\n// Retrieve emitted Providers.\nstore.getProviders()\n// => [EIP6963ProviderDetail, EIP6963ProviderDetail, ...]\n\n// Find a Provider Detail.\nstore.findProvider({ rdns: 'com.example' })\n// => EIP6963ProviderDetail | undefined\n\n// Clear the store, including all Providers.\nstore.clear()\n\n// Reset the store, and emit an event to request Providers.\nstore.reset()\n\n// Destroy the store, and remove all Providers and event listeners.\nstore.destroy()\n```\n\n### Usage\n\n#### Vanilla JS\n\n```tsx\nimport { useSyncExternalStore } from 'react'\nimport { createStore } from 'mipd'\n\nconst store = createStore()\n\nlet providers = store.getProviders()\nstore.subscribe(providerDetails => (providers = providerDetails))\n```\n\n#### React\n\n```tsx\nimport { useSyncExternalStore } from 'react'\nimport { createStore } from 'mipd'\n\nconst store = createStore()\n\nfunction Example() {\n  const providers = useSyncExternalStore(store.subscribe, store.getProviders)\n  // ...\n}\n```\n\n#### Svelte\n\n```html\n<script lang=\"ts\">\n  import { readable } from 'svelte/store'\n  import { createStore } from 'mipd'\n  \n  const store = createStore()\n  const providers = readable(store.getProviders(), store.subscribe)\n</script>\n\n<!-- ... -->\n```\n\n#### Vue\n\n```html\n<script setup lang=\"ts\">\n  import { reactive } from 'vue'\n  import { createStore } from 'mipd'\n\n  const store = createStore()\n  const state = reactive({ providers: store.getProviders() })\n  store.subscribe(providers => (state.providers = providers))\n</script>\n\n<!-- ... -->\n```\n\n### API\n\n#### createStore()\n\nCreates a MIPD Store, and emits an event to request Providers from the Wallet(s).\n\n```ts\nconst store = createStore()\n```\n\n#### store.subscribe(listener, args)\n\nSubscribes to the MIPD Store, and returns a function to unsubscribe.\n\n```ts\nconst unsubscribe = store.subscribe(providers => {\n  console.log(providers)\n  // => [EIP6963ProviderDetail, EIP6963ProviderDetail, ...]\n})\n```\n\n**Definition**\n\n```ts\nexport type Listener = (\n  // The updated Providers store.\n  providerDetails: EIP6963ProviderDetail[],\n  meta?: {\n    // The Providers that were added to the store.\n    added?: EIP6963ProviderDetail[]\n    // The Providers that were removed from the store.\n    removed?: EIP6963ProviderDetail[]\n  },\n) => void\n\nfunction subscribe(\n  // The listener function.\n  listener: Listener, \n  args?: { \n    // If `true`, the listener will be called immediately with the stored Providers.\n    emitImmediately?: boolean \n  }\n): () => void // Returns an unsubscribe function.\n```\n\n#### store.getProviders()\n\nReturns the current Providers.\n\n```ts\nconst providers = store.getProviders()\n// => [EIP6963ProviderDetail, EIP6963ProviderDetail, ...]\n```\n\n**Definition**\n\n```ts\nfunction getProviders(): EIP6963ProviderDetail[]\n```\n\n#### store.findProvider(args)\n\nFinds a provider detail by its RDNS (Reverse Domain Name Identifier).\n\n```ts\nconst provider = store.findProvider({ rdns: 'com.example' })\n```\n\n**Definition**\n\n```ts\nfunction findProvider(args: { \n  // The RDNS of the Provider Detail to find.\n  rdns: string \n}): EIP6963ProviderDetail | undefined\n```\n\n#### store.clear()\n\nClears the store, including all Providers.\n\n```ts\nstore.clear()\n```\n\n**Definition**\n\n```ts\nfunction clear(): void\n```\n\n#### store.reset()\n\nResets the store, and emits an event to request Providers from the Wallet(s).\n\n```ts\nstore.reset()\n```\n\n**Definition**\n\n```ts\nfunction reset(): void\n```\n\n#### store.destroy()\n\nDestroys the store, and removes all Providers and event listeners.\n\n```ts\nstore.destroy()\n```\n\n**Definition**\n\n```ts\nfunction destroy(): void\n```\n\n## Utilities\n\n### requestProviders\n\nThe `requestProviders` utility emits an event to request Providers from the Wallet(s). It returns an `unsubscribe` function to clean up event listeners.\n\n```ts\nimport { requestProviders } from 'mipd'\n\nlet providers = []\n\nconst unsubscribe = requestProviders(providerDetail => providers.push(providerDetail))\n```\n\n**Definition**\n\n```ts\nfunction requestProviders(\n  // The listener.\n  listener: (providerDetail: EIP6963ProviderDetail) => void\n// Unsubscribe function to clean up the listener.\n): () => void\n```\n\n### announceProvider\n\nThe `announceProvider` utility emits an event to announce a Provider to the Wallet(s), and also listen for incoming requests. It returns an `unsubscribe` function to clean up event listeners.\n\n```ts\nimport { announceProvider } from 'mipd'\n\nconst unsubscribe = announceProvider({\n  info: {\n    icon: 'https://example.com/icon.png',\n    name: 'Example',\n    rdns: 'com.example',\n    uuid: '00000000-0000-0000-0000-000000000000'\n  },\n  provider: new EIP1193Provider()\n})\n```\n\n**Definition**\n\n```ts\nfunction requestProviders(\n  // The EIP-1193 Provider and Provider Info.\n  detail: EIP6963ProviderDetail\n// Unsubscribe function to clean up the listener.\n): () => void\n```\n\n## `window` Polyfill\n\nBy importing the `mipd/window` Polyfill, the types on `window.addEventListener` will be inferred to include the `EIP6963AnnounceProviderEvent` and `EIP6963RequestProviderEvent` types.\n\n```ts\nimport 'mipd/window'\n\nwindow.addEventListener(\n  'eip6963:announceProvider'\n  // ^? 'eip6963:announceProvider' | 'eip6963:requestProvider' | 'click' | ...\n\n  event => {\n  // ^? EIP6963AnnounceProviderEvent\n\n    event.type\n    //    ^? 'eip6963:announceProvider'\n    event.detail\n    //    ^? EIP6963ProviderDetail\n    event.detail.info\n    //           ^? EIP6963ProviderInfo\n    event.detail.provider\n    //           ^? EIP1193Provider\n  }\n)\n\nwindow.addEventListener(\n  'eip6963:requestProvider'\n  // ^? 'eip6963:announceProvider' | 'eip6963:requestProvider' | 'click' | ...\n\n  event => {\n  // ^? EIP6963RequestProviderEvent\n\n    event.type\n    //    ^? 'eip6963:requestProvider'\n  }\n)\n```\n\n## Types\n\n### EIP6963ProviderDetail\n\nEvent detail from `eip6963:announceProvider`.\n\n#### Import\n\n```ts\nimport { type EIP6963ProviderDetail } from 'mipd'\n```\n\n#### Definition\n\n```ts\nexport interface EIP6963ProviderDetail<TProvider = Config['EIP1193Provider']> {\n  info: EIP6963ProviderInfo\n  provider: TProvider\n}\n```\n\n### EIP6963ProviderInfo\n\nMetadata of the EIP-1193 Provider.\n\n#### Import\n\n```ts\nimport { type EIP6963ProviderInfo } from 'mipd'\n```\n\n#### Definition\n\n```ts\nexport interface EIP6963ProviderInfo {\n  icon: string\n  name: string\n  rdns?: ... | (string & {})\n  uuid: string\n}\n```\n\n### EIP6963AnnounceProviderEvent\n\nEvent type to announce an EIP-1193 Provider.\n\n#### Import\n\n```ts\nimport { type EIP6963AnnounceProviderEvent } from 'mipd'\n```\n\n#### Definition\n\n```ts\nexport interface EIP6963AnnounceProviderEvent<TProvider = DefaultProvider>\n  extends CustomEvent<EIP6963ProviderDetail<TProvider>> {\n  type: 'eip6963:announceProvider'\n}\n```\n\n### EIP6963RequestProviderEvent\n\nEvent type to request EIP-1193 Providers.\n\n#### Import\n\n```ts\nimport { type EIP6963RequestProviderEvent } from 'mipd'\n```\n\n#### Definition\n\n```ts\nexport interface EIP6963RequestProviderEvent extends Event {\n  type: 'eip6963:requestProvider'\n}\n```\n\n## Configuration\n\nIn some cases you might want to tune the global types (e.g. the `EIP1193Provider`). To do this, the following configuration options are available:\n\n| Type                | Default                                                        | Description            |\n| ------------------- | -------------------------------------------------------------- | ---------------------- |\n| `provider`          | `import('viem').EIP1193Provider`                               | The EIP-1193 Provider. |\n| `rdns`              | `'com.coinbase' \\| 'com.enkrypt' \\| 'io.metamask' \\| 'io.zerion' \\| (string & {})` | Deterministic identifier for the Provider in the form of an rDNS (Reverse Domain Name Notation) |\n\nConfiguration options are customizable using [declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html). Extend the `Register` interface either directly in your code or in a `d.ts` file (e.g. `eip6963.d.ts`):\n\n```ts\nimport { type EIP1193Provider } from './eip1193-provider'\n\ndeclare module 'mipd' {\n  interface Register {\n    provider: EIP1193Provider\n  }\n}\n```\n\n## Authors\n\n- [@jxom](https://github.com/jxom) (jxom.eth, [Twitter](https://twitter.com/jakemoxey))\n- [@tmm](https://github.com/tmm) (awkweb.eth, [Twitter](https://twitter.com/awkweb))\n\n## License\n\n[MIT](/LICENSE) License\n","readmeFilename":"README.md","gitHead":"45156dd298c838c90dfaf12a94bc97edd2c6721f","bugs":{"url":"https://github.com/wagmi-dev/mipd/issues"},"homepage":"https://github.com/wagmi-dev/mipd#readme","_id":"mipd@0.1.0-canary.20230825T175705","_nodeVersion":"18.17.1","_npmVersion":"9.6.7","dist":{"integrity":"sha512-h2op+cCr9VQBFowzbUkl2ksJHbVNlp3HKAoBde0RvqvTluJ/vU9wF7BlMUGjGVe2KDfW3GHDgqQ0ulJFpsSnpg==","shasum":"1aee62f06d3883d8d3182d1ca6a8560c259d1cbb","tarball":"https://registry.npmjs.org/mipd/-/mipd-0.1.0-canary.20230825T175705.tgz","fileCount":47,"unpackedSize":40078,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCe6kg7GirlzBBcV4NkT+inKwgo6/FDLLHriVO4x1zGOwIhAIz7MUNjfhIflTWEWnfRtpUBt823+3TYBl/y2DZVGwfo"}]},"_npmUser":{"name":"jmoxey","email":"jakemoxey@gmail.com"},"directories":{},"maintainers":[{"name":"awkweb","email":"tom@meagher.co"},{"name":"jmoxey","email":"jakemoxey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mipd_0.1.0-canary.20230825T175705_1692986237248_0.7351429687620972"},"_hasShrinkwrap":false},"0.1.0-canary.20231012T134656":{"name":"mipd","description":"TypeScript Utilities for EIP-6963","version":"0.1.0-canary.20231012T134656","license":"MIT","repository":{"type":"git","url":"git+https://github.com/wagmi-dev/mipd.git"},"sideEffects":false,"main":"./dist/cjs/index.js","module":"./dist/esm/index.js","types":"./dist/types/index.d.ts","typings":"./dist/types/index.d.ts","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","default":"./dist/cjs/index.js"},"./window":{"types":"./dist/types/window.d.ts","import":"./dist/esm/window.js","default":"./dist/cjs/window.js"},"./package.json":"./package.json"},"typesVersions":{"*":{"window":["./src/window.d.ts"]}},"peerDependencies":{"typescript":">=5.0.4"},"peerDependenciesMeta":{"typescript":{"optional":true}},"dependencies":{"viem":"^1.1.4"},"contributors":[{"name":"jxom.eth","email":"j@wagmi.sh"},{"name":"awkweb.eth","email":"t@wagmi.sh"}],"funding":[{"type":"github","url":"https://github.com/sponsors/wagmi-dev"}],"keywords":["eth","ethereum","dapps","wallet","web3","eip","6963"],"_id":"mipd@0.1.0-canary.20231012T134656","readme":"<br/>\n\n<p align=\"center\">\n    <picture>\n      <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://github.com/wagmi-dev/mipd/blob/main/.github/mipd-dark-hug.svg\">\n      <img alt=\"mipd logo\" src=\"https://github.com/wagmi-dev/mipd/blob/main/.github/mipd-light-hug.svg\" width=\"auto\" height=\"60\">\n    </picture>\n</p>\n\n<p align=\"center\">\n  TypeScript Utilities for <a href=\"https://eips.ethereum.org/EIPS/eip-6963\">EIP-6963: Multi Injected Provider Discovery</a>\n<p>\n\n## Contents\n\n- [Install](#install)\n- [Store](#store)\n- [Utilities](#utilities)\n  - [`requestProviders`](#requestproviders)\n  - [`announceProvider`](#announceprovider)\n- [`window` Type Polyfill](#window-polyfill)\n- [Types](#types)\n- [Configuration](#configuration)\n\n## Install\n\n```bash\nnpm i mipd\n```\n\n```bash\npnpm add mipd\n```\n\n```bash\nyarn add mipd\n```\n\n## Store\n\nThe MIPD Store stores the Providers that have been emitted by a Wallet (or other source), and provides a way to subscribe to the store and retrieve the Providers.\n\n### Overview\n\n```ts\nimport { createStore } from 'mipd'\n\n// Set up a MIPD Store, and request Providers.\nconst store = createStore()\n\n// Subscribe to the MIPD Store.\nstore.subscribe(providerDetails => {\n  console.log(providerDetails)\n  // => [EIP6963ProviderDetail, EIP6963ProviderDetail, ...]\n})\n\n// Retrieve emitted Providers.\nstore.getProviders()\n// => [EIP6963ProviderDetail, EIP6963ProviderDetail, ...]\n\n// Find a Provider Detail.\nstore.findProvider({ rdns: 'com.example' })\n// => EIP6963ProviderDetail | undefined\n\n// Clear the store, including all Providers.\nstore.clear()\n\n// Reset the store, and emit an event to request Providers.\nstore.reset()\n\n// Destroy the store, and remove all Providers and event listeners.\nstore.destroy()\n```\n\n### Usage\n\n#### Vanilla JS\n\n```tsx\nimport { useSyncExternalStore } from 'react'\nimport { createStore } from 'mipd'\n\nconst store = createStore()\n\nlet providers = store.getProviders()\nstore.subscribe(providerDetails => (providers = providerDetails))\n```\n\n#### React\n\n```tsx\nimport { useSyncExternalStore } from 'react'\nimport { createStore } from 'mipd'\n\nconst store = createStore()\n\nfunction Example() {\n  const providers = useSyncExternalStore(store.subscribe, store.getProviders)\n  // ...\n}\n```\n\n#### Svelte\n\n```html\n<script lang=\"ts\">\n  import { readable } from 'svelte/store'\n  import { createStore } from 'mipd'\n  \n  const store = createStore()\n  const providers = readable(store.getProviders(), store.subscribe)\n</script>\n\n<!-- ... -->\n```\n\n#### Vue\n\n```html\n<script setup lang=\"ts\">\n  import { reactive } from 'vue'\n  import { createStore } from 'mipd'\n\n  const store = createStore()\n  const state = reactive({ providers: store.getProviders() })\n  store.subscribe(providers => (state.providers = providers))\n</script>\n\n<!-- ... -->\n```\n\n### API\n\n#### createStore()\n\nCreates a MIPD Store, and emits an event to request Providers from the Wallet(s).\n\n```ts\nconst store = createStore()\n```\n\n#### store.subscribe(listener, args)\n\nSubscribes to the MIPD Store, and returns a function to unsubscribe.\n\n```ts\nconst unsubscribe = store.subscribe(providers => {\n  console.log(providers)\n  // => [EIP6963ProviderDetail, EIP6963ProviderDetail, ...]\n})\n```\n\n**Definition**\n\n```ts\nexport type Listener = (\n  // The updated Providers store.\n  providerDetails: EIP6963ProviderDetail[],\n  meta?: {\n    // The Providers that were added to the store.\n    added?: EIP6963ProviderDetail[]\n    // The Providers that were removed from the store.\n    removed?: EIP6963ProviderDetail[]\n  },\n) => void\n\nfunction subscribe(\n  // The listener function.\n  listener: Listener, \n  args?: { \n    // If `true`, the listener will be called immediately with the stored Providers.\n    emitImmediately?: boolean \n  }\n): () => void // Returns an unsubscribe function.\n```\n\n#### store.getProviders()\n\nReturns the current Providers.\n\n```ts\nconst providers = store.getProviders()\n// => [EIP6963ProviderDetail, EIP6963ProviderDetail, ...]\n```\n\n**Definition**\n\n```ts\nfunction getProviders(): EIP6963ProviderDetail[]\n```\n\n#### store.findProvider(args)\n\nFinds a provider detail by its RDNS (Reverse Domain Name Identifier).\n\n```ts\nconst provider = store.findProvider({ rdns: 'com.example' })\n```\n\n**Definition**\n\n```ts\nfunction findProvider(args: { \n  // The RDNS of the Provider Detail to find.\n  rdns: string \n}): EIP6963ProviderDetail | undefined\n```\n\n#### store.clear()\n\nClears the store, including all Providers.\n\n```ts\nstore.clear()\n```\n\n**Definition**\n\n```ts\nfunction clear(): void\n```\n\n#### store.reset()\n\nResets the store, and emits an event to request Providers from the Wallet(s).\n\n```ts\nstore.reset()\n```\n\n**Definition**\n\n```ts\nfunction reset(): void\n```\n\n#### store.destroy()\n\nDestroys the store, and removes all Providers and event listeners.\n\n```ts\nstore.destroy()\n```\n\n**Definition**\n\n```ts\nfunction destroy(): void\n```\n\n## Utilities\n\n### requestProviders\n\nThe `requestProviders` utility emits an event to request Providers from the Wallet(s). It returns an `unsubscribe` function to clean up event listeners.\n\n```ts\nimport { requestProviders } from 'mipd'\n\nlet providers = []\n\nconst unsubscribe = requestProviders(providerDetail => providers.push(providerDetail))\n```\n\n**Definition**\n\n```ts\nfunction requestProviders(\n  // The listener.\n  listener: (providerDetail: EIP6963ProviderDetail) => void\n// Unsubscribe function to clean up the listener.\n): () => void\n```\n\n### announceProvider\n\nThe `announceProvider` utility emits an event to announce a Provider to the Wallet(s), and also listen for incoming requests. It returns an `unsubscribe` function to clean up event listeners.\n\n```ts\nimport { announceProvider } from 'mipd'\n\nconst unsubscribe = announceProvider({\n  info: {\n    icon: 'https://example.com/icon.png',\n    name: 'Example',\n    rdns: 'com.example',\n    uuid: '00000000-0000-0000-0000-000000000000'\n  },\n  provider: new EIP1193Provider()\n})\n```\n\n**Definition**\n\n```ts\nfunction requestProviders(\n  // The EIP-1193 Provider and Provider Info.\n  detail: EIP6963ProviderDetail\n// Unsubscribe function to clean up the listener.\n): () => void\n```\n\n## `window` Polyfill\n\nBy importing the `mipd/window` Polyfill, the types on `window.addEventListener` will be inferred to include the `EIP6963AnnounceProviderEvent` and `EIP6963RequestProviderEvent` types.\n\n```ts\nimport 'mipd/window'\n\nwindow.addEventListener(\n  'eip6963:announceProvider'\n  // ^? 'eip6963:announceProvider' | 'eip6963:requestProvider' | 'click' | ...\n\n  event => {\n  // ^? EIP6963AnnounceProviderEvent\n\n    event.type\n    //    ^? 'eip6963:announceProvider'\n    event.detail\n    //    ^? EIP6963ProviderDetail\n    event.detail.info\n    //           ^? EIP6963ProviderInfo\n    event.detail.provider\n    //           ^? EIP1193Provider\n  }\n)\n\nwindow.addEventListener(\n  'eip6963:requestProvider'\n  // ^? 'eip6963:announceProvider' | 'eip6963:requestProvider' | 'click' | ...\n\n  event => {\n  // ^? EIP6963RequestProviderEvent\n\n    event.type\n    //    ^? 'eip6963:requestProvider'\n  }\n)\n```\n\n## Types\n\n### EIP6963ProviderDetail\n\nEvent detail from `eip6963:announceProvider`.\n\n#### Import\n\n```ts\nimport { type EIP6963ProviderDetail } from 'mipd'\n```\n\n#### Definition\n\n```ts\nexport interface EIP6963ProviderDetail<TProvider = Config['EIP1193Provider']> {\n  info: EIP6963ProviderInfo\n  provider: TProvider\n}\n```\n\n### EIP6963ProviderInfo\n\nMetadata of the EIP-1193 Provider.\n\n#### Import\n\n```ts\nimport { type EIP6963ProviderInfo } from 'mipd'\n```\n\n#### Definition\n\n```ts\nexport interface EIP6963ProviderInfo {\n  icon: string\n  name: string\n  rdns?: ... | (string & {})\n  uuid: string\n}\n```\n\n### EIP6963AnnounceProviderEvent\n\nEvent type to announce an EIP-1193 Provider.\n\n#### Import\n\n```ts\nimport { type EIP6963AnnounceProviderEvent } from 'mipd'\n```\n\n#### Definition\n\n```ts\nexport interface EIP6963AnnounceProviderEvent<TProvider = DefaultProvider>\n  extends CustomEvent<EIP6963ProviderDetail<TProvider>> {\n  type: 'eip6963:announceProvider'\n}\n```\n\n### EIP6963RequestProviderEvent\n\nEvent type to request EIP-1193 Providers.\n\n#### Import\n\n```ts\nimport { type EIP6963RequestProviderEvent } from 'mipd'\n```\n\n#### Definition\n\n```ts\nexport interface EIP6963RequestProviderEvent extends Event {\n  type: 'eip6963:requestProvider'\n}\n```\n\n## Configuration\n\nIn some cases you might want to tune the global types (e.g. the `EIP1193Provider`). To do this, the following configuration options are available:\n\n| Type                | Default                                                        | Description            |\n| ------------------- | -------------------------------------------------------------- | ---------------------- |\n| `provider`          | `import('viem').EIP1193Provider`                               | The EIP-1193 Provider. |\n| `rdns`              | `'com.coinbase' \\| 'com.enkrypt' \\| 'io.metamask' \\| 'io.zerion' \\| (string & {})` | Deterministic identifier for the Provider in the form of an rDNS (Reverse Domain Name Notation) |\n\nConfiguration options are customizable using [declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html). Extend the `Register` interface either directly in your code or in a `d.ts` file (e.g. `eip6963.d.ts`):\n\n```ts\nimport { type EIP1193Provider } from './eip1193-provider'\n\ndeclare module 'mipd' {\n  interface Register {\n    provider: EIP1193Provider\n  }\n}\n```\n\n## Authors\n\n- [@jxom](https://github.com/jxom) (jxom.eth, [Twitter](https://twitter.com/jakemoxey))\n- [@tmm](https://github.com/tmm) (awkweb.eth, [Twitter](https://twitter.com/awkweb))\n\n## License\n\n[MIT](/LICENSE) License\n","readmeFilename":"README.md","gitHead":"864309baea6d61d6ca2bf14e67e6cb69a63c5f9d","bugs":{"url":"https://github.com/wagmi-dev/mipd/issues"},"homepage":"https://github.com/wagmi-dev/mipd#readme","_nodeVersion":"18.18.0","_npmVersion":"9.8.1","dist":{"integrity":"sha512-tSxqqngoxHrYri1oXAXYRow2VHxw2pZVgMSpF2OUFHk0WwWxxvVuhgxzT7vtQqb2JifAGST7ymQpps5zrKZX5g==","shasum":"ced67192164d1f8a0e57b4ad415e02ae7ea058e8","tarball":"https://registry.npmjs.org/mipd/-/mipd-0.1.0-canary.20231012T134656.tgz","fileCount":47,"unpackedSize":40078,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE2LErGfrMwugCQ5TumHOmUWhayKPzzbqNoOJGm5IGG3AiAC6BQ31TYIR98IcpfWwl2+Q30WLhMLbNUv33lD/Wms2w=="}]},"_npmUser":{"name":"jmoxey","email":"jakemoxey@gmail.com"},"directories":{},"maintainers":[{"name":"awkweb","email":"tom@meagher.co"},{"name":"jmoxey","email":"jakemoxey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mipd_0.1.0-canary.20231012T134656_1697118429691_0.19031395660849726"},"_hasShrinkwrap":false},"0.1.0-canary.20240325T220725":{"name":"mipd","description":"TypeScript Utilities for EIP-6963","version":"0.1.0-canary.20240325T220725","license":"MIT","repository":{"type":"git","url":"git+https://github.com/wagmi-dev/mipd.git"},"sideEffects":false,"main":"./dist/cjs/index.js","module":"./dist/esm/index.js","types":"./dist/types/index.d.ts","typings":"./dist/types/index.d.ts","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","default":"./dist/cjs/index.js"},"./window":{"types":"./dist/types/window.d.ts","import":"./dist/esm/window.js","default":"./dist/cjs/window.js"},"./package.json":"./package.json"},"typesVersions":{"*":{"window":["./src/window.d.ts"]}},"peerDependencies":{"typescript":">=5.0.4"},"peerDependenciesMeta":{"typescript":{"optional":true}},"contributors":[{"name":"jxom.eth","email":"j@wagmi.sh"},{"name":"awkweb.eth","email":"t@wagmi.sh"}],"funding":[{"type":"github","url":"https://github.com/sponsors/wagmi-dev"}],"keywords":["eth","ethereum","dapps","wallet","web3","eip","6963"],"_id":"mipd@0.1.0-canary.20240325T220725","readme":"<br/>\n\n<p align=\"center\">\n    <picture>\n      <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://github.com/wagmi-dev/mipd/blob/main/.github/mipd-dark-hug.svg\">\n      <img alt=\"mipd logo\" src=\"https://github.com/wagmi-dev/mipd/blob/main/.github/mipd-light-hug.svg\" width=\"auto\" height=\"60\">\n    </picture>\n</p>\n\n<p align=\"center\">\n  TypeScript Utilities for <a href=\"https://eips.ethereum.org/EIPS/eip-6963\">EIP-6963: Multi Injected Provider Discovery</a>\n<p>\n\n## Contents\n\n- [Install](#install)\n- [Store](#store)\n- [Utilities](#utilities)\n  - [`requestProviders`](#requestproviders)\n  - [`announceProvider`](#announceprovider)\n- [`window` Type Polyfill](#window-polyfill)\n- [Types](#types)\n- [Configuration](#configuration)\n\n## Install\n\n```bash\nnpm i mipd\n```\n\n```bash\npnpm add mipd\n```\n\n```bash\nyarn add mipd\n```\n\n## Store\n\nThe MIPD Store stores the Providers that have been emitted by a Wallet (or other source), and provides a way to subscribe to the store and retrieve the Providers.\n\n### Overview\n\n```ts\nimport { createStore } from 'mipd'\n\n// Set up a MIPD Store, and request Providers.\nconst store = createStore()\n\n// Subscribe to the MIPD Store.\nstore.subscribe(providerDetails => {\n  console.log(providerDetails)\n  // => [EIP6963ProviderDetail, EIP6963ProviderDetail, ...]\n})\n\n// Retrieve emitted Providers.\nstore.getProviders()\n// => [EIP6963ProviderDetail, EIP6963ProviderDetail, ...]\n\n// Find a Provider Detail.\nstore.findProvider({ rdns: 'com.example' })\n// => EIP6963ProviderDetail | undefined\n\n// Clear the store, including all Providers.\nstore.clear()\n\n// Reset the store, and emit an event to request Providers.\nstore.reset()\n\n// Destroy the store, and remove all Providers and event listeners.\nstore.destroy()\n```\n\n### Usage\n\n#### Vanilla JS\n\n```tsx\nimport { useSyncExternalStore } from 'react'\nimport { createStore } from 'mipd'\n\nconst store = createStore()\n\nlet providers = store.getProviders()\nstore.subscribe(providerDetails => (providers = providerDetails))\n```\n\n#### React\n\n```tsx\nimport { useSyncExternalStore } from 'react'\nimport { createStore } from 'mipd'\n\nconst store = createStore()\n\nfunction Example() {\n  const providers = useSyncExternalStore(store.subscribe, store.getProviders)\n  // ...\n}\n```\n\n#### Svelte\n\n```html\n<script lang=\"ts\">\n  import { readable } from 'svelte/store'\n  import { createStore } from 'mipd'\n  \n  const store = createStore()\n  const providers = readable(store.getProviders(), store.subscribe)\n</script>\n\n<!-- ... -->\n```\n\n#### Vue\n\n```html\n<script setup lang=\"ts\">\n  import { reactive } from 'vue'\n  import { createStore } from 'mipd'\n\n  const store = createStore()\n  const state = reactive({ providers: store.getProviders() })\n  store.subscribe(providers => (state.providers = providers))\n</script>\n\n<!-- ... -->\n```\n\n### API\n\n#### createStore()\n\nCreates a MIPD Store, and emits an event to request Providers from the Wallet(s).\n\n```ts\nconst store = createStore()\n```\n\n#### store.subscribe(listener, args)\n\nSubscribes to the MIPD Store, and returns a function to unsubscribe.\n\n```ts\nconst unsubscribe = store.subscribe(providers => {\n  console.log(providers)\n  // => [EIP6963ProviderDetail, EIP6963ProviderDetail, ...]\n})\n```\n\n**Definition**\n\n```ts\nexport type Listener = (\n  // The updated Providers store.\n  providerDetails: EIP6963ProviderDetail[],\n  meta?: {\n    // The Providers that were added to the store.\n    added?: EIP6963ProviderDetail[]\n    // The Providers that were removed from the store.\n    removed?: EIP6963ProviderDetail[]\n  },\n) => void\n\nfunction subscribe(\n  // The listener function.\n  listener: Listener, \n  args?: { \n    // If `true`, the listener will be called immediately with the stored Providers.\n    emitImmediately?: boolean \n  }\n): () => void // Returns an unsubscribe function.\n```\n\n#### store.getProviders()\n\nReturns the current Providers.\n\n```ts\nconst providers = store.getProviders()\n// => [EIP6963ProviderDetail, EIP6963ProviderDetail, ...]\n```\n\n**Definition**\n\n```ts\nfunction getProviders(): EIP6963ProviderDetail[]\n```\n\n#### store.findProvider(args)\n\nFinds a provider detail by its RDNS (Reverse Domain Name Identifier).\n\n```ts\nconst provider = store.findProvider({ rdns: 'com.example' })\n```\n\n**Definition**\n\n```ts\nfunction findProvider(args: { \n  // The RDNS of the Provider Detail to find.\n  rdns: string \n}): EIP6963ProviderDetail | undefined\n```\n\n#### store.clear()\n\nClears the store, including all Providers.\n\n```ts\nstore.clear()\n```\n\n**Definition**\n\n```ts\nfunction clear(): void\n```\n\n#### store.reset()\n\nResets the store, and emits an event to request Providers from the Wallet(s).\n\n```ts\nstore.reset()\n```\n\n**Definition**\n\n```ts\nfunction reset(): void\n```\n\n#### store.destroy()\n\nDestroys the store, and removes all Providers and event listeners.\n\n```ts\nstore.destroy()\n```\n\n**Definition**\n\n```ts\nfunction destroy(): void\n```\n\n## Utilities\n\n### requestProviders\n\nThe `requestProviders` utility emits an event to request Providers from the Wallet(s). It returns an `unsubscribe` function to clean up event listeners.\n\n```ts\nimport { requestProviders } from 'mipd'\n\nlet providers = []\n\nconst unsubscribe = requestProviders(providerDetail => providers.push(providerDetail))\n```\n\n**Definition**\n\n```ts\nfunction requestProviders(\n  // The listener.\n  listener: (providerDetail: EIP6963ProviderDetail) => void\n// Unsubscribe function to clean up the listener.\n): () => void\n```\n\n### announceProvider\n\nThe `announceProvider` utility emits an event to announce a Provider to the Wallet(s), and also listen for incoming requests. It returns an `unsubscribe` function to clean up event listeners.\n\n```ts\nimport { announceProvider } from 'mipd'\n\nconst unsubscribe = announceProvider({\n  info: {\n    icon: 'data:image/svg+xml,<svg width=\"32px\" height=\"32px\" viewBox=\"0 0 32 32\"/>',\n    name: 'Example',\n    rdns: 'com.example',\n    uuid: '00000000-0000-0000-0000-000000000000'\n  },\n  provider: new EIP1193Provider()\n})\n```\n\n**Definition**\n\n```ts\nfunction requestProviders(\n  // The EIP-1193 Provider and Provider Info.\n  detail: EIP6963ProviderDetail\n// Unsubscribe function to clean up the listener.\n): () => void\n```\n\n## `window` Polyfill\n\nBy importing the `mipd/window` Polyfill, the types on `window.addEventListener` will be inferred to include the `EIP6963AnnounceProviderEvent` and `EIP6963RequestProviderEvent` types.\n\n```ts\nimport 'mipd/window'\n\nwindow.addEventListener(\n  'eip6963:announceProvider'\n  // ^? 'eip6963:announceProvider' | 'eip6963:requestProvider' | 'click' | ...\n\n  event => {\n  // ^? EIP6963AnnounceProviderEvent\n\n    event.type\n    //    ^? 'eip6963:announceProvider'\n    event.detail\n    //    ^? EIP6963ProviderDetail\n    event.detail.info\n    //           ^? EIP6963ProviderInfo\n    event.detail.provider\n    //           ^? EIP1193Provider\n  }\n)\n\nwindow.addEventListener(\n  'eip6963:requestProvider'\n  // ^? 'eip6963:announceProvider' | 'eip6963:requestProvider' | 'click' | ...\n\n  event => {\n  // ^? EIP6963RequestProviderEvent\n\n    event.type\n    //    ^? 'eip6963:requestProvider'\n  }\n)\n```\n\n## Types\n\n### EIP6963ProviderDetail\n\nEvent detail from `eip6963:announceProvider`.\n\n#### Import\n\n```ts\nimport { type EIP6963ProviderDetail } from 'mipd'\n```\n\n#### Definition\n\n```ts\nexport interface EIP6963ProviderDetail<TProvider = Config['EIP1193Provider']> {\n  info: EIP6963ProviderInfo\n  provider: TProvider\n}\n```\n\n### EIP6963ProviderInfo\n\nMetadata of the EIP-1193 Provider.\n\n#### Import\n\n```ts\nimport { type EIP6963ProviderInfo } from 'mipd'\n```\n\n#### Definition\n\n```ts\nexport interface EIP6963ProviderInfo {\n  icon: string\n  name: string\n  rdns?: ... | (string & {})\n  uuid: string\n}\n```\n\n### EIP6963AnnounceProviderEvent\n\nEvent type to announce an EIP-1193 Provider.\n\n#### Import\n\n```ts\nimport { type EIP6963AnnounceProviderEvent } from 'mipd'\n```\n\n#### Definition\n\n```ts\nexport interface EIP6963AnnounceProviderEvent<TProvider = DefaultProvider>\n  extends CustomEvent<EIP6963ProviderDetail<TProvider>> {\n  type: 'eip6963:announceProvider'\n}\n```\n\n### EIP6963RequestProviderEvent\n\nEvent type to request EIP-1193 Providers.\n\n#### Import\n\n```ts\nimport { type EIP6963RequestProviderEvent } from 'mipd'\n```\n\n#### Definition\n\n```ts\nexport interface EIP6963RequestProviderEvent extends Event {\n  type: 'eip6963:requestProvider'\n}\n```\n\n## Configuration\n\nIn some cases you might want to tune the global types (e.g. the `EIP1193Provider`). To do this, the following configuration options are available:\n\n| Type                | Default                                                        | Description            |\n| ------------------- | -------------------------------------------------------------- | ---------------------- |\n| `provider`          | `import('viem').EIP1193Provider`                               | The EIP-1193 Provider. |\n| `rdns`              | `'com.coinbase' \\| 'com.enkrypt' \\| 'io.metamask' \\| 'io.zerion' \\| (string & {})` | Deterministic identifier for the Provider in the form of an rDNS (Reverse Domain Name Notation) |\n\nConfiguration options are customizable using [declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html). Extend the `Register` interface either directly in your code or in a `d.ts` file (e.g. `eip6963.d.ts`):\n\n```ts\nimport { type EIP1193Provider } from './eip1193-provider'\n\ndeclare module 'mipd' {\n  interface Register {\n    provider: EIP1193Provider\n  }\n}\n```\n\n## Authors\n\n- [@jxom](https://github.com/jxom) (jxom.eth, [Twitter](https://twitter.com/jakemoxey))\n- [@tmm](https://github.com/tmm) (awkweb.eth, [Twitter](https://twitter.com/awkweb))\n\n## License\n\n[MIT](/LICENSE) License\n","readmeFilename":"README.md","gitHead":"e7870b33e6e0e10484bdd24d08ac3ea7245a27dc","bugs":{"url":"https://github.com/wagmi-dev/mipd/issues"},"homepage":"https://github.com/wagmi-dev/mipd#readme","_nodeVersion":"18.19.1","_npmVersion":"10.2.4","dist":{"integrity":"sha512-xCv8CQhz/Qni/v771ckmOjt4ByKcPGHTzPgF9njt/G7V4bwytCcG075mrzmaWC3bDDtW+A6LZsc96AI6IBbvbg==","shasum":"cb90d7adc456c86d39948aa09c73216171f08f15","tarball":"https://registry.npmjs.org/mipd/-/mipd-0.1.0-canary.20240325T220725.tgz","fileCount":47,"unpackedSize":40131,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCydiwUwONno43Es9lp6Moc1kHstrI2cYk0y17Z8UFlHQIgG0kfGQTMHjh/EsMl/BRmPW1uUy7ZRqyNbXve55Txf6A="}]},"_npmUser":{"name":"awkweb","email":"tom@meagher.co"},"directories":{},"maintainers":[{"name":"jmoxey","email":"jakemoxey@gmail.com"},{"name":"awkweb","email":"tom@meagher.co"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mipd_0.1.0-canary.20240325T220725_1711404455433_0.4025801913604663"},"_hasShrinkwrap":false},"0.0.7":{"name":"mipd","description":"TypeScript Utilities for EIP-6963","version":"0.0.7","license":"MIT","repository":{"type":"git","url":"git+https://github.com/wagmi-dev/mipd.git"},"sideEffects":false,"main":"./dist/cjs/index.js","module":"./dist/esm/index.js","types":"./dist/types/index.d.ts","typings":"./dist/types/index.d.ts","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","default":"./dist/cjs/index.js"},"./window":{"types":"./dist/types/window.d.ts","import":"./dist/esm/window.js","default":"./dist/cjs/window.js"},"./package.json":"./package.json"},"typesVersions":{"*":{"window":["./src/window.d.ts"]}},"peerDependencies":{"typescript":">=5.0.4"},"peerDependenciesMeta":{"typescript":{"optional":true}},"contributors":[{"name":"jxom.eth","email":"j@wagmi.sh"},{"name":"awkweb.eth","email":"t@wagmi.sh"}],"funding":[{"type":"github","url":"https://github.com/sponsors/wagmi-dev"}],"keywords":["eth","ethereum","dapps","wallet","web3","eip","6963"],"bugs":{"url":"https://github.com/wagmi-dev/mipd/issues"},"homepage":"https://github.com/wagmi-dev/mipd#readme","_id":"mipd@0.0.7","_integrity":"sha512-aAPZPNDQ3uMTdKbuO2YmAw2TxLHO0moa4YKAyETM/DTj5FloZo+a+8tU+iv4GmW+sOxKLSRwcSFuczk+Cpt6fg==","_resolved":"/tmp/aef5f3c0dae2263d908d7e93a16decf9/mipd-0.0.7.tgz","_from":"file:mipd-0.0.7.tgz","_nodeVersion":"18.19.1","_npmVersion":"10.2.4","dist":{"integrity":"sha512-aAPZPNDQ3uMTdKbuO2YmAw2TxLHO0moa4YKAyETM/DTj5FloZo+a+8tU+iv4GmW+sOxKLSRwcSFuczk+Cpt6fg==","shasum":"bb5559e21fa18dc3d9fe1c08902ef14b7ce32fd9","tarball":"https://registry.npmjs.org/mipd/-/mipd-0.0.7.tgz","fileCount":48,"unpackedSize":40767,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEBW2ZoWg0dKpY49G89skbE82kOYLDc4jaBIRLAi5S1BAiAqM9PVbypeEbX/UdsIf4sJwISlZCWHjVohGbdS98fIJA=="}]},"_npmUser":{"name":"awkweb","email":"tom@meagher.co"},"directories":{},"maintainers":[{"name":"jmoxey","email":"jakemoxey@gmail.com"},{"name":"awkweb","email":"tom@meagher.co"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mipd_0.0.7_1711404458382_0.982390244062282"},"_hasShrinkwrap":false},"0.1.0-canary.20240404T022200":{"name":"mipd","description":"TypeScript Utilities for EIP-6963","version":"0.1.0-canary.20240404T022200","license":"MIT","repository":{"type":"git","url":"git+https://github.com/wagmi-dev/mipd.git"},"sideEffects":false,"main":"./dist/cjs/index.js","module":"./dist/esm/index.js","types":"./dist/types/index.d.ts","typings":"./dist/types/index.d.ts","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","default":"./dist/cjs/index.js"},"./window":{"types":"./dist/types/window.d.ts","import":"./dist/esm/window.js","default":"./dist/cjs/window.js"},"./package.json":"./package.json"},"typesVersions":{"*":{"window":["./src/window.d.ts"]}},"peerDependencies":{"typescript":">=5.0.4"},"peerDependenciesMeta":{"typescript":{"optional":true}},"contributors":[{"name":"jxom.eth","email":"j@wagmi.sh"},{"name":"awkweb.eth","email":"t@wagmi.sh"}],"funding":[{"type":"github","url":"https://github.com/sponsors/wagmi-dev"}],"keywords":["eth","ethereum","dapps","wallet","web3","eip","6963"],"_id":"mipd@0.1.0-canary.20240404T022200","readme":"<br/>\n\n<p align=\"center\">\n    <picture>\n      <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://github.com/wagmi-dev/mipd/blob/main/.github/mipd-dark-hug.svg\">\n      <img alt=\"mipd logo\" src=\"https://github.com/wagmi-dev/mipd/blob/main/.github/mipd-light-hug.svg\" width=\"auto\" height=\"60\">\n    </picture>\n</p>\n\n<p align=\"center\">\n  TypeScript Utilities for <a href=\"https://eips.ethereum.org/EIPS/eip-6963\">EIP-6963: Multi Injected Provider Discovery</a>\n<p>\n\n## Contents\n\n- [Install](#install)\n- [Store](#store)\n- [Utilities](#utilities)\n  - [`requestProviders`](#requestproviders)\n  - [`announceProvider`](#announceprovider)\n- [`window` Type Polyfill](#window-polyfill)\n- [Types](#types)\n- [Configuration](#configuration)\n\n## Install\n\n```bash\nnpm i mipd\n```\n\n```bash\npnpm add mipd\n```\n\n```bash\nyarn add mipd\n```\n\n## Store\n\nThe MIPD Store stores the Providers that have been emitted by a Wallet (or other source), and provides a way to subscribe to the store and retrieve the Providers.\n\n### Overview\n\n```ts\nimport { createStore } from 'mipd'\n\n// Set up a MIPD Store, and request Providers.\nconst store = createStore()\n\n// Subscribe to the MIPD Store.\nstore.subscribe(providerDetails => {\n  console.log(providerDetails)\n  // => [EIP6963ProviderDetail, EIP6963ProviderDetail, ...]\n})\n\n// Retrieve emitted Providers.\nstore.getProviders()\n// => [EIP6963ProviderDetail, EIP6963ProviderDetail, ...]\n\n// Find a Provider Detail.\nstore.findProvider({ rdns: 'com.example' })\n// => EIP6963ProviderDetail | undefined\n\n// Clear the store, including all Providers.\nstore.clear()\n\n// Reset the store, and emit an event to request Providers.\nstore.reset()\n\n// Destroy the store, and remove all Providers and event listeners.\nstore.destroy()\n```\n\n### Usage\n\n#### Vanilla JS\n\n```tsx\nimport { createStore } from 'mipd'\n\nconst store = createStore()\n\nlet providers = store.getProviders()\nstore.subscribe(providerDetails => (providers = providerDetails))\n```\n\n#### React\n\n```tsx\nimport { useSyncExternalStore } from 'react'\nimport { createStore } from 'mipd'\n\nconst store = createStore()\n\nfunction Example() {\n  const providers = useSyncExternalStore(store.subscribe, store.getProviders)\n  // ...\n}\n```\n\n#### Svelte\n\n```html\n<script lang=\"ts\">\n  import { readable } from 'svelte/store'\n  import { createStore } from 'mipd'\n  \n  const store = createStore()\n  const providers = readable(store.getProviders(), store.subscribe)\n</script>\n\n<!-- ... -->\n```\n\n#### Vue\n\n```html\n<script setup lang=\"ts\">\n  import { reactive } from 'vue'\n  import { createStore } from 'mipd'\n\n  const store = createStore()\n  const state = reactive({ providers: store.getProviders() })\n  store.subscribe(providers => (state.providers = providers))\n</script>\n\n<!-- ... -->\n```\n\n### API\n\n#### createStore()\n\nCreates a MIPD Store, and emits an event to request Providers from the Wallet(s).\n\n```ts\nconst store = createStore()\n```\n\n#### store.subscribe(listener, args)\n\nSubscribes to the MIPD Store, and returns a function to unsubscribe.\n\n```ts\nconst unsubscribe = store.subscribe(providers => {\n  console.log(providers)\n  // => [EIP6963ProviderDetail, EIP6963ProviderDetail, ...]\n})\n```\n\n**Definition**\n\n```ts\nexport type Listener = (\n  // The updated Providers store.\n  providerDetails: EIP6963ProviderDetail[],\n  meta?: {\n    // The Providers that were added to the store.\n    added?: EIP6963ProviderDetail[]\n    // The Providers that were removed from the store.\n    removed?: EIP6963ProviderDetail[]\n  },\n) => void\n\nfunction subscribe(\n  // The listener function.\n  listener: Listener, \n  args?: { \n    // If `true`, the listener will be called immediately with the stored Providers.\n    emitImmediately?: boolean \n  }\n): () => void // Returns an unsubscribe function.\n```\n\n#### store.getProviders()\n\nReturns the current Providers.\n\n```ts\nconst providers = store.getProviders()\n// => [EIP6963ProviderDetail, EIP6963ProviderDetail, ...]\n```\n\n**Definition**\n\n```ts\nfunction getProviders(): EIP6963ProviderDetail[]\n```\n\n#### store.findProvider(args)\n\nFinds a provider detail by its RDNS (Reverse Domain Name Identifier).\n\n```ts\nconst provider = store.findProvider({ rdns: 'com.example' })\n```\n\n**Definition**\n\n```ts\nfunction findProvider(args: { \n  // The RDNS of the Provider Detail to find.\n  rdns: string \n}): EIP6963ProviderDetail | undefined\n```\n\n#### store.clear()\n\nClears the store, including all Providers.\n\n```ts\nstore.clear()\n```\n\n**Definition**\n\n```ts\nfunction clear(): void\n```\n\n#### store.reset()\n\nResets the store, and emits an event to request Providers from the Wallet(s).\n\n```ts\nstore.reset()\n```\n\n**Definition**\n\n```ts\nfunction reset(): void\n```\n\n#### store.destroy()\n\nDestroys the store, and removes all Providers and event listeners.\n\n```ts\nstore.destroy()\n```\n\n**Definition**\n\n```ts\nfunction destroy(): void\n```\n\n## Utilities\n\n### requestProviders\n\nThe `requestProviders` utility emits an event to request Providers from the Wallet(s). It returns an `unsubscribe` function to clean up event listeners.\n\n```ts\nimport { requestProviders } from 'mipd'\n\nlet providers = []\n\nconst unsubscribe = requestProviders(providerDetail => providers.push(providerDetail))\n```\n\n**Definition**\n\n```ts\nfunction requestProviders(\n  // The listener.\n  listener: (providerDetail: EIP6963ProviderDetail) => void\n// Unsubscribe function to clean up the listener.\n): () => void\n```\n\n### announceProvider\n\nThe `announceProvider` utility emits an event to announce a Provider to the Wallet(s), and also listen for incoming requests. It returns an `unsubscribe` function to clean up event listeners.\n\n```ts\nimport { announceProvider } from 'mipd'\n\nconst unsubscribe = announceProvider({\n  info: {\n    icon: 'data:image/svg+xml,<svg width=\"32px\" height=\"32px\" viewBox=\"0 0 32 32\"/>',\n    name: 'Example',\n    rdns: 'com.example',\n    uuid: '00000000-0000-0000-0000-000000000000'\n  },\n  provider: new EIP1193Provider()\n})\n```\n\n**Definition**\n\n```ts\nfunction requestProviders(\n  // The EIP-1193 Provider and Provider Info.\n  detail: EIP6963ProviderDetail\n// Unsubscribe function to clean up the listener.\n): () => void\n```\n\n## `window` Polyfill\n\nBy importing the `mipd/window` Polyfill, the types on `window.addEventListener` will be inferred to include the `EIP6963AnnounceProviderEvent` and `EIP6963RequestProviderEvent` types.\n\n```ts\nimport 'mipd/window'\n\nwindow.addEventListener(\n  'eip6963:announceProvider'\n  // ^? 'eip6963:announceProvider' | 'eip6963:requestProvider' | 'click' | ...\n\n  event => {\n  // ^? EIP6963AnnounceProviderEvent\n\n    event.type\n    //    ^? 'eip6963:announceProvider'\n    event.detail\n    //    ^? EIP6963ProviderDetail\n    event.detail.info\n    //           ^? EIP6963ProviderInfo\n    event.detail.provider\n    //           ^? EIP1193Provider\n  }\n)\n\nwindow.addEventListener(\n  'eip6963:requestProvider'\n  // ^? 'eip6963:announceProvider' | 'eip6963:requestProvider' | 'click' | ...\n\n  event => {\n  // ^? EIP6963RequestProviderEvent\n\n    event.type\n    //    ^? 'eip6963:requestProvider'\n  }\n)\n```\n\n## Types\n\n### EIP6963ProviderDetail\n\nEvent detail from `eip6963:announceProvider`.\n\n#### Import\n\n```ts\nimport { type EIP6963ProviderDetail } from 'mipd'\n```\n\n#### Definition\n\n```ts\nexport interface EIP6963ProviderDetail<TProvider = Config['EIP1193Provider']> {\n  info: EIP6963ProviderInfo\n  provider: TProvider\n}\n```\n\n### EIP6963ProviderInfo\n\nMetadata of the EIP-1193 Provider.\n\n#### Import\n\n```ts\nimport { type EIP6963ProviderInfo } from 'mipd'\n```\n\n#### Definition\n\n```ts\nexport interface EIP6963ProviderInfo {\n  icon: string\n  name: string\n  rdns?: ... | (string & {})\n  uuid: string\n}\n```\n\n### EIP6963AnnounceProviderEvent\n\nEvent type to announce an EIP-1193 Provider.\n\n#### Import\n\n```ts\nimport { type EIP6963AnnounceProviderEvent } from 'mipd'\n```\n\n#### Definition\n\n```ts\nexport interface EIP6963AnnounceProviderEvent<TProvider = DefaultProvider>\n  extends CustomEvent<EIP6963ProviderDetail<TProvider>> {\n  type: 'eip6963:announceProvider'\n}\n```\n\n### EIP6963RequestProviderEvent\n\nEvent type to request EIP-1193 Providers.\n\n#### Import\n\n```ts\nimport { type EIP6963RequestProviderEvent } from 'mipd'\n```\n\n#### Definition\n\n```ts\nexport interface EIP6963RequestProviderEvent extends Event {\n  type: 'eip6963:requestProvider'\n}\n```\n\n## Configuration\n\nIn some cases you might want to tune the global types (e.g. the `EIP1193Provider`). To do this, the following configuration options are available:\n\n| Type                | Default                                                        | Description            |\n| ------------------- | -------------------------------------------------------------- | ---------------------- |\n| `provider`          | `import('viem').EIP1193Provider`                               | The EIP-1193 Provider. |\n| `rdns`              | `'com.coinbase' \\| 'com.enkrypt' \\| 'io.metamask' \\| 'io.zerion' \\| (string & {})` | Deterministic identifier for the Provider in the form of an rDNS (Reverse Domain Name Notation) |\n\nConfiguration options are customizable using [declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html). Extend the `Register` interface either directly in your code or in a `d.ts` file (e.g. `eip6963.d.ts`):\n\n```ts\nimport { type EIP1193Provider } from './eip1193-provider'\n\ndeclare module 'mipd' {\n  interface Register {\n    provider: EIP1193Provider\n  }\n}\n```\n\n## Authors\n\n- [@jxom](https://github.com/jxom) (jxom.eth, [Twitter](https://twitter.com/jakemoxey))\n- [@tmm](https://github.com/tmm) (awkweb.eth, [Twitter](https://twitter.com/awkweb))\n\n## License\n\n[MIT](/LICENSE) License\n","readmeFilename":"README.md","gitHead":"0fda4481a31a28a4571c10a1d99568c9b4fed226","bugs":{"url":"https://github.com/wagmi-dev/mipd/issues"},"homepage":"https://github.com/wagmi-dev/mipd#readme","_nodeVersion":"18.19.1","_npmVersion":"10.2.4","dist":{"integrity":"sha512-ioicTCGJDvS1EzsBRizjGShiqjSDgheXlUny20apJJXL19y8R2Y78ifeo1g9v2AqyBOGPPv6ety9mfyJAlCHZQ==","shasum":"80fa89559a05a5d77d588a3839fa285d1444d08b","tarball":"https://registry.npmjs.org/mipd/-/mipd-0.1.0-canary.20240404T022200.tgz","fileCount":47,"unpackedSize":40086,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCZpcA/PjmLWg+QV4s2fHX2qz16KjunsiA/8QBXzB1zzwIhAPT5JVb/PMNJ7BjW/UAavD9X+toRZuoK0NxY07Simy6Q"}]},"_npmUser":{"name":"awkweb","email":"tom@meagher.co"},"directories":{},"maintainers":[{"name":"jmoxey","email":"jakemoxey@gmail.com"},{"name":"awkweb","email":"tom@meagher.co"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mipd_0.1.0-canary.20240404T022200_1712197329973_0.5273531173637072"},"_hasShrinkwrap":false}},"time":{"created":"2023-06-10T00:30:16.861Z","0.0.0":"2023-06-10T00:30:16.988Z","modified":"2024-04-04T02:22:10.430Z","0.0.1":"2023-06-30T04:49:58.315Z","0.0.2":"2023-07-01T00:37:04.679Z","0.0.3":"2023-07-01T01:01:58.873Z","0.0.4":"2023-07-02T03:57:13.237Z","0.1.0-canary.20230704T065839":"2023-07-04T06:58:50.879Z","0.0.5":"2023-07-04T06:58:53.394Z","0.1.0-canary.20230720T053946":"2023-07-20T05:39:57.634Z","0.1.0-canary.20230825T175705":"2023-08-25T17:57:17.485Z","0.1.0-canary.20231012T134656":"2023-10-12T13:47:09.877Z","0.1.0-canary.20240325T220725":"2024-03-25T22:07:35.641Z","0.0.7":"2024-03-25T22:07:38.528Z","0.1.0-canary.20240404T022200":"2024-04-04T02:22:10.232Z"},"maintainers":[{"name":"jmoxey","email":"jakemoxey@gmail.com"},{"name":"awkweb","email":"tom@meagher.co"}],"readme":"","readmeFilename":"","description":"TypeScript Utilities for EIP-6963","homepage":"https://github.com/wagmi-dev/mipd#readme","keywords":["eth","ethereum","dapps","wallet","web3","eip","6963"],"repository":{"type":"git","url":"git+https://github.com/wagmi-dev/mipd.git"},"bugs":{"url":"https://github.com/wagmi-dev/mipd/issues"},"license":"MIT","contributors":[{"name":"jxom.eth","email":"j@wagmi.sh"},{"name":"awkweb.eth","email":"t@wagmi.sh"}]}