Compare commits
4 Commits
grids3
..
6f5525afcf
| Author | SHA1 | Date | |
|---|---|---|---|
| 6f5525afcf | |||
| 4f1958b210 | |||
| 3da9bd570b | |||
| d2163c1ff8 |
+7
-1098
File diff suppressed because it is too large
Load Diff
+1184
File diff suppressed because it is too large
Load Diff
+2
-36
@@ -190,48 +190,16 @@ l_to_i(S) ->
|
||||
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, false).
|
||||
|
||||
req({sign, message}, Message, ID) ->
|
||||
req(sign, Message, ID) ->
|
||||
#{"grids" => 1,
|
||||
"chain" => "gajumaru",
|
||||
"network_id" => hz:network_id(),
|
||||
"type" => "message",
|
||||
"public_id" => ID,
|
||||
"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) ->
|
||||
#{"grids" => 1,
|
||||
"chain" => "gajumaru",
|
||||
@@ -245,6 +213,4 @@ req(ack, Message, ID) ->
|
||||
"network_id" => hz:network_id(),
|
||||
"type" => "ack",
|
||||
"public_id" => ID,
|
||||
"payload" => Message};
|
||||
req(sign, Message, ID) ->
|
||||
req({sign, message}, Message, ID).
|
||||
"payload" => Message}.
|
||||
|
||||
Reference in New Issue
Block a user