diff --git a/CHANGELOG.md b/CHANGELOG.md index eabb985..3e70700 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.5.0 +- Add `stakingPriority` method + ## 0.4.5 - Create `StakeRewardsInfo` diff --git a/lib/src/network/explorer/explorer_api.dart b/lib/src/network/explorer/explorer_api.dart index 32cd7c2..cf2b283 100644 --- a/lib/src/network/explorer/explorer_api.dart +++ b/lib/src/network/explorer/explorer_api.dart @@ -2672,28 +2672,18 @@ class HashInfo { class PrioritiesEstimate { PrioritiesEstimate({ - // required this.drtStinky, - // required this.drtLow, - // required this.drtMedium, - // required this.drtHigh, - // required this.drtOpulent, - required this.vttStinky, - required this.vttLow, - required this.vttMedium, - required this.vttHigh, - required this.vttOpulent, + required this.stinky, + required this.low, + required this.medium, + required this.high, + required this.opulent, }); - // final PriorityEstimate drtStinky; - // final PriorityEstimate drtLow; - // final PriorityEstimate drtMedium; - // final PriorityEstimate drtHigh; - // final PriorityEstimate drtOpulent; - final PriorityEstimate vttStinky; - final PriorityEstimate vttLow; - final PriorityEstimate vttMedium; - final PriorityEstimate vttHigh; - final PriorityEstimate vttOpulent; + final PriorityEstimate stinky; + final PriorityEstimate low; + final PriorityEstimate medium; + final PriorityEstimate high; + final PriorityEstimate opulent; factory PrioritiesEstimate.fromRawJson(String str) => PrioritiesEstimate.fromJson(json.decode(str)); @@ -2702,29 +2692,19 @@ class PrioritiesEstimate { factory PrioritiesEstimate.fromJson(Map json) { return PrioritiesEstimate( - // drtStinky: PriorityEstimate.fromJson(json["drt_stinky"]), - // drtLow: PriorityEstimate.fromJson(json["drt_low"]), - // drtMedium: PriorityEstimate.fromJson(json["drt_medium"]), - // drtHigh: PriorityEstimate.fromJson(json["drt_high"]), - // drtOpulent: PriorityEstimate.fromJson(json["drt_opulent"]), - vttStinky: PriorityEstimate.fromJson(json["vtt_stinky"]), - vttLow: PriorityEstimate.fromJson(json["vtt_low"]), - vttMedium: PriorityEstimate.fromJson(json["vtt_medium"]), - vttHigh: PriorityEstimate.fromJson(json["vtt_high"]), - vttOpulent: PriorityEstimate.fromJson(json["vtt_opulent"])); + stinky: PriorityEstimate.fromJson(json["stinky"]), + low: PriorityEstimate.fromJson(json["low"]), + medium: PriorityEstimate.fromJson(json["medium"]), + high: PriorityEstimate.fromJson(json["high"]), + opulent: PriorityEstimate.fromJson(json["opulent"])); } Map jsonMap() => { - // "drt_stinky": drtStinky, - // "drt_low": drtLow, - // "drt_medium": drtMedium, - // "drt_high": drtHigh, - // "drt_opulent": drtOpulent, - "vtt_stinky": vttStinky, - "vtt_low": vttLow, - "vtt_medium": vttMedium, - "vtt_high": vttHigh, - "vtt_opulent": vttOpulent, + "stinky": stinky, + "low": low, + "medium": medium, + "high": high, + "opulent": opulent, }; } diff --git a/lib/src/network/explorer/explorer_client.dart b/lib/src/network/explorer/explorer_client.dart index fbac234..745ca83 100644 --- a/lib/src/network/explorer/explorer_client.dart +++ b/lib/src/network/explorer/explorer_client.dart @@ -706,8 +706,21 @@ class ExplorerClient { Future valueTransferPriority() async { try { - return PrioritiesEstimate.fromJson( - await client.get(api('transaction/priority', {"key": "vtt"}))); + final result = + await client.get(api('transaction/priority', {"key": "vtt"})); + return PrioritiesEstimate.fromJson(result['vtt']); + } on ExplorerException catch (e) { + print(e); + throw ExplorerException( + code: e.code, message: '{"priority": "${e.message}"}'); + } + } + + Future stakingPriority() async { + try { + final result = + await client.get(api('transaction/priority', {"key": "st"})); + return PrioritiesEstimate.fromJson(result['st']); } on ExplorerException catch (e) { print(e); throw ExplorerException( diff --git a/pubspec.yaml b/pubspec.yaml index 22ba063..e0589c1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,7 +5,7 @@ description: A library to interface with the Witnet Protocol. - communicate with a rust node or wallet server - communicate with the explorer -version: 0.4.5 +version: 0.5.0 homepage: https://github.com/witnet/witnet.dart repository: https://github.com/witnet/witnet.dart