Skip to content

hedgehog-app/flutter-wallet-connect-v2

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wallet_connect_v2

WalletConnect V2 for Flutter

This lib came from the demand of our project Avacus

We used to try to make in pure Dart but it cost much time to build and test so we decide to make an wrapper to consume SDKs from WalletConnect team!

Getting Started

We make very detail in example so you can follow it.

Import and create instance

import 'package:wallet_connect_v2/wallet_connect_v2.dart';

final _client = WalletConnectV2();

Initiate WalletConnect SDK

_client.init(projectId: projectId, appMetadata: walletMetadata);

Listen needed events from our export

typedef OnConnectionStatus = Function(bool isConnected);
typedef OnSessionProposal = Function(SessionProposal proposal);
typedef OnSessionSettle = Function(Session session);
typedef OnSessionUpdate = Function(String topic);
typedef OnSessionDelete = Function(String topic);
typedef OnSessionRequest = Function(SessionRequest request);
typedef OnEventError = Function(String code, String message);

// example of listen to session proposal
_client.onSessionProposal = (proposal) {
  // do approve and reject session here
}

Connect to listen event

_client.connect();

Disconnect

_client.disconnect();

Pair with DApps

_client.pair(uri: uri);

Approve session

_client.approveSession(approval: approval);

Reject session

_client.rejectSession(proposalId: proposal.id);

Disconnect session

_client.disconnectSession(topic: topic);

Update session

_client.updateSession(approval: updateApproval);

Approve request

_client.approveRequest(topic: topic, requestId: requestId, result: result);

Reject request

_client.rejectRequest(topic: topic, requestId: requestId);

About

WalletConnect V2 for Flutter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 36.4%
  • Kotlin 32.3%
  • Swift 28.6%
  • Ruby 1.6%
  • Objective-C 1.1%