Java Code Examples for com.btchip.utils.CoinFormatUtils

The following examples show how to use com.btchip.utils.CoinFormatUtils. These examples are extracted from open source projects. 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 Project: green_android   Source File: BTChipDongle.java    License: 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 Project: GreenBits   Source File: BTChipDongle.java    License: 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
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;
}