The client to use for the transaction. AvalancheWalletCoreClient
The parameters for the transaction. PrepareSetL1ValidatorWeightTxnParameters
The unsigned transaction. PrepareSetL1ValidatorWeightTxnReturnType
https://build.avax.network/docs/api-reference/p-chain/txn-format#unsigned-set-l1-validator-weight-tx
import { prepareSetL1ValidatorWeightTxn } from "@avalanche-sdk/client/methods/wallet/pChain/prepareSetL1ValidatorWeightTxn";
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 pChainSetL1ValidatorWeightTxnRequest = await prepareSetL1ValidatorWeightTxn(walletClient, {
message: "0x1234567890123456789012345678901234567890",
});
console.log(pChainSetL1ValidatorWeightTxnRequest);
Prepares a set L1 validator weight transaction for the P-chain.