Migrate to version 0.38.0
The 1.0 release of the SDK contains many additional changes. This document may help help as an intermediate step when upgrading from older versions of the SDK, but all apps should be upgraded to the latest version of the SDK instead of 0.38.0.
The Sui TypeScript SDK was refactored beginning with version 0.38.0. If you are updating from an earlier version of the SDK, there are some changes you should consider when updating your code.
Module structure
The Sui TypeScript SDK is now divided into modular components. Before version 0.38.0, you imported the complete SDK module. Now, you upload the individual packages of the SDK module instead. See the Module Packages section for the list of packages.
Deprecated classes
The Sui TypeScript SDK deprecates the following classes with version 0.38.0:
JsonRpcProvider- TheJsonRpcProviderclass is deprecated in favor of thesuiClientclass when creating a client for a Sui network. See Network Interactions with SuiClient for more information.SignerWithProverandRawSigner- Key pairs now directly support signing transactions and messages without the need of aSignerclass. See the Key pairs topic for more information.signAndExecuteTransaction- This method was not deprecated, but is now part ofSuiClient.Connectionclasses - TheConnectionclasses (Connection,devnetConnection, and so on) have been deprecated in favor of usingsuiClientfor establishing the connection. See Network Interactions with SuiClient for more information.- The
superstructtype definitions forJsonRPCProvidertypes are replaced with generated types exported from@mysten/sui/client. The new type definitions are pure TypeScript types that you can't use for runtime validation. - A more stable JSON-RPC API has reduced the need for many of the SDK "getter" methods, which are now deprecated.
Signing transactions
Signing and sending transactions changes slightly with the deprecation of the Signer pattern. For
an example of transaction signing, see the
Sui Programmable Transaction Blocks Basics topic.
Faucet requests
The ability to request SUI from a faucet is not part of SuiClient as it was with
JsonRpcProvider. Instead, you must use the requestSuiFromFaucetV0 method from
@mysten/sui/faucet. The @mysten/sui/faucet import also provides a getFaucetHost method to
retrieve the faucet URL for localnet, testnet, or devnet networks.
import { getFaucetHost, requestSuiFromFaucetV0 } from '@mysten/sui/faucet';
await requestSuiFromFaucetV0({
host: getFaucetHost('devnet'),
recipient: '<SUI_ADDRESS>',
});