![]() |
VOOZH | about |
dotnet add package Nethereum.Wallet.UI.Components.Blazor --version 6.1.0
NuGet\Install-Package Nethereum.Wallet.UI.Components.Blazor -Version 6.1.0
<PackageReference Include="Nethereum.Wallet.UI.Components.Blazor" Version="6.1.0" />
<PackageVersion Include="Nethereum.Wallet.UI.Components.Blazor" Version="6.1.0" />Directory.Packages.props
<PackageReference Include="Nethereum.Wallet.UI.Components.Blazor" />Project file
paket add Nethereum.Wallet.UI.Components.Blazor --version 6.1.0
#r "nuget: Nethereum.Wallet.UI.Components.Blazor, 6.1.0"
#:package Nethereum.Wallet.UI.Components.Blazor@6.1.0
#addin nuget:?package=Nethereum.Wallet.UI.Components.Blazor&version=6.1.0Install as a Cake Addin
#tool nuget:?package=Nethereum.Wallet.UI.Components.Blazor&version=6.1.0Install as a Cake Tool
Production-ready Blazor component library providing complete Ethereum wallet UI for building decentralized applications. Implements platform-specific services for browser environments using MudBlazor Material Design components and browser localStorage for persistence.
NuGet Packages:
CommunityToolkit.Mvvm 8.4.0 - MVVM infrastructureMicrosoft.AspNetCore.Components 9.0.1 - Blazor coreMicrosoft.AspNetCore.Components.Web 9.0.1 - Blazor web componentsMudBlazor 8.* - Material Design UI componentsProject References:
Nethereum.Blazor - EIP-6963 integrationNethereum.Wallet.UI.Components - Platform-agnostic ViewModelsNethereum.Wallet - Wallet core servicesNethereum.Web3 - Ethereum interactiondotnet add package Nethereum.Wallet.UI.Components.Blazor
Register wallet services in your Program.cs:
Blazor WebAssembly:
using Nethereum.Wallet.UI.Components.Blazor.Extensions;
using Nethereum.Wallet.UI.Components.Blazor.Services;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
// Register scoped wallet services (default for WebAssembly)
builder.Services.AddNethereumWalletUI();
// Register storage services
builder.Services.AddSingleton<IWalletVaultService, LocalStorageWalletVaultService>();
builder.Services.AddSingleton<IWalletStorageService, LocalStorageWalletStorageService>();
builder.Services.AddSingleton<IEncryptionStrategy, AesEncryptionStrategy>();
await builder.Build().RunAsync();
Blazor Server:
using Nethereum.Wallet.UI.Components.Blazor.Extensions;
using Nethereum.Wallet.UI.Components.Blazor.Services;
var builder = WebApplication.CreateBuilder(args);
// Register scoped wallet services
builder.Services.AddNethereumWalletUI();
// Register storage services
builder.Services.AddScoped<IWalletVaultService, LocalStorageWalletVaultService>();
builder.Services.AddScoped<IWalletStorageService, LocalStorageWalletStorageService>();
builder.Services.AddSingleton<IEncryptionStrategy, AesEncryptionStrategy>();
var app = builder.Build();
app.Run();
Add the wallet component to your page:
@page "/"
@using Nethereum.Wallet.UI.Components.Blazor.NethereumWallet
<NethereumWallet OnConnected="@HandleWalletConnected"
Width="100%"
Height="100vh" />
@code {
private async Task HandleWalletConnected()
{
// Wallet is unlocked and ready
Console.WriteLine("Wallet connected!");
}
}
Initialize component registries in your app startup (after DI container is built):
var app = builder.Build();
// Initialize account type registries
var scope = app.Services.CreateScope();
scope.ServiceProvider.InitializeAccountTypes();
await app.RunAsync();
The package provides three registration methods in ServiceCollectionExtensions.cs:
Registers all wallet services with scoped lifetime (recommended for most scenarios).
Location: Extensions/ServiceCollectionExtensions.cs:46-142
Key Registrations:
// MudBlazor configuration
services.AddMudServices(config => {
config.SnackbarConfiguration.PositionClass = Defaults.Classes.Position.BottomLeft;
config.SnackbarConfiguration.VisibleStateDuration = 10000;
// ... additional snackbar configuration
});
// Platform services
services.AddScoped<IWalletNotificationService, BlazorWalletNotificationService>();
services.AddScoped<IWalletDialogService, BlazorWalletDialogService>();
services.AddScoped<IWalletLoadingService, MudLoadingService>();
// Component registries
services.AddScoped<IAccountCreationRegistry, AccountCreationRegistry>();
services.AddScoped<IAccountDetailsRegistry, AccountDetailsRegistry>();
services.AddScoped<IGroupDetailsRegistry, GroupDetailsRegistry>();
// ViewModels
services.AddScoped<NethereumWalletViewModel>();
services.AddScoped<WalletDashboardViewModel>();
services.AddScoped<CreateAccountViewModel>();
// Account type ViewModels
services.AddScoped<IAccountCreationViewModel, MnemonicAccountCreationViewModel>();
services.AddScoped<IAccountCreationViewModel, PrivateKeyAccountCreationViewModel>();
services.AddScoped<IAccountCreationViewModel, ViewOnlyAccountCreationViewModel>();
// Additional services
services.AddNetworkManagement();
services.AddTokenTransferServices();
services.AddTransactionServices();
services.AddPromptsServices();
Registers wallet services with singleton lifetime for application-wide state scenarios.
Location: Extensions/ServiceCollectionExtensions.cs:147-232
Uses Transient for ViewModels and Singleton for registries and infrastructure.
Component registries map ViewModels to Razor components dynamically using the IWalletUIRegistryContributor pattern.
Location: Extensions/ServiceCollectionExtensions.cs:276-318
public static void InitializeAccountTypes(this IServiceProvider serviceProvider)
{
serviceProvider.ConfigureAccountCreationRegistry();
serviceProvider.ConfigureAccountDetailsRegistry();
serviceProvider.ConfigureGroupDetailsRegistry();
serviceProvider.ConfigureDashboardPluginRegistry();
}
Account Creation Registry:
// Maps account creation ViewModels to Razor components
registry.Register<MnemonicAccountCreationViewModel, MnemonicAccountCreation>();
registry.Register<PrivateKeyAccountCreationViewModel, PrivateKeyAccountCreation>();
registry.Register<ViewOnlyAccountCreationViewModel, ViewOnlyAccountCreation>();
registry.Register<VaultMnemonicAccountViewModel, VaultMnemonicAccountEditor>();
Dashboard Plugin Registry:
// Maps dashboard plugins to components
componentRegistry.Register<AccountListPluginViewModel, AccountList>();
componentRegistry.Register<CreateAccountPluginViewModel, CreateAccount>();
componentRegistry.Register<WalletOverviewPluginViewModel, WalletOverview>();
componentRegistry.Register<NetworkManagementPluginViewModel, NetworkManagement>();
componentRegistry.Register<SendNativeTokenViewModel, TokenTransfer>();
componentRegistry.Register<PromptsPluginViewModel, PromptsPlugin>();
Ensures registries are initialized before component use.
Location: Services/WalletUIBootstrapper.cs:8-38
public sealed class WalletUIBootstrapper
{
private readonly IServiceProvider _serviceProvider;
private readonly IEnumerable<IWalletUIRegistryContributor> _registryContributors;
private bool _initialized;
public void EnsureInitialized()
{
if (_initialized) return;
// Initialize built-in account types
_serviceProvider.InitializeAccountTypes();
// Apply custom registry contributors (e.g., Trezor hardware wallet)
foreach (var contributor in _registryContributors)
{
contributor.Configure(_serviceProvider);
}
_initialized = true;
}
}
Implements IWalletDialogService using MudBlazor dialogs.
Location: Services/BlazorWalletDialogService.cs:10-149
Methods:
// Confirmation dialog with Yes/No options
Task<bool> ShowConfirmationAsync(string title, string message)
WalletPromptDialog componentIcons.Material.Filled.HelpOutlinetrue if user confirms// Information message dialog
Task ShowMessageAsync(string title, string message)
Icons.Material.Filled.Info// Warning confirmation dialog (destructive actions)
Task<bool> ShowWarningConfirmationAsync(string title, string message,
string confirmText = "Remove", string cancelText = "Cancel")
Icons.Material.Filled.Warning// Error message dialog
Task ShowErrorAsync(string title, string message)
Icons.Material.Filled.Error// Success message dialog
Task ShowSuccessAsync(string title, string message)
Icons.Material.Filled.CheckCircleDialog Options:
BackdropClick: false (prevents accidental dismissal)MaxWidth: MaxWidth.SmallCloseButton: false (requires explicit user action)Implements IWalletNotificationService using MudBlazor Snackbar.
Location: Services/BlazorWalletNotificationService.cs:7-138
Configuration:
Methods:
// Show notification with custom severity
void ShowNotification(string message, NotificationSeverity severity = NotificationSeverity.Info)
// Success notification (3 second duration)
void ShowSuccess(string message)
// Error notification (5 second duration, requires interaction)
void ShowError(string message)
RequireInteraction: true// Warning notification (4 second duration)
void ShowWarning(string message)
// Info notification (3 second duration)
void ShowInfo(string message)
// Notification with custom action button
void ShowNotificationWithAction(string message, NotificationSeverity severity, NotificationAction action)
Implements IWalletVaultService using browser localStorage for encrypted wallet storage.
Location: Services/LocalStorageWalletVaultService.cs:10-45
Storage Key: Nethereum.Wallet.Vault
Methods:
// Check if vault exists in localStorage
async Task<bool> VaultExistsAsync()
// Get encrypted vault data
async Task<string?> GetEncryptedAsync()
// Save encrypted vault data
async Task SaveEncryptedAsync(string encrypted)
// Delete vault from localStorage
async Task ResetStorageAsync()
Encryption:
Uses IEncryptionStrategy (typically AES-256) provided during service registration. Vault data is encrypted before storage and decrypted on retrieval.
Implements IWalletStorageService for persisting wallet configuration, networks, transactions, and DApp permissions.
Location: Services/LocalStorageWalletStorageService.cs:18-560
Storage Keys:
Nethereum.Wallet.Settings.{key}Nethereum.Wallet.UserNetworksNethereum.Wallet.CustomRpcs.{chainId}Nethereum.Wallet.ActiveRpcs.{chainId}Nethereum.Wallet.RpcHealth.{base64(rpcUrl)}Nethereum.Wallet.Transactions.Pending.{chainId}Nethereum.Wallet.Transactions.Recent.{chainId} (max 50)Nethereum.Wallet.DAppPermissions.{origin}Nethereum.Wallet.Settings.SelectedNetworkNethereum.Wallet.Settings.SelectedAccountKey Methods:
// Generic settings storage
async Task<T?> GetSettingAsync<T>(string key)
async Task SetSettingAsync<T>(string key, T value)
async Task RemoveSettingAsync(string key)
// Network management
async Task<List<ChainFeature>> GetUserNetworksAsync()
async Task SaveUserNetworkAsync(ChainFeature network)
async Task DeleteUserNetworkAsync(BigInteger chainId)
// RPC endpoint management
async Task<List<string>> GetActiveRpcsAsync(BigInteger chainId)
async Task SetActiveRpcsAsync(BigInteger chainId, List<string> rpcUrls)
async Task RemoveRpcAsync(BigInteger chainId, string rpcUrl)
// Transaction history
async Task<List<TransactionInfo>> GetPendingTransactionsAsync(BigInteger chainId)
async Task<List<TransactionInfo>> GetRecentTransactionsAsync(BigInteger chainId)
async Task SaveTransactionAsync(BigInteger chainId, TransactionInfo transaction)
async Task UpdateTransactionStatusAsync(BigInteger chainId, string hash, TransactionStatus status)
// DApp permission management
async Task<string?> GetDAppPermissionsAsync(string dappOrigin)
async Task SaveDAppPermissionsAsync(string dappOrigin, string permissionsJson)
async Task RemoveDAppPermissionsAsync(string dappOrigin)
Provides access to MudBlazor IDialogService for components that need dialog functionality outside the normal DI scope (e.g., hardware wallet prompt handlers).
Location: Services/WalletDialogAccessor.cs:5-14
public interface IWalletDialogAccessor
{
IDialogService? DialogService { get; set; }
}
Set by NethereumWallet.razor:223 on initialization.
Root wallet component managing authentication, vault creation, and dashboard routing.
Location: NethereumWallet/NethereumWallet.razor:1-390
Features:
Parameters:
[Parameter] public EventCallback OnConnected { get; set; }
[Parameter] public string? Width { get; set; } // Default: 100%
[Parameter] public string? Height { get; set; } // Default: 100%
[Parameter] public DrawerBehavior? DrawerBehavior { get; set; }
[Parameter] public int? ResponsiveBreakpoint { get; set; }
[Parameter] public int? SidebarWidth { get; set; }
[Parameter] public bool? ShowLogo { get; set; }
[Parameter] public bool? ShowApplicationName { get; set; }
[Parameter] public bool? ShowNetworkInHeader { get; set; }
[Parameter] public bool? ShowAccountDetailsInHeader { get; set; }
States:
Loading (Lines 32-43):
Config.ShowProgressIndicatorsLogin (Lines 44-109):
Wallet Creation (Lines 126-196):
Account Creation (Lines 111-117):
CreateAccount componentDashboard (Lines 118-123):
WalletDashboard componentDispatcher Registration (Lines 221-223):
WalletBlazorDispatcher.Register(RunOnUiThreadAsync);
DialogAccessor.DialogService = DialogService;
Enables background threads (e.g., transaction monitoring) to update UI safely.
Plugin-based dashboard with responsive sidebar navigation and dynamic content area.
Location: Dashboard/WalletDashboard.razor:1-568
Features:
Parameters:
[Parameter] public EventCallback OnLogout { get; set; }
[Parameter] public string? SelectedAccount { get; set; }
[Parameter] public string Title { get; set; } = "Wallet Dashboard"
[Parameter] public string Subtitle { get; set; } = "Manage your accounts, security, and wallet settings"
[Parameter] public string MobileTitle { get; set; } = "Wallet"
Layout Modes:
Desktop Layout (Lines 27-67):
GlobalConfig.SidebarWidth, default 280px)Mobile Layout (Lines 118-153):
Layout Behavior (Lines 526-546):
private bool ShouldShowSidebar()
{
return GlobalConfig.DrawerBehavior switch
{
DrawerBehavior.AlwaysShow => true, // Always show sidebar
DrawerBehavior.AlwaysHidden => false, // Always use overlay
DrawerBehavior.Responsive => !isCompact, // Responsive (default)
_ => !isCompact
};
}
Header (Lines 72-95):
Uses WalletHeader component displaying:
Plugin Rendering (Lines 100-114):
<DynamicComponent Type="@GetPluginComponentType(SelectedPlugin)"
Parameters="@GetPluginParameters(SelectedPlugin)"
@key="@GetPluginKey(SelectedPlugin)"
@ref="activePluginComponentRef" />
Plugin Parameters (Lines 340-373):
SelectedAccount: Current account addressComponentWidth: Current component width (for responsive components)IsCompact: Boolean indicating compact modeOnAccountAdded: Callback for account creation workflowOnReady: Callback for plugin initializationNavigation System (Lines 430-474):
private async Task OnNavigationRequestedAsync(object sender, DashboardNavigationEventArgs e)
{
pendingNavigationParameters = e.Parameters;
await SwitchToPlugin(e.PluginId);
}
private async void OnPluginReady(object pluginInstance)
{
if (pendingNavigationParameters != null && pluginInstance is INavigatablePlugin nav)
{
await nav.NavigateWithParametersAsync(pendingNavigationParameters);
pendingNavigationParameters = null;
}
}
Solves Blazor parameter caching issues by delivering navigation parameters when plugin is ready.
Built-in Plugins:
account-list) - Account managementcreate-account) - Account creation wizardnetwork_management) - Network managementPrompts) - DApp interaction promptsAuto-navigation to Prompts (Lines 436-462):
private async void OnPromptQueueChanged(object? sender, PromptQueueChangedEventArgs e)
{
if (e.ChangeType == PromptQueueChangeType.Added)
{
await DashboardNavService.NavigateToPluginAsync("Prompts");
}
else if (!PromptQueueService.HasPendingPrompts && SelectedPlugin?.PluginId == "Prompts")
{
// Return to first plugin when no prompts remain
await InvokeAsync(() => {
var plugins = AvailablePlugins.ToList();
SelectedPlugin = plugins.FirstOrDefault();
ActivePluginIndex = 0;
StateHasChanged();
});
}
}
Multi-step wizard for creating or importing mnemonic (HD wallet) accounts.
Location: WalletAccounts/Mnemonic/MnemonicAccountCreation.razor:1-*
Steps:
Setup (Lines 38-56):
Mnemonic (Lines 58-*):
Security (Final step):
Component Usage:
<WalletFormLayout Title="Create Mnemonic Account"
Steps="@formSteps"
CurrentStepIndex="@((int)CurrentStep)"
ShowBack="@(CurrentStep > FormStep.Setup)"
ShowContinue="@(CurrentStep != FormStep.Security)"
ShowPrimary="@(CurrentStep == FormStep.Security)"
OnBack="@GoToPreviousStep"
OnContinue="@HandleContinue"
OnPrimary="@CreateAccount">
</WalletFormLayout>
ViewModel: MnemonicAccountCreationViewModel (Nethereum.Wallet.UI.Components)
Generic dialog component used by BlazorWalletDialogService.
Location: Shared/WalletPromptDialog.razor:1-110
Parameters:
[Parameter] public string Title { get; set; } = ""
[Parameter] public string Message { get; set; } = ""
[Parameter] public string Icon { get; set; } = ""
[Parameter] public Color IconColor { get; set; } = Color.Primary
[Parameter] public string ConfirmText { get; set; } = "Confirm"
[Parameter] public string CancelText { get; set; } = "Cancel"
[Parameter] public Color ConfirmColor { get; set; } = Color.Primary
[Parameter] public bool ShowCancel { get; set; } = true
[Parameter] public bool IsLoading { get; set; } = false
[Parameter] public EventCallback<bool> OnResult { get; set; }
[Parameter] public RenderFragment? ChildContent { get; set; }
Structure (Lines 8-70):
<MudDialog>
<DialogContent>
<div class="wallet-prompt-dialog">
<div class="wallet-prompt-icon">
<MudIcon Icon="@Icon" Size="Size.Large" Color="@IconColor" />
</div>
<div class="wallet-prompt-content">
<MudText Typo="Typo.h6">@Title</MudText>
<MudText Typo="Typo.body1">@Message</MudText>
@ChildContent
</div>
</div>
</DialogContent>
<DialogActions>
<MudButton OnClick="HandleCancel">@CancelText</MudButton>
<MudButton Color="@ConfirmColor" OnClick="HandleConfirm" Disabled="@IsLoading">
@if (IsLoading)
{
<MudProgressCircular Size="Size.Small" Indeterminate="true" />
}
else
{
@ConfirmText
}
</MudButton>
</DialogActions>
</MudDialog>
Reusable form layout with step progression, navigation buttons, and consistent styling.
Location: Shared/WalletFormLayout.razor (referenced in MnemonicAccountCreation)
Used by account creation wizards (Mnemonic, PrivateKey, ViewOnly, Trezor).
Comprehensive header component displaying application info, network, account, and actions.
Location: Shared/WalletHeader.razor (referenced in WalletDashboard)
Features:
Transaction approval prompt for DApp-initiated transactions.
Location: Prompts/DAppTransactionPromptView.razor:1-80+
Steps:
Request Details (Lines 33-66):
Gas Configuration (Lines 68-79):
Component Usage:
<WalletFormLayout Title="@GetTitle()"
Subtitle="@GetSubtitle()"
Steps="@_steps"
CurrentStepIndex="@ViewModel.CurrentStep"
ShowBack="@(ViewModel.CurrentStep > 0 && ViewModel.CurrentStep < 2)"
ShowContinue="@(ViewModel.CurrentStep == 0)"
ShowPrimary="@(ViewModel.CurrentStep == 1)"
OnBack="HandleBack"
OnContinue="HandleContinue"
OnPrimary="HandlePrimary">
</WalletFormLayout>
Reuses: TransactionInput component for transaction details and gas configuration.
eth_sign, personal_sign)wallet_switchEthereumChain)wallet_addEthereumChain)Localization is registered in ServiceCollectionExtensions.cs:234-264:
private static void RegisterWalletUILocalization(IServiceCollection services)
{
services.TryAddSingleton<ILocalizationStorageProvider, BrowserLocalizationStorageProvider>();
services.TryAddSingleton<IWalletLocalizationService, WalletLocalizationService>();
// Component localizers
services.TryAddSingleton<IComponentLocalizer<NethereumWalletViewModel>, NethereumWalletLocalizer>();
services.TryAddSingleton<IComponentLocalizer<MnemonicAccountCreationViewModel>, MnemonicAccountEditorLocalizer>();
services.TryAddSingleton<IComponentLocalizer<PrivateKeyAccountCreationViewModel>, PrivateKeyAccountEditorLocalizer>();
services.TryAddSingleton<IComponentLocalizer<ViewOnlyAccountCreationViewModel>, ViewOnlyAccountEditorLocalizer>();
// ... additional localizers
}
Supported Languages: English (en-US), Spanish (es-ES)
Storage: Browser localStorage via BrowserLocalizationStorageProvider
Main wallet configuration (registered as singleton).
Usage in Component (NethereumWallet.razor:24):
@inject NethereumWalletConfiguration Config
Properties:
ShowProgressIndicators - Show loading spinnersAllowPasswordVisibilityToggle - Password visibility toggle buttonEnableKeyboardShortcuts - Enter key to submit formsBehavior.EnableWalletReset - Show "Reset Wallet" buttonBehavior.AutoFocusPasswordField - Auto-focus password on mountGlobal UI configuration (registered as singleton).
Usage in Component (NethereumWallet.razor:26, WalletDashboard.razor:17):
@inject INethereumWalletUIConfiguration GlobalConfig
Properties:
ApplicationName - Application name displayed in headerLogoPath / WelcomeLogoPath - Logo image pathsShowLogo / ShowApplicationName - Display togglesShowNetworkInHeader / ShowAccountDetailsInHeader - Header display optionsDrawerBehavior - Sidebar behavior (AlwaysShow, AlwaysHidden, Responsive)ResponsiveBreakpoint - Pixel width for mobile/desktop switch (default: 960px)SidebarWidth - Sidebar width in pixels (default: 280px)Location: Referenced in ServiceCollectionExtensions.cs:125
services.AddNetworkManagement();
Registers:
NetworkManagementPluginViewModelIChainManagementServiceINetworkIconProvider (default implementation)Location: Referenced in ServiceCollectionExtensions.cs:127
services.AddTokenTransferServices();
Registers:
SendNativeTokenViewModelTokenNativeTransferModelLocation: Referenced in ServiceCollectionExtensions.cs:129
services.AddTransactionServices();
Registers:
TransactionMonitoringService (IHostedService)ITransactionServiceLocation: Referenced in ServiceCollectionExtensions.cs:131
services.AddPromptsServices();
Registers:
PromptsPluginViewModelDAppTransactionPromptViewModelDAppSignaturePromptViewModelDAppChainSwitchPromptViewModelDAppChainAdditionPromptViewModelIPromptQueueServiceIChainAdditionPromptServiceSupported Browsers:
Browser Storage:
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Nethereum.Wallet;
using Nethereum.Wallet.UI.Components.Blazor.Extensions;
using Nethereum.Wallet.UI.Components.Blazor.Services;
using Nethereum.Wallet.UI.Components.Configuration;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
// Register wallet services
builder.Services.AddNethereumWalletUI();
// Register storage services
builder.Services.AddSingleton<IWalletVaultService, LocalStorageWalletVaultService>();
builder.Services.AddSingleton<IWalletStorageService, LocalStorageWalletStorageService>();
builder.Services.AddSingleton<IEncryptionStrategy, AesEncryptionStrategy>();
// Configure wallet UI
builder.Services.AddSingleton<INethereumWalletUIConfiguration>(sp =>
new DefaultNethereumWalletUIConfiguration
{
ApplicationName = "My DApp Wallet",
LogoPath = "logo.png",
WelcomeLogoPath = "welcome-logo.png",
ShowLogo = true,
ShowApplicationName = true,
DrawerBehavior = DrawerBehavior.Responsive,
ResponsiveBreakpoint = 960,
SidebarWidth = 280
});
var app = builder.Build();
// Initialize component registries
var scope = app.Services.CreateScope();
scope.ServiceProvider.InitializeAccountTypes();
await app.RunAsync();
@using Nethereum.Wallet.UI.Components.Blazor.NethereumWallet
<Router AppAssembly="@typeof(App).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
</Found>
<NotFound>
<PageTitle>Not found</PageTitle>
<LayoutView Layout="@typeof(MainLayout)">
<p>Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
@page "/"
@using Nethereum.Wallet.UI.Components.Blazor.NethereumWallet
<PageTitle>Wallet</PageTitle>
<div style="height: 100vh; width: 100vw;">
<NethereumWallet OnConnected="@HandleWalletConnected"
Width="100%"
Height="100%"
DrawerBehavior="DrawerBehavior.Responsive"
ResponsiveBreakpoint="960" />
</div>
@code {
private void HandleWalletConnected()
{
Console.WriteLine("Wallet connected and ready!");
}
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>My DApp Wallet</title>
<base href="/" />
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" rel="stylesheet" />
<link href="_content/MudBlazor/MudBlazor.min.css" rel="stylesheet" />
</head>
<body>
<div id="app">Loading...</div>
<script src="_framework/blazor.webassembly.js"></script>
<script src="_content/MudBlazor/MudBlazor.min.js"></script>
</body>
</html>
To add hardware wallet support (e.g., Trezor), install the additional package:
dotnet add package Nethereum.Wallet.UI.Components.Blazor.Trezor
Register Trezor services:
using Nethereum.Wallet.UI.Components.Blazor.Trezor.Extensions;
builder.Services.AddNethereumWalletUI();
builder.Services.AddTrezorWalletBlazorComponents();
// Initialize registries (includes Trezor components)
var scope = app.Services.CreateScope();
scope.ServiceProvider.InitializeAccountTypes();
The Trezor registry contributor automatically registers Trezor account types into the wallet UI.
Extensions:
Extensions/ServiceCollectionExtensions.cs:1-323 - Service registrationExtensions/NetworkServiceCollectionExtensions.cs - Network service registrationPlatform Services:
Services/BlazorWalletDialogService.cs:10-149 - MudBlazor dialogsServices/BlazorWalletNotificationService.cs:7-138 - Snackbar notificationsServices/LocalStorageWalletVaultService.cs:10-45 - Encrypted vault storageServices/LocalStorageWalletStorageService.cs:18-560 - Settings and data persistenceServices/WalletUIBootstrapper.cs:8-38 - Registry initializationServices/WalletDialogAccessor.cs:5-14 - Dialog service accessorServices/MudLoadingService.cs - Loading indicator serviceMain Components:
NethereumWallet/NethereumWallet.razor:1-390 - Root wallet componentDashboard/WalletDashboard.razor:1-568 - Dashboard with plugin systemAccount Creation:
WalletAccounts/Mnemonic/MnemonicAccountCreation.razor - Mnemonic account wizardWalletAccounts/PrivateKey/PrivateKeyAccountCreation.razor - Private key importWalletAccounts/ViewOnly/ViewOnlyAccountCreation.razor - View-only accountCreateAccount/CreateAccount.razor - Account type selectionAccount Details:
WalletAccounts/Mnemonic/MnemonicAccountDetails.razor - Mnemonic account detailsWalletAccounts/PrivateKey/PrivateKeyAccountDetails.razor - Private key account detailsWalletAccounts/ViewOnly/ViewOnlyAccountDetails.razor - View-only account detailsAccountDetails/AccountDetails.razor - Account details containerAccountDetails/GroupDetails.razor - Group details containerShared Components:
Shared/WalletPromptDialog.razor:1-110 - Generic dialogShared/WalletFormLayout.razor - Form layout with stepsShared/WalletHeader.razor - Dashboard headerShared/WalletTextField.razor - Text input fieldShared/WalletAddressDisplay.razor - Address display with copyShared/WalletMnemonicDisplay.razor - Mnemonic displayShared/WalletWordChips.razor - Word chip collectionShared/NotificationBadge.razor - Notification counter badgeShared/ - 60+ additional shared componentsDApp Prompts:
Prompts/DAppTransactionPromptView.razor:1-80+ - Transaction approvalPrompts/DAppPermissionPromptView.razor - Account connectionPrompts/DAppSignaturePromptView.razor - Message signingPrompts/DAppChainSwitchPromptView.razor - Network switchPrompts/DAppChainAdditionPromptView.razor - Custom network additionPrompts/PromptsPlugin.razor - Prompts dashboard pluginTransactions:
SendTransaction/TokenTransfer.razor - Send token wizardSendTransaction/TransactionInput.razor - Transaction input formSendTransaction/TransactionConfirmation.razor - Confirmation screenTransactions/TransactionHistory.razor - Transaction historyTransactions/PendingTransactionsList.razor - Pending transactionsNetworks:
Networks/NetworkManagement.razor - Network management hubNetworks/NetworkList.razor - Network listNetworks/NetworkCard.razor - Network cardNetworks/AddCustomNetwork.razor - Add custom network formMIT License - Part of the Nethereum project.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 1 NuGet packages that depend on Nethereum.Wallet.UI.Components.Blazor:
| Package | Downloads |
|---|---|
|
Nethereum.Wallet.UI.Components.Blazor.Trezor
Blazor prompt components and services tailored for Trezor hardware wallets. |
This package is not used by any popular GitHub repositories.