Skip to content

Instantly share code, notes, and snippets.

@PrathamRawat

PrathamRawat/accountQuery.js Secret

Created May 21, 2020
Embed
What would you like to do?
const conseilServer = {
url: 'https://conseil-prod.cryptonomic-infra.tech:443',
apiKey: "INSERT KEY HERE", //Replace this with your own key from Nautilus Cloud
network: 'mainnet'
};
// Account Balance Query
let query = conseiljs.ConseilQueryBuilder.blankQuery(); //Initializes a blank query
query = conseiljs.ConseilQueryBuilder.addFields(query, 'balance'); // Adds balance as a field
query = conseiljs.ConseilQueryBuilder.addFields(query, 'account_id'); // Adds the account_id as a field
query = conseiljs.ConseilQueryBuilder.addOrdering(query, "balance", conseiljs.ConseilSortDirection.DESC); // Orders the results based off of balance in descending order
query = conseiljs.ConseilQueryBuilder.setLimit(query, 684); // Limits the results to 684 accounts
// Wrapper function for query execution
let execute = async function(query, entity) {
let result = await conseiljs.ConseilDataClient.executeEntityQuery(conseilServer, 'tezos', conseilServer.network, entity, query); // ConseilJS call to execute query
console.log(result)
return result
}
result = execute(query, "accounts")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.