Skip to main content

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:


_10
import * as fcl from "@onflow/fcl-core"
_10
_10
fcl.discovery.getDiscoveryService(service)

Or import the namespace directly:


_10
import { discovery } from "@onflow/fcl-core"
_10
_10
discovery.getDiscoveryService(service)

Usage


_18
// Get discovery service with default configuration
_18
const discoveryService = await getDiscoveryService()
_18
console.log(discoveryService.endpoint) // Configured discovery endpoint
_18
_18
// Override discovery service endpoint
_18
const customService = await getDiscoveryService({
_18
endpoint: "https://wallet.example.com/authn",
_18
method: "HTTP/POST"
_18
})
_18
_18
// Use with custom wallet service
_18
const 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


_10
export 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:


_10
import * as fcl from "@onflow/fcl-core"
_10
_10
fcl.discovery.makeDiscoveryServices()

Or import the namespace directly:


_10
import { discovery } from "@onflow/fcl-core"
_10
_10
discovery.makeDiscoveryServices()

Usage


_10
// Get all available discovery services
_10
const services = await makeDiscoveryServices()
_10
console.log(services.length) // Number of available services
_10
services.forEach(service => {
_10
console.log(`Service: ${service.provider?.name}, Type: ${service.type}`)
_10
})

Returns


_10
Promise<Service[]>


Rate this page