The client to use for the transaction. AvalancheWalletCoreClient
The parameters for the transaction. PrepareAddSubnetValidatorTxnParameters
The unsigned transaction. PrepareAddSubnetValidatorTxnReturnType
import { prepareAddSubnetValidatorTxn } from "@avalanche-sdk/client/methods/wallet/pChain/prepareAddSubnetValidatorTxn";
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 pChainAddSubnetValidatorTxnRequest = await prepareAddSubnetValidatorTxn(walletClient, {
subnetId: "11111111111111111111111111111111LpoYY",
nodeId: "NodeID-7Xhw2mDxuDS44j42TCB6U5579esbSt3Lg",
weight: 1n,
end: 1716441600n,
subnetAuth: [1],
});
console.log(pChainAddSubnetValidatorTxnRequest);
Prepares an add subnet validator transaction for the P-chain.