Web3ModalService constructor
- IWeb3App? web3App,
- String? projectId,
- PairingMetadata? metadata,
- Map<
String, RequiredNamespace> ? requiredNamespaces, - IExplorerService? explorerService,
- Set<
String> ? recommendedWalletIds, - ExcludedWalletState excludedWalletState = ExcludedWalletState.list,
- Set<
String> ? excludedWalletIds,
Creates a new instance of Web3ModalService.
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
Web3ModalService({
IWeb3App? web3App,
String? projectId,
PairingMetadata? metadata,
Map<String, RequiredNamespace>? requiredNamespaces,
IExplorerService? explorerService,
Set<String>? recommendedWalletIds,
ExcludedWalletState excludedWalletState = ExcludedWalletState.list,
Set<String>? excludedWalletIds,
}) {
if (projectId == null && metadata == null && web3App == 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;
}
this.explorerService = explorerService ??
ExplorerService(
projectId: _projectId,
recommendedWalletIds: recommendedWalletIds,
excludedWalletState: excludedWalletState,
excludedWalletIds: excludedWalletIds,
);
}