Created
June 7, 2021 08:16
-
-
Save Gkiokan/a0efa11ce08b54d988cc32a9618bccdb to your computer and use it in GitHub Desktop.
TronConomy withdraw
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let withdrawalAmount = 10 | |
let fetchOptions = { | |
headers: { | |
'Authorization': 'bearer '+window.localStorage["sessionToken"], | |
'Content-Type': 'application/json' | |
}, | |
body: JSON.stringify({ amount: window.tronWeb.toSun(withdrawalAmount) }), | |
method: 'POST' | |
}; | |
fetch(`/api/tronlink/withdrawrequest`, fetchOptions).then(resp => resp.json()).then((resp) => { | |
console.log(`withdraw requested ${withdrawalAmount}`); | |
console.log("response: "); | |
console.dir(resp); | |
if (resp.message) { | |
alert(resp.message); | |
} else { | |
alert('Withdrawal of '+withdrawalAmount+ ' TRX requested'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment