當前位置: 首頁>>代碼示例>>Java>>正文


Java TransactionResult類代碼示例

本文整理匯總了Java中com.ripple.core.types.known.tx.result.TransactionResult的典型用法代碼示例。如果您正苦於以下問題:Java TransactionResult類的具體用法?Java TransactionResult怎麽用?Java TransactionResult使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TransactionResult類屬於com.ripple.core.types.known.tx.result包,在下文中一共展示了TransactionResult類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: fillInLedger

import com.ripple.core.types.known.tx.result.TransactionResult; //導入依賴的package包/類
void fillInLedger(final PendingLedger ledger) {
    final long ledger_index = ledger.ledger_index;
    ledger.setStatus(PendingLedger.Status.fillingIn);

    requestLedger(ledger_index, false, new Callback<Response>() {
        @Override
        public void called(Response response) {
            JSONObject ledgerJSON = response.result.getJSONObject("ledger");
            JSONArray transactions = ledgerJSON.getJSONArray("transactions");

            for (int i = 0; i < transactions.length(); i++) {
                JSONObject json = transactions.getJSONObject(i);
                // This is kind of nasty
                json.put("ledger_index", ledger_index);
                json.put("validated",    true);
                TransactionResult tr = TransactionResult.fromJSON(json);
                ledger.notifyTransaction(tr);
            }

            final String transaction_hash = ledgerJSON.getString("transaction_hash");
            boolean correctHash = ledger.transactionHashEquals(transaction_hash);
            if (!correctHash) throw new IllegalStateException("We don't handle invalid transactions yet");
            clearLedger(ledger_index, "fillInLedger");
        }
    });
}
 
開發者ID:cping,項目名稱:RipplePower,代碼行數:27,代碼來源:PendingLedgers.java

示例2: updateFromTransactionResult

import com.ripple.core.types.known.tx.result.TransactionResult; //導入依賴的package包/類
public void updateFromTransactionResult(TransactionResult tr) {
    if (!tr.validated) {
        return;
    }

    TransactionMeta meta = tr.meta;
    UInt32 ledgerIndex = tr.ledgerIndex;
    UInt32 txnIndex = meta.transactionIndex();

    for (AffectedNode an : meta.affectedNodes()) {
        Hash256 index = an.ledgerIndex();
        CacheEntry ce = getOrCreate(index);
        ce.upateLedgerEntry(an.isDeletedNode() ? null : (LedgerEntry) an.nodeAsFinal(),
                            ledgerIndex,
                            txnIndex);
    }
}
 
開發者ID:cping,項目名稱:RipplePower,代碼行數:18,代碼來源:SLECache.java

示例3: onTransaction

import com.ripple.core.types.known.tx.result.TransactionResult; //導入依賴的package包/類
void onTransaction(JSONObject msg) {
    TransactionResult tr = new TransactionResult(msg, TransactionResult
            .Source
            .transaction_subscription_notification);
    if (tr.validated) {
        if (transactionSubscriptionManager != null) {
            transactionSubscriptionManager.notifyTransactionResult(tr);
        } else {
            onTransactionResult(tr);
        }
    }
}
 
開發者ID:cping,項目名稱:RipplePower,代碼行數:13,代碼來源:Client.java

示例4: onTransactionResult

import com.ripple.core.types.known.tx.result.TransactionResult; //導入依賴的package包/類
public void onTransactionResult(TransactionResult tr) {
    log(Level.INFO, "Transaction {0} is validated", tr.hash);
    Map<AccountID, STObject> affected = tr.modifiedRoots();

    if (affected != null) {
        Hash256 transactionHash = tr.hash;
        UInt32 transactionLedgerIndex = tr.ledgerIndex;

        for (Map.Entry<AccountID, STObject> entry : affected.entrySet()) {
            Account account = accounts.get(entry.getKey());
            if (account != null) {
                STObject rootUpdates = entry.getValue();
                account.getAccountRoot()
                        .updateFromTransaction(
                                transactionHash, transactionLedgerIndex, rootUpdates);
            }
        }
    }

    Account initator = accounts.get(tr.initiatingAccount());
    if (initator != null) {
        log(Level.INFO, "Found initiator {0}, notifying transactionManager", initator);
        initator.transactionManager().notifyTransactionResult(tr);
    } else {
        log(Level.INFO, "Can't find initiating account!");
    }
    emit(OnValidatedTransaction.class, tr);
}
 
開發者ID:cping,項目名稱:RipplePower,代碼行數:29,代碼來源:Client.java

示例5: requestTransaction

import com.ripple.core.types.known.tx.result.TransactionResult; //導入依賴的package包/類
public void requestTransaction(final Hash256 hash, final Manager<TransactionResult> cb) {
    makeManagedRequest(Command.tx, cb, new Request.Builder<TransactionResult>() {
        @Override
        public void beforeRequest(Request request) {
            request.json("binary", true);
            request.json("transaction", hash);
        }

        @Override
        public TransactionResult buildTypedResponse(Response response) {
            return new TransactionResult(response.result, TransactionResult.Source.request_tx_binary);
        }
    });
}
 
開發者ID:cping,項目名稱:RipplePower,代碼行數:15,代碼來源:Client.java

示例6: notifyTransactionResult

import com.ripple.core.types.known.tx.result.TransactionResult; //導入依賴的package包/類
public void notifyTransactionResult(TransactionResult tr) {
    long key = tr.ledgerIndex.longValue();
    if (clearedLedgers.contains(key)) {
        System.out.println("warning");
        return;
    }

    PendingLedger ledger = getOrAddLedger(key);
    ledger.notifyTransaction(tr);
}
 
開發者ID:cping,項目名稱:RipplePower,代碼行數:11,代碼來源:PendingLedgers.java

示例7: notifyTransaction

import com.ripple.core.types.known.tx.result.TransactionResult; //導入依賴的package包/類
public void notifyTransaction(TransactionResult tr) {
    if (!transactions.hasLeaf(tr.hash)) {
        clearedTransactions++;
        transactions.addTransactionResult(tr);
        client.onTransactionResult(tr);
        logStateChange();
    }
}
 
開發者ID:cping,項目名稱:RipplePower,代碼行數:9,代碼來源:PendingLedger.java

示例8: onPage

import com.ripple.core.types.known.tx.result.TransactionResult; //導入依賴的package包/類
@Override
public void onPage(AccountTxPager.Page page) {
    lastTxnRequesterUpdate = client.serverInfo.ledger_index;

    if (page.hasNext()) {
        page.requestNext();
    } else {
        lastLedgerCheckedAccountTxns = Math.max(lastLedgerCheckedAccountTxns, page.ledgerMax());
        txnPager = null;
    }

    for (TransactionResult tr : page.transactionResults()) {
        notifyTransactionResult(tr);
    }
}
 
開發者ID:cping,項目名稱:RipplePower,代碼行數:16,代碼來源:TransactionManager.java

示例9: onValidated

import com.ripple.core.types.known.tx.result.TransactionResult; //導入依賴的package包/類
public ManagedTxn onValidated(final Callback<ManagedTxn> handler) {
    on(OnTransactionValidated.class, new OnTransactionValidated() {
        @Override
        public void called(TransactionResult args) {
            result = args;
            handler.called(ManagedTxn.this);
        }
    });
    return this;
}
 
開發者ID:cping,項目名稱:RipplePower,代碼行數:11,代碼來源:ManagedTxn.java

示例10: printTrade

import com.ripple.core.types.known.tx.result.TransactionResult; //導入依賴的package包/類
private static void printTrade(TransactionResult tr,
                               Offer before,
                               Offer after) {
    // Executed define non negative amount of Before - After
    STObject executed = after.executed(before);
    Amount takerGot = executed.get(Amount.TakerGets);

    // Only print trades that executed
    if (!takerGot.isZero()) {
        print("In {0} tx: {1}, Offer owner {2}, was paid: {3}, gave: {4} ",
              tr.transactionType(), tr.hash, before.account(),
                executed.get(Amount.TakerPays), takerGot);
    }
}
 
開發者ID:ripple,項目名稱:ripple-lib-java,代碼行數:15,代碼來源:OffersExecuted.java

示例11: notifyTransactionResult

import com.ripple.core.types.known.tx.result.TransactionResult; //導入依賴的package包/類
public void notifyTransactionResult(TransactionResult tr) {
    ledgers.notifyTransactionResult(tr);
}
 
開發者ID:cping,項目名稱:RipplePower,代碼行數:4,代碼來源:LedgerSubscriber.java

示例12: onTransactions

import com.ripple.core.types.known.tx.result.TransactionResult; //導入依賴的package包/類
private void onTransactions(JSONObject responseResult) {
    final JSONArray transactions = responseResult.getJSONArray("transactions");
    final int ledger_index_max = responseResult.optInt("ledger_index_max");
    final int ledger_index_min = responseResult.optInt("ledger_index_min");
    final Object newMarker = responseResult.opt("marker");

    onPage.onPage(new Page() {
        ArrayList<TransactionResult> txns = null;

        @Override
        public boolean hasNext() {
            return newMarker != null;
        }

        @Override
        public void requestNext() {
            if (hasNext()) {
                walkAccountTx(newMarker);
            }
        }

        @Override
        public long ledgerMax() {
            return ledger_index_max;
        }

        @Override
        public long ledgerMin() {
            return ledger_index_min;
        }

        @Override
        public int size() {
            return transactions.length();
        }

        @Override
        public ArrayList<TransactionResult> transactionResults() {
            if (txns == null) {
                txns = new ArrayList<TransactionResult>();
                for (int i = 0; i < transactions.length(); i++) {
                    JSONObject jsonObject = transactions.optJSONObject(i);
                    txns.add(new TransactionResult(jsonObject,
                            TransactionResult.Source.request_account_tx_binary));
                }
            }
            return txns;
        }

        @Override
        public JSONArray transactionsJSON() {
            return transactions;
        }
    });
}
 
開發者ID:cping,項目名稱:RipplePower,代碼行數:56,代碼來源:AccountTxPager.java

示例13: TransactionResultItem

import com.ripple.core.types.known.tx.result.TransactionResult; //導入依賴的package包/類
public TransactionResultItem(TransactionResult result) {
    this.result = result;
}
 
開發者ID:cping,項目名稱:RipplePower,代碼行數:4,代碼來源:TransactionResultItem.java

示例14: copy

import com.ripple.core.types.known.tx.result.TransactionResult; //導入依賴的package包/類
@Override
public ShaMapItem<TransactionResult> copy() {
    // that's ok right ;) these bad boys are immutable anyway
    return this;
}
 
開發者ID:cping,項目名稱:RipplePower,代碼行數:6,代碼來源:TransactionResultItem.java

示例15: value

import com.ripple.core.types.known.tx.result.TransactionResult; //導入依賴的package包/類
@Override
public TransactionResult value() {
    return result;
}
 
開發者ID:cping,項目名稱:RipplePower,代碼行數:5,代碼來源:TransactionResultItem.java


注:本文中的com.ripple.core.types.known.tx.result.TransactionResult類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。