The client to use for the transaction. AvalancheWalletCoreClient
The parameters for the transaction. PrepareAddPermissionlessDelegatorTxnParameters
The unsigned transaction. PrepareAddPermissionlessDelegatorTxnReturnType
import { prepareAddPermissionlessDelegatorTxn } from "@avalanche-sdk/client/methods/wallet/pChain/prepareAddPermissionlessDelegatorTxn";
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 pChainAddPermissionlessDelegatorTxnRequest = await prepareAddPermissionlessDelegatorTxn(walletClient, {
nodeId: "NodeID-7Xhw2mDxuDS44j42TCB6U5579esbSt3Lg",
stakeInAvax: 1,
end: 1716441600,
rewardAddresses: ["P-fuji19fc97zn3mzmwr827j4d3n45refkksgms4y2yzz"],
threshold: 1,
});
console.log(pChainAddPermissionlessDelegatorTxnRequest);
Prepares an add permissionless delegator transaction for the P-chain.