UNPKG

saepenatus

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 (26 loc) 958 B
import Joi from 'joi' import { InjectedWalletOptions } from './types.js' import { validate, type ValidateReturn } from '@web3-onboard/common' const walletModule = Joi.object({ label: Joi.string().required(), getIcon: Joi.function().arity(0).required(), getInterface: Joi.function().maxArity(1).required(), injectedNamespace: Joi.string().required(), checkProviderIdentity: Joi.function().arity(1).required(), platforms: Joi.array().items(Joi.string()) }) const wallets = Joi.array().items(walletModule) const filter = Joi.object().pattern( /\w+/, Joi.any().allow(Joi.boolean(), Joi.array().items(Joi.string())) ) const walletOptions = Joi.object({ custom: wallets, filter, displayUnavailable: Joi.boolean(), walletUnavailableMessage: Joi.function(), sort: Joi.function() }) export const validateWalletOptions = ( data: InjectedWalletOptions | Partial<InjectedWalletOptions> ): ValidateReturn => validate(walletOptions, data)