Class: Query

Query(options)

Service class for querying Cask subgraph data.

Constructor

new Query(options)

Create an instance of the Query service.
Parameters:
Name Type Description
options See CaskSDK configuration.
See:

Methods

(async) chainlinkTopup(id, optionsopt) → {Promise.<*>}

Get a specific chainlink topup flow.
Parameters:
Name Type Attributes Description
id string Chainlink Topup ID
options Object <optional>
Returns:
Type
Promise.<*>

consumerSubscriptions() → {Promise.<*>}

Get a list of subscriptions for a consumer for a specific provider and also optionally a planId.
Returns:
Type
Promise.<*>

(async) consumerSummary(args) → {Promise.<*>}

Get the summary metrics for a specific consumer.
Parameters:
Name Type Description
args Object Function arguments
Properties
Name Type Attributes Default Description
address string <optional>
this.ethersConnection.address Address of consumer
Returns:
Type
Promise.<*>

(async) dca(id, optionsopt) → {Promise.<*>}

Get a specific DCA flow.
Parameters:
Name Type Attributes Description
id string DCA ID
options Object <optional>
Returns:
Type
Promise.<*>

(async) flow(id, type, optionsopt) → {Promise.<*>}

Get the specified flow of a specific type.
Parameters:
Name Type Attributes Description
id string flow ID
type string Flow type (subscription, dca, p2p or chainlinkTopup)
options Object <optional>
query options
Returns:
Type
Promise.<*>

(async) flows(args) → {Promise.<*>}

Get all flows for an address.
Parameters:
Name Type Description
args Object Function arguments
Properties
Name Type Attributes Default Description
address string <optional>
this.ethersConnection.address Address of user
Returns:
Type
Promise.<*>

(async) graphStatus(options) → {Promise.<*>}

Get status of the subgraph.
Parameters:
Name Type Description
options
Returns:
Type
Promise.<*>

(async) init(args)

Initialize the query service.
Parameters:
Name Type Description
args Object Function arguments
Properties
Name Type Attributes Description
ethersConnection EthersConnection <optional>
EthersConnection instance

(async) p2p(id, optionsopt) → {Promise.<*>}

Get a specific P2P flow.
Parameters:
Name Type Attributes Description
id string P2P ID
options Object <optional>
Returns:
Type
Promise.<*>

(async) providerPlanSummary(args) → {Promise.<*>}

Get the summary metrics for a specific provider and plan.
Parameters:
Name Type Description
args Object Function arguments
Properties
Name Type Attributes Default Description
address string <optional>
this.ethersConnection.address Address of user
planId number Plan ID
Returns:
Type
Promise.<*>

(async) providerSummary(args) → {Promise.<*>}

Get the summary metrics for a specific provider.
Parameters:
Name Type Description
args Object Function arguments
Properties
Name Type Attributes Default Description
address string <optional>
this.ethersConnection.address Address of provider
Returns:
Type
Promise.<*>

(async) rawQuery(query, options) → {Promise.<ApolloQueryResult.<any>>}

Perform a raw graphql query on the subgraph
Parameters:
Name Type Description
query
options
Returns:
Type
Promise.<ApolloQueryResult.<any>>

subscribers() → {Promise.<*>}

Get a list of subscribers for a provider.
Returns:
Type
Promise.<*>

(async) subscription(id, optionsopt) → {Promise.<*>}

Get a specific subscription.
Parameters:
Name Type Attributes Description
id string Subscription ID
options Object <optional>
Returns:
Type
Promise.<*>

subscriptions() → {Promise.<*>}

Get a list of subscriptions for a consumer
Returns:
Type
Promise.<*>

(async) walletHistory(address, optionsopt) → {Promise.<Array.<*>>}

Get wallet history for a specific address.
Parameters:
Name Type Attributes Description
address string Wallet address
options Object <optional>
Returns:
Type
Promise.<Array.<*>>

whereQuery(where) → {String}

Build graphQL where query from a map
Parameters:
Name Type Description
where Object
Returns:
Type
String