Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 0.5.0
- Add `stakingPriority` method

## 0.4.5
- Create `StakeRewardsInfo`

Expand Down
60 changes: 20 additions & 40 deletions lib/src/network/explorer/explorer_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -2702,29 +2692,19 @@ class PrioritiesEstimate {

factory PrioritiesEstimate.fromJson(Map<String, dynamic> 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<String, PriorityEstimate> 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,
};
}

Expand Down
17 changes: 15 additions & 2 deletions lib/src/network/explorer/explorer_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -706,8 +706,21 @@ class ExplorerClient {

Future<PrioritiesEstimate> 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<PrioritiesEstimate> 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(
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down