@blockchain-lab-um/masca-connector
Version:
Library for using Masca on the frontend
27 lines (24 loc) • 613 B
JavaScript
import { createStore } from 'mipd';
// src/ProviderStore.ts
var ProviderStore = class {
constructor() {
this.currentProvider = null;
this.store = createStore();
const providers = this.store.getProviders();
this.currentProvider = providers.find(
(provider) => ["io.metamask", "io.metamask.mmi", "io.metamask.flask"].includes(
provider.info.rdns
)
) || null;
}
getCurrentProvider() {
return this.currentProvider;
}
findProvider(rdns) {
return this.store.findProvider({ rdns });
}
destroy() {
this.store.destroy();
}
};
export { ProviderStore };