Skip to content

Commit

Permalink
Frontend now uses MVR for PTBs (#79)
Browse files Browse the repository at this point in the history
* Use MVR for all PTBs in the FE

* nit

* Fix build'
  • Loading branch information
manolisliolios authored Dec 10, 2024
1 parent 6fd0277 commit 5ad6455
Show file tree
Hide file tree
Showing 11 changed files with 152 additions and 89 deletions.
8 changes: 4 additions & 4 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
},
"dependencies": {
"@hookform/resolvers": "^3.9.0",
"@mysten/dapp-kit": "^0.14.24",
"@mysten/kiosk": "^0.9.20",
"@mysten/sui": "^1.11.0",
"@mysten/suins": "^0.4.0",
"@mysten/dapp-kit": "^0.14.41",
"@mysten/kiosk": "^0.9.32",
"@mysten/sui": "^1.16.2",
"@mysten/suins": "^0.4.1",
"@radix-ui/react-accordion": "^1.2.0",
"@radix-ui/react-checkbox": "^1.1.1",
"@radix-ui/react-dialog": "^1.1.1",
Expand Down
119 changes: 78 additions & 41 deletions app/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/src/components/modals/apps/CreateOrUpdateApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { SuinsName } from "@/hooks/useOwnedSuiNSNames";
const formSchema = z
.object({
nsName: z.string().readonly(),
name: z.string().min(3),
name: z.string().min(1),
mainnet: z.string().nullable().optional(),
testnet: z.string().nullable().optional(),
acceptMainnetWarning: z.boolean().optional(),
Expand Down
21 changes: 21 additions & 0 deletions app/src/components/providers/client-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { getFullnodeUrl, SuiClient } from "@mysten/sui/client";
import { KioskClient, Network } from "@mysten/kiosk";
import { createContext, useContext } from "react";
import { SuiGraphQLClient } from "@mysten/sui/graphql";
import { namedPackagesPlugin, TransactionPlugin } from "@mysten/sui/transactions";

export type Clients = {
mainnet: SuiClient;
Expand All @@ -19,10 +20,26 @@ export type Clients = {
mainnet: SuiGraphQLClient;
testnet: SuiGraphQLClient;
};
mvrPlugin: {
mainnet: TransactionPlugin;
testnet: TransactionPlugin;
};
};

const mainnet = new SuiClient({ url: "https://suins-rpc.mainnet.sui.io:443" });

const testnetNamedPackagesPlugin = namedPackagesPlugin({
suiGraphQLClient: new SuiGraphQLClient({
url: 'https://mvr-rpc.sui-testnet.mystenlabs.com/graphql'
})
});

const mainnetNamedPackagesPlugin = namedPackagesPlugin({
suiGraphQLClient: new SuiGraphQLClient({
url: 'https://mvr-rpc.sui-mainnet.mystenlabs.com/graphql'
})
});

export const DefaultClients: Clients = {
mainnet,
testnet: new SuiClient({ url: "https://suins-rpc.testnet.sui.io:443" }),
Expand All @@ -42,6 +59,10 @@ export const DefaultClients: Clients = {
url: "https://mvr-rpc.sui-testnet.mystenlabs.com",
}),
},
mvrPlugin: {
mainnet: mainnetNamedPackagesPlugin,
testnet: testnetNamedPackagesPlugin,
},
};

export const SuiClientContext = createContext<Clients>(DefaultClients);
Expand Down
10 changes: 5 additions & 5 deletions app/src/data/on-chain-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const registerApp = ({
mainnetPackageInfo?: TransactionObjectArgument | string;
}) => {
const appCap = tx.moveCall({
target: `${Constants.appsPackageId}::move_registry::register`,
target: `@mvr/core::move_registry::register`,
arguments: [
tx.object(Constants.appsRegistryId),
tx.object(suinsObjectId),
Expand Down Expand Up @@ -52,7 +52,7 @@ export const assignMainnetPackage = ({
const pkgInfoArg = (typeof packageInfo === 'object' && 'objectId' in packageInfo) ? tx.object(packageInfo.objectId) : tx.object(packageInfo);

tx.moveCall({
target: `${Constants.appsPackageId}::move_registry::assign_package`,
target: `@mvr/core::move_registry::assign_package`,
arguments: [
tx.object(Constants.appsRegistryId),
tx.object(appCap),
Expand All @@ -76,7 +76,7 @@ export const setExternalNetwork = async ({
packageInfo: PackageInfoData;
}) => {
const appInfo = tx.moveCall({
target: `${Constants.appsPackageId}::app_info::new`,
target: `@mvr/core::app_info::new`,
arguments: [
tx.pure.option("address", packageInfo.objectId),
tx.pure.option("address", packageInfo.packageAddress),
Expand All @@ -85,7 +85,7 @@ export const setExternalNetwork = async ({
});

tx.moveCall({
target: `${Constants.appsPackageId}::move_registry::set_network`,
target: `@mvr/core::move_registry::set_network`,
arguments: [
tx.object(Constants.appsRegistryId),
tx.object(appCap),
Expand All @@ -109,7 +109,7 @@ export const unsetExternalNetwork = async ({
chainId: string;
}) => {
tx.moveCall({
target: `${Constants.appsPackageId}::move_registry::unset_network`,
target: `@mvr/core::move_registry::unset_network`,
arguments: [
tx.object(Constants.appsRegistryId),
tx.object(appCap),
Expand Down
Loading

0 comments on commit 5ad6455

Please sign in to comment.