Architecture

API Architecture

The Ternoa SDK facilitates access to the main functionalities offered by the Ternoa chain. It enables you to execute all transactions from the chain pallets/primitives, perform queries, or access constant storage. Additionally, the SDK includes various helpers and utility functions to enhance your overall experience.

On-chain handlers architecture

For those who have experience with Polkadot, the architectural design of the features in Ternoa SDK will be familiar. If you are new to this, there's no need to worry as the fundamental concepts are straightforward to grasp. Based on the specific pallet or handler category, you can access the following:

  • Constants to request the chain runtime.

  • Storage to query the chain state.

  • Extrinsics to execute the transactions.

  • Utils & Helpers: Some powerful functions to assist you in interacting with the chain or performing off-chain operations.

If you need to perform custom storage calls, constant calls, or extrinsic calls that are not readily available as dedicated helpers in the SDK, you can execute them directly through the API using getRawApi(). Further instructions on executing custom calls can be found in the Build section.

Off-chain handlers architecture

  • Helpers: Some user-friendly functions to facilitate performing off-chain operations like interacting with TEE SGX Clusters, connecting and storing data in the IPFS Ternoa client, and managing encryption with keys (...).

The main handlers are the ones below:

  • blockchain: the CORE blockchain function. The API brain that randomly: init the API, executes transactions, queries data, batch transactions, etc.

  • account: the functions that allow you to generate a new seed and a keyring

  • auction: the Auction pallet with its extrinsics, query, and storage to create auctions and manage bids.

  • assets: the Auction pallet with its extrinsics, query, and storage.

  • balance: the Balance pallet with its extrinsics, query, and storage.

  • nft: the NFT pallet with its extrinsics, query, and storage.

  • marketplace: the Marketplace pallet with its extrinsics, query, and storage.

  • protocols: the Transmission protocols pallet with its extrinsics, query, and storage.

  • rent: the Rent pallet with its extrinsics, query, and storage.

  • helpers: the helpers' folder that contains all the functions to perform off-chain operations:

    • Crypto utilities

    • Encryption helpers

    • The Ternoa IPFS client

    • Some end-to-end NFT, secret NFT & Capsule NFT helpers

    • Some TEE helpers interact with clusters

    • The Utility helpers as formatters, file converters, and other useful helpers.

  • events: the events list returned when the submitTxBlocking function is triggered

Response Format

In our effort to offer the most accessible tools for building on the Ternoa chain, we have also endeavored to simplify the response formats of our functions where possible. Depending on whether you can use the automated approach or the customizable one to run your extrinsics, we suggest selecting the appropriate function. Some functions will directly provide events and featured data, while others will return only the transaction hash in hexadecimal format to be signed and submitted by the external user of your dApp. More about this automated or customizable approach in the Workflow section.

Last updated