1 min read
How to mint FLOW Token
Some actions on the network will require an account to have a certain amount of FLOW (tokens) - transaction and storage fees, account creation, etc.
Framework provides a method to query FLOW balances with getFlowBalance
and mint new tokens via mintFlow
.
Returns current FLOW token balance of the specified account.
Name | Type | Description |
---|---|---|
address | Address | address of the account to check |
Type | Description |
---|---|
string | UFix64 amount of FLOW tokens stored in account storage |
1import {2init,3emulator,4getAccountAddress,5getFlowBalance,6} from "@onflow/flow-js-testing"78const main = async () => {9const basePath = path.resolve(__dirname, "../cadence")1011await init(basePath)12await emulator.start()1314const Alice = await getAccountAddress("Alice")1516const [result, error] = await getFlowBalance(Alice)17console.log(result, error)1819await emulator.stop()20}2122main()
Sends transaction to mint the specified amount of FLOW and send it to recipient.
⚠️ Required: Framework shall be initialized with
init
method for this method to work.
Name | Type | Description |
---|---|---|
recipient | Address | address of the account to check |
amount | string | UFix64 amount of FLOW tokens to mint and send to recipient |
1import {init, emulator, mintFlow} from "@onflow/flow-js-testing"23const main = async () => {4const basePath = path.resolve(__dirname, "../cadence")56await init(basePath)7await emulator.start()89const Alice = await getAccountAddress("Alice")10const amount = "42.0"11const [mintResult, error] = await mintFlow(Alice)12console.log(mintResult, error)1314await emulator.stop()15}1617main()