@avalanche-sdk/client
Version:
A TypeScript SDK for interacting with the Avalanche network through JSON-RPC APIs. This SDK provides a comprehensive set of tools to interact with all Avalanche chains (P-Chain, X-Chain, C-Chain) and various APIs, including wallet functionality for transa
39 lines • 1.8 kB
TypeScript
import { AvalancheWalletCoreClient } from "../../../clients/createAvalancheWalletCoreClient.js";
import { PrepareExportTxnParameters, PrepareExportTxnReturnType } from "./types/prepareExportTxn.js";
/**
* Prepares an export transaction for the C-chain.
*
* @param client - The client to use for the transaction. {@link AvalancheWalletCoreClient}
* @param params - The parameters for the transaction. {@link PrepareExportTxnParameters}
* @returns The unsigned transaction. {@link PrepareExportTxnReturnType}
*
* @see https://build.avax.network/docs/api-reference/c-chain/txn-format#exporttx
*
* @example
* ```ts
* 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";
* import { avaxToNanoAvax } from "@avalanche-sdk/client/utils";
*
* const account = privateKeyToAvalancheAccount("0x1234567890123456789012345678901234567890");
* const walletClient = createAvalancheWalletClient({
* account,
* chain: avalanche,
* });
*
* const cChainExportTxnRequest = await prepareExportTxn(walletClient, {
* destinationChain: "P",
* fromAddress: "0x76Dd3d7b2f635c2547B861e55aE8A374E587742D",
* exportedOutput: {
* addresses: ["P-fuji19fc97zn3mzmwr827j4d3n45refkksgms4y2yzz"],
* amount: avaxToNanoAvax(0.0001),
* },
* });
*
* console.log(cChainExportTxnRequest);
* ```
*/
export declare function prepareExportTxn(client: AvalancheWalletCoreClient, params: PrepareExportTxnParameters): Promise<PrepareExportTxnReturnType>;
//# sourceMappingURL=prepareExportTxn.d.ts.map