mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-29 04:49:51 +00:00
BTC
This commit is contained in:
parent
2673ecd45e
commit
1d793ab284
44 changed files with 1503 additions and 225 deletions
21
lib/bitcoin/api.dart
Normal file
21
lib/bitcoin/api.dart
Normal file
|
@ -0,0 +1,21 @@
|
|||
import 'dart:convert';
|
||||
import 'package:http/http.dart';
|
||||
|
||||
const blockchainInfoBaseURI = 'https://blockchain.info';
|
||||
const multiAddressURI = '$blockchainInfoBaseURI/multiaddr';
|
||||
|
||||
Future<List<String>> fetchAllAddresses({String xpub}) async {
|
||||
final uri = '$multiAddressURI?active=$xpub';
|
||||
final response = await get(uri);
|
||||
final responseJSON = json.decode(response.body) as Map<String, dynamic>;
|
||||
|
||||
print(responseJSON);
|
||||
|
||||
return (responseJSON['addresses'] as List<dynamic>).map((dynamic row) {
|
||||
if (row is Map<String, Object>) {
|
||||
return row['address'] as String;
|
||||
}
|
||||
|
||||
return '';
|
||||
}).toList();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue