merge upstream
This commit is contained in:
commit
a4aeccdefe
|
@ -28,6 +28,7 @@ public class Currencies {
|
||||||
public static final String BTCP = "BTCP"; //Bitcoin Private
|
public static final String BTCP = "BTCP"; //Bitcoin Private
|
||||||
public static final String BTX = "BTX"; //BitCore
|
public static final String BTX = "BTX"; //BitCore
|
||||||
public static final String ETH = "ETH";
|
public static final String ETH = "ETH";
|
||||||
|
public static final String EFL = "EFL";
|
||||||
public static final String LTC = "LTC";
|
public static final String LTC = "LTC";
|
||||||
public static final String VIA = "VIA";
|
public static final String VIA = "VIA";
|
||||||
public static final String DEX = "DEX";
|
public static final String DEX = "DEX";
|
||||||
|
@ -77,6 +78,7 @@ public class Currencies {
|
||||||
crypto.add(BCH);
|
crypto.add(BCH);
|
||||||
crypto.add(BTCP);
|
crypto.add(BTCP);
|
||||||
crypto.add(BTX);
|
crypto.add(BTX);
|
||||||
|
crypto.add(EFL);
|
||||||
crypto.add(ETH);
|
crypto.add(ETH);
|
||||||
crypto.add(LTC);
|
crypto.add(LTC);
|
||||||
crypto.add(VIA);
|
crypto.add(VIA);
|
||||||
|
|
|
@ -42,6 +42,7 @@ public class CoinmarketcapRateSource implements IRateSource {
|
||||||
coinIDs.put(Currencies.POT, 122);
|
coinIDs.put(Currencies.POT, 122);
|
||||||
coinIDs.put(Currencies.FLASH, 1755);
|
coinIDs.put(Currencies.FLASH, 1755);
|
||||||
coinIDs.put(Currencies.BTCP, 2575);
|
coinIDs.put(Currencies.BTCP, 2575);
|
||||||
|
coinIDs.put(Currencies.EFL, 234);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoinmarketcapRateSource() {
|
public CoinmarketcapRateSource() {
|
||||||
|
@ -62,6 +63,7 @@ public class CoinmarketcapRateSource implements IRateSource {
|
||||||
result.add(Currencies.POT);
|
result.add(Currencies.POT);
|
||||||
result.add(Currencies.FLASH);
|
result.add(Currencies.FLASH);
|
||||||
result.add(Currencies.BTCP);
|
result.add(Currencies.BTCP);
|
||||||
|
result.add(Currencies.EFL);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -87,9 +89,10 @@ public class CoinmarketcapRateSource implements IRateSource {
|
||||||
if (!getFiatCurrencies().contains(fiatCurrency)) {
|
if (!getFiatCurrencies().contains(fiatCurrency)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer cryptoId = coinIDs.get(cryptoCurrency);
|
Integer cryptoId = coinIDs.get(cryptoCurrency);
|
||||||
if(cryptoId == null){
|
if(cryptoId == null){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Map<String, Object> ticker = api.getTickers(cryptoId, fiatCurrency);
|
Map<String, Object> ticker = api.getTickers(cryptoId, fiatCurrency);
|
||||||
if(ticker == null){
|
if(ticker == null){
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
/*************************************************************************************
|
||||||
|
* Copyright (C) 2014-2016 GENERAL BYTES s.r.o. All rights reserved.
|
||||||
|
*
|
||||||
|
* This software may be distributed and modified under the terms of the GNU
|
||||||
|
* General Public License version 2 (GPL2) as published by the Free Software
|
||||||
|
* Foundation and appearing in the file GPL2.TXT included in the packaging of
|
||||||
|
* this file. Please note that GPL2 Section 2[b] requires that all works based
|
||||||
|
* on this software must also be made publicly available under the terms of
|
||||||
|
* the GPL2 ("Copyleft").
|
||||||
|
*
|
||||||
|
* Contact information
|
||||||
|
* -------------------
|
||||||
|
*
|
||||||
|
* GENERAL BYTES s.r.o.
|
||||||
|
* Web : http://www.generalbytes.com
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
package com.generalbytes.batm.server.extensions.extra.egulden;
|
||||||
|
|
||||||
|
import com.generalbytes.batm.server.coinutil.AddressFormatException;
|
||||||
|
import com.generalbytes.batm.server.coinutil.Base58;
|
||||||
|
import com.generalbytes.batm.server.extensions.ICryptoAddressValidator;
|
||||||
|
|
||||||
|
public class EguldenAddressValidator implements ICryptoAddressValidator {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAddressValid(String address) {
|
||||||
|
if (address.startsWith("L") || address.startsWith("E")) {
|
||||||
|
try {
|
||||||
|
Base58.decodeToBigInteger(address);
|
||||||
|
Base58.decodeChecked(address);
|
||||||
|
} catch (AddressFormatException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isPaperWalletSupported() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mustBeBase58Address() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,128 @@
|
||||||
|
/*************************************************************************************
|
||||||
|
* Copyright (C) 2014-2016 GENERAL BYTES s.r.o. All rights reserved.
|
||||||
|
*
|
||||||
|
* This software may be distributed and modified under the terms of the GNU
|
||||||
|
* General Public License version 2 (GPL2) as published by the Free Software
|
||||||
|
* Foundation and appearing in the file GPL2.TXT included in the packaging of
|
||||||
|
* this file. Please note that GPL2 Section 2[b] requires that all works based
|
||||||
|
* on this software must also be made publicly available under the terms of
|
||||||
|
* the GPL2 ("Copyleft").
|
||||||
|
*
|
||||||
|
* Contact information
|
||||||
|
* -------------------
|
||||||
|
*
|
||||||
|
* GENERAL BYTES s.r.o.
|
||||||
|
* Web : http://www.generalbytes.com
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
package com.generalbytes.batm.server.extensions.extra.egulden;
|
||||||
|
|
||||||
|
import com.generalbytes.batm.server.extensions.*;
|
||||||
|
import com.generalbytes.batm.server.extensions.extra.egulden.sources.FixPriceRateSource;
|
||||||
|
import com.generalbytes.batm.server.extensions.extra.egulden.wallets.eguldend.EguldendRPCWallet;
|
||||||
|
import com.generalbytes.batm.server.extensions.watchlist.IWatchList;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
|
public class EguldenExtension implements IExtension{
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "BATM e-Gulden extension";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IExchange createExchange(String exchangeLogin) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IWallet createWallet(String walletLogin) {
|
||||||
|
if (walletLogin !=null && !walletLogin.trim().isEmpty()) {
|
||||||
|
StringTokenizer st = new StringTokenizer(walletLogin,":");
|
||||||
|
String walletType = st.nextToken();
|
||||||
|
|
||||||
|
if ("eguldend".equalsIgnoreCase(walletType)) {
|
||||||
|
//"eguldend:protocol:user:password:ip:port:accountname"
|
||||||
|
|
||||||
|
String protocol = st.nextToken();
|
||||||
|
String username = st.nextToken();
|
||||||
|
String password = st.nextToken();
|
||||||
|
String hostname = st.nextToken();
|
||||||
|
String port = st.nextToken();
|
||||||
|
String accountName ="";
|
||||||
|
if (st.hasMoreTokens()) {
|
||||||
|
accountName = st.nextToken();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (protocol != null && username != null && password != null && hostname !=null && port != null && accountName != null) {
|
||||||
|
String rpcURL = protocol +"://" + username +":" + password + "@" + hostname +":" + port;
|
||||||
|
return new EguldendRPCWallet(rpcURL,accountName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ICryptoAddressValidator createAddressValidator(String cryptoCurrency) {
|
||||||
|
if (Currencies.EFL.equalsIgnoreCase(cryptoCurrency)) {
|
||||||
|
return new EguldenAddressValidator();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPaperWalletGenerator createPaperWalletGenerator(String cryptoCurrency) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPaymentProcessor createPaymentProcessor(String paymentProcessorLogin) {
|
||||||
|
return null; //no payment processors available
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IRateSource createRateSource(String sourceLogin) {
|
||||||
|
if (sourceLogin != null && !sourceLogin.trim().isEmpty()) {
|
||||||
|
StringTokenizer st = new StringTokenizer(sourceLogin,":");
|
||||||
|
String exchangeType = st.nextToken();
|
||||||
|
|
||||||
|
if ("eflfix".equalsIgnoreCase(exchangeType)) {
|
||||||
|
BigDecimal rate = BigDecimal.ZERO;
|
||||||
|
if (st.hasMoreTokens()) {
|
||||||
|
try {
|
||||||
|
rate = new BigDecimal(st.nextToken());
|
||||||
|
} catch (Throwable e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String preferedFiatCurrency = Currencies.USD;
|
||||||
|
if (st.hasMoreTokens()) {
|
||||||
|
preferedFiatCurrency = st.nextToken().toUpperCase();
|
||||||
|
}
|
||||||
|
return new FixPriceRateSource(rate, preferedFiatCurrency);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Set<String> getSupportedCryptoCurrencies() {
|
||||||
|
Set<String> result = new HashSet<String>();
|
||||||
|
result.add(Currencies.EFL);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<String> getSupportedWatchListsNames() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IWatchList getWatchList(String name) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
package com.generalbytes.batm.server.extensions.extra.egulden.sources;
|
||||||
|
|
||||||
|
import com.generalbytes.batm.server.extensions.Currencies;
|
||||||
|
import com.generalbytes.batm.server.extensions.Currencies;
|
||||||
|
import com.generalbytes.batm.server.extensions.IRateSource;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class FixPriceRateSource implements IRateSource {
|
||||||
|
private BigDecimal rate = BigDecimal.ZERO;
|
||||||
|
|
||||||
|
private String preferedFiatCurrency = Currencies.USD;
|
||||||
|
|
||||||
|
public FixPriceRateSource(BigDecimal rate,String preferedFiatCurrency) {
|
||||||
|
this.rate = rate;
|
||||||
|
for (String fiatCurrency : Currencies.FIAT_CURRENCIES) {
|
||||||
|
if (fiatCurrency.equalsIgnoreCase(preferedFiatCurrency)) {
|
||||||
|
this.preferedFiatCurrency = fiatCurrency;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<String> getCryptoCurrencies() {
|
||||||
|
Set<String> result = new HashSet<String>();
|
||||||
|
result.add(Currencies.EFL);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BigDecimal getExchangeRateLast(String cryptoCurrency, String fiatCurrency) {
|
||||||
|
if (Currencies.EFL.equalsIgnoreCase(cryptoCurrency)) {
|
||||||
|
return rate;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<String> getFiatCurrencies() {
|
||||||
|
Set<String> result = new HashSet<String>();
|
||||||
|
result.add(Currencies.USD);
|
||||||
|
result.add(Currencies.EUR);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPreferredFiatCurrency() {
|
||||||
|
return preferedFiatCurrency;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,120 @@
|
||||||
|
/*************************************************************************************
|
||||||
|
* Copyright (C) 2014-2016 GENERAL BYTES s.r.o. All rights reserved.
|
||||||
|
*
|
||||||
|
* This software may be distributed and modified under the terms of the GNU
|
||||||
|
* General Public License version 2 (GPL2) as published by the Free Software
|
||||||
|
* Foundation and appearing in the file GPL2.TXT included in the packaging of
|
||||||
|
* this file. Please note that GPL2 Section 2[b] requires that all works based
|
||||||
|
* on this software must also be made publicly available under the terms of
|
||||||
|
* the GPL2 ("Copyleft").
|
||||||
|
*
|
||||||
|
* Contact information
|
||||||
|
* -------------------
|
||||||
|
*
|
||||||
|
* GENERAL BYTES s.r.o.
|
||||||
|
* Web : http://www.generalbytes.com
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
package com.generalbytes.batm.server.extensions.extra.egulden.wallets.eguldend;
|
||||||
|
|
||||||
|
import com.azazar.bitcoin.jsonrpcclient.BitcoinException;
|
||||||
|
import com.azazar.bitcoin.jsonrpcclient.BitcoinJSONRPCClient;
|
||||||
|
import com.generalbytes.batm.server.extensions.Currencies;
|
||||||
|
import com.generalbytes.batm.server.extensions.IWallet;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class EguldendRPCWallet implements IWallet{
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(EguldendRPCWallet.class);
|
||||||
|
private static final String CRYPTO_CURRENCY = Currencies.EFL;
|
||||||
|
|
||||||
|
public EguldendRPCWallet(String rpcURL, String accountName) {
|
||||||
|
this.rpcURL = rpcURL;
|
||||||
|
this.accountName = accountName;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String rpcURL;
|
||||||
|
private String accountName;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<String> getCryptoCurrencies() {
|
||||||
|
Set<String> result = new HashSet<String>();
|
||||||
|
result.add(CRYPTO_CURRENCY);
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPreferredCryptoCurrency() {
|
||||||
|
return CRYPTO_CURRENCY;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String sendCoins(String destinationAddress, BigDecimal amount, String cryptoCurrency, String description) {
|
||||||
|
if (!CRYPTO_CURRENCY.equalsIgnoreCase(cryptoCurrency)) {
|
||||||
|
log.error("Eguldend wallet error: unknown cryptocurrency.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("Eguldend sending coins from " + accountName + " to: " + destinationAddress + " " + amount);
|
||||||
|
try {
|
||||||
|
String result = getClient(rpcURL).sendFrom(accountName, destinationAddress,amount.doubleValue());
|
||||||
|
log.debug("result = " + result);
|
||||||
|
return result;
|
||||||
|
} catch (BitcoinException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCryptoAddress(String cryptoCurrency) {
|
||||||
|
if (!CRYPTO_CURRENCY.equalsIgnoreCase(cryptoCurrency)) {
|
||||||
|
log.error("Eguldend wallet error: unknown cryptocurrency.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
List<String> addressesByAccount = getClient(rpcURL).getAddressesByAccount(accountName);
|
||||||
|
if (addressesByAccount == null || addressesByAccount.size() == 0) {
|
||||||
|
return null;
|
||||||
|
}else{
|
||||||
|
return addressesByAccount.get(0);
|
||||||
|
}
|
||||||
|
} catch (BitcoinException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BigDecimal getCryptoBalance(String cryptoCurrency) {
|
||||||
|
if (!CRYPTO_CURRENCY.equalsIgnoreCase(cryptoCurrency)) {
|
||||||
|
log.error("Eguldend wallet error: unknown cryptocurrency: " + cryptoCurrency);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
double balance = getClient(rpcURL).getBalance(accountName);
|
||||||
|
return BigDecimal.valueOf(balance);
|
||||||
|
} catch (BitcoinException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private BitcoinJSONRPCClient getClient(String rpcURL) {
|
||||||
|
try {
|
||||||
|
return new BitcoinJSONRPCClient(rpcURL);
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,13 +1,13 @@
|
||||||
package com.generalbytes.batm.server.extensions.extra.futurocoin.sources.yobit.dto;
|
package com.generalbytes.batm.server.extensions.extra.futurocoin.sources.yobit.dto;
|
||||||
|
|
||||||
public class YobitResponse {
|
public class YobitResponse {
|
||||||
private Ticker fot_usd;
|
private Ticker fto_usd;
|
||||||
|
|
||||||
public Ticker getFto_usd() {
|
public Ticker getFto_usd() {
|
||||||
return fot_usd;
|
return fto_usd;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFot_usd(Ticker fot_usd) {
|
public void setFto_usd(Ticker fto_usd) {
|
||||||
this.fot_usd = fot_usd;
|
this.fto_usd = fto_usd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,7 @@
|
||||||
<cryptocurrency>POT</cryptocurrency>
|
<cryptocurrency>POT</cryptocurrency>
|
||||||
<cryptocurrency>BTX</cryptocurrency>
|
<cryptocurrency>BTX</cryptocurrency>
|
||||||
<cryptocurrency>BTCP</cryptocurrency>
|
<cryptocurrency>BTCP</cryptocurrency>
|
||||||
|
<cryptocurrency>EFL</cryptocurrency>
|
||||||
</ratesource>
|
</ratesource>
|
||||||
<paymentprocessor prefix="bitcoinpay" name="BitcoinPay.com" >
|
<paymentprocessor prefix="bitcoinpay" name="BitcoinPay.com" >
|
||||||
<param name="apikey" />
|
<param name="apikey" />
|
||||||
|
@ -447,7 +448,7 @@
|
||||||
<cryptologo cryptocurrency="DEX" file="dex.png"/>
|
<cryptologo cryptocurrency="DEX" file="dex.png"/>
|
||||||
<cryptologo cryptocurrency="BCH" file="bch.png"/>
|
<cryptologo cryptocurrency="BCH" file="bch.png"/>
|
||||||
</extension>
|
</extension>
|
||||||
<extension class="com.generalbytes.batm.server.extensions.extra.bitcore.BitcoreExtension" >
|
<extension class="com.generalbytes.batm.server.extensions.extra.bitcore.BitcoreExtension" >
|
||||||
<wallet prefix="bitcored" name="Bitcored">
|
<wallet prefix="bitcored" name="Bitcored">
|
||||||
<param name="protocol" />
|
<param name="protocol" />
|
||||||
<param name="user" />
|
<param name="user" />
|
||||||
|
@ -483,6 +484,18 @@
|
||||||
</ratesource>
|
</ratesource>
|
||||||
<cryptologo cryptocurrency="FTO" file="fto.png"/>
|
<cryptologo cryptocurrency="FTO" file="fto.png"/>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension class="com.generalbytes.batm.server.extensions.extra.egulden.EguldenExtension" >
|
||||||
|
<wallet prefix="eguldend" name="Eguldend">
|
||||||
|
<param name="protocol" />
|
||||||
|
<param name="user" />
|
||||||
|
<param name="password" />
|
||||||
|
<param name="host" />
|
||||||
|
<param name="port" />
|
||||||
|
<param name="accountname" />
|
||||||
|
<cryptocurrency>EFL</cryptocurrency>
|
||||||
|
</wallet>
|
||||||
|
<cryptologo cryptocurrency="EFL" file="efl.png"/>
|
||||||
|
</extension>
|
||||||
<extension class="com.generalbytes.batm.server.extensions.extra.bitcoinprivate.BitcoinPrivateExtension" >
|
<extension class="com.generalbytes.batm.server.extensions.extra.bitcoinprivate.BitcoinPrivateExtension" >
|
||||||
<wallet prefix="btcpd" name="Bitcoinprivated">
|
<wallet prefix="btcpd" name="Bitcoinprivated">
|
||||||
<param name="protocol" />
|
<param name="protocol" />
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 8.4 KiB |
Loading…
Reference in New Issue