Skip to content

Commit

Permalink
feat: Added service listener in web3_service in mirai_web3
Browse files Browse the repository at this point in the history
  • Loading branch information
i-asimkhan committed Feb 22, 2024
1 parent 85b8d86 commit a2b39b6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/mirai_web3/lib/services/web_modal_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:mirai_web3/models/token.dart';
import 'package:mirai_web3/models/transaction_details.dart';
import 'package:mirai_web3/utils/extensions.dart';
import 'package:web3modal_flutter/pages/select_network_page.dart';
import 'package:web3modal_flutter/services/w3m_service/i_w3m_service.dart';
import 'package:web3modal_flutter/web3modal_flutter.dart';
import 'package:web3modal_flutter/widgets/widget_stack/widget_stack_singleton.dart';

Expand All @@ -34,6 +35,7 @@ class Web3ModalService {
ChainMetadata? metadata,
List<W3MChainInfo> customChains = const [],
List<ContractDetails> contractsList = const [],
void Function(W3MServiceStatus status)? listener,
}) async {
_chainMetadata = metadata ??
const ChainMetadata(
Expand Down Expand Up @@ -66,6 +68,9 @@ class Web3ModalService {
),
);
await _service.init();
_service.addListener(() {
listener?.call(_service.status);
});

isInitialize = true;
} catch (e) {
Expand Down

0 comments on commit a2b39b6

Please sign in to comment.