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

docs work #88

Merged
merged 2 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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.

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

Here are some examples of how to integrate with SuiNS on-chain.

## 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 that demonstrates how to interact with SuiNS on-chain.
ronny-mysten marked this conversation as resolved.
Show resolved Hide resolved

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

/// Our SuiNS dependency is imported here.
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 (e.g `example.sui`)
public fun send_to_name<T: key + store>(suins: &SuiNS, obj: T, name: String, clock: &Clock) {
// Lookup 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.
// We could skip that, but it's recommended we do indeed check for this.
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())
}
}
```
37 changes: 34 additions & 3 deletions documentation/pages/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,44 @@ This is a list of our current active objects to interact with SuiNS.

<Tabs items={['Mainnet', 'Testnet']}>
<Tabs.Tab>
| Kind | ObjectID |
The following packages are deployed, authorized, and maintained by SuiNS 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
The following packages are deployed, authorized, and maintained by SuiNS on mainnet.
<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>
14 changes: 14 additions & 0 deletions documentation/pages/indexing.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Indexing

The reason we built an indexer was to enable more expressive queries about the active domain state, as the on-chain resolution wasn't enough to power our
interface.

This allows us to run complex queries such as:

- **Get all the subnames for a given parent:** Easily 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 that are associated with a specific wallet address, which is invaluable for tracking ownership and usage.

You can find the indexer in the [GitHub repository here](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 our indexer works and how to integrate it into your projects, please 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. */}
Loading