{"id":18752913,"url":"https://github.com/blocto/fcl-android","last_synced_at":"2025-04-13T00:31:27.123Z","repository":{"id":59669351,"uuid":"505659431","full_name":"blocto/fcl-android","owner":"blocto","description":"🌊 Flow Client Library for Android","archived":false,"fork":false,"pushed_at":"2024-02-29T03:15:07.000Z","size":572,"stargazers_count":20,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-26T18:52:34.570Z","etag":null,"topics":["blockchain","fcl","flow","flow-blockchain","flow-sdk"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blocto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-21T02:10:46.000Z","updated_at":"2025-03-04T12:24:38.000Z","dependencies_parsed_at":"2023-01-22T08:30:13.853Z","dependency_job_id":null,"html_url":"https://github.com/blocto/fcl-android","commit_stats":null,"previous_names":["blocto/fcl-android"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blocto%2Ffcl-android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blocto%2Ffcl-android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blocto%2Ffcl-android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blocto%2Ffcl-android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blocto","download_url":"https://codeload.github.com/blocto/fcl-android/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650590,"owners_count":21139670,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","fcl","flow","flow-blockchain","flow-sdk"],"created_at":"2024-11-07T17:23:06.799Z","updated_at":"2025-04-13T00:31:25.968Z","avatar_url":"https://github.com/blocto.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FCL\n\n![Maven Central](https://img.shields.io/maven-central/v/com.portto.fcl/fcl?color=%230075FF\u0026label=maven%20central)\n![Github Action](https://github.com/portto/fcl-android/actions/workflows/ci.yml/badge.svg)\n\nThe Flow Client Library (FCL) is a package used to interact with user wallets and the Flow\nblockchain. When using FCL for authentication, DApps are able to support all FCL-compatible wallets\non Flow and their users without any custom integrations or changes needed to the DApp code.\n\nRequirements\n-------\n\n- Min SDK 21+\n\nDownload\n-------\nIn `build.gradle` of app module, include this dependency\n\n```kotlin\nimplementation(\"com.portto.fcl:fcl:x.y.z\")\n```\n\n\u003e Add `maven(\"https://jitpack.io\")` or `maven { url 'https://jitpack.io' }` to your\n\u003e project's `build.gradle` if you haven't. This is required by [flow-jvm-sdk][10].\n\nInitialization\n-------\nAdd FCL content provider to `AndroidManifest.xml`.\n\n```xml\n\n\u003capplication\u003e\n    \u003cprovider android:authorities=\"com.portto.fcl.context\"\n        android:name=\"com.portto.fcl.lifecycle.FCLContentProvider\" android:exported=\"false\" /\u003e\n\u003c/application\u003e\n```\n\nTo initialize FCL, use the following function:\n\n```kotlin\nFcl.init(\n    env = Network.TESTNET,\n    supportedWallets = getWalletList(isMainnet),\n    appDetail = AppDetail(),\n)\n```\n\n- env: The network on which the app was built. i.e. `Network.TESTNET` or `Network.MAINNET`\n- supportedWallets: A list of **wallet providers** supported by the app. See **Wallet Discovery**\n  for more info.\n- appDetail(Optional): The information of the app.\n\nWallet Discovery\n-------\nKnowing all the wallets available to users on a blockchain can be challenging. FCL's Discovery\nmechanism relieves much of the burden of integrating with Flow compatible wallets and lets\ndevelopers focus on building their DApp and providing as many options as possible to their users.\n\nWhen you initialize FCL, it's required to provide a list of wallet providers. The following is an\nexample of adding `Blocto` and `Dapper` as wallet providers.\n\n```kotlin\nlistOf(Blocto.getInstance(BLOCTO_TESTNET_APP_ID), Dapper)\n```\n\n### Current Wallet Providers\n\n- [Blocto][1] (Fully supported) [Doc][7]\n- [Dapper Wallet][2] (Support only authn for now)\n\nOnce you've initialized FCL, you may use Discovery directly from `Discovery UI` or `Config`.\n\n### Discovery UI\n\nThe simplest way to integrate Wallet Discovery is to utilize Discovery UI.\n\n```kotlin\n// MainActivity.kt\nshowConnectWalletDialog(this) {\n    // authentication\n}\n```\n\n### Config\n\nIf you want to create your own authentication UI, the wallet providers are exposed as a list which\ncan be retrieved from\n`Fcl.config`.\n\n```kotlin\n// Create a custom UI by supplying wallet provider list as data\nval providerList = Fcl.config.supportedWallets\n// Once you get the user's selected provider, you need to add it to config\nFcl.config.put(Config.Option.SelectedWalletProvider(provider))\n```\n\nAuthentication\n-------\nIn order to interact with Flow blockchain, the current user's information is required. The user's\naccount address can be easily retrieved by calling `Fcl.authenticate()`.\n\n```kotlin\nwhen (val result = Fcl.authenticate()) {\n    is Result.Success -\u003e {\n        val address = result.value\n    }\n    is Result.Failure -\u003e {\n        // Handle error\n    }\n}\n```\n\nProof of Authentication\n-------\nA common desire that application developers have is to be able to prove that a user controls an\non-chain account. Proving ownership of an on-chain account is a way to authenticate a user with an\napplication backend. Fortunately, FCL provides a way to achieve this.\n\n### Authenticating a user using `AccountProof`\n\nBy supplying `AccountProofData` to authenticate, the signatures will be acquired and set to the\ncurrent user in `config`\n.\n\n```kotlin\nwhen (val result = Fcl.authenticate(accountProofData)) {\n    is Result.Success -\u003e {\n        val address = result.value\n    }\n    is Result.Failure -\u003e {\n        // Handle error\n    }\n}\n\n\n```\n\nVerify `AccountProof`\n-------\nIf you've acquired account proof signed data from `authenticate`, you may retrieve the signatures\nfrom `config`.\n\n```kotlin\nval accountProofData = Fcl.currentUser?.accountProofData\n```\n\nThen you can verify the signatures by calling `Fcl.verifyAccountProof()`.\n\n```kotlin\nwhen (val result = Fcl.verifyAccountProof(FLOW_APP_IDENTIFIER, accountProofData)) {\n    is Result.Success -\u003e {\n        val isValid = reuslt.value\n    }\n    is Result.Failure -\u003e {\n        // Handle error\n    }\n}\n```\n\n[Learn more about account proof][3]\n\nSign a message\n-------\nCryptographic signatures are a key part of the blockchain. They are used to prove ownership of an\naddress without exposing its private key. While primarily used for signing transactions,\ncryptographic signatures can also be used to sign arbitrary messages.\n\nTo sign a message, simply call `Fcl.signUserMessage`.\n\n```kotlin\nwhen (val result = Fcl.signUserMessage(message)) {\n    is Result.Success -\u003e {\n        val userSignatures = result.value\n    }\n    is Result.Failure -\u003e {\n        // Handle error\n    }\n}\n```\n\nVerify user signatures\n-------\n\n```kotlin\nwhen (val result = Fcl.verifyUserSignatures(userMessage, userSignatures)) {\n    is Result.Success -\u003e {\n        val isValid = reuslt.value\n    }\n    is Result.Failure -\u003e {\n        // Handle error \n    }\n}\n```\n\nBlockchain Interactions\n-------\n\n- `Fcl.query()`: Send arbitrary Cadence scripts to the chain and receive back decoded values\n- `Fcl.mutate()`: Send arbitrary transactions with your own signatures or via a user's wallet to\n  perform state changes on chain\n\n[Learn more about on-chain interactions][4]\n\n### Utilities\n\n- Get account details from any Flow address\n\n```kotlin\n// suspending function\nval account: FlowAccount = AppUtils.getAccount(address)\n```\n\n- Get the latest block\n\n```kotlin\n// suspending function\nval latestBlock: FlowBlock = AppUtils.getLatestBlock()\n```\n\n- Get transaction status\n\n```kotlin\n// suspending function\nval result = Fcl.getTransactionStatus(transactionId)\n```\n\nSupport\n-------\nTo report a specific problem or feature request, [open a new issue on Github][8]. For questions,\nsuggestions, or anything else, feel free to join FCL-Android's [Discussion][9].\n\nLicense\n-------\nSee the [LICENSE][6] file for details.\n\n[1]: https://blocto.io/\n\n[2]: https://www.meetdapper.com\n\n[3]: https://developers.flow.com/tools/fcl-js/reference/proving-authentication#authenticating-a-user-using-account-proof\n\n[4]: https://docs.onflow.org/fcl/reference/api/#on-chain-interactions\n\n[5]: https://forum.onflow.org/c/developer-tools/flow-fcl/22\n\n[6]: https://github.com/portto/fcl-android/blob/main/LICENSE\n\n[7]: https://docs.blocto.app/blocto-sdk/android-sdk/flow\n\n[8]: https://github.com/portto/fcl-android/issues/new/choose\n\n[9]: https://github.com/portto/fcl-android/discussions\n\n[10]: https://github.com/onflow/flow-jvm-sdk#gradle\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblocto%2Ffcl-android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblocto%2Ffcl-android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblocto%2Ffcl-android/lists"}