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

Live Editor
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

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

const dAppClient = new DAppClient({
  name: "Beacon Docs",
  preferredNetwork: NetworkType.EDONET,
});

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

Testnet With Custom RPC

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

const dAppClient = new DAppClient({
  name: "Beacon Docs",
  preferredNetwork: NetworkType.EDONET,
});

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

Custom Network

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

const dAppClient = new DAppClient({
  name: "Beacon Docs",
  preferredNetwork: 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...