Avalanche SDK Client
    Preparing search index...

    Function getRegistrationJustification

    • Retrieves the registration justification for the given validation ID Hex and subnet ID.

      If the validation ID corresponds to a bootstrap validator, the justification bytes produced by ConvertSubnetToL1Tx are returned.

      Otherwise, the function searches the Warp logs on the chain where the validator manager is deployed to locate the RegisterL1ValidatorMessage for the specified validation ID.

      Type Parameters

      • chain extends undefined | Chain

      Parameters

      Returns Promise<GetRegistrationJustificationReturnType>

      The GetRegistrationJustificationReturnType instance.

      import { createAvalancheClient } from "@avalanche-sdk/client";
      import { getRegistrationJustification } from "@avalanche-sdk/client/methods/public";
      import { defineChain } from "@avalanche-sdk/client/chains";
      import { utils } from "@avalanche-sdk/client/utils";

      const chainConfig = defineChain({
      id: 28098,
      name: "Rough Complexity Chain",
      rpcUrls: {
      default: {
      http: [
      "https://base-url-to-your-rpc/ext/bc/28zXo5erueBemgxPjLom6Vhsm6oVyftLtfQSt61fd62SghoXrz/rpc",
      ],
      },
      },
      });

      const publicClient = createAvalancheClient({
      chain: chainConfig,
      transport: {
      type: "http",
      },
      });

      const validationIDHex = utils.bufferToHex(
      utils.base58check.decode(
      "TEwxg8JzAUsqFibtYkaiiYH9G1h5ZfX56zYURXpyaPRCSppC4"
      )
      );

      const justification = await getRegistrationJustification(publicClient, {
      validationIDHex,
      subnetIDStr: "2DN6PTi2uXNCzzNz1p2ckGcW2eqTfpt2kv2a1h7EV36hYV3XRJ",
      maxBootstrapValidators: 200,
      chunkSize: 200,
      maxChunks: 100,
      });

      console.log("justification", JSON.stringify(justification, null, 2));