diff --git a/lib/dto/ordinals/output_response b/lib/dto/ordinals/output_response.dart similarity index 57% rename from lib/dto/ordinals/output_response rename to lib/dto/ordinals/output_response.dart index cd25fe961..6faf40845 100644 --- a/lib/dto/ordinals/output_response +++ b/lib/dto/ordinals/output_response.dart @@ -1,3 +1,5 @@ +import 'package:stackwallet/dto/ordinals/transaction_response.dart'; + class OutputResponse { final OutputLinks links; final String address; @@ -15,11 +17,11 @@ class OutputResponse { factory OutputResponse.fromJson(Map json) { return OutputResponse( - links: OutputLinks.fromJson(json['_links']), - address: json['address'], - scriptPubkey: json['script_pubkey'], - transaction: json['transaction'], - value: json['value'], + links: OutputLinks.fromJson(json['_links'] as Map), + address: json['address'] as String, + scriptPubkey: json['script_pubkey'] as String, + transaction: json['transaction'] as String, + value: json['value'] as int, ); } } @@ -35,8 +37,8 @@ class OutputLinks { factory OutputLinks.fromJson(Map json) { return OutputLinks( - self: OutputLink.fromJson(json['self']), - transaction: TransactionLink.fromJson(json['transaction']), + self: OutputLink.fromJson(json['self'] as Map), + transaction: TransactionLink.fromJson(json['transaction'] as Map), ); } } \ No newline at end of file diff --git a/lib/services/ordinals_api.dart b/lib/services/ordinals_api.dart index 264223f8a..e83e9eb9e 100644 --- a/lib/services/ordinals_api.dart +++ b/lib/services/ordinals_api.dart @@ -4,6 +4,8 @@ import 'package:http/http.dart' as http; import 'package:stackwallet/dto/ordinals/feed_response.dart'; import 'package:stackwallet/dto/ordinals/inscription_response.dart'; import 'package:stackwallet/dto/ordinals/sat_response.dart'; +import 'package:stackwallet/dto/ordinals/transaction_response.dart'; +import 'package:stackwallet/dto/ordinals/output_response.dart'; class OrdinalsAPI { final String baseUrl; @@ -42,4 +44,14 @@ class OrdinalsAPI { final response = await _getResponse('/sat/$satNumber'); return SatResponse.fromJson(response); } + + Future getTransaction(String transactionId) async { + final response = await _getResponse('/tx/$transactionId'); + return TransactionResponse.fromJson(response); + } + + Future getTransactionOutputs(String transactionId) async { + final response = await _getResponse('/output/$transactionId'); + return OutputResponse.fromJson(response); + } }