Snippets

Browse an entire list of code examples for you to copy.

To add your own Snippet, make a Pull Request here.

Snippet

Bulk Transfer NFTs in Cadence

Learn how to bulk transfer NFTs to different addresses in Cadence using the example Avataaars contract.

Skills you'll learn
cadence
Snippet

Burn an NFT in Cadence

Learn how to burn an NFT in Cadence using the example Avataaars contract.

Skills you'll learn
cadence
Snippet

Create an Account in Cadence

Learn how to create an account directly in Cadence.

Skills you'll learn
cadence
Snippet

Deploy a Contract in Cadence

Learn how to deploy a smart contract directly in Cadence.

Skills you'll learn
cadence
Snippet

Mint an NFT in Cadence

Learn how to mint an NFT in Cadence using the example Avataaars contract.

Skills you'll learn
cadence
Snippet

Random Number in Cadence

Generate a random number bewteen min & max in Cadence using the built-in revertibleRandom function.

Skills you'll learn
cadence
Snippet

Time in Cadence

Learn how to get and calculate time in Cadence.

Skills you'll learn
cadence
Snippet

Transfer an NFT in Cadence

Learn how to transfer an NFT in Cadence using the example Avataaars contract.

Skills you'll learn
cadence
Snippet

Dynamically Import a Contract

Learn how to import a Cadence contract at run-time in a script or transaction.

Skills you'll learn
cadence
Snippet

Proving Authentication with FCL (Account Proof)

Learn how to verify a users authentication ("account proof") using FCL on testnet and mainnet.

Skills you'll learn
dapp
javascript
Snippet

Dapper Wallet-Only Authentication using FCL

Learn how to log in, log out, and access user data using only Dapper Wallet.

Skills you'll learn
dapp
javascript
Snippet

Authenticate using FCL

Learn how to log in, log out, and access user data.

Skills you'll learn
dapp
javascript
Snippet

Configure WalletConnect w/ FCL

Configure WalletConnect and mobile wallets with FCL.

Skills you'll learn
dapp
javascript
Snippet

Create an Account with FCL

Learn how to take a public key and create an account with it using FCL.

Skills you'll learn
dapp
javascript
Snippet

Execute a Transaction w/ FCL (Custodial Wallet)

Learn how to execute a basic transaction with FCL using a custodial wallet (Blocto, Lilico, etc).

Skills you'll learn
dapp
javascript
Snippet

Execute a Transaction w/ FCL (Non-Custodial Wallet)

Learn how to execute a basic transaction with FCL using a non-custodial wallet (aka with a private key).

Skills you'll learn
dapp
javascript
Snippet

Pass a Dictionary Arg to Cadence in FCL

Learn how to pass a dictionary argument to a Cadence script or transaction in FCL.

Skills you'll learn
javascript
Snippet

Pass a Storage/Public Path Arg to Cadence in FCL

Learn how to pass a storage/public path arg to a Cadence script or transaction in FCL.

Skills you'll learn
javascript
Snippet

Pass a Struct Arg to Cadence in FCL

Learn how to pass a struct argument to a Cadence script or transaction in FCL.

Skills you'll learn
javascript
Snippet

Execute a Script with FCL

Learn how to execute a basic script using FCL.

Skills you'll learn
dapp
javascript
Snippet

Sign a Message with FCL

Sign a user message with FCL on the frontend.

Skills you'll learn
dapp
javascript
Snippet

Fetch Historical Blocks

Learn how to fetch blocks with the Historical API.

Skills you'll learn
dapp
javascript
Snippet

Fetch Historical Events

Learn how to fetch events with the Historical API.

Skills you'll learn
dapp
javascript
Snippet

Fetch Historical Transaction Data

Learn how to fetch transaction data with the Historical API.

Skills you'll learn
dapp
javascript
Snippet

Cadence Setup using Unity SDK

Learn how to setup cadence using Flow Unity SDK.

Skills you'll learn
dapp
unity
Snippet

Execute Scripts using Unity SDK

Learn how to execute scripts using Flow Unity SDK.

Skills you'll learn
dapp
unity
Snippet

Setup and Authenticate using Unity SDK

Learn how to setup and authenticate using Flow Unity SDK.

Skills you'll learn
dapp
unity
Snippet

Send Transactions using Unity SDK

Learn how to send transactions using Flow Unity SDK.

Skills you'll learn
dapp
unity
Snippet

Listen for Events in FCL

Poll for events happening on chain using FCL.

Skills you'll learn
dapp
javascript
Snippet

Get all User NBATopShot Moments

Get all the moments a user has on NBATopShot.

Skills you'll learn
cadence
Snippet

Buy an NFT in Cadence

Buy an NFT listed on NFTStorefrontV2 via NFT Catalog.

Skills you'll learn
cadence
Snippet

Sign & Verify a User Message On Chain

Sign a user message with FCL and verify it on chain in Cadence.

Skills you'll learn
dapp
javascript
cadence