Provider Discovery
Discover injected wallet providers with ease.
For your convenience, MinaJS Connect provides a simple way to discover all Mina's injected wallet providers. This is done by an API similar to Wevm's MIPD.
Vanilla TypeScript
import { createStore, type MinaProviderDetail } from '@mina-js/connect'
const store = createStore()
// Reactively, you can use MinaProviderDetail to type the array, but it fails in docs ffs.
const providersReactively = []
const unsubscribe = store.subscribe((provider) => providersReactively.push(provider))
// Imperatively
const providersImperatively = store.getProviders()
React
import { useSyncExternalStore } from 'react'
import { createStore } from '@mina-js/connect'
const store = createStore()
function Example() {
const providers = useSyncExternalStore(store.subscribe, store.getProviders)
}
Svelte
<script lang="ts">
import { readable } from 'svelte/store'
import { createStore } from '@mina-js/connect'
const store = createStore()
const providers = readable(store.getProviders(), store.subscribe)
</script>
Vue
<script setup lang="ts">
import { reactive } from 'vue'
import { createStore } from '@mina-js/connect'
const store = createStore()
const state = reactive({ providers: store.getProviders() })
store.subscribe(providers => (state.providers = providers))
</script>