diff --git a/.changeset/consolidate-graphql-schemas.md b/.changeset/consolidate-graphql-schemas.md new file mode 100644 index 000000000..7c7b34a19 --- /dev/null +++ b/.changeset/consolidate-graphql-schemas.md @@ -0,0 +1,11 @@ +--- +'@mysten/sui': major +--- + +Consolidate GraphQL schema exports into a single version: + +- Removed versioned schema exports: `@mysten/sui/graphql/schemas/2024.1`, `@mysten/sui/graphql/schemas/2024.4`, `@mysten/sui/graphql/schemas/latest` +- Added single unified schema export: `@mysten/sui/graphql/schema` +- The SDK now tracks only the latest mainnet GraphQL schema version + +See the migration guide for updating your code to use the new export diff --git a/.changeset/curly-boxes-follow.md b/.changeset/curly-boxes-follow.md new file mode 100644 index 000000000..e7dba4469 --- /dev/null +++ b/.changeset/curly-boxes-follow.md @@ -0,0 +1,5 @@ +--- +'@mysten/dapp-kit': minor +--- + +Remove reportTransactionEffects feature diff --git a/.changeset/dry-dingos-raise.md b/.changeset/dry-dingos-raise.md new file mode 100644 index 000000000..66ba967e7 --- /dev/null +++ b/.changeset/dry-dingos-raise.md @@ -0,0 +1,6 @@ +--- +'@mysten/walrus': minor +'@mysten/seal': minor +--- + +remove asClientExtension static method diff --git a/.changeset/dull-bikes-bet.md b/.changeset/dull-bikes-bet.md new file mode 100644 index 000000000..40ce8bb86 --- /dev/null +++ b/.changeset/dull-bikes-bet.md @@ -0,0 +1,5 @@ +--- +'@mysten/sui': patch +--- + +Change private key data on keypairs to be private fields to prevent accidental logging. diff --git a/.changeset/fair-laws-jog.md b/.changeset/fair-laws-jog.md new file mode 100644 index 000000000..78536de5a --- /dev/null +++ b/.changeset/fair-laws-jog.md @@ -0,0 +1,5 @@ +--- +'@mysten/walrus': minor +--- + +WalrusClient can no longer be created with only an rpc url, pass in a Client instead diff --git a/.changeset/fruity-cats-grab.md b/.changeset/fruity-cats-grab.md new file mode 100644 index 000000000..db0677ccb --- /dev/null +++ b/.changeset/fruity-cats-grab.md @@ -0,0 +1,5 @@ +--- +'@mysten/sui': major +--- + +Remove default client used for verifying zklogin signatures diff --git a/.changeset/honest-cows-shave.md b/.changeset/honest-cows-shave.md new file mode 100644 index 000000000..d430645a9 --- /dev/null +++ b/.changeset/honest-cows-shave.md @@ -0,0 +1,5 @@ +--- +'@mysten/sui': major +--- + +`network` is now a required option on SuiGraphQLClient and SuiJsonRpcClient diff --git a/.changeset/little-chefs-shake.md b/.changeset/little-chefs-shake.md new file mode 100644 index 000000000..fb15e6381 --- /dev/null +++ b/.changeset/little-chefs-shake.md @@ -0,0 +1,5 @@ +--- +'@mysten/sui': major +--- + +Make legacyAddress parameter in all methods to reduce confusion and inconsistency around default values diff --git a/.changeset/mean-bikes-drum.md b/.changeset/mean-bikes-drum.md new file mode 100644 index 000000000..0b4d6f089 --- /dev/null +++ b/.changeset/mean-bikes-drum.md @@ -0,0 +1,5 @@ +--- +'@mysten/wallet-standard': minor +--- + +Remove reportTransactionEffects feature diff --git a/.changeset/remove-bcs-deprecated-exports.md b/.changeset/remove-bcs-deprecated-exports.md new file mode 100644 index 000000000..7b54cebaf --- /dev/null +++ b/.changeset/remove-bcs-deprecated-exports.md @@ -0,0 +1,5 @@ +--- +'@mysten/bcs': major +--- + +Remove deprecated exports: `toB58`, `fromB58`, `toB64`, `fromB64`, `toHEX`, `fromHEX`. Use `toBase58`, `fromBase58`, `toBase64`, `fromBase64`, `toHex`, `fromHex` instead. diff --git a/.changeset/remove-kiosk-deprecated-params.md b/.changeset/remove-kiosk-deprecated-params.md new file mode 100644 index 000000000..447c132bc --- /dev/null +++ b/.changeset/remove-kiosk-deprecated-params.md @@ -0,0 +1,5 @@ +--- +'@mysten/kiosk': minor +--- + +Remove deprecated `transactionBlock` parameter from `KioskTransaction`, `TransferPolicyTransaction`, and `RuleResolvingParams`. Use `transaction` parameter instead. diff --git a/.changeset/remove-signers-deprecated-methods.md b/.changeset/remove-signers-deprecated-methods.md new file mode 100644 index 000000000..60933e47c --- /dev/null +++ b/.changeset/remove-signers-deprecated-methods.md @@ -0,0 +1,5 @@ +--- +'@mysten/signers': minor +--- + +Remove deprecated `signData()` method from `AwsKmsSigner`, `GcpKmsSigner`, and `MultiSigSigner`. Use `sign()` method instead. diff --git a/.changeset/remove-suiclient-exports.md b/.changeset/remove-suiclient-exports.md new file mode 100644 index 000000000..d99b8f7e3 --- /dev/null +++ b/.changeset/remove-suiclient-exports.md @@ -0,0 +1,25 @@ +--- +'@mysten/sui': major +--- + +Remove SuiClient exports from @mysten/sui/client + +BREAKING CHANGE: All exports from `@mysten/sui/client` have been removed. Use `@mysten/sui/jsonRpc` instead: + +- `SuiClient` -> `SuiJsonRpcClient` +- `SuiClientOptions` -> `SuiJsonRpcClientOptions` +- `isSuiClient` -> `isSuiJsonRpcClient` +- `SuiTransport` -> `JsonRpcTransport` +- `getFullnodeUrl` -> `getJsonRpcFullnodeUrl` + +Migration example: + +```ts +// Before +import { SuiClient, getFullnodeUrl } from '@mysten/sui/client'; +const client = new SuiClient({ url: getFullnodeUrl('devnet'), network: 'devnet' }); + +// After +import { SuiJsonRpcClient, getJsonRpcFullnodeUrl } from '@mysten/sui/jsonRpc'; +const client = new SuiJsonRpcClient({ url: getJsonRpcFullnodeUrl('devnet'), network: 'devnet' }); +``` diff --git a/.changeset/remove-typescript-deprecated-exports.md b/.changeset/remove-typescript-deprecated-exports.md new file mode 100644 index 000000000..7219beed0 --- /dev/null +++ b/.changeset/remove-typescript-deprecated-exports.md @@ -0,0 +1,15 @@ +--- +'@mysten/sui': major +--- + +Remove deprecated exports and properties: + +- Removed `fromB64`, `toB64`, `fromHEX`, `toHEX` exports from utils (use `fromBase64`, `toBase64`, `fromHex`, `toHex` instead) +- Removed `schema` property from `ParsedKeypair` (use `scheme` instead) +- Removed `requestType` parameter from `executeTransactionBlock` +- Removed deprecated faucet methods: `requestSuiFromFaucetV0`, `requestSuiFromFaucetV1`, `getFaucetRequestStatus` (use `requestSuiFromFaucetV2` instead) +- Removed deprecated subscription methods: `subscribeEvent`, `subscribeTransaction` +- Removed `blockData` property from Transaction class (use `getData()` instead) +- Removed `gasConfig` property from TransactionDataBuilder (use `gasData` instead) +- Removed `NamedPackagesPluginCache` type export (use `NamedPackagesOverrides` instead) +- Removed unnamed plugin registration methods from Transaction class diff --git a/.changeset/stabilize-experimental-client-api.md b/.changeset/stabilize-experimental-client-api.md new file mode 100644 index 000000000..63844af75 --- /dev/null +++ b/.changeset/stabilize-experimental-client-api.md @@ -0,0 +1,15 @@ +--- +'@mysten/sui': major +--- + +Stabilize experimental client API by moving it from `@mysten/sui/experimental` to `@mysten/sui/client`: + +- Moved client implementation from `src/experimental/` to `src/client/` +- Removed `Experimental_` prefix from all client types and classes +- Updated all internal packages to use the new stable API + +Breaking changes: + +- `@mysten/sui/experimental` module has been removed +- All `Experimental_` prefixed types/classes have been renamed (e.g., `Experimental_CoreClient` → `CoreClient`) +- Client types namespace changed from `Experimental_SuiClientTypes` to `SuiClientTypes` diff --git a/.changeset/update-all-packages-suiclient.md b/.changeset/update-all-packages-suiclient.md new file mode 100644 index 000000000..65cd39791 --- /dev/null +++ b/.changeset/update-all-packages-suiclient.md @@ -0,0 +1,19 @@ +--- +'@mysten/dapp-kit': minor +'@mysten/kiosk': minor +'@mysten/deepbook': minor +'@mysten/deepbook-v3': minor +'@mysten/suins': minor +'@mysten/walrus': minor +'@mysten/zksend': minor +'@mysten/codegen': minor +'@mysten/enoki': minor +'@mysten/payment-kit': minor +'@mysten/seal': minor +'@mysten/signers': minor +'@mysten/wallet-sdk': minor +--- + +Update to use SuiJsonRpcClient instead of SuiClient + +Updated all type signatures, internal usages, examples, and documentation to use `SuiJsonRpcClient` from `@mysten/sui/jsonRpc` instead of the deprecated `SuiClient` from `@mysten/sui/client`. diff --git a/.eslintrc.js b/.eslintrc.js index 48bc6dfc3..8a1464b61 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -38,6 +38,7 @@ module.exports = { 'packages/move-bytecode-template', 'packages/walrus-wasm', 'packages/walrus/src/node-api', + 'packages/walrus/src/contracts', 'generated', 'vite-env.d.ts', ], diff --git a/packages/bcs/src/index.ts b/packages/bcs/src/index.ts index 8c84e675b..88f6e6c17 100644 --- a/packages/bcs/src/index.ts +++ b/packages/bcs/src/index.ts @@ -62,21 +62,3 @@ export { type EnumInputShape, type EnumOutputShapeWithKeys, }; - -/** @deprecated use toBase58 instead */ -export const toB58 = toBase58; - -/** @deprecated use fromBase58 instead */ -export const fromB58 = fromBase58; - -/** @deprecated use toBase64 instead */ -export const toB64 = toBase64; - -/** @deprecated use fromBase64 instead */ -export const fromB64 = fromBase64; - -/** @deprecated use toHex instead */ -export const toHEX = toHex; - -/** @deprecated use fromHex instead */ -export const fromHEX = fromHex; diff --git a/packages/codegen/README.md b/packages/codegen/README.md index 3ecb3d356..ecb00be4e 100644 --- a/packages/codegen/README.md +++ b/packages/codegen/README.md @@ -31,8 +31,8 @@ export default config; ``` The `package` field should be the MVR name for your move package. If you have not registered your -package on MVR yet, you can use the `@local-pkg` scope, and set up an override in your `SuiClient` -to resolve it to the correct address. +package on MVR yet, you can use the `@local-pkg` scope, and set up an override in your +`SuiJsonRpcClient` to resolve it to the correct address. ## Generating code @@ -65,14 +65,14 @@ or by adding something the following script to your package.json and running `pn } ``` -## Setting up SuiClient +## Setting up SuiJsonRpcClient If your package is registered on MVR, the generated code should work without additional -configuration. If you are using a `@local-pkg` name, you will need to configure your `SuiClient` to -resolver the package name correctly: +configuration. If you are using a `@local-pkg` name, you will need to configure your +`SuiJsonRpcClient` to resolver the package name correctly: ```ts -const client = new SuiClient({ +const client = new SuiJsonRpcClient({ network: 'testnet', url: testnetRpcUrl, mvr: { @@ -90,7 +90,7 @@ If you are using `dapp-kit`, you may need to set up your network config and `Sui ```ts const { networkConfig, useNetworkVariable, useNetworkVariables } = createNetworkConfig({ testnet: { - url: getFullnodeUrl('testnet'), + url: getJsonRpcFullnodeUrl('testnet'), variables: { yourPackageId: YOUR_TESTNET_PACKAGE_ID, }, @@ -103,7 +103,7 @@ const { networkConfig, useNetworkVariable, useNetworkVariables } = createNetwork networks={networkConfig} defaultNetwork="testnet" createClient={(network, config) => { - return new SuiClient({ + return new SuiJsonRpcClient({ network, url: config.url, mvr: { diff --git a/packages/create-dapp/templates/react-client-dapp/src/networkConfig.ts b/packages/create-dapp/templates/react-client-dapp/src/networkConfig.ts index 96de92158..97bc1ee6b 100644 --- a/packages/create-dapp/templates/react-client-dapp/src/networkConfig.ts +++ b/packages/create-dapp/templates/react-client-dapp/src/networkConfig.ts @@ -1,16 +1,19 @@ -import { getFullnodeUrl } from "@mysten/sui/client"; +import { getJsonRpcFullnodeUrl } from "@mysten/sui/jsonRpc"; import { createNetworkConfig } from "@mysten/dapp-kit"; const { networkConfig, useNetworkVariable, useNetworkVariables } = createNetworkConfig({ devnet: { - url: getFullnodeUrl("devnet"), + url: getJsonRpcFullnodeUrl("devnet"), + network: "devnet", }, testnet: { - url: getFullnodeUrl("testnet"), + url: getJsonRpcFullnodeUrl("testnet"), + network: "testnet", }, mainnet: { - url: getFullnodeUrl("mainnet"), + url: getJsonRpcFullnodeUrl("mainnet"), + network: "mainnet", }, }); diff --git a/packages/create-dapp/templates/react-e2e-counter/src/networkConfig.ts b/packages/create-dapp/templates/react-e2e-counter/src/networkConfig.ts index 7b6f8b73d..351931614 100644 --- a/packages/create-dapp/templates/react-e2e-counter/src/networkConfig.ts +++ b/packages/create-dapp/templates/react-e2e-counter/src/networkConfig.ts @@ -1,4 +1,4 @@ -import { getFullnodeUrl } from "@mysten/sui/client"; +import { getJsonRpcFullnodeUrl } from "@mysten/sui/jsonRpc"; import { DEVNET_COUNTER_PACKAGE_ID, TESTNET_COUNTER_PACKAGE_ID, @@ -9,19 +9,22 @@ import { createNetworkConfig } from "@mysten/dapp-kit"; const { networkConfig, useNetworkVariable, useNetworkVariables } = createNetworkConfig({ devnet: { - url: getFullnodeUrl("devnet"), + url: getJsonRpcFullnodeUrl("devnet"), + network: "devnet", variables: { counterPackageId: DEVNET_COUNTER_PACKAGE_ID, }, }, testnet: { - url: getFullnodeUrl("testnet"), + url: getJsonRpcFullnodeUrl("testnet"), + network: "testnet", variables: { counterPackageId: TESTNET_COUNTER_PACKAGE_ID, }, }, mainnet: { - url: getFullnodeUrl("mainnet"), + url: getJsonRpcFullnodeUrl("mainnet"), + network: "mainnet", variables: { counterPackageId: MAINNET_COUNTER_PACKAGE_ID, }, diff --git a/packages/dapp-kit-next/examples/next-js/simple/app/dApp-kit.ts b/packages/dapp-kit-next/examples/next-js/simple/app/dApp-kit.ts index 6ac309dac..c6f3a4115 100644 --- a/packages/dapp-kit-next/examples/next-js/simple/app/dApp-kit.ts +++ b/packages/dapp-kit-next/examples/next-js/simple/app/dApp-kit.ts @@ -2,14 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 import { createDAppKit } from '@mysten/dapp-kit-react'; -import { getFullnodeUrl, SuiClient } from '@mysten/sui/client'; +import { getJsonRpcFullnodeUrl, SuiJsonRpcClient } from '@mysten/sui/jsonRpc'; export const dAppKit = createDAppKit({ enableBurnerWallet: process.env.NODE_ENV === 'development', networks: ['mainnet', 'testnet'], defaultNetwork: 'testnet', createClient(network) { - return new SuiClient({ network, url: getFullnodeUrl(network) }); + return new SuiJsonRpcClient({ network, url: getJsonRpcFullnodeUrl(network) }); }, }); diff --git a/packages/dapp-kit-next/examples/next-js/simple/app/globals.css b/packages/dapp-kit-next/examples/next-js/simple/app/globals.css index f4eb179d7..f38fb903c 100644 --- a/packages/dapp-kit-next/examples/next-js/simple/app/globals.css +++ b/packages/dapp-kit-next/examples/next-js/simple/app/globals.css @@ -1,13 +1,13 @@ :root { - font-family: system-ui, Avenir, Helvetica, Arial, sans-serif; - line-height: 1.5; - font-weight: 400; + font-family: system-ui, Avenir, Helvetica, Arial, sans-serif; + line-height: 1.5; + font-weight: 400; - color: #213547; - background-color: #ffffff; + color: #213547; + background-color: #ffffff; - font-synthesis: none; - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; + font-synthesis: none; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; } diff --git a/packages/dapp-kit-next/examples/next-js/simple/eslint.config.mjs b/packages/dapp-kit-next/examples/next-js/simple/eslint.config.mjs index 537c89b70..9b7e5ed98 100644 --- a/packages/dapp-kit-next/examples/next-js/simple/eslint.config.mjs +++ b/packages/dapp-kit-next/examples/next-js/simple/eslint.config.mjs @@ -2,12 +2,12 @@ import { FlatCompat } from '@eslint/eslintrc'; const compat = new FlatCompat({ baseDirectory: import.meta.dirname, -}) +}); const eslintConfig = [ ...compat.config({ extends: ['next'], }), -] +]; -export default eslintConfig; \ No newline at end of file +export default eslintConfig; diff --git a/packages/dapp-kit-next/examples/next-js/simple/tsconfig.json b/packages/dapp-kit-next/examples/next-js/simple/tsconfig.json index 41a5af9a5..bc58dd01f 100644 --- a/packages/dapp-kit-next/examples/next-js/simple/tsconfig.json +++ b/packages/dapp-kit-next/examples/next-js/simple/tsconfig.json @@ -1,30 +1,30 @@ { - "compilerOptions": { - "target": "ES2017", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, - "skipLibCheck": true, - "strict": true, - "noEmit": true, - "esModuleInterop": true, - "module": "esnext", - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "resolveJsonModule": true, - "isolatedModules": true, - "jsx": "preserve", - "incremental": true, - "experimentalDecorators": true, - "useDefineForClassFields": false, - "plugins": [ - { - "name": "next" - } - ], - "paths": { - "@/*": ["./*"] - } - }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], - "exclude": ["node_modules"] + "compilerOptions": { + "target": "ES2017", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "noEmit": true, + "esModuleInterop": true, + "module": "esnext", + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve", + "incremental": true, + "experimentalDecorators": true, + "useDefineForClassFields": false, + "plugins": [ + { + "name": "next" + } + ], + "paths": { + "@/*": ["./*"] + } + }, + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], + "exclude": ["node_modules"] } diff --git a/packages/dapp-kit-next/examples/react/simple/src/dApp-kit.ts b/packages/dapp-kit-next/examples/react/simple/src/dApp-kit.ts index 58e3425ce..dd7742e4e 100644 --- a/packages/dapp-kit-next/examples/react/simple/src/dApp-kit.ts +++ b/packages/dapp-kit-next/examples/react/simple/src/dApp-kit.ts @@ -2,14 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 import { createDAppKit } from '@mysten/dapp-kit-react'; -import { getFullnodeUrl, SuiClient } from '@mysten/sui/client'; +import { getJsonRpcFullnodeUrl, SuiJsonRpcClient } from '@mysten/sui/jsonRpc'; export const dAppKit = createDAppKit({ enableBurnerWallet: import.meta.env.DEV, networks: ['mainnet', 'testnet'], defaultNetwork: 'testnet', createClient(network) { - return new SuiClient({ network, url: getFullnodeUrl(network) }); + return new SuiJsonRpcClient({ network, url: getJsonRpcFullnodeUrl(network) }); }, }); diff --git a/packages/dapp-kit-next/examples/vanilla/simple/src/main.ts b/packages/dapp-kit-next/examples/vanilla/simple/src/main.ts index 41b09c548..633afcb48 100644 --- a/packages/dapp-kit-next/examples/vanilla/simple/src/main.ts +++ b/packages/dapp-kit-next/examples/vanilla/simple/src/main.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { createDAppKit } from '@mysten/dapp-kit-core'; -import { getFullnodeUrl, SuiClient } from '@mysten/sui/client'; +import { getJsonRpcFullnodeUrl, SuiJsonRpcClient } from '@mysten/sui/jsonRpc'; import '@mysten/dapp-kit-core/web'; @@ -13,7 +13,7 @@ const dAppKit = createDAppKit({ networks: ['mainnet', 'testnet'], defaultNetwork: 'testnet', createClient(network) { - return new SuiClient({ network, url: getFullnodeUrl(network) }); + return new SuiJsonRpcClient({ network, url: getJsonRpcFullnodeUrl(network) }); }, }); diff --git a/packages/dapp-kit-next/examples/vue/simple/index.html b/packages/dapp-kit-next/examples/vue/simple/index.html index 7f1788378..1dae23da3 100644 --- a/packages/dapp-kit-next/examples/vue/simple/index.html +++ b/packages/dapp-kit-next/examples/vue/simple/index.html @@ -6,7 +6,7 @@ DApp Kit Vue Simple Example App - +
diff --git a/packages/dapp-kit-next/examples/vue/simple/src/App.vue b/packages/dapp-kit-next/examples/vue/simple/src/App.vue index 06bed5374..ba76f4272 100644 --- a/packages/dapp-kit-next/examples/vue/simple/src/App.vue +++ b/packages/dapp-kit-next/examples/vue/simple/src/App.vue @@ -5,4 +5,3 @@ import { dAppKit } from './dapp-kit'; - diff --git a/packages/dapp-kit-next/examples/vue/simple/src/dapp-kit.ts b/packages/dapp-kit-next/examples/vue/simple/src/dapp-kit.ts index 68e44b94b..f482afce3 100644 --- a/packages/dapp-kit-next/examples/vue/simple/src/dapp-kit.ts +++ b/packages/dapp-kit-next/examples/vue/simple/src/dapp-kit.ts @@ -2,13 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 import { createDAppKit } from '@mysten/dapp-kit-core'; -import { getFullnodeUrl, SuiClient } from '@mysten/sui/client'; +import { getJsonRpcFullnodeUrl, SuiJsonRpcClient } from '@mysten/sui/jsonRpc'; export const dAppKit = createDAppKit({ enableBurnerWallet: import.meta.env.DEV, networks: ['mainnet', 'testnet'], defaultNetwork: 'testnet', createClient(network) { - return new SuiClient({ network, url: getFullnodeUrl(network) }); + return new SuiJsonRpcClient({ network, url: getJsonRpcFullnodeUrl(network) }); }, }); diff --git a/packages/dapp-kit-next/examples/vue/simple/tsconfig.app.json b/packages/dapp-kit-next/examples/vue/simple/tsconfig.app.json index 11f33457d..26c680081 100644 --- a/packages/dapp-kit-next/examples/vue/simple/tsconfig.app.json +++ b/packages/dapp-kit-next/examples/vue/simple/tsconfig.app.json @@ -1,12 +1,12 @@ { - "extends": "@vue/tsconfig/tsconfig.dom.json", - "include": ["src/**/*", "src/**/*.vue"], - "exclude": ["src/**/__tests__/*"], - "compilerOptions": { - "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", + "extends": "@vue/tsconfig/tsconfig.dom.json", + "include": ["src/**/*", "src/**/*.vue"], + "exclude": ["src/**/__tests__/*"], + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", - "paths": { - "@/*": ["./src/*"] - } - } + "paths": { + "@/*": ["./src/*"] + } + } } diff --git a/packages/dapp-kit-next/examples/vue/simple/tsconfig.json b/packages/dapp-kit-next/examples/vue/simple/tsconfig.json index 66b5e5703..ae91ebf72 100644 --- a/packages/dapp-kit-next/examples/vue/simple/tsconfig.json +++ b/packages/dapp-kit-next/examples/vue/simple/tsconfig.json @@ -1,11 +1,11 @@ { - "files": [], - "references": [ - { - "path": "./tsconfig.node.json" - }, - { - "path": "./tsconfig.app.json" - } - ] + "files": [], + "references": [ + { + "path": "./tsconfig.node.json" + }, + { + "path": "./tsconfig.app.json" + } + ] } diff --git a/packages/dapp-kit-next/examples/vue/simple/tsconfig.node.json b/packages/dapp-kit-next/examples/vue/simple/tsconfig.node.json index a83dfc9d4..8731853d7 100644 --- a/packages/dapp-kit-next/examples/vue/simple/tsconfig.node.json +++ b/packages/dapp-kit-next/examples/vue/simple/tsconfig.node.json @@ -1,19 +1,19 @@ { - "extends": "@tsconfig/node22/tsconfig.json", - "include": [ - "vite.config.*", - "vitest.config.*", - "cypress.config.*", - "nightwatch.conf.*", - "playwright.config.*", - "eslint.config.*" - ], - "compilerOptions": { - "noEmit": true, - "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", + "extends": "@tsconfig/node22/tsconfig.json", + "include": [ + "vite.config.*", + "vitest.config.*", + "cypress.config.*", + "nightwatch.conf.*", + "playwright.config.*", + "eslint.config.*" + ], + "compilerOptions": { + "noEmit": true, + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", - "module": "ESNext", - "moduleResolution": "Bundler", - "types": ["node"] - } + "module": "ESNext", + "moduleResolution": "Bundler", + "types": ["node"] + } } diff --git a/packages/dapp-kit-next/packages/dapp-kit-core/src/core/types.ts b/packages/dapp-kit-next/packages/dapp-kit-core/src/core/types.ts index ab4da3d00..00dfeb595 100644 --- a/packages/dapp-kit-next/packages/dapp-kit-core/src/core/types.ts +++ b/packages/dapp-kit-next/packages/dapp-kit-core/src/core/types.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import type { ClientWithCoreApi } from '@mysten/sui/experimental'; +import type { ClientWithCoreApi } from '@mysten/sui/client'; import type { Networks } from '../utils/networks.js'; import type { StateStorage } from '../utils/storage.js'; import type { WalletInitializer } from '../wallets/index.js'; diff --git a/packages/dapp-kit-next/packages/dapp-kit-core/src/index.ts b/packages/dapp-kit-next/packages/dapp-kit-core/src/index.ts index 15b90a8c7..73861aacc 100644 --- a/packages/dapp-kit-next/packages/dapp-kit-core/src/index.ts +++ b/packages/dapp-kit-next/packages/dapp-kit-core/src/index.ts @@ -8,7 +8,7 @@ export type { DAppKitCompatibleClient } from './core/types.js'; export type { WalletConnection } from './core/store.js'; export type { Register, ResolvedRegister, RegisteredDAppKit } from './types.js'; export type { StateStorage } from './utils/storage.js'; -export type { ClientWithCoreApi } from '@mysten/sui/experimental'; +export type { ClientWithCoreApi } from '@mysten/sui/client'; export { getWalletUniqueIdentifier } from './utils/wallets.js'; export type { UiWallet, UiWalletAccount } from '@wallet-standard/ui'; diff --git a/packages/dapp-kit-next/packages/dapp-kit-core/src/utils/networks.ts b/packages/dapp-kit-next/packages/dapp-kit-core/src/utils/networks.ts index 0955263a4..3da660c33 100644 --- a/packages/dapp-kit-next/packages/dapp-kit-core/src/utils/networks.ts +++ b/packages/dapp-kit-next/packages/dapp-kit-core/src/utils/networks.ts @@ -1,14 +1,14 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import type { Experimental_SuiClientTypes } from '@mysten/sui/experimental'; +import type { SuiClientTypes } from '@mysten/sui/client'; import type { IdentifierString } from '@mysten/wallet-standard'; import { DAppKitError } from './errors.js'; import type { DAppKitCompatibleClient } from '../core/types.js'; -export type Networks = Experimental_SuiClientTypes.Network[]; +export type Networks = SuiClientTypes.Network[]; -export function getChain(network: Experimental_SuiClientTypes.Network): IdentifierString { +export function getChain(network: SuiClientTypes.Network): IdentifierString { return `sui:${network}`; } diff --git a/packages/dapp-kit-next/packages/dapp-kit-core/src/utils/signer.ts b/packages/dapp-kit-next/packages/dapp-kit-core/src/utils/signer.ts index 133403d0f..48bc8bac5 100644 --- a/packages/dapp-kit-next/packages/dapp-kit-core/src/utils/signer.ts +++ b/packages/dapp-kit-next/packages/dapp-kit-core/src/utils/signer.ts @@ -5,8 +5,8 @@ import type { PublicKey, SignatureScheme } from '@mysten/sui/cryptography'; import { SIGNATURE_FLAG_TO_SCHEME, Signer } from '@mysten/sui/cryptography'; import type { DAppKit } from '../core/index.js'; import type { Transaction } from '@mysten/sui/transactions'; -import type { Experimental_SuiClientTypes } from '@mysten/sui/experimental'; -import { parseTransactionBcs, parseTransactionEffectsBcs } from '@mysten/sui/experimental'; +import type { SuiClientTypes } from '@mysten/sui/client'; +import { parseTransactionBcs, parseTransactionEffectsBcs } from '@mysten/sui/client'; import { toBase64, fromBase64 } from '@mysten/sui/utils'; import { publicKeyFromSuiBytes } from '@mysten/sui/verify'; @@ -68,7 +68,7 @@ export class CurrentAccountSigner extends Signer { transaction, }: { transaction: Transaction; - }): Promise> { + }): Promise> { const { bytes, signature, digest, effects } = await this.#dAppKit.signAndExecuteTransaction({ transaction, }); @@ -78,17 +78,10 @@ export class CurrentAccountSigner extends Signer { signatures: [signature], epoch: null, effects: parseTransactionEffectsBcs(fromBase64(effects)), - objectTypes: { - // oxlint-disable-next-line no-thenable - get then() { - const promise = Promise.reject>( - new Error('objectTypes is not implemented for WalletSigner'), - ); - - return promise.then.bind(promise); - }, - }, transaction: parseTransactionBcs(fromBase64(bytes)), + events: undefined, + objectTypes: undefined, + balanceChanges: undefined, }; } } diff --git a/packages/dapp-kit-next/packages/dapp-kit-core/src/wallets/unsafe-burner.ts b/packages/dapp-kit-next/packages/dapp-kit-core/src/wallets/unsafe-burner.ts index d5980fd5a..393c73629 100644 --- a/packages/dapp-kit-next/packages/dapp-kit-core/src/wallets/unsafe-burner.ts +++ b/packages/dapp-kit-next/packages/dapp-kit-core/src/wallets/unsafe-burner.ts @@ -26,7 +26,7 @@ import { } from '@mysten/wallet-standard'; import type { Wallet } from '@mysten/wallet-standard'; import { toBase64 } from '@mysten/utils'; -import type { ClientWithCoreApi } from '@mysten/sui/experimental'; +import type { ClientWithCoreApi } from '@mysten/sui/client'; import type { WalletInitializer } from './index.js'; import { getChain } from '../utils/networks.js'; diff --git a/packages/dapp-kit-next/packages/dapp-kit-core/src/web/dapp-kit-connect-button.stories.ts b/packages/dapp-kit-next/packages/dapp-kit-core/src/web/dapp-kit-connect-button.stories.ts index 97728b4c6..e7060b4ea 100644 --- a/packages/dapp-kit-next/packages/dapp-kit-core/src/web/dapp-kit-connect-button.stories.ts +++ b/packages/dapp-kit-next/packages/dapp-kit-core/src/web/dapp-kit-connect-button.stories.ts @@ -5,12 +5,12 @@ import type { Meta, StoryObj } from '@storybook/web-components'; import { html } from 'lit'; import type { DAppKitConnectButton } from './dapp-kit-connect-button.js'; import { createDAppKit } from '../core/index.js'; -import { getFullnodeUrl, SuiClient } from '@mysten/sui/client'; +import { getJsonRpcFullnodeUrl, SuiJsonRpcClient } from '@mysten/sui/jsonRpc'; const dAppKit = createDAppKit({ networks: ['testnet'], createClient(network) { - return new SuiClient({ network, url: getFullnodeUrl(network) }); + return new SuiJsonRpcClient({ network, url: getJsonRpcFullnodeUrl(network) }); }, }); diff --git a/packages/dapp-kit-next/packages/dapp-kit-core/src/web/dapp-kit-connect-modal.stories.ts b/packages/dapp-kit-next/packages/dapp-kit-core/src/web/dapp-kit-connect-modal.stories.ts index 776acd464..6e54d85de 100644 --- a/packages/dapp-kit-next/packages/dapp-kit-core/src/web/dapp-kit-connect-modal.stories.ts +++ b/packages/dapp-kit-next/packages/dapp-kit-core/src/web/dapp-kit-connect-modal.stories.ts @@ -5,12 +5,12 @@ import type { Meta, StoryObj } from '@storybook/web-components'; import { html } from 'lit'; import type { DAppKitConnectModal } from './dapp-kit-connect-modal.js'; import { createDAppKit } from '../core/index.js'; -import { getFullnodeUrl, SuiClient } from '@mysten/sui/client'; +import { getJsonRpcFullnodeUrl, SuiJsonRpcClient } from '@mysten/sui/jsonRpc'; const dAppKit = createDAppKit({ networks: ['testnet'], createClient(network) { - return new SuiClient({ network, url: getFullnodeUrl(network) }); + return new SuiJsonRpcClient({ network, url: getJsonRpcFullnodeUrl(network) }); }, }); diff --git a/packages/dapp-kit-next/packages/dapp-kit-core/test/integration/actions/connect-wallet.test.ts b/packages/dapp-kit-next/packages/dapp-kit-core/test/integration/actions/connect-wallet.test.ts index 30ff78500..2f74d9d4a 100644 --- a/packages/dapp-kit-next/packages/dapp-kit-core/test/integration/actions/connect-wallet.test.ts +++ b/packages/dapp-kit-next/packages/dapp-kit-core/test/integration/actions/connect-wallet.test.ts @@ -5,7 +5,7 @@ import { describe, expect, test, beforeEach } from 'vitest'; import { TEST_DEFAULT_NETWORK, TEST_NETWORKS, TestWalletInitializeResult } from '../../test-utils'; import { createMockWallets, MockWallet } from '../../mocks/mock-wallet'; import { createDAppKit, DAppKit } from '../../../src'; -import { SuiClient, getFullnodeUrl } from '@mysten/sui/client'; +import { SuiJsonRpcClient, getJsonRpcFullnodeUrl } from '@mysten/sui/jsonRpc'; import { getWallets } from '@mysten/wallet-standard'; import { createMockAccount } from '../../mocks/mock-account'; import { UiWallet } from '@wallet-standard/ui'; @@ -21,7 +21,7 @@ describe('[Integration] connectWallet action', () => { networks: TEST_NETWORKS, defaultNetwork: TEST_DEFAULT_NETWORK, createClient(network) { - return new SuiClient({ network, url: getFullnodeUrl(network) }); + return new SuiJsonRpcClient({ network, url: getJsonRpcFullnodeUrl(network) }); }, walletInitializers: [ { diff --git a/packages/dapp-kit-next/packages/dapp-kit-core/test/integration/actions/disconnect-wallet.test.ts b/packages/dapp-kit-next/packages/dapp-kit-core/test/integration/actions/disconnect-wallet.test.ts index 0d4372e13..d56a43f82 100644 --- a/packages/dapp-kit-next/packages/dapp-kit-core/test/integration/actions/disconnect-wallet.test.ts +++ b/packages/dapp-kit-next/packages/dapp-kit-core/test/integration/actions/disconnect-wallet.test.ts @@ -5,7 +5,7 @@ import { describe, expect, test, beforeEach, vi, MockInstance } from 'vitest'; import { TEST_DEFAULT_NETWORK, TEST_NETWORKS, TestWalletInitializeResult } from '../../test-utils'; import { createMockWallets, MockWallet } from '../../mocks/mock-wallet'; import { createDAppKit, DAppKit } from '../../../src'; -import { SuiClient, getFullnodeUrl } from '@mysten/sui/client'; +import { SuiJsonRpcClient, getJsonRpcFullnodeUrl } from '@mysten/sui/jsonRpc'; import { getWallets } from '@mysten/wallet-standard'; import { createMockAccount } from '../../mocks/mock-account'; import { UiWallet } from '@wallet-standard/ui'; @@ -24,7 +24,7 @@ describe('[Integration] disconnectWallet action', () => { networks: TEST_NETWORKS, defaultNetwork: TEST_DEFAULT_NETWORK, createClient(network) { - return new SuiClient({ network, url: getFullnodeUrl(network) }); + return new SuiJsonRpcClient({ network, url: getJsonRpcFullnodeUrl(network) }); }, walletInitializers: [ { diff --git a/packages/dapp-kit-next/packages/dapp-kit-core/test/unit/unit-test-utils.ts b/packages/dapp-kit-next/packages/dapp-kit-core/test/unit/unit-test-utils.ts index 82f60f32f..c7877d274 100644 --- a/packages/dapp-kit-next/packages/dapp-kit-core/test/unit/unit-test-utils.ts +++ b/packages/dapp-kit-next/packages/dapp-kit-core/test/unit/unit-test-utils.ts @@ -9,7 +9,7 @@ import { TEST_NETWORKS, unbindStoreListeners, } from '../test-utils.js'; -import { getFullnodeUrl, SuiClient } from '@mysten/sui/client'; +import { getJsonRpcFullnodeUrl, SuiJsonRpcClient } from '@mysten/sui/jsonRpc'; import type { MockWalletOptions } from '../mocks/mock-wallet.js'; import { createMockWallets } from '../mocks/mock-wallet.js'; import { createMockAccount } from '../mocks/mock-account.js'; @@ -22,11 +22,11 @@ export function createTestStores({ const clients = Object.fromEntries( [...TEST_NETWORKS].map((network) => [ network, - new SuiClient({ network, url: getFullnodeUrl(network) }), + new SuiJsonRpcClient({ network, url: getJsonRpcFullnodeUrl(network) }), ]), ); - return createStores({ + return createStores({ defaultNetwork: currentNetwork, getClient: (network) => clients[network as keyof typeof clients], }); diff --git a/packages/dapp-kit/README.md b/packages/dapp-kit/README.md index fa409d85e..465bd1213 100644 --- a/packages/dapp-kit/README.md +++ b/packages/dapp-kit/README.md @@ -35,13 +35,13 @@ pages. ```tsx import { createNetworkConfig, SuiClientProvider, WalletProvider } from '@mysten/dapp-kit'; -import { getFullnodeUrl, type SuiClientOptions } from '@mysten/sui/client'; +import { getJsonRpcFullnodeUrl, type SuiClientOptions } from '@mysten/sui/jsonRpc'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; // Config options for the networks you want to connect to const { networkConfig } = createNetworkConfig({ - localnet: { url: getFullnodeUrl('localnet') }, - mainnet: { url: getFullnodeUrl('mainnet') }, + localnet: { url: getJsonRpcFullnodeUrl('localnet') }, + mainnet: { url: getJsonRpcFullnodeUrl('mainnet') }, }); const queryClient = new QueryClient(); diff --git a/packages/dapp-kit/src/components/SuiClientProvider.tsx b/packages/dapp-kit/src/components/SuiClientProvider.tsx index ffbcd8118..56cd1ba00 100644 --- a/packages/dapp-kit/src/components/SuiClientProvider.tsx +++ b/packages/dapp-kit/src/components/SuiClientProvider.tsx @@ -1,19 +1,17 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { getFullnodeUrl, isSuiClient, SuiClient } from '@mysten/sui/client'; -import type { SuiClientOptions } from '@mysten/sui/client'; +import { getJsonRpcFullnodeUrl, isSuiJsonRpcClient, SuiJsonRpcClient } from '@mysten/sui/jsonRpc'; +import type { SuiJsonRpcClientOptions } from '@mysten/sui/jsonRpc'; import { createContext, useMemo, useState } from 'react'; import type { NetworkConfig } from '../hooks/networkConfig.js'; -type NetworkConfigs = Record< - string, - T ->; +type NetworkConfigs = + Record; export interface SuiClientProviderContext { - client: SuiClient; + client: SuiJsonRpcClient; networks: NetworkConfigs; network: string; config: NetworkConfig | null; @@ -23,7 +21,7 @@ export interface SuiClientProviderContext { export const SuiClientContext = createContext(null); export type SuiClientProviderProps = { - createClient?: (name: keyof T, config: T[keyof T]) => SuiClient; + createClient?: (name: keyof T, config: T[keyof T]) => SuiJsonRpcClient; children: React.ReactNode; networks?: T; onNetworkChange?: (network: keyof T & string) => void; @@ -39,18 +37,18 @@ export type SuiClientProviderProps = { ); const DEFAULT_NETWORKS = { - localnet: { url: getFullnodeUrl('localnet') }, + localnet: { url: getJsonRpcFullnodeUrl('localnet') }, }; const DEFAULT_CREATE_CLIENT = function createClient( _name: string, - config: NetworkConfig | SuiClient, + config: NetworkConfig | SuiJsonRpcClient, ) { - if (isSuiClient(config)) { + if (isSuiJsonRpcClient(config)) { return config; } - return new SuiClient(config); + return new SuiJsonRpcClient(config); }; export function SuiClientProvider(props: SuiClientProviderProps) { @@ -75,9 +73,9 @@ export function SuiClientProvider(props: SuiClientProv networks, network: currentNetwork, config: - networks[currentNetwork] instanceof SuiClient + networks[currentNetwork] instanceof SuiJsonRpcClient ? null - : (networks[currentNetwork] as SuiClientOptions), + : (networks[currentNetwork] as SuiJsonRpcClientOptions), selectNetwork: (newNetwork) => { if (currentNetwork === newNetwork) { return; diff --git a/packages/dapp-kit/src/constants/walletMutationKeys.ts b/packages/dapp-kit/src/constants/walletMutationKeys.ts index 679d17c12..6d9212283 100644 --- a/packages/dapp-kit/src/constants/walletMutationKeys.ts +++ b/packages/dapp-kit/src/constants/walletMutationKeys.ts @@ -12,7 +12,6 @@ export const walletMutationKeys = { signTransaction: formMutationKeyFn('sign-transaction'), signAndExecuteTransaction: formMutationKeyFn('sign-and-execute-transaction'), switchAccount: formMutationKeyFn('switch-account'), - reportTransactionEffects: formMutationKeyFn('report-transaction-effects'), }; function formMutationKeyFn(baseEntity: string) { diff --git a/packages/dapp-kit/src/hooks/networkConfig.ts b/packages/dapp-kit/src/hooks/networkConfig.ts index acdd645bb..f77f983cb 100644 --- a/packages/dapp-kit/src/hooks/networkConfig.ts +++ b/packages/dapp-kit/src/hooks/networkConfig.ts @@ -1,11 +1,11 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import type { SuiClientOptions } from '@mysten/sui/client'; +import type { SuiJsonRpcClientOptions } from '@mysten/sui/jsonRpc'; import { useSuiClientContext } from './useSuiClient.js'; -export type NetworkConfig = SuiClientOptions & { +export type NetworkConfig = SuiJsonRpcClientOptions & { variables?: T; }; diff --git a/packages/dapp-kit/src/hooks/useResolveSuiNSNames.ts b/packages/dapp-kit/src/hooks/useResolveSuiNSNames.ts index d85afe394..dd35ac359 100644 --- a/packages/dapp-kit/src/hooks/useResolveSuiNSNames.ts +++ b/packages/dapp-kit/src/hooks/useResolveSuiNSNames.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import type { ResolvedNameServiceNames } from '@mysten/sui/client'; +import type { ResolvedNameServiceNames } from '@mysten/sui/jsonRpc'; import type { UseQueryOptions, UseQueryResult } from '@tanstack/react-query'; import { useSuiClientQuery } from './useSuiClientQuery.js'; diff --git a/packages/dapp-kit/src/hooks/useSuiClient.ts b/packages/dapp-kit/src/hooks/useSuiClient.ts index bd86165cb..a3f568c14 100644 --- a/packages/dapp-kit/src/hooks/useSuiClient.ts +++ b/packages/dapp-kit/src/hooks/useSuiClient.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import type { SuiClient } from '@mysten/sui/client'; +import type { SuiJsonRpcClient } from '@mysten/sui/jsonRpc'; import { useContext } from 'react'; import { SuiClientContext } from '../components/SuiClientProvider.js'; @@ -18,6 +18,6 @@ export function useSuiClientContext() { return suiClient; } -export function useSuiClient(): SuiClient { +export function useSuiClient(): SuiJsonRpcClient { return useSuiClientContext().client; } diff --git a/packages/dapp-kit/src/hooks/useSuiClientInfiniteQuery.ts b/packages/dapp-kit/src/hooks/useSuiClientInfiniteQuery.ts index ff2f0c7ed..3347b8fc4 100644 --- a/packages/dapp-kit/src/hooks/useSuiClientInfiniteQuery.ts +++ b/packages/dapp-kit/src/hooks/useSuiClientInfiniteQuery.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import type { SuiClient } from '@mysten/sui/client'; +import type { SuiJsonRpcClient } from '@mysten/sui/jsonRpc'; import type { InfiniteData, UseInfiniteQueryOptions, @@ -19,11 +19,15 @@ interface PaginatedResult { } export type SuiRpcPaginatedMethodName = { - [K in keyof SuiClient]: SuiClient[K] extends (input: any) => Promise ? K : never; -}[keyof SuiClient]; + [K in keyof SuiJsonRpcClient]: SuiJsonRpcClient[K] extends ( + input: any, + ) => Promise + ? K + : never; +}[keyof SuiJsonRpcClient]; export type SuiRpcPaginatedMethods = { - [K in SuiRpcPaginatedMethodName]: SuiClient[K] extends ( + [K in SuiRpcPaginatedMethodName]: SuiJsonRpcClient[K] extends ( input: infer Params, ) => Promise< infer Result extends { hasNextPage?: boolean | null; nextCursor?: infer Cursor | null } diff --git a/packages/dapp-kit/src/hooks/useSuiClientQuery.ts b/packages/dapp-kit/src/hooks/useSuiClientQuery.ts index e3f9c850a..69a6ea943 100644 --- a/packages/dapp-kit/src/hooks/useSuiClientQuery.ts +++ b/packages/dapp-kit/src/hooks/useSuiClientQuery.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import type { SuiClient } from '@mysten/sui/client'; +import type { SuiJsonRpcClient } from '@mysten/sui/jsonRpc'; import type { UndefinedInitialDataOptions, UseQueryOptions, @@ -14,19 +14,21 @@ import type { PartialBy } from '../types/utilityTypes.js'; import { useSuiClientContext } from './useSuiClient.js'; export type SuiRpcMethodName = { - [K in keyof SuiClient]: SuiClient[K] extends ((input: any) => Promise) | (() => Promise) + [K in keyof SuiJsonRpcClient]: SuiJsonRpcClient[K] extends + | ((input: any) => Promise) + | (() => Promise) ? K : never; -}[keyof SuiClient]; +}[keyof SuiJsonRpcClient]; export type SuiRpcMethods = { - [K in SuiRpcMethodName]: SuiClient[K] extends (input: infer P) => Promise + [K in SuiRpcMethodName]: SuiJsonRpcClient[K] extends (input: infer P) => Promise ? { name: K; result: R; params: P; } - : SuiClient[K] extends () => Promise + : SuiJsonRpcClient[K] extends () => Promise ? { name: K; result: R; @@ -41,7 +43,7 @@ export type UseSuiClientQueryOptions = Par >; export type GetSuiClientQueryOptions = { - client: SuiClient; + client: SuiJsonRpcClient; network: string; method: T; options?: PartialBy< diff --git a/packages/dapp-kit/src/hooks/wallet/useReportTransactionEffects.ts b/packages/dapp-kit/src/hooks/wallet/useReportTransactionEffects.ts deleted file mode 100644 index 554d93f4f..000000000 --- a/packages/dapp-kit/src/hooks/wallet/useReportTransactionEffects.ts +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Mysten Labs, Inc. -// SPDX-License-Identifier: Apache-2.0 - -import { toBase64 } from '@mysten/sui/utils'; -import type { SuiReportTransactionEffectsInput } from '@mysten/wallet-standard'; -import type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query'; -import { useMutation } from '@tanstack/react-query'; - -import { walletMutationKeys } from '../../constants/walletMutationKeys.js'; -import type { WalletFeatureNotSupportedError } from '../../errors/walletErrors.js'; -import { - WalletNoAccountSelectedError, - WalletNotConnectedError, -} from '../../errors/walletErrors.js'; -import type { PartialBy } from '../../types/utilityTypes.js'; -import { useCurrentAccount } from './useCurrentAccount.js'; -import { useCurrentWallet } from './useCurrentWallet.js'; - -type UseReportTransactionEffectsArgs = Omit< - PartialBy, - 'effects' -> & { - effects: string | number[]; -}; - -type UseReportTransactionEffectsError = - | WalletFeatureNotSupportedError - | WalletNoAccountSelectedError - | WalletNotConnectedError - | Error; - -type UseReportTransactionEffectsMutationOptions = Omit< - UseMutationOptions< - void, - UseReportTransactionEffectsError, - UseReportTransactionEffectsArgs, - unknown - >, - 'mutationFn' ->; - -/** - * Mutation hook for prompting the user to sign a message. - */ -export function useReportTransactionEffects({ - mutationKey, - ...mutationOptions -}: UseReportTransactionEffectsMutationOptions = {}): UseMutationResult< - void, - UseReportTransactionEffectsError, - UseReportTransactionEffectsArgs -> { - const { currentWallet } = useCurrentWallet(); - const currentAccount = useCurrentAccount(); - - return useMutation({ - mutationKey: walletMutationKeys.reportTransactionEffects(mutationKey), - mutationFn: async ({ effects, chain = currentWallet?.chains[0], account = currentAccount }) => { - if (!currentWallet) { - throw new WalletNotConnectedError('No wallet is connected.'); - } - - if (!account) { - throw new WalletNoAccountSelectedError( - 'No wallet account is selected to report transaction effects for', - ); - } - - const reportTransactionEffectsFeature = - currentWallet.features['sui:reportTransactionEffects']; - - if (reportTransactionEffectsFeature) { - return await reportTransactionEffectsFeature.reportTransactionEffects({ - effects: Array.isArray(effects) ? toBase64(new Uint8Array(effects)) : effects, - account, - chain: chain ?? currentWallet?.chains[0], - }); - } - }, - ...mutationOptions, - }); -} diff --git a/packages/dapp-kit/src/hooks/wallet/useSignAndExecuteTransaction.ts b/packages/dapp-kit/src/hooks/wallet/useSignAndExecuteTransaction.ts index 27db7ee4d..9523fd2a4 100644 --- a/packages/dapp-kit/src/hooks/wallet/useSignAndExecuteTransaction.ts +++ b/packages/dapp-kit/src/hooks/wallet/useSignAndExecuteTransaction.ts @@ -21,7 +21,6 @@ import type { PartialBy } from '../../types/utilityTypes.js'; import { useSuiClientContext } from '../useSuiClient.js'; import { useCurrentAccount } from './useCurrentAccount.js'; import { useCurrentWallet } from './useCurrentWallet.js'; -import { useReportTransactionEffects } from './useReportTransactionEffects.js'; type UseSignAndExecuteTransactionArgs = PartialBy< Omit, @@ -78,7 +77,6 @@ export function useSignAndExecuteTransaction< const { currentWallet, supportedIntents } = useCurrentWallet(); const currentAccount = useCurrentAccount(); const { client, network } = useSuiClientContext(); - const { mutate: reportTransactionEffects } = useReportTransactionEffects(); const executeTransaction: ({ bytes, @@ -152,18 +150,6 @@ export function useSignAndExecuteTransaction< const result = await executeTransaction({ bytes, signature }); - let effects: string; - - if ('effects' in result && result.effects?.bcs) { - effects = result.effects.bcs; - } else if ('rawEffects' in result) { - effects = toBase64(new Uint8Array(result.rawEffects!)); - } else { - throw new Error('Could not parse effects from transaction result.'); - } - - reportTransactionEffects({ effects, account: signerAccount, chain }); - return result as Result; }, ...mutationOptions, diff --git a/packages/dapp-kit/src/hooks/wallet/useSignTransaction.ts b/packages/dapp-kit/src/hooks/wallet/useSignTransaction.ts index 6257f0d2c..3848c2c4b 100644 --- a/packages/dapp-kit/src/hooks/wallet/useSignTransaction.ts +++ b/packages/dapp-kit/src/hooks/wallet/useSignTransaction.ts @@ -17,7 +17,6 @@ import type { PartialBy } from '../../types/utilityTypes.js'; import { useSuiClientContext } from '../useSuiClient.js'; import { useCurrentAccount } from './useCurrentAccount.js'; import { useCurrentWallet } from './useCurrentWallet.js'; -import { useReportTransactionEffects } from './useReportTransactionEffects.js'; type UseSignTransactionArgs = PartialBy< Omit, @@ -26,9 +25,7 @@ type UseSignTransactionArgs = PartialBy< transaction: Transaction | string; }; -interface UseSignTransactionResult extends SignedTransaction { - reportTransactionEffects: (effects: string) => void; -} +interface UseSignTransactionResult extends SignedTransaction {} type UseSignTransactionError = | WalletFeatureNotSupportedError @@ -61,8 +58,6 @@ export function useSignTransaction({ const currentAccount = useCurrentAccount(); const { client, network } = useSuiClientContext(); - const { mutate: reportTransactionEffects } = useReportTransactionEffects(); - return useMutation({ mutationKey: walletMutationKeys.signTransaction(mutationKey), mutationFn: async ({ transaction, ...signTransactionArgs }) => { @@ -110,13 +105,6 @@ export function useSignTransaction({ return { bytes, signature, - reportTransactionEffects: (effects) => { - reportTransactionEffects({ - effects, - account: signerAccount, - chain, - }); - }, }; }, ...mutationOptions, diff --git a/packages/dapp-kit/src/hooks/wallet/useUnsafeBurnerWallet.ts b/packages/dapp-kit/src/hooks/wallet/useUnsafeBurnerWallet.ts index 8d1a6f5bf..9364b764e 100644 --- a/packages/dapp-kit/src/hooks/wallet/useUnsafeBurnerWallet.ts +++ b/packages/dapp-kit/src/hooks/wallet/useUnsafeBurnerWallet.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import type { SuiClient } from '@mysten/sui/client'; +import type { SuiJsonRpcClient } from '@mysten/sui/jsonRpc'; import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519'; import { Transaction } from '@mysten/sui/transactions'; import { toBase64 } from '@mysten/sui/utils'; @@ -37,7 +37,7 @@ export function useUnsafeBurnerWallet(enabled: boolean) { }, [enabled, suiClient]); } -function registerUnsafeBurnerWallet(suiClient: SuiClient) { +function registerUnsafeBurnerWallet(suiClient: SuiJsonRpcClient) { const walletsApi = getWallets(); const registeredWallets = walletsApi.get(); diff --git a/packages/dapp-kit/src/index.ts b/packages/dapp-kit/src/index.ts index 15d4c7a64..24ad8c71e 100644 --- a/packages/dapp-kit/src/index.ts +++ b/packages/dapp-kit/src/index.ts @@ -21,7 +21,6 @@ export * from './hooks/wallet/useDisconnectWallet.js'; export * from './hooks/wallet/useSignAndExecuteTransaction.js'; export * from './hooks/wallet/useSignPersonalMessage.js'; export * from './hooks/wallet/useSignTransaction.js'; -export * from './hooks/wallet/useReportTransactionEffects.js'; export * from './hooks/wallet/useSwitchAccount.js'; export * from './hooks/wallet/useWallets.js'; export * from './themes/lightTheme.js'; diff --git a/packages/dapp-kit/test/components/SuiClientProvider.test.tsx b/packages/dapp-kit/test/components/SuiClientProvider.test.tsx index 1763c8fc3..4c94b34a4 100644 --- a/packages/dapp-kit/test/components/SuiClientProvider.test.tsx +++ b/packages/dapp-kit/test/components/SuiClientProvider.test.tsx @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { SuiClient } from '@mysten/sui/client'; +import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc'; import { screen } from '@testing-library/dom'; import { render } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; @@ -20,10 +20,10 @@ describe('SuiClientProvider', () => { expect(screen.getByText('Test')).toBeInTheDocument(); }); - it('provides a SuiClient instance to its children', () => { + it('provides a SuiJsonRpcClient instance to its children', () => { const ChildComponent = () => { const client = useSuiClient(); - expect(client).toBeInstanceOf(SuiClient); + expect(client).toBeInstanceOf(SuiJsonRpcClient); return
Test
; }; @@ -35,10 +35,10 @@ describe('SuiClientProvider', () => { }); it('can accept pre-configured SuiClients', () => { - const suiClient = new SuiClient({ url: 'http://localhost:8080' }); + const suiClient = new SuiJsonRpcClient({ url: 'http://localhost:8080', network: 'localnet' }); const ChildComponent = () => { const client = useSuiClient(); - expect(client).toBeInstanceOf(SuiClient); + expect(client).toBeInstanceOf(SuiJsonRpcClient); expect(client).toBe(suiClient); return
Test
; }; @@ -74,16 +74,18 @@ describe('SuiClientProvider', () => { networks={{ a: { url: 'http://localhost:8080', + network: 'localnet', custom: setSelectedNetwork, }, b: { url: 'http://localhost:8080', + network: 'localnet', custom: setSelectedNetwork, }, }} createClient={(name, { custom, ...config }) => { custom(name); - return new SuiClient(config); + return new SuiJsonRpcClient(config); }} >
{`selected network: ${selectedNetwork}`}
@@ -127,10 +129,12 @@ describe('SuiClientProvider', () => { networks={{ a: { url: 'http://localhost:8080', + network: 'localnet', custom: setSelectedNetwork, }, b: { url: 'http://localhost:8080', + network: 'localnet', custom: setSelectedNetwork, }, }} @@ -180,10 +184,12 @@ describe('SuiClientProvider', () => { networks={{ a: { url: 'http://localhost:8080', + network: 'localnet', custom: setSelectedNetwork, }, b: { url: 'http://localhost:8080', + network: 'localnet', custom: setSelectedNetwork, }, }} diff --git a/packages/dapp-kit/test/hooks/useSignAndExecuteTransaction.test.tsx b/packages/dapp-kit/test/hooks/useSignAndExecuteTransaction.test.tsx index fcd6b7a2c..76cd7a26f 100644 --- a/packages/dapp-kit/test/hooks/useSignAndExecuteTransaction.test.tsx +++ b/packages/dapp-kit/test/hooks/useSignAndExecuteTransaction.test.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { bcs } from '@mysten/sui/bcs'; -import { getFullnodeUrl, SuiClient } from '@mysten/sui/client'; +import { getJsonRpcFullnodeUrl, SuiJsonRpcClient } from '@mysten/sui/jsonRpc'; import { Transaction } from '@mysten/sui/transactions'; import { act, renderHook, waitFor } from '@testing-library/react'; import { expect, type Mock } from 'vitest'; @@ -62,7 +62,10 @@ describe('useSignAndExecuteTransaction', () => { features: suiFeatures, }); - const suiClient = new SuiClient({ url: getFullnodeUrl('localnet') }); + const suiClient = new SuiJsonRpcClient({ + url: getJsonRpcFullnodeUrl('localnet'), + network: 'localnet', + }); const mockSignTransactionFeature = mockWallet.features['sui:signTransaction']; const signTransaction = mockSignTransactionFeature!.signTransaction as Mock; @@ -71,11 +74,6 @@ describe('useSignAndExecuteTransaction', () => { signature: '123', }); - const reportEffectsFeature = mockWallet.features['sui:reportTransactionEffects']; - const reportEffects = reportEffectsFeature!.reportTransactionEffects as Mock; - - reportEffects.mockImplementation(async () => {}); - const executeTransaction = vi.spyOn(suiClient, 'executeTransactionBlock'); executeTransaction.mockResolvedValueOnce({ @@ -109,11 +107,6 @@ describe('useSignAndExecuteTransaction', () => { signature: '123', rawEffects: [10, 20, 30], }); - expect(reportEffects).toHaveBeenCalledWith({ - effects: 'ChQe', - chain: 'sui:testnet', - account: mockWallet.accounts[0], - }); const call = signTransaction.mock.calls[0]; @@ -139,11 +132,10 @@ describe('useSignAndExecuteTransaction', () => { signature: '123', }); - const reportEffectsFeature = mockWallet.features['sui:reportTransactionEffects']; - const reportEffects = reportEffectsFeature!.reportTransactionEffects as Mock; - reportEffects.mockImplementation(async () => {}); - - const suiClient = new SuiClient({ url: getFullnodeUrl('localnet') }); + const suiClient = new SuiJsonRpcClient({ + url: getJsonRpcFullnodeUrl('localnet'), + network: 'localnet', + }); const executeTransaction = vi.spyOn(suiClient, 'executeTransactionBlock'); executeTransaction.mockResolvedValueOnce({ digest: '123', @@ -167,11 +159,6 @@ describe('useSignAndExecuteTransaction', () => { }); await waitFor(() => expect(result.current.useSignAndExecuteTransaction.isSuccess).toBe(true)); - expect(reportEffects).toHaveBeenCalledWith({ - effects: 'ChQe', - chain: 'sui:test', - account: mockWallet.accounts[0], - }); expect(signTransaction).toHaveBeenCalledWith({ transaction: expect.any(Object), @@ -188,7 +175,10 @@ describe('useSignAndExecuteTransaction', () => { features: suiFeatures, }); - const suiClient = new SuiClient({ url: getFullnodeUrl('localnet') }); + const suiClient = new SuiJsonRpcClient({ + url: getJsonRpcFullnodeUrl('localnet'), + network: 'localnet', + }); const mockSignMessageFeature = mockWallet.features['sui:signTransaction']; const signTransaction = mockSignMessageFeature!.signTransaction as Mock; @@ -197,11 +187,6 @@ describe('useSignAndExecuteTransaction', () => { signature: '123', }); - const reportEffectsFeature = mockWallet.features['sui:reportTransactionEffects']; - const reportEffects = reportEffectsFeature!.reportTransactionEffects as Mock; - - reportEffects.mockImplementation(async () => {}); - const wrapper = createWalletProviderContextWrapper({}, suiClient); const fakeDigest = toBase58( @@ -272,11 +257,6 @@ describe('useSignAndExecuteTransaction', () => { custom: 123, }); expect(result.current.useSignAndExecuteTransaction.data?.custom).toBe(123); - expect(reportEffects).toHaveBeenCalledWith({ - account: mockWallet.accounts[0], - chain: 'sui:testnet', - effects: effectsBcs, - }); const call = signTransaction.mock.calls[0]; diff --git a/packages/dapp-kit/test/hooks/useSignTransaction.test.tsx b/packages/dapp-kit/test/hooks/useSignTransaction.test.tsx index 1b1562fc2..6968853de 100644 --- a/packages/dapp-kit/test/hooks/useSignTransaction.test.tsx +++ b/packages/dapp-kit/test/hooks/useSignTransaction.test.tsx @@ -87,7 +87,6 @@ describe('useSignTransaction', () => { expect(result.current.signTransaction.data).toStrictEqual({ bytes: 'abc', signature: '123', - reportTransactionEffects: expect.any(Function), }); expect(signTransactionMock).toHaveBeenCalledWith({ diff --git a/packages/dapp-kit/test/hooks/useSuiClient.test.tsx b/packages/dapp-kit/test/hooks/useSuiClient.test.tsx index 64c39d616..4a3a41779 100644 --- a/packages/dapp-kit/test/hooks/useSuiClient.test.tsx +++ b/packages/dapp-kit/test/hooks/useSuiClient.test.tsx @@ -1,6 +1,6 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { getFullnodeUrl, SuiClient } from '@mysten/sui/client'; +import { getJsonRpcFullnodeUrl, SuiJsonRpcClient } from '@mysten/sui/jsonRpc'; import { renderHook } from '@testing-library/react'; import { useSuiClient } from '../../src/index.js'; @@ -13,8 +13,11 @@ describe('useSuiClient', () => { ); }); - test('returns a SuiClient', () => { - const suiClient = new SuiClient({ url: getFullnodeUrl('localnet') }); + test('returns a SuiJsonRpcClient', () => { + const suiClient = new SuiJsonRpcClient({ + url: getJsonRpcFullnodeUrl('localnet'), + network: 'localnet', + }); const wrapper = createSuiClientContextWrapper(suiClient); const { result } = renderHook(() => useSuiClient(), { wrapper }); diff --git a/packages/dapp-kit/test/hooks/useSuiClientInfiniteQuery.test.tsx b/packages/dapp-kit/test/hooks/useSuiClientInfiniteQuery.test.tsx index 687d13424..edfa5fb04 100644 --- a/packages/dapp-kit/test/hooks/useSuiClientInfiniteQuery.test.tsx +++ b/packages/dapp-kit/test/hooks/useSuiClientInfiniteQuery.test.tsx @@ -1,6 +1,6 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { getFullnodeUrl, SuiClient } from '@mysten/sui/client'; +import { getJsonRpcFullnodeUrl, SuiJsonRpcClient } from '@mysten/sui/jsonRpc'; import { act, renderHook, waitFor } from '@testing-library/react'; import { useSuiClientInfiniteQuery } from '../../src/hooks/useSuiClientInfiniteQuery.js'; @@ -8,7 +8,10 @@ import { createWalletProviderContextWrapper } from '../test-utils.js'; describe('useSuiClientInfiniteQuery', () => { it('should fetch data', async () => { - const suiClient = new SuiClient({ url: getFullnodeUrl('mainnet') }); + const suiClient = new SuiJsonRpcClient({ + url: getJsonRpcFullnodeUrl('mainnet'), + network: 'mainnet', + }); const wrapper = createWalletProviderContextWrapper({}, suiClient); const queryTransactionBlocks = vi.spyOn(suiClient, 'queryTransactionBlocks'); diff --git a/packages/dapp-kit/test/hooks/useSuiClientMutation.test.tsx b/packages/dapp-kit/test/hooks/useSuiClientMutation.test.tsx index e9293af14..f419b330b 100644 --- a/packages/dapp-kit/test/hooks/useSuiClientMutation.test.tsx +++ b/packages/dapp-kit/test/hooks/useSuiClientMutation.test.tsx @@ -1,6 +1,6 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { getFullnodeUrl, SuiClient } from '@mysten/sui/client'; +import { getJsonRpcFullnodeUrl, SuiJsonRpcClient } from '@mysten/sui/jsonRpc'; import { act, renderHook, waitFor } from '@testing-library/react'; import { useSuiClientMutation } from '../../src/hooks/useSuiClientMutation.js'; @@ -8,7 +8,10 @@ import { createWalletProviderContextWrapper } from '../test-utils.js'; describe('useSuiClientMutation', () => { it('should fetch data', async () => { - const suiClient = new SuiClient({ url: getFullnodeUrl('mainnet') }); + const suiClient = new SuiJsonRpcClient({ + url: getJsonRpcFullnodeUrl('mainnet'), + network: 'mainnet', + }); const wrapper = createWalletProviderContextWrapper({}, suiClient); const queryTransactionBlocks = vi.spyOn(suiClient, 'queryTransactionBlocks'); diff --git a/packages/dapp-kit/test/hooks/useSuiClientQueries.test.tsx b/packages/dapp-kit/test/hooks/useSuiClientQueries.test.tsx index 2dbfacc31..c042bd976 100644 --- a/packages/dapp-kit/test/hooks/useSuiClientQueries.test.tsx +++ b/packages/dapp-kit/test/hooks/useSuiClientQueries.test.tsx @@ -1,6 +1,6 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { getFullnodeUrl, SuiClient } from '@mysten/sui/client'; +import { getJsonRpcFullnodeUrl, SuiJsonRpcClient } from '@mysten/sui/jsonRpc'; import { renderHook, waitFor } from '@testing-library/react'; import { useSuiClientQueries } from '../../src/hooks/useSuiClientQueries.js'; @@ -21,7 +21,10 @@ const MOCK_QUERY_TRANSACTION_BLOCK_RESULT_DATA = { }; describe('useSuiClientQueries', () => { - const suiClient = new SuiClient({ url: getFullnodeUrl('mainnet') }); + const suiClient = new SuiJsonRpcClient({ + url: getJsonRpcFullnodeUrl('mainnet'), + network: 'mainnet', + }); const wrapper = createWalletProviderContextWrapper({}, suiClient); test('should fetch data', async () => { const getAllBalances = vi.spyOn(suiClient, 'getAllBalances'); diff --git a/packages/dapp-kit/test/hooks/useSuiClientQuery.test.tsx b/packages/dapp-kit/test/hooks/useSuiClientQuery.test.tsx index 457d41920..290056e28 100644 --- a/packages/dapp-kit/test/hooks/useSuiClientQuery.test.tsx +++ b/packages/dapp-kit/test/hooks/useSuiClientQuery.test.tsx @@ -1,6 +1,6 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { getFullnodeUrl, SuiClient } from '@mysten/sui/client'; +import { getJsonRpcFullnodeUrl, SuiJsonRpcClient } from '@mysten/sui/jsonRpc'; import { renderHook, waitFor } from '@testing-library/react'; import { useSuiClientQuery } from '../../src/hooks/useSuiClientQuery.js'; @@ -8,7 +8,10 @@ import { createWalletProviderContextWrapper } from '../test-utils.js'; describe('useSuiClientQuery', () => { it('should fetch data', async () => { - const suiClient = new SuiClient({ url: getFullnodeUrl('mainnet') }); + const suiClient = new SuiJsonRpcClient({ + url: getJsonRpcFullnodeUrl('mainnet'), + network: 'mainnet', + }); const wrapper = createWalletProviderContextWrapper({}, suiClient); const queryTransactionBlocks = vi.spyOn(suiClient, 'queryTransactionBlocks'); diff --git a/packages/dapp-kit/test/mocks/mockFeatures.ts b/packages/dapp-kit/test/mocks/mockFeatures.ts index 27da03be9..e34689a62 100644 --- a/packages/dapp-kit/test/mocks/mockFeatures.ts +++ b/packages/dapp-kit/test/mocks/mockFeatures.ts @@ -39,8 +39,4 @@ export const suiFeatures: SuiFeatures = { version: '2.0.0', signAndExecuteTransaction: vi.fn(), }, - 'sui:reportTransactionEffects': { - version: '1.0.0', - reportTransactionEffects: vi.fn(), - }, }; diff --git a/packages/dapp-kit/test/test-utils.tsx b/packages/dapp-kit/test/test-utils.tsx index 997b5cc26..3a8c2f4bb 100644 --- a/packages/dapp-kit/test/test-utils.tsx +++ b/packages/dapp-kit/test/test-utils.tsx @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { getFullnodeUrl, SuiClient } from '@mysten/sui/client'; +import { getJsonRpcFullnodeUrl, SuiJsonRpcClient } from '@mysten/sui/jsonRpc'; import type { IdentifierRecord, ReadonlyWalletAccount } from '@mysten/wallet-standard'; import { getWallets } from '@mysten/wallet-standard'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; @@ -12,7 +12,7 @@ import { SuiClientProvider } from '../src/index.js'; import { createMockAccount } from './mocks/mockAccount.js'; import { MockWallet } from './mocks/mockWallet.js'; -export function createSuiClientContextWrapper(client: SuiClient) { +export function createSuiClientContextWrapper(client: SuiJsonRpcClient) { return function SuiClientContextWrapper({ children }: { children: React.ReactNode }) { return {children}; }; @@ -20,7 +20,10 @@ export function createSuiClientContextWrapper(client: SuiClient) { export function createWalletProviderContextWrapper( providerProps: Omit, 'children'> = {}, - suiClient: SuiClient = new SuiClient({ url: getFullnodeUrl('localnet') }), + suiClient: SuiJsonRpcClient = new SuiJsonRpcClient({ + url: getJsonRpcFullnodeUrl('localnet'), + network: 'localnet', + }), ) { const queryClient = new QueryClient(); return function WalletProviderContextWrapper({ children }: { children: React.ReactNode }) { diff --git a/packages/dapp-kit/vitest.config.mts b/packages/dapp-kit/vitest.config.mts index 1fb810ed3..214c9a36d 100644 --- a/packages/dapp-kit/vitest.config.mts +++ b/packages/dapp-kit/vitest.config.mts @@ -23,7 +23,7 @@ export default defineConfig({ '@mysten/utils': new URL('../utils/src', import.meta.url).pathname, '@mysten/sui/keypairs/ed25519': new URL('../typescript/src/keypairs/ed25519', import.meta.url) .pathname, - '@mysten/sui/client': new URL('../typescript/src/client', import.meta.url).pathname, + '@mysten/sui/jsonRpc': new URL('../typescript/src/jsonRpc', import.meta.url).pathname, '@mysten/sui/utils': new URL('../typescript/src/utils', import.meta.url).pathname, '@mysten/sui/transactions': new URL('../typescript/src/transactions', import.meta.url) .pathname, diff --git a/packages/deepbook-v3/examples/accountOpenOrders.ts b/packages/deepbook-v3/examples/accountOpenOrders.ts index 9a3945318..752633316 100644 --- a/packages/deepbook-v3/examples/accountOpenOrders.ts +++ b/packages/deepbook-v3/examples/accountOpenOrders.ts @@ -1,6 +1,6 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { getFullnodeUrl, SuiClient } from '@mysten/sui/client'; +import { getJsonRpcFullnodeUrl, SuiJsonRpcClient } from '@mysten/sui/jsonRpc'; import { DeepBookClient } from '../src/index.js'; // Adjust import source accordingly @@ -18,8 +18,8 @@ import { DeepBookClient } from '../src/index.js'; // Adjust import source accord const dbClient = new DeepBookClient({ address: '0x0', env: env, - client: new SuiClient({ - url: getFullnodeUrl(env), + client: new SuiJsonRpcClient({ + url: getJsonRpcFullnodeUrl(env), }), balanceManagers: balanceManagers, }); diff --git a/packages/deepbook-v3/examples/accountOrderMap.ts b/packages/deepbook-v3/examples/accountOrderMap.ts index 23fce3b0b..0f68e0332 100644 --- a/packages/deepbook-v3/examples/accountOrderMap.ts +++ b/packages/deepbook-v3/examples/accountOrderMap.ts @@ -1,6 +1,6 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { getFullnodeUrl, SuiClient } from '@mysten/sui/client'; +import { getJsonRpcFullnodeUrl, SuiJsonRpcClient } from '@mysten/sui/jsonRpc'; import { DeepBookClient } from '../src/index.js'; // Adjust import source accordingly @@ -19,8 +19,8 @@ import { DeepBookClient } from '../src/index.js'; // Adjust import source accord const dbClient = new DeepBookClient({ address: '0x0', env: env, - client: new SuiClient({ - url: getFullnodeUrl(env), + client: new SuiJsonRpcClient({ + url: getJsonRpcFullnodeUrl(env), }), balanceManagers: balanceManagers, }); diff --git a/packages/deepbook-v3/examples/balance.ts b/packages/deepbook-v3/examples/balance.ts index e292316cc..4b9930fbe 100644 --- a/packages/deepbook-v3/examples/balance.ts +++ b/packages/deepbook-v3/examples/balance.ts @@ -1,6 +1,6 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { getFullnodeUrl, SuiClient } from '@mysten/sui/client'; +import { getJsonRpcFullnodeUrl, SuiJsonRpcClient } from '@mysten/sui/jsonRpc'; import { DeepBookClient } from '../src/index.js'; // Adjust import source accordingly @@ -18,8 +18,8 @@ import { DeepBookClient } from '../src/index.js'; // Adjust import source accord const dbClient = new DeepBookClient({ address: '0x0', env: env, - client: new SuiClient({ - url: getFullnodeUrl(env), + client: new SuiJsonRpcClient({ + url: getJsonRpcFullnodeUrl(env), }), balanceManagers: balanceManagers, }); diff --git a/packages/deepbook-v3/examples/deepbookMarketMaker.ts b/packages/deepbook-v3/examples/deepbookMarketMaker.ts index 5c463f792..99430b84c 100644 --- a/packages/deepbook-v3/examples/deepbookMarketMaker.ts +++ b/packages/deepbook-v3/examples/deepbookMarketMaker.ts @@ -1,6 +1,6 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import { getFullnodeUrl, SuiClient } from '@mysten/sui/client'; +import { getJsonRpcFullnodeUrl, SuiJsonRpcClient } from '@mysten/sui/jsonRpc'; import { decodeSuiPrivateKey } from '@mysten/sui/cryptography'; import type { Keypair } from '@mysten/sui/cryptography'; import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519'; @@ -11,7 +11,7 @@ import type { BalanceManager } from '../src/types/index.js'; export class DeepBookMarketMaker extends DeepBookClient { keypair: Keypair; - suiClient: SuiClient; + suiClient: SuiJsonRpcClient; constructor( keypair: string | Keypair, @@ -32,16 +32,16 @@ export class DeepBookMarketMaker extends DeepBookClient { super({ address: address, env: env, - client: new SuiClient({ - url: getFullnodeUrl(env), + client: new SuiJsonRpcClient({ + url: getJsonRpcFullnodeUrl(env), }), balanceManagers: balanceManagers, adminCap: adminCap, }); this.keypair = resolvedKeypair; - this.suiClient = new SuiClient({ - url: getFullnodeUrl(env), + this.suiClient = new SuiJsonRpcClient({ + url: getJsonRpcFullnodeUrl(env), }); } diff --git a/packages/deepbook-v3/src/client.ts b/packages/deepbook-v3/src/client.ts index 81216bf21..bca9b0f3f 100644 --- a/packages/deepbook-v3/src/client.ts +++ b/packages/deepbook-v3/src/client.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { bcs } from '@mysten/sui/bcs'; import { Account, Order, OrderDeepPrice, VecSet } from './types/bcs.js'; -import type { SuiClient } from '@mysten/sui/client'; +import type { SuiJsonRpcClient } from '@mysten/sui/jsonRpc'; import { Transaction } from '@mysten/sui/transactions'; import { normalizeSuiAddress } from '@mysten/sui/utils'; @@ -32,7 +32,7 @@ import { PoolProxyContract } from './transactions/poolProxy.js'; * DeepBookClient class for managing DeepBook operations. */ export class DeepBookClient { - client: SuiClient; + client: SuiJsonRpcClient; #config: DeepBookConfig; #address: string; balanceManager: BalanceManagerContract; @@ -48,7 +48,7 @@ export class DeepBookClient { poolProxy: PoolProxyContract; /** - * @param {SuiClient} client SuiClient instance + * @param {SuiJsonRpcClient} client SuiJsonRpcClient instance * @param {string} address Address of the client * @param {Environment} env Environment configuration * @param {Object.} [balanceManagers] Optional initial BalanceManager map @@ -71,7 +71,7 @@ export class DeepBookClient { marginAdminCap, marginMaintainerCap, }: { - client: SuiClient; + client: SuiJsonRpcClient; address: string; env: Environment; balanceManagers?: { [key: string]: BalanceManager }; diff --git a/packages/deepbook-v3/src/pyth/pyth.ts b/packages/deepbook-v3/src/pyth/pyth.ts index 305ae520b..3dbf81414 100644 --- a/packages/deepbook-v3/src/pyth/pyth.ts +++ b/packages/deepbook-v3/src/pyth/pyth.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { bcs } from '@mysten/sui/bcs'; -import type { SuiClient } from '@mysten/sui/client'; +import type { SuiJsonRpcClient } from '@mysten/sui/jsonRpc'; import type { Transaction } from '@mysten/sui/transactions'; import { coinWithBalance } from '@mysten/sui/transactions'; import { fromBase64, fromHex, parseStructTag } from '@mysten/sui/utils'; @@ -31,11 +31,11 @@ export class SuiPythClient { #priceFeedObjectIdCache: Map> = new Map(); #priceTableInfo?: Promise<{ id: ObjectId; fieldType: ObjectId }>; #baseUpdateFee?: Promise; - provider: SuiClient; + provider: SuiJsonRpcClient; pythStateId: ObjectId; wormholeStateId: ObjectId; - constructor(provider: SuiClient, pythStateId: ObjectId, wormholeStateId: ObjectId) { + constructor(provider: SuiJsonRpcClient, pythStateId: ObjectId, wormholeStateId: ObjectId) { this.provider = provider; this.pythStateId = pythStateId; this.wormholeStateId = wormholeStateId; diff --git a/packages/deepbook/.prettierignore b/packages/deepbook/.prettierignore index b0894a4b7..09f1d001d 100644 --- a/packages/deepbook/.prettierignore +++ b/packages/deepbook/.prettierignore @@ -7,3 +7,4 @@ yarn-error.log* .swc/ out/ CHANGELOG.md +test/e2e/data diff --git a/packages/deepbook/src/client.ts b/packages/deepbook/src/client.ts index ab4993997..c66d04865 100644 --- a/packages/deepbook/src/client.ts +++ b/packages/deepbook/src/client.ts @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 import { bcs } from '@mysten/sui/bcs'; -import type { OrderArguments, PaginatedEvents, PaginationArguments } from '@mysten/sui/client'; -import { getFullnodeUrl, SuiClient } from '@mysten/sui/client'; +import type { OrderArguments, PaginatedEvents, PaginationArguments } from '@mysten/sui/jsonRpc'; +import { getJsonRpcFullnodeUrl, SuiJsonRpcClient } from '@mysten/sui/jsonRpc'; import type { Argument, TransactionObjectInput, TransactionResult } from '@mysten/sui/transactions'; import { Transaction } from '@mysten/sui/transactions'; import { @@ -44,7 +44,10 @@ export class DeepBookClient { * @param currentAddress (optional) address of the current user (default: DUMMY_ADDRESS) */ constructor( - public suiClient: SuiClient = new SuiClient({ url: getFullnodeUrl('testnet') }), + public suiClient: SuiJsonRpcClient = new SuiJsonRpcClient({ + url: getJsonRpcFullnodeUrl('testnet'), + network: 'testnet', + }), public accountCap: string | undefined = undefined, public currentAddress: string = DUMMY_ADDRESS, private clientOrderId: number = 0, diff --git a/packages/deepbook/src/types/index.ts b/packages/deepbook/src/types/index.ts index d02e87336..8eea9af29 100644 --- a/packages/deepbook/src/types/index.ts +++ b/packages/deepbook/src/types/index.ts @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -import type { EventId } from '@mysten/sui/client'; +import type { EventId } from '@mysten/sui/jsonRpc'; export * from './bcs.js'; diff --git a/packages/deepbook/test/e2e/setup.ts b/packages/deepbook/test/e2e/setup.ts index 5d31cb5fd..2d10d2365 100644 --- a/packages/deepbook/test/e2e/setup.ts +++ b/packages/deepbook/test/e2e/setup.ts @@ -7,8 +7,8 @@ import type { SuiObjectChangeCreated, SuiObjectChangePublished, SuiTransactionBlockResponse, -} from '@mysten/sui/client'; -import { getFullnodeUrl, SuiClient } from '@mysten/sui/client'; +} from '@mysten/sui/jsonRpc'; +import { getJsonRpcFullnodeUrl, SuiJsonRpcClient } from '@mysten/sui/jsonRpc'; import { FaucetRateLimitError, getFaucetHost, requestSuiFromFaucetV2 } from '@mysten/sui/faucet'; import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519'; import { Transaction } from '@mysten/sui/transactions'; @@ -22,17 +22,17 @@ import type { PoolSummary } from '../../src/types/index.js'; import { FLOAT_SCALING_FACTOR, NORMALIZED_SUI_COIN_TYPE } from '../../src/utils/index.js'; const DEFAULT_FAUCET_URL = process.env.FAUCET_URL ?? getFaucetHost('localnet'); -const DEFAULT_FULLNODE_URL = process.env.FULLNODE_URL ?? getFullnodeUrl('localnet'); +const DEFAULT_FULLNODE_URL = process.env.FULLNODE_URL ?? getJsonRpcFullnodeUrl('localnet'); export const DEFAULT_TICK_SIZE = 1n * FLOAT_SCALING_FACTOR; export const DEFAULT_LOT_SIZE = 1n; export class TestToolbox { keypair: Ed25519Keypair; - client: SuiClient; + client: SuiJsonRpcClient; configPath: string; - constructor(keypair: Ed25519Keypair, client: SuiClient, configPath: string) { + constructor(keypair: Ed25519Keypair, client: SuiJsonRpcClient, configPath: string) { this.keypair = keypair; this.client = client; this.configPath = configPath; @@ -47,8 +47,8 @@ export class TestToolbox { } } -export function getClient(): SuiClient { - return new SuiClient({ +export function getClient(): SuiJsonRpcClient { + return new SuiJsonRpcClient({ url: DEFAULT_FULLNODE_URL, }); } diff --git a/packages/docs/content/dapp-kit/index.mdx b/packages/docs/content/dapp-kit/index.mdx index 2054949f9..a094302d3 100644 --- a/packages/docs/content/dapp-kit/index.mdx +++ b/packages/docs/content/dapp-kit/index.mdx @@ -32,13 +32,13 @@ respective pages. ```tsx import { createNetworkConfig, SuiClientProvider, WalletProvider } from '@mysten/dapp-kit'; -import { getFullnodeUrl } from '@mysten/sui/client'; +import { getJsonRpcFullnodeUrl } from '@mysten/sui/jsonRpc'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; // Config options for the networks you want to connect to const { networkConfig } = createNetworkConfig({ - localnet: { url: getFullnodeUrl('localnet') }, - mainnet: { url: getFullnodeUrl('mainnet') }, + localnet: { url: getJsonRpcFullnodeUrl('localnet') }, + mainnet: { url: getJsonRpcFullnodeUrl('mainnet') }, }); const queryClient = new QueryClient(); diff --git a/packages/docs/content/dapp-kit/sui-client-provider.mdx b/packages/docs/content/dapp-kit/sui-client-provider.mdx index 1c1fb277b..96703cb14 100644 --- a/packages/docs/content/dapp-kit/sui-client-provider.mdx +++ b/packages/docs/content/dapp-kit/sui-client-provider.mdx @@ -2,25 +2,25 @@ title: SuiClientProvider --- -The `SuiClientProvider` manages the active `SuiClient` that hooks and components use in the dApp -Kit. +The `SuiClientProvider` manages the active `SuiJsonRpcClient` that hooks and components use in the +dApp Kit. ## Usage Place the `SuiClientProvider` at the root of your app and wrap all components that use the dApp Kit hooks. -`SuiClientProvider` accepts a list of network configurations to create `SuiClient` instances for the -currently active network. +`SuiClientProvider` accepts a list of network configurations to create `SuiJsonRpcClient` instances +for the currently active network. ```tsx import { createNetworkConfig, SuiClientProvider, WalletProvider } from '@mysten/dapp-kit'; -import { getFullnodeUrl } from '@mysten/sui/client'; +import { getJsonRpcFullnodeUrl } from '@mysten/sui/jsonRpc'; // Config options for the networks you want to connect to const { networkConfig } = createNetworkConfig({ - localnet: { url: getFullnodeUrl('localnet') }, - mainnet: { url: getFullnodeUrl('mainnet') }, + localnet: { url: getJsonRpcFullnodeUrl('localnet') }, + mainnet: { url: getJsonRpcFullnodeUrl('mainnet') }, }); function App() { @@ -35,15 +35,15 @@ function App() { ## Props - `networks`: A map of networks you can use. The keys are the network names, and the values can be - either a configuration object (`SuiClientOptions`) or a `SuiClient` instance. + either a configuration object (`SuiClientOptions`) or a `SuiJsonRpcClient` instance. - `defaultNetwork`: The name of the network to use by default when using the `SuiClientProvider` as an uncontrolled component. - `network`: The name of the network to use when using the `SuiClientProvider` as a controlled component. - `onNetworkChange`: A callback when the active network changes. -- `createClient`: A callback when a new `SuiClient` is created (for example, when the active network - changes). It receives the network name and configuration object as arguments, returning a - `SuiClient` instance. +- `createClient`: A callback when a new `SuiJsonRpcClient` is created (for example, when the active + network changes). It receives the network name and configuration object as arguments, returning a + `SuiJsonRpcClient` instance. ## Controlled component @@ -51,13 +51,13 @@ The following example demonstrates a `SuiClientProvider` used as a controlled co ```tsx import { createNetworkConfig, SuiClientProvider } from '@mysten/dapp-kit'; -import { getFullnodeUrl } from '@mysten/sui/client'; +import { getJsonRpcFullnodeUrl } from '@mysten/sui/jsonRpc'; import { useState } from 'react'; // Config options for the networks you want to connect to const { networkConfig } = createNetworkConfig({ - localnet: { url: getFullnodeUrl('localnet') }, - mainnet: { url: getFullnodeUrl('mainnet') }, + localnet: { url: getJsonRpcFullnodeUrl('localnet') }, + mainnet: { url: getJsonRpcFullnodeUrl('mainnet') }, }); function App() { @@ -77,18 +77,18 @@ function App() { } ``` -## SuiClient customization +## SuiJsonRpcClient customization -The following example demonstrates how to create a custom `SuiClient`. +The following example demonstrates how to create a custom `SuiJsonRpcClient`. ```tsx import { SuiClientProvider } from '@mysten/dapp-kit'; -import { getFullnodeUrl, SuiClient, SuiHTTPTransport } from '@mysten/sui/client'; +import { getJsonRpcFullnodeUrl, SuiJsonRpcClient, SuiHTTPTransport } from '@mysten/sui/jsonRpc'; // Config options for the networks you want to connect to const networks = { - localnet: { url: getFullnodeUrl('localnet') }, - mainnet: { url: getFullnodeUrl('mainnet') }, + localnet: { url: getJsonRpcFullnodeUrl('localnet') }, + mainnet: { url: getJsonRpcFullnodeUrl('mainnet') }, } satisfies Record; function App() { @@ -97,7 +97,7 @@ function App() { networks={networks} defaultNetwork="localnet" createClient={(network, config) => { - return new SuiClient({ + return new SuiJsonRpcClient({ transport: new SuiHTTPTransport({ url: 'https://api.safecoin.org', rpc: { @@ -115,9 +115,9 @@ function App() { } ``` -## Using the SuiClient from the provider +## Using the SuiJsonRpcClient from the provider -To use the `SuiClient` from the provider, import the `useSuiClient` function from the +To use the `SuiJsonRpcClient` from the provider, import the `useSuiClient` function from the `@mysten/dapp-kit` module. ```tsx @@ -166,19 +166,19 @@ to get the variables defined in your configuration. ```tsx import { createNetworkConfig, SuiClientProvider, WalletProvider } from '@mysten/dapp-kit'; -import { getFullnodeUrl } from '@mysten/sui/client'; +import { getJsonRpcFullnodeUrl } from '@mysten/sui/jsonRpc'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; // Config options for the networks you want to connect to const { networkConfig, useNetworkVariable } = createNetworkConfig({ localnet: { - url: getFullnodeUrl('localnet'), + url: getJsonRpcFullnodeUrl('localnet'), variables: { myMovePackageId: '0x123', }, }, mainnet: { - url: getFullnodeUrl('mainnet'), + url: getJsonRpcFullnodeUrl('mainnet'), variables: { myMovePackageId: '0x456', }, diff --git a/packages/docs/content/dapp-kit/wallet-hooks/_meta.json b/packages/docs/content/dapp-kit/wallet-hooks/_meta.json index 12f0853d8..b275c19d5 100644 --- a/packages/docs/content/dapp-kit/wallet-hooks/_meta.json +++ b/packages/docs/content/dapp-kit/wallet-hooks/_meta.json @@ -9,6 +9,5 @@ "useSwitchAccount": "useSwitchAccount", "useSignPersonalMessage": "useSignPersonalMessage", "useSignTransaction": "useSignTransaction", - "useSignAndExecuteTransaction": "useSignAndExecuteTransaction", - "useReportTransactionEffects": "useReportTransactionEffects" + "useSignAndExecuteTransaction": "useSignAndExecuteTransaction" } diff --git a/packages/docs/content/dapp-kit/wallet-hooks/useReportTransactionEffects.mdx b/packages/docs/content/dapp-kit/wallet-hooks/useReportTransactionEffects.mdx deleted file mode 100644 index 6f31e5f8c..000000000 --- a/packages/docs/content/dapp-kit/wallet-hooks/useReportTransactionEffects.mdx +++ /dev/null @@ -1,58 +0,0 @@ ---- -title: useReportTransactionEffects ---- - -import { UseSignTransactionExample } from '../../../examples/wallet-hooks'; - -Use the `useReportTransactionEffects` hook can be used to report the effects of a transaction to the -connected wallet. The `useSignAndExecuteTransaction` hook automatically reports effects, and the -`useSignTransaction` hook provides a `reportTransactionEffects` callback to report effects manually, -so this hook is only needed when using a non-standard flow for executing transactions. - -```ts -import { - ConnectButton, - useCurrentAccount, - useReportTransactionEffects, - useSuiClient, -} from '@mysten/dapp-kit'; -import { toBase64 } from '@mysten/sui/utils'; -import { useState } from 'react'; - -function MyComponent() { - const { mutateAsync: reportTransactionEffects } = useReportTransactionEffects(); - const [signature, setSignature] = useState(''); - const client = useSuiClient(); - const currentAccount = useCurrentAccount(); - - return ( -
- - {currentAccount && ( - <> -
- -
-
Signature: {signature}
- - )} -
- ); -} -``` - -## Arguments - -- `effects`: The effects of an executed transaction. This can either be the `rawEffects` returned - from the JSON-RPC `executeTransactionBlock` method (returned when showRawEffects is set to true), - or the `effects.bcs` when executing with the GraphQL API. -- `chain`: (optional) The chain identifier the transaction was executed on. -- `account` (optional) the account that signed the transaction, defaults to the currently connected - account diff --git a/packages/docs/content/dapp-kit/wallet-hooks/useSignAndExecuteTransaction.mdx b/packages/docs/content/dapp-kit/wallet-hooks/useSignAndExecuteTransaction.mdx index 15c9a2bc9..9544e960f 100644 --- a/packages/docs/content/dapp-kit/wallet-hooks/useSignAndExecuteTransaction.mdx +++ b/packages/docs/content/dapp-kit/wallet-hooks/useSignAndExecuteTransaction.mdx @@ -129,5 +129,5 @@ function MyComponent() { - `execute`: (optional) A custom function to execute the transaction In addition to these options, you can also pass any options that the -[SuiClient.signAndExecuteTransaction](/typedoc/classes/_mysten_sui.client.SuiClient.html#signAndExecuteTransactionBlock) +[SuiJsonRpcClient.signAndExecuteTransaction](/typedoc/classes/_mysten_sui.client.SuiJsonRpcClient.html#signAndExecuteTransactionBlock) method accepts. diff --git a/packages/docs/content/dapp-kit/wallet-hooks/useSignTransaction.mdx b/packages/docs/content/dapp-kit/wallet-hooks/useSignTransaction.mdx index 95e6cc133..b48dbc91a 100644 --- a/packages/docs/content/dapp-kit/wallet-hooks/useSignTransaction.mdx +++ b/packages/docs/content/dapp-kit/wallet-hooks/useSignTransaction.mdx @@ -31,7 +31,7 @@ function MyComponent() {