The client to use for the transaction. AvalancheWalletCoreClient
The parameters for the transaction. PrepareBaseTxnParameters
The unsigned transaction. PrepareBaseTxnReturnType
import { prepareBaseTxn } from "@avalanche-sdk/client/methods/wallet/pChain/prepareBaseTxn";
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 pChainBaseTxnRequest = await prepareBaseTxn(walletClient, {
outputs: [{
addresses: "P-fuji19fc97zn3mzmwr827j4d3n45refkksgms4y2yzz",
amount: 1,
}],
});
console.log(pChainBaseTxnRequest);
Prepares a base transaction for the P-chain.