All Projects â†’ onflow â†’ fcl-js

onflow / fcl-js

Licence: Apache-2.0 license
FCL (Flow Client Library) - The best tool for building JavaScript (browser & NodeJS) applications on Flow 🌊

Programming Languages

javascript
184084 projects - #8 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to fcl-js

flow-ft
The Fungible Token standard on the Flow Blockchain
Stars: ✭ 120 (-60.26%)
Mutual labels:  smart-contracts, onflow
flow-js-testing
Testing framework to enable Cadence testing via a set of JavaScript methods and tools
Stars: ✭ 44 (-85.43%)
Mutual labels:  smart-contracts, cadence
create-truffle-dapp
Create and deploy Truffle projects with no configuration.
Stars: ✭ 17 (-94.37%)
Mutual labels:  smart-contracts
framework
Lightweight, open source and magic-free framework for testing solidity smart contracts.
Stars: ✭ 36 (-88.08%)
Mutual labels:  smart-contracts
bcdhub
Better Call Dev backend
Stars: ✭ 30 (-90.07%)
Mutual labels:  smart-contracts
haal
HÃĪÃĪl - Anonymous Electronic Voting System on Public Blockchains
Stars: ✭ 96 (-68.21%)
Mutual labels:  smart-contracts
blockchain-development
A complimentary course for an understanding of blockchain and its development like custom blockchain, dapps, etc.
Stars: ✭ 71 (-76.49%)
Mutual labels:  smart-contracts
soldoc
A solidity documentation generator, based in NatSpec format. 📃 with standalone HTML, pdf, gitbook and docsify output ✏ïļ just plug and play.
Stars: ✭ 54 (-82.12%)
Mutual labels:  smart-contracts
uniswap-arbitrage-flash-swap
Uniswap flash swap arbitrage solidity contracts
Stars: ✭ 341 (+12.91%)
Mutual labels:  smart-contracts
starter-kit-gsn
An OpenZeppelin starter kit focused on GSN.
Stars: ✭ 39 (-87.09%)
Mutual labels:  smart-contracts
bloqly
Bloqly: JavaScript Smart Contracts Engine + SQL database
Stars: ✭ 29 (-90.4%)
Mutual labels:  smart-contracts
proof-of-existence
Ethereum Smart Contract to prove a document's existence at some point by storing and verifying its hash.
Stars: ✭ 22 (-92.72%)
Mutual labels:  smart-contracts
quipuswap-core
🧙‍♂ïļ Repository containing QuipuSwap liquidity protocol smart-contracts written in Ligo language
Stars: ✭ 48 (-84.11%)
Mutual labels:  smart-contracts
TZComet
Contract Metadata Viewer on Tezos
Stars: ✭ 24 (-92.05%)
Mutual labels:  smart-contracts
idex-sdk-js
IDEX v3 SDK built with TypeScript, supporting both web and Node environments.
Stars: ✭ 35 (-88.41%)
Mutual labels:  smart-contracts
ethereum-solidity-course-updated-code
Up-to-date Solidity/web3.js/React/Next.js code for the udemy.com course Ethereum and Solidity: The Complete Developer's Guide.
Stars: ✭ 161 (-46.69%)
Mutual labels:  smart-contracts
bytecode-verifier
Compile Solidity source code and verify its bytecode matches the blockchain
Stars: ✭ 78 (-74.17%)
Mutual labels:  smart-contracts
create-ether-dapp
A template for building Full-Stack Blockchain Dapps using Next.js (React), TypeScript, Tailwind CSS, Hardhat, Solidity, and many more!
Stars: ✭ 100 (-66.89%)
Mutual labels:  smart-contracts
mStable-contracts
📃 Smart Contracts that make up the core of the mStable protocol
Stars: ✭ 277 (-8.28%)
Mutual labels:  smart-contracts
web3j-example
Android web3j example
Stars: ✭ 27 (-91.06%)
Mutual labels:  smart-contracts

FLOW-JS-SDK Continuous Integration lerna

Note: This repository makes use of ZenHub to track issue dependencies and long term planning. Please follow along here. You will be asked to create a (free) ZenHub account to view.

Upgrading to FCL 1.0.0

FCL 1.0.0 has arrived! When upgrading your project, reference the Release Notes for information on how to make your app compatible with its breaking changes.



FCL JS

Connect your dapp to users, their wallets and Flow.

Quickstart · Report Bug · Contribute

What is FCL?

The Flow Client Library (FCL) JS is a package used to interact with user wallets and the Flow blockchain. When using FCL for authentication, dapps are able to support all FCL-compatible wallets on Flow and their users without any custom integrations or changes needed to the dapp code.

It was created to make developing applications that connect to the Flow blockchain easy and secure. It defines a standardized set of communication patterns between wallets, applications, and users that is used to perform a wide variety of actions for your dapp. FCL also offers a full featured SDK and utilities to interact with the Flow blockchain.

While FCL itself is a concept and standard, FCL JS is the javascript implementation of FCL and can be used in both browser and server environments. All functionality for connecting and communicating with wallet providers is restricted to the browser. We also have FCL Swift implementation for iOS, see FCL Swift contributed by @lmcmz.


Getting Started

Requirements

  • Node version v12.0.0 or higher.

Build

npm i
npm run build

Installation

To use the FCL JS in your application, install using yarn or npm

npm i -S @onflow/fcl
yarn add @onflow/fcl

Importing

ES6

import * as fcl from "@onflow/fcl";

Node.js

const fcl = require("@onflow/fcl");

FCL for Dapps

Wallet Interactions

  • Wallet Discovery and Sign-up/Login: Onboard users with ease. Never worry about supporting multiple wallets. Authenticate users with any FCL compatible wallet.
// in the browser
import * as fcl from "@onflow/fcl"

fcl.config({
  "discovery.wallet": "https://fcl-discovery.onflow.org/testnet/authn", // Endpoint set to Testnet
})

fcl.authenticate()

FCL Default Discovery UI

Note: A Dapper Wallet developer account is required. To enable Dapper Wallet inside FCL, you need to follow this guide.

  • Interact with smart contracts: Authorize transactions via the user's chosen wallet
  • Prove ownership of a wallet address: Signing and verifying user signed data

Learn more about wallet interactions >

Blockchain Interactions

  • Query the chain: Send arbitrary Cadence scripts to the chain and receive back decoded values
import * as fcl from "@onflow/fcl";

const result = await fcl.query({
  cadence: `
    pub fun main(a: Int, b: Int, addr: Address): Int {
      log(addr)
      return a + b
    }
  `,
  args: (arg, t) => [
    arg(7, t.Int), // a: Int
    arg(6, t.Int), // b: Int
    arg("0xba1132bc08f82fe2", t.Address), // addr: Address
  ],
});
console.log(result); // 13
  • Mutate the chain: Send arbitrary transactions with your own signatures or via a user's wallet to perform state changes on chain.
import * as fcl from "@onflow/fcl";
// in the browser, FCL will automatically connect to the user's wallet to request signatures to run the transaction
const txId = await fcl.mutate({
  cadence: `
    import Profile from 0xba1132bc08f82fe2
    
    transaction(name: String) {
      prepare(account: AuthAccount) {
        account.borrow<&{Profile.Owner}>(from: Profile.privatePath)!.setName(name)
      }
    }
  `,
  args: (arg, t) => [arg("myName", t.String)],
});

Learn more about on-chain interactions >

Utilities

  • Get account details from any Flow address
  • Get the latest block
  • Transaction status polling
  • Event polling
  • Custom authorization functions

Learn more about utilities >

Next Steps

See the Flow App Quick Start.

See the full API Reference for all FCL functionality.

Learn Flow's smart contract language to build any script or transactions: Cadence.

Explore all of Flow docs and tools.


FCL for Wallet Providers

Wallet providers on Flow have the flexibility to build their user interactions and UI through a variety of ways:

  • Front channel communication via Iframe, pop-up, tab, or extension
  • Back channel communication via HTTP

FCL is agnostic to the communication channel and be configured to create both custodial and non-custodial wallets. This enables users to interact with wallet providers without needing to download an app or extension.

The communication channels involve responding to a set of pre-defined FCL messages to deliver the requested information to the dapp. Implementing a FCL compatible wallet on Flow is as simple as filling in the responses with the appropriate data when FCL requests them. If using any of the front-channel communication methods, FCL also provides a set of wallet utilities to simplify this process.

Current Wallet Providers

Wallet Discovery

It can be difficult to get users to discover new wallets on a chain. To solve this, we created a wallet discovery service that can be configured and accessed through FCL to display all available Flow wallet providers to the user. This means:

  • Dapps can display and support all FCL compatible wallets that launch on Flow without needing to change any code
  • Users don't need to sign up for new wallets - they can carry over their existing one to any dapp that uses FCL for authentication and authorization.

The discovery feature can be used via API allowing you to customize your own UI or you can use the default UI without any additional configuration.

Note: To get your wallet added to the discovery service, make a PR in fcl-discovery.

Building a FCL compatible wallet

  • Read the wallet guide to understand the implementation details.
  • Review the architecture of the FCL dev wallet for an overview.
  • If building a non-custodial wallet, see the Account API and the FLIP on derivation paths and key generation.

Support

Notice an problem or want to request a feature? Add an issue.

Discuss FCL with the community on the forum.

Join the Flow community on Discord to keep up to date and to talk to the team.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].