Files
arbiter/useragent/lib/providers/evm.dart
hdbg 088fa6fe72
Some checks failed
ci/woodpecker/pr/server-audit Pipeline was successful
ci/woodpecker/pr/server-vet Pipeline failed
ci/woodpecker/pr/server-lint Pipeline failed
ci/woodpecker/pr/server-test Pipeline was successful
feat(evm): add grant management for EVM wallets
2026-03-16 18:53:10 +01:00

41 lines
1.1 KiB
Dart

import 'package:arbiter/features/connection/evm.dart';
import 'package:arbiter/proto/evm.pb.dart';
import 'package:arbiter/providers/connection/connection_manager.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'evm.g.dart';
@riverpod
class Evm extends _$Evm {
@override
Future<List<WalletEntry>?> build() async {
final connection = await ref.watch(connectionManagerProvider.future);
if (connection == null) {
return null;
}
return listEvmWallets(connection);
}
Future<void> refreshWallets() async {
final connection = await ref.read(connectionManagerProvider.future);
if (connection == null) {
state = const AsyncData(null);
return;
}
state = const AsyncLoading();
state = await AsyncValue.guard(() => listEvmWallets(connection));
}
Future<void> createWallet() async {
final connection = await ref.read(connectionManagerProvider.future);
if (connection == null) {
throw Exception('Not connected to the server.');
}
await createEvmWallet(connection);
state = await AsyncValue.guard(() => listEvmWallets(connection));
}
}