Codes
Attach JSON Schema
Guide for Attaching a JSON Schema to Smart Contract Code
Overview
Attaching a JSON Schema to your smart contract code is a crucial step that enhances clarity for developers interacting with the blockchain. It can be done at various stages of contract management and deployment within Celatone.
Uploaded JSON schemas are stored locally on your device, ensuring quick access and reference. An option to attach a JSON schema is also provided, allowing users to enrich the code details for better clarity and ease of use.
Touchpoints for Attaching JSON Schema
- After stored the code: Immediately after uploading a WASM file, you can attach a corresponding JSON Schema.
- During Query/Execute: While querying or executing a contract, you can attach a JSON Schema to ensure proper input formatting.
- Contract Details: On the Contract Details page, attaching a JSON Schema will link it to the associated code.
- Code Details: You can attach a JSON Schema directly on the Code Details page, which will then be associated with all contracts instantiated from that code.
Options for Attaching Schema
Users are provided with three methods for attaching a JSON Schema:
- Upload a .json File: Directly upload a schema file from your local device.
- Load from URL: Attach a schema that is hosted online, specifying its URL.
- Manual Input: Enter the JSON schema details manually into the provided field.
Viewing Attached JSON Schema
To view an attached JSON Schema:
- Navigate to the Code Details page.
- Select the JSON Schema tab. Here you can view the full schema and details for instantiation, execution, query, and migration messages.
It provides the following functionalities:
- Full Schema: Offers a complete schema overview, defining the structure of the smart contract’s data.
- InstantiateMsg: Describes the schema for the message format required to instantiate a new contract instance.
- ExecuteMsg: Outlines the schema for messages that execute contract functions, altering its state.
- QueryMsg: Details the schema for constructing queries to retrieve information from the contract without changing its state.
- MigrateMsg: Specifies the schema for migration messages, used when upgrading or migrating the contract.
Was this page helpful?