Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API updates #49

Merged
merged 7 commits into from
Feb 20, 2024
Merged

API updates #49

merged 7 commits into from
Feb 20, 2024

Conversation

gabaldon
Copy link
Contributor

@gabaldon gabaldon commented Jan 4, 2024

close #51

@gabaldon gabaldon force-pushed the test-api-updates-2 branch 2 times, most recently from 3e0f896 to 65664f0 Compare January 8, 2024 11:52
@gabaldon gabaldon marked this pull request as ready for review January 8, 2024 11:55
pubspec.yaml Outdated Show resolved Hide resolved
example/explorer_example.dart Outdated Show resolved Hide resolved
@gabaldon gabaldon force-pushed the test-api-updates-2 branch 3 times, most recently from beb6fcd to 387365a Compare February 20, 2024 16:21
String toRawJson() => json.encode(jsonMap());

factory NetworkBalances.fromJson(Map<String, dynamic> json) =>
NetworkBalances(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
NetworkBalances(
NetworkBalances(
balances: List<Balance>.from(json["balances"].map((e) => Balance.fromJson(e))),
totalItems: json["total_items"],
totalBalancesSum: json["total_balance_sum"],
lastUpdated: json["last_updated"],
);

"balances": balances.map((e) => e.jsonMap()),
"total_items": totalItems,
"total_balances_sum": totalBalancesSum,
"lastUpdated": lastUpdated,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"lastUpdated": lastUpdated,
"last_updated": lastUpdated,

Balance({
required this.address,
required this.balance,
required this.level,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the variable is label, and needs to be updated in the json methods as well

Suggested change
required this.level,
required this.label,


factory NetworkReputation.fromJson(Map<String, dynamic> json) =>
NetworkReputation(
reputations: json["reputation"].map((e) => Reputation.fromJson(e)),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
reputations: json["reputation"].map((e) => Reputation.fromJson(e)),
reputations: List<Reputation>.from(json["reputation"].map((e) => Reputation.fromJson(e))),

factory Reputation.fromJson(Map<String, dynamic> json) => Reputation(
address: json["address"],
reputation: json["reputation"],
eligibility: json["eligility"],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
eligibility: json["eligility"],
eligibility: json["eligibility"],

final List<BlockchainInfo> blockchain;

factory Blockchain.fromJson(Map<String, dynamic> data) {
return Blockchain(
blockchain: List<BlockchainInfo>.from(
data['blockchain'].map((e) => BlockchainInfo.fromList(e))));
data['blockchain'].map((e) => BlockchainInfo.fromJson(e))),
reverted: data["reverted"],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
reverted: data["reverted"],
reverted: List<int>.from(data["reverted"]),

try {
return Status.fromJson(await client.get(api('status')));
PaginatedRequest<dynamic> result = await client.get(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reputation endpoint is not Paginated
https://witscan.xyz/api/documentation#get-/api/network/reputation

@gabaldon gabaldon merged commit eec0b6a into witnet:main Feb 20, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test sendTransaction with the new api version
2 participants