Skip to content

Commit

Permalink
Merge pull request #36 from virtualeconomy/support-base58
Browse files Browse the repository at this point in the history
support base58 description when send v coin
  • Loading branch information
SheldonYS authored Nov 12, 2019
2 parents 17615de + 5e22a3a commit 8560b9a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
10 changes: 8 additions & 2 deletions app/src/main/java/systems/v/coldwallet/Util/UIUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,13 @@ public static void setPaymentTx(final Activity activity, final Account sender,
String time = new Timestamp(timestamp).toString();
time = time.substring(0, time.indexOf("."));
timestampTx.setText(time + "\n" + TimeZone.getDefault().getDisplayName());
String tempAttachment = attachment;
try {
tempAttachment = new String(Base58.decode(attachment));
} catch(Exception e) {
}
if (!tempAttachment.equals("")) { attachmentTx.setText(tempAttachment); }

if (!attachment.equals("")) { attachmentTx.setText(attachment); }
else { attachmentTx.setText("None"); }

final BigInteger timeBigInteger = BigInteger.valueOf(timestamp)
Expand Down Expand Up @@ -414,7 +419,8 @@ public static void setExecContractTx(final Activity activity, final Account send
tempAttachment = new String(Base58.decode(attachment));
} catch(Exception e) {
}
attachmentTx.setText(tempAttachment);
if (!tempAttachment.equals("")) { attachmentTx.setText(tempAttachment); }
else { attachmentTx.setText("None"); }
contractIdTx.setText(contractId);
explainTx.setText(explain);

Expand Down
10 changes: 7 additions & 3 deletions app/src/main/java/systems/v/coldwallet/Wallet/Transaction.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,14 @@ public static Transaction makePaymentTx(Account sender, String recipient, long a
putBigInteger(buf, timestamp);
buf.putLong(amount).putLong(fee);
buf.putShort(feeScale);
byte[] attachmentArr = attachmentBytes;
try {
attachmentArr = Base58.decode(attachment);
} catch (Exception e) {
}
recipient = putRecipient(buf, sender.getChainId(), recipient);
putString(buf, attachment);
putString(buf, new String(attachmentArr));
printByteBufToHex(buf);

return new Transaction(sender, buf,"/transactions/broadcast",
"type", PAYMENT,
"version", V2,
Expand All @@ -107,7 +111,7 @@ public static Transaction makePaymentTx(Account sender, String recipient, long a
"fee", fee,
"feeScale", feeScale,
"timestamp", timestamp,
"attachment", Base58.encode(attachmentBytes));
"attachment", Base58.encode(attachmentArr));
}

@NonNull
Expand Down

0 comments on commit 8560b9a

Please sign in to comment.