Flow
Installation
Magic interacts with the Flow blockchain via Magic's extension NPM package @magic-ext/flow
. The Flow extension also lets you interact with the blockchain using methods from Flow's Javascript SDK.
note
You can skip straight to our kitchen sink example directly:
๐ Flow Example
If this is your first time using Magic with Flow, you may need to wait up to 30 seconds after clicking the magic link before your login completes because Magic has to wait for the Flow blockchain to confirm a transaction that creates your account.
- NPM
- Yarn
Initializing Extension
- ES Modules/TypeScript
warning
You have to use the Magic LIVE API KEY with Flow Mainnet and Magic TEST API KEY with Flow Testnet, because which network to create your account according to the API KEY.
Send Transaction
Getting Test Flow
Before you can send transaction on the Flow blockchain, you'll need to acquire some test Flow (Flow's native cryptocurrency for test network).
- Go to our Flow Example application
- Login with your email address
- Copy your Flow public address
- Go to the Flow Faucet
- Fill in the form and paste your copied Flow public address in the Address field.
- You can receive 1000 test Flow
- Now you can use your test Flow in our example app
Call Extension Method
Note that the Magic Flow extension follows the method names and conventions of Flow's Javascript SDK. You can use the magic.flow.authorization()
method to replace the fcl.authenticate()
.
- ES Modules/TypeScript