@@ -10,6 +10,7 @@ class APIConfig {
10
10
final String transaction;
11
11
final String transactions;
12
12
final String sendTransaction;
13
+ final String blockHeight;
13
14
final APIType apiType;
14
15
final BasedUtxoNetwork network;
15
16
@@ -41,6 +42,11 @@ class APIConfig {
41
42
return baseUrl.replaceAll ("###" , address);
42
43
}
43
44
45
+ String getBlockHeight (int blockHaight) {
46
+ String baseUrl = blockHeight;
47
+ return baseUrl.replaceAll ("###" , "$blockHaight " );
48
+ }
49
+
44
50
factory APIConfig .fromBlockCypher (BasedUtxoNetwork network) {
45
51
String baseUrl;
46
52
switch (network) {
@@ -65,14 +71,15 @@ class APIConfig {
65
71
}
66
72
67
73
return APIConfig (
68
- url: "$baseUrl /addrs/###/?unspentOnly=true&includeScript=true&limit=2000" ,
69
- feeRate: baseUrl,
70
- transaction: "$baseUrl /txs/###" ,
71
- sendTransaction: "$baseUrl /txs/push" ,
72
- apiType: APIType .blockCypher,
73
- transactions: "$baseUrl /addrs/###/full?limit=200" ,
74
- network: network,
75
- );
74
+ url:
75
+ "$baseUrl /addrs/###/?unspentOnly=true&includeScript=true&limit=2000" ,
76
+ feeRate: baseUrl,
77
+ transaction: "$baseUrl /txs/###" ,
78
+ sendTransaction: "$baseUrl /txs/push" ,
79
+ apiType: APIType .blockCypher,
80
+ transactions: "$baseUrl /addrs/###/full?limit=200" ,
81
+ network: network,
82
+ blockHeight: "$baseUrl /blocks/###" );
76
83
}
77
84
78
85
factory APIConfig .mempool (BasedUtxoNetwork network) {
@@ -90,23 +97,23 @@ class APIConfig {
90
97
}
91
98
92
99
return APIConfig (
93
- url: "$baseUrl /address/###/utxo" ,
94
- feeRate: "$baseUrl /v1/fees/recommended" ,
95
- transaction: "$baseUrl /tx/###" ,
96
- sendTransaction: "$baseUrl /tx" ,
97
- apiType: APIType .mempool,
98
- transactions: "$baseUrl /address/###/txs" ,
99
- network: network,
100
- );
100
+ url: "$baseUrl /address/###/utxo" ,
101
+ feeRate: "$baseUrl /v1/fees/recommended" ,
102
+ transaction: "$baseUrl /tx/###" ,
103
+ sendTransaction: "$baseUrl /tx" ,
104
+ apiType: APIType .mempool,
105
+ transactions: "$baseUrl /address/###/txs" ,
106
+ network: network,
107
+ blockHeight : "$ baseUrl /block-height/###" );
101
108
}
102
109
103
- APIConfig ({
104
- required this .url,
105
- required this .feeRate,
106
- required this .transaction,
107
- required this .transactions,
108
- required this .sendTransaction,
109
- required this .apiType,
110
- required this .network,
111
- });
110
+ APIConfig (
111
+ { required this .url,
112
+ required this .feeRate,
113
+ required this .transaction,
114
+ required this .transactions,
115
+ required this .sendTransaction,
116
+ required this .apiType,
117
+ required this .network,
118
+ required this .blockHeight });
112
119
}
0 commit comments