From 1a27f5999ba448d1383934fa9c67b4ef71fa5789 Mon Sep 17 00:00:00 2001 From: Jeremy Kauffman Date: Thu, 2 Mar 2017 15:59:31 -0500 Subject: [PATCH] add publish support to quickstart --- controller/action/DeveloperActions.class.php | 4 ++-- view/template/developer/_formCreditsPublish.php | 2 +- view/template/developer/_quickstartCredits.php | 16 +++++++++++----- web/js/quickstart.js | 16 ++++++++-------- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/controller/action/DeveloperActions.class.php b/controller/action/DeveloperActions.class.php index fbffc98a..329ee7ef 100644 --- a/controller/action/DeveloperActions.class.php +++ b/controller/action/DeveloperActions.class.php @@ -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') ]; } diff --git a/view/template/developer/_formCreditsPublish.php b/view/template/developer/_formCreditsPublish.php index 71236bd3..290ddd88 100644 --- a/view/template/developer/_formCreditsPublish.php +++ b/view/template/developer/_formCreditsPublish.php @@ -15,7 +15,7 @@ lbry.quickstartForm('#form-new-publish-reward', "");
-
diff --git a/view/template/developer/_quickstartCredits.php b/view/template/developer/_quickstartCredits.php index 44e8ebf3..275b59a3 100644 --- a/view/template/developer/_quickstartCredits.php +++ b/view/template/developer/_quickstartCredits.php @@ -13,9 +13,6 @@ $curl 'http://localhost:5279/lbryapi' --data '{"method":"wallet_balance"}' [50.00000000]

Publishing

-
- 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. -

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.

Not sure what to publish? We recommend your favorite picture or home video. Or just grab something from here.

$curl 'http://localhost:5279/lbryapi' --data '{"method":"publish", "params": { @@ -24,17 +21,26 @@ "bid": 1, "metadata": { } //this should match the metadata returned by resolve_name }}' -[whatever this response looks like] +[ + { + "claim_id": "2081486f32dc493980c77bdaa0502950b532af13", + "fee": 0.000329, + "nout": 0, + "tx": "0100000001a2dcee285b3f552fb8b3eef416c9f17...", + "txid": "d71d63ebb3e10067bfd0b302433bc1ab09fbdd5dc9bc687f50aeb6809d1770fe" //this is the value you need to copy + } +]
Request::getRelativeUri() . '#new-developer' ]) ?>

Enjoy a Hollywood Film

+

It's a Disaster starring David Cross is just one of tens of thousands of great pieces of content available. Check it out!

$curl 'http://localhost:5279/lbryapi' --data '{"method":"get","params":{"name":"itsadisaster"} }' ["d5169241150022f996fa7cd6a9a1c421937276a3275eb912790bd07ba7aec1fac5fd45431d226b8fb402691e79aeb24b"]

Try the UI

-

LBRY comes with a UI so that normal people can use it too. You can download it here.

+

LBRY comes with a UI so that normal people can use it too. You can download it here.

You Did It! What's Next?

Start building something awesome! LBRY works as a discovery and distribution backend for everything from films to CAD files. diff --git a/web/js/quickstart.js b/web/js/quickstart.js index 61d119f8..3987257f 100644 --- a/web/js/quickstart.js +++ b/web/js/quickstart.js @@ -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 = $(''); - 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)