mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 20:19:25 +00:00
26 lines
No EOL
679 B
Dart
26 lines
No EOL
679 B
Dart
import 'dart:convert';
|
|
import 'package:cake_wallet/yat/yat_exception.dart';
|
|
import 'package:http/http.dart';
|
|
|
|
Future<String> fetchYatAddress(String emojiId) async {
|
|
const _apiKey = ''; // FIXME
|
|
const _requestURL = 'https://api.y.at/emoji_id/';
|
|
|
|
final url = _requestURL + emojiId;
|
|
|
|
final response = await get(
|
|
url,
|
|
headers: {
|
|
'Accept': '*/*',
|
|
'Authorization': 'Bearer $_apiKey'
|
|
}
|
|
);
|
|
|
|
if (response.statusCode != 200) {
|
|
throw YatException(text: response.body.toString());
|
|
}
|
|
|
|
final responseJSON = json.decode(response.body) as Map<String, dynamic>;
|
|
final yatAddress = responseJSON[''] as String; // FIXME
|
|
return yatAddress;
|
|
} |