File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
java/com/samourai/wallet/api/explorer Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ package com .samourai .wallet .api .explorer ;
2+
3+ import org .slf4j .Logger ;
4+ import org .slf4j .LoggerFactory ;
5+
6+ public class ExplorerApi {
7+ private Logger log = LoggerFactory .getLogger (ExplorerApi .class );
8+
9+ private static final String EXPLORER_MAINNET = "https://blockstream.info/" ;
10+ private static final String EXPLORER_TESTNET = "https://blockstream.info/testnet/" ;
11+
12+ private static final String URL_TX = "tx/" ;
13+ private static final String URL_ADDRESS = "address/" ;
14+
15+ private boolean testnet ;
16+
17+ public ExplorerApi (boolean testnet ) {
18+ this .testnet = testnet ;
19+ }
20+
21+ public String getUrl () {
22+ return testnet ? EXPLORER_TESTNET : EXPLORER_MAINNET ;
23+ }
24+
25+ public String getUrlTx () {
26+ return getUrl ()+URL_TX ;
27+ }
28+
29+ public String getUrlTx (String txid ) {
30+ return getUrl ()+URL_TX +txid ;
31+ }
32+
33+ public String getUrlAddress () {
34+ return getUrl ()+URL_ADDRESS ;
35+ }
36+
37+ public String getUrlAddress (String address ) {
38+ return getUrl ()+URL_ADDRESS +address ;
39+ }
40+ }
You can’t perform that action at this time.
0 commit comments