Guides

Validating Metadata

6min

How and Why

Validating metadata is a critical step in defining your mini-app effectively. To assist with this process, we have developed various functions that enable you to validate either specific parts or the entirety of the metadata in a modular manner. To ensure clarity and provide actionable feedback, we have categorized the possible validation errors into distinct types. These error types can be integrated into your code as needed to deliver detailed and meaningful insights during the validation process.

Handling Errors

Error Classes are available for instanceof operations that you can use during your validation and/or testing process. As a developer, you have complete freedom to define the metadata as you see fit; however, this metadata will be validated before each rendering-publishing. To ensure the proper functioning of the mini-app you have defined, we have made these classes available, allowing you to get the highest level of detail in case any errors occur during the metadata definition or validation process.

Example

TypeScript
metadata.ts
example-abi.ts


FunctionNotFoundError

FunctionNotFoundError is thrown when

TypeScript


NoActionDefinedError

NoActionDefinedError is thrown when there is no declaration of a Blockchain Action in the metadata.

TypeScript


InvalidAddress

InvalidAddress is thrown when the address of the contract to be executed in the Blockchain Action is invalid.

TypeScript


ActionsNumberError

ActionsNumberErros is thrown when the number of Blockchain Actions to be executed is greater than four (4).

TypeScript