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/cChain/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 cChainExportTxnRequest = await prepareExportTxn(walletClient, {
destinationChain: "P",
fromAddress: "0x76Dd3d7b2f635c2547B861e55aE8A374E587742D",
exportedOutput: {
addresses: ["P-fuji19fc97zn3mzmwr827j4d3n45refkksgms4y2yzz"],
amount: 0.0001,
},
});
console.log(cChainExportTxnRequest);
Prepares an export transaction for the C-chain.