Skip to content

Instantly share code, notes, and snippets.

@agnelvishal
Last active October 23, 2019 09:14
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 agnelvishal/51220774885092a4e54827b13a551711 to your computer and use it in GitHub Desktop.
Save agnelvishal/51220774885092a4e54827b13a551711 to your computer and use it in GitHub Desktop.
Rydeum wallet transfer api call code
async function walletTransfer(amount,fromAddress,fromPrivateKey,Daddress, Oaddress, Raddress, DPercent = 60, OPercent = 20, RPercent) {
if(typeof RPercent != 'undefined')
{
RPercent = Math.round(100-OPercent-DPercent)
}
const serverUrl = "http:///localhost:3000/send"
let fetchUrl = serverUrl + "?amount=" + amount + "&fromAddress="+fromAddress+"&fromPrivateKey=" + fromPrivateKey +"&Daddress=" + Daddress + "&Oaddress=" + Oaddress + "&Raddress=" + Raddress + "&DPercent=" + DPercent + "&OPercent=" + OPercent + "&RPercent=" + RPercent;
promiseData = await fetch(fetchUrl);
jsonData = await promiseData.json();
return jsonData
}
// 1st argument to walletTransfer is amount to send. 2nd argument is Driver Wallet address. 3rd argument is Operator Wallet address. 4th argument is Rydeum fund Wallet address.
let transaction = await walletTransfer(1,"","","0x4c93a5590d6372af3e1c9be3954c39c590e60038","0x08328aD6E0Ad188Ab7378c6cc81209E1df922Dc7","0x40ADe8d4B29306486b0ED948Dc2Ed7a4eA71c2d8",80,20)
console.log(transaction)
console.log(transaction.etherscan1) // To view etherscan link where funds are transferred to Driver wallet address
console.log(transaction.etherscan2) // To view etherscan link where funds are transferred to Operator wallet address
console.log(transaction.etherscan3) // To view etherscan link where funds are transferred to Rydeum wallet address.
console.log(transaction.hash1) // Just in case you want to view the transaction details like Block number, block hash, transaction hash for Driver wallet address
@agnelvishal
Copy link
Author

agnelvishal commented Oct 22, 2019

To see the response in Postman or Browser, copy this link,and replace xxx and yyy with Rider Wallet Address and Private key and paste in Postman or Browser,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment