Updated on 2026-08-14
This commit is contained in:
parent
62fb73228e
commit
aa824b3dc6
8 changed files with 812 additions and 13 deletions
|
|
@ -25,6 +25,7 @@ public enum Blockchain {
|
|||
MaticTestNet("MATIC/test", "MTX", 1.0, R.drawable.tangem2, "Matic Testnet"),
|
||||
Stellar("XLM", "XLM", 1000000.0, R.drawable.ic_logo_stellar, "Stellar"),
|
||||
StellarTestNet("XLM/test", "XLM", 1000000.0, R.drawable.ic_logo_stellar, "Stellar Testnet"),
|
||||
StellarAsset("Asset", "XLM", 10000000.0, R.drawable.ic_logo_stellar, "Stellar"),
|
||||
Eos("EOS", "EOS", 10000.0, R.drawable.tangem2, "EOS");
|
||||
|
||||
Blockchain(String ID, String currency, double multiplier, int imageResource, String officialName) {
|
||||
|
|
|
|||
|
|
@ -31,6 +31,15 @@ import io.reactivex.schedulers.Schedulers;
|
|||
* {@link Listener}.onSuccess(...) callback
|
||||
*/
|
||||
public class ServerApiStellar {
|
||||
|
||||
public ServerApiStellar(Blockchain blockchain) {
|
||||
if (blockchain == Blockchain.Stellar || blockchain == Blockchain.StellarAsset) {
|
||||
currentURL = ServerURL.API_STELLAR;
|
||||
} else {
|
||||
currentURL = ServerURL.API_STELLAR_TESTNET;
|
||||
}
|
||||
}
|
||||
|
||||
private static String TAG = ServerApiStellar.class.getSimpleName();
|
||||
|
||||
/**
|
||||
|
|
@ -97,14 +106,6 @@ public class ServerApiStellar {
|
|||
requestsCount++;
|
||||
LOG.i(TAG, String.format("New request[%d]: %s", requestsCount, stellarRequest.getClass().getSimpleName()));
|
||||
|
||||
if (currentURL == null) {
|
||||
if (ctx.getBlockchain() == Blockchain.Stellar) {
|
||||
currentURL = ServerURL.API_STELLAR;
|
||||
} else if (ctx.getBlockchain() == Blockchain.StellarTestNet) {
|
||||
currentURL = ServerURL.API_STELLAR_TESTNET;
|
||||
}
|
||||
}
|
||||
|
||||
Observable<StellarRequest.Base> stellarObserver = Observable.just(stellarRequest)
|
||||
.doOnEach(stellarRequest1 -> doStellarRequest(ctx, stellarRequest))
|
||||
|
||||
|
|
@ -172,7 +173,7 @@ public class ServerApiStellar {
|
|||
stellarRequest.setError(null);
|
||||
try {
|
||||
Server server;
|
||||
if (ctx.getBlockchain() == Blockchain.Stellar) {
|
||||
if (ctx.getBlockchain() == Blockchain.Stellar || ctx.getBlockchain() == Blockchain.StellarAsset) {
|
||||
Network.usePublicNetwork();
|
||||
server = new Server(currentURL);
|
||||
} else if (ctx.getBlockchain() == Blockchain.StellarTestNet) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue