# GraphSense API
#
# GraphSense API provides programmatic access to various ledgers' addresses, entities, blocks, transactions and tags for automated and highly efficient forensics tasks.
#
# The version of the OpenAPI document: 1.0.1
# Contact: contact@ikna.io
# Generated by: https://openapi-generator.tech
#' @docType class
#' @title Address
#'
#' @description Address Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field address character
#'
#' @field balance \link{Values}
#'
#' @field currency character
#'
#' @field entity integer
#'
#' @field first_tx \link{TxSummary}
#'
#' @field in_degree integer
#'
#' @field last_tx \link{TxSummary}
#'
#' @field no_incoming_txs integer
#'
#' @field no_outgoing_txs integer
#'
#' @field out_degree integer
#'
#' @field total_received \link{Values}
#'
#' @field total_spent \link{Values}
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
Address <- R6::R6Class(
'Address',
public = list(
`address` = NULL,
`balance` = NULL,
`currency` = NULL,
`entity` = NULL,
`first_tx` = NULL,
`in_degree` = NULL,
`last_tx` = NULL,
`no_incoming_txs` = NULL,
`no_outgoing_txs` = NULL,
`out_degree` = NULL,
`total_received` = NULL,
`total_spent` = NULL,
initialize = function(
`address`, `balance`, `currency`, `entity`, `first_tx`, `in_degree`, `last_tx`, `no_incoming_txs`, `no_outgoing_txs`, `out_degree`, `total_received`, `total_spent`, ...
) {
local.optional.var <- list(...)
if (!missing(`address`)) {
stopifnot(is.character(`address`), length(`address`) == 1)
self$`address` <- `address`
}
if (!missing(`balance`)) {
stopifnot(R6::is.R6(`balance`))
self$`balance` <- `balance`
}
if (!missing(`currency`)) {
stopifnot(is.character(`currency`), length(`currency`) == 1)
self$`currency` <- `currency`
}
if (!missing(`entity`)) {
stopifnot(is.numeric(`entity`), length(`entity`) == 1)
self$`entity` <- `entity`
}
if (!missing(`first_tx`)) {
stopifnot(R6::is.R6(`first_tx`))
self$`first_tx` <- `first_tx`
}
if (!missing(`in_degree`)) {
stopifnot(is.numeric(`in_degree`), length(`in_degree`) == 1)
self$`in_degree` <- `in_degree`
}
if (!missing(`last_tx`)) {
stopifnot(R6::is.R6(`last_tx`))
self$`last_tx` <- `last_tx`
}
if (!missing(`no_incoming_txs`)) {
stopifnot(is.numeric(`no_incoming_txs`), length(`no_incoming_txs`) == 1)
self$`no_incoming_txs` <- `no_incoming_txs`
}
if (!missing(`no_outgoing_txs`)) {
stopifnot(is.numeric(`no_outgoing_txs`), length(`no_outgoing_txs`) == 1)
self$`no_outgoing_txs` <- `no_outgoing_txs`
}
if (!missing(`out_degree`)) {
stopifnot(is.numeric(`out_degree`), length(`out_degree`) == 1)
self$`out_degree` <- `out_degree`
}
if (!missing(`total_received`)) {
stopifnot(R6::is.R6(`total_received`))
self$`total_received` <- `total_received`
}
if (!missing(`total_spent`)) {
stopifnot(R6::is.R6(`total_spent`))
self$`total_spent` <- `total_spent`
}
},
toJSON = function() {
AddressObject <- list()
if (!is.null(self$`address`)) {
AddressObject[['address']] <-
self$`address`
}
if (!is.null(self$`balance`)) {
AddressObject[['balance']] <-
self$`balance`$toJSON()
}
if (!is.null(self$`currency`)) {
AddressObject[['currency']] <-
self$`currency`
}
if (!is.null(self$`entity`)) {
AddressObject[['entity']] <-
self$`entity`
}
if (!is.null(self$`first_tx`)) {
AddressObject[['first_tx']] <-
self$`first_tx`$toJSON()
}
if (!is.null(self$`in_degree`)) {
AddressObject[['in_degree']] <-
self$`in_degree`
}
if (!is.null(self$`last_tx`)) {
AddressObject[['last_tx']] <-
self$`last_tx`$toJSON()
}
if (!is.null(self$`no_incoming_txs`)) {
AddressObject[['no_incoming_txs']] <-
self$`no_incoming_txs`
}
if (!is.null(self$`no_outgoing_txs`)) {
AddressObject[['no_outgoing_txs']] <-
self$`no_outgoing_txs`
}
if (!is.null(self$`out_degree`)) {
AddressObject[['out_degree']] <-
self$`out_degree`
}
if (!is.null(self$`total_received`)) {
AddressObject[['total_received']] <-
self$`total_received`$toJSON()
}
if (!is.null(self$`total_spent`)) {
AddressObject[['total_spent']] <-
self$`total_spent`$toJSON()
}
AddressObject
},
fromJSON = function(AddressJson) {
AddressObject <- jsonlite::fromJSON(AddressJson)
if (!is.null(AddressObject$`address`)) {
self$`address` <- AddressObject$`address`
}
if (!is.null(AddressObject$`balance`)) {
balanceObject <- Values$new()
balanceObject$fromJSON(jsonlite::toJSON(AddressObject$balance, auto_unbox = TRUE, digits = NA))
self$`balance` <- balanceObject
}
if (!is.null(AddressObject$`currency`)) {
self$`currency` <- AddressObject$`currency`
}
if (!is.null(AddressObject$`entity`)) {
self$`entity` <- AddressObject$`entity`
}
if (!is.null(AddressObject$`first_tx`)) {
first_txObject <- TxSummary$new()
first_txObject$fromJSON(jsonlite::toJSON(AddressObject$first_tx, auto_unbox = TRUE, digits = NA))
self$`first_tx` <- first_txObject
}
if (!is.null(AddressObject$`in_degree`)) {
self$`in_degree` <- AddressObject$`in_degree`
}
if (!is.null(AddressObject$`last_tx`)) {
last_txObject <- TxSummary$new()
last_txObject$fromJSON(jsonlite::toJSON(AddressObject$last_tx, auto_unbox = TRUE, digits = NA))
self$`last_tx` <- last_txObject
}
if (!is.null(AddressObject$`no_incoming_txs`)) {
self$`no_incoming_txs` <- AddressObject$`no_incoming_txs`
}
if (!is.null(AddressObject$`no_outgoing_txs`)) {
self$`no_outgoing_txs` <- AddressObject$`no_outgoing_txs`
}
if (!is.null(AddressObject$`out_degree`)) {
self$`out_degree` <- AddressObject$`out_degree`
}
if (!is.null(AddressObject$`total_received`)) {
total_receivedObject <- Values$new()
total_receivedObject$fromJSON(jsonlite::toJSON(AddressObject$total_received, auto_unbox = TRUE, digits = NA))
self$`total_received` <- total_receivedObject
}
if (!is.null(AddressObject$`total_spent`)) {
total_spentObject <- Values$new()
total_spentObject$fromJSON(jsonlite::toJSON(AddressObject$total_spent, auto_unbox = TRUE, digits = NA))
self$`total_spent` <- total_spentObject
}
self
},
toJSONString = function() {
jsoncontent <- c(
if (!is.null(self$`address`)) {
sprintf(
'"address":
"%s"
',
self$`address`
)},
if (!is.null(self$`balance`)) {
sprintf(
'"balance":
%s
',
jsonlite::toJSON(self$`balance`$toJSON(), auto_unbox=TRUE, digits = NA)
)},
if (!is.null(self$`currency`)) {
sprintf(
'"currency":
"%s"
',
self$`currency`
)},
if (!is.null(self$`entity`)) {
sprintf(
'"entity":
%d
',
self$`entity`
)},
if (!is.null(self$`first_tx`)) {
sprintf(
'"first_tx":
%s
',
jsonlite::toJSON(self$`first_tx`$toJSON(), auto_unbox=TRUE, digits = NA)
)},
if (!is.null(self$`in_degree`)) {
sprintf(
'"in_degree":
%d
',
self$`in_degree`
)},
if (!is.null(self$`last_tx`)) {
sprintf(
'"last_tx":
%s
',
jsonlite::toJSON(self$`last_tx`$toJSON(), auto_unbox=TRUE, digits = NA)
)},
if (!is.null(self$`no_incoming_txs`)) {
sprintf(
'"no_incoming_txs":
%d
',
self$`no_incoming_txs`
)},
if (!is.null(self$`no_outgoing_txs`)) {
sprintf(
'"no_outgoing_txs":
%d
',
self$`no_outgoing_txs`
)},
if (!is.null(self$`out_degree`)) {
sprintf(
'"out_degree":
%d
',
self$`out_degree`
)},
if (!is.null(self$`total_received`)) {
sprintf(
'"total_received":
%s
',
jsonlite::toJSON(self$`total_received`$toJSON(), auto_unbox=TRUE, digits = NA)
)},
if (!is.null(self$`total_spent`)) {
sprintf(
'"total_spent":
%s
',
jsonlite::toJSON(self$`total_spent`$toJSON(), auto_unbox=TRUE, digits = NA)
)}
)
jsoncontent <- paste(jsoncontent, collapse = ",")
paste('{', jsoncontent, '}', sep = "")
},
fromJSONString = function(AddressJson) {
AddressObject <- jsonlite::fromJSON(AddressJson)
self$`address` <- AddressObject$`address`
self$`balance` <- Values$new()$fromJSON(jsonlite::toJSON(AddressObject$balance, auto_unbox = TRUE, digits = NA))
self$`currency` <- AddressObject$`currency`
self$`entity` <- AddressObject$`entity`
self$`first_tx` <- TxSummary$new()$fromJSON(jsonlite::toJSON(AddressObject$first_tx, auto_unbox = TRUE, digits = NA))
self$`in_degree` <- AddressObject$`in_degree`
self$`last_tx` <- TxSummary$new()$fromJSON(jsonlite::toJSON(AddressObject$last_tx, auto_unbox = TRUE, digits = NA))
self$`no_incoming_txs` <- AddressObject$`no_incoming_txs`
self$`no_outgoing_txs` <- AddressObject$`no_outgoing_txs`
self$`out_degree` <- AddressObject$`out_degree`
self$`total_received` <- Values$new()$fromJSON(jsonlite::toJSON(AddressObject$total_received, auto_unbox = TRUE, digits = NA))
self$`total_spent` <- Values$new()$fromJSON(jsonlite::toJSON(AddressObject$total_spent, auto_unbox = TRUE, digits = NA))
self
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.