Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User command memo, better GraphQL docstring #7079

Merged
merged 3 commits into from
Dec 16, 2020
Merged
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
44 changes: 22 additions & 22 deletions graphql_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@
},
{
"name": "memo",
"description": "Short arbitrary message provided by the sender",
"description": "A short message from the sender, encoded with Base58Check, version byte=0x14; byte 2 of the decoding is the message length",
"args": [],
"type": {
"kind": "SCALAR",
Expand Down Expand Up @@ -786,7 +786,7 @@
},
{
"name": "memo",
"description": "Short arbitrary message provided by the sender",
"description": "A short message from the sender, encoded with Base58Check, version byte=0x14; byte 2 of the decoding is the message length",
"type": {
"kind": "SCALAR",
"name": "String",
Expand Down Expand Up @@ -921,7 +921,7 @@
},
{
"name": "memo",
"description": "Short arbitrary message provided by the sender",
"description": "A short message from the sender, encoded with Base58Check, version byte=0x14; byte 2 of the decoding is the message length",
"args": [],
"type": {
"kind": "SCALAR",
Expand Down Expand Up @@ -1033,7 +1033,7 @@
},
{
"name": "memo",
"description": "Short arbitrary message provided by the sender",
"description": "A short message from the sender, encoded with Base58Check, version byte=0x14; byte 2 of the decoding is the message length",
"type": {
"kind": "SCALAR",
"name": "String",
Expand Down Expand Up @@ -1168,7 +1168,7 @@
},
{
"name": "memo",
"description": "Short arbitrary message provided by the sender",
"description": "A short message from the sender, encoded with Base58Check, version byte=0x14; byte 2 of the decoding is the message length",
"args": [],
"type": {
"kind": "SCALAR",
Expand Down Expand Up @@ -1248,7 +1248,7 @@
},
{
"name": "memo",
"description": "Short arbitrary message provided by the sender",
"description": "A short message from the sender, encoded with Base58Check, version byte=0x14; byte 2 of the decoding is the message length",
"type": {
"kind": "SCALAR",
"name": "String",
Expand Down Expand Up @@ -1355,7 +1355,7 @@
},
{
"name": "memo",
"description": "Short arbitrary message provided by the sender",
"description": "A short message from the sender, encoded with Base58Check, version byte=0x14; byte 2 of the decoding is the message length",
"args": [],
"type": {
"kind": "SCALAR",
Expand Down Expand Up @@ -1439,7 +1439,7 @@
},
{
"name": "memo",
"description": "Short arbitrary message provided by the sender",
"description": "A short message from the sender, encoded with Base58Check, version byte=0x14; byte 2 of the decoding is the message length",
"type": {
"kind": "SCALAR",
"name": "String",
Expand Down Expand Up @@ -1628,7 +1628,7 @@
},
{
"name": "memo",
"description": "Short arbitrary message provided by the sender",
"description": "A short message from the sender, encoded with Base58Check, version byte=0x14; byte 2 of the decoding is the message length",
"args": [],
"type": {
"kind": "SCALAR",
Expand Down Expand Up @@ -1740,7 +1740,7 @@
},
{
"name": "memo",
"description": "Short arbitrary message provided by the sender",
"description": "A short message from the sender, encoded with Base58Check, version byte=0x14; byte 2 of the decoding is the message length",
"type": {
"kind": "SCALAR",
"name": "String",
Expand Down Expand Up @@ -3594,7 +3594,7 @@
},
{
"name": "amount",
"description": "Amount that the source is sending to receiver - this is 0 for commands that are not associated with an amount",
"description": "Amount that the source is sending to receiver; 0 for commands without an associated amount",
"args": [],
"type": {
"kind": "NON_NULL",
Expand Down Expand Up @@ -3642,7 +3642,7 @@
},
{
"name": "memo",
"description": "Short arbitrary message provided by the sender",
"description": "A short message from the sender, encoded with Base58Check, version byte=0x14; byte 2 of the decoding is the message length",
"args": [],
"type": {
"kind": "NON_NULL",
Expand Down Expand Up @@ -3915,7 +3915,7 @@
},
{
"name": "amount",
"description": "Amount that the source is sending to receiver - this is 0 for commands that are not associated with an amount",
"description": "Amount that the source is sending to receiver; 0 for commands without an associated amount",
"args": [],
"type": {
"kind": "NON_NULL",
Expand Down Expand Up @@ -3963,7 +3963,7 @@
},
{
"name": "memo",
"description": "Short arbitrary message provided by the sender",
"description": "A short message from the sender, encoded with Base58Check, version byte=0x14; byte 2 of the decoding is the message length",
"args": [],
"type": {
"kind": "NON_NULL",
Expand Down Expand Up @@ -4236,7 +4236,7 @@
},
{
"name": "amount",
"description": "Amount that the source is sending to receiver - this is 0 for commands that are not associated with an amount",
"description": "Amount that the source is sending to receiver; 0 for commands without an associated amount",
"args": [],
"type": {
"kind": "NON_NULL",
Expand Down Expand Up @@ -4284,7 +4284,7 @@
},
{
"name": "memo",
"description": "Short arbitrary message provided by the sender",
"description": "A short message from the sender, encoded with Base58Check, version byte=0x14; byte 2 of the decoding is the message length",
"args": [],
"type": {
"kind": "NON_NULL",
Expand Down Expand Up @@ -4557,7 +4557,7 @@
},
{
"name": "amount",
"description": "Amount that the source is sending to receiver - this is 0 for commands that are not associated with an amount",
"description": "Amount that the source is sending to receiver; 0 for commands without an associated amount",
"args": [],
"type": {
"kind": "NON_NULL",
Expand Down Expand Up @@ -4605,7 +4605,7 @@
},
{
"name": "memo",
"description": "Short arbitrary message provided by the sender",
"description": "A short message from the sender, encoded with Base58Check, version byte=0x14; byte 2 of the decoding is the message length",
"args": [],
"type": {
"kind": "NON_NULL",
Expand Down Expand Up @@ -4882,7 +4882,7 @@
},
{
"name": "amount",
"description": "Amount that the source is sending to receiver - this is 0 for commands that are not associated with an amount",
"description": "Amount that the source is sending to receiver; 0 for commands without an associated amount",
"args": [],
"type": {
"kind": "NON_NULL",
Expand Down Expand Up @@ -4930,7 +4930,7 @@
},
{
"name": "memo",
"description": "Short arbitrary message provided by the sender",
"description": "A short message from the sender, encoded with Base58Check, version byte=0x14; byte 2 of the decoding is the message length",
"args": [],
"type": {
"kind": "NON_NULL",
Expand Down Expand Up @@ -5171,7 +5171,7 @@
},
{
"name": "amount",
"description": "Amount that the source is sending to receiver - 0 for commands that are not associated with an amount",
"description": "Amount that the source is sending to receiver; 0 for commands without an associated amount",
"args": [],
"type": {
"kind": "NON_NULL",
Expand Down Expand Up @@ -5219,7 +5219,7 @@
},
{
"name": "memo",
"description": "Short arbitrary message provided by the sender",
"description": "A short message from the sender, encoded with Base58Check, version byte=0x14; byte 2 of the decoding is the message length",
"args": [],
"type": {
"kind": "NON_NULL",
Expand Down
16 changes: 9 additions & 7 deletions src/lib/coda_graphql/coda_graphql.ml
Original file line number Diff line number Diff line change
Expand Up @@ -969,9 +969,8 @@ module Types = struct
Signed_command.token cmd.With_hash.data )
; field "amount" ~typ:(non_null uint64) ~args:[]
~doc:
"Amount that the source is sending to receiver - this is 0 for \
commands that are not associated with an amount"
~resolve:(fun _ cmd ->
"Amount that the source is sending to receiver; 0 for commands \
without an associated amount" ~resolve:(fun _ cmd ->
match Signed_command.amount cmd.With_hash.data with
| Some amount ->
Currency.Amount.to_uint64 amount
Expand All @@ -986,15 +985,18 @@ module Types = struct
transaction" ~resolve:(fun _ cmd ->
Signed_command.fee cmd.With_hash.data |> Currency.Fee.to_uint64 )
; field "memo" ~typ:(non_null string) ~args:[]
~doc:"Short arbitrary message provided by the sender"
~doc:
(sprintf
"A short message from the sender, encoded with Base58Check, \
version byte=0x%02X; byte 2 of the decoding is the message \
length"
(Char.to_int Base58_check.Version_bytes.user_command_memo))
~resolve:(fun _ payment ->
Signed_command_payload.memo
@@ Signed_command.payload payment.With_hash.data
|> Signed_command_memo.to_string )
; field "isDelegation" ~typ:(non_null bool) ~args:[]
~doc:
"If true, this represents a delegation of stake, otherwise it is \
a payment"
~doc:"If true, this command represents a delegation of stake"
~deprecated:(Deprecated (Some "use kind field instead"))
~resolve:(fun _ user_command ->
match
Expand Down