Dapps Integration
Flash wallet using WalletConnect open protocol to communicate securely to dapps.
Links
Demo https://flash-wallet-demo.vercel.app/
Source Code https://github.com/mintmasterapp/flash-wallet-demo
Wallet Connect https://docs.walletconnect.com/
Install
npm install --save @walletconnect/client
OR
yarn add @walletconnect/clientInitiate Connection
import WalletConnect from "@walletconnect/client";
// Create a connector
const connector = new WalletConnect({
bridge: "https://bridge.walletconnect.org", // Required
});
// Check if connection is already established
if (!connector.connected) {
// create new session
connector.createSession();
}
// Subscribe to connection events
connector.on("connect", (error, payload) => {
if (error) {
throw error;
}
// Get provided accounts and chainId
const { accounts, chainId } = payload.params[0];
});
connector.on("session_update", (error, payload) => {
if (error) {
throw error;
}
// Get updated accounts and chainId
const { accounts, chainId } = payload.params[0];
});
connector.on("disconnect", (error, payload) => {
if (error) {
throw error;
}
// Delete connector
});Send Transaction
Create Transaction Example
Transaction
Generate Byte
Supported Hedera Network
Flash Wallet supported all hedera networks e.g MAINNET, TESTNET, and PREVIEWNET.
After the connection is approved by the flash wallet. Flash Wallet responds accountId (solidityAddress) and chainId.
For MAINNET chainId is 1.
For TESTNET chainId is 2.
For PREVIEWNET chainId is 3.
Last updated