From 12e462f46fb6a26f8180553b186aa73f7be09d15 Mon Sep 17 00:00:00 2001 From: xiaohuo Date: Thu, 30 May 2019 00:30:06 +0800 Subject: [PATCH] chore: clean code and update version --- build.gradle | 4 ++-- example/build.gradle | 2 +- .../java/com/firestack/example/TransactionOperation.java | 4 +--- src/main/java/com/firestack/laksaj/account/Wallet.java | 1 - .../java/com/firestack/laksaj/transaction/Transaction.java | 1 - src/test/java/com/firestack/laksaj/account/WalletTest.java | 6 ------ 6 files changed, 4 insertions(+), 14 deletions(-) diff --git a/build.gradle b/build.gradle index 222940f..84a6ec8 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ repositories { group 'com.firestack' -version '0.4.0-RELEASE' +version '0.4.1-RELEASE' sourceCompatibility = 1.8 @@ -60,7 +60,7 @@ publishing { customizePom(pom) groupId = 'org.firestack' artifactId = 'laksaj' - version = '0.4.0-RELEASE' + version = '0.4.1-RELEASE' from components.java diff --git a/example/build.gradle b/example/build.gradle index 615487e..4afb84d 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -12,5 +12,5 @@ repositories { } dependencies { - compile group: 'org.firestack', name: 'laksaj', version: '0.4.0-RELEASE' + compile group: 'org.firestack', name: 'laksaj', version: '0.4.1-RELEASE' } diff --git a/example/src/main/java/com/firestack/example/TransactionOperation.java b/example/src/main/java/com/firestack/example/TransactionOperation.java index 7fb6397..ad4e077 100644 --- a/example/src/main/java/com/firestack/example/TransactionOperation.java +++ b/example/src/main/java/com/firestack/example/TransactionOperation.java @@ -22,8 +22,6 @@ public static void main(String[] args) throws Exception { String ptivateKey = "e19d05c5452598e24caad4a0d85a49146f7be089515c905ae6a19e8a578a6930"; // Populate the wallet with an account String address = wallet.addByPrivateKey(ptivateKey); - System.out.println("address is: " + address); - HttpProvider provider = new HttpProvider("https://api.zilliqa.com"); //get balance HttpProvider.BalanceResult balanceResult = provider.getBalance(address).getResult(); @@ -32,7 +30,7 @@ public static void main(String[] args) throws Exception { //construct non-contract transaction Transaction transaction = Transaction.builder() .version(String.valueOf(pack(2, 8))) - .toAddr("4baf5fada8e5db92c3d3242618c5b47133ae003c".toLowerCase()) + .toAddr("zil16jrfrs8vfdtc74yzhyy83je4s4c5sqrcasjlc4") .senderPubKey("0246e7178dc8253201101e18fd6f6eb9972451d121fc57aa2a06dd5c111e58dc6a") .amount("10000000") .gasPrice("1000000000") diff --git a/src/main/java/com/firestack/laksaj/account/Wallet.java b/src/main/java/com/firestack/laksaj/account/Wallet.java index 3ac59b4..6d1e024 100644 --- a/src/main/java/com/firestack/laksaj/account/Wallet.java +++ b/src/main/java/com/firestack/laksaj/account/Wallet.java @@ -140,7 +140,6 @@ public Transaction signWith(Transaction tx, Account signer) throws IOException { } if (Objects.isNull(tx.getNonce()) || tx.getNonce().isEmpty()) { try { - System.out.println(signer.getAddress()); result = this.provider.getBalance(signer.getAddress()).getResult(); tx.setNonce(String.valueOf(Integer.valueOf(result.getNonce()) + 1)); } catch (IOException e) { diff --git a/src/main/java/com/firestack/laksaj/transaction/Transaction.java b/src/main/java/com/firestack/laksaj/transaction/Transaction.java index d9bfbf9..fabeb8c 100644 --- a/src/main/java/com/firestack/laksaj/transaction/Transaction.java +++ b/src/main/java/com/firestack/laksaj/transaction/Transaction.java @@ -54,7 +54,6 @@ public TxParams toTransactionParam() throws IOException { } public TransactionPayload toTransactionPayload() throws Exception { - System.out.println(this.toAddr); return TransactionPayload.builder() .version(Integer.parseInt(this.version)) .nonce(Integer.valueOf(this.nonce)) diff --git a/src/test/java/com/firestack/laksaj/account/WalletTest.java b/src/test/java/com/firestack/laksaj/account/WalletTest.java index edc0851..a5409b2 100644 --- a/src/test/java/com/firestack/laksaj/account/WalletTest.java +++ b/src/test/java/com/firestack/laksaj/account/WalletTest.java @@ -16,14 +16,12 @@ public void sendTransactionTest() throws Exception { String ptivateKey = "e19d05c5452598e24caad4a0d85a49146f7be089515c905ae6a19e8a578a6930"; // Populate the wallet with an account String address = wallet.addByPrivateKey(ptivateKey); - System.out.println("address is: " + address); wallet.addByPrivateKey(ptivateKey); HttpProvider provider = new HttpProvider("https://dev-api.zilliqa.com/"); wallet.setProvider(provider); //get balance HttpProvider.BalanceResult balanceResult = provider.getBalance(address).getResult(); - System.out.println("balance is: " + balanceResult.getBalance()); //construct non-contract transaction Transaction transaction = Transaction.builder() @@ -43,13 +41,9 @@ public void sendTransactionTest() throws Exception { //sign transaction transaction = wallet.sign(transaction); - System.out.println("signature is: " + transaction.getSignature()); - System.out.println(transaction.getToAddr()); //broadcast transaction HttpProvider.CreateTxResult result = TransactionFactory.createTransaction(transaction); - System.out.println(result.getTranID()); transaction.confirm(result.getTranID(),100,10); - } }