To connect a Finance app, you need to pass it to connectFinance():
import connect from '@aragon/connect'
import connectFinance from '@aragon/connect-finance'
const org = await connect('myorg.aragonid.eth', 'thegraph')
const finance = await connectFinance(org.app('finance'))
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 Finance 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 Finance instance (see below).
It can throw the following errors:
Either the passed value is not a valid app object, or its name is not finance.
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 Finance app, returned by connectFinance(). Use the following API to retrieve its data:
Finance#transactions(filters)
Get the list of transactions in the Finance app.
Optional object allowing to filter the votes.
Maximum number of votes. Defaults to 1000.
Skip a number of votes. Defaults to 0.
The list of transactions.
This method can throw one of the following errors:
The response seems incorrect.
The connection to the remote source failed.
Finance#onTransactions(filters, callback)
Subscribe to the list of transactions in the Finance app. The callback is optional, not passing it will return a partially applied function.
Optional object allowing to filter the votes. See Finance#transactions() for details.
(error: Error, transactions: Transaction[]) => 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.
Finance#balance(tokenAddress, filters)
Get the balance of a token in the Finance app.
The address of the token.
Optional object allowing to filter the votes.
Maximum number of votes. Defaults to 1000.
Skip a number of votes. Defaults to 0.
The balance of the token.
This method can throw one of the following errors:
The response seems incorrect.
The connection to the remote source failed.
Finance#onBalance(tokenAddress, filters, callback)
Subscribe to the balance of a token in the Finance app. The callback is optional, not passing it will return a partially applied function.
The address of the token.
Optional object allowing to filter the votes. See Finance#balance() for details.
(error: Error, balance: TokenBalance) => 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.
Represents the balance in a given token. It gets returned by Finance#balance() for example.
Unique identifier representing this token balance.
Address of the token contract.
Unique identifier representing this transaction.
Address of the token contract.
Recipient or sender for the transfer.
Whether the transaction is incoming or outgoing.
The amount of tokens transferred.
Date of the transfer, in Unix time.
An optional reference attached to the transaction.