Skip to content

Commit 04cf437

Browse files
authored
add asset hub public endpoints (#180)
* add asset hub public endpoints * fix endpoints url * fix links
1 parent 14e4cef commit 04cf437

File tree

4 files changed

+33
-24
lines changed

4 files changed

+33
-24
lines changed

docs/.vuepress/configs/sidebar.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ export const sidebar: Record<string, SidebarConfig> = {
6565
'/build/sdk/v2/sponsoring.md',
6666
'/build/sdk/v2/indexer.md',
6767
'/build/sdk/v2/evm.md',
68-
'/build/sdk/v2/dapps.md',
6968
'/build/sdk/v2/asset-hub.md',
69+
'/build/sdk/v2/dapps.md',
7070
]
7171
},
7272
{

docs/build/evm/getting-started.md

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The premise of this document is as follows (for whom this document is intended):
1515
Since your core functionality is provided via Solidity contracts, we have taken care to provide you with as much examples and instructions as possible to help you navigate the transition from the existing ERC-721 tokens to the Unique native model.
1616

1717
:::tip
18-
One note to be mindful of is: the most efficient way of accomplishing this goal is by using the Unique SDK 2.0. It will provide you with the framework, the tools and the methods to make this fast and easy, so do brush up on your Typescript if you have been away from it for a while. It will save you an enormous amount of time. To make it as real-world as possible, we have implemented our SDK calls in a React framework so you can gauge how the SDK functions in a UI context and you can see it all in the video listed below.
18+
One note to be mindful of is: the most efficient way of accomplishing this goal is by using the Unique SDK 2.0. It will provide you with the framework, the tools and the methods to make this fast and easy, so do brush up on your Typescript if you have been away from it for a while. It will save you an enormous amount of time. To make it as real-world as possible, we have implemented our SDK calls in a [React framework](https://github.com/UniqueNetwork/unique-react-template) so you can gauge how the SDK functions in a UI context and you can see it all in the video listed below.
1919
:::
2020

2121
That said...
@@ -29,18 +29,18 @@ Once you read through this document, we propose that you attempt to replicate th
2929
5. Call that contract from the SDK
3030
6. Nest a token
3131

32-
ALL the examples for this except point 6 are shown in this video: https://youtu.be/Cid_Ui5e0rk
32+
ALL the examples for this except point 6 are shown in [this video](https://youtu.be/Cid_Ui5e0rk).
3333

3434
To nest, you just send a native token to a native token address as though it is a wallet using a simple send call via the SDK. That's all. Nesting doesn't even have a dedicated method. It is a simple send of a token to another tokens address.
3535

3636
Read on...
3737

3838

39-
# 1. EVM and Substrate
39+
## EVM and Substrate
4040

4141
There are two types of accounts – Substrate (5Grw...) and EVM (0x...)
4242
In terms of calling contracts:
43-
- EVM accounts operate the same way as in Ethereum, nothing special
43+
- EVM accounts operate the same way as in Ethereum
4444
- Substrate accounts cannot call EVM contracts directly because EVM works only with EVM accounts. But they can do it through the `evm.call` extrinsic (in SDK - `sdk.evm.send` method). For contract, `msg.sender` will be Substrate's account mirror – EVM account. To calculate the Substrate account mirror, use the `Address` utility from `@unique-nft/utils`
4545

4646
```ts
@@ -50,7 +50,7 @@ const ethMirror = Address.mirror.SubstrateToEthereum('5GrwvaEF5zXb26Fz9rcQpDWS57
5050
// 0xd43593c715Fdd31c61141ABd04a99FD6822c8558
5151
```
5252

53-
or play with the converter in the documentation – https://docs.unique.network/reference/tools.html
53+
or play with the [converter](https://docs.unique.network/reference/tools.html) in the documentation.
5454

5555
It is essential to understand that mirror calculation is a one-way operation. You cannot calculate the origin address from its mirror.
5656

@@ -99,21 +99,20 @@ or convert the address to CrossAccount directly:
9999
```
100100

101101
A lot of examples of how to use CrossAddress with EVM and Substrate accounts can be found in recipes of unique-contracts repo. For example:
102-
- minter contract: https://github.com/UniqueNetwork/unique-contracts/blob/main/contracts/recipes/Minter.sol#L100
103-
- test: how to call the minter contract with EVM account https://github.com/UniqueNetwork/unique-contracts/blob/main/test/minter.spec.ts
104-
- test: how to call the minter contract with Substrate account: https://github.com/UniqueNetwork/unique-contracts/blob/main/test/minter.spec.ts
102+
- [minter contract](https://github.com/UniqueNetwork/unique-contracts/blob/main/contracts/recipes/Minter.sol#L100)
103+
- how to [call the minter contract with EVM account](https://github.com/UniqueNetwork/unique-contracts/blob/main/test/minter.spec.ts)
104+
- how to [call the minter contract with Substrate account](https://github.com/UniqueNetwork/unique-contracts/blob/main/test/minter.spec.ts)
105105

106106
## Signers and Wallets
107107

108-
Documentation section on how to build applications, and specifically connecting accounts
109-
https://docs.unique.network/build/sdk/v2/dapps.html#connecting-accounts
108+
Documentation section on how to build applications, and specifically [connecting accounts](https://docs.unique.network/build/sdk/v2/dapps.html#connecting-accounts)
110109

111-
It could be much easier to understand playing with code. Here is a react template: https://github.com/UniqueNetwork/unique-react-template
110+
It could be much easier to understand playing with code. Here is a [react template](https://github.com/UniqueNetwork/unique-react-template) you can use.
112111

113112
## SDK
114113

115114
SDK is only for Substrate accounts (remember that Substrate accounts can invoke contracts).
116-
The build section of the documentation explains all the needed concepts - https://docs.unique.network/build/sdk/v2/quick-start.html
115+
The [build](https://docs.unique.network/build/sdk/v2/quick-start.html) section of the documentation explains all the needed concepts.
117116

118117
## Why it makes sense to use the schema 2.0 and why you don't have to if you do not need it.
119118

@@ -125,20 +124,20 @@ We support Unique Schema 2.0, an OpenSea compatible, on-chain metadata format, t
125124

126125
However, there is good news—if you use SDK or unique contracts, you don't need to understand this format in detail. You only need to understand its features. Everything else is handled for you.
127126

128-
The reference section in the documentation explaining all the features of unique schema – https://docs.unique.network/reference/schemas
129-
The js library for the unique schema. You don't need it if you use SDK https://github.com/UniqueNetwork/unique_schemas
127+
The [reference section](https://docs.unique.network/reference/schemas) in the documentation explaining all the features of unique schema.
130128

131-
# How to call EVM contracts using Substrate account and SDK
129+
The [js library for the unique schema](https://github.com/UniqueNetwork/unique_schemas ). You don't need it if you use SDK.
132130

133-
docs – https://docs.unique.network/build/sdk/v2/evm.html
131+
## How to call EVM contracts using Substrate account and SDK
134132

135-
EVM workshop – https://github.com/UniqueNetwork/unique-react-template/tree/workshop-EVM
133+
- [Documentation](https://docs.unique.network/build/sdk/v2/evm.html)
134+
- [EVM workshop](https://github.com/UniqueNetwork/unique-react-template/tree/workshop-EVM)
136135
- [This function](https://github.com/UniqueNetwork/unique-react-template/blob/ab923457ece54f6ac6d1f2f47fc08ea52363dad1/src/pages/BreedingPage.tsx#L58-L107) covers how to invoke contracts
137136

138137
Long story short:
139138

140139
- You save the contract's ABI as JSON file and import it
141-
- You call sdk.evm.send and pass abi, contract address, function name, and params
140+
- You call `sdk.evm.send` and pass abi, contract address, function name, and params
142141

143142
## To change a schema 2.0 compliant data attribute from EVM
144143

@@ -151,4 +150,4 @@ EVM workhop demonstrates how to do this.
151150
- [How do we call these solidity functions on the UI](https://github.com/UniqueNetwork/unique-react-template/blob/ab923457ece54f6ac6d1f2f47fc08ea52363dad1/src/pages/BreedingPage.tsx#L138-L173)
152151

153152

154-
Please remember to view this video: https://youtu.be/Cid_Ui5e0rk
153+
Please remember to view [this video](https://youtu.be/Cid_Ui5e0rk).

docs/build/sdk/v2/asset-hub.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Asset Hub
22

3-
The Unique SDK supports the Asset Hub, as well as the uniques and nfts pallets. You can use a publicly available endpoint to interact with the Asset Hub:
3+
The Unique SDK supports the Asset Hub, as well as the `uniques` and `nfts` pallets. You can use a [publicly available endpoint](../../../reference/sdk-endpoints.md) to interact with the Asset Hub:
44

55
```ts:no-line-numbers
66
import { AssetHub } from "@unique-nft/sdk";

docs/reference/sdk-endpoints.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
1-
# Public endpoints
1+
# Public SDK endpoints
22

3-
## SDK-V2
3+
## SDK-2.0
4+
5+
### Unique
46

57
| | Endpoint |
68
|----------|----------|
79
| Unique | https://rest.unique.network/v2/unique |
810
| Quartz | https://rest.unique.network/v2/quartz |
911
| Opal | https://rest.unique.network/v2/opal |
1012

11-
## SDK-V1
13+
### Asset Hub
14+
15+
| | Endpoint |
16+
|----------|----------|
17+
| Polkadot | https://rest.unique.network/v2/polkadot-asset-hub |
18+
| Kusama | https://rest.unique.network/v2/kusama-asset-hub |
19+
| Westend | https://rest.unique.network/v2/westend-asset-hub |
20+
21+
## SDK-1.0 (Legacy)
1222

1323
| | Endpoint |
1424
|----------|----------|

0 commit comments

Comments
 (0)