This repository was archived by the owner on Aug 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata_functions.py
More file actions
51 lines (36 loc) · 1.81 KB
/
data_functions.py
File metadata and controls
51 lines (36 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from graphql_functions import load_query, fetch_graphql_data
from collections import Counter
def getTopAccount() :
query = load_query('account.graphql')
data = fetch_graphql_data(query, "https://aptos-mainnet.nodeinfra.com/indexer")
return data["account_transactions_aggregate"]["aggregate"]["max"]["account_address"], query
def getNumberOfNfts() :
query = load_query('nfts.graphql')
data = fetch_graphql_data(query, "https://aptos-mainnet.nodeinfra.com/indexer")
return data['current_token_ownerships_v2_aggregate']['aggregate']['count'], query
def getNumberOfMint() :
query = load_query('mint.graphql')
data = fetch_graphql_data(query, "https://aptos-mainnet.nodeinfra.com/indexer")
return data['token_activities_v2_aggregate']['aggregate']['count'], query
def getNumberOfBurn() :
query = load_query('burn.graphql')
data = fetch_graphql_data(query, "https://aptos-mainnet.nodeinfra.com/indexer")
return data['token_activities_v2_aggregate']['aggregate']['count'], query
def getTopModudle() :
query = load_query('events.graphql')
data = fetch_graphql_data(query, "https://aptos-mainnet.nodeinfra.com/indexer")
first_key = list(data.keys())[0]
types = [item['type'] for item in data[first_key]]
modules = ['::'.join(t.split('::')[:2]) for t in types]
counter = Counter(modules)
top_module, _ = counter.most_common(1)[0]
return top_module, query
def getTopContracts() :
query = load_query('events.graphql')
data = fetch_graphql_data(query, "https://aptos-mainnet.nodeinfra.com/indexer")
first_key = list(data.keys())[0]
types = [item['type'] for item in data[first_key]]
contracts = ['::'.join(t.split('::')[:3]) for t in types]
counter = Counter(contracts)
top_contract, _ = counter.most_common(1)[0]
return top_contract, query