Skip to content

Instantly share code, notes, and snippets.

@Gkiokan
Created June 7, 2021 08:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gkiokan/a0efa11ce08b54d988cc32a9618bccdb to your computer and use it in GitHub Desktop.
Save Gkiokan/a0efa11ce08b54d988cc32a9618bccdb to your computer and use it in GitHub Desktop.
TronConomy withdraw
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