当前位置: 首页>>代码示例>>Java>>正文


Java UnixIpcService类代码示例

本文整理汇总了Java中org.web3j.protocol.ipc.UnixIpcService的典型用法代码示例。如果您正苦于以下问题:Java UnixIpcService类的具体用法?Java UnixIpcService怎么用?Java UnixIpcService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UnixIpcService类属于org.web3j.protocol.ipc包,在下文中一共展示了UnixIpcService类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: EthereumWeb3jProvider

import org.web3j.protocol.ipc.UnixIpcService; //导入依赖的package包/类
@Inject
public EthereumWeb3jProvider(EthereumConnectorConfig config) {
    if (config.getEthereumJsonRpc() == null
            && config.getEthereumIpc() == null
            && config.getInfuraRpc() == null) {
        this.web3j = Web3j.build(new HttpService(EthereumConnectorConfig.DEFAULT_JSON_RPC));
    } else if (config.getEthereumJsonRpc() != null
            && config.getEthereumIpc() == null
            && config.getInfuraRpc() == null) {
        this.web3j = Web3j.build(new HttpService(config.getEthereumJsonRpc()));
    } else if (config.getEthereumJsonRpc() == null
            && config.getEthereumIpc() != null
            && config.getInfuraRpc() == null) {
        this.web3j = Web3j.build(new UnixIpcService(config.getEthereumIpc()));
    } else if (config.getEthereumJsonRpc() == null
            && config.getEthereumIpc() == null
            && config.getInfuraRpc() != null) {
        this.web3j = Web3j.build(new InfuraHttpService(config.getInfuraRpc()));
    } else {
        throw new IllegalArgumentException("More than 1 Ethereum service providers found");
    }
}
 
开发者ID:xiaoyao1991,项目名称:presto-ethereum,代码行数:23,代码来源:EthereumWeb3jProvider.java

示例2: ApplicationContext

import org.web3j.protocol.ipc.UnixIpcService; //导入依赖的package包/类
public ApplicationContext(CoreContext context) {
    super(context);
    this.context = context;

    synchronized (ApplicationContext.class) {
        if (web == null) {
            logger.log("Subscribing to ipc.. " + config.getIpc() + " on " + config.getOs());
            if (config.getOs().equals(ApplicationConfig.OSType.WINDOWS)) {
                web = Web3j.build(new WindowsIpcService(config.getIpc()));
            } else {
                web = Web3j.build(new UnixIpcService(config.getIpc()));
            }
            logger.log("Successfully connected to ipc, waiting for blocks..");

            web.ethSyncing().observable().subscribe(is -> {
                logger.event("synchronizing").put("is", is.isSyncing()).send();
            });
        }
    }
}
 
开发者ID:codingchili,项目名称:ethereum-ingest,代码行数:21,代码来源:ApplicationContext.java

示例3: init

import org.web3j.protocol.ipc.UnixIpcService; //导入依赖的package包/类
private void init() {
    if (USING_IPC) {
        if (DEBUG) { // IPC Logging
            System.setProperty("org.apache.commons.logging.simplelog.log.org.web3j.protocol.ipc", "DEBUG");
        }
        web3j = Web3j.build(new UnixIpcService(IPC_SOCKET_PATH));
    } else {
        if (DEBUG) { // HTTP Logging
            System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
            System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
            System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.wire", "DEBUG");
            System.setProperty("org.apache.commons.logging.simplelog.log.org.web3j.protocol.ipc", "DEBUG");
        }
        web3j = Web3j.build(new HttpService(URL_JSON_RPC));
    }

    subscription = web3j.blockObservable(false).subscribe(block -> {
        blockObservable(block);
    }, Throwable::printStackTrace, () -> System.out.println("block done"));
    web3j.transactionObservable().subscribe(tx -> {
        transactionObservable(tx);
    }, Throwable::printStackTrace, () -> System.out.println("tx done"));

    web3j.pendingTransactionObservable().subscribe(tx -> {
        pendingTransactionObservable(tx);
    }, Throwable::printStackTrace, () -> System.out.println("ptx done"));

}
 
开发者ID:jestevez,项目名称:ethereum-java-wallet,代码行数:29,代码来源:EthereumWallet.java


注:本文中的org.web3j.protocol.ipc.UnixIpcService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。