Skip to content

Commit

Permalink
add new function
Browse files Browse the repository at this point in the history
1. add RegisterTransaction's description field
2. note:
	this version is suitable for DNA-master-version(afb1764c7263e1ba8eece9269d4c692dabbe32c0)


Signed-off-by: tssqzr <1214661466@qq.com>
  • Loading branch information
tssqzr committed Aug 16, 2017
1 parent e89df04 commit d875264
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
6 changes: 6 additions & 0 deletions src/main/java/DNA/Core/RegisterTransaction.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ public class RegisterTransaction extends Transaction {
* 资产名称
*/
public String name; // 资产名称
/**
* 资产描述
*/
public String description; // 资产描述
/**
* 精度
*/
Expand Down Expand Up @@ -62,6 +66,7 @@ public RegisterTransaction() {
protected void deserializeExclusiveData(BinaryReader reader) throws IOException {
try {
name = reader.readVarString();
description = reader.readVarString();
precision = reader.readByte();
assetType = AssetType.valueOf(reader.readByte());
recordType = RecordType.valueOf(reader.readByte());
Expand All @@ -78,6 +83,7 @@ protected void deserializeExclusiveData(BinaryReader reader) throws IOException
@Override
protected void serializeExclusiveData(BinaryWriter writer) throws IOException {
writer.writeVarString(name);
writer.writeVarString(description);
writer.writeByte(precision);
writer.writeByte(assetType.value());
writer.writeByte(recordType.value());
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/DNA/Websocket/Utils/GetBlockTransactionUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ public class GetBlockTransactionUtils {
* @return transaction list
*/
public static Block from(String ss) {
try {
return JsonSerializable.from(JObject.parse(ss), Block.class);
} catch (InstantiationException | IllegalAccessException e) {
throw new RuntimeException("Block Parsing exception");
}
// try {
// return JsonSerializable.from(JObject.parse(ss), Block.class);
// } catch (InstantiationException | IllegalAccessException e) {
// throw new RuntimeException("Block Parsing exception");
// }
return null;
}
}
1 change: 1 addition & 0 deletions src/main/java/DNA/sdk/wallet/AccountManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ private RegisterTransaction getRegTx(Account acc, String assetName, long assetAm

tx.assetType = assetType ;
tx.name = assetName;
tx.description = txDesc;
tx.amount = Fixed8.parse(String.valueOf(assetAmount));
tx.issuer = acc.publicKey;
tx.admin = Wallet.toScriptHash(controller);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/TestMain4CLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public static AccountManager getAccountManager() {
// v1.1
String dnaUrl = "http://127.0.0.1:20334";
String dnaToken = "";
String path = "./dat/3.db3";
String path = "./4.db3";
AccountManager wm = AccountManager.getWallet(path, dnaUrl, dnaToken);
print(String.format("[param=%s,%s]", dnaUrl, path));
print(String.format("start to test....hh:%s", wm.getBlockHeight()));
Expand Down

0 comments on commit d875264

Please sign in to comment.