Skip to content

Commit

Permalink
Use external example code
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Geihs <matthias@perun.network>
  • Loading branch information
matthiasgeihs committed Mar 1, 2021
1 parent d643f0c commit b4bb1d2
Show file tree
Hide file tree
Showing 24 changed files with 33 additions and 875 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Expand Up @@ -9,6 +9,7 @@ commands:
setup:
steps:
- checkout
- run: git submodule init && git submodule update
- add_ssh_keys:
fingerprints: "ba:c4:1d:f9:75:8e:45:6e:bb:30:0c:58:4d:28:40:32"
- restore_cache:
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
@@ -0,0 +1,3 @@
[submodule "source/perun-examples"]
path = source/perun-examples
url = https://github.com/perun-network/perun-examples
2 changes: 1 addition & 1 deletion source/conf.py
Expand Up @@ -67,7 +67,7 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []
exclude_patterns = ["perun-examples/*"]

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
Expand Down
4 changes: 2 additions & 2 deletions source/go-perun/tutorial/channels/closing.rst
Expand Up @@ -57,14 +57,14 @@ Ethereum transaction fees still apply.
Keep in mind that we already *finalized* the channel in the update that we sent.
We therefore just need to *register* and *settle* which looks like this:

.. literalinclude:: ../go-perun-test/node.go
.. literalinclude:: ../../../perun-examples/simple-client/node.go
:language: go
:lines: 130-147

The other participant would then have its `AdjudicatorEvent` handler called with a
`ConcludedEvent`_ and should then also execute `closeChannel`.

.. literalinclude:: ../go-perun-test/node.go
.. literalinclude:: ../../../perun-examples/simple-client/node.go
:language: go
:lines: 149-155

Expand Down
6 changes: 3 additions & 3 deletions source/go-perun/tutorial/channels/opening.rst
Expand Up @@ -7,7 +7,7 @@ The channel is open after all participants accept the proposal and finish the on

It looks like this:

.. literalinclude:: ../go-perun-test/node.go
.. literalinclude:: ../../../perun-examples/simple-client/node.go
:language: go
:lines: 38-68

Expand All @@ -24,7 +24,7 @@ HandleProposal

An example Proposal handler looks like this:

.. literalinclude:: ../go-perun-test/node.go
.. literalinclude:: ../../../perun-examples/simple-client/node.go
:language: go
:lines: 70-89

Expand All @@ -39,7 +39,7 @@ NewChannel
*go-perun* expects this handler to finish quickly. Use *go* routines if you want to do
time-intensive tasks. You should also start the :ref:`watcher <the-watcher>` as shown below:

.. literalinclude:: ../go-perun-test/node.go
.. literalinclude:: ../../../perun-examples/simple-client/node.go
:language: go
:lines: 91-100

Expand Down
4 changes: 2 additions & 2 deletions source/go-perun/tutorial/channels/updating.rst
Expand Up @@ -6,7 +6,7 @@ Updating
We now give the `node` an `updateChannel` function to update the channel by sending Ether from
*Bob* to *Alice*.

.. literalinclude:: ../go-perun-test/node.go
.. literalinclude:: ../../../perun-examples/simple-client/node.go
:language: go
:lines: 102-115
:emphasize-lines: 8,9
Expand All @@ -26,7 +26,7 @@ The update that was initiated with the `updateChannel` function above would then
at the `HandleUpdate` function of the other participant. In `HandleUpdate` you can decide on whether you want to accept the incoming update or not.
This example function accepts all updates:

.. literalinclude:: ../go-perun-test/node.go
.. literalinclude:: ../../../perun-examples/simple-client/node.go
:language: go
:lines: 117-124

Expand Down
4 changes: 2 additions & 2 deletions source/go-perun/tutorial/getting-started.rst
Expand Up @@ -13,8 +13,8 @@ To make it easier to follow the tutorial, you may already clone the source code
.. code-block:: bash
cd $GOPATH/src
git clone https://github.com/perun-network/perun-tutorial.git
cd perun-tutorial/go-perun-test
git clone https://github.com/perun-network/perun-examples.git
cd perun-examples/simple-client
# Initialize Golang
go mod tidy
Expand Down
42 changes: 0 additions & 42 deletions source/go-perun/tutorial/go-perun-test/channel.go

This file was deleted.

55 changes: 0 additions & 55 deletions source/go-perun/tutorial/go-perun-test/config.go

This file was deleted.

9 changes: 0 additions & 9 deletions source/go-perun/tutorial/go-perun-test/go.mod

This file was deleted.

0 comments on commit b4bb1d2

Please sign in to comment.