Skip to content

Commit d875264

Browse files
committed
add new function
1. add RegisterTransaction's description field 2. note: this version is suitable for DNA-master-version(afb1764c7263e1ba8eece9269d4c692dabbe32c0) Signed-off-by: tssqzr <1214661466@qq.com>
1 parent e89df04 commit d875264

4 files changed

Lines changed: 14 additions & 6 deletions

File tree

src/main/java/DNA/Core/RegisterTransaction.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ public class RegisterTransaction extends Transaction {
2929
* 资产名称
3030
*/
3131
public String name; // 资产名称
32+
/**
33+
* 资产描述
34+
*/
35+
public String description; // 资产描述
3236
/**
3337
* 精度
3438
*/
@@ -62,6 +66,7 @@ public RegisterTransaction() {
6266
protected void deserializeExclusiveData(BinaryReader reader) throws IOException {
6367
try {
6468
name = reader.readVarString();
69+
description = reader.readVarString();
6570
precision = reader.readByte();
6671
assetType = AssetType.valueOf(reader.readByte());
6772
recordType = RecordType.valueOf(reader.readByte());
@@ -78,6 +83,7 @@ protected void deserializeExclusiveData(BinaryReader reader) throws IOException
7883
@Override
7984
protected void serializeExclusiveData(BinaryWriter writer) throws IOException {
8085
writer.writeVarString(name);
86+
writer.writeVarString(description);
8187
writer.writeByte(precision);
8288
writer.writeByte(assetType.value());
8389
writer.writeByte(recordType.value());

src/main/java/DNA/Websocket/Utils/GetBlockTransactionUtils.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ public class GetBlockTransactionUtils {
1919
* @return transaction list
2020
*/
2121
public static Block from(String ss) {
22-
try {
23-
return JsonSerializable.from(JObject.parse(ss), Block.class);
24-
} catch (InstantiationException | IllegalAccessException e) {
25-
throw new RuntimeException("Block Parsing exception");
26-
}
22+
// try {
23+
// return JsonSerializable.from(JObject.parse(ss), Block.class);
24+
// } catch (InstantiationException | IllegalAccessException e) {
25+
// throw new RuntimeException("Block Parsing exception");
26+
// }
27+
return null;
2728
}
2829
}

src/main/java/DNA/sdk/wallet/AccountManager.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,7 @@ private RegisterTransaction getRegTx(Account acc, String assetName, long assetAm
546546

547547
tx.assetType = assetType ;
548548
tx.name = assetName;
549+
tx.description = txDesc;
549550
tx.amount = Fixed8.parse(String.valueOf(assetAmount));
550551
tx.issuer = acc.publicKey;
551552
tx.admin = Wallet.toScriptHash(controller);

src/main/java/TestMain4CLI.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public static AccountManager getAccountManager() {
248248
// v1.1
249249
String dnaUrl = "http://127.0.0.1:20334";
250250
String dnaToken = "";
251-
String path = "./dat/3.db3";
251+
String path = "./4.db3";
252252
AccountManager wm = AccountManager.getWallet(path, dnaUrl, dnaToken);
253253
print(String.format("[param=%s,%s]", dnaUrl, path));
254254
print(String.format("start to test....hh:%s", wm.getBlockHeight()));

0 commit comments

Comments
 (0)