WalletConnectModalService constructor
Creates a new instance of WalletConnectModalService.
web3App
is optional and can be used to pass in an already created Web3App
.
projectId
and metadata
are optional and can be used to create a new Web3App
.
You must provide either a projectId
and metadata
or an already created web3App
, or this will throw an ArgumentError.
requiredNamespaces
is optional and can be used to pass in a custom set of required namespaces.
explorerService is optional and can be used to pass in a custom IExplorerService.
recommendedWalletIds
is optional and can be used to pass in a custom set of recommended wallet IDs.
excludedWalletState
is optional and can be used to pass in a custom ExcludedWalletState.
excludedWalletIds
is optional and can be used to pass in a custom set of excluded wallet IDs.
Implementation
WalletConnectModalService({
IWeb3App? web3App,
String? projectId,
PairingMetadata? metadata,
Map<String, RequiredNamespace>? requiredNamespaces,
Set<String>? recommendedWalletIds,
ExcludedWalletState excludedWalletState = ExcludedWalletState.list,
Set<String>? excludedWalletIds,
}) {
if (web3App == null && projectId == null && metadata == null) {
throw ArgumentError(
'Either a projectId and metadata must be provided or an already created web3App.',
);
}
_web3App = web3App ??
Web3App(
core: Core(
projectId: projectId!,
),
metadata: metadata!,
);
_projectId = projectId ?? _web3App!.core.projectId;
if (requiredNamespaces != null) {
_requiredNamespaces = requiredNamespaces;
}
explorerService.instance = ExplorerService(
projectId: _projectId,
referer: _web3App!.metadata.name.replaceAll(' ', ''),
recommendedWalletIds: recommendedWalletIds,
excludedWalletState: excludedWalletState,
excludedWalletIds: excludedWalletIds,
);
}