mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 17:57:40 +00:00
add output endpoint
This commit is contained in:
parent
828782f00c
commit
48e4f8c577
2 changed files with 21 additions and 7 deletions
|
@ -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<String, dynamic> 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<String, dynamic>),
|
||||
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<String, dynamic> json) {
|
||||
return OutputLinks(
|
||||
self: OutputLink.fromJson(json['self']),
|
||||
transaction: TransactionLink.fromJson(json['transaction']),
|
||||
self: OutputLink.fromJson(json['self'] as Map<String, dynamic>),
|
||||
transaction: TransactionLink.fromJson(json['transaction'] as Map<String, dynamic>),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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<TransactionResponse> getTransaction(String transactionId) async {
|
||||
final response = await _getResponse('/tx/$transactionId');
|
||||
return TransactionResponse.fromJson(response);
|
||||
}
|
||||
|
||||
Future<OutputResponse> getTransactionOutputs(String transactionId) async {
|
||||
final response = await _getResponse('/output/$transactionId');
|
||||
return OutputResponse.fromJson(response);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue