diff --git a/app/package.json b/app/package.json index 8fdfe18..b74eaea 100644 --- a/app/package.json +++ b/app/package.json @@ -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", diff --git a/app/pnpm-lock.yaml b/app/pnpm-lock.yaml index 999cc70..b976082 100644 --- a/app/pnpm-lock.yaml +++ b/app/pnpm-lock.yaml @@ -12,17 +12,17 @@ importers: specifier: ^3.9.0 version: 3.9.0(react-hook-form@7.53.0(react@18.3.1)) '@mysten/dapp-kit': - specifier: ^0.14.24 - version: 0.14.24(@tanstack/react-query@5.55.4(react@18.3.1))(@types/react-dom@18.3.0)(@types/react@18.3.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.2) + specifier: ^0.14.41 + version: 0.14.41(@tanstack/react-query@5.55.4(react@18.3.1))(@types/react-dom@18.3.0)(@types/react@18.3.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.2) '@mysten/kiosk': - specifier: ^0.9.20 - version: 0.9.20(typescript@5.6.2) + specifier: ^0.9.32 + version: 0.9.32(typescript@5.6.2) '@mysten/sui': - specifier: ^1.11.0 - version: 1.11.0(typescript@5.6.2) + specifier: ^1.16.2 + version: 1.16.2(typescript@5.6.2) '@mysten/suins': - specifier: ^0.4.0 - version: 0.4.0(typescript@5.6.2) + specifier: ^0.4.1 + version: 0.4.1(typescript@5.6.2) '@radix-ui/react-accordion': specifier: ^1.2.0 version: 1.2.0(@types/react-dom@18.3.0)(@types/react@18.3.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -286,32 +286,36 @@ packages: '@jridgewell/trace-mapping@0.3.25': resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} - '@mysten/bcs@1.1.0': - resolution: {integrity: sha512-yy9/1Y4d0FlRywS1+9ze/T7refCbrvwFwJIOKs9M3QBK1njbcHZp+LkVeLqBvIJA5eZ3ZCzmhQ1Xq4Sed5mEBA==} + '@mysten/bcs@1.2.0': + resolution: {integrity: sha512-LuKonrGdGW7dq/EM6U2L9/as7dFwnhZnsnINzB/vu08Xfrj0qzWwpLOiXagAa5yZOPLK7anRZydMonczFkUPzA==} - '@mysten/dapp-kit@0.14.24': - resolution: {integrity: sha512-Ob6MQy6kACjn19T/LS9zujd0glajV1gFPjkc7raNEru1ue4pmeYfg0VYPBFDLH/ULsbxbAnQV1jp/xp4c3T6ew==} + '@mysten/dapp-kit@0.14.41': + resolution: {integrity: sha512-eywIo1wEqQrazlJIJRu1d9d5ZH4JKvJEkw1+W6MK8Cz0vW4rMiq4AEWYv8Cs/8wI1WzjiIqzDZX4w42l99mmGQ==} peerDependencies: '@tanstack/react-query': ^5.0.0 react: '*' - '@mysten/kiosk@0.9.20': - resolution: {integrity: sha512-HI58E7CQv7czw7ZxJLVrNJrMkpuXO8gDCK/AxEr+uNdvXqmamQiO8yv7a5sRr79sg7SmEbJTD9AWK+fJKimjQw==} + '@mysten/kiosk@0.9.32': + resolution: {integrity: sha512-YRpZXubnnEaJTyRyYX1b3e2E2Tgv22H97i+gNo85OiebH7zAJ7V+vHpgHjJ8ZFcM9OiTY32fIRvrIBmDvx71Fg==} engines: {node: '>=18'} - '@mysten/sui@1.11.0': - resolution: {integrity: sha512-+5kSXmoPFrecxUb+fweqqy4eXRpgvv6H51IwRzJbxlolE0AmnM+5IJbLpTlM5RNZEmmocE7p5bUn1OijbuDVkw==} + '@mysten/sui@1.16.1': + resolution: {integrity: sha512-UopFv/D73EIiRpP42BbD3YFAyWCeAnCh1ZS+uuk2aSIS/4+89TWKvWgES23kBdzLSL9/6O9jAP9JRmsZTtvqLw==} engines: {node: '>=18'} - '@mysten/suins@0.4.0': - resolution: {integrity: sha512-cDXrlhtDFw/WgtOvMvtXT3sTD8l7qaQhLKGM+oL2u7ccOxwxgpfcU8AX+57EcTVpblbGq4Bw49mMhImSMOIMOg==} + '@mysten/sui@1.16.2': + resolution: {integrity: sha512-1Nfm7iTs3IVsiCXFPrnci9Y7fP9ldtwNOTe7JRkaHTg58VRhSe/nhHOvt6UsYiswVPUBqlsSF73KER5MpirCvw==} + engines: {node: '>=18'} + + '@mysten/suins@0.4.1': + resolution: {integrity: sha512-5kkYe4VO5Z4enxioUoOTpjgviktL8HZldngDFrojlHJSinYeAs5NWmOy+bsOZOSqtOG0WkCrE8TVOd4duLK+9g==} engines: {node: '>=16'} - '@mysten/wallet-standard@0.13.6': - resolution: {integrity: sha512-WJmz/T2RduSRMOBTrgAEfYJZS2r9YmsUNwHbvmI0w4QHJudmLLdkjvtYOzKR2Cbylpw+lDohdxCZFQPuvPQlpQ==} + '@mysten/wallet-standard@0.13.17': + resolution: {integrity: sha512-f3masRTwD5qcQi9IWTqzxVayZd5daF1JIVolFU0vVxxQACOR7uBE6FyFlvTGSfpBnF1A8FQHrecANN+/0rdTTA==} - '@mysten/zksend@0.11.5': - resolution: {integrity: sha512-/zDXOM6NGfy2bUR5VYs3Y3IGJOuukInyswreOvZUN5EFXWq+PZ8Pz/4ERQ8BI9aarKJN22SpzjYbGzMVm72fEA==} + '@mysten/zksend@0.12.7': + resolution: {integrity: sha512-Kz9Jy9Ssp1twUQt2wZYfmMxoxKfmaVLVFBrR3sjHgKER+Jvk+L+7gjLczoQ2T4K9zPMEAfcQyUbc/sjn2G/Qrw==} '@next/env@14.2.9': resolution: {integrity: sha512-hnDAoDPMii31V0ivibI8p6b023jOF1XblWTVjsDUoZKwnZlaBtJFZKDwFqi22R8r9i6W08dThUWU7Bsh2Rg8Ww==} @@ -1993,6 +1997,9 @@ packages: resolution: {integrity: sha512-2yTgeWTWzMWkHu6Jp9NKgePDaYHbntiwvYuuJLbbN9vl7DC9DvXKOB2BC3ZZ92D3cvV/aflH0osDfwpHepQ53w==} hasBin: true + jose@5.9.6: + resolution: {integrity: sha512-AMlnetc9+CV9asI19zHmrgS/WYsWUwCn2R7RzlbJWD7F9eWYUTGyBmU9o6PxngtLGOiDGPRu+Uc4fhKzbpteZQ==} + js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} @@ -2235,6 +2242,9 @@ packages: resolution: {integrity: sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==} engines: {node: '>= 6'} + poseidon-lite@0.2.1: + resolution: {integrity: sha512-xIr+G6HeYfOhCuswdqcFpSX47SPhm0EpisWJ6h7fHlWwaVIvH3dLnejpatrtw6Xc6HaLrpq05y7VRfvDmDGIog==} + possible-typed-array-names@1.0.0: resolution: {integrity: sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==} engines: {node: '>= 0.4'} @@ -2917,15 +2927,15 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.0 - '@mysten/bcs@1.1.0': + '@mysten/bcs@1.2.0': dependencies: bs58: 6.0.0 - '@mysten/dapp-kit@0.14.24(@tanstack/react-query@5.55.4(react@18.3.1))(@types/react-dom@18.3.0)(@types/react@18.3.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.2)': + '@mysten/dapp-kit@0.14.41(@tanstack/react-query@5.55.4(react@18.3.1))(@types/react-dom@18.3.0)(@types/react@18.3.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.2)': dependencies: - '@mysten/sui': 1.11.0(typescript@5.6.2) - '@mysten/wallet-standard': 0.13.6(typescript@5.6.2) - '@mysten/zksend': 0.11.5(typescript@5.6.2) + '@mysten/sui': 1.16.1(typescript@5.6.2) + '@mysten/wallet-standard': 0.13.17(typescript@5.6.2) + '@mysten/zksend': 0.12.7(typescript@5.6.2) '@radix-ui/react-dialog': 1.1.1(@types/react-dom@18.3.0)(@types/react@18.3.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@radix-ui/react-dropdown-menu': 2.1.1(@types/react-dom@18.3.0)(@types/react@18.3.5)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@radix-ui/react-slot': 1.1.0(@types/react@18.3.5)(react@18.3.1) @@ -2946,18 +2956,18 @@ snapshots: - react-dom - typescript - '@mysten/kiosk@0.9.20(typescript@5.6.2)': + '@mysten/kiosk@0.9.32(typescript@5.6.2)': dependencies: - '@mysten/sui': 1.11.0(typescript@5.6.2) + '@mysten/sui': 1.16.2(typescript@5.6.2) transitivePeerDependencies: - '@gql.tada/svelte-support' - '@gql.tada/vue-support' - typescript - '@mysten/sui@1.11.0(typescript@5.6.2)': + '@mysten/sui@1.16.1(typescript@5.6.2)': dependencies: '@graphql-typed-document-node/core': 3.2.0(graphql@16.9.0) - '@mysten/bcs': 1.1.0 + '@mysten/bcs': 1.2.0 '@noble/curves': 1.6.0 '@noble/hashes': 1.5.0 '@scure/bip32': 1.5.0 @@ -2966,6 +2976,8 @@ snapshots: bech32: 2.0.0 gql.tada: 1.8.7(graphql@16.9.0)(typescript@5.6.2) graphql: 16.9.0 + jose: 5.9.6 + poseidon-lite: 0.2.1 tweetnacl: 1.0.3 valibot: 0.36.0 transitivePeerDependencies: @@ -2973,27 +2985,48 @@ snapshots: - '@gql.tada/vue-support' - typescript - '@mysten/suins@0.4.0(typescript@5.6.2)': + '@mysten/sui@1.16.2(typescript@5.6.2)': dependencies: - '@mysten/sui': 1.11.0(typescript@5.6.2) + '@graphql-typed-document-node/core': 3.2.0(graphql@16.9.0) + '@mysten/bcs': 1.2.0 + '@noble/curves': 1.6.0 + '@noble/hashes': 1.5.0 + '@scure/bip32': 1.5.0 + '@scure/bip39': 1.4.0 + '@suchipi/femver': 1.0.0 + bech32: 2.0.0 + gql.tada: 1.8.7(graphql@16.9.0)(typescript@5.6.2) + graphql: 16.9.0 + jose: 5.9.6 + poseidon-lite: 0.2.1 + tweetnacl: 1.0.3 + valibot: 0.36.0 transitivePeerDependencies: - '@gql.tada/svelte-support' - '@gql.tada/vue-support' - typescript - '@mysten/wallet-standard@0.13.6(typescript@5.6.2)': + '@mysten/suins@0.4.1(typescript@5.6.2)': dependencies: - '@mysten/sui': 1.11.0(typescript@5.6.2) + '@mysten/sui': 1.16.2(typescript@5.6.2) + transitivePeerDependencies: + - '@gql.tada/svelte-support' + - '@gql.tada/vue-support' + - typescript + + '@mysten/wallet-standard@0.13.17(typescript@5.6.2)': + dependencies: + '@mysten/sui': 1.16.1(typescript@5.6.2) '@wallet-standard/core': 1.0.3 transitivePeerDependencies: - '@gql.tada/svelte-support' - '@gql.tada/vue-support' - typescript - '@mysten/zksend@0.11.5(typescript@5.6.2)': + '@mysten/zksend@0.12.7(typescript@5.6.2)': dependencies: - '@mysten/sui': 1.11.0(typescript@5.6.2) - '@mysten/wallet-standard': 0.13.6(typescript@5.6.2) + '@mysten/sui': 1.16.1(typescript@5.6.2) + '@mysten/wallet-standard': 0.13.17(typescript@5.6.2) mitt: 3.0.1 nanostores: 0.10.3 valibot: 0.36.0 @@ -4388,7 +4421,7 @@ snapshots: debug: 4.3.7 enhanced-resolve: 5.17.1 eslint: 9.10.0(jiti@1.21.6) - eslint-module-utils: 2.11.0(@typescript-eslint/parser@7.2.0(eslint@9.10.0(jiti@1.21.6))(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.2.0(eslint@9.10.0(jiti@1.21.6))(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0)(eslint@9.10.0(jiti@1.21.6)))(eslint@9.10.0(jiti@1.21.6)) + eslint-module-utils: 2.11.0(@typescript-eslint/parser@7.2.0(eslint@9.10.0(jiti@1.21.6))(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@9.10.0(jiti@1.21.6)) fast-glob: 3.3.2 get-tsconfig: 4.8.0 is-bun-module: 1.2.1 @@ -4401,7 +4434,7 @@ snapshots: - eslint-import-resolver-webpack - supports-color - eslint-module-utils@2.11.0(@typescript-eslint/parser@7.2.0(eslint@9.10.0(jiti@1.21.6))(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.2.0(eslint@9.10.0(jiti@1.21.6))(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0)(eslint@9.10.0(jiti@1.21.6)))(eslint@9.10.0(jiti@1.21.6)): + eslint-module-utils@2.11.0(@typescript-eslint/parser@7.2.0(eslint@9.10.0(jiti@1.21.6))(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@9.10.0(jiti@1.21.6)): dependencies: debug: 3.2.7 optionalDependencies: @@ -4423,7 +4456,7 @@ snapshots: doctrine: 2.1.0 eslint: 9.10.0(jiti@1.21.6) eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.11.0(@typescript-eslint/parser@7.2.0(eslint@9.10.0(jiti@1.21.6))(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.2.0(eslint@9.10.0(jiti@1.21.6))(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.30.0)(eslint@9.10.0(jiti@1.21.6)))(eslint@9.10.0(jiti@1.21.6)) + eslint-module-utils: 2.11.0(@typescript-eslint/parser@7.2.0(eslint@9.10.0(jiti@1.21.6))(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@9.10.0(jiti@1.21.6)) hasown: 2.0.2 is-core-module: 2.15.1 is-glob: 4.0.3 @@ -4881,6 +4914,8 @@ snapshots: jiti@1.21.6: {} + jose@5.9.6: {} + js-tokens@4.0.0: {} js-yaml@4.1.0: @@ -5107,6 +5142,8 @@ snapshots: pirates@4.0.6: {} + poseidon-lite@0.2.1: {} + possible-typed-array-names@1.0.0: {} postcss-import@15.1.0(postcss@8.4.45): diff --git a/app/src/components/modals/apps/CreateOrUpdateApp.tsx b/app/src/components/modals/apps/CreateOrUpdateApp.tsx index 4c57659..9956330 100644 --- a/app/src/components/modals/apps/CreateOrUpdateApp.tsx +++ b/app/src/components/modals/apps/CreateOrUpdateApp.tsx @@ -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(), diff --git a/app/src/components/providers/client-provider.tsx b/app/src/components/providers/client-provider.tsx index 6adcf31..b6852f5 100644 --- a/app/src/components/providers/client-provider.tsx +++ b/app/src/components/providers/client-provider.tsx @@ -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; @@ -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" }), @@ -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(DefaultClients); diff --git a/app/src/data/on-chain-app.ts b/app/src/data/on-chain-app.ts index ef6cd02..a7fb059 100644 --- a/app/src/data/on-chain-app.ts +++ b/app/src/data/on-chain-app.ts @@ -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), @@ -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), @@ -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), @@ -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), @@ -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), diff --git a/app/src/data/package-info.ts b/app/src/data/package-info.ts index 1393ac4..5794575 100644 --- a/app/src/data/package-info.ts +++ b/app/src/data/package-info.ts @@ -19,16 +19,13 @@ export type GithubPackageInfo = { export class PackageInfo { transaction: Transaction; - packageId: string; info: TransactionObjectArgument | string | undefined; constructor( transaction: Transaction, - packageId: string, packageInfo?: TransactionObjectArgument | string, ) { this.transaction = transaction; - this.packageId = packageId; if (packageInfo) this.info = this.transaction.object(packageInfo); return this; @@ -38,7 +35,7 @@ export class PackageInfo { if (this.info) throw new Error("PackageInfo already initialized"); this.info = this.transaction.moveCall({ - target: `${this.packageId}::package_info::new`, + target: `@mvr/metadata::package_info::new`, arguments: [this.transaction.object(upgradeCap)], }); @@ -54,7 +51,7 @@ export class PackageInfo { this.#checkInitialized(); const display = this.transaction.moveCall({ - target: `${this.packageId}::display::new`, + target: `@mvr/metadata::display::new`, arguments: [ this.transaction.pure.string(label), this.transaction.pure.string(gradientFrom), @@ -64,7 +61,7 @@ export class PackageInfo { }); this.transaction.moveCall({ - target: `${this.packageId}::package_info::set_display`, + target: `@mvr/metadata::package_info::set_display`, arguments: [this.transaction.object(this.info!), display], }); @@ -75,7 +72,7 @@ export class PackageInfo { this.#checkInitialized(); const git = this.transaction.moveCall({ - target: `${this.packageId}::git::new`, + target: `@mvr/metadata::git::new`, arguments: [ this.transaction.pure.string(gitInfo.gitRepository), this.transaction.pure.string(gitInfo.gitSubdirectory), @@ -84,7 +81,7 @@ export class PackageInfo { }); this.transaction.moveCall({ - target: `${this.packageId}::package_info::set_git_versioning`, + target: `@mvr/metadata::package_info::set_git_versioning`, arguments: [ this.transaction.object(this.info!), this.transaction.pure.u64(version), @@ -104,7 +101,7 @@ export class PackageInfo { }) { this.#checkInitialized(); this.transaction.moveCall({ - target: `${this.packageId}::package_info::transfer`, + target: `@mvr/metadata::package_info::transfer`, arguments: [ this.transaction.object(this.info!), selfTransfer ? sender(this.transaction) : to!, diff --git a/app/src/hooks/useTransactionExecution.tsx b/app/src/hooks/useTransactionExecution.tsx index 376ece2..b0100cc 100644 --- a/app/src/hooks/useTransactionExecution.tsx +++ b/app/src/hooks/useTransactionExecution.tsx @@ -4,12 +4,19 @@ import { useSignTransaction } from '@mysten/dapp-kit'; import { useState } from 'react'; import {toast} from 'sonner'; import { Transaction } from '@mysten/sui/transactions'; -import { SuiClient, SuiTransactionBlockResponse } from '@mysten/sui/client'; +import { SuiTransactionBlockResponse } from '@mysten/sui/client'; import { isValidSuiAddress, toB64 } from '@mysten/sui/utils'; import { useMVRContext } from '@/components/providers/mvr-provider'; +import { useSuiClientsContext } from '@/components/providers/client-provider'; -export function useTransactionExecution(client: SuiClient) { +export function useTransactionExecution(network: 'mainnet' | 'testnet') { const { isCustom, customAddress } = useMVRContext(); + const clients = useSuiClientsContext(); + const client = clients[network]; + + // register the plugin based on the selected network. + Transaction.registerGlobalSerializationPlugin('namedPackagesPlugin', clients.mvrPlugin[network]); + const { mutateAsync: signTransaction } = useSignTransaction(); const [txData, setTxData] = useState(undefined); @@ -42,7 +49,8 @@ export function useTransactionExecution(client: SuiClient) { try { const signature = await signTransaction({ - transaction: tx, + // @ts-ignore temporary due to dapp-kit not deploying. + transaction: tx!, }); const res = await client.executeTransactionBlock({ diff --git a/app/src/lib/constants.ts b/app/src/lib/constants.ts index 2370b57..5ca351c 100644 --- a/app/src/lib/constants.ts +++ b/app/src/lib/constants.ts @@ -1,14 +1,19 @@ /** App-wide global constants */ export const Constants = { - appsPackageId: '0x62c1f5b1cb9e3bfc3dd1f73c95066487b662048a6358eabdbf67f6cdeca6db4b', - appsRegistryTableId: '0xe8417c530cde59eddf6dfb760e8a0e3e2c6f17c69ddaab5a73dd6a6e65fc463b', - appsRegistryId: '0x0e5d473a055b6b7d014af557a13ad9075157fdc19b6d51562a18511afd397727', + appsPackageId: + "0x62c1f5b1cb9e3bfc3dd1f73c95066487b662048a6358eabdbf67f6cdeca6db4b", + appsRegistryTableId: + "0xe8417c530cde59eddf6dfb760e8a0e3e2c6f17c69ddaab5a73dd6a6e65fc463b", + appsRegistryId: + "0x0e5d473a055b6b7d014af557a13ad9075157fdc19b6d51562a18511afd397727", - // TODO: Replace this logic with MVR logic once GQL is out. - packageInfoIds: { - mainnet: "0x0f6b71233780a3f362137b44ac219290f4fd34eb81e0cb62ddf4bb38d1f9a3a1", - testnet: "0xb96f44d08ae214887cae08d8ae061bbf6f0908b1bfccb710eea277f45150b9f4", - devnet: "", - localnet: '', - } -} + // TODO: Replace this logic with MVR logic once GQL is out. + packageInfoIds: { + mainnet: + "0x0f6b71233780a3f362137b44ac219290f4fd34eb81e0cb62ddf4bb38d1f9a3a1", + testnet: + "0xb96f44d08ae214887cae08d8ae061bbf6f0908b1bfccb710eea277f45150b9f4", + devnet: "", + localnet: "", + }, +}; diff --git a/app/src/lib/utils.ts b/app/src/lib/utils.ts index 98da726..19b2288 100644 --- a/app/src/lib/utils.ts +++ b/app/src/lib/utils.ts @@ -6,8 +6,6 @@ export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)) } - - export function sender(tx: Transaction) { return tx.moveCall({ target: '0x2::tx_context::sender' diff --git a/app/src/mutations/appMutations.ts b/app/src/mutations/appMutations.ts index 1582746..fd3b298 100644 --- a/app/src/mutations/appMutations.ts +++ b/app/src/mutations/appMutations.ts @@ -9,6 +9,7 @@ import { useChainIdentifier } from "@/hooks/useChainIdentifier"; import { AppRecord } from "@/hooks/useGetApp"; import { SuinsName } from "@/hooks/useOwnedSuiNSNames"; import { useTransactionExecution } from "@/hooks/useTransactionExecution"; +import { sender } from "@/lib/utils"; import { type PackageInfoData } from "@/utils/types"; import { KioskTransaction } from "@mysten/kiosk"; import { @@ -17,8 +18,8 @@ import { import { useMutation } from "@tanstack/react-query"; export function useCreateAppMutation() { - const { mainnet: client, kiosk: {mainnet: kioskClient } } = useSuiClientsContext(); - const { executeTransaction } = useTransactionExecution(client); + const { kiosk: {mainnet: kioskClient } } = useSuiClientsContext(); + const { executeTransaction } = useTransactionExecution('mainnet'); const { data: testnetChainIdentifier } = useChainIdentifier("testnet"); return useMutation({ @@ -83,9 +84,11 @@ export function useCreateAppMutation() { tx.transferObjects( [appCap], - tx.moveCall({ target: `0x2::tx_context::sender` }), + sender(tx), ); + // console.log(tx.getData()); + const res = await executeTransaction(tx); return res; }, @@ -94,7 +97,7 @@ export function useCreateAppMutation() { export function useUpdateAppMutation() { const { mainnet: client } = useSuiClientsContext(); - const { executeTransaction } = useTransactionExecution(client); + const { executeTransaction } = useTransactionExecution('mainnet'); const { data: testnetChainIdentifier } = useChainIdentifier("testnet"); return useMutation({ diff --git a/app/src/mutations/packageInfoMutations.ts b/app/src/mutations/packageInfoMutations.ts index f686c30..e067d0c 100644 --- a/app/src/mutations/packageInfoMutations.ts +++ b/app/src/mutations/packageInfoMutations.ts @@ -1,16 +1,12 @@ -import { useSuiClientsContext } from "@/components/providers/client-provider"; import { PackageInfo } from "@/data/package-info"; import { useTransactionExecution } from "@/hooks/useTransactionExecution"; import { GitVersion } from "@/hooks/useVersionsTable"; -import { Constants } from "@/lib/constants"; import { Network, PackageDisplayType } from "@/utils/types"; import { Transaction } from "@mysten/sui/transactions"; import { useMutation } from "@tanstack/react-query"; export function useCreatePackageInfoMutation(network: Network) { - const { [network]: client } = useSuiClientsContext(); - - const { executeTransaction } = useTransactionExecution(client); + const { executeTransaction } = useTransactionExecution(network as 'mainnet' | 'testnet'); return useMutation({ mutationKey: ["create-package-info"], @@ -28,7 +24,7 @@ export function useCreatePackageInfoMutation(network: Network) { if (!upgradeCapId) throw new Error("upgradeCapId is required"); // Call the API to create a new package info object - const packageInfo = new PackageInfo(tx, Constants.packageInfoIds[network]); + const packageInfo = new PackageInfo(tx); packageInfo.new(upgradeCapId); packageInfo.setDisplay( @@ -49,8 +45,7 @@ export function useCreatePackageInfoMutation(network: Network) { } export function useUpdatePackageInfoMutation(network: Network) { - const { [network]: client } = useSuiClientsContext(); - const { executeTransaction } = useTransactionExecution(client); + const { executeTransaction } = useTransactionExecution(network as 'mainnet' | 'testnet'); return useMutation({ mutationKey: ["update-package-info"], @@ -70,7 +65,6 @@ export function useUpdatePackageInfoMutation(network: Network) { // Call the API to create a new package info object const packageInfo = new PackageInfo( tx, - Constants.packageInfoIds[network], packageInfoId, );