Nyzo techRelease notesNyzo 609: prefilled-data amount option

Nyzo 609: prefilled-data amount option

Nyzo version 609 (commit on GitHub) adds an amount option to Nyzo prefilled-data strings.

This version affects the client.

Nyzo prefilled-data strings were originally created to allow recipients to bundle a data field with their receiver identifier. This is especially useful for exchanges, which can use the data field to identify an account within the exchange. It would also be useful for many purchase scenarios, allowing bundling of an invoice identifier or other reference number.

A community member suggested in a GitHub issue that adding an amount option to prefilled-data strings would be useful. This version implements that suggestion.

In CommandEndpointApi, the command is now wrapped in a try/catch. This allows the endpoint to produce a result even if the command fails with an exception.

In future versions, CommandEndpointApi should perform proper validation of arguments and return the validation results in the response.

RN_609 image 0

In PrefilledDataCreateCommand, an optional field for amount was added.

RN_609 image 1

When sender data is validated in PrefilledDataCreateCommand.validate() the truncation warning is now attached to the validation result instead of being written to the output.

The amount is now validated, producing a warning if an unparseable value is provided.

RN_609 image 2

In the PrefilledDataCreateCommand.run() method, the amount is now processed, included in the prefilled-data string, and written to the output table.

RN_609 image 3

In PrefilledDataSendCommand, the amount is now indicated as optional if an amount is included in the prefilled-data string.

RN_609 image 4

In PrefilledDataSendCommand.validate() the amount is now fetched from the prefilled-data string. For backwards compatibility, strings without an amount specified behave as having an amount of 0.

RN_609 image 5

When processing the amount in PrefilledDataSendCommand.validate(), the amount from the prefilled-data string is used as a fallback if a valid amount is not specified as an argument to the command.

RN_609 image 6

In PrefilledDataSendCommand.run(), the same behavior applies. If the amount is not specified in a command argument, or if the amount specified is invalid, then the amount from the prefilled-data string is used.

RN_609 image 7

In NyzoStringPrefilledData, a field for amount was added.

RN_609 image 8

In the byte encoding of the prefilled-data string, the most significant bit of the sender-data length field is now used to encode the presence or absence of an amount. This makes all existing prefilled-data strings compatible with the new code.

RN_609 image 9

When decoding a prefilled-data string from bytes, the amount is now considered also. The comments explain in more detail how the bits of the sender-data length field are used.

The NyzoStringPrefilledData.toString() method was added to improve debuggability.

RN_609 image 10

In NyzoStringTest.testPrefilledDataStrings(), amounts are now populated and tested.

RN_609 image 11