Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/doc update #132

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions docs/Welcome/01-ternoa-introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
sidebar_label: "Ternoa introduction"
sidebar_position: 1
---

# Teronoa Introduction

Ternoa is the first NFT centric blockchain built with Substrate
To learn more please visit [Ternoa](https://www.ternoa.network/)

## Key features

- True ownership and Secret Content
- Combination and Fractionalization
- Delegating and Lending
- Auction and Royalties
- Mirroring and Interoperability

Discover [ternoa ecosystem](https://www.ternoa.network/ecosystem)
10 changes: 10 additions & 0 deletions docs/Welcome/02-trusted-executed-environment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
sidebar_label: "Trusted Executed Environment"
sidebar_position: 3
---

# Trusted Executed Environment

## TEE Architecture

## Extrinsics
2 changes: 1 addition & 1 deletion docs/for-developers/cookbook/batch.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ In this example we are going to run the `batchAllTxHex` but because we want the
```js showLineNumbers

export const nftsBatchMintingHex = async (nftMetadata, quantity) => {
// nftMetaData represents here the offChain datas of the NFT.
// nftMetaData represents here the offChain data of the NFT.
// quantity is the number of NFT to be minted
try{
...
Expand Down
24 changes: 14 additions & 10 deletions docs/for-developers/cookbook/ipfs.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ created: 2022-12-09

## Overview

IPFS (Interplanetary File Systems) is one of the solution we recommend to upload NFTs medias and other associated metadatas. Thus offchain datas are stored in a fully decentralized way and only the link to this metadata is stored on-chain as part of the NFT. This link is frequently a fingerprint called a cryptographic hash ID (e.g. `Qmf5RHhnUjSCfCN9d1Ee6sUWxe3Eqvogw1cTsssrxAxtPn`). IPFS files are accessible using those hashes.
IPFS (Interplanetary File Systems) is one of the solution we recommend to upload NFTs medias and other associated metadatas. Thus offchain data are stored in a fully decentralized way and only the link to this metadata is stored on-chain as part of the NFT. This link is frequently a fingerprint called a cryptographic hash ID (e.g. `Qmf5RHhnUjSCfCN9d1Ee6sUWxe3Eqvogw1cTsssrxAxtPn`). IPFS files are accessible using those hashes.

On Ternoa NFTs are composed of two files: an asset file (e.g. image, video, music) and a metadata json file. The asset file hash is nested into the metadata file and both are stored on IPFS with their dedicated hashes.

Expand Down Expand Up @@ -89,23 +89,27 @@ An IPFS client is available on ternoa-js SDK to make IPFS upload simple with onl
Here is an example uploading an image "shining.jpg" from the movie:

```typescript
import { TernoaIPFS, File } from "ternoa-js"
import { TernoaIPFS, File } from "ternoa-js";

const main = async () => {
const file = new File([await fs.promises.readFile("shining.jpg")], "shining.jpg", {
type: "image/jpg",
})
const file = new File(
[await fs.promises.readFile("shining.jpg")],
"shining.jpg",
{
type: "image/jpg",
}
);

const ipfsClient = new TernoaIPFS(new URL("IPFS_NODE_URL"), "IPFS_API_KEY")
const ipfsClient = new TernoaIPFS(new URL("IPFS_NODE_URL"), "IPFS_API_KEY");

const nftMetadata = {
title: "Shining, a nice movie",
description: "This is (not) my first Ternoa's NFT",
}
};

const { Hash } = await ipfsClient.storeNFT(file, nftMetadata)
console.log("The off-chain metadata hash is ", Hash)
}
const { Hash } = await ipfsClient.storeNFT(file, nftMetadata);
console.log("The off-chain metadata hash is ", Hash);
};
```

First the JPG image file named "shining.jpg" is read from the file system and wrapped in a specific `File` instance. The TernoaIPFS class is then used to create an IPFS client that connects to a specified IPFS node using a given API key. The metadata for the file is then defined in an object and passed to the `storeNFT` method of the client along with the `File` instance. The resulting `Hash` of the off-chain metadata is logged to the console.
Expand Down
2 changes: 1 addition & 1 deletion docs/for-developers/good-practices.tmp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar_label: Good practices
# Good practices

- init API
- Offchain datas - IPFS
- Offchain data - IPFS
- on-chain, off-chain
- keyring signing
- no keyring, signer
Expand Down
2 changes: 1 addition & 1 deletion docs/for-developers/guides/NFT/basic-NFT/prepare-assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ sidebar_label: How to prepare Basic NFT assets

A Ternoa NFT is composed of two files: an asset file (e.g. image, video, music) and a metadata json file. The asset file CID is nested into the metadata file and both are stored on IPFS (Interplanetary File Systems) with their dedicated hashes.

IPFS (Interplanetary File Systems) is one of the solution we recommend to upload NFTs medias and other associated metadatas. Thus offchain datas are stored in a fully decentralized way and only the link to this metadata is stored on-chain as part of the NFT. This link is frequently a fingerprint called a cryptographic ID (e.g. `Qmf5RHhnUjSCfCN9d1Ee6sUWxe3Eqvogw1cTsssrxAxtPn`). IPFS files are accessible using those hashes.
IPFS (Interplanetary File Systems) is one of the solution we recommend to upload NFTs medias and other associated metadatas. Thus offchain data are stored in a fully decentralized way and only the link to this metadata is stored on-chain as part of the NFT. This link is frequently a fingerprint called a cryptographic ID (e.g. `Qmf5RHhnUjSCfCN9d1Ee6sUWxe3Eqvogw1cTsssrxAxtPn`). IPFS files are accessible using those hashes.

Ternoa provides its own IPFS public nodes on different HTTP gateways based on the network environement:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The asset preparation for a Soulbound NFT is exactly the same as the one describ

A Ternoa NFT is composed of two files: an asset file (e.g. image, video, music) and a metadata json file. The asset file CID is nested into the metadata file and both are stored on IPFS (Interplanetary File Systems) with their dedicated hashes.

IPFS (Interplanetary File Systems) is one of the solution we recommend to upload NFTs medias and other associated metadatas. Thus offchain datas are stored in a fully decentralized way and only the link to this metadata is stored on-chain as part of the NFT. This link is frequently a fingerprint called a cryptographic ID (e.g. `Qmf5RHhnUjSCfCN9d1Ee6sUWxe3Eqvogw1cTsssrxAxtPn`). IPFS files are accessible using those hashes.
IPFS (Interplanetary File Systems) is one of the solution we recommend to upload NFTs medias and other associated metadatas. Thus offchain data are stored in a fully decentralized way and only the link to this metadata is stored on-chain as part of the NFT. This link is frequently a fingerprint called a cryptographic ID (e.g. `Qmf5RHhnUjSCfCN9d1Ee6sUWxe3Eqvogw1cTsssrxAxtPn`). IPFS files are accessible using those hashes.

Ternoa provides its own IPFS public nodes on different HTTP gateways based on the network environement:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ sidebar_label: How to prepare Collection assets

A Ternoa Collection is composed of three files: a profile picture image, a banner image and a metadata json file. The image files CID is nested into the metadata file and all are stored on IPFS (Interplanetary File Systems) with their dedicated hashes.

IPFS (Interplanetary File Systems) is one of the solution we recommend to upload NFTs medias and other associated metadatas. Thus offchain datas are stored in a fully decentralized way and only the link to this metadata is stored on-chain as part of the NFT. This link is frequently a fingerprint called a cryptographic ID (e.g. `Qmf5RHhnUjSCfCN9d1Ee6sUWxe3Eqvogw1cTsssrxAxtPn`). IPFS files are accessible using those hashes.
IPFS (Interplanetary File Systems) is one of the solution we recommend to upload NFTs medias and other associated metadatas. Thus offchain data are stored in a fully decentralized way and only the link to this metadata is stored on-chain as part of the NFT. This link is frequently a fingerprint called a cryptographic ID (e.g. `Qmf5RHhnUjSCfCN9d1Ee6sUWxe3Eqvogw1cTsssrxAxtPn`). IPFS files are accessible using those hashes.

Ternoa provides its own IPFS public nodes on different HTTP gateways based on the network environement:

Expand Down
11 changes: 6 additions & 5 deletions docs/for-developers/sdk-references/indexer/Introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@ sidebar_position: 1

# Introduction

The indexer is an Open, Flexible, Fast tool based on the **[SubQuery Framework](https://doc.subquery.network/).** It is used to transform blockchain data into a **graphql queryable database**.
The indexer is an Open, Flexible, Fast tool based on the **[SubQuery Framework](https://doc.subquery.network/).** It is used to transform blockchain data into a **graphql queryable database**.

### How it works:

The indexer scans through each block and their events to see what happened on the Ternoa Blockchain. It then parses all that data into entities and inserts it in a postgres DB.
Ternoa deploys its own indexer, and anybody can run his own.
Ternoa deploys its own indexer, and anybody can run his own.

> You can get more information on the **[SubQuery official documentation](https://doc.subquery.network/faqs/faqs.html)**

> You can also check out **[our repository](https://github.com/capsule-corp-ternoa/ternoa-subql)** to see how we setup the subquery project to connect to the ternoa blockchain.

### The most important files are:

- Project.yaml: setup the endpoint, the genesis hash, the types file, and the different filter to get only the specific events / extrinsics needed. We can also filter on the success status of the event / extrinsic. (More details on the **[docs](https://doc.subquery.network/build/manifest/polkadot.html)**)
- Schema.graphql: specifies the custom data we need to record in our postgres db.
- The Mappings folder : Your mappingHandlers will handle the functions to transform the blockchain datas into the needed GraphQL entities contained in the Schema.graphql. More info [here](https://academy.subquery.network/build/mapping/polkadot.html)
- Project.yaml: setup the endpoint, the genesis hash, the types file, and the different filter to get only the specific events / extrinsics needed. We can also filter on the success status of the event / extrinsic. (More details on the **[docs](https://doc.subquery.network/build/manifest/polkadot.html)**)
- Schema.graphql: specifies the custom data we need to record in our postgres db.
- The Mappings folder : Your mappingHandlers will handle the functions to transform the blockchain data into the needed GraphQL entities contained in the Schema.graphql. More info [here](https://academy.subquery.network/build/mapping/polkadot.html)
2 changes: 1 addition & 1 deletion docs/for-developers/sdk-references/indexer/_category_.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"position": 2,
"link": {
"type": "generated-index",
"description": "If you are looking for building a fast and performant dApp, this section is made for you. Let's explore our Indexer and get datas from the Ternoa blockchain."
"description": "If you are looking for building a fast and performant dApp, this section is made for you. Let's explore our Indexer and get data from the Ternoa blockchain."
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ sidebar_position: 1

Some aggregation plugins are available to count some data. You can use them in simple queries.

If you look at the indexer playground docs and schema on the right panel, you can see some aggregate fields.
They allow to make some mathematical calculations for some specific datas. Let's keep the example to query some NFT filtered by a specific owner and calculate the total amount in CAPS for each listed NFT.
If you look at the indexer playground docs and schema on the right panel, you can see some aggregate fields.
They allow to make some mathematical calculations for some specific data. Let's keep the example to query some NFT filtered by a specific owner and calculate the total amount in CAPS for each listed NFT.

```graphql showLineNumbers
query {
Expand All @@ -34,7 +34,7 @@ query {
}
```

The expected outcome will be :
The expected outcome will be :

```graphql showLineNumbers
...
Expand All @@ -48,11 +48,8 @@ aggregates: {

> ![filterFields](./aggregate.png)




<!-- To see more details about the corresponding code you can check **[this link](https://github.com/capsule-corp-ternoa/subql/blob/dev-update/packages/query/src/graphql/plugins/PgAggregateTransfer.ts)**.
___
___

## Most sold

Expand Down Expand Up @@ -91,4 +88,4 @@ The topSeller query return a ranking of addresses which sold the most NFTs:
}
}
}
``` -->
``` -->
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ sidebar_label: Overview

Ternoa Dictionary records all the native substrate on-chain data of the Ternoa blockchain: blocks, extrinsics, and events. It is a glossary of data that pre-indexes chain events, drastically improving the overall indexing performance. Unlike the Indexer, no data relating to the Ternoa pallets is covered by the Dictionary.

If you already looked at our documentation, you should now [understand](/ternoa-wiki/offchain-components/builder-tools/dictionary) that the indexing datas provided by the chain can be retrieved both on our (**[alphanet indexer](https://indexer-alphanet.ternoa.dev/)** or **[mainnet indexer](https://indexer-mainnet.ternoa.network/)**), but also on our [dictionary](https://dictionary-mainnet.ternoa.dev/).
If you already looked at our documentation, you should now [understand](/ternoa-wiki/offchain-components/builder-tools/dictionary) that the indexing data provided by the chain can be retrieved both on our (**[alphanet indexer](https://indexer-alphanet.ternoa.dev/)** or **[mainnet indexer](https://indexer-mainnet.ternoa.network/)**), but also on our [dictionary](https://dictionary-mainnet.ternoa.dev/).

Since the [Dictionary](/for-developers/#what-are-the-differences-between-the-dictionary-or-the-indexer) is focused on native substrate on-chain data contained in **blocks**, (instead of being focused on listening events like the indexer), you can use it for :

Since the [Dictionary](/for-developers/#what-are-the-differences-between-the-dictionary-or-the-indexer) is focused on native substrate on-chain data contained in **blocks**, (instead of being focused on listening events like the indexer), you can use it for :
- [Installing](/for-developers/indexer/dictionary/use-dictionary) it into your own indexer as we do to improve performance.
- Use it as an to [query datas](http://localhost:3000/for-developers/indexer/dictionary/use-dictionnary-explorer) exactly like on the indexer
- Use it as an to [query data](http://localhost:3000/for-developers/indexer/dictionary/use-dictionnary-explorer) exactly like on the indexer

_If you want to know which tool suits you the best, look at the official [documentation](https://academy.subquery.network/academy/tutorials_examples/dictionary.html)._
_If you want to know which tool suits you the best, look at the official [documentation](https://academy.subquery.network/academy/tutorials_examples/dictionary.html)._
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,16 @@ sidebar_position: 1

## USE IT FROM PLAYGROUND

Depending on the datas you are looking for, you can directly query any data needed on:
Depending on the data you are looking for, you can directly query any data needed on:

- **[The Alphanet indexer](https://indexer-alphanet.ternoa.dev/)**
- **[The Mainnet indexer](https://indexer-mainnet.ternoa.network/)**

#### You just need to create the graphql request, for example, a simple request to get the 10 last listed nft:
#### You just need to create the graphql request, for example, a simple request to get the 10 last listed nft:

```graphql
{
nftEntities(
first: 10,
offset: 0,
orderBy: TIMESTAMP_LIST_DESC
) {
nftEntities(first: 10, offset: 0, orderBy: TIMESTAMP_LIST_DESC) {
totalCount
nodes {
nftId
Expand All @@ -29,10 +27,13 @@ Depending on the datas you are looking for, you can directly query any data need
}
}
```

#### Same example in the playground:

![exemple](./playground-example.png)

#### You can access the hole schema in the right panel of the playground:

![playgroundPanel](./playground-schema.png)

Or directly in our **[repository](https://github.com/capsule-corp-ternoa/ternoa-subql/blob/main/schema.graphql)**.
Or directly in our **[repository](https://github.com/capsule-corp-ternoa/ternoa-subql/blob/main/schema.graphql)**.
Loading