Skip to content

Commit

Permalink
Add mvr names management (#227)
Browse files Browse the repository at this point in the history
* Add mvr names management

* Updates

---------

Co-authored-by: Ronny Roland <[email protected]>
  • Loading branch information
manolisliolios and ronny-mysten authored Dec 11, 2024
1 parent 4341d32 commit e8c01ad
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 5 deletions.
11 changes: 11 additions & 0 deletions documentation/pages/move-registry.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,14 @@ MVR default service currently supports Mainnet and Testnet networks.
## Development status

<Beta/>

## Source location

The open-source code for MVR is located within both the [Sui](https://github.com/MystenLabs/sui) and [MVR](https://github.com/MystenLabs/mvr) repositories on GitHub.

- MVR repository houses the [MVR-CLI](https://github.com/MystenLabs/mvr/tree/main/mvr-cli) and [MVR web app](https://github.com/MystenLabs/mvr/tree/main/app) code.
- Sui repository houses the [MVR plugin for Sui TypeScript SDK](https://github.com/MystenLabs/sui/blob/main/sdk/typescript/src/transactions/plugins/NamedPackagesPlugin.ts) and [MVR GraphQL](https://github.com/MystenLabs/sui/tree/main/crates/sui-graphql-rpc/src/types/move_registry) code.

## MVR web app

You can access the front end of the Move Registry online at https://www.moveregistry.com/apps.
87 changes: 82 additions & 5 deletions documentation/pages/move-registry/mvr-names.mdx
Original file line number Diff line number Diff line change
@@ -1,11 +1,88 @@
import Beta from '../../components/beta'
import { Callout } from 'nextra/components';

<Beta/>

# Managing MVR names
# Managing MVR names (Mainnet only)

[TODO!!!: Add sui client ptb commands to:
<Callout type="warning">
These examples assume that you use the MVR plugin for the Sui Typescript SDK, as described in the [`Typescript SDK`](/move-registry/tooling/typescript-sdk) section.
</Callout>

1. Create a new MVR app by presenting a SuiNS name and a package name.
2. Linking a MVR app with a `PackageInfo` object.
]
## Creating a new application

To create a new application, you must provide a SuiNS name and a package name, as long as it is not
already registered.

```typescript
const transaction = new Transaction();

const appCap = transaction.moveCall({
target: `@mvr/core::move_registry::register`,
arguments: [
// the registry obj: Can also be resolved as `registry-obj@mvr` from mainnet SuiNS.
transaction.object('0x0e5d473a055b6b7d014af557a13ad9075157fdc19b6d51562a18511afd397727'),
transaction.object(suinsObjectId),
transaction.pure.string(name),
transaction.object.clock(),
],
});

// we can then use the appCap to attach packages directly, or transfer (e.g. to a safe address)
// and register packages later.
```

## Attaching a Mainnet package to an application

When attaching a Mainnet package to an application, you must provide the `PackageInfo` object.
This call is permanent, so after a `PackageInfo` object is attached to an application, it cannot be
detached in the future. Consequently, an app is always linked to a specific package.

```typescript
// we can then use the appCap to attach packages directly, or transfer (e.g. to a safe address)
// and register packages later.

const transaction = new Transaction();

transaction.moveCall({
target: `@mvr/core::move_registry::assign_package`,
arguments: [
// the registry obj: Can also be resolved as `registry-obj@mvr` from mainnet SuiNS.
transaction.object(`0x0e5d473a055b6b7d014af557a13ad9075157fdc19b6d51562a18511afd397727`),
transaction.object('<The AppCap object>'),
transaction.object('<The PackageInfo object on mainnet>'),
],
});
```

## Attaching a non-Mainnet package to an application

For non-Mainnet networks, you only attach a "pointer" to the package, instead of strict binding (which wouldn't be possible).

<Callout>
You can always update an external network by first calling `@mvr/core::move_registry::unset_network`, and then calling `@mvr/core::move_registry::set_network` again.
</Callout>

```typescript
const transaction = new Transaction();

const appInfo = transaction.moveCall({
target: `@mvr/core::app_info::new`,
arguments: [
transaction.pure.option("address", '<The objectId of the `PackageInfo` object on the external network>'),
transaction.pure.option("address", '<The address of the package on the external network>'),
transaction.pure.option("address", null),
],
});

transaction.moveCall({
target: `@mvr/core::move_registry::set_network`,
arguments: [
// the registry obj: Can also be resolved as `registry-obj@mvr` from mainnet SuiNS.
transaction.object('0x0e5d473a055b6b7d014af557a13ad9075157fdc19b6d51562a18511afd397727'),
transaction.object('<The AppCap object>'),
transaction.pure.string("<chain id of the network: use `4c78adac` for testnet>"),
appInfo,
],
});
```

0 comments on commit e8c01ad

Please sign in to comment.