Skip to main content

Introduction


Overview ⚙️

Welcome to the Ternoa-js developer documentation. Ternoa-js main objective is to be: one of the most user-friendly tools to build web3 projects on top of the Ternoa Chain. Based on Polkadot{.js} API and Javascript, it offers developers the ability to query and interact with substrate chains like the Ternoa chain. It provides a seamless experience and allows you to start building at a glance: an extra short init and just a few lines of code, and your first NFT will be live on the chain.

Forward Together

Ternoa-js is an open-source project. Feel free to interact and move forward with us. If you have questions about anything related to Ternoa, need help, or want to request features, you can open a discussion on our GitHub Discussions And if you find an issue, lets us know in our GitHub Issues section.

API Architecture

Ternoa SDK handles the main features proposed by the Ternoa chain. It allows you to run every transaction from the chain pallets, make a query or ask for some constants storage. We also provide a bunch of helpers and utils functions to help you enjoy the entire experience.

The main handlers are the ones below:

  • blockchain: the CORE blockchain function. The API brain to randomly: init the API, execute transactions, query datas, batch transactions, etc.
  • account: the functions that allows you to generate a new seed and a keyring
  • 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.
  • events: the events list returned when submitTxBlocking function is triggered

Handlers Architecture

For those familiar with Polkadot, you will quickly recognize the design structure of the features. If you don't know yet, no worries, the basic principles are easy to understand. Depending on the pallet or handler category, you will retrieve the following:

  • Constants to request the chain runtime.
  • Storage to query the chain state.
  • Extrinsics to execute the transactions.
  • Utils when available provides some additional usefull functions you can directly import in your project.

Response Format

As it makes sense for us to provide the most accessible tools to build on the Ternoa chain, we also tried to simplify the response format of our functions whenever we could. Depending if you want to get things done for you or if you go with the fully customizable way and handle your callback, we invite you to choose the correct function: Events and features datas will be provided directly on some function while only transaction hash hex will be returned on others. We will cover this topic later in the doc.

Ready to discover more?

If you are looking for full examples or short code snippet, move to the Cookbook to get a look at our most common use-cases or go to the e2e Test dApp and github repository to get a full example.