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


Java Coin.toPlainString方法代码示例

本文整理汇总了Java中org.bitcoinj.core.Coin.toPlainString方法的典型用法代码示例。如果您正苦于以下问题:Java Coin.toPlainString方法的具体用法?Java Coin.toPlainString怎么用?Java Coin.toPlainString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bitcoinj.core.Coin的用法示例。


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

示例1: getBalanceFriendlyStr

import org.bitcoinj.core.Coin; //导入方法依赖的package包/类
/**
 *
 */
@Override
public String getBalanceFriendlyStr() {
    //send test coins back to : mwCwTceJvYV27KXBc3NJZys6CjsgsoeHmf

    Coin balance = _coin.getWalletManager().wallet().getBalance(Wallet.BalanceType.ESTIMATED);

    String balanceStatus =
            "Friendly balance : " + balance.toFriendlyString()
            + " Estimated : " + _coin.getWalletManager().wallet().getBalance(Wallet.BalanceType.ESTIMATED)
            + " Available : " + _coin.getWalletManager().wallet().getBalance(Wallet.BalanceType.AVAILABLE)
            + " Available Spendable : " + _coin.getWalletManager().wallet().getBalance(Wallet.BalanceType.AVAILABLE_SPENDABLE)
            + " Estimated Spendable : " + _coin.getWalletManager().wallet().getBalance(Wallet.BalanceType.ESTIMATED_SPENDABLE);

    return balance.toPlainString();
}
 
开发者ID:ehanoc,项目名称:xwallet,代码行数:19,代码来源:BitcoinManager.java

示例2: applyTxFee

import org.bitcoinj.core.Coin; //导入方法依赖的package包/类
/**
 *
 * @param valueMessage
 * @return
 */
@Override
public SpentValueMessage applyTxFee(SpentValueMessage valueMessage) {
    Coin amountCoin = Coin.parseCoin(valueMessage.getAmount());
    Address addr = Address.fromBase58(_coin.getWalletManager().wallet().getParams(), valueMessage.getAddress());
    SendRequest sendRequest = SendRequest.to(addr, amountCoin);

    Coin txValue = CalculateFeeTxSizeBytes(sendRequest.tx, sendRequest.feePerKb.getValue());
    valueMessage.setTxFee(txValue.toPlainString());

    String amountStr = amountCoin.toPlainString();
    valueMessage.setAmount(amountStr);

    return valueMessage;
}
 
开发者ID:ehanoc,项目名称:xwallet,代码行数:20,代码来源:BitcoinManager.java

示例3: getTransactionList

import org.bitcoinj.core.Coin; //导入方法依赖的package包/类
/**
 *
 */
@Override
public List<CoinTransaction> getTransactionList() {
    List<CoinTransaction> transactions = new ArrayList<>();

    Set<Transaction> txs = _coin.getWalletManager().wallet().getTransactions(true);
    for (Transaction tx : txs) {
        Coin amount = tx.getValue(_coin.getWalletManager().wallet());

        String hash = tx.getHash().toString();
        String amountStr = amount.toPlainString();
        String fee = "";
        String confirmationStr = "CONFIRMED";

        if (tx.getFee() != null) {
            fee = tx.getFee().toPlainString();
        }

        TransactionConfidence confidence = tx.getConfidence();
        if (confidence.getDepthInBlocks() < 6) {
            confirmationStr = confidence.getDepthInBlocks() + " CONFIRMATIONS";
        }

        TransactionConfidence.ConfidenceType cType = confidence.getConfidenceType();

        CoinTransaction coinTransaction = new CoinTransaction(fee, hash, amountStr, confirmationStr, tx.getUpdateTime());
        transactions.add(coinTransaction);
    }

    return transactions;
}
 
开发者ID:ehanoc,项目名称:xwallet,代码行数:34,代码来源:BitcoinManager.java


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