Avalanche SDK Client
    Preparing search index...

    Function prepareConvertSubnetToL1Txn

    • Prepares a convert subnet to L1 transaction for the P-chain.

      Parameters

      Returns Promise<PrepareConvertSubnetToL1TxnReturnType>

      The unsigned transaction. PrepareConvertSubnetToL1TxnReturnType

      import { prepareConvertSubnetToL1Txn } from "@avalanche-sdk/client/methods/wallet/pChain/prepareConvertSubnetToL1Txn";
      import { createAvalancheWalletClient } from "@avalanche-sdk/client/clients/createAvalancheWalletClient";
      import { privateKeyToAvalancheAccount } from "@avalanche-sdk/client/accounts";
      import { avalanche } from "@avalanche-sdk/client/chains";

      const account = privateKeyToAvalancheAccount("0x1234567890123456789012345678901234567890");
      const walletClient = createAvalancheWalletClient({
      account,
      chain: avalanche,
      });

      const pChainConvertSubnetToL1TxnRequest = await prepareConvertSubnetToL1Txn(walletClient, {
      subnetId: "11111111111111111111111111111111LpoYY",
      blockchainId: 1,
      managerContractAddress: "0x1234567890123456789012345678901234567890",
      subnetAuth: [1],
      validators: [
      {
      nodeId: "NodeID-7Xhw2mDxuDS44j42TCB6U5579esbSt3Lg",
      weight: 1n,
      initialBalanceInAvax: 1,
      nodePoP: {
      publicKey: "0x1234567890123456789012345678901234567890",
      proofOfPossession: "0x1234567890123456789012345678901234567890",
      },
      remainingBalanceOwner: {
      addresses: ["P-fuji19fc97zn3mzmwr827j4d3n45refkksgms4y2yzz"],
      threshold: 1,
      },
      deactivationOwner: {
      addresses: ["P-fuji19fc97zn3mzmwr827j4d3n45refkksgms4y2yzz"],
      threshold: 1,
      },
      },
      ],
      });

      console.log(pChainConvertSubnetToL1TxnRequest);