Compare commits
78 Commits
grids3
...
6d429aa6a4
| Author | SHA1 | Date | |
|---|---|---|---|
| 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 | |||
| 48bcccdf23 | |||
| 03b9756066 | |||
| 56e63051bc | |||
| 3f1c9bd626 | |||
| 97e32574c4 | |||
| 6f5525afcf | |||
| 4f1958b210 | |||
| 3da9bd570b | |||
| d65a048409 | |||
| 9280495b18 | |||
| d2163c1ff8 |
+2
-2
@@ -8,9 +8,9 @@ cancer
|
|||||||
erl_crash.dump
|
erl_crash.dump
|
||||||
ebin/*.beam
|
ebin/*.beam
|
||||||
doc/*.html
|
doc/*.html
|
||||||
doc/*.css
|
|
||||||
doc/edoc-info
|
|
||||||
doc/erlang.png
|
doc/erlang.png
|
||||||
|
doc/stylesheet.css
|
||||||
|
doc/edoc-info
|
||||||
rel/example_project
|
rel/example_project
|
||||||
.concrete/DEV_MODE
|
.concrete/DEV_MODE
|
||||||
.rebar
|
.rebar
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
@@ -0,0 +1,75 @@
|
|||||||
|
/* standard EDoc style sheet */
|
||||||
|
body {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
margin-left: .25in;
|
||||||
|
margin-right: .2in;
|
||||||
|
margin-top: 0.2in;
|
||||||
|
margin-bottom: 0.2in;
|
||||||
|
color: #696969;
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
a:link{
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
a:visited{
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
a:hover{
|
||||||
|
color: #d8613c;
|
||||||
|
}
|
||||||
|
h1,h2 {
|
||||||
|
margin-left: -0.2in;
|
||||||
|
}
|
||||||
|
div.navbar {
|
||||||
|
background-color: #000000;
|
||||||
|
padding: 0.2em;
|
||||||
|
}
|
||||||
|
h2.indextitle {
|
||||||
|
padding: 0.4em;
|
||||||
|
color: #dfdfdf;
|
||||||
|
background-color: #000000;
|
||||||
|
}
|
||||||
|
div.navbar a:link {
|
||||||
|
color: #dfdfdf;
|
||||||
|
}
|
||||||
|
div.navbar a:visited {
|
||||||
|
color: #dfdfdf;
|
||||||
|
}
|
||||||
|
div.navbar a:hover {
|
||||||
|
color: #d8613c;
|
||||||
|
}
|
||||||
|
h3.function,h3.typedecl {
|
||||||
|
background-color: #000000;
|
||||||
|
color: #dfdfdf;
|
||||||
|
padding-left: 1em;
|
||||||
|
}
|
||||||
|
div.spec {
|
||||||
|
margin-left: 2em;
|
||||||
|
background-color: #eeeeee;
|
||||||
|
}
|
||||||
|
a.module {
|
||||||
|
text-decoration:none
|
||||||
|
}
|
||||||
|
a.module:hover {
|
||||||
|
background-color: #eeeeee;
|
||||||
|
}
|
||||||
|
ul.definitions {
|
||||||
|
list-style-type: none;
|
||||||
|
}
|
||||||
|
ul.index {
|
||||||
|
list-style-type: none;
|
||||||
|
background-color: #eeeeee;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Minor style tweaks
|
||||||
|
*/
|
||||||
|
ul {
|
||||||
|
list-style-type: square;
|
||||||
|
}
|
||||||
|
table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
td {
|
||||||
|
padding: 3
|
||||||
|
}
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
@author Craig Everett <craigeverett@qpq.swiss> [https://git.qpq.swiss/QPQ-AG/hakuzaru]
|
@author Craig Everett <craigeverett@qpq.swiss> [https://git.qpq.swiss/QPQ-AG/hakuzaru]
|
||||||
@version 0.8.0
|
@version 0.9.2
|
||||||
@title Hakuzaru: Gajumaru blockchain bindings for Erlang
|
@title Hakuzaru: Gajumaru blockchain bindings for Erlang
|
||||||
|
|
||||||
@doc
|
@doc
|
||||||
|
|||||||
+3
-3
@@ -3,7 +3,7 @@
|
|||||||
{included_applications,[]},
|
{included_applications,[]},
|
||||||
{applications,[stdlib,kernel]},
|
{applications,[stdlib,kernel]},
|
||||||
{description,"Gajumaru interoperation library"},
|
{description,"Gajumaru interoperation library"},
|
||||||
{vsn,"0.8.2"},
|
{vsn,"0.9.2"},
|
||||||
{modules,[hakuzaru,hz,hz_fetcher,hz_format,hz_grids,
|
{modules,[hakuzaru,hz,hz_aaci,hz_fetcher,hz_format,hz_grids,
|
||||||
hz_key_master,hz_man,hz_sup]},
|
hz_key_master,hz_man,hz_sophia,hz_sup]},
|
||||||
{mod,{hakuzaru,[]}}]}.
|
{mod,{hakuzaru,[]}}]}.
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(hakuzaru).
|
-module(hakuzaru).
|
||||||
-vsn("0.8.2").
|
-vsn("0.9.2").
|
||||||
-author("Craig Everett <ceverett@tsuriai.jp>").
|
-author("Craig Everett <ceverett@tsuriai.jp>").
|
||||||
-copyright("Craig Everett <ceverett@tsuriai.jp>").
|
-copyright("Craig Everett <ceverett@tsuriai.jp>").
|
||||||
-license("GPL-3.0-or-later").
|
-license("GPL-3.0-or-later").
|
||||||
|
|||||||
+291
-1183
File diff suppressed because it is too large
Load Diff
+1657
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).
|
-module(hz_fetcher).
|
||||||
-vsn("0.8.2").
|
-vsn("0.9.2").
|
||||||
-author("Craig Everett <ceverett@tsuriai.jp>").
|
-author("Craig Everett <ceverett@tsuriai.jp>").
|
||||||
-copyright("Craig Everett <ceverett@tsuriai.jp>").
|
-copyright("Craig Everett <ceverett@tsuriai.jp>").
|
||||||
-license("MIT").
|
-license("MIT").
|
||||||
|
|||||||
+18
-1
@@ -21,7 +21,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(hz_format).
|
-module(hz_format).
|
||||||
-vsn("0.8.2").
|
-vsn("0.9.2").
|
||||||
-author("Craig Everett <ceverett@tsuriai.jp>").
|
-author("Craig Everett <ceverett@tsuriai.jp>").
|
||||||
-copyright("Craig Everett <ceverett@tsuriai.jp>").
|
-copyright("Craig Everett <ceverett@tsuriai.jp>").
|
||||||
-license("GPL-3.0-or-later").
|
-license("GPL-3.0-or-later").
|
||||||
@@ -462,9 +462,26 @@ ranks(heresy) ->
|
|||||||
["k ", "m ", "b ", "t ", "q ", "e ", "z ", "y ", "r ", "Q "].
|
["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(gaju) -> $木;
|
||||||
mark(puck) -> $本.
|
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(gaju) -> 1_000_000_000_000_000_000;
|
||||||
one(puck) -> 1.
|
one(puck) -> 1.
|
||||||
|
|
||||||
|
|||||||
+45
-9
@@ -37,8 +37,8 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(hz_grids).
|
-module(hz_grids).
|
||||||
-vsn("0.8.2").
|
-vsn("0.9.2").
|
||||||
-export([url/2, url/3, url/4, parse/1, req/2, req/3]).
|
-export([url/2, url/3, url/4, parse/1, req/2, req/3, req/4]).
|
||||||
|
|
||||||
|
|
||||||
-spec url(Instruction, HTTP) -> Result
|
-spec url(Instruction, HTTP) -> Result
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
Result :: {ok, GRIDS} | uri_string:uri_error(),
|
Result :: {ok, GRIDS} | uri_string:uri_error(),
|
||||||
GRIDS :: uri_string:uri_string().
|
GRIDS :: uri_string:uri_string().
|
||||||
%% @doc
|
%% @doc
|
||||||
%% Takes
|
%% Takes an instruction and an HTTP endpoint location and forms a GRIDS URL.
|
||||||
|
|
||||||
url(Instruction, HTTP) ->
|
url(Instruction, HTTP) ->
|
||||||
case uri_string:parse(HTTP) of
|
case uri_string:parse(HTTP) of
|
||||||
@@ -134,6 +134,8 @@ qwargs(Amount, Payload) ->
|
|||||||
Amount :: non_neg_integer(),
|
Amount :: non_neg_integer(),
|
||||||
Payload :: binary(),
|
Payload :: binary(),
|
||||||
URL :: string().
|
URL :: string().
|
||||||
|
%% @doc
|
||||||
|
%% Translate a GRIDS URL into an Erlang terms instruction.
|
||||||
|
|
||||||
parse(GRIDS) ->
|
parse(GRIDS) ->
|
||||||
case uri_string:parse(GRIDS) of
|
case uri_string:parse(GRIDS) of
|
||||||
@@ -190,27 +192,61 @@ l_to_i(S) ->
|
|||||||
end.
|
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) ->
|
||||||
req(Type, Message, false).
|
req(Type, Message, false).
|
||||||
|
|
||||||
req(sign, Message, ID) ->
|
|
||||||
|
-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,
|
#{"grids" => 1,
|
||||||
"chain" => "gajumaru",
|
"chain" => "gajumaru",
|
||||||
"network_id" => hz:network_id(),
|
"network_id" => NetworkID,
|
||||||
"type" => "message",
|
"type" => "message",
|
||||||
"public_id" => ID,
|
"public_id" => ID,
|
||||||
"payload" => Message};
|
"payload" => Message};
|
||||||
req(tx, Data, ID) ->
|
req(tx, Data, ID, NetworkID) ->
|
||||||
#{"grids" => 1,
|
#{"grids" => 1,
|
||||||
"chain" => "gajumaru",
|
"chain" => "gajumaru",
|
||||||
"network_id" => hz:network_id(),
|
"network_id" => NetworkID,
|
||||||
"type" => "tx",
|
"type" => "tx",
|
||||||
"public_id" => ID,
|
"public_id" => ID,
|
||||||
"payload" => Data};
|
"payload" => Data};
|
||||||
req(ack, Message, ID) ->
|
req(ack, Message, ID, NetworkID) ->
|
||||||
#{"grids" => 1,
|
#{"grids" => 1,
|
||||||
"chain" => "gajumaru",
|
"chain" => "gajumaru",
|
||||||
"network_id" => hz:network_id(),
|
"network_id" => NetworkID,
|
||||||
"type" => "ack",
|
"type" => "ack",
|
||||||
"public_id" => ID,
|
"public_id" => ID,
|
||||||
"payload" => Message}.
|
"payload" => Message}.
|
||||||
|
|||||||
@@ -8,8 +8,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(hz_key_master).
|
-module(hz_key_master).
|
||||||
-vsn("0.8.2").
|
-vsn("0.9.2").
|
||||||
|
|
||||||
|
|
||||||
-export([make_key/1, encode/1, decode/1]).
|
-export([make_key/1, encode/1, decode/1]).
|
||||||
-export([lcg/1]).
|
-export([lcg/1]).
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(hz_man).
|
-module(hz_man).
|
||||||
-vsn("0.8.2").
|
-vsn("0.9.2").
|
||||||
-behavior(gen_server).
|
-behavior(gen_server).
|
||||||
-author("Craig Everett <ceverett@tsuriai.jp>").
|
-author("Craig Everett <ceverett@tsuriai.jp>").
|
||||||
-copyright("Craig Everett <ceverett@tsuriai.jp>").
|
-copyright("Craig Everett <ceverett@tsuriai.jp>").
|
||||||
|
|||||||
+1518
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -9,7 +9,7 @@
|
|||||||
%%% @end
|
%%% @end
|
||||||
|
|
||||||
-module(hz_sup).
|
-module(hz_sup).
|
||||||
-vsn("0.8.2").
|
-vsn("0.9.2").
|
||||||
-behaviour(supervisor).
|
-behaviour(supervisor).
|
||||||
-author("Craig Everett <zxq9@zxq9.com>").
|
-author("Craig Everett <zxq9@zxq9.com>").
|
||||||
-copyright("Craig Everett <zxq9@zxq9.com>").
|
-copyright("Craig Everett <zxq9@zxq9.com>").
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
{type,app}.
|
{type,app}.
|
||||||
{modules,[]}.
|
{modules,[]}.
|
||||||
{prefix,"hz"}.
|
{prefix,"hz"}.
|
||||||
{desc,"Gajumaru interoperation library"}.
|
|
||||||
{author,"Craig Everett"}.
|
{author,"Craig Everett"}.
|
||||||
{package_id,{"otpr","hakuzaru",{0,8,2}}}.
|
{desc,"Gajumaru interoperation library"}.
|
||||||
|
{package_id,{"otpr","hakuzaru",{0,9,2}}}.
|
||||||
{deps,[{"otpr","sophia",{9,0,0}},
|
{deps,[{"otpr","sophia",{9,0,0}},
|
||||||
{"otpr","gmserialization",{0,1,3}},
|
{"otpr","gmserialization",{0,1,3}},
|
||||||
{"otpr","gmbytecode",{3,4,1}},
|
{"otpr","gmbytecode",{3,4,1}},
|
||||||
|
|||||||
Reference in New Issue
Block a user