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/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 xChainBaseTxnRequest = await prepareBaseTxn(walletClient, {
outputs: [
{
amount: 1000000000000000000,
to: "P-fuji19fc97zn3mzmwr827j4d3n45refkksgms4y2yzz",
},
],
Prepares a base transaction for the X-chain.