@subwallet-connect/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
29 lines (28 loc) • 1.16 kB
JavaScript
import { openInfinityWallet } from '@infinitywallet/infinity-connector';
function infinityWallet(options) {
if (typeof window === 'undefined')
return () => null;
return () => {
return {
type: 'evm',
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.infinityWallet;
}
else {
openInfinityWallet(window.location.href, options === null || options === void 0 ? void 0 : options.chainId);
throw new Error('Opening Infinity Wallet! If not installed first download to use Infinity Wallet');
}
return {
provider
};
}
};
};
}
export default infinityWallet;