https://github.com/onflow/fcl-discovery
https://github.com/onflow/fcl-discovery
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/onflow/fcl-discovery
- Owner: onflow
- License: apache-2.0
- Created: 2020-09-23T23:52:23.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2025-03-18T14:53:19.000Z (9 months ago)
- Last Synced: 2025-04-05T04:07:00.220Z (8 months ago)
- Language: TypeScript
- Homepage: https://fcl-discovery.onflow.org
- Size: 2.73 MB
- Stars: 11
- Watchers: 35
- Forks: 19
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
## Discovery
When building an dapp on Flow using [@onflow/fcl](https://github.com/onflow/fcl-js), Discovery eliminates the need for dapp developers to write code to integrate their user's preferred wallet into their application. Instead, @onflow/fcl and this repo uses a secure discovery protocol that wallets can implement to connect to @onflow/fcl. The end result is dapps using @onflow/fcl automatically integrate all compatible wallets without their developers needing to write any custom code!
To read more about consuming/using this repo via FCL, visit the [Discovery docs](https://developers.flow.com/tools/fcl-js/reference/discovery).
## Getting Started
First, run the development server:
```bash
npm run dev
# or
yarn dev
```
Then add Discovery to your FCL app:
```
import * as fcl from "@onflow/fcl"
fcl.config({
"discovery.wallet": "https://fcl-discovery.onflow.org/testnet/authn",
"discovery.authn.endpoint": "https://fcl-discovery.onflow.org/api/testnet/authn"
})
```
## Networks
### Discovery UI URLs
| Environment | Example |
| ----------- | ---------------------------------------------------------------------- |
| Mainnet | `http://localhost:3002/authn` or `http://localhost:3002/mainnet/authn` |
| Testnet | `http://localhost:3002/testnet/authn` |
| Previewnet | `http://localhost:3002/previewnet/authn` |
| Local | `http://localhost:3002/local/authn` |
| Emulator | `http://localhost:3002/emulator/authn` |
### Discovery API Endpoints
| Environment | Example |
| ----------- | ------------------------------------------------------------------------------ |
| Mainnet | `http://localhost:3002/api/authn` or `http://localhost:3002/api/mainnet/authn` |
| Testnet | `http://localhost:3002/api/testnet/authn` |
| Previewnet | `http://localhost:3002/api/previewnet/authn` |
| Local | `http://localhost:3002/api/local/authn` |
| Emulator | `http://localhost:3002/api/emulator/authn` |
> Note: Local and emulator will return Dev Wallet as a service for developing locally with the default port of 8701. If you'd like to override the default port add ?port=0000 with the port being whatever you'd like to override it to.
## More Configuration
For more configuration options, please see the [**documentation**](https://developers.flow.com/tools/clients/fcl-js/discovery).
## Adding a Wallet to Discovery
Flow compatible wallets wanting to add their wallets to Discovery can do so by creating a PR with the following:
- Add your wallet's service information to the [services data file](https://github.com/onflow/fcl-discovery/blob/master/data/services.json)
- Please provide any metadata related to your service if required ([see metadata docs](https://github.com/onflow/fcl-discovery/blob/master/docs/service-fields.md))
- Provide a demo of your wallet that can be tested and is connected to Testnet
- Specify if your wallet is opt-in or not. Opt-in wallets are those that don't have support for authentication, authorization, and user signature services.
Before adding your wallet to Discovery, ensure your wallet meets the minimum [acceptance criteria](https://github.com/onflow/fcl-discovery/blob/master/docs/wallet-compliance-guide.md).
For more information/examples on how to build a Flow compatible wallet, check out the following links:
- [Wallet Provider Spec](https://github.com/onflow/fcl-js/blob/9bce741d3b32fde18b07084b62ea15f9bbdb85bc/packages/fcl/src/wallet-provider-spec/draft-v3.md)
- [FCL Dev Wallet](https://github.com/onflow/fcl-dev-wallet)
- [Example Chrome Extension Wallet](https://github.com/onflow/wallet-extension-example)
## Documentation
To learn more about the repo, take a look at the following resources:
- [Discovery](https://developers.flow.com/tools/fcl-js/reference/api#discovery) - Documentation for using Discovery with FCL.
- [FCL](https://developers.flow.com/tools/fcl-js) - Learn more about Flow's FCL
- [Next.js Documentation](https://nextjs.org/docs) - This app is built with Next. Learn about Next.js features and API.