Compare commits
78 Commits
48bcccdf23
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 75bc52ede3 | |||
| 29619f08b7 | |||
| af46223163 | |||
| 9cafdd2b0f | |||
| 6d429aa6a4 | |||
| fcf85077b2 | |||
| 3585dbe534 | |||
| 9a7a2a98c4 | |||
| 4530fd2e93 | |||
| 2a7079129f | |||
| 88aeb39d4a | |||
| 9fc89c0c22 | |||
| 23c13f607e | |||
| 8bc79d3b3f | |||
| 3fae9a2edd | |||
| a3b19747b6 | |||
| f8e9333b4b | |||
| eaccd50764 | |||
| 9fd8dbd1a6 | |||
| f0f86ed36d | |||
| ed252b4c06 | |||
| 5dcc05d56a | |||
| 2eca3a5338 | |||
| e595991616 | |||
| da92d80334 | |||
| f821d57c1c | |||
| e87be689a8 | |||
| 2a7de4fee1 | |||
| 82d08da8ca | |||
| 85d0c6fd04 | |||
| d8221e0b25 | |||
| b950bb8a67 | |||
| a4914c1ad1 | |||
| 9e6d9ec02e | |||
| 4b9fa65672 | |||
| 74aaad297a | |||
| c9ead44aa2 | |||
| c54c0db17a | |||
| cd4f6a56a5 | |||
| fd2158a465 | |||
| 7fc3cd00da | |||
| 02945dd10d | |||
| 695e7e4828 | |||
| 9f02f73dbd | |||
| fd8766a249 | |||
| 540b2c513b | |||
| bda4e89e58 | |||
| f277e79096 | |||
| ddec3bfa74 | |||
| a0fbeebcdb | |||
| 78c9c67f38 | |||
| 9bc0ffafd1 | |||
| a1fc5f19fa | |||
| efe0a64056 | |||
| 60985130cb | |||
| 6c172c4783 | |||
| 3838a7e3c5 | |||
| d014ae0982 | |||
| bb4bcbb7de | |||
| a695c21fc9 | |||
| 493bdb990c | |||
| 17f635af61 | |||
| 272ed01fdc | |||
| 49cd8b6687 | |||
| 966b4b2748 | |||
| fe182a5233 | |||
| f1696e2b9e | |||
| 2bf384ca82 | |||
| 4f2a3c6c6f | |||
| 7df04a81be | |||
| 6f02d4c4e6 | |||
| 56e63051bc | |||
| 3f1c9bd626 | |||
| 97e32574c4 | |||
| 6f5525afcf | |||
| 4f1958b210 | |||
| 3da9bd570b | |||
| d2163c1ff8 |
@@ -8,6 +8,8 @@ cancer
|
||||
erl_crash.dump
|
||||
ebin/*.beam
|
||||
doc/*.html
|
||||
doc/erlang.png
|
||||
doc/stylesheet.css
|
||||
doc/edoc-info
|
||||
rel/example_project
|
||||
.concrete/DEV_MODE
|
||||
|
||||
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
+4
-3
@@ -1,5 +1,6 @@
|
||||
@author Craig Everett <craigeverett@qpq.swiss> [https://git.qpq.swiss/QPQ-AG/hakuzaru]
|
||||
@version 0.8.0
|
||||
@author Craig Everett <craigeverett@qpq.swiss> [https://zxq9.com]
|
||||
@author Jarvis Carrol <jarviscarrol@qpq.swiss> [https://jarviscarroll.net/]
|
||||
@version 0.9.2
|
||||
@title Hakuzaru: Gajumaru blockchain bindings for Erlang
|
||||
|
||||
@doc
|
||||
@@ -21,7 +22,7 @@ After startup `hz_man' must be given the address and port of a list of Gajumaru
|
||||
Note that the service nodes will need to have the dry-run endpoint enabled and the internal service query port made available in order to provide dry-runs and transaction submission.
|
||||
|
||||
When configuring chain nodes a list of nodes should be provided.
|
||||
To avoid sync issues in the case of fast transaction formation/submission to the chain, only one node from the list of chain nodes is used for submitting transactions and querying `next_nonce/1`.
|
||||
To avoid sync issues in the case of fast transaction formation/submission to the chain, only one node from the list of chain nodes is used for submitting transactions and querying `next_nonce/1'.
|
||||
This node is called "the sticky node".
|
||||
|
||||
The first node in the list of chain nodes provided during configuration is designated as the sticky node.
|
||||
|
||||
+3
-3
@@ -3,7 +3,7 @@
|
||||
{included_applications,[]},
|
||||
{applications,[stdlib,kernel]},
|
||||
{description,"Gajumaru interoperation library"},
|
||||
{vsn,"0.8.3"},
|
||||
{modules,[hakuzaru,hz,hz_fetcher,hz_format,hz_grids,
|
||||
hz_key_master,hz_man,hz_sup]},
|
||||
{vsn,"0.9.2"},
|
||||
{modules,[hakuzaru,hz,hz_aaci,hz_fetcher,hz_format,hz_grids,
|
||||
hz_key_master,hz_man,hz_sophia,hz_sup]},
|
||||
{mod,{hakuzaru,[]}}]}.
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(hakuzaru).
|
||||
-vsn("0.8.3").
|
||||
-vsn("0.9.2").
|
||||
-author("Craig Everett <ceverett@tsuriai.jp>").
|
||||
-copyright("Craig Everett <ceverett@tsuriai.jp>").
|
||||
-license("GPL-3.0-or-later").
|
||||
|
||||
+293
-1184
File diff suppressed because it is too large
Load Diff
+1673
File diff suppressed because it is too large
Load Diff
+9
-1
@@ -1,5 +1,13 @@
|
||||
%%% @private
|
||||
%%% Hakuzaru Request Fetcher
|
||||
%%%
|
||||
%%% This module defines the request workers.
|
||||
%%% Each request to a remote chain node is handled by a worker that is spawned
|
||||
%%% to handle it and terminates on completion.
|
||||
%%% @end
|
||||
|
||||
-module(hz_fetcher).
|
||||
-vsn("0.8.3").
|
||||
-vsn("0.9.2").
|
||||
-author("Craig Everett <ceverett@tsuriai.jp>").
|
||||
-copyright("Craig Everett <ceverett@tsuriai.jp>").
|
||||
-license("MIT").
|
||||
|
||||
+18
-1
@@ -21,7 +21,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(hz_format).
|
||||
-vsn("0.8.3").
|
||||
-vsn("0.9.2").
|
||||
-author("Craig Everett <ceverett@tsuriai.jp>").
|
||||
-copyright("Craig Everett <ceverett@tsuriai.jp>").
|
||||
-license("GPL-3.0-or-later").
|
||||
@@ -462,9 +462,26 @@ ranks(heresy) ->
|
||||
["k ", "m ", "b ", "t ", "q ", "e ", "z ", "y ", "r ", "Q "].
|
||||
|
||||
|
||||
-spec mark(Unit) -> Mark
|
||||
when Unit :: gaju | puck,
|
||||
Mark :: $木 | $本.
|
||||
%% @doc
|
||||
%% Retrieve the unicode codepoint for the `gaju' mark (木) or the `puck' mark (本).
|
||||
|
||||
mark(gaju) -> $木;
|
||||
mark(puck) -> $本.
|
||||
|
||||
|
||||
-spec one(Unit) -> Pucks
|
||||
when Unit :: gaju | puck,
|
||||
Pucks :: 1_000_000_000_000_000_000 | 1.
|
||||
%% @doc
|
||||
%% Quickly resolve the number of pucks in a given unit.
|
||||
%%
|
||||
%% The number of pucks in a gaju is so large that it can be a little bit annoying
|
||||
%% to remember the exact amount. This is a helper to simplify this when writing
|
||||
%% an app against the hakuzaru library when dealing in either unit.
|
||||
|
||||
one(gaju) -> 1_000_000_000_000_000_000;
|
||||
one(puck) -> 1.
|
||||
|
||||
|
||||
+34
-2
@@ -37,7 +37,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(hz_grids).
|
||||
-vsn("0.8.3").
|
||||
-vsn("0.9.2").
|
||||
-export([url/2, url/3, url/4, parse/1, req/2, req/3, req/4]).
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
Result :: {ok, GRIDS} | uri_string:uri_error(),
|
||||
GRIDS :: uri_string:uri_string().
|
||||
%% @doc
|
||||
%% Takes
|
||||
%% Takes an instruction and an HTTP endpoint location and forms a GRIDS URL.
|
||||
|
||||
url(Instruction, HTTP) ->
|
||||
case uri_string:parse(HTTP) of
|
||||
@@ -134,6 +134,8 @@ qwargs(Amount, Payload) ->
|
||||
Amount :: non_neg_integer(),
|
||||
Payload :: binary(),
|
||||
URL :: string().
|
||||
%% @doc
|
||||
%% Translate a GRIDS URL into an Erlang terms instruction.
|
||||
|
||||
parse(GRIDS) ->
|
||||
case uri_string:parse(GRIDS) of
|
||||
@@ -190,13 +192,43 @@ l_to_i(S) ->
|
||||
end.
|
||||
|
||||
|
||||
-spec req(Type, Message) -> Format
|
||||
when Type :: sign | tx | ack,
|
||||
Message :: string() | binary(),
|
||||
Format :: map().
|
||||
%% @doc
|
||||
%% @equiv req(Type, Message, false)
|
||||
|
||||
req(Type, Message) ->
|
||||
req(Type, Message, false).
|
||||
|
||||
|
||||
-spec req(Type, Message, ID) -> Format
|
||||
when Type :: sign | tx | ack,
|
||||
Message :: string() | binary(),
|
||||
ID :: false | string() | binary(),
|
||||
Format :: map().
|
||||
%% @doc
|
||||
%% Creates a GRIDS message format with the current `NetworkID'.
|
||||
%%
|
||||
%% The `ID' parameter indicates which key the requestee should sign with or
|
||||
%% is `false' to indicate that which key to sign with is up to the requestee.
|
||||
%% @equiv req(Type, Message, ID, CurrentNetworkID)
|
||||
|
||||
req(Type, Message, ID) ->
|
||||
{ok, NetworkID} = hz:network_id(),
|
||||
req(Type, Message, ID, NetworkID).
|
||||
|
||||
|
||||
-spec req(Type, Message, ID, NetworkID) -> Format
|
||||
when Type :: sign | tx | ack,
|
||||
Message :: string() | binary(),
|
||||
ID :: false | string() | binary(),
|
||||
NetworkID :: string() | binary(),
|
||||
Format :: map().
|
||||
%% @doc
|
||||
%% Creates a GRIDS message format.
|
||||
|
||||
req(sign, Message, ID, NetworkID) ->
|
||||
#{"grids" => 1,
|
||||
"chain" => "gajumaru",
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(hz_key_master).
|
||||
-vsn("0.8.3").
|
||||
|
||||
-vsn("0.9.2").
|
||||
|
||||
-export([make_key/1, encode/1, decode/1]).
|
||||
-export([lcg/1]).
|
||||
|
||||
+1
-2
@@ -9,7 +9,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(hz_man).
|
||||
-vsn("0.8.3").
|
||||
-vsn("0.9.2").
|
||||
-behavior(gen_server).
|
||||
-author("Craig Everett <ceverett@tsuriai.jp>").
|
||||
-copyright("Craig Everett <ceverett@tsuriai.jp>").
|
||||
@@ -172,7 +172,6 @@ start_link() ->
|
||||
%% preparatory work necessary for proper function.
|
||||
|
||||
init(none) ->
|
||||
ok = io:format("hz_man starting.~n"),
|
||||
State = #s{},
|
||||
{ok, State}.
|
||||
|
||||
|
||||
+1521
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -9,7 +9,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(hz_sup).
|
||||
-vsn("0.8.3").
|
||||
-vsn("0.9.2").
|
||||
-behaviour(supervisor).
|
||||
-author("Craig Everett <zxq9@zxq9.com>").
|
||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
{type,app}.
|
||||
{modules,[]}.
|
||||
{prefix,"hz"}.
|
||||
{desc,"Gajumaru interoperation library"}.
|
||||
{author,"Craig Everett"}.
|
||||
{package_id,{"otpr","hakuzaru",{0,8,3}}}.
|
||||
{desc,"Gajumaru interoperation library"}.
|
||||
{package_id,{"otpr","hakuzaru",{0,9,2}}}.
|
||||
{deps,[{"otpr","sophia",{9,0,0}},
|
||||
{"otpr","gmserialization",{0,1,3}},
|
||||
{"otpr","gmbytecode",{3,4,1}},
|
||||
|
||||
Reference in New Issue
Block a user