com.btchip.utils.CoinFormatUtils Java Examples

The following examples show how to use com.btchip.utils.CoinFormatUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BTChipDongle.java    From green_android with GNU General Public License v3.0 5 votes vote down vote up
public BTChipOutput finalizeInput(String outputAddress, String amount, String fees, final List<Integer> changePath) throws BTChipException {
	BTChipOutput result;
	ByteArrayOutputStream data = new ByteArrayOutputStream();
	byte path[] = pathToByteArray(changePath);
	data.write(outputAddress.length());
	BufferUtils.writeBuffer(data, outputAddress.getBytes());
	BufferUtils.writeUint64BE(data, CoinFormatUtils.toSatoshi(amount));
	BufferUtils.writeUint64BE(data, CoinFormatUtils.toSatoshi(fees));
	BufferUtils.writeBuffer(data, path);
	byte[] response = exchangeApdu(BTCHIP_CLA, BTCHIP_INS_HASH_INPUT_FINALIZE, (byte)0x02, (byte)0x00, data.toByteArray(), OK);
	result = convertResponseToOutput(response);
	return result;
}
 
Example #2
Source File: BTChipDongle.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
public BTChipOutput finalizeInput(String outputAddress, String amount, String fees, String changePath) throws BTChipException {
	BTChipOutput result;
	ByteArrayOutputStream data = new ByteArrayOutputStream();
	byte path[] = BIP32Utils.splitPath(changePath);
	data.write(outputAddress.length());
	BufferUtils.writeBuffer(data, outputAddress.getBytes());
	BufferUtils.writeUint64BE(data, CoinFormatUtils.toSatoshi(amount));
	BufferUtils.writeUint64BE(data, CoinFormatUtils.toSatoshi(fees));
	BufferUtils.writeBuffer(data, path);
	byte[] response = exchangeApdu(BTCHIP_CLA, BTCHIP_INS_HASH_INPUT_FINALIZE, (byte)0x02, (byte)0x00, data.toByteArray(), OK);
	result = convertResponseToOutput(response);
	return result;
}
 
Example #3
Source File: BTChipDongle.java    From WalletCordova with GNU Lesser General Public License v2.1 5 votes vote down vote up
public BTChipOutput finalizeInput(String outputAddress, String amount, String fees, String changePath) throws BTChipException {
	BTChipOutput result;
	ByteArrayOutputStream data = new ByteArrayOutputStream();
	byte path[] = BIP32Utils.splitPath(changePath);
	data.write(outputAddress.length());
	BufferUtils.writeBuffer(data, outputAddress.getBytes());
	BufferUtils.writeUint64BE(data, CoinFormatUtils.toSatoshi(amount));
	BufferUtils.writeUint64BE(data, CoinFormatUtils.toSatoshi(fees));
	BufferUtils.writeBuffer(data, path);
	byte[] response = exchangeApdu(BTCHIP_CLA, BTCHIP_INS_HASH_INPUT_FINALIZE, (byte)0x02, (byte)0x00, data.toByteArray(), OK);
	result = convertResponseToOutput(response);
	return result;
}