-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added
chain_details
and validate_address
action parsers in …
…`mirai_web3`
- Loading branch information
1 parent
2979639
commit bde0968
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
export 'package:mirai_web3/action_parsers/mirai_web3_connect/web3_connect_parser.dart'; | ||
export 'package:mirai_web3/action_parsers/mirai_web3_initialize/mirai_web3_initialize_parser.dart'; | ||
export 'package:mirai_web3/action_parsers/web3_sign_message/web3_sign_message.dart'; | ||
export 'package:mirai_web3/action_parsers/mirai_web3_chain_details/mirai_web3_chain_details_parser.dart'; | ||
export 'package:mirai_web3/action_parsers/mirai_web3_connect_with_network/web3_connect_with_network_parser.dart'; | ||
export 'package:mirai_web3/action_parsers/mirai_web3_load_tokens/web3_load_tokens_parser.dart'; | ||
export 'package:mirai_web3/action_parsers/mirai_web3_validate_address/mirai_web3_validate_address_parser.dart'; | ||
export 'package:mirai_web3/action_parsers/mirai_web3_transfer_token/web3_transfer_token_parser.dart'; | ||
export 'package:mirai_web3/action_parsers/web3_sign_message/web3_sign_message_parser.dart'; |
22 changes: 22 additions & 0 deletions
22
...rai_web3/lib/action_parsers/mirai_web3_chain_details/mirai_web3_chain_details_parser.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import 'dart:async'; | ||
|
||
import 'package:flutter/widgets.dart'; | ||
import 'package:mirai_framework/mirai_framework.dart'; | ||
import 'package:mirai_web3/services/web_modal_service.dart'; | ||
|
||
class MiraiWeb3ChainDetailsParser | ||
extends MiraiActionParser<Map<String, dynamic>> { | ||
const MiraiWeb3ChainDetailsParser(); | ||
|
||
@override | ||
String get actionType => 'web3ChainDetails'; | ||
|
||
@override | ||
getModel(Map<String, dynamic> json) => json; | ||
|
||
@override | ||
FutureOr<dynamic> onCall( | ||
BuildContext context, Map<String, dynamic> model) async { | ||
return Web3ModalService.getChainDetails(); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...b3/lib/action_parsers/mirai_web3_validate_address/mirai_web3_validate_address_parser.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import 'dart:async'; | ||
|
||
import 'package:flutter/widgets.dart'; | ||
import 'package:mirai_framework/mirai_framework.dart'; | ||
import 'package:mirai_web3/services/web_modal_service.dart'; | ||
|
||
class MiraiWeb3ValidateAddress extends MiraiActionParser<Map<String, dynamic>> { | ||
const MiraiWeb3ValidateAddress(); | ||
|
||
@override | ||
String get actionType => 'web3ValidateAddress'; | ||
|
||
@override | ||
getModel(Map<String, dynamic> json) => json; | ||
|
||
@override | ||
FutureOr<dynamic> onCall( | ||
BuildContext context, Map<String, dynamic> model) async { | ||
return Web3ModalService.validateCryptoAddress(model['address']); | ||
} | ||
} |