The package that gives access to an Extension that allows integrating Sui blockchain functionality to our client.

Functions

SuiExtension method

SuiExtension(): Extension<ISuiExtension>
A method that, when passed to the client instance, injects the following modules into it:

sui module

Provides methods to create Sui client and signer for Sui wallets.
The reference types below are simplified for the sake of readability. See the type specification for details.
PropertyTypeDescription
getSigner(props: { wallet: Wallet }) => ISuiSignerReturns an object that can be used to prompt the user for message and transaction signing.
getNetworkUrl(props: { walletId: string }) => Promise<string>Returns the Sui fullnode URL for the network the wallet is connected to. Especially useful for creating Sui clients.
getNetworkName(props: { walletId: string }) => Promise<SuiNetworkName>Returns the name of the network the wallet is connected to.

Types

ISuiExtension type

Type of the Sui extension.
import { Transaction } from '@mysten/sui/transactions'
import { type Wallet } from '@dynamic-labs/client'

type SuiNetworkName = 'mainnet' | 'testnet' | 'devnet' | 'localnet'

type ISuiSigner = {
  signTransaction(transaction: Transaction): Promise<{ signature: string }>
  signMessage(message: string): Promise<{ signature: string }>
}

type ISuiExtension = {
  sui: {
    /**
     * Returns an object that can be used to prompt the user for message and transaction signing.
     */
    getSigner: (props: { wallet: Wallet }) => ISuiSigner

    /**
     * Returns the Sui fullnode URL for the network the wallet is connected to.
     * Especially useful for creating Sui clients.
     */
    getNetworkUrl: (props: { walletId: string }) => Promise<string>

    /**
     * Returns the name of the network the wallet is connected to.
     */
    getNetworkName: (props: { walletId: string }) => Promise<SuiNetworkName>
  }
}