-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove lite-client from blockchain module;
decouple blockchain and tlb print methods;
- Loading branch information
Showing
17 changed files
with
924 additions
and
1,014 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
blockchain/src/main/java/org/ton/java/blockchain/print/BlockPrintInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package org.ton.java.blockchain.print; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.ton.java.tlb.types.Block; | ||
import org.ton.java.tlb.types.Transaction; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Builder | ||
@Data | ||
@Slf4j | ||
public class BlockPrintInfo { | ||
|
||
public static void printAllTransactions(Block block) { | ||
List<Transaction> txs = block.getAllTransactions(); | ||
if (txs.isEmpty()) { | ||
log.info("No transactions"); | ||
return; | ||
} | ||
TransactionPrintInfo.printTxHeaderWithoutBlock(""); | ||
for (Transaction tx : txs) { | ||
TransactionPrintInfo.printTransactionInfo(tx); | ||
} | ||
TransactionPrintInfo.printTxFooterWithoutBlock(); | ||
} | ||
|
||
public static List<MessagePrintInfo> getAllMessages(Block block) { | ||
List<Transaction> txs = block.getAllTransactions(); | ||
List<MessagePrintInfo> msgFees = new ArrayList<>(); | ||
for (Transaction tx : txs) { | ||
msgFees.addAll(TransactionPrintInfo.getAllMessagePrintInfo(tx)); | ||
} | ||
|
||
return msgFees; | ||
} | ||
|
||
public static void printAllMessages(Block block) { | ||
List<MessagePrintInfo> msgFees = getAllMessages(block); | ||
if (msgFees.isEmpty()) { | ||
log.info("No messages"); | ||
return; | ||
} | ||
MessagePrintInfo.printMessageInfoHeader(); | ||
for (MessagePrintInfo msgFee : msgFees) { | ||
msgFee.printMessageInfo(); | ||
} | ||
MessagePrintInfo.printMessageInfoFooter(); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
.../ton/java/tlb/types/MessagePrintInfo.java → ...va/blockchain/print/MessagePrintInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.