👀
This is a developer preview of the Move Registry. It is experimental and therefore provides no guarantees of uptime or correctness. Use at your own risk.
Plugin for Sui Typescript SDK
The Move Registry (MVR, pronounced "mover") Sui TypeScript SDK plugin offers builders a seamless experience when constructing programmable transaction blocks (PTBs) using MVR names.
The plugin resolves MVR names to their respective addresses before constructing the PTB, caching the results during each runtime.
This also applies to type names, especially across package upgrades.
How to use
The MVR plugin is exported directly from the @mysten/sui
package. To enable the plugin, register it either globally or per PTB in your dApp.
Endpoints
Mysten Labs provides public good endpoints compatible with the MVR plugin.
Mainnet: https://mvr-rpc.sui-mainnet.mystenlabs.com/graphql
Testnet: https://mvr-rpc.sui-testnet.mystenlabs.com/graphql
Register the plugin
import { namedPackagesPlugin, Transaction } from "@mysten/sui/transactions";
/** Register the MVR plugin globally (once) for our PTB construction */
Transaction.registerGlobalSerializationPlugin('namedPackagesPlugin', namedPackagesPlugin({
suiGraphQLClient: new SuiGraphQLClient({
url: `<a graphql endpoint with mvr enabled>`
}),
// You can also define overrides for packages and types optionally.
// The following example shows how to override the sui@framework package to resolve 0x1.
// Attention: Types need to be strictly defined in the overrides.
overrides: {
packages: { 'sui@framework': '0x2' },
types: {}
}
}));
Before / after example
ℹ️
The examples in the tabs are simplified for clarity. Actual addresses or names might differ.
Example of a PTB before MVR:
const transaction = new Transaction();
// testnet
// Notice how the suifren type has a V1 outer package id, and a V2 inner type package id,
// even if they are part of the same package upgrades.
transaction.moveCall({
target: `0xe177697e191327901637f8d2c5ffbbde8b1aaac27ec1024c4b62d1ebd1cd7430::accessories::equip`,
arguments: [..],
typeArguments: [
`0x80d7de9c4a56194087e0ba0bf59492aa8e6a5ee881606226930827085ddf2332::suifren::SuiFren<0x297d8afb6ede450529d347cf9254caeea2b685c8baef67b084122291ebaefb38::bullshark::Bullshark>`
]
});
// mainnet
transaction.moveCall({
target: `0x54800ebb4606fd0c03b4554976264373b3374eeb3fd63e7ff69f31cac786ba8c::accessories::equip`,
arguments: [..],
typeArguments: [
`0xee496a0cc04d06a345982ba6697c90c619020de9e274408c7819f787ff66e1a1::suifren::SuiFren<0x8894fa02fc6f36cbc485ae9145d05f247a78e220814fb8419ab261bd81f08f32::bullshark::Bullshark>`
]
});