diff --git a/packages/mirai_web3/lib/services/web_modal_service.dart b/packages/mirai_web3/lib/services/web_modal_service.dart index ed554399..234acfc3 100644 --- a/packages/mirai_web3/lib/services/web_modal_service.dart +++ b/packages/mirai_web3/lib/services/web_modal_service.dart @@ -328,7 +328,7 @@ class Web3ModalService { tokenName: contractToken.name, timestamp: "", explorer: Uri.https( - "${_service.selectedChain?.blockExplorer?.url}/tx/${l.blockHash}"), + "${_service.selectedChain?.blockExplorer?.url.truncatedSlash}/tx/${l.blockHash}"), ), ); } @@ -364,3 +364,15 @@ class Web3ModalService { await _service.disconnect(); } } + +extension StringExt on String? { + String get truncatedSlash { + if (this == null || this!.isEmpty) { + return W3MChainPresets.chains['1']?.blockExplorer?.url ?? ''; + } else if (this!.endsWith('/')) { + return this!.substring(0, (this!.length) - 1); + } else { + return this!; + } + } +}