mango-token-sale/utils/wallet-adapters/sollet-extension.ts

23 lines
526 B
TypeScript
Raw Normal View History

2021-04-25 08:03:30 -07:00
import Wallet from '@project-serum/sol-wallet-adapter'
import { notify } from '../../utils/notifications'
export function SolletExtensionAdapter(_, network) {
const sollet = (window as any).sollet
if (sollet) {
return new Wallet(sollet, network)
}
return {
2021-04-27 02:28:04 -07:00
on: () => {
/* do nothing */
},
2021-04-25 08:03:30 -07:00
connect: () => {
notify({
message: 'Sollet Extension Error',
description:
'Please install the Sollet Extension for Chrome and then reload this page.',
})
},
}
}