-
Notifications
You must be signed in to change notification settings - Fork 0
/
params.js
116 lines (104 loc) · 4.1 KB
/
params.js
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import {
externalChainIDs,
addDetails,
nodeURL,
RPCByChainID,
corsProxyURL,
hashServerURL,
renderHeader
} from './common.js';
// import {create} from "./secp256k1";
await renderHeader();
(async () => {
async function renderChainParams() {
const div = document.getElementById('chain-params-json');
const url = `${nodeURL}/zeta-chain/observer/get_chain_params`;
const response = await fetch(url);
const data = await response.json();
const element = createTreeView(div, data);
}
renderChainParams();
async function renderSlashingParams() {
const div = document.getElementById('slashing-params-json');
const url = `${nodeURL}/cosmos/slashing/v1beta1/params`;
const response = await fetch(url);
const data = await response.json();
const element = createTreeView(div, data);
}
renderSlashingParams();
async function renderStakingParams() {
const div = document.getElementById('staking-params-json');
const url = `${nodeURL}/cosmos/staking/v1beta1/params`;
const response = await fetch(url);
const data = await response.json();
const element = createTreeView(div, data);
console.log(element);
}
renderStakingParams();
async function renderEmissionParams() {
const div = document.getElementById('emission-params-json');
const url = `${nodeURL}/zeta-chain/emissions/params`;
const response = await fetch(url);
const data = await response.json();
const element = createTreeView(div, data);
}
renderEmissionParams();
async function renderGovParams() {
async function render(subspace){
const div = document.getElementById(`gov-params-json-${subspace}`);
const url = `${nodeURL}/cosmos/gov/v1/params/${subspace}`;
const response = await fetch(url);
const data = await response.json();
const element = createTreeView(div, data);
}
await render("deposit");
await render("voting");
await render("tallying");
}
renderGovParams();
async function renderObserverParams() {
const div = document.getElementById('observer-params-json');
const url = `${nodeURL}/zeta-chain/observer/params`;
const response = await fetch(url);
const data = await response.json();
const element = createTreeView(div, data);
return data;
}
const obP = renderObserverParams();
async function renderNodeAccounts() {
const div = document.getElementById('node-accounts-json');
const url = `${nodeURL}/zeta-chain/observer/nodeAccount`;
const response = await fetch(url);
const data = await response.json();
const element = createTreeView(div, data);
return data;
const grantees = data.NodeAccount.map((x)=>x.granteeAddress);
div.appendChild(createTreeView(document.createElement("div"), grantees));
}
const nAccP = renderNodeAccounts();
async function renderObserverSet() {
const div = document.getElementById('observer-set-json');
const url = `${nodeURL}/zeta-chain/observer/observer_set`;
const response = await fetch(url);
const data = await response.json();
const element = createTreeView(div, data);
}
renderObserverSet();
async function renderCrosschainFlags() {
const div = document.getElementById('crosschain-flags-json');
const url = `${nodeURL}/zeta-chain/observer/crosschain_flags`;
const response = await fetch(url);
const data = await response.json();
const element = createTreeView(div, data);
}
renderCrosschainFlags();
async function renderBlockParams() {
const div = document.getElementById('block-params-json');
const url = `${nodeURL}/cosmos/params/v1beta1/params?subspace=baseapp&key=BlockParams`;
const response = await fetch(url);
const data = await response.json();
console.log(data);
const element = createTreeView(div, data);
}
renderBlockParams();
})();