Character History
Pre-requisites
Before you can fetch history for a character, you'll need to make sure that you have a project and character created. Refer to the creating a project and characters overview guides to learn how to do so.
Intro
The Edge Client's has a feature that allows you to fetch the history of a character. This feature is useful for tracking the character's progress and activities over time.
Query
To fetch the history of a character, you'll need to make the following query to the Edge Client:
- JavaScript
- GraphQL
- Unity/C#
await client.fetchCharacterHistory({
addresses: [ // Array of character addresses (Required)
characterAddress.toString()
],
event: [ // Array of event types (Optional)
"Staking",
"Mission"
],
});
query CharacterHistory($addresses: [Bytes!]!, $event: [String!]) {
characterHistory(addresses: $addresses, event: $event) {
time
event_data
event
address
}
}
Provide the character's address and the event type you want to fetch history for like this:
{
"addresses": [ // Array of character addresses (Required)
"pubkey"
],
"event": [ // Array of event types (Optional)
"Staking",
"Mission"
]
}
var fetchCharacterHistoryParams = new FetchCharacterHistoryParams
{
Addresses = new List<string>
{
// Array of character addresses (Required)
characterAddress.ToString()
},
Event = new List<string>
{
// Array of event types (Optional)
"Staking",
"Mission"
}
};
// Execute the fetch character history method
var characterHistory = await Client.FetchCharacterHistory(fetchCharacterHistoryParams);