-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi.js
25 lines (19 loc) · 754 Bytes
/
api.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
function check(){
let userAddress = document.getElementById("input").value;
fetch(`https://worker.jup.ag/jup-claim-proof/WENWENvqqNya429ubCdR81ZmD69brwQaaBYY6p3LCpk/${userAddress}`)
.then(res =>{
return res.json();
})
.then(data =>{
const amount = data.amount
const formattedNumber = amount.toString().replace(/(\.0+|(?<=\d)0+)$/, '');
const setData =`
<p>Allocation: <span> ${formattedNumber} </span></p>`
document.querySelector('.result').innerHTML = setData;
})
.catch(error => {
const setData =`
<p>Allocation: <span> NO ALLOCATION FOUND </span></p>`
document.querySelector('.result').innerHTML = setData;
})
}