Skip to main content

Network Environments

Connecting to specific network environment

When you are working on Sui development, you will need to connect to a specific Sui Full node on a Sui network.

import { SuiClient, getFullnodeUrl } from '@mysten/sui.js/client';

// create a client object connected to localnet
const client = new SuiClient({ url: getFullnodeUrl('localnet') });

Getting Test Sui

If you want to test transactions on Sui network you need first to get Sui coins in your wallet. To receive test Sui in your wallet you have to make a request to the faucet server.

import { JsonRpcProvider, devnetConnection } from "@mysten/sui.js";

// connect to Devnet
const provider = new JsonRpcProvider(devnetConnection);

// get test Sui from the DevNet faucet server
await provider.requestSuiFromFaucet(