The client to use for the transaction. AvalancheWalletCoreClient
The parameters for the transaction. PrepareImportTxnParameters
The unsigned transaction. PrepareImportTxnReturnType
import { prepareImportTxn } from "@avalanche-sdk/client/methods/wallet/pChain/prepareImportTxn";
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 pChainImportTxnRequest = await prepareImportTxn(walletClient, {
sourceChain: "C",
importedOutput: {
addresses: ["P-fuji19fc97zn3mzmwr827j4d3n45refkksgms4y2yzz"],
},
});
console.log(pChainImportTxnRequest);
Prepares an import transaction for the P-chain.