Skip to main content

Network

The Network configuration in Beacon 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.

Mainnet With Custom RPC​

Example
import { DAppClient, NetworkType } from "@airgap/beacon-sdk";

const dAppClient = new DAppClient({ name: "Beacon Docs" });

// Mainnet with different rpcUrl
const result = await dAppClient.requestPermissions({
  network: {
    type: NetworkType.MAINNET,
    rpcUrl: "https://mainnet.api.tez.ie",
  },
});
Loading...

Testnet​

Example
import { DAppClient, NetworkType } from "@airgap/beacon-sdk";

const dAppClient = new DAppClient({
  name: "Beacon Docs",
  network: { type: NetworkType.SEOULNET },
});

// Seoulnet with default rpcUrl
const result = await dAppClient.requestPermissions({
  network: {
    type: NetworkType.SEOULNET,
  },
});
Loading...

Testnet With Custom RPC​

Example
import { DAppClient, NetworkType } from "@airgap/beacon-sdk";

const dAppClient = new DAppClient({
  name: "Beacon Docs",
  network: { type: NetworkType.SEOULNET },
});

// Seoulnet with different rpcUrl
const result = await dAppClient.requestPermissions({
  network: {
    type: NetworkType.SEOULNET,
    rpcUrl: "https://testnet-tezos.giganode.io/",
  },
});
Loading...

Custom Network​

Example
import { DAppClient, NetworkType } from "@airgap/beacon-sdk";

const dAppClient = new DAppClient({
  name: "Beacon Docs",
  network: { type: NetworkType.CUSTOM },
});

// Custom network (eg. local development or latest testnet)
const result = await dAppClient.requestPermissions({
  network: {
    type: NetworkType.CUSTOM,
    name: "Local Node",
    rpcUrl: "http://localhost:8732/",
  },
});
Loading...