-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added first API for raw transactions
- Loading branch information
Showing
5 changed files
with
135 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#' RPC-JSON API: getrawtransaction | ||
#' | ||
#' Returns the raw transaction data. | ||
#' | ||
#' @section: Details | ||
#' By default this function only works for mempool transactions. | ||
#' If the -txindex option is enabled, it also works for blockchain transactions. | ||
#' DEPRECATED: for now, it also works for transactions with unspent outputs. | ||
#' If verbose is 'true', returns an object with information about 'txid'. | ||
#' If verbose is 'false' or omitted, returns a string that is serialized, | ||
#' hex-encoded data for 'txid'. | ||
#' | ||
#' @param obj object of class \code{CONRPC}. | ||
#' @param txid \code{character}, the transaction id. | ||
#' @param verbose \code{logical}, type of output. | ||
#' | ||
#' @return A S4-object of class \code{ANSRPC}. | ||
#' @family RawTransactions RPCs | ||
#' @author Bernhard Pfaff | ||
#' @references \url{https://bitcoin.org/en/developer-reference#getblock}, | ||
#' \url{https://bitcoin.org/en/developer-reference#remote-procedure-calls-rpcs} | ||
#' @name getrawtransaction | ||
#' @aliases getrawtransaction | ||
#' @rdname getrawtransaction | ||
#' @export | ||
getrawtransaction <- function(obj, txid, verbose = FALSE){ | ||
txid <- as.character(txid) | ||
verb <- ifelse(verbose, 1L, 0L) | ||
pl <- list(txid = txid, verbose = verb) | ||
rpcpost(obj, "getrawtransaction", pl) | ||
} | ||
|
||
|
||
|
||
#' RPC-JSON API: decoderawtransaction | ||
#' | ||
#' Return a JSON object representing the serialized, | ||
#' hex-encoded transaction. | ||
#' | ||
#' @param obj object of class \code{CONRPC}. | ||
#' @param hexstring \code{character}, the transaction hex string. | ||
#' | ||
#' @return A S4-object of class \code{ANSRPC}. | ||
#' @family RawTransactions RPCs | ||
#' @author Bernhard Pfaff | ||
#' @references \url{https://bitcoin.org/en/developer-reference#getblock}, | ||
#' \url{https://bitcoin.org/en/developer-reference#remote-procedure-calls-rpcs} | ||
#' @name decoderawtransaction | ||
#' @aliases decoderawtransaction | ||
#' @rdname decoderawtransaction | ||
#' @export | ||
decoderawtransaction <- function(obj, hexstring){ | ||
hexstring <- as.character(hexstring) | ||
pl <- list(hexstring = hexstring) | ||
rpcpost(obj, "decoderawtransaction", pl) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.