AccountDataResponse
in package
Represents data entries stored on an account
Accounts can store arbitrary key-value data on the ledger using the ManageData operation. Each data entry is stored as a base64-encoded string. This response provides methods to access data entries both in their raw base64 form and decoded as strings.
Data entries are limited to:
- Key: Maximum 64 bytes
- Value: Maximum 64 bytes
This response is included in AccountResponse as part of the account details.
Tags
Table of Contents
Methods
- __construct() : mixed
- Creates a new account data response
- fromJson() : AccountDataResponse
- Creates an AccountDataResponse instance from JSON data
- get() : string|null
- Gets a decoded data entry value by key
- getBase64Encoded() : string|null
- Gets a base64-encoded data entry value by key
- getData() : array<string|int, mixed>
- Gets all data entries as an associative array
- getKeys() : array<string|int, mixed>
- Gets all data entry keys
Methods
__construct()
Creates a new account data response
public
__construct([array<string|int, mixed> $data = [] ]) : mixed
Parameters
- $data : array<string|int, mixed> = []
-
Associative array of data entries (key => base64 value)
fromJson()
Creates an AccountDataResponse instance from JSON data
public
static fromJson(array<string|int, mixed> $json) : AccountDataResponse
Parameters
- $json : array<string|int, mixed>
-
The JSON array containing data entries from Horizon
Return values
AccountDataResponse —The parsed data response
get()
Gets a decoded data entry value by key
public
get(string $key) : string|null
Returns the data value decoded from base64 to its original string form.
Parameters
- $key : string
-
The data entry key
Return values
string|null —The decoded value, or null if key does not exist
getBase64Encoded()
Gets a base64-encoded data entry value by key
public
getBase64Encoded(string $key) : string|null
Returns the data value in its raw base64-encoded form as stored on the ledger.
Parameters
- $key : string
-
The data entry key
Return values
string|null —The base64-encoded value, or null if key does not exist
getData()
Gets all data entries as an associative array
public
getData() : array<string|int, mixed>
Return values
array<string|int, mixed> —Associative array of all data entries (key => base64 value)
getKeys()
Gets all data entry keys
public
getKeys() : array<string|int, mixed>
Return values
array<string|int, mixed> —Array of data entry keys