WalletConnectProvider class

Provider for Wallet Connect connection, typically used in mobile phone connection.

Constructors

WalletConnectProvider.fromInfura(String infuraId, {String? network, String? bridge, bool? qrCode, int? chainId, int? networkId, List<String>? mobileLinks})
Instantiate WalletConnectProvider using infuraId.
factory
WalletConnectProvider.fromRpc(Map<int, String> rpc, {String? network, String? bridge, bool? qrCode, required int chainId, int? networkId, List<String>? mobileLinks})
Instantiate WalletConnectProvider using rpc.
factory

Properties

accounts List<String>
Accounts which is at provider disposal.
no setter
chainId String
Main network chain id.
no setter
connected bool
true if this is connected successfully to rpc provider.
no setter
hashCode int
The hash code for this object.
no setterinherited
impl → _WalletConnectProviderImpl
Internal JS Object, should not be used directly.
finalinherited
isConnecting bool
true if this is connecting successfully to rpc provider.
no setter
rpc Map<int, String>
Chain id and rpc url map.
no setter
rpcUrl String
Main network rpc url.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
walletMeta WalletMeta
Connected wallet metadata, contains serveral information about connected provider.
no setter

Methods

connect() Future<void>
Enable session and try to connect to provider. (triggers QR Code modal)
disconnect() Future<void>
Close provider session.
listenerCount([String? eventName]) int
Returns the number of listeners for the eventName events. If no eventName is provided, the total number of listeners is returned.
listeners(String eventName) List
Returns the list of Listeners for the eventName events.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
off(String eventName, [Function? listener]) → dynamic
Remove a listener for the eventName event. If no listener is provided, all listeners for eventName are removed.
on(String eventName, Function listener) → dynamic
Add a listener to be triggered for each eventName event.
onAccountsChanged(void listener(List<String> accounts)) → dynamic
Add a listener to be triggered for each accountsChanged event.
once(String eventName, Function listener) → dynamic
Add a listener to be triggered for only the next eventName event, at which time it will be removed.
onChainChanged(void listener(int chainId)) → dynamic
Add a listener to be triggered for each chainChanged event.
onConnect(void listener()) → dynamic
Add a listener to be triggered for each connect event.
onDisconnect(void listener(int code, String reason)) → dynamic
Add a listener to be triggered for each disconnect event.
onMessage(void listener(String type, dynamic data)) → dynamic
Add a listener to be triggered for each message event type.
removeAllListeners([String? eventName]) → dynamic
Remove all the listeners for the eventName events. If no eventName is provided, all events are removed.
request<T>(String method, [dynamic params]) Future<T>
Use request to submit RPC requests with method and optionally params to Ethereum via Wallet Connect.
toString() String
A string representation of this object.
override

Operators

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

Static Methods

binance() WalletConnectProvider
Instantiate WalletConnectProvider object with Binance Mainnet rpc and QR code enabled, ready to connect.
harmony() WalletConnectProvider
Instantiate WalletConnectProvider object with Harmony Mainnet rpc and QR code enabled, ready to connect.
polygon() WalletConnectProvider
Instantiate WalletConnectProvider object with Polygon Mainnet rpc and QR code enabled, ready to connect.
xDai() WalletConnectProvider
Instantiate WalletConnectProvider object with xDai rpc and QR code enabled, ready to connect.