BPUB-71: Block.io wallet should have support for mining fee priority
This commit is contained in:
parent
bdbf814deb
commit
876a69a59c
|
@ -0,0 +1,121 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="module" module-name="server_extensions_api" />
|
||||||
|
<orderEntry type="module-library">
|
||||||
|
<library>
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MODULE_DIR$/libs/base64-2.3.8.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</orderEntry>
|
||||||
|
<orderEntry type="module-library">
|
||||||
|
<library>
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MODULE_DIR$/libs/bitcoin-json-rpc-client-1.0.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</orderEntry>
|
||||||
|
<orderEntry type="module-library">
|
||||||
|
<library>
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MODULE_DIR$/libs/commons-io-2.4.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</orderEntry>
|
||||||
|
<orderEntry type="module-library">
|
||||||
|
<library>
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MODULE_DIR$/libs/guava-18.0.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</orderEntry>
|
||||||
|
<orderEntry type="module-library">
|
||||||
|
<library>
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MODULE_DIR$/libs/jackson-annotations-2.4.0.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</orderEntry>
|
||||||
|
<orderEntry type="module-library">
|
||||||
|
<library>
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MODULE_DIR$/libs/jackson-core-2.4.0.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</orderEntry>
|
||||||
|
<orderEntry type="module-library">
|
||||||
|
<library>
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MODULE_DIR$/libs/jackson-databind-2.4.0.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</orderEntry>
|
||||||
|
<orderEntry type="module-library">
|
||||||
|
<library>
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MODULE_DIR$/libs/javax.ws.rs-api-2.0.1.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</orderEntry>
|
||||||
|
<orderEntry type="module-library">
|
||||||
|
<library>
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MODULE_DIR$/libs/rescu-1.7.2-SNAPSHOT.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</orderEntry>
|
||||||
|
<orderEntry type="module-library">
|
||||||
|
<library>
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MODULE_DIR$/libs/xchange-bitfinex-4.0.1-SNAPSHOT.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</orderEntry>
|
||||||
|
<orderEntry type="module-library">
|
||||||
|
<library>
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MODULE_DIR$/libs/xchange-core-4.0.1-SNAPSHOT.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</orderEntry>
|
||||||
|
<orderEntry type="module-library">
|
||||||
|
<library>
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MODULE_DIR$/libs/xchange-itbit-4.0.1-SNAPSHOT.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</orderEntry>
|
||||||
|
</component>
|
||||||
|
</module>
|
|
@ -52,7 +52,12 @@ public class DogecoinExtension implements IExtension{
|
||||||
if ("blockio".equalsIgnoreCase(walletType)) {
|
if ("blockio".equalsIgnoreCase(walletType)) {
|
||||||
String apikey = st.nextToken();
|
String apikey = st.nextToken();
|
||||||
String pin = st.nextToken();
|
String pin = st.nextToken();
|
||||||
return new BlockIOWallet(apikey,pin);
|
String priority = null;
|
||||||
|
if (st.hasMoreTokens()) {
|
||||||
|
priority = st.nextToken();
|
||||||
|
}
|
||||||
|
return new BlockIOWallet(apikey,pin, priority);
|
||||||
|
|
||||||
}else if ("dogecoind".equalsIgnoreCase(walletType)) {
|
}else if ("dogecoind".equalsIgnoreCase(walletType)) {
|
||||||
//"dogecoind:protocol:user:password:ip:port:accountname"
|
//"dogecoind:protocol:user:password:ip:port:accountname"
|
||||||
|
|
||||||
|
|
|
@ -8,18 +8,36 @@ import si.mazi.rescu.RestProxyFactory;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static com.generalbytes.batm.server.extensions.extra.dogecoin.wallets.blockio.IBlockIO.PRIORITY_HIGH;
|
||||||
|
import static com.generalbytes.batm.server.extensions.extra.dogecoin.wallets.blockio.IBlockIO.PRIORITY_LOW;
|
||||||
|
import static com.generalbytes.batm.server.extensions.extra.dogecoin.wallets.blockio.IBlockIO.PRIORITY_MEDIUM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by b00lean on 8/11/14.
|
* Created by b00lean on 8/11/14.
|
||||||
*/
|
*/
|
||||||
public class BlockIOWallet implements IWallet {
|
public class BlockIOWallet implements IWallet {
|
||||||
private String apiKey;
|
private String apiKey;
|
||||||
private String pin;
|
private String pin;
|
||||||
|
private String priority;
|
||||||
|
|
||||||
private IBlockIO api;
|
private IBlockIO api;
|
||||||
|
|
||||||
public BlockIOWallet(String apiKey, String pin) {
|
public BlockIOWallet(String apiKey, String pin, String priority) {
|
||||||
this.apiKey = apiKey;
|
this.apiKey = apiKey;
|
||||||
this.pin = pin;
|
this.pin = pin;
|
||||||
|
if (priority == null) {
|
||||||
|
this.priority = PRIORITY_LOW;
|
||||||
|
} else if (PRIORITY_LOW.equalsIgnoreCase(priority.trim())) {
|
||||||
|
this.priority = PRIORITY_LOW;
|
||||||
|
}
|
||||||
|
else if (PRIORITY_MEDIUM.equalsIgnoreCase(priority.trim())) {
|
||||||
|
this.priority = PRIORITY_MEDIUM;
|
||||||
|
}
|
||||||
|
else if (PRIORITY_HIGH.equalsIgnoreCase(priority.trim())) {
|
||||||
|
this.priority = PRIORITY_HIGH;
|
||||||
|
} else {
|
||||||
|
this.priority = PRIORITY_LOW;
|
||||||
|
}
|
||||||
api = RestProxyFactory.createProxy(IBlockIO.class, "https://block.io");
|
api = RestProxyFactory.createProxy(IBlockIO.class, "https://block.io");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +96,7 @@ public class BlockIOWallet implements IWallet {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
BlockIOResponseWithdrawal response = api.withdraw(apiKey, pin, amount.toPlainString(), destinationAddress);
|
BlockIOResponseWithdrawal response = api.withdraw(apiKey, pin, amount.toPlainString(), destinationAddress, priority);
|
||||||
if (response != null && response.getStatus() != null && "success".equalsIgnoreCase(response.getStatus()) && response.getData() != null && response.getData().getTxid() !=null) {
|
if (response != null && response.getStatus() != null && "success".equalsIgnoreCase(response.getStatus()) && response.getData() != null && response.getData().getTxid() !=null) {
|
||||||
return response.getData().getTxid();
|
return response.getData().getTxid();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,15 +6,13 @@ import javax.ws.rs.PathParam;
|
||||||
import javax.ws.rs.Produces;
|
import javax.ws.rs.Produces;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by b00lean on 8/11/14.
|
|
||||||
*/
|
|
||||||
@Path("/api/v2/")
|
@Path("/api/v2/")
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public interface IBlockIO {
|
public interface IBlockIO {
|
||||||
public static final String PRIORITY_LOW = "low";
|
|
||||||
public static final String PRIORITY_MEDIUM = "medium";
|
String PRIORITY_LOW = "low";
|
||||||
public static final String PRIORITY_HIGH = "high";
|
String PRIORITY_MEDIUM = "medium";
|
||||||
|
String PRIORITY_HIGH = "high";
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("get_my_addresses/?api_key={apikey}")
|
@Path("get_my_addresses/?api_key={apikey}")
|
||||||
|
@ -25,7 +23,6 @@ public interface IBlockIO {
|
||||||
BlockIOResponseBalance getBalance(@PathParam("apikey") String apikey);
|
BlockIOResponseBalance getBalance(@PathParam("apikey") String apikey);
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("withdraw/?api_key={apikey}&amounts={amount}&to_addresses={payment_address}&pin={pin}")
|
@Path("withdraw/?api_key={apikey}&amounts={amount}&to_addresses={payment_address}&pin={pin}&priority={priority}")
|
||||||
BlockIOResponseWithdrawal withdraw(@PathParam("apikey") String apikey, @PathParam("pin") String pin, @PathParam("amount") String amount, @PathParam("payment_address") String payment_address);
|
BlockIOResponseWithdrawal withdraw(@PathParam("apikey") String apikey, @PathParam("pin") String pin, @PathParam("amount") String amount, @PathParam("payment_address") String payment_address, @PathParam("priority") String priority);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,7 @@
|
||||||
<wallet prefix="blockio" name="Block.io Wallet">
|
<wallet prefix="blockio" name="Block.io Wallet">
|
||||||
<param name="apikey" />
|
<param name="apikey" />
|
||||||
<param name="pin" />
|
<param name="pin" />
|
||||||
|
<param name="priority" />
|
||||||
<cryptocurrency>DOGE</cryptocurrency>
|
<cryptocurrency>DOGE</cryptocurrency>
|
||||||
<cryptocurrency>BTC</cryptocurrency>
|
<cryptocurrency>BTC</cryptocurrency>
|
||||||
<cryptocurrency>LTC</cryptocurrency>
|
<cryptocurrency>LTC</cryptocurrency>
|
||||||
|
|
Loading…
Reference in New Issue