<commit_before>/*
 * Copyright (c) 2016-2017 Infinitape Inc, All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package io.infinitape.etherjar.rpc;

import io.infinitape.etherjar.domain.*;
import io.infinitape.etherjar.hex.Hex32;
import io.infinitape.etherjar.hex.HexData;
import io.infinitape.etherjar.rpc.json.*;

import java.io.IOException;
import java.util.concurrent.CompletableFuture;

public interface RpcClient {

    EthCommands eth();
    TraceCommands trace();

    public interface EthCommands {

        /**
         *
         * @return number of most recent block.
         * @throws IOException
         */
        public CompletableFuture<Long> getBlockNumber();

        /**
         *
         * @param address address
         * @param block block to check
         * @return balance of the account of given address.
         * @throws IOException
         */
        public CompletableFuture<Wei> getBalance(Address address, BlockTag block);

        /**
         *
         * @param address address
         * @param block block to check
         * @return balance of the account of given address.
         * @throws IOException
         */
        public CompletableFuture<Wei> getBalance(Address address, long block);

        /**
         *
         * @param blockNumber block number
         * @param includeTransactions includes TransactionJson if true, or hashes as HexData only
         * @return information about a block
         * @throws IOException
         */
        public CompletableFuture<BlockJson> getBlock(long blockNumber, boolean includeTransactions);

        /**
         *
         * @param hash block hash
         * @param includeTransactions includes TransactionJson if true, or hashes as HexData only
         * @return information about a block
         * @throws IOException
         */
        public CompletableFuture<BlockJson> getBlock(BlockHash hash, boolean includeTransactions);

        /**
         *
         * @param hash keystore hash
         * @return information about a transaction
         * @throws IOException
         */
        public CompletableFuture<TransactionJson> getTransaction(TransactionId hash);

        /**
         *
         * @param block block hash
         * @param index keystore index in the block<commit_msg>solution: typed return for block rpc<commit_after>/*
 * Copyright (c) 2016-2017 Infinitape Inc, All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package io.infinitape.etherjar.rpc;

import io.infinitape.etherjar.domain.*;
import io.infinitape.etherjar.hex.Hex32;
import io.infinitape.etherjar.hex.HexData;
import io.infinitape.etherjar.rpc.json.*;

import java.io.IOException;
import java.util.concurrent.CompletableFuture;

public interface RpcClient {

    EthCommands eth();
    TraceCommands trace();

    public interface EthCommands {

        /**
         *
         * @return number of most recent block.
         * @throws IOException
         */
        public CompletableFuture<Long> getBlockNumber();

        /**
         *
         * @param address address
         * @param block block to check
         * @return balance of the account of given address.
         * @throws IOException
         */
        public CompletableFuture<Wei> getBalance(Address address, BlockTag block);

        /**
         *
         * @param address address
         * @param block block to check
         * @return balance of the account of given address.
         * @throws IOException
         */
        public CompletableFuture<Wei> getBalance(Address address, long block);

        /**
         *
         * @param blockNumber block number
         * @param includeTransactions includes TransactionJson if true, or hashes as HexData only
         * @return information about a block
         * @throws IOException
         */
        public <X> CompletableFuture<BlockJson<X>> getBlock(long blockNumber, boolean includeTransactions);

        /**
         *
         * @param hash block hash
         * @param includeTransactions includes TransactionJson if true, or hashes as HexData only
         * @return information about a block
         * @throws IOException
         */
        public <X> CompletableFuture<BlockJson<X>> getBlock(BlockHash hash, boolean includeTransactions);

        /**
         *
         * @param hash keystore hash
         * @return information about a transaction
         * @throws IOException
         */
        public CompletableFuture<TransactionJson> getTransaction(TransactionId hash);

        /**
         *
         * @param block block hash
         * @param index keystore index in the block
{'fraction_non_alphanumeric': 0.07719236828286365, 'fraction_numerical': 0.004901102748118327, 'mean_word_length': 2.3810650887573965, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3836884', 'n_tokens_mistral': 1429, 'n_tokens_neox': 1393, 'n_words': 510}