Skip to content

Commit

Permalink
docs work (#88)
Browse files Browse the repository at this point in the history
* docs work

* Style guide update

---------

Co-authored-by: Ronny Roland <[email protected]>
  • Loading branch information
manolisliolios and ronny-mysten authored Apr 23, 2024
1 parent 0a9c6ae commit d909143
Show file tree
Hide file tree
Showing 20 changed files with 101 additions and 57 deletions.
2 changes: 1 addition & 1 deletion documentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

To run locally:

1. `pnpm i` (only needed first time)
1. `pnpm i` (needed first time and when modules change)
2. `pnpm dev`
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions documentation/pages/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"index": "SuiNS Documentation",
"integration": "Integration",
"subnames": "Subnames",
"contracts": "Smart Contracts",
"sdk": "SDK"
"indexing": "Indexing",
"examples": "Examples"
}
26 changes: 0 additions & 26 deletions documentation/pages/contracts.mdx

This file was deleted.

44 changes: 44 additions & 0 deletions documentation/pages/examples.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Examples

The following code sample is an initial example of how to integrate with SuiNS on chain. This page will host more examples in the future.

## Transferring any object to a SuiNS name fully on-chain

The following `demo` module demonstrates how to transfer an object of any type to a SuiNS name. This is a basic example of how to interact with SuiNS on chain.

```rust
module demo::demo {
use std::string::String;
use sui::clock::Clock;

/// Import the SuiNS dependency.
use suins::{
suins::SuiNS,
registry::Registry,
domain
};

/// Different custom error messages.
const ENameNotFound: u64 = 0;
const ENameNotPointingToAddress: u64 = 1;
const ENameExpired: u64 = 2;

/// A function to transfer an object of any type T to a name (for instance `example.sui`)
public fun send_to_name<T: key + store>(suins: &SuiNS, obj: T, name: String, clock: &Clock) {
// Look up the name on the registry.
let mut optional = suins.registry<Registry>().lookup(domain::new(name));
// Check that the name indeed exists.
assert!(optional.is_some(), ENameNotFound);

let name_record = optional.extract();
// Check that name has not expired.
// This check is optional, but it's recommended you perform the verification.
assert!(name_record.has_expired(clock), ENameExpired);
// Check that the name has a target address set.
assert!(name_record.target_address().is_some(), ENameNotPointingToAddress);

// Transfer the object to that name.
transfer::public_transfer(obj, name_record.target_address().extract())
}
}
```
49 changes: 39 additions & 10 deletions documentation/pages/index.mdx
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import { Tabs } from 'nextra/components'
import { Callout } from 'nextra/components'

# SuiNS Documentation
# Sui Name Service Documentation

SuiNS documentation is a place to find the available ways of integration with SuiNS.
Sui Name Service documentation details how to integrate Sui Name Service (SuiNS) with you projects. This includes ways to integrate using both the on-chain resolution, as well as off-chain resolution, depending on the use case.

This includes ways to integrate using both the on-chain resolution, as well as off-chain resolution,
based on the use-case.
The documentation is early in its development. As the site matures, the content will include instructio on how to use the SuiNS portal, as well.

## Active constants

## Active Constants

This is a list of our current active objects to interact with SuiNS.
This is a list of the current active objects to interact with SuiNS.

<Callout type="info" emoji="ℹ️">
It's recommended to look here for the latest state, as some of the active constants might be changed.
Expand All @@ -21,13 +19,44 @@ This is a list of our current active objects to interact with SuiNS.

<Tabs items={['Mainnet', 'Testnet']}>
<Tabs.Tab>
| Kind | ObjectID |
SuiNS deploys, authorizes, and maintains the following packages on Mainnet.
<Tabs items={['Packages', 'Objects']}>
<Tabs.Tab>
| Kind | Package Id |
|-------------- |---------------------------------------------------------------------- |
| SuiNS Shared Object | `0x6e0ddefc0ad98889c04bab9639e512c21766c5e6366f89e696956d9be6952871` |
| SuiNS Core V2 (latest) | `0xb7004c7914308557f7afbaf0dca8dd258e18e306cb7a45b28019f3d0a693f162` |
| SuiNS Core V1 | `0xd22b24490e0bae52676651b4f56660a5ff8022a2576e0089f79b3c88d44e08f0` |
| Registration | `0x9d451fa0139fef8f7c1f0bd5d7e45b7fa9dbb84c2e63c2819c7abd0a7f7d749d` |
| Renewal | `0xd5e5f74126e7934e35991643b0111c3361827fc0564c83fa810668837c6f0b0f` |
| Utilities (setup) | `0xdac22652eb400beb1f5e2126459cae8eedc116b73b8ad60b71e3e8d7fdb317e2` |
| Discounts Package | `0x6a6ea140e095ddd82f7c745905054b3203129dd04a09d0375416c31161932d2d` |
</Tabs.Tab>
<Tabs.Tab>
| Kind | Object Id |
|-------------- |---------------------------------------------------------------------- |
| SuiNS Core Object | `0x6e0ddefc0ad98889c04bab9639e512c21766c5e6366f89e696956d9be6952871` |
| SuiNS Discounts | `0x7fdd883c0b7427f18cdb498c4c87a4a79d6bec4783cb3f21aa3816bbc64ce8ef` |
</Tabs.Tab>
</Tabs>
</Tabs.Tab>
<Tabs.Tab>
test
SuiNS deploys, authorizes, and maintains the following packages on Testnet.
<Tabs items={['Packages', 'Objects']}>
<Tabs.Tab>
| Kind | Package Id |
|-------------- |---------------------------------------------------------------------- |
| SuiNS Core | `0x22fa05f21b1ad71442491220bb9338f7b7095fe35000ef88d5400d28523bdd93` |
| Registration | `0x4255184a0143c0ce4394a3f16a6f5aa5d64507269e54e51ea396d569fe8f1ba5` |
| Renewal | `0x54800ebb4606fd0c03b4554976264373b3374eeb3fd63e7ff69f31cac786ba8c` |
| Utilities (setup) | `0x6ed81fd808a23eae2da488052334d50478b36527474fc99707c1aed0e43104b1` |
| Subnames | `0x3c272bc45f9157b7818ece4f7411bdfa8af46303b071aca4e18c03119c9ff636` |
| Subnames Proxy | `0x3489ab5dcd346afee8b681267bcab2583a5eba9855680ec9931355e50e21c148` |
</Tabs.Tab>
<Tabs.Tab>
| Kind | Object Id |
|-------------- |---------------------------------------------------------------------- |
| SuiNS Core Object | `0x300369e8909b9a6464da265b9a5a9ab6fe2158a040e84e808628cde7a07ee5a3` |
</Tabs.Tab>
</Tabs>
</Tabs.Tab>
</Tabs>
13 changes: 13 additions & 0 deletions documentation/pages/indexing.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Indexing

The indexer enables more expressive queries about the active domain state, as the on-chain resolution wasn't enough to power the interface.

This allows for complex queries such as:

- **Get all the subnames for a given parent:** Retrieve every subdomain linked to a parent domain, enhancing the ability to manage and analyze domain structures.
- **Get all names pointing to a specified address:** Identify all domain names associated with a specific wallet address to track ownership and usage.

You can find the indexer in the [suins-indexer GitHub repository](https://github.com/MystenLabs/sui/tree/main/crates/suins-indexer).
Feel free to spin up your own service if you're looking to index data tailored to your needs.

For a deeper understanding of how the indexer works and how to integrate it into your projects, refer to [Sui's custom indexer documentation](https://docs.sui.io/guides/developer/advanced/custom-indexer).
16 changes: 0 additions & 16 deletions documentation/pages/sdk.mdx

This file was deleted.

4 changes: 2 additions & 2 deletions documentation/pages/subnames.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ The following table provides more details on the differences between the two typ
Similar to regular names, you can look up subnames through JSON-RPC and GraphQL. You can also look up subnames on chain, as described in [Integrations](./integration.mdx).


## Creating subnames
{/* ## Creating subnames
TODO: Show how someone could create subnames through the SDK (being the parent).
TODO: Show how someone can integrate with the subdomains package to create subnames.
TODO: Show how someone can integrate with the subdomains package to create subnames. */}

0 comments on commit d909143

Please sign in to comment.