Skip to content

Instantly share code, notes, and snippets.

@laalaguer
Last active January 13, 2020 06:28
Show Gist options
  • Save laalaguer/b48e6ca679f2e71d08af64076cfb4539 to your computer and use it in GitHub Desktop.
Save laalaguer/b48e6ca679f2e71d08af64076cfb4539 to your computer and use it in GitHub Desktop.
get sponsor signature function
// 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