PublicKeyAnnouncement(JSONObject attachmentData) throws JSONException { super(attachmentData); this.publicKey = Convert.parseHexString((String)attachmentData.get("recipientPublicKey")); }
private AbstractEncryptedMessage(JSONObject attachmentJSON, JSONObject encryptedMessageJSON) throws JSONException { super(attachmentJSON); byte[] data = Convert.parseHexString((String)encryptedMessageJSON.get("data")); byte[] nonce = Convert.parseHexString((String)encryptedMessageJSON.get("nonce")); this.encryptedData = new EncryptedData(data, nonce); this.isText = Boolean.TRUE.equals(encryptedMessageJSON.get("isText")); }
Message(JSONObject attachmentData) throws JSONException { super(attachmentData); String messageString = (String)attachmentData.get("message"); this.isText = Boolean.TRUE.equals(attachmentData.get("messageIsText")); this.message = isText ? Convert.toBytes(messageString) : Convert.parseHexString(messageString); }
DigitalGoodsDelivery(JSONObject attachmentData) throws JSONException { super(attachmentData); this.purchaseId = Convert.parseUnsignedLong((String)attachmentData.get("purchase")); this.goods = new EncryptedData(Convert.parseHexString((String)attachmentData.get("goodsData")), Convert.parseHexString((String)attachmentData.get("goodsNonce"))); this.discountNQT = Convert.parseLong(attachmentData.get("discountNQT")); this.goodsIsText = Boolean.TRUE.equals(attachmentData.get("goodsIsText")); }
buffer.putLong(feeNQT); if (referencedTransactionFullHash != null) { buffer.put(Convert.parseHexString(referencedTransactionFullHash)); } else { buffer.put(new byte[32]); buffer.putInt((int) (feeNQT / Constants.ONE_NXT)); if (referencedTransactionFullHash != null) { buffer.putLong(Convert.fullHashToId(Convert.parseHexString(referencedTransactionFullHash))); } else { buffer.putLong(0L);
@Override public void onResponse(Response response) throws IOException { try { if (!response.isSuccessful()) { log.info("Unable to fetch txs."); log.info("[Error code] = " + response.code()); } JSONObject reply = parseReply(response); String txBytes = reply.getString("transactionBytes"); TransactionImpl rawTx = TransactionImpl.parseTransaction(Convert.parseHexString(txBytes)); rawTx.setConfirmations(confirmations); NxtTransaction tx = new NxtTransaction(type, rawTx); log.info("Fetching tx bytes"); listener.onTransactionUpdate(tx); } catch (IOException e) { log.info("IOException: " + e.getMessage()); } catch (JSONException e) { log.info("Could not parse JSON: " + e.getMessage()); } catch (NxtException.ValidationException e) { log.info("Transaction is invalid"); e.printStackTrace(); } } });
int timestamp = ((Long) transactionData.getLong("timestamp")).intValue(); short deadline = ((Long) transactionData.getLong("deadline")).shortValue(); byte[] senderPublicKey = Convert.parseHexString((String) transactionData.get("senderPublicKey")); long amountNQT = Convert.parseLong(transactionData.get("amountNQT")); long feeNQT = Convert.parseLong(transactionData.get("feeNQT")); String referencedTransactionFullHash = (transactionData.has("referencedTransactionFullHash"))?(String) transactionData.get("referencedTransactionFullHash"):""; byte[] signature = Convert.parseHexString((String) transactionData.get("signature")); Long versionValue = transactionData.getLong("version"); byte version = versionValue == null ? 0 : versionValue.byteValue();