Skip to content

Asset lists, and rich list #18

@quocble

Description

@quocble

Motivation

Users are asking how many people holding certain coins.. Let's provide a rich list of these coins.

Design

https://open-explorer.io/#/assets
We have fewer columns.

  • Name
  • Description
  • Circulating Supply (sum up from all the account holders)
  • Total Supply (get_object 2.3.0 which is the dynamic asset object for 1.3.0)
  • Holders (see get_asset_holders_count)

Clicking on Asset takes to top holders

https://open-explorer.io/#/assets/1.3.113

  • Account
  • Amount

with paging , see get_asset_holders api

Sample code

const fetch = require('node-fetch');
var wsString = "ws://testnet-01.quantachain.io:8090";
import GrapheneApi from "@quantadex/bitsharesjs-ws/cjs/src/GrapheneApi";
import ChainWebSocket from "@quantadex/bitsharesjs-ws/cjs/src/ChainWebSocket";

import { hash } from "@quantadex/bitsharesjs";
// import GrapheneApi from "@quantadex/bitsharesjs-ws/es/src/GrapheneApi";
import createHash from "create-hash";

var url = "https://wya99cec1d.execute-api.us-east-1.amazonaws.com/testnet/account?filter_field=operation_type&filter_value=50&size=1000"

async function main() {
	// await Apis.instance(wsString, true, 3000, { enableOrders: false }).init_promise
	let conn = new ChainWebSocket(wsString, () => { }, 3000, true,() =>{});
	await conn.login("","")

	var api = new GrapheneApi(conn,"asset");
	console.log("connect?");
	try {
		const out = await api.init()
		console.log("connected");
		const block = await api.exec("get_asset_holders", ["1.3.0", 0, 100])
		console.log(block);
		
		const count = await api.exec("get_asset_holders_count", ["1.3.0"])
		console.log("Count",count);

	}catch(e) {
		console.log(e);
	}
}

main().then(e=> {})

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions