Skip to content

Commit

Permalink
chore: clean code and update version
Browse files Browse the repository at this point in the history
  • Loading branch information
renlulu committed May 29, 2019
1 parent b4b89e5 commit 12e462f
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 14 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repositories {


group 'com.firestack'
version '0.4.0-RELEASE'
version '0.4.1-RELEASE'

sourceCompatibility = 1.8

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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")
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/firestack/laksaj/account/Wallet.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
6 changes: 0 additions & 6 deletions src/test/java/com/firestack/laksaj/account/WalletTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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);

}
}

0 comments on commit 12e462f

Please sign in to comment.