Conversation
|
Now I have the full picture. Here's my review of PR #418 - "Adjusting to new graphql API" by dewabisma. OverviewThis PR migrates from the old subsquid API (separate What's Good
Issues1. DRY violation in factory constructors
factory ReversibleTransferEvent.fromExecutedJson(Map<String, dynamic> json) =>
ReversibleTransferEvent._fromNestedJson(json, ReversibleTransferStatus.EXECUTED);
factory ReversibleTransferEvent.fromCancelledJson(Map<String, dynamic> json) =>
ReversibleTransferEvent._fromNestedJson(json, ReversibleTransferStatus.CANCELLED);
factory ReversibleTransferEvent._fromNestedJson(Map<String, dynamic> json, ReversibleTransferStatus status) {
final block = json['block'] as Map<String, dynamic>;
final scheduledTransfer = json['scheduledTransfer'] as Map<String, dynamic>;
return ReversibleTransferEvent(
id: json['id'] as String,
from: scheduledTransfer['from']?['id'] as String? ?? '',
to: scheduledTransfer['to']?['id'] as String? ?? '',
amount: BigInt.parse(scheduledTransfer['amount'] as String),
timestamp: DateTime.parse(json['timestamp'] as String),
txId: json['txId'] as String,
status: status,
scheduledAt: DateTime.parse(scheduledTransfer['scheduledAt'] as String),
extrinsicHash: json['extrinsicHash'] as String?,
blockNumber: block['height'] as int,
blockHash: block['hash'] as String? ?? '',
);
}2. Stale error messageIn print('Error fetching transactions by hash: $e');Should be 3.
|
Summary
Since we changed the reversible transfer in new subsquid, I make adjustment to our quantus app graphql query and also the implementations. I changed get by hash for checking executed transfer because it's not straightforward now we already have executed event and we better use txId for it.
I also deleted unused method and queries since it's already combined in account events now.
We shouldn't merge this PR unless we have deployed the new subsquid. Which I haven't done yet.