-
-
Save PrathamRawat/ab16612268d2721911a88f5a8fabe98f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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