WalletConnect class

WalletConnect is an open source protocol for connecting decentralised applications to mobile wallets with QR code scanning or deep linking.

A user can interact securely with any Dapp from their mobile phone, making WalletConnect wallets a safer choice compared to desktop or browser extension wallets.

Constructors

WalletConnect({String bridge = '', String uri = '', WalletConnectSession? session, SessionStorage? sessionStorage, CipherBox? cipher, SocketTransport? transport, String? clientId, PeerMeta? clientMeta})
WalletConnect is an open source protocol for connecting decentralised applications to mobile wallets with QR code scanning or deep linking.
factory

Properties

bridgeConnected bool
Check if walletconnect is currently connected with the bridge.
no setter
cipherBox CipherBox
The algorithm used to encrypt/decrypt payloads
getter/setter pair
connected bool
Check if a current session is connected.
no setter
hashCode int
The hash code for this object.
no setterinherited
payloadId int
Get a new random, payload id.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
session WalletConnectSession
The current active session.
final
sessionStorage SessionStorage?
The storage when sessions can be stored and retrieved.
final
signingMethods List<String>
Default signing methods (for Ethereum)
final

Methods

approveRequest({required int id, required String result}) Future
Approves a pending request responding with a hex encoded string https://docs.walletconnect.com/client-api#approve-call-request
approveSession({required List<String> accounts, required int chainId}) Future
Approves the session requested by the peer (dApp), responding with the accounts and client's id and meta. https://docs.walletconnect.com/client-api#approve-session-request-connect
close({bool forceClose = false}) Future
Close the connection This does not kill and clear the session.
connect({int? chainId, OnDisplayUriCallback? onDisplayUri}) Future<SessionStatus>
Creates a new session calling createSession if it doesnt exists, or returns the instantiated one.
createSession({int? chainId, OnDisplayUriCallback? onDisplayUri}) Future<SessionStatus>
Creates a new session between the dApp and wallet. The dapp should call this method for initiating the session. https://docs.walletconnect.com/client-api#create-new-session-session_request
isSilentPayload(JsonRpcRequest request) bool
Check if the request is a silent payload.
killSession({String? sessionError}) Future
Kill the current session. https://docs.walletconnect.com/client-api#kill-session-disconnect
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
on<T>(String eventName, OnEvent<T> callback) → void
Registers event subscriptions. https://docs.walletconnect.com/client-api#register-event-subscription Supported events: connect, disconnect, session_request, session_update
reconnect() → void
Reconnects to the web socket server.
registerListeners({OnConnectRequest? onConnect, OnSessionUpdate? onSessionUpdate, OnDisconnect? onDisconnect}) → void
Register callback listeners.
rejectRequest({required int id, String? errorMessage}) Future
Rejects a pending request specifing the error https://docs.walletconnect.com/client-api#reject-call-request
rejectSession({String? message}) Future
Rejects the session requested by the peer (dApp), responding with reason message. https://docs.walletconnect.com/client-api#reject-session-request-disconnect
sendCustomRequest({int? id, required String method, required List params, String? topic}) Future
Send a custom request. https://docs.walletconnect.com/client-api#send-custom-request
sendCustomResponse({required int id, String? result, String? error}) Future
Send a custom response.
toString() String
A string representation of this object.
inherited
updateSession(SessionStatus sessionStatus) Future
Updates the actual session requesting the peer to change some session data Only chainId and/or accounts can be changed. https://docs.walletconnect.com/client-api#update-session-session_update

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

protocol → const String
The wallet connect protocol
version → const int
The current wallet connect version