public NxtAddress(CoinType type, String rsAccount) { this.type = type; publicKey = null; this.accountId = Convert.parseAccountId(type, rsAccount); this.rsAccount = rsAccount; }
public NxtAddress(CoinType type, long accountId) { this.type = type; publicKey = null; this.accountId = accountId; this.rsAccount = Convert.rsAccount(type, accountId); }
@Override int getMySize() { int size = 8 + 1; for (String uri : uris) { size += 2 + Convert.toBytes(uri).length; } return size; }
DigitalGoodsRefund(JSONObject attachmentData) throws JSONException { super(attachmentData); this.purchaseId = Convert.parseUnsignedLong((String)attachmentData.get("purchase")); this.refundNQT = Convert.parseLong(attachmentData.get("refundNQT")); }
MessagingAliasSell(JSONObject attachmentData) throws JSONException { super(attachmentData); this.aliasName = Convert.nullToEmpty((String) attachmentData.get("alias")); this.priceNQT = Convert.parseLong(attachmentData.get("priceNQT")); }
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); }
Long amountNQT = 0L; Long feeNQT = 100000000L; int timestamp = Convert.toNxtEpochTime(System.currentTimeMillis()); // different for nxt and burst short deadline = 1440; Long recipientLong = Convert.parseAccountId(NxtMain.get(), recipient); EncryptedData data = EncryptedData.encrypt(Convert.toBytes("test text"), nxtPrivateKey, recipientPublicKey);
BuilderImpl referencedTransactionFullHash(byte[] referencedTransactionFullHash) { if (referencedTransactionFullHash != null) { this.referencedTransactionFullHash = Convert.toHexString(referencedTransactionFullHash); } return this; }
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")); }
long amountNQT = 100000000L; long feeNQT = 100000000L; int timestamp = Convert.toNxtEpochTime(System.currentTimeMillis()); // different for nxt and burst short deadline = 1440; long recipientLong = Convert.parseAccountId(NxtMain.get(), recipient);
ColoredCoinsAssetTransfer(JSONObject attachmentData) throws JSONException { super(attachmentData); this.assetId = Convert.parseUnsignedLong((String) attachmentData.get("asset")); this.quantityQNT = Convert.parseLong(attachmentData.get("quantityQNT")); this.comment = getVersion() == 0 ? Convert.nullToEmpty((String) attachmentData.get("comment")) : null; }
byte[] referencedTransactionFullHashBytes = new byte[32]; buffer.get(referencedTransactionFullHashBytes); if (Convert.emptyToNull(referencedTransactionFullHashBytes) != null) { referencedTransactionFullHash = Convert.toHexString(referencedTransactionFullHashBytes); signature = Convert.emptyToNull(signature); int flags = 0; int ecBlockHeight = 0;
public static NxtSendRequest to(NxtFamilyWallet from, NxtAddress destination, Value amount) { checkNotNull(destination.getType(), "Address is for an unknown network"); checkState(from.getCoinType() == destination.getType(), "Incompatible destination address coin type"); checkState(TypeUtils.is(destination.getType(), amount.type), "Incompatible sending amount type"); checkTypeCompatibility(destination.getType()); NxtSendRequest req = new NxtSendRequest(destination.getType()); byte version = (byte) 1; int timestamp; if (req.type instanceof NxtMain) { timestamp = Convert.toNxtEpochTime(System.currentTimeMillis()); } else if (req.type instanceof BurstMain) { timestamp = Convert.toBurstEpochTime(System.currentTimeMillis()); } else { throw new RuntimeException("Unexpected NXT family type: " + req.type.toString()); } TransactionImpl.BuilderImpl builder = new TransactionImpl.BuilderImpl(version, from.getPublicKey(), amount.value, req.fee.value, timestamp, NxtFamily.DEFAULT_DEADLINE, Attachment.ORDINARY_PAYMENT); builder.recipientId(destination.getAccountId()); // TODO extra check, query the server if the public key announcement is actually needed if (destination.getPublicKey() != null) { Appendix.PublicKeyAnnouncement publicKeyAnnouncement = new Appendix.PublicKeyAnnouncement(destination.getPublicKey()); builder.publicKeyAnnouncement(publicKeyAnnouncement); } req.nxtTxBuilder = builder; return req; }
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);
public ColoredCoinsAssetIssuance(String name, String description, long quantityQNT, byte decimals) { this.name = name; this.description = Convert.nullToEmpty(description); this.quantityQNT = quantityQNT; this.decimals = decimals; }
PublicKeyAnnouncement(JSONObject attachmentData) throws JSONException { super(attachmentData); this.publicKey = Convert.parseHexString((String)attachmentData.get("recipientPublicKey")); }
DigitalGoodsListing(JSONObject attachmentData) throws JSONException { super(attachmentData); this.name = (String) attachmentData.get("name"); this.description = (String) attachmentData.get("description"); this.tags = (String) attachmentData.get("tags"); this.quantity = ((Long) attachmentData.get("quantity")).intValue(); this.priceNQT = Convert.parseLong(attachmentData.get("priceNQT")); }
public static long getId(byte[] publicKey) { byte[] publicKeyHash = Crypto.sha256().digest(publicKey); return Convert.fullHashToId(publicKeyHash); }
BuilderImpl fullHash(byte[] fullHash) { if (fullHash != null) { this.fullHash = Convert.toHexString(fullHash); } return this; }
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(); long recipientId = Convert.parseUnsignedLong((String) transactionData.get("recipient")); builder.recipientId(recipientId); if (transactionData.has("ecBlockHeight")) { builder.ecBlockHeight(((Long) transactionData.getLong("ecBlockHeight")).intValue()); builder.ecBlockId(Convert.parseUnsignedLong(transactionData.getString("ecBlockId")));