Polkadot Apps
    Preparing search index...
    • Create a multi-chain client with user-provided descriptors and RPC endpoints.

      Returns fully-typed APIs for each chain plus raw PolkadotClient access via .raw. Connections use host routing (via @polkadot-apps/host) when inside a container, falling back to direct WebSocket RPC.

      Results are cached by genesis-hash fingerprint — calling with the same descriptors returns the same instance.

      Type Parameters

      • const TChains extends Record<string, ChainDefinition>

      Parameters

      Returns Promise<ChainClient<TChains>>

      import { createChainClient } from "@polkadot-apps/chain-client";
      import { paseo_asset_hub } from "@polkadot-apps/descriptors/paseo-asset-hub";
      import { bulletin } from "@polkadot-apps/descriptors/bulletin";

      const client = await createChainClient({
      chains: { assetHub: paseo_asset_hub, bulletin },
      rpcs: {
      assetHub: ["wss://sys.ibp.network/asset-hub-paseo"],
      bulletin: ["wss://paseo-bulletin-rpc.polkadot.io"],
      },
      });

      // Fully typed from your descriptors
      const account = await client.assetHub.query.System.Account.getValue(addr);
      const fee = await client.bulletin.query.TransactionStorage.ByteFee.getValue();

      // Raw client for advanced use (e.g., InkSdk for contracts)
      import { createInkSdk } from "@polkadot-api/sdk-ink";
      const inkSdk = createInkSdk(client.raw.assetHub, { atBest: true });

      // Cleanup
      client.destroy();