Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
621 changes: 316 additions & 305 deletions assets/examples/agents.html

Large diffs are not rendered by default.

17 changes: 16 additions & 1 deletion assets/examples/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@
</a>


<a class="source" href="fabric-basic-usage.html">
examples/fabric-basic-usage.js
</a>


<a class="source" href="fabric-demo.html">
examples/fabric-demo.js
</a>


<a class="source" href="fabric.html">
examples/fabric.js
</a>
Expand Down Expand Up @@ -102,6 +112,11 @@
</a>


<a class="source" href="onion-forward.html">
examples/onion-forward.js
</a>


<a class="source" href="oracle.html">
examples/oracle.js
</a>
Expand Down Expand Up @@ -156,7 +171,7 @@ <h1 id="offline-first-applications-with-fabric">Offline-first Applications with
<h2 id="warning">Warning</h2>
<p>This example is intended for downstream consumers — those seeking to implement client-facing applications using Fabric.</p>
<h2 id="quickstart">Quickstart</h2>
<p>Ensure that you are using NodeJS <code>24.14.1</code> — execute in your clone of the Fabric Core repository.</p>
<p>Ensure that you are using NodeJS <code>24.15.0</code> — execute in your clone of the Fabric Core repository.</p>
<h3 id="cloning-fabric">Cloning Fabric</h3>
<p>Run the following commands:</p>
<pre><code>git clone git@github.<span class="hljs-property">com</span>:<span class="hljs-title class_">FabricLabs</span>/fabric.<span class="hljs-property">git</span>
Expand Down
50 changes: 38 additions & 12 deletions assets/examples/bitcoin.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@
</a>


<a class="source" href="fabric-basic-usage.html">
examples/fabric-basic-usage.js
</a>


<a class="source" href="fabric-demo.html">
examples/fabric-demo.js
</a>


<a class="source" href="fabric.html">
examples/fabric.js
</a>
Expand Down Expand Up @@ -102,6 +112,11 @@
</a>


<a class="source" href="onion-forward.html">
examples/onion-forward.js
</a>


<a class="source" href="oracle.html">
examples/oracle.js
</a>
Expand Down Expand Up @@ -168,11 +183,10 @@ <h1>bitcoin.js</h1>

<span class="hljs-keyword">const</span> <span class="hljs-title class_">Fabric</span> = <span class="hljs-built_in">require</span>(<span class="hljs-string">&#x27;../&#x27;</span>);
<span class="hljs-keyword">const</span> <span class="hljs-title class_">Bitcoin</span> = <span class="hljs-built_in">require</span>(<span class="hljs-string">&#x27;../services/bitcoin&#x27;</span>);
<span class="hljs-keyword">const</span> <span class="hljs-title class_">Wallet</span> = <span class="hljs-built_in">require</span>(<span class="hljs-string">&#x27;../types/wallet&#x27;</span>);

<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">main</span> () {
<span class="hljs-keyword">let</span> fabric = <span class="hljs-keyword">new</span> <span class="hljs-title class_">Fabric</span>();
<span class="hljs-keyword">let</span> bitcoin = <span class="hljs-keyword">new</span> <span class="hljs-title class_">Bitcoin</span>({ <span class="hljs-attr">network</span>: <span class="hljs-string">&#x27;regtest&#x27;</span> });</pre>
<span class="hljs-keyword">const</span> fabric = <span class="hljs-keyword">new</span> <span class="hljs-title class_">Fabric</span>();
<span class="hljs-keyword">const</span> bitcoin = <span class="hljs-keyword">new</span> <span class="hljs-title class_">Bitcoin</span>({ <span class="hljs-attr">network</span>: <span class="hljs-string">&#x27;regtest&#x27;</span> });</pre>
</div>
</div>

Expand All @@ -185,14 +199,13 @@ <h1>bitcoin.js</h1>
<div class="sswrap ">
<a class="ss" href="#section-2">&#x00a7;</a>
</div>
<p>let wallet = new Wallet();</p>
<p>Listen for messages from the Bitcoin service</p>

</div>

<div class="content">
<div class='highlight'>
<pre>
bitcoin.<span class="hljs-title function_">on</span>(<span class="hljs-string">&#x27;message&#x27;</span>, <span class="hljs-keyword">function</span> (<span class="hljs-params">msg</span>) {
<pre> bitcoin.<span class="hljs-title function_">on</span>(<span class="hljs-string">&#x27;message&#x27;</span>, <span class="hljs-keyword">function</span> (<span class="hljs-params">msg</span>) {
<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">&#x27;[DEVELOP]&#x27;</span>, <span class="hljs-string">&#x27;Bitcoin emitted message:&#x27;</span>, msg);
});</pre>
</div>
Expand All @@ -207,13 +220,13 @@ <h1>bitcoin.js</h1>
<div class="sswrap ">
<a class="ss" href="#section-3">&#x00a7;</a>
</div>
<p>fabric.use(bitcoin);</p>
<p>Use the Bitcoin service in the Fabric instance</p>

</div>

<div class="content">
<div class='highlight'>
<pre> <span class="hljs-keyword">await</span> bitcoin.<span class="hljs-title function_">start</span>();</pre>
<pre> fabric.<span class="hljs-title function_">use</span>(bitcoin);</pre>
</div>
</div>

Expand All @@ -226,10 +239,16 @@ <h1>bitcoin.js</h1>
<div class="sswrap ">
<a class="ss" href="#section-4">&#x00a7;</a>
</div>
<p>await wallet.start();</p>
<p>Start the Bitcoin service</p>

</div>

<div class="content">
<div class='highlight'>
<pre> <span class="hljs-keyword">await</span> bitcoin.<span class="hljs-title function_">start</span>();</pre>
</div>
</div>

</li>


Expand Down Expand Up @@ -278,9 +297,16 @@ <h1>bitcoin.js</h1>

<div class="content">
<div class='highlight'>
<pre>}

<span class="hljs-variable language_">module</span>.<span class="hljs-property">exports</span> = <span class="hljs-title function_">main</span>();</pre>
<pre>
<span class="hljs-keyword">await</span> bitcoin.<span class="hljs-title function_">stop</span>();
}

<span class="hljs-keyword">if</span> (<span class="hljs-built_in">require</span>.<span class="hljs-property">main</span> === <span class="hljs-variable language_">module</span>) {
<span class="hljs-title function_">main</span>().<span class="hljs-title function_">catch</span>(<span class="hljs-function">(<span class="hljs-params">exception</span>) =&gt;</span> {
<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">error</span>(<span class="hljs-string">&#x27;[EXAMPLES:BITCOIN]&#x27;</span>, <span class="hljs-string">&#x27;Main Process Exception:&#x27;</span>, exception);
process.<span class="hljs-property">exitCode</span> = <span class="hljs-number">1</span>;
});
}</pre>
</div>
</div>

Expand Down
15 changes: 15 additions & 0 deletions assets/examples/blockchain.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@
</a>


<a class="source" href="fabric-basic-usage.html">
examples/fabric-basic-usage.js
</a>


<a class="source" href="fabric-demo.html">
examples/fabric-demo.js
</a>


<a class="source" href="fabric.html">
examples/fabric.js
</a>
Expand Down Expand Up @@ -102,6 +112,11 @@
</a>


<a class="source" href="onion-forward.html">
examples/onion-forward.js
</a>


<a class="source" href="oracle.html">
examples/oracle.js
</a>
Expand Down
25 changes: 20 additions & 5 deletions assets/examples/chain.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@
</a>


<a class="source" href="fabric-basic-usage.html">
examples/fabric-basic-usage.js
</a>


<a class="source" href="fabric-demo.html">
examples/fabric-demo.js
</a>


<a class="source" href="fabric.html">
examples/fabric.js
</a>
Expand Down Expand Up @@ -102,6 +112,11 @@
</a>


<a class="source" href="onion-forward.html">
examples/onion-forward.js
</a>


<a class="source" href="oracle.html">
examples/oracle.js
</a>
Expand Down Expand Up @@ -185,19 +200,19 @@ <h1>chain.js</h1>
<span class="hljs-keyword">const</span> chain = <span class="hljs-keyword">new</span> <span class="hljs-title class_">Chain</span>();

<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">main</span> () {
<span class="hljs-keyword">await</span> chain.<span class="hljs-property">storage</span>.<span class="hljs-title function_">open</span>();
<span class="hljs-keyword">await</span> chain.<span class="hljs-title function_">start</span>();

chain.<span class="hljs-title function_">on</span>(<span class="hljs-string">&#x27;block&#x27;</span>, <span class="hljs-keyword">function</span> (<span class="hljs-params">block</span>) {
<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">&#x27;[CHAIN]&#x27;</span>, <span class="hljs-string">&#x27;new block:&#x27;</span>, block);
<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">&#x27;[CHAIN]&#x27;</span>, <span class="hljs-string">&#x27;chain:&#x27;</span>, chain);
});

chain.<span class="hljs-title function_">append</span>({ <span class="hljs-attr">test</span>: <span class="hljs-string">&#x27;foo&#x27;</span> });
chain.<span class="hljs-title function_">append</span>({ <span class="hljs-attr">test</span>: <span class="hljs-string">&#x27;bar&#x27;</span> });
<span class="hljs-keyword">await</span> chain.<span class="hljs-title function_">append</span>({ <span class="hljs-attr">test</span>: <span class="hljs-string">&#x27;foo&#x27;</span> });
<span class="hljs-keyword">await</span> chain.<span class="hljs-title function_">append</span>({ <span class="hljs-attr">test</span>: <span class="hljs-string">&#x27;bar&#x27;</span> });

<span class="hljs-keyword">await</span> chain.<span class="hljs-property">storage</span>.<span class="hljs-title function_">close</span>();
<span class="hljs-keyword">await</span> chain.<span class="hljs-title function_">stop</span>();

<span class="hljs-keyword">return</span> <span class="hljs-variable language_">this</span>;
<span class="hljs-keyword">return</span> chain;
}

<span class="hljs-title function_">main</span>().<span class="hljs-title function_">catch</span>(<span class="hljs-function">(<span class="hljs-params">exception</span>) =&gt;</span> {
Expand Down
15 changes: 15 additions & 0 deletions assets/examples/cli.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@
</a>


<a class="source" href="fabric-basic-usage.html">
examples/fabric-basic-usage.js
</a>


<a class="source" href="fabric-demo.html">
examples/fabric-demo.js
</a>


<a class="source" href="fabric.html">
examples/fabric.js
</a>
Expand Down Expand Up @@ -102,6 +112,11 @@
</a>


<a class="source" href="onion-forward.html">
examples/onion-forward.js
</a>


<a class="source" href="oracle.html">
examples/oracle.js
</a>
Expand Down
15 changes: 15 additions & 0 deletions assets/examples/collection.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@
</a>


<a class="source" href="fabric-basic-usage.html">
examples/fabric-basic-usage.js
</a>


<a class="source" href="fabric-demo.html">
examples/fabric-demo.js
</a>


<a class="source" href="fabric.html">
examples/fabric.js
</a>
Expand Down Expand Up @@ -102,6 +112,11 @@
</a>


<a class="source" href="onion-forward.html">
examples/onion-forward.js
</a>


<a class="source" href="oracle.html">
examples/oracle.js
</a>
Expand Down
15 changes: 15 additions & 0 deletions assets/examples/environment.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@
</a>


<a class="source" href="fabric-basic-usage.html">
examples/fabric-basic-usage.js
</a>


<a class="source" href="fabric-demo.html">
examples/fabric-demo.js
</a>


<a class="source" href="fabric.html">
examples/fabric.js
</a>
Expand Down Expand Up @@ -102,6 +112,11 @@
</a>


<a class="source" href="onion-forward.html">
examples/onion-forward.js
</a>


<a class="source" href="oracle.html">
examples/oracle.js
</a>
Expand Down
Loading
Loading