Last active
January 13, 2020 06:28
-
-
Save laalaguer/b48e6ca679f2e71d08af64076cfb4539 to your computer and use it in GitHub Desktop.
get sponsor signature function
This file contains 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
// HTTP function definition | |
async function getSponosrSignature(sender, txBody) { | |
const url = 'http://localhost:3000/' | |
const response = await fetch(url, { | |
method: 'POST', | |
headers: { | |
'Accept': 'application/json', | |
'Content-Type': 'application/json' | |
}, | |
body: JSON.stringify({ | |
'sender': sender, | |
'txBody': txBody | |
}) | |
}) | |
const r = await response.json() | |
return r['sponsor_signature'] | |
} | |
// Fetch the sponsor signature. | |
const sponsorSignature = await getSponosrSignature( | |
'0x'+originAddress.toString('hex'), | |
txBody | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment