Compare commits
1 Commits
a1fc5f19fa
..
grids3
| Author | SHA1 | Date | |
|---|---|---|---|
| feae15740a |
+1110
-79
File diff suppressed because it is too large
Load Diff
-1185
File diff suppressed because it is too large
Load Diff
+36
-2
@@ -190,16 +190,48 @@ l_to_i(S) ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
-spec req(Type, Message) -> RequestMap
|
||||||
|
when Type :: {sign, message | binary | bitcoin}
|
||||||
|
| tx
|
||||||
|
| ack
|
||||||
|
| sign,
|
||||||
|
Message :: binary(),
|
||||||
|
RequestMap :: map().
|
||||||
|
%% @doc
|
||||||
|
%% GRIDS maps always contain the following keys:
|
||||||
|
%% ```
|
||||||
|
%% #{"grids" => 1,
|
||||||
|
%% "chain" => "gajumaru",
|
||||||
|
%% "network_id" => "groot.mainnet.gajumaru.io",
|
||||||
|
%% "type" => "message" | "binary" | "binary" | "tx" | "ack"
|
||||||
|
%% "public_id" => term(),
|
||||||
|
%% "payload" => string()};
|
||||||
|
%% '''
|
||||||
|
|
||||||
req(Type, Message) ->
|
req(Type, Message) ->
|
||||||
req(Type, Message, false).
|
req(Type, Message, false).
|
||||||
|
|
||||||
req(sign, Message, ID) ->
|
req({sign, message}, Message, ID) ->
|
||||||
#{"grids" => 1,
|
#{"grids" => 1,
|
||||||
"chain" => "gajumaru",
|
"chain" => "gajumaru",
|
||||||
"network_id" => hz:network_id(),
|
"network_id" => hz:network_id(),
|
||||||
"type" => "message",
|
"type" => "message",
|
||||||
"public_id" => ID,
|
"public_id" => ID,
|
||||||
"payload" => Message};
|
"payload" => Message};
|
||||||
|
req({sign, binary}, Binary, ID) ->
|
||||||
|
#{"grids" => 1,
|
||||||
|
"chain" => "gajumaru",
|
||||||
|
"network_id" => hz:network_id(),
|
||||||
|
"type" => "binary",
|
||||||
|
"public_id" => ID,
|
||||||
|
"payload" => base64:encode(Binary)};
|
||||||
|
req({sign, bitcoin}, Binary, ID) ->
|
||||||
|
#{"grids" => 1,
|
||||||
|
"chain" => "gajumaru",
|
||||||
|
"network_id" => hz:network_id(),
|
||||||
|
"type" => "bitcoin",
|
||||||
|
"public_id" => ID,
|
||||||
|
"payload" => base64:encode(Binary)};
|
||||||
req(tx, Data, ID) ->
|
req(tx, Data, ID) ->
|
||||||
#{"grids" => 1,
|
#{"grids" => 1,
|
||||||
"chain" => "gajumaru",
|
"chain" => "gajumaru",
|
||||||
@@ -213,4 +245,6 @@ req(ack, Message, ID) ->
|
|||||||
"network_id" => hz:network_id(),
|
"network_id" => hz:network_id(),
|
||||||
"type" => "ack",
|
"type" => "ack",
|
||||||
"public_id" => ID,
|
"public_id" => ID,
|
||||||
"payload" => Message}.
|
"payload" => Message};
|
||||||
|
req(sign, Message, ID) ->
|
||||||
|
req({sign, message}, Message, ID).
|
||||||
|
|||||||
-1075
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user