@web3-onboard/infinity-wallet
Version:
Infinity Wallet SDK wallet module for connecting to Web3-Onboard. Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardized spec compliant web3 providers for all supported wallets, framework agnosti
28 lines (27 loc) • 1.14 kB
JavaScript
import { createDownloadMessage } from '@web3-onboard/common';
import { openInfinityWallet } from '@infinitywallet/infinity-connector';
function infinityWallet(options) {
if (typeof window === 'undefined')
return () => null;
return () => {
return {
label: 'Infinity Wallet',
getIcon: async () => (await import('./icon.js')).default,
getInterface: async () => {
const ethereumInjectionExists = window.hasOwnProperty('ethereum');
let provider;
// check if Infinity Wallet is injected into window.ethereum
if (ethereumInjectionExists && window['ethereum'].isInfinityWallet) {
provider = window['ethereum'];
}
else {
throw new Error(createDownloadMessage('Infinity Wallet', () => openInfinityWallet(window.location.href, options === null || options === void 0 ? void 0 : options.chainId)));
}
return {
provider
};
}
};
};
}
export default infinityWallet;