"use strict"; /* global document, fetch, history, send, window */ document.getElementById("get-started").onclick = event => { event.preventDefault(); send({ message: "auth me with github" }); }; if (window.location.search.includes("?code=")) { document.querySelector("developer-program").innerHTML = `
To receive your LBC, you'll need a wallet address. While graphical wallets are available, the recommended path for engineers is to:
./lbrynet start
)../lbrynet address unused
and copy the id
field.Awaiting response from LBRY server...
"; }; } function syncWithApi(data) { // eslint-disable-line no-unused-vars const address = data.address; const code = data.code; if (code === null) document.querySelector("developer-program").innerHTML = "There was an issue with accessing GitHub's API. Please try again later.
"; fetch(`https://api.lbry.com/reward/new?github_token=${code}&reward_type=github_developer&wallet_address=${address}`) .then(response => response.json()) .then(result => { switch(true) { case result.error === "this reward is limited to 1 per person": document.querySelector("developer-program").innerHTML = "You have already claimed this reward. This reward is limited to ONE per person. Your enthusiasm is appreciated.
"; break; case result.success: result = result.data; document.querySelector("developer-program").innerHTML = `Success! Your wallet has been credited with ${result.reward_amount} LBC.
We have a great reference for the LBRY SDK here to help you get started.
You can see proof of this transaction on our Blockchain Explorer.
`; break; default: console.log(data); // eslint-disable-line no-console document.querySelector("developer-program").innerHTML = "The LBRY API might be down. Please try again later.
"; break; } }) .catch(() => { // Idk what the error would be (probably a 500) so let's just have this message document.querySelector("developer-program").innerHTML = "LBRY API is down. Please try again later.
"; }); }