Avalanche SDK Client
    Preparing search index...

    Function createAdminApiClient

    • Creates an Admin API Client with a given transport configured for a Chain.

      Type Parameters

      • transport extends Transport
      • chain extends undefined | Chain = undefined
      • accountOrAddress extends undefined | `0x${string}` | Account = undefined
      • rpcSchema extends undefined | RpcSchema = undefined
      • raw extends boolean = false

      Parameters

      Returns {
          alias: (args: AliasParameters) => Promise<void>;
          aliasChain: (args: AliasChainParameters) => Promise<void>;
          extend: <const client extends { [key: string]: unknown }>(
              fn: (
                  client: {
                      alias: ...;
                      aliasChain: ...;
                      extend: ...;
                      getChainAliases: ...;
                      getLoggerLevel: ...;
                      loadVMs: ...;
                      lockProfile: ...;
                      memoryProfile: ...;
                      setLoggerLevel: ...;
                      startCPUProfiler: ...;
                      stopCPUProfiler: ...;
                  },
              ) => client,
          ) => { [K in (...)
          | (...)
          | (...)]: (...)[(...)] };
          getChainAliases: (args: GetChainAliasesParameters) => Promise<GetChainAliasesReturnType>;
          getLoggerLevel: (args: GetLoggerLevelParameters) => Promise<GetLoggerLevelReturnType>;
          loadVMs: () => Promise<LoadVMsReturnType>;
          lockProfile: () => Promise<void>;
          memoryProfile: () => Promise<void>;
          setLoggerLevel: (args: SetLoggerLevelParameters) => Promise<void>;
          startCPUProfiler: () => Promise<void>;
          stopCPUProfiler: () => Promise<void>;
      }

      An Admin API Client. AdminApiClient

      • alias: (args: AliasParameters) => Promise<void>

        Assign an API endpoint an alias, a different endpoint for the API. The original endpoint will still work. This change only affects this node.

        import { createAvalancheClient} from '@avalanche-sdk/client'
        import { avalanche } from '@avalanche-sdk/client/chains'

        const client = createAvalancheClient({
        chain: avalanche,
        transport: {
        type: "http",
        },
        })

        await client.admin.alias({
        endpoint: "bc/X",
        alias: "myAlias"
        })
      • aliasChain: (args: AliasChainParameters) => Promise<void>

        Give a blockchain an alias, a different name that can be used any place the blockchain's ID is used. Note: The alias is set for each chain on each node individually.

        import { createAvalancheClient} from '@avalanche-sdk/client'
        import { avalanche } from '@avalanche-sdk/client/chains'

        const client = createAvalancheClient({
        chain: avalanche,
        transport: {
        type: "http",
        },
        })

        await client.admin.aliasChain({
        chain: "sV6o671RtkGBcno1FiaDbVcFv2sG5aVXMZYzKdP4VQAWmJQnM",
        alias: "myBlockchainAlias"
        })
      • extend: <const client extends { [key: string]: unknown }>(
            fn: (
                client: {
                    alias: ...;
                    aliasChain: ...;
                    extend: ...;
                    getChainAliases: ...;
                    getLoggerLevel: ...;
                    loadVMs: ...;
                    lockProfile: ...;
                    memoryProfile: ...;
                    setLoggerLevel: ...;
                    startCPUProfiler: ...;
                    stopCPUProfiler: ...;
                },
            ) => client,
        ) => { [K in (...)
        | (...)
        | (...)]: (...)[(...)] }
      • getChainAliases: (args: GetChainAliasesParameters) => Promise<GetChainAliasesReturnType>
        import { createAvalancheClient} from '@avalanche-sdk/client'
        import { avalanche } from '@avalanche-sdk/client/chains'

        const client = createAvalancheClient({
        chain: avalanche,
        transport: {
        type: "http",
        },
        })

        const aliases = await client.admin.getChainAliases({
        chain: "sV6o671RtkGBcno1FiaDbVcFv2sG5aVXMZYzKdP4VQAWmJQnM"
        })
      • getLoggerLevel: (args: GetLoggerLevelParameters) => Promise<GetLoggerLevelReturnType>

        Returns log and display levels of loggers.

        import { createAvalancheClient} from '@avalanche-sdk/client'
        import { avalanche } from '@avalanche-sdk/client/chains'

        const client = createAvalancheClient({
        chain: avalanche,
        transport: {
        type: "http",
        },
        })

        const loggerLevels = await client.admin.getLoggerLevel({
        loggerName: "C"
        })
      • loadVMs: () => Promise<LoadVMsReturnType>

        Dynamically loads any virtual machines installed on the node as plugins.

        import { createAvalancheClient} from '@avalanche-sdk/client'
        import { avalanche } from '@avalanche-sdk/client/chains'

        const client = createAvalancheClient({
        chain: avalanche,
        transport: {
        type: "http",
        },
        })

        const vms = await client.admin.loadVMs()
      • lockProfile: () => Promise<void>

        Writes a profile of mutex statistics to lock.profile.

        import { createAvalancheClient} from '@avalanche-sdk/client'
        import { avalanche } from '@avalanche-sdk/client/chains'

        const client = createAvalancheClient({
        chain: avalanche,
        transport: {
        type: "http",
        },
        })

        await client.admin.lockProfile()
      • memoryProfile: () => Promise<void>

        Writes a memory profile of the node to mem.profile.

        import { createAvalancheClient} from '@avalanche-sdk/client'
        import { avalanche } from '@avalanche-sdk/client/chains'

        const client = createAvalancheClient({
        chain: avalanche,
        transport: {
        type: "http",
        },
        })

        await client.admin.memoryProfile()
      • setLoggerLevel: (args: SetLoggerLevelParameters) => Promise<void>
        import { createAvalancheClient} from '@avalanche-sdk/client'
        import { avalanche } from '@avalanche-sdk/client/chains'

        const client = createAvalancheClient({
        chain: avalanche,
        transport: {
        type: "http",
        },
        })

        await client.admin.setLoggerLevel({
        loggerName: "C",
        logLevel: "DEBUG",
        displayLevel: "INFO"
        })
      • startCPUProfiler: () => Promise<void>

        Start profiling the CPU utilization of the node. To stop, call stopCPUProfiler. On stop, writes the profile to cpu.profile.

        import { createAvalancheClient} from '@avalanche-sdk/client'
        import { avalanche } from '@avalanche-sdk/client/chains'

        const client = createAvalancheClient({
        chain: avalanche,
        transport: {
        type: "http",
        },
        })

        await client.admin.startCPUProfiler()
      • stopCPUProfiler: () => Promise<void>

        Stop the CPU profile that was previously started.

        import { createAvalancheClient} from '@avalanche-sdk/client'
        import { avalanche } from '@avalanche-sdk/client/chains'

        const client = createAvalancheClient({
        chain: avalanche,
        transport: {
        type: "http",
        },
        })

        await client.admin.stopCPUProfiler()
      import { createAdminApiClient} from '@avalanche-sdk/client'
      import { avalanche } from '@avalanche-sdk/client/chains'

      const client = createAdminApiClient({
      chain: avalanche,
      transport: {
      type: "http",
      url: "https://api.avax.network/ext/admin",
      },
      })

      // Set endpoint alias
      const alias = await client.alias({ endpoint: "bc/X", alias: "myAlias" })