You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuweni.apache.org by to...@apache.org on 2021/01/03 04:26:39 UTC

[incubator-tuweni-website] 02/02: Add units tutorial

This is an automated email from the ASF dual-hosted git repository.

toulmean pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tuweni-website.git

commit 9dda94b462af1b68c35d7e5e497e8ced82741a58
Author: Antoine Toulme <an...@lunar-ocean.com>
AuthorDate: Sat Jan 2 20:26:22 2021 -0800

    Add units tutorial
---
 tutorials/creating-uints.md             | 10 ++++++++++
 tutorials/getting-started-with-units.md | 35 +++++++++++++++++++++++++++++++++
 tutorials/index.md                      | 12 +++++++++--
 tutorials/mutable-bytes.md              |  1 +
 tutorials/own-bytes-class.md            | 19 ++++++++++++++++++
 5 files changed, 75 insertions(+), 2 deletions(-)

diff --git a/tutorials/creating-uints.md b/tutorials/creating-uints.md
new file mode 100644
index 0000000..49827cc
--- /dev/null
+++ b/tutorials/creating-uints.md
@@ -0,0 +1,10 @@
+---
+layout: tutorial
+title: Creating Uints
+description: Creating Uints
+group: nav-right
+categories: ["units", "bigints"]
+previous: getting-started-with-units.md
+---
+
+TODO
\ No newline at end of file
diff --git a/tutorials/getting-started-with-units.md b/tutorials/getting-started-with-units.md
new file mode 100644
index 0000000..95480b5
--- /dev/null
+++ b/tutorials/getting-started-with-units.md
@@ -0,0 +1,35 @@
+---
+layout: tutorial
+title: Getting Started with Unsigned Integers
+description: Getting Started with Unsigned Integers
+group: nav-right
+categories: ["units", "bigints"]
+previous: index.md
+next: creating-uints.md
+---
+
+Apache Tuweni provides support for manipulating unsigned integers and base Ethereum currencies.
+
+To get started, install the `units` library.
+
+With Maven:
+
+{% highlight xml %}
+<dependency>
+  <groupId>org.apache.tuweni</groupId>
+  <artifactId>units</artifactId>
+  <version>{{site.data.project.latest_release}}</version>
+</dependency>
+{% endhighlight %}
+
+Or using Gradle:
+
+{% highlight groovy %}
+implementation("org.apache.tuweni:units:{{site.data.project.latest_release}}")
+{% endhighlight %}
+
+The [units library](/docs/org.apache.tuweni.units.bigints/index.html) revolves mainly around the [`Uint256`](/docs/org.apache.tuweni.units.bigints/-u-int256/index.html), [`Uint384`](/docs/org.apache.tuweni.units.bigints/-u-int384/index.html)  and [`Uint64`](/docs/org.apache.tuweni.units.bigints/-u-int64/index.html)  interfaces.
+
+This tutorial goes over the main uses of `Uint256` - you can apply the same behaviors over to `Uint384`, `Uint64` or `Uint32`.
+
+It will also touch on `Wei` and `Gas`.
\ No newline at end of file
diff --git a/tutorials/index.md b/tutorials/index.md
index c7ffe1a..360def7 100644
--- a/tutorials/index.md
+++ b/tutorials/index.md
@@ -5,8 +5,16 @@ description: Tutorials
 group: nav-right
 ---
 
-# Getting started with bytes
+# All about bytes
 
 In this tutorial, we explain in detail how to use the bytes library of Apache Tuweni.
 
-## [Start tutorial](getting-started-with-bytes)
\ No newline at end of file
+## [Start tutorial](getting-started-with-bytes)
+
+# Big integers and Ethereum domain objects
+
+Unsigned ints - uints - are interesting domain objects to perform arithmetic operations with blockchains.
+
+We explain in detail how to use the units library of Apache Tuweni.
+
+## [Start tutorial](getting-started-with-units)
\ No newline at end of file
diff --git a/tutorials/mutable-bytes.md b/tutorials/mutable-bytes.md
index 87cc26b..50cad67 100644
--- a/tutorials/mutable-bytes.md
+++ b/tutorials/mutable-bytes.md
@@ -5,6 +5,7 @@ description: Mutable Bytes
 group: nav-right
 categories: ["bytes"]
 previous: manipulating-bytes.md
+next: own-bytes-class.md
 ---
 
 
diff --git a/tutorials/own-bytes-class.md b/tutorials/own-bytes-class.md
new file mode 100644
index 0000000..28387b6
--- /dev/null
+++ b/tutorials/own-bytes-class.md
@@ -0,0 +1,19 @@
+---
+layout: tutorial
+title: Creating your very own Bytes classs
+description: Creating your very own Bytes classs
+group: nav-right
+categories: ["bytes"]
+previous: mutable-bytes.md
+---
+
+You can create your very own implementation of `Bytes` by extending the [`AbstractBytes` class](/docs/org.apache.tuweni.bytes/-abstract-bytes/index.html).
+
+You will need to implement the following functions:
+* [`get(i)`](/docs/org.apache.tuweni.bytes/-bytes/get.html)
+* [`size()`](/docs/org.apache.tuweni.bytes/-bytes/size.html)
+* [`slice(offset, size)`](/docs/org.apache.tuweni.bytes/-bytes/slice.html)
+* [`copy(offset, size)`](/docs/org.apache.tuweni.bytes/-bytes/copy.html)
+* [`mutableCopy(offset, size)`](/docs/org.apache.tuweni.bytes/-bytes/mutable-copy.html)
+
+You can choose to simplify greatly by extending the [`DelegatingBytes` class](/docs/org.apache.tuweni.bytes/-delegating-bytes/index.html) instead.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tuweni.apache.org
For additional commands, e-mail: commits-help@tuweni.apache.org