0 purchases
wallet connect v2
wallet_connect_v2 #
WalletConnect V2 for Flutter, available for both Wallet and DApp!
Fully support at Avacus, you can experience both Mainnet and Testnet as it supports network customization.
Feel free to use and don't hesitate to raise issue if there are.
Getting Started #
We make very detail in example so you can follow it for both Wallet and Dapp.
The connection is kept stable follow app lifecycle.
Import and create instance
import 'package:wallet_connect_v2/wallet_connect_v2.dart';
final _client = WalletConnectV2();
copied to clipboard
Initiate WalletConnect SDK
_client.init(projectId: projectId, appMetadata: walletMetadata);
copied to clipboard
Listen needed events from our export
// Wallet & DApp, listen to socket connection change
_client.onConnectionStatus = (isConnected) {
// do something, for e.g update UI
}
// Wallet only, listen to session proposal from DApp
_client.onSessionProposal = (proposal) {
// proposal request, handle to approve or reject
}
// Wallet & DApp, listen to new session which has been established
_client.onSessionSettle = (session) {
// we have detail information of session
}
// Wallet & DApp
_client.onSessionUpdate = (topic) {
// the session of topic has been updated
}
// Wallet & DApp
_client.onSessionDelete = (topic) {
// the session of topic has been deleted
}
// Wallet & DApp
_client.onSessionRequest = (request) {
// session request, handle to approve or reject
}
// DApp only, when Wallet reject the proposal
_client.onSessionRejection = (topic) {
// handle rejection here, for e.g hide the uri popup
}
// DApp only, when Wallet approve and reject session request
_client.onSessionResponse = (topic) {
// handle response here, for e.g update UI
}
copied to clipboard
Connect to listen event, for Wallet & DApp to connect to Relay service
_client.connect();
copied to clipboard
Disconnect, for Wallet & DApp to disconnect with Relay service
_client.disconnect();
copied to clipboard
Pair with DApps for Wallet only
_client.pair(uri: uri);
copied to clipboard
Approve session for Wallet only
_client.approveSession(approval: approval);
copied to clipboard
Reject session for Wallet only
_client.rejectSession(proposalId: proposal.id);
copied to clipboard
Disconnect session for Wallet & DApp
_client.disconnectSession(topic: topic);
copied to clipboard
Update session for Wallet & DApp
_client.updateSession(approval: updateApproval);
copied to clipboard
Approve request for Wallet only
_client.approveRequest(topic: topic, requestId: requestId, result: result);
copied to clipboard
Reject request for Wallet only
_client.rejectRequest(topic: topic, requestId: requestId);
copied to clipboard
Create pair for DApp only
_client.createPair(namespaces: namespaces);
copied to clipboard
Send request for DApp only
_client.sendRequest(request: request);
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.