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/xChain";
import { privateKeyToAvalancheAccount } from "@avalanche-sdk/client/accounts";
import { avalanche } from "@avalanche-sdk/client/chains";
const account = privateKeyToAvalancheAccount(privateKeyForTest);
const walletClient = new AvalancheWalletCoreClient({
chain: avalanche,
transport: {
url: "https://api.avax.network/ext/bc/C/rpc",
},
account,
});
const xChainImportTxnRequest = await prepareImportTxn(walletClient, {
sourceChain: "P",
importedOutput: {
amount: 1000000000000000000,
to: "P-fuji19fc97zn3mzmwr827j4d3n45refkksgms4y2yzz",
},
Prepares an import transaction for the X-chain.