Skip to content

fetchStSuiAPR return 0 #39

Description

@seehe2025

fetchStSuiAPR(1) returns "0" because Events.getEvents() filters out all epoch events after the GraphQL migration.

In @alphafi/stsui-sdk@2.0.2, GraphQL event JSON returns:

{
"event": {
"typename": "d1b729...::stsui::STSUI"
}
}
but events.js still expects the old shape:

event.event.typename.name
So the filter compares "0xundefined" with params.typeName, skips all events, and APR calculation receives an empty epochChangeEvents array.

Expected fix: support both shapes:

const typename =
typeof event.event.typename === "string"
? event.event.typename
: event.event.typename?.name;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions