All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.jleskovar.btcrpc.AsyncBitcoinRpcClient.kt Maven / Gradle / Ivy

The newest version!
package com.github.jleskovar.btcrpc

import com.googlecode.jsonrpc4j.JsonRpcMethod
import java.math.BigDecimal
import java.util.concurrent.CompletableFuture

/**
 * Created by james on 1/12/17.
 */
interface AsyncBitcoinRpcClient {

    @JsonRpcMethod("abandontransaction")
    fun abandonTransaction(transactionId: String): CompletableFuture

    @JsonRpcMethod("abortrescan")
    fun abortRescan(): CompletableFuture

    @JsonRpcMethod("addmultisigaddress")
    fun addMultiSigAddress(required: Int? = null, keys: List): CompletableFuture

    @JsonRpcMethod("addnode")
    fun addNode(address: String, operation: NodeListOperation): CompletableFuture

    @JsonRpcMethod("backupwallet")
    fun backupWallet(destination: String): CompletableFuture

    @JsonRpcMethod("clearbanned")
    fun clearBanned(): CompletableFuture

    @JsonRpcMethod("createmultisig")
    fun createMultiSig(required: Int, keys: List): CompletableFuture

    @JsonRpcMethod("createrawtransaction")
    fun createRawTransaction(
            inputs: List,
            outputs: Map,
            lockTime: Int? = null,
            replaceable: Boolean? = null
    ): CompletableFuture

    @JsonRpcMethod("decoderawtransaction")
    fun decodeRawTransaction(transactionId: String): CompletableFuture

    @JsonRpcMethod("decodescript")
    fun decodeScript(scriptHex: String): CompletableFuture

    @JsonRpcMethod("disconnectnode")
    fun disconnectNode(nodeAddress: String? = null, nodeId: Int? = null): CompletableFuture

    @JsonRpcMethod("dumpprivkey")
    fun dumpPrivateKey(address: String): CompletableFuture

    @JsonRpcMethod("dumpwallet")
    fun dumpWallet(filename: String): CompletableFuture>

    @JsonRpcMethod("encryptwallet")
    fun encryptWallet(passphrase: String): CompletableFuture

    @JsonRpcMethod("generate")
    fun generate(numberOfBlocks: Int, maxTries: Int? = null): CompletableFuture>

    @JsonRpcMethod("getaddednodeinfo")
    fun getAddedNodeInfo(): CompletableFuture>

    @JsonRpcMethod("getbalance")
    fun getBalance(
            account: String = "*",
            minconf: Int = 1,
            includeWatchOnly: Boolean = false): CompletableFuture

    @JsonRpcMethod("getbestblockhash")
    fun getBestBlockhash(): CompletableFuture

    @JsonRpcMethod("getblock")
    fun getBlockData(blockHash: String, verbosity: Int = 0): CompletableFuture

    @JsonRpcMethod("getblock")
    fun getBlock(blockHash: String, verbosity: Int = 1): CompletableFuture

    @JsonRpcMethod("getblock")
    fun getBlockWithTransactions(blockHash: String, verbosity: Int = 2): CompletableFuture

    @JsonRpcMethod("getblockchaininfo")
    fun getBlockchainInfo(): CompletableFuture

    @JsonRpcMethod("getblockcount")
    fun getBlockCount(): CompletableFuture

    @JsonRpcMethod("getblockhash")
    fun getBlockHash(height: Int): CompletableFuture

    @JsonRpcMethod("getblockheader")
    fun getBlockHeader(blockHash: String, verbose: Boolean? = false): CompletableFuture

    @JsonRpcMethod("getblocktemplate")
    fun getBlockTemplate(blockTemplateRequest: BlockTemplateRequest? = null): CompletableFuture

    @JsonRpcMethod("getchaintips")
    fun getChainTips(): CompletableFuture>

    @JsonRpcMethod("getchaintxstats")
    fun getChainTransactionStats(
            blockWindowSize: Int? = null,
            blockHashEnd: String? = null
    ): CompletableFuture

    @JsonRpcMethod("getconnectioncount")
    fun getConnectionCount(): CompletableFuture

    @JsonRpcMethod("getdifficulty")
    fun getDifficulty(): CompletableFuture

    @JsonRpcMethod("getmemoryinfo")
    fun getMemoryInfo(): CompletableFuture

    @JsonRpcMethod("getmempoolancestors")
    fun getMempoolAncestors(transactionId: String): CompletableFuture

    @JsonRpcMethod("getmempooldescendants")
    fun getMempoolDescendants(): CompletableFuture

    @JsonRpcMethod("getmempoolentry")
    fun getMempoolEntry(transactionId: String): CompletableFuture>

    @JsonRpcMethod("getmempoolinfo")
    fun getMempoolInfo(): CompletableFuture

    @JsonRpcMethod("getmininginfo")
    fun getMiningInfo(): CompletableFuture

    @JsonRpcMethod("getnettotals")
    fun getNetworkTotals(): CompletableFuture

    @JsonRpcMethod("getnetworkhashps")
    fun getNetworkHashesPerSeconds(lastBlocks: Int, height: Int): CompletableFuture

    @JsonRpcMethod("getnetworkinfo")
    fun getNetworkInfo(): CompletableFuture

    @JsonRpcMethod("getnewaddress")
    fun getNewAddress(): CompletableFuture

    @JsonRpcMethod("getpeerinfo")
    fun getPeerInfo(): CompletableFuture>

    @JsonRpcMethod("getrawchangeaddress")
    fun getRawChangeAddress(): CompletableFuture

    @JsonRpcMethod("getrawmempool")
    fun getRawMemPool(verbose: Boolean = false): CompletableFuture>>

    @JsonRpcMethod("getrawtransaction")
    fun getRawTransaction(transactionId: String): CompletableFuture

    @JsonRpcMethod("getreceivedbyaddress")
    fun getReceivedByAddress(address: String, minConfirmations: Int = 1): CompletableFuture

    @JsonRpcMethod("gettransaction")
    fun getWalletTransaction(transactionId: String): CompletableFuture>

    @JsonRpcMethod("gettxout")
    fun getUnspentTransactionOutputInfo(transactionId: String, index: Int): CompletableFuture>

    @JsonRpcMethod("gettxoutsetinfo")
    fun getUnspentTransactionOutputSetInfo(): CompletableFuture

    @JsonRpcMethod("getwalletinfo")
    fun getWalletInfo(): CompletableFuture>

    @JsonRpcMethod("importaddress")
    fun importAddress(
            scriptOrAddress: String,
            label: String? = null,
            rescan: Boolean? = null,
            includePayToScriptHash: Boolean? = null
    ): CompletableFuture

    @JsonRpcMethod("importprivkey")
    fun importPrivateKey(
            privateKey: String,
            label: String? = null,
            rescan: Boolean? = null
    ): CompletableFuture

    @JsonRpcMethod("importpubkey")
    fun importPublicKey(
            publicKey: String,
            label: String? = null,
            rescan: Boolean? = null
    ): CompletableFuture

    @JsonRpcMethod("importwallet")
    fun importWallet(walletFile: String): CompletableFuture

    @JsonRpcMethod("keypoolrefill")
    fun keypoolRefill(newSize: Int = 100): CompletableFuture

    @JsonRpcMethod("listaddressgroupings")
    fun listAddressGroupings(): CompletableFuture>

    @JsonRpcMethod("listbanned")
    fun listBanned(): CompletableFuture>

    @JsonRpcMethod("listlockunspent")
    fun listLockUnspent(): CompletableFuture>>

    @JsonRpcMethod("listreceivedbyaddress")
    fun listReceivedByAddress(
            minConfirmations: Int? = null,
            includeEmpty: Boolean? = null,
            includeWatchOnly: Boolean? = null
    ): CompletableFuture>>

    @JsonRpcMethod("listsinceblock")
    fun listSinceBlock(
            blockHash: String? = null,
            targetConfirmations: Int? = null,
            includeWatchOnly: Boolean? = null,
            includeRemoved: Boolean? = null
    ): CompletableFuture>

    @JsonRpcMethod("listtransactions")
    fun listTransactions(
            account: String? = null,
            count: Int? = null,
            skip: Int? = null,
            includeWatchOnly: Boolean? = null
    ): CompletableFuture>>

    @JsonRpcMethod("listunspent")
    fun listUnspent(
            minConfirmations: Int? = null,
            maxConfirmations: Int? = null,
            addresses: List? = null,
            includeUnsafe: Boolean? = null,
            queryOptions: QueryOptions? = null
    ): CompletableFuture

    @JsonRpcMethod("listwallets")
    fun listWallets(): CompletableFuture>

    @JsonRpcMethod("lockunspent")
    fun lockUnspent(unlock: Boolean, unspentOutputs: List): CompletableFuture

    fun ping(): CompletableFuture

    @JsonRpcMethod("preciousblock")
    fun preciousBlock(block: String): CompletableFuture

    @JsonRpcMethod("prioritisetransaction")
    fun prioritiseTransaction(transactionId: String, dummy: Int, feeDeltaSatoshis: Int): CompletableFuture

    @JsonRpcMethod("pruneblockchain")
    fun pruneBlockchain(blockHeightOrUnixTimestamp: Long): CompletableFuture

    @JsonRpcMethod("removeprunedfunds")
    fun removePrunedFunds(transactionId: String): CompletableFuture

    @JsonRpcMethod("sendmany")
    fun sendMany(account: String,
                 addressAmounts: Map,
                 comment: String? = null,
                 subtractFee: Boolean = false,
                 replaceable: Boolean = false,
                 minConfirmations: Int? = null,
                 feeEstimateMode: FeeEstimateMode? = null
    ): CompletableFuture

    @JsonRpcMethod("sendrawtransaction")
    fun sendRawTransaction(transaction: String): CompletableFuture

    @JsonRpcMethod("sendtoaddress")
    fun sendToAddress(
            address: String,
            amount: BigDecimal,
            comment: String? = null,
            commentTo: String? = null,
            subtractFee: Boolean? = null,
            replaceable: Boolean? = null,
            minConfirmations: Int? = null,
            feeEstimateMode: FeeEstimateMode? = null): CompletableFuture

    @JsonRpcMethod("setban")
    fun setBan(
            address: String,
            operation: NodeListOperation,
            seconds: Int
    ): CompletableFuture

    @JsonRpcMethod("settxfee")
    fun setTransactionFee(fee: Double): CompletableFuture

    @JsonRpcMethod("signmessage")
    fun signMessage(
            address: String,
            message: String
    ): CompletableFuture

    @JsonRpcMethod("signmessagewithprivkey")
    fun signMessageWithPrivateKey(
            privateKey: String,
            message: String
    ): CompletableFuture

    @JsonRpcMethod("signrawtransaction")
    fun signRawTransaction(transactionId: String): CompletableFuture

    @JsonRpcMethod("submitblock")
    fun submitBlock(blockData: String): CompletableFuture

    fun uptime(): CompletableFuture

    @JsonRpcMethod("validateaddress")
    fun validateAddress(address: String): CompletableFuture

    @JsonRpcMethod("verifychain")
    fun verifyChain(): CompletableFuture

    @JsonRpcMethod("verifymessage")
    fun verifyMessage(
            address: String,
            signature: String,
            message: String
    ): CompletableFuture

    @JsonRpcMethod("searchrawtransactions")
    fun searchRawSerialisedTransactions(
            address: String,
            verbose: Int?=0,
            skip: Int?=null,
            count: Int?=null,
            vInExtra: Int?=null,
            reverse: Boolean?=null): CompletableFuture>

    @JsonRpcMethod("searchrawtransactions")
    fun searchRawVerboseTransactions(
            address: String,
            verbose: Int?=1,
            skip: Int?=null,
            count: Int?=null,
            vInExtra: Int?=null,
            reverse: Boolean?=null): CompletableFuture>

    /**
     * btcd-specific extension methods
     */
    @JsonRpcMethod("authenticate")
    fun btcdAuthenticate(username: String, password: String): CompletableFuture

    @JsonRpcMethod("generate")
    fun btcdGenerate(numberOfBlocks: Int): CompletableFuture>

    @JsonRpcMethod("getblock")
    fun btcdGetBlockWithTransactions(blockHash: String, verbose: Boolean = true): CompletableFuture
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy