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


Java BCSAPIException类代码示例

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


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

示例1: getTx

import org.hyperledger.api.BCSAPIException; //导入依赖的package包/类
@GET
@Path("tx/{txId}")
public TransactionRepresentation getTx(@PathParam("txId") TID txId) throws BCSAPIException, HyperLedgerException {
    APITransaction tx = api.getTransaction(txId);

    List<APITransaction> inputTxs = api.getInputTransactions(txId);
    List<String> inputAddresses = new ArrayList<>(inputTxs == null ? 0 : inputTxs.size());
    List<String> color = new ArrayList<>(inputTxs == null ? 0 : inputTxs.size());
    List<Long> quantity = new ArrayList<>(inputTxs == null ? 0 : inputTxs.size());
    if (inputTxs != null) {
        int i = 0;
        for (APITransaction inputTx : inputTxs) {
            if (inputTx == null) {
                inputAddresses.add("");
                color.add("");
                quantity.add(-1L);
            } else {
                TransactionOutput output = inputTx.getOutput(tx.getSource(i).getOutputIndex());
                if (output.getOutputAddress() != null) {
                    inputAddresses.add(output.getOutputAddress().toString());
                    if (output instanceof ColoredTransactionOutput) {
                        color.add(((ColoredTransactionOutput) output).getColor().toString());
                        quantity.add(((ColoredTransactionOutput) output).getQuantity());
                    } else {
                        color.add("");
                        quantity.add(-1L);
                    }
                } else {
                    inputAddresses.add("");
                    color.add("");
                    quantity.add(-1L);
                }
            }
            i++;
        }
    }
    return TransactionRepresentation.create(tx, inputAddresses, color, quantity);
}
 
开发者ID:DigitalAssetCom,项目名称:-deprecated-hlp-candidate,代码行数:39,代码来源:ExplorerResource.java

示例2: sync

import org.hyperledger.api.BCSAPIException; //导入依赖的package包/类
@Override
public void sync(BCSAPI api, TransactionListener txListener) throws BCSAPIException {
    log.trace("Sync naddr: " + keys.size());
    api.scanTransactionsForAddresses(getRelevantAddresses(), txListener);
    log.trace("Sync finished naddr: " + keys.size());

}
 
开发者ID:DigitalAssetCom,项目名称:-deprecated-hlp-candidate,代码行数:8,代码来源:MultiSigKeyListChain.java

示例3: sync

import org.hyperledger.api.BCSAPIException; //导入依赖的package包/类
protected void sync(MasterPublicKey masterPublicKey, BCSAPI api, TransactionListener txListener) throws BCSAPIException {
    log.trace("Sync nkeys: {}", nextSequence);
    api.scanTransactions(masterPublicKey, lookAhead, t -> {
        for (TransactionOutput o : t.getOutputs()) {
            Integer thisKey = getKeyIDForAddress(o.getOutputAddress());
            if (thisKey != null) {
                ensureLookAhead(thisKey);
                nextSequence = Math.max(nextSequence, thisKey + 1);
            }
        }
        txListener.process(t);
    });
    log.trace("Sync finished with nkeys: {}", nextSequence);
}
 
开发者ID:DigitalAssetCom,项目名称:-deprecated-hlp-candidate,代码行数:15,代码来源:MasterKeyChain.java

示例4: run

import org.hyperledger.api.BCSAPIException; //导入依赖的package包/类
@Override
public void run(T configuration, Environment environment) throws Exception {
    final HyperLedgerConfiguration supernode = getSupernodeConfiguration(configuration);

    log.info("Creating BCSAPI instance");
    managedBCSAPI = supernode.createBCSAPI();

    // jackson module for JSON serialization
    environment.getObjectMapper().registerModule(new SupernodeModule(() -> {
        try {
            return getBCSAPI().ping(0) == 0;
        } catch (BCSAPIException e) {
            return false;
        }
    }));

    environment.lifecycle().manage(managedBCSAPI);
    environment.healthChecks().register("supernode", new HealthCheck() {
        @Override
        protected Result check() throws Exception {
            try {
                managedBCSAPI.getBCSAPI().ping(new Random().nextLong());
                return Result.healthy("Ping succeeded");
            } catch (BCSAPIException be) {
                return Result.unhealthy(be);
            }

        }
    });
}
 
开发者ID:DigitalAssetCom,项目名称:-deprecated-hlp-candidate,代码行数:31,代码来源:HyperLedgerBundle.java

示例5: mineOneBlock

import org.hyperledger.api.BCSAPIException; //导入依赖的package包/类
@Override
public void mineOneBlock() {
    try {
        bcsapi.mine(minerAddress);
        keyChain.sync(bcsapi, minerAccount);
    } catch (BCSAPIException e) {
        log.error("Mining failed with: {}", e);
    }
}
 
开发者ID:DigitalAssetCom,项目名称:-deprecated-hlp-candidate,代码行数:10,代码来源:HyperLedgerRule.java

示例6: sendTo

import org.hyperledger.api.BCSAPIException; //导入依赖的package包/类
@Override
public void sendTo(String address, long amount) {
    try {
        TransactionFactory factory = new CoinbaseAwareBaseTransactionFactory(minerAccount, blockStore, coinbaseMaturity);
        TransactionProposal proposal = factory.propose(UIAddress.fromSatoshiStyle(address).getAddress(), amount);
        Transaction tx = proposal.sign(minerAccount);
        bcsapi.sendTransaction(tx);
        mineOneBlock();
    } catch (HyperLedgerException | BCSAPIException e) {
        log.error("Failed sending amount {} to address {}. Problem was {}", amount, address, e);
        throw new RuntimeException(e);
    }
}
 
开发者ID:DigitalAssetCom,项目名称:-deprecated-hlp-candidate,代码行数:14,代码来源:HyperLedgerRule.java

示例7: latestBlocks

import org.hyperledger.api.BCSAPIException; //导入依赖的package包/类
@GET
@Path("block/{blockId}")
public BlockRepresentation latestBlocks(@PathParam("blockId") BID blockId) throws BCSAPIException {
    return BlockRepresentation.create(api.getBlock(blockId));
}
 
开发者ID:DigitalAssetCom,项目名称:-deprecated-hlp-candidate,代码行数:6,代码来源:ExplorerResource.java

示例8: getChainHeight

import org.hyperledger.api.BCSAPIException; //导入依赖的package包/类
@GET
@Path("chain/height")
public ChainHeightRepresentation getChainHeight() throws BCSAPIException {
    return ChainHeightRepresentation.create(api.getChainHeight());
}
 
开发者ID:DigitalAssetCom,项目名称:-deprecated-hlp-candidate,代码行数:6,代码来源:ExplorerResource.java

示例9: sync

import org.hyperledger.api.BCSAPIException; //导入依赖的package包/类
@Override
public void sync(BCSAPI api, TransactionListener txListener) throws BCSAPIException {
    receiver.sync(api, txListener);
    change.sync(api, txListener);
}
 
开发者ID:DigitalAssetCom,项目名称:-deprecated-hlp-candidate,代码行数:6,代码来源:TREZORChain.java

示例10: sync

import org.hyperledger.api.BCSAPIException; //导入依赖的package包/类
@Override
public void sync(BCSAPI api, TransactionListener txListener) throws BCSAPIException {
    log.trace("Sync naddr: " + keys.size());
    api.scanTransactionsForAddresses(getRelevantAddresses(), txListener);
    log.trace("Sync finished naddr: " + keys.size());
}
 
开发者ID:DigitalAssetCom,项目名称:-deprecated-hlp-candidate,代码行数:7,代码来源:MultiSigMasterChain.java

示例11: sync

import org.hyperledger.api.BCSAPIException; //导入依赖的package包/类
@Override
public void sync(BCSAPI api) throws BCSAPIException {
    reset();
    addressChain.sync(api, this);
}
 
开发者ID:DigitalAssetCom,项目名称:-deprecated-hlp-candidate,代码行数:6,代码来源:BaseReadOnlyAccount.java

示例12: sync

import org.hyperledger.api.BCSAPIException; //导入依赖的package包/类
@Override
public void sync(BCSAPI api, TransactionListener txListener) throws BCSAPIException {
    sync(master.getMasterPublic(), api, txListener);
}
 
开发者ID:DigitalAssetCom,项目名称:-deprecated-hlp-candidate,代码行数:5,代码来源:MasterPrivateChain.java

示例13: sync

import org.hyperledger.api.BCSAPIException; //导入依赖的package包/类
@Override
public void sync(BCSAPI api, TransactionListener txListener) throws BCSAPIException {
    log.trace("Sync naddr: " + addresses.size());
    api.scanTransactionsForAddresses(addresses, txListener);
    log.trace("Sync finished naddr: " + addresses.size());
}
 
开发者ID:DigitalAssetCom,项目名称:-deprecated-hlp-candidate,代码行数:7,代码来源:AddressListChain.java

示例14: sync

import org.hyperledger.api.BCSAPIException; //导入依赖的package包/类
@Override
public void sync(BCSAPI api, TransactionListener txListener) throws BCSAPIException {
    sync(master, api, txListener);
}
 
开发者ID:DigitalAssetCom,项目名称:-deprecated-hlp-candidate,代码行数:5,代码来源:MasterPublicChain.java

示例15: test

import org.hyperledger.api.BCSAPIException; //导入依赖的package包/类
@Test
public void test() throws BCSAPIException {
    assertEquals("CURRENT-VERSION", new BCSAPIClient(new InMemoryConnectorFactory()).getClientVersion());
}
 
开发者ID:DigitalAssetCom,项目名称:-deprecated-hlp-candidate,代码行数:5,代码来源:VersionTest.java


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