diff --git a/DESCRIPTION b/DESCRIPTION index e672255..0f91f76 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: rbtc Title: Bitcoin API -Version: 0.1-4 +Version: 0.1-5 Authors@R: person("Bernhard", "Pfaff", email = "bernhard@pfaffikus.de", role = c("aut", "cre")) Description: Implementation of the RPC-JSON API for Bitcoin and utility functions for address creation and content analysis of the blockchain. Depends: R (>= 3.4.0) diff --git a/R/BlockchainRpcs.R b/R/BlockchainRpcs.R index 6e0a907..4d367a6 100644 --- a/R/BlockchainRpcs.R +++ b/R/BlockchainRpcs.R @@ -531,8 +531,14 @@ verifytxoutproof <- function(con, proof){ #' @aliases decodescript #' @rdname decodescript #' @export -decodescript <- function(con, redeem){ +decodescript <- function (con, redeem){ rs <- as.character(redeem) - pl <- list(redeem = rs) + if (length(rs) > 1){ + msg <- paste0("\nLength of 'redeem' greater than one,\n", + "using first element, only.\n") + warning(msg) + rs <- rs[1] + } + pl <- list(rs) rpcpost(con, "decodescript", pl) } diff --git a/R/UtilFuncs.R b/R/UtilFuncs.R index bf06c1c..43b0e0f 100644 --- a/R/UtilFuncs.R +++ b/R/UtilFuncs.R @@ -250,7 +250,9 @@ utxotype <- function(con, txid){ "result") vout <- txdec[["vout"]] ans <- unlist( - lapply(vout, function(x) x[["type"]]) + lapply(vout, function(x){ + x[["scriptPubKey"]][["type"]] + }) ) ans }