add publish support to quickstart

This commit is contained in:
Jeremy Kauffman 2017-03-02 15:59:31 -05:00
parent 1ee041d467
commit 1a27f5999b
4 changed files with 22 additions and 16 deletions

View file

@ -52,7 +52,7 @@ class DeveloperActions extends Actions
return $vars + [
'defaultWalletAddress' => Session::get(Session::KEY_DEVELOPER_CREDITS_WALLET_ADDRESS),
'error' => Session::get(Session::KEY_DEVELOPER_LAST_FORM) == "new_developer" ? Session::getFlash(Session::KEY_DEVELOPER_CREDITS_ERROR) : '',
'apiUrl' => LBRY::getApiUrl('/user/new_github')
'apiUrl' => LBRY::getApiUrl('/reward/new?reward_type=new_developer')
];
}
@ -61,7 +61,7 @@ class DeveloperActions extends Actions
return $vars + [
'defaultWalletAddress' => Session::get(Session::KEY_DEVELOPER_CREDITS_WALLET_ADDRESS),
'error' => Session::get(Session::KEY_DEVELOPER_LAST_FORM) == "new_publish" ? Session::getFlash(Session::KEY_DEVELOPER_CREDITS_ERROR) : '',
'apiUrl' => LBRY::getApiUrl('/reward/new')
'apiUrl' => LBRY::getApiUrl('/reward/new?reward_type=first_publish')
];
}

View file

@ -15,7 +15,7 @@ lbry.quickstartForm('#form-new-publish-reward', "<?php echo $apiUrl ?>");
<div class="form-row">
<label for="wallet">Publishing Transaction ID</label>
<div class="form-input">
<input type="text" name="transaction_hash" value="<?php echo '' ?>"
<input type="text" name="transaction_id" value="<?php echo '' ?>"
class="required standard " placeholder="e99240e60499b372371a4e461ca25506745686b4c8fa3dd646a83f44ad358255">
</div>
</div>

View file

@ -13,9 +13,6 @@
<code class="code-bash"><span class="code-bash__prompt">$</span>curl 'http://localhost:5279/lbryapi' --data '{"method":"wallet_balance"}'
<span class="code-bash__response">[50.00000000]</span></code>
<h3 id="publish">Publishing</h3>
<div class="notice notice-info spacer1">
The credit reward for this portion of the guide does not work yet. It will be added shortly. However, you can still follow this section to learn how to publish.
</div>
<p>Publishing to LBRY is just as easy as everything else! If you publish something, we'll send you an additional 200 LBC for further use.</p>
<p>Not sure what to publish? We recommend your favorite picture or home video. Or just grab something from <a class="link-primary" href="https://archive.org/details/movies">here</a>.</p>
<code class="code-bash"><span class="code-bash__prompt">$</span>curl 'http://localhost:5279/lbryapi' --data '{"method":"publish", "params": {
@ -24,17 +21,26 @@
"bid": 1,
"metadata": { } <span class="code-bash__comment">//this should match the metadata returned by resolve_name </span>
}}'
<span class="code-bash__response">[whatever this response looks like]</span></code>
<span class="code-bash__response">[
{
"claim_id": "2081486f32dc493980c77bdaa0502950b532af13",
"fee": 0.000329,
"nout": 0,
"tx": "0100000001a2dcee285b3f552fb8b3eef416c9f17...",
"txid": "d71d63ebb3e10067bfd0b302433bc1ab09fbdd5dc9bc687f50aeb6809d1770fe" <span class="code-bash__comment">//this is the value you need to copy</span>
}
]</span></code>
<div class="quickstart__claim-form content-light content" id="new-publish">
<?php echo View::render('developer/_formCreditsPublish', [
'returnUrl' => Request::getRelativeUri() . '#new-developer'
]) ?>
</div>
<h3>Enjoy a Hollywood Film</h3>
<p><a href="http://www.imdb.com/title/tt1995341/" class="link-primary">It's a Disaster</a> starring David Cross is just one of tens of thousands of great pieces of content available. Check it out!</p>
<code class="code-bash"><span class="code-bash__prompt">$</span>curl 'http://localhost:5279/lbryapi' --data '{"method":"get","params":{"name":"itsadisaster"} }'
<span class="code-bash__response">["d5169241150022f996fa7cd6a9a1c421937276a3275eb912790bd07ba7aec1fac5fd45431d226b8fb402691e79aeb24b"]</span></code>
<h3>Try the UI</h3>
<p>LBRY comes with a UI so that normal people can use it too. You can download it <a href="https://lbry.io/get" class="link-primary">here</a>.</p>
<p>LBRY comes with a UI so that normal people can use it too. You can download it <a href="https://github.com/lbryio/lbry-app/releases" class="link-primary">here</a>.</p>
<h3 id="community">You Did It! What's Next?</h3>
<p>
Start building something awesome! LBRY works as a discovery and distribution backend for everything from films to CAD files.

View file

@ -2,7 +2,7 @@ lbry.quickstartForm = function (selector, apiUrl) {
var form = $(selector),
accessToken = form.find(':input[name="access_token"]').val(),
walletAddressInput = form.find(':input[name="wallet_address"]'),
transactionHashInput = form.find(':input[name="transaction_hash"]'),
transactionIdInput = form.find(':input[name="transaction_id"]'),
storageKey = form.attr('id') + "SuccessHTML",
submitButton = form.find(':input[type="submit"]'),
isAutomaticSubmit = false,
@ -11,7 +11,7 @@ lbry.quickstartForm = function (selector, apiUrl) {
function resetFormState() {
isSubmitting = false;
walletAddressInput.attr('readonly', null);
transactionHashInput.attr('readonly', null);
transactionIdInput.attr('readonly', null);
submitButton.val(submitButton.data('submitLabel')).attr('disabled', null);
}
@ -39,29 +39,29 @@ lbry.quickstartForm = function (selector, apiUrl) {
return false;
}
if (transactionHashInput.length) {
if (!transactionHashInput.val()) {
if (transactionIdInput.length) {
if (!transactionIdInput.val()) {
resetFormState();
if (!isAutomaticSubmit) {
form.find('.notice-error').html("Please supply a transaction ID.").show();
}
return false;
}
postData.transaction_hash = transactionHashInput.val();
postData.transaction_id = transactionIdInput.val();
}
event.preventDefault();
walletAddressInput.attr('readonly', 'readonly');
transactionHashInput.attr('readonly', 'readonly');
transactionIdInput.attr('readonly', 'readonly');
submitButton.val(submitButton.data('submittingLabel')).attr('disabled', 'disabled');
$.post(apiUrl, postData)
.done(function (responseData) {
var data = responseData.data;
var anchor = $('<a class="link-primary--break-word"></a>');
anchor.attr("href", "https://explorer.lbry.io/tx/" + data.TransactionHash);
anchor.html(data.TransactionHash)
anchor.attr("href", "https://explorer.lbry.io/tx/" + data.transactionId);
anchor.html(data.transactionId)
form.find('.notice-success')
.html(data.RewardAmount + " credits sent in transaction ")
.append(anchor)