Stellar PHP SDK API Documentation

XdrDataValue
in package

Table of Contents

Methods

__construct()  : mixed
decode()  : XdrDataValue
encode()  : string
fromBase64Xdr()  : static
fromJson()  : static
fromJsonValue()  : static
getValue()  : string|null
toBase64Xdr()  : string
toJson()  : string
toJsonValue()  : mixed
SEP-51 (XDR-JSON) emission for the DataValue typedef.

Methods

__construct()

public __construct([string|null $value = null ]) : mixed
Parameters
$value : string|null = null

fromBase64Xdr()

public static fromBase64Xdr(string $xdr) : static
Parameters
$xdr : string
Return values
static

fromJson()

public static fromJson(string $json) : static
Parameters
$json : string
Tags
throws
JsonException

If $json is not syntactically valid JSON.

InvalidArgumentException

If the JSON shape does not match this type.

Return values
static

fromJsonValue()

public static fromJsonValue(mixed $value) : static
Parameters
$value : mixed
Return values
static

getValue()

public getValue() : string|null
Return values
string|null

toBase64Xdr()

public toBase64Xdr() : string
Return values
string

toJson()

public toJson() : string
Tags
throws
JsonException

If the value contains structures that cannot be encoded as JSON.

Return values
string

toJsonValue()

SEP-51 (XDR-JSON) emission for the DataValue typedef.

public toJsonValue() : mixed

The XDR is typedef opaque DataValue<64>; per SEP-51 §Opaque the variable-opaque wire form is a hex string. This PHP class is a hand-written wrapper used for optional fields (e.g. ManageData dataValue), so the value field is nullable; the SEP-51 to/from methods preserve the null state by emitting JSON null when the wrapper carries no bytes.

Mirrors the bare opaque-typedef emission (XdrJsonHelper::bytesToHex / hexToBytes), with an additional null guard for the optional wrapper semantics.

On this page

Search results