Code Monkey home page Code Monkey logo

fcl-android's Introduction

FCL Android

Connect your dapp to users, their wallets and Flow.
Read the docs»

Quickstart · Report Bug · Contribute · Discord

Overview


This reference documents all the methods available in the SDK, and explains in detail how these methods work. SDKs are open source, and you can use them according to the licence.


Feature list:

  • Sign in/up with Wallet provider
  • Configure app
  • Query cadence script with arguments
  • Send transaction with non-custodial mode (Blocto)
  • Send transaction with custodial wallet
  • Support all access api endpoint such as GetAccount and GetLastestBlock
  • Sign user message
  • Verify user signature
  • Publish to maven center

Todo list:

  • Support custom authz function

Getting Started

Installing

Use the configuration below to add this SDK to your project using Maven or Gradle.

Gradle

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
implementation 'com.github.Outblock:fcl-android:0.09'

Config

Values only need to be set once. We recommend doing this once and as early in the life cycle as possible. To set a configuration value, the put method on the config instance needs to be called, the put method returns the config instance so they can be chained.

Fcl.config(
    appMetadata = AppMetadata(),
    env = FlowEnvironment(),
    // Not required: only required if you use the wallet connect function
    walletConnectMeta = WalletConnectMeta()
)

Common Configuration Keys

Name Example Description
accessNode (required) https://access-testnet.onflow.org API URL for the Flow Blockchain Access Node you want to be communicating with. See all available access node endpoints here.
location (required) https://foo.com Your application's site URL, can be requested by wallets and other services.
env testnet Used in conjunction with stored interactions. Possible values: local, canarynet, testnet, mainnet
appName Cryptokitties Your applications title, can be requested by wallets and other services.
appIcon https://fcl-discovery.onflow.org/images/blocto.png Url for your applications icon, can be requested by wallets and other services.

Wallet Interactions

  • These methods allows dapps to interact with FCL compatible wallets in order to authenticate the user and authorize transactions on their behalf.

authenticate

Calling this method will authenticate the current user via any wallet that supports FCL. Once called, FCL will initiate communication with the configured authn endpoint which lets the user select a wallet to authenticate with. Once the wallet provider has authenticated the user, FCL will set the values on the current user object for future use and authorization.

Fcl.authenticate(WalletProvider.DAPPER)

mutate

A convenience method that produces the needed authorization details for the current user to submit transactions to Flow. It defines a signing function that connects to a user's wallet provider to produce signatures to submit transactions.

Usage

Note: The default values for proposer, payer, and authorizations are already fcl.authz so there is no need to include these parameters, it is shown only for example purposes. See more on signing roles.

val tid = Fcl.mutate {
    cadence(
        """  
        transaction(test: String, testInt: Int) {           
	      prepare(signer: AuthAccount) {                
	          log(signer.address)   
	          log(test)   
	          log(testInt) 
          }
	}
	""".trimIndent()
    )
    arg { string("Test2") }
    arg { int(1) }
    gasLimit(1000)
}

Compatibility

Minimum Android SDK: FCL Android requires a minimum API level of 23.

License

See the LICENSE file for details.

fcl-android's People

Contributors

amartyasingh97 avatar jaymengxy avatar john990 avatar kai990 avatar lmcmz avatar naman14 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

fcl-android's Issues

页面加载进度条

进入页面后有长时间空白等待,对用户体验不太友好,希望作者大大可以加上页面加载进度提示

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.