mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-22 18:44:31 +00:00
update OrdinalsInterface to not need baseUrl declared by withee classes
This commit is contained in:
parent
8e17556e41
commit
bc8f5ce8f9
2 changed files with 18 additions and 7 deletions
|
@ -1,8 +1,10 @@
|
|||
import 'package:stackwallet/services/ordinals_api.dart';
|
||||
import 'package:stackwallet/dto/ordinals/feed_response.dart';
|
||||
import 'package:stackwallet/dto/ordinals/feed_response.dart'; // Assuming this import is necessary
|
||||
import 'package:stackwallet/services/ordinals_api.dart'; // Assuming this import is necessary
|
||||
|
||||
mixin OrdinalsInterface {
|
||||
Future<FeedResponse> fetchLatestInscriptions(OrdinalsAPI ordinalsAPI) async {
|
||||
final OrdinalsAPI ordinalsAPI = OrdinalsAPI(baseUrl: 'http://ord-litecoin.stackwallet.com');
|
||||
|
||||
Future<FeedResponse> fetchLatestInscriptions() async {
|
||||
try {
|
||||
final feedResponse = await ordinalsAPI.getLatestInscriptions();
|
||||
// Process the feedResponse data as needed
|
||||
|
|
|
@ -12,10 +12,19 @@ import 'package:stackwallet/dto/ordinals/block_response.dart';
|
|||
import 'package:stackwallet/dto/ordinals/content_response.dart';
|
||||
import 'package:stackwallet/dto/ordinals/preview_response.dart';
|
||||
|
||||
class OrdinalsAPI {
|
||||
final String baseUrl;
|
||||
import 'package:stackwallet/dto/ordinals/feed_response.dart'; // Assuming this import is necessary
|
||||
|
||||
OrdinalsAPI({required this.baseUrl});
|
||||
class OrdinalsAPI {
|
||||
static final OrdinalsAPI _instance = OrdinalsAPI._internal();
|
||||
|
||||
factory OrdinalsAPI({required String baseUrl}) {
|
||||
_instance.baseUrl = baseUrl;
|
||||
return _instance;
|
||||
}
|
||||
|
||||
OrdinalsAPI._internal();
|
||||
|
||||
late String baseUrl;
|
||||
|
||||
Future<OrdinalsResponse> _getResponse(String endpoint) async {
|
||||
final response = await http.get(Uri.parse('$baseUrl$endpoint'));
|
||||
|
|
Loading…
Reference in a new issue