Skip to main content

Network

The Network configuration in octez.connect SDK allows developers to specify the blockchain network their application will interact with. This includes using predefined networks like Mainnet or Testnet, as well as defining custom networks and RPC endpoints.

Set the network when you create the DAppClient (or Taquito's BeaconWallet). Since v5, DAppClient.requestPermissions() no longer accepts a network option and throws if one is passed.

Mainnet With Custom RPC​

Example
import { DAppClient, NetworkType } from "@tezos-x/octez.connect-sdk";

// Mainnet with different rpcUrl
const dAppClient = new DAppClient({
  name: "Beacon Docs",
  network: {
    type: NetworkType.MAINNET,
    rpcUrl: "https://rpc.tzbeta.net",
  },
});

const result = await dAppClient.requestPermissions();
Loading...

Testnet​

Example
import { DAppClient, NetworkType } from "@tezos-x/octez.connect-sdk";

// Shadownet with default rpcUrl
const dAppClient = new DAppClient({
  name: "Beacon Docs",
  network: { type: NetworkType.SHADOWNET },
});

const result = await dAppClient.requestPermissions();
Loading...

Testnet With Custom RPC​

Example
import { DAppClient, NetworkType } from "@tezos-x/octez.connect-sdk";

// Shadownet with different rpcUrl
const dAppClient = new DAppClient({
  name: "Beacon Docs",
  network: {
    type: NetworkType.SHADOWNET,
    rpcUrl: "https://rpc.tzkt.io/shadownet",
  },
});

const result = await dAppClient.requestPermissions();
Loading...

Custom Network​

Example
import { DAppClient, NetworkType } from "@tezos-x/octez.connect-sdk";

// Custom network (eg. local development or latest testnet).
// Not every wallet supports custom networks.
const dAppClient = new DAppClient({
  name: "Beacon Docs",
  network: {
    type: NetworkType.CUSTOM,
    // e.g. a local node at "http://localhost:8732". Here we point to a public
    // Shadownet RPC so the example can be run as-is.
    name: "Shadownet (custom)",
    rpcUrl: "https://rpc.shadownet.teztnets.com",
  },
});

const result = await dAppClient.requestPermissions();
Loading...