Viacoin: Extension and ICurrencies VIA String

This commit is contained in:
romanornr 2017-11-07 17:34:43 +01:00
parent b01a7a05b4
commit e785ff0ce9
No known key found for this signature in database
GPG Key ID: 3F92368F0D21A206
2 changed files with 109 additions and 0 deletions

View File

@ -23,6 +23,7 @@ public interface ICurrencies {
public static final String BCH = "BCH"; //Bitcoin Cash
public static final String ETH = "ETH";
public static final String LTC = "LTC";
public static final String VIA = "VIA";
public static final String DEX = "DEX";
public static final String DASH = "DASH";
public static final String DOGE = "DOGE";

View File

@ -0,0 +1,108 @@
/*************************************************************************************
* Copyright (C) 2014-2017 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.viacoin;
import com.generalbytes.batm.server.extensions.*;
import com.generalbytes.batm.server.extensions.extra.viacoin.sources.FixPriceRateSource;
import com.generalbytes.batm.server.extensions.extra.viacoin.sources.btce.BTCeRateSource;
import com.generalbytes.batm.server.extensions.extra.viacoin.wallets.viacoind.ViacoindRPCWallet;
import com.generalbytes.batm.server.extensions.watchlist.IWatchList;
import java.math.BigDecimal;
import java.util.*;
public class ViacoinExtentsion implements IExtension{
@Override
public String getName(){
return "BATM Viacoin 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("viacoind".equalsIgnoreCase(walletType)){
//"viacoind::protocol:user:password:ip:port:accountname"
String protcol = 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 ViacoindRPCWallet(rpcURL,accountName);
}
}
}
return null;
}
@Override
public ICryptoAddressValidator createAddressValidator(String cryptoCurrency){
if(ICurrencies.VIA.equalsIgnoreCase(cryptoCurrency)){
return new ViacoinAddressValidator();
}
return null;
}
@Override
public IPaperWalletGenerator createPaperWalletGenerator(String cryptoCurrency) {
return null;
}
@Override
public IPaymentProcessors createPaymentProcessor(String paymentProcessorLogin){
return null;
}
@Override
public IRateSource createRateSource(String sourceLogin) {
// to do
}
@Override
public Set<String> getSupportedCryptoCurrencies(){
Set<String> result = new HashSet<String>();
result.add(ICurrencies.VIA);
return result;
}
@Override
public Set<String> getSupportedWatchListsNames(){
return null;
}
@Override
public IWatchList getWatchList(String name){
return null;
}
}