Getting Data
How to use the SDK Core to write subgraph queries and get account data
Pre-Defined Subgraph Queries
const { Framework } = require("@superfluid-finance/sdk-core");
const { ethers } = require("ethers");
const provider = new ethers.providers.InfuraProvider(
"matic",
"<INFURA_API_KEY>"
);
const sf = await Framework.create({
networkName: "matic",
provider
});
type Paging = { take: number, skip?: number, lastId?: string };
const pageResult = await sf.query.
// The different queries can take different order by properties
// given the properties that exist on the entity itself.
listAllSuperTokens({ isListed?: boolean },
paging: Paging,
ordering: Ordering<Token_OrderBy>
);
listIndexes({ indexId?: string, publisher?: string, token?: string },
paging: Paging,
ordering: Ordering<Index_OrderBy>
);
listIndexSubscriptions({ subscriber?: string, approved?: boolean },
paging: Paging,
ordering: Ordering<IndexSubscription_OrderBy>
);
listStreams({ sender?: string, receiver?: string, token?: string },
paging: Paging,
ordering: Ordering<Stream_OrderBy>
);
listUserInteractedSuperTokens({ account?: string, token?: string },
paging: Paging,
ordering: Ordering<AccountTokenSnapshot_OrderBy>
);
listEvents({ account?: string, timestamp_gt?: number },
paging: Paging,
ordering: Ordering<Event_OrderBy>
);
// A subscription function which allows you to subscribe to events via polling.
on(
callback: (events: AllEvents[], unsubscribe: () => void) => void,
ms: number,
account?: string,
timeout?: number
)Direct Initialization
Pagination
Ordering
Example Usage:
Getting Data from Agreements
CFAV1 Read Operations
IDAV1 Read Operations
Super Token Read Operations
Last updated