The Flow Dev Wallet is a mock Flow wallet that simulates the protocols used by FCL to interact with the Flow blockchain on behalf of simulated user accounts.
IMPORTANT
This project implements an FCL compatible
interface, but should not be used as a reference for
building a production grade wallet.
This project should only be used in aid of local
development against a locally run instance of the Flow
blockchain like the Flow emulator, and should never be used in
conjunction with Flow Mainnet, Testnet, or any
other instances of Flow.
info
To see a full list of Flow compatible wallets visit Wallets page
The Flow Dev Wallet is designed to be used with @onflow/fcl version 1.0.0 or higher. The FCL package can be installed with: npm install @onflow/fcl or yarn add @onflow/fcl.
To use the dev wallet, configure FCL to point to the address of a locally running Flow emulator and the dev wallet endpoint.
You can create a new account by using the &Account constructor. When you do this, make sure to specify which account will pay for the creation fees by setting it as the payer.
The account you choose to pay these fees must have enough money to cover the cost. If it doesn't, the process will stop and the account won't be created.
transaction(publicKey: String) {
prepare(signer: &Account) {
let key = PublicKey(
publicKey: publicKey.decodeHex(),
signatureAlgorithm: SignatureAlgorithm.ECDSA_P256
)
let account = Account(payer: signer)
account.keys.add(
publicKey: key,
hashAlgorithm: HashAlgorithm.SHA3_256,
weight: 1000.0
)
}
}
To create a new Flow account refer to these resources
Retrieving the token balance of a specific account involves writing a script to pull data from onchain. The user may have both locked tokens as well as unlocked so to retrieve the total balance we would aggregate them together.
Releasing a new version of Dev Wallet is as simple as tagging and creating a release, a Github Action will then build a bundle of the Dev Wallet that can be used in other tools (such as CLI). If the update of the Dev Wallet is required in the CLI, a seperate update PR on the CLI should be created. For more information, please visit the fcl-dev-wallet GitHub repository.