Skip to main content

subgraph sub-class

The following readme describes all the functions and their parameters exposed by the subgraph class of the Stakehouse SDK.

getAllIndexesOwnedByAUser function

This function allows users to fetch all the indexes owned by a user.

Input Parameters

userAddress: Ethereum execution layer address of the user.

Using getAllIndexesOwnedByAUser function

await sdk.subgraph.getAllIndexesOwnedByAUser(userAddress);

Return Parameter

Returns a list of indexes owned by the user.

getPersonalIndex function

This function allows user to fetch the personal index id of any user. Personal index is the first ever savETH index the user created.

Input Parameters

userAddress: Ethereum execution layer address of the user.

Using getPersonalIndex function

await sdk.subgraph.getPersonalIndex(userAddress);

Return Parameter

Returns the personal index id of the user.

knotToStakehouse function

This function allows the user to get the Stakehouse of a KNOT.

Input Parameters

id: BLS Public Key of the KNOT.

Using knotToStakehouse function

await sdk.subgraph.knotToStakehouse(id);

Return Parameter

Returns the Stakehouse address of the KNOT.

getAllEventsForAKnot function

This function allows the user to get all events, for a KNOT, emitted when interacting with the Stakehouse Universe smart contracts.

Input Parameters

blsPublicKey: BLS Public Key of the KNOT.

Using getAllEventsForAKnot function

await sdk.subgraph.getAllEventsForAKnot(blsPublicKey);

Return Parameter

Returns a list of events.