idquia
Version:
Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardised spec compliant web3 providers for all supported wallets, framework agnostic modern javascript UI with code splitting, CSS customization, mul
32 lines (29 loc) • 848 B
text/typescript
import { createEIP1193Provider, WalletInit } from '@web3-onboard/common'
import icon from './icon.js'
import type { ConstructorParams } from '@arcana/auth/types'
export default function (opts: {
clientID: string
params?: ConstructorParams
}): WalletInit {
return () => ({
label: 'Arcana Auth',
async getIcon() {
return icon
},
async getInterface() {
const { AuthProvider } = await import('@arcana/auth')
const instance = new AuthProvider(opts.clientID, opts.params)
await instance.init()
return new Promise((resolve, reject) => {
// @ts-ignore
instance.provider.once('connect', () => {
resolve({
provider: createEIP1193Provider(instance.provider),
instance
})
})
instance.connect().catch(reject)
})
}
})
}