Skip to content

Commit

Permalink
move some docs from guides to build section
Browse files Browse the repository at this point in the history
  • Loading branch information
Maksandre committed Apr 6, 2024
1 parent deee315 commit 0695431
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 300 deletions.
6 changes: 2 additions & 4 deletions docs/.vuepress/components/WalletTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,14 @@ const wallets: WalletItem[] = [
display: flex;
flex-wrap: wrap;
gap: 10px;
padding: 40px;
}
.item {
width: 250px;
display: flex;
flex-direction: column;
align-items: center;
background-color: white;
border: 1px solid #e1e4e8;
background-color: var(--c-bg-light);
border-radius: 12px;
overflow: hidden;
transition: transform 0.3s ease, box-shadow 0.3s ease;
Expand All @@ -87,7 +85,7 @@ const wallets: WalletItem[] = [
.title {
font-size: 20px;
color: #333;
color: var(--c-text-hover);
width: 100%;
padding: 20px;
text-align: center;
Expand Down
18 changes: 12 additions & 6 deletions docs/.vuepress/configs/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ export const sidebar: Record<string, SidebarConfig> = {
{
text: 'SDK',
children: [
'/build/sdk',
'/build/sdk/getting-started.md',
'/build/sdk/accounts.md',
'/build/sdk/collections.md',
'/build/sdk/tokens.md',
'/build/sdk/examples-nesting.md',
]
},
Expand All @@ -86,10 +89,7 @@ export const sidebar: Record<string, SidebarConfig> = {
{
text: 'SDK guides',
children: [
'/tutorials/how-to-accounts.md',
'/tutorials/work-with-accounts.md',
'/tutorials/how-to-collections.md',
'/tutorials/how-to-tokens.md',
// '/tutorials/accounts/create-account.md', - how-to-accounts.md
// '/tutorials/getAccountAndBalance.md', - how-to-accounts.md
// '/tutorials/create-collection-token.md', - exists in how-to-collections.md + how-to-tokens.md
Expand Down Expand Up @@ -156,8 +156,14 @@ export const sidebar: Record<string, SidebarConfig> = {
{
text: 'User guides',
children: [
'/tutorials/user-guides/wallets.md',
'/tutorials/user-guides/ledger-connect.md'
{
text: 'Choose your wallet',
link: '/tutorials/user-guides/wallets.md',
children: [
'/tutorials/user-guides/polkadotjs.md',
'/tutorials/user-guides/ledger-connect.md'
]
},
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion docs/build/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

Unique Network provides various tools for application development.

- [SDK](./sdk/) for the most friendly developer experience and advanced capabilities.
- [SDK](./sdk/getting-started.md) for the most friendly developer experience and advanced capabilities.
- [EVM tools](./evm/) if you want to use smart contracts in your application.
43 changes: 13 additions & 30 deletions docs/tutorials/how-to-accounts.md → docs/build/sdk/accounts.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,20 @@
# How to work with accounts

# Working with accounts
<!-- TODO review this doc -->
[[toc]]

## Creating a Substrate address via the browser extension

Unique Network, like most blockchains, is based on [accounts or addresses](/concepts/addresses/index.md). An address can own some QTZ or UNQ tokens, NFTs or some ERC-20 tokens. It can sign transactions to transfer these valuable assets to other addresses or to make some actions in Decentralized Apps (dApps). For example, an address can buy and sell NFTs on the NFT Marketplace.

A typical Quartz address looks like this: `yGHuU9CWnrHMUz8GJRmpA9MowmtMKZvnq2tLc5mk3zMFizW5X`

So, to purchase and sell tokens on the Market, you need to have a Unique Network account. To create a new account, you should get an address that can own NFTs and allow you to manage KSM. The best way to get an address is to install the **Polkadot{.js} browser extension** [for Chrome](https://chrome.google.com/webstore/detail/polkadot%7Bjs%7D-extension/mopnmbcafieddcagagdcbnhejhlodfdd) or [for Firefox](https://addons.mozilla.org/en-US/firefox/addon/polkadot-js-extension/). This browser extension manages accounts and allows you to sign transactions with these accounts.

To create a Unique Network account:
1. Download the [Polkadot{.js} extension](https://polkadot.js.org/extension/) and add it to your browser.
2. Click on the Polkadot{.js} extension in your browser.
3. In the **Authorize** window, read the disclaimer and click **Yes, allow this application access**.
4. Click the **Add Account** icon (**+**) and then click **Create new account**. This will generate your wallet address and the 12-word mnemonic seed – the series of words that can be used to restore your wallet. :warning: Copy this seed and keep it a safe place. :warning:
![Seed](./images/seed.png)
5. Select "I have saved my mnemonic seed safely" and click **Next step**.
6. On the next screen, in the _NETWORK_ drop-down menu, select **Allow use on any chain**. Add a name for your account and create a new password by entering the password twice.
![AccountName](./images/acc-name.png)
7. Click **Add the account with the generated seed**. Your newly created account is now displayed in the Accounts window.
![AccountList](./images/acc-list.png)

Each account has an icon displayed next to the account name. Clicking this icon, you copy the account address to the clipboard.
## Creating a Substrate address with wallets

- [Choose from supported wallets](../../tutorials/user-guides/wallets.md)
- [Create account via Polkadot.js browser extension](../../tutorials/user-guides/polkadotjs.md)
- [Learn how to connect Ledger](../../tutorials/user-guides/ledger-connect.md)

## Create an account via code
## Create an account via SDK

In this tutorial, we will go through the entire process of creating an account using the Unique Network SDK.

Consider using how you can create or get an account using the [Accounts](https://www.npmjs.com/package/@unique-nft/accounts) package.
Consider how you can create or get an account using the [Accounts](https://www.npmjs.com/package/@unique-nft/accounts) package.

You will need to come up with or generate a mnemonic phrase (this is a set of words that can be used to create and restore your wallet).
You will need to create or generate a mnemonic phrase (a set of words that can be used to create and restore your wallet).

:warning: Never share your mnemonic phrase with anyone. If someone gets access to your mnemonic phrase, they can steal your funds.

Expand Down Expand Up @@ -74,7 +57,7 @@ console.log(account);

### Get an account from mnemonic

If you already have a mnemonic phrase, you can use it to get an account. Here is how the phrase looks like:
If you already have a mnemonic phrase, you can use it to get an account. Here is what the phrase looks like:

``
affair spoon other impact target solve extra range cute myself float panda
Expand Down Expand Up @@ -126,7 +109,7 @@ const account = await getAccountFromMnemonic({

### Providers

If you need to get an account from one specific provider, then it is not necessary to create an Accounts object, you can contact the provider directly:
If you need to get an account from one specific provider, then it is not necessary to create an Accounts object. You can contact the provider directly:

```typescript:no-line-numbers
import { Account } from '@unique-nft/accounts';
Expand Down Expand Up @@ -224,7 +207,7 @@ const signer = await provider.first();

### Get accounts

You can use the [Accounts](https://www.npmjs.com/package/@unique-nft/accounts) package to work with accounts easily.
You can use the [Accounts](https://www.npmjs.com/package/@unique-nft/accounts) package to easily manage accounts.

The package allows connecting with different accounts. To get an accounts list, you need to create an instance of the `Accounts` class and connect the necessary providers to it:

Expand Down Expand Up @@ -285,7 +268,7 @@ import { KeyringLocalProvider } from '@unique-nft/accounts/keyring-local';
const options: KeyringLocalOptions = {
type: 'sr25519', //
passwordCallback: async (keyring: KeyringPair) => {
... // here you need to ask the user to enter a password to sign the transaction and return it from this callback
... // here you need to ask the user to enter a password to sign the transaction and return it from this callback
},
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# How to work with collections

# Working with collections
<!-- TODO review this page -->
[[toc]]

## Intro
Expand All @@ -21,11 +21,11 @@ In Unique Network, the collection has the following entities:

## Prerequisites

We'll need a Substrate address to use in this example. If you do not have it yet, please check [Create an account](../tutorials/how-to-accounts.md#create-an-account-via-code).
We'll need a Substrate address to use in this example. If you do not have it yet, please check [working with account](./accounts.md#create-an-account-via-sdk).

And, since some Opal tokens are required to pay for the transaction fees as well (around 2 to 2.5 OPL), please make sure that your balance has some tokens. These can be obtained via the [Telegram faucet bot](https://t.me/unique2faucet_opal_bot).

We will use SDK and some other packages in this section. To learn how to install SDK, please refer to [SDK Installation](../sdk/installation.md).
We will use SDK and some other packages in this section. To learn how to install SDK, please refer to [getting started](./getting-started.md).

## Collection creation

Expand All @@ -34,7 +34,7 @@ We will use SDK and some other packages in this section. To learn how to install
Please find below a full sample code that creates an account from a mnemonic phrase, initializes SDK, and then creates a collection on the Opal testnet.

:warning: Please note that you need to use your mnemonic phrase, or even use another way to initialize your account
(see [Create an account](../tutorials/how-to-accounts.md#create-an-account-via-code)).
(see [Create an account](./accounts.md#create-an-account-via-sdk)).

<CodeGroup>
<CodeGroupItem title = "SDK">
Expand Down Expand Up @@ -294,7 +294,7 @@ curl -X 'GET' \

Your NFT collection have a bunch of various properties such as limits, permissions, token attributes and some others. Some of them you can set only while collection creation, but others you can set up later, when your collection is already created.

You can find the list of SDK methods, that you can use to adjust your collection [here](../sdk/methods.md#collection).
You can find the list of SDK methods, that you can use to adjust your collection [here](../../reference/sdk-methods.md).

For example, let's update the collection limits using `sdk.collections.setLimits` method. The method sets some collection limits and starts enforcing them immediately. By the way, only the collection owner has the permission to call this method.

Expand Down
2 changes: 1 addition & 1 deletion docs/build/sdk/examples-nesting.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The **nesting** feature allows you to create **nested tokens**. Thus, the topmost token will have a wallet address as its owner, while the owner of tokens nested in it will be the token above it.
The entire chain of nested tokens will be called a **bundle**. If you transfer a top-level token to another owner, all tokens in the bundle will go with it.

> If you don't know how to create collections and tokens, start from [the beginning](./index.md)
> If you don't know how to create collections and tokens, start from [the beginning](./getting-started.md)
## Nesting permission

Expand Down
File renamed without changes.
Loading

0 comments on commit 0695431

Please sign in to comment.