From ccc8bdcf328f17487a1092761a1c8711069c82bd Mon Sep 17 00:00:00 2001 From: inertia <amartin75@gmail.com> Date: Fri, 18 Jun 2021 08:39:20 -0700 Subject: [PATCH] #56 switched broadcast examples to testnets --- _includes/local-testnet.html | 7 +++++++ _tutorials-ruby/edit_content_patching.md | 2 ++ _tutorials-ruby/follow_another_user.md | 2 ++ _tutorials-ruby/reblogging_post.md | 2 ++ _tutorials-ruby/submit_comment_reply.md | 2 ++ _tutorials-ruby/submit_post.md | 2 ++ _tutorials-ruby/vote_on_content.md | 2 ++ tutorials/ruby/10_submit_post/submit_a_new_post.rb | 1 + .../ruby/11_submit_comment_reply/submit_comment_reply.rb | 1 + .../ruby/12_edit_content_patching/edit_content_patching.rb | 5 +++-- tutorials/ruby/14_reblogging_post/reblogging_post.rb | 5 ++++- tutorials/ruby/17_vote_on_content/vote_on_content.rb | 5 ++++- tutorials/ruby/18_follow_another_user/follow.rb | 1 + 13 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 _includes/local-testnet.html diff --git a/_includes/local-testnet.html b/_includes/local-testnet.html new file mode 100644 index 00000000..5bedbdb2 --- /dev/null +++ b/_includes/local-testnet.html @@ -0,0 +1,7 @@ +You can launch a local testnet, with port 8090 mapped locally to the docker container: + +```bash +docker run -d -p 8090:8090 inertia/tintoy:latest +``` + +For details on running a local testnet, see: [Setting Up a Testnet]({{ '/nodeop/setting-up-a-testnet.html' | relative_url }}) diff --git a/_tutorials-ruby/edit_content_patching.md b/_tutorials-ruby/edit_content_patching.md index 6e443701..6805dd00 100644 --- a/_tutorials-ruby/edit_content_patching.md +++ b/_tutorials-ruby/edit_content_patching.md @@ -33,6 +33,8 @@ As stated earlier, you will need to change `broadcast` to `true`. You can also First, set up your workstation using the steps provided in [Getting Started]({{ '/tutorials-ruby/getting_started.html' | relative_url }}). Then you can create and execute the script (or clone from this repository): +{% include local-testnet.html %} + ```bash git clone https://gitlab.syncad.com/hive/devportal.git cd devportal/tutorials/ruby/12_edit_content_patching diff --git a/_tutorials-ruby/follow_another_user.md b/_tutorials-ruby/follow_another_user.md index ef671f87..08e85b9f 100644 --- a/_tutorials-ruby/follow_another_user.md +++ b/_tutorials-ruby/follow_another_user.md @@ -63,6 +63,8 @@ We also specify `blog` to tell the API method that we're looking for followed, n First, set up your workstation using the steps provided in [Getting Started]({{ '/tutorials-ruby/getting_started.html' | relative_url }}). Then you can create and execute the script (or clone from this repository): +{% include local-testnet.html %} + ```bash git clone https://gitlab.syncad.com/hive/devportal.git cd devportal/tutorials/ruby/18_follow_another_user diff --git a/_tutorials-ruby/reblogging_post.md b/_tutorials-ruby/reblogging_post.md index 7b460a3f..c8911114 100644 --- a/_tutorials-ruby/reblogging_post.md +++ b/_tutorials-ruby/reblogging_post.md @@ -286,6 +286,8 @@ Broadcasting a `custom_json` operation will require the following fields: First, set up your workstation using the steps provided in [Getting Started]({{ '/tutorials-ruby/getting_started.html' | relative_url }}). Then you can create and execute the script (or clone from this repository): +{% include local-testnet.html %} + ```bash git clone https://gitlab.syncad.com/hive/devportal.git cd devportal/tutorials/ruby/14_reblogging_post diff --git a/_tutorials-ruby/submit_comment_reply.md b/_tutorials-ruby/submit_comment_reply.md index 68a08057..3525b5fd 100644 --- a/_tutorials-ruby/submit_comment_reply.md +++ b/_tutorials-ruby/submit_comment_reply.md @@ -34,6 +34,8 @@ You should change `wif` to the posting key that matches your `author`. This scr First, set up your workstation using the steps provided in [Getting Started]({{ '/tutorials-ruby/getting_started.html' | relative_url }}). Then you can create and execute the script (or clone from this repository): +{% include local-testnet.html %} + ```bash git clone https://gitlab.syncad.com/hive/devportal.git cd devportal/tutorials/ruby/11_submit_comment_reply diff --git a/_tutorials-ruby/submit_post.md b/_tutorials-ruby/submit_post.md index 7d071d2e..b6b19c63 100644 --- a/_tutorials-ruby/submit_post.md +++ b/_tutorials-ruby/submit_post.md @@ -30,6 +30,8 @@ You should change `wif` to the posting key that matches your `author`. This scr First, set up your workstation using the steps provided in [Getting Started]({{ '/tutorials-ruby/getting_started.html' | relative_url }}). Then you can create and execute the script (or clone from this repository): +{% include local-testnet.html %} + ```bash git clone https://gitlab.syncad.com/hive/devportal.git cd devportal/tutorials/ruby/10_submit_post diff --git a/_tutorials-ruby/vote_on_content.md b/_tutorials-ruby/vote_on_content.md index a417a0bc..16904eca 100644 --- a/_tutorials-ruby/vote_on_content.md +++ b/_tutorials-ruby/vote_on_content.md @@ -203,6 +203,8 @@ Broadcasting a `vote` operation will require the following fields: First, set up your workstation using the steps provided in [Getting Started]({{ '/tutorials-ruby/getting_started.html' | relative_url }}). Then you can create and execute the script (or clone from this repository) with the following arguments: +{% include local-testnet.html %} + ```bash git clone https://gitlab.syncad.com/hive/devportal.git cd devportal/tutorials/ruby/17_vote_on_content diff --git a/tutorials/ruby/10_submit_post/submit_a_new_post.rb b/tutorials/ruby/10_submit_post/submit_a_new_post.rb index 95dec9a8..c824786d 100755 --- a/tutorials/ruby/10_submit_post/submit_a_new_post.rb +++ b/tutorials/ruby/10_submit_post/submit_a_new_post.rb @@ -4,6 +4,7 @@ require 'bundler/setup' Bundler.require options = { + url = 'https://testnet.openhive.network', wif: '5JrvPrQeBBvCRdjv29iDvkwn3EQYZ9jqfAHzrCyUvfbEbRkrYFC' } tx = Radiator::Transaction.new(options) diff --git a/tutorials/ruby/11_submit_comment_reply/submit_comment_reply.rb b/tutorials/ruby/11_submit_comment_reply/submit_comment_reply.rb index da9984a6..f2048f88 100755 --- a/tutorials/ruby/11_submit_comment_reply/submit_comment_reply.rb +++ b/tutorials/ruby/11_submit_comment_reply/submit_comment_reply.rb @@ -4,6 +4,7 @@ require 'bundler/setup' Bundler.require options = { + url: 'https://testnet.openhive.network', wif: '5JrvPrQeBBvCRdjv29iDvkwn3EQYZ9jqfAHzrCyUvfbEbRkrYFC' } tx = Radiator::Transaction.new(options) diff --git a/tutorials/ruby/12_edit_content_patching/edit_content_patching.rb b/tutorials/ruby/12_edit_content_patching/edit_content_patching.rb index 724787e3..c1da69f8 100755 --- a/tutorials/ruby/12_edit_content_patching/edit_content_patching.rb +++ b/tutorials/ruby/12_edit_content_patching/edit_content_patching.rb @@ -5,11 +5,12 @@ Bundler.require # change to true if you want to broadcast this example broadcast = false +url = 'https://testnet.openhive.network' wif = '5JrvPrQeBBvCRdjv29iDvkwn3EQYZ9jqfAHzrCyUvfbEbRkrYFC' author = 'social' title = 'title of my post' permlink = title.gsub(' ', '-').downcase -api = Radiator::Api.new +api = Radiator::Api.new(url: url) content = api.get_content(author, permlink).result metadata = {tags: %w(tag), app: 'devportal/1.0'} new_body = "#{content.body}\nAppended content." @@ -33,7 +34,7 @@ post = { body: new_body } -tx = Radiator::Transaction.new(wif: wif) +tx = Radiator::Transaction.new(url: url, wif: wif) tx.operations << post response = tx.process(broadcast) diff --git a/tutorials/ruby/14_reblogging_post/reblogging_post.rb b/tutorials/ruby/14_reblogging_post/reblogging_post.rb index 28574b93..ef9986c0 100755 --- a/tutorials/ruby/14_reblogging_post/reblogging_post.rb +++ b/tutorials/ruby/14_reblogging_post/reblogging_post.rb @@ -9,7 +9,10 @@ author = slug.split('/')[0] permlink = slug.split('/')[1..-1].join('/') reblogger = 'social' posting_wif = '5JrvPrQeBBvCRdjv29iDvkwn3EQYZ9jqfAHzrCyUvfbEbRkrYFC' -options = {wif: posting_wif} +options = { + url: 'https://testnet.openhive.network', + wif: posting_wif +} tx = Radiator::Transaction.new(options) diff --git a/tutorials/ruby/17_vote_on_content/vote_on_content.rb b/tutorials/ruby/17_vote_on_content/vote_on_content.rb index d8dfde5f..b3de7dfb 100755 --- a/tutorials/ruby/17_vote_on_content/vote_on_content.rb +++ b/tutorials/ruby/17_vote_on_content/vote_on_content.rb @@ -9,8 +9,11 @@ author = slug.split('/')[0] permlink = slug.split('/')[1..-1].join('/') voter = 'social' posting_wif = '5JrvPrQeBBvCRdjv29iDvkwn3EQYZ9jqfAHzrCyUvfbEbRkrYFC' -options = {wif: posting_wif} weight = ((weight || '100.0').to_f * 100).to_i +options = { + url: 'https://testnet.openhive.network', + wif: posting_wif +} tx = Radiator::Transaction.new(options) diff --git a/tutorials/ruby/18_follow_another_user/follow.rb b/tutorials/ruby/18_follow_another_user/follow.rb index 50f2e32a..bcc3da63 100755 --- a/tutorials/ruby/18_follow_another_user/follow.rb +++ b/tutorials/ruby/18_follow_another_user/follow.rb @@ -4,6 +4,7 @@ require 'bundler/setup' Bundler.require options = { + url: 'https://testnet.openhive.network', wif: '5JrvPrQeBBvCRdjv29iDvkwn3EQYZ9jqfAHzrCyUvfbEbRkrYFC' } tx = Radiator::Transaction.new(options) -- GitLab