discovery
Overview
Namespace containing discovery utilities
Functions
getDiscoveryService
Creates and configures a discovery service object used for wallet authentication. This function combines the provided service configuration with discovery-related settings from the FCL configuration to create a complete service definition for wallet authentication flows.
Import
You can import the entire package and access the function:
_10import * as fcl from "@onflow/fcl-core"_10_10fcl.discovery.getDiscoveryService(service)
Or import the namespace directly:
_10import { discovery } from "@onflow/fcl-core"_10_10discovery.getDiscoveryService(service)
Usage
_18// Get discovery service with default configuration_18const discoveryService = await getDiscoveryService()_18console.log(discoveryService.endpoint) // Configured discovery endpoint_18_18// Override discovery service endpoint_18const customService = await getDiscoveryService({_18 endpoint: "https://wallet.example.com/authn",_18 method: "HTTP/POST"_18})_18_18// Use with custom wallet service_18const walletService = await getDiscoveryService({_18 endpoint: "https://my-wallet.com/fcl",_18 provider: {_18 name: "My Wallet",_18 icon: "https://my-wallet.com/icon.png"_18 }_18})
Parameters
service
(optional)
- Type:
Partial<Service>
- Description: Optional partial service configuration to override defaults
Returns
_10export interface DiscoveryService extends Service {_10 discoveryAuthnInclude: string[]_10 discoveryAuthnExclude: string[]_10 discoveryFeaturesSuggested: string[]_10}
makeDiscoveryServices
Creates an array of discovery services by combining extension services from the window object with registered services from the service registry. This is used internally by FCL to gather all available wallet and authentication services.
Import
You can import the entire package and access the function:
_10import * as fcl from "@onflow/fcl-core"_10_10fcl.discovery.makeDiscoveryServices()
Or import the namespace directly:
_10import { discovery } from "@onflow/fcl-core"_10_10discovery.makeDiscoveryServices()
Usage
_10// Get all available discovery services_10const services = await makeDiscoveryServices()_10console.log(services.length) // Number of available services_10services.forEach(service => {_10 console.log(`Service: ${service.provider?.name}, Type: ${service.type}`)_10})
Returns
_10Promise<Service[]>