Skip to Content
Supported NetworksSui Networks

Networks

WaaP supports standard Sui networks. You can switch between them programmatically.

Funding your Sui wallet: Bridging ETH via the Sui Bridge creates a wrapped ETH token on Sui — not native SUI. You still need native SUI for gas. To get SUI: buy on an exchange and withdraw on the Sui network, or swap bridged ETH for SUI on a DEX like Cetus (but you need SUI for the swap gas — a chicken-and-egg problem). Plan ahead and send native SUI first.

Gas costs: Sui transactions are cheap (typically less than 0.01 SUI) but not free. Reserve at least 0.2 SUI for gas when running an agent, more if the agent executes transactions frequently. Running multiple agent instances by accident can drain gas quickly.

Supported Networks

The SDK supports the following standard Sui network identifiers:

  • sui:mainnet
  • sui:testnet
  • sui:devnet

Switching Networks

You can request to switch the wallet’s active network using the sui:switchChain feature standard.

Switch Network (standard)

import { getWallets } from '@mysten/wallet-standard' const wallets = getWallets().get() const wallet = wallets.find(w => w.name === 'WaaP') if (!wallet) return try { // Request the wallet to switch its active chain await wallet.features['sui:switchChain'].switchChain({ chain: 'sui:testnet' }) } catch (error) { console.error("Failed to switch network:", error) }

Switch Network (with @mysten/dapp-kit)

When using @mysten/dapp-kit, you should coordinate the wallet switch with the dApp’s network context.

import { useCurrentWallet, useSuiClientContext } from '@mysten/dapp-kit' import { useState } from 'react' export function NetworkSwitcher() { const { currentWallet } = useCurrentWallet() const ctx = useSuiClientContext() const [isSwitching, setIsSwitching] = useState(false) const switchToTestnet = async () => { setIsSwitching(true) try { // 1. Request wallet to switch await currentWallet.features['sui:switchChain'].switchChain({ chain: 'sui:testnet' }) // 2. Update dApp context ctx.selectNetwork('testnet') console.log('Switched to testnet') } catch (e) { console.error('Failed to switch:', e) } finally { setIsSwitching(false) } } return ( <button onClick={switchToTestnet} disabled={isSwitching}> Switch to Testnet </button> ) }

Configuring Networks

Configure Networks (standard)

If you are not using @mysten/dapp-kit, you can define your network configuration and use the SuiClient directly.

import { getFullnodeUrl, SuiClient } from '@mysten/sui/client' // 1. Define your network configuration const networks = { mainnet: { url: getFullnodeUrl('mainnet') }, testnet: { url: getFullnodeUrl('testnet') }, devnet: { url: getFullnodeUrl('devnet') }, localnet: { url: 'http://127.0.0.1:9000' }, } // 2. Create a client for your desired network const client = new SuiClient({ url: networks.testnet.url })

Configure Networks (with @mysten/dapp-kit)

When using @mysten/dapp-kit, supported networks need to be defined. This configuration drives the useSuiClient and useSuiClientContext hooks.

import { createNetworkConfig, SuiClientProvider, WalletProvider } from '@mysten/dapp-kit' import { getFullnodeUrl } from '@mysten/sui/client' import { QueryClient, QueryClientProvider } from '@tanstack/react-query' // 1. Define your network configuration const { networkConfig } = createNetworkConfig({ mainnet: { url: getFullnodeUrl('mainnet') }, testnet: { url: getFullnodeUrl('testnet') }, devnet: { url: getFullnodeUrl('devnet') }, localnet: { url: 'http://127.0.0.1:9000' }, }) const queryClient = new QueryClient() export function Providers({ children }: { children: React.ReactNode }) { return ( <QueryClientProvider client={queryClient}> <SuiClientProvider networks={networkConfig} defaultNetwork="testnet"> <WalletProvider> {children} </WalletProvider> </SuiClientProvider> </QueryClientProvider> ) }
Last updated on