"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.
"; return; case Boolean(result.error): document.querySelector("developer-program").innerHTML = `${result.error}
`; return; 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.
`; return; default: console.info(data); // eslint-disable-line no-console document.querySelector("developer-program").innerHTML = "No success or error was received so the LBRY API might be down.
Please try again later.
LBRY API is down. Please try again later.
"; }); }