To connect a Tokens app, you need to pass it to connectTokens():
import connect from '@aragon/connect'
import connectTokens from '@aragon/connect-tokens'
const org = await connect('myorg.aragonid.eth', 'thegraph')
const tokens = await connectTokens(org.app('token-manager'))
It extends the App object, which means that every method and property of App is also available on this object.
connect(app, connector)
Connects and returns a Tokens instance.
The app to extend with connected capabilities.
["thegraph", Object] or "thegraph"
Accepts either a string describing the desired connector (only "thegraph" for now), or a tuple to also pass a configuration object to the connector.
An Tokens instance (see below).
It can throw the following errors:
Either the passed value is not a valid app object, or its name is not token-manager.
Either the connector configuration format is not valid, or the connector name is not supported.
A subgraph couldn’t be found with the current network. Pass a subgraphUrl directly, or use one of the supported networks.
An object representing the Tokens app, returned by connectTokens(). Use the following API to retrieve its data:
Get the Token instance used with the app.
This method can throw one of the following errors:
The response seems incorrect.
The connection to the remote source failed.
Tokens#holders(filters)
Get a list of token holders.
Optional object allowing to filter the token holders.
Maximum number of token holders. Defaults to 1000.
Skip a number of token holders. Defaults to 0.
This method can throw one of the following errors:
The response seems incorrect.
The connection to the remote source failed.
Tokens#onHolders(filters, callback)
Subscribe to a list of token holders. The callback is optional, not passing it will return a partially applied function.
Optional object allowing to filter the token holders. See Tokens#holders() for details.
(error: Error, tokenHolders: TokenHolder[]) => void
A callback that will get called every time the result gets updated.
{ unsubscribe: () => void }
The error passed to callback can be null (no error) or one of the following:
The data couldn’t be fetched.
The connection to the remote source failed.
This object represents the token contract (based on MiniMe) used by the Tokens app. It gets returned by Tokens#token() for example.
Unique identifier representing this token.
The token name (e.g. “Aragon Network Token”).
The token symbol (e.g. “ANT”).
The total supply for the token.
Whether the token is transferable.
This object represents a single token holder. It gets returned by Tokens#holders() for example.
Unique identifier representing the token holder.
Address of the token holder.