JSFiddle - React, Tailwind, and code Playground
by rrmadjos
HTML
<!DOCTYPE html>
<html>
<body>
<p id="price"></p>
</body>
</html>
JavaScript
const apiUrl = 'https://api.signalclout.com/graphql';
let queryBody = {
query: `
query ($hodler: String!, $creator: String!) {
stableProfile(publicKey: $hodler) {
holding(creator: $creator) {
valueUSD
}
}
}
`,
variables: {
hodler: 'BC1YLhtGk4DdnAEjeNSW8wA6H45LdtFQT9Fmw6GsUr1C9p4bqNtYAnW',
creator: 'BC1YLjKs9SwhBVXtxR9AfZZ3tErjGhAnyMEQmDCNrJVVNrgrPGtgriM'
}
};
let options = {
method: 'post',
headers: {
'content-type': 'application/json'
},
body: JSON.stringify(queryBody)
}
fetch(apiUrl, options)
.then(response => response.json())
.then(response => {
document.getElementById("price").innerHTML = response.data.stableProfile.holding.valueUSD;
});