Helius
2022-07-22 823aabb391a0cbd2eddf7c58c03b76e71967b964
src/main/java/cc/mrbird/febs/dapp/chain/ChainService.java
@@ -61,7 +61,11 @@
     * @param startBlock 开始区块
     */
    public static void contractEventListener(BigInteger startBlock, ContractEventService event, String type) {
        contractEventListener(startBlock, null, event, type);
        try {
            contractEventListener(startBlock, null, event, type);
        } catch (Exception e) {
            log.error("合约监听异常", e);
        }
    }
    public static void contractEventListener(BigInteger startBlock, BigInteger endBlock, ContractEventService event, String type) {
@@ -108,17 +112,19 @@
    }
    public static void main(String[] args) {
        ChainEnum chain = ChainEnum.getValueByName(ChainEnum.BSC_TFC.name());
        assert chain != null;
//        ChainEnum chain = ChainEnum.getValueByName(ChainEnum.BSC_TFC.name());
//        assert chain != null;
//
//        EthUsdtContract contract = contract(chain.getPrivateKey(), chain.getContractAddress(), chain.getUrl());
//        EthFilter filter = getFilter(new BigInteger("18097238"), chain.getContractAddress());
//
//        contract.transferEventFlowable(filter).subscribe(e -> {
//            System.out.println(1);
//        }, error -> {
//            log.error("--->", error);
//        });
        EthUsdtContract contract = contract(chain.getPrivateKey(), chain.getContractAddress(), chain.getUrl());
        EthFilter filter = getFilter(new BigInteger("18097238"), chain.getContractAddress());
        contract.transferEventFlowable(filter).subscribe(e -> {
            System.out.println(1);
        }, error -> {
            log.error("--->", error);
        });
        System.out.println(ChainService.getInstance(ChainEnum.BSC_TFC.name()).totalSupply());
    }
}