The client to use for the transaction. AvalancheWalletCoreClient
The parameters for the transaction. PrepareExportTxnParameters
The unsigned transaction. PrepareExportTxnReturnType
import { prepareExportTxn } from "@avalanche-sdk/client/methods/wallet/pChain/prepareExportTxn";
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 pChainExportTxnRequest = await prepareExportTxn(walletClient, {
destinationChain: "P",
exportedOutputs: [{
addresses: ["P-fuji19fc97zn3mzmwr827j4d3n45refkksgms4y2yzz"],
amount: 0.0001,
}],
Prepares an export transaction for the P-chain.