@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
35 lines • 1.51 kB
TypeScript
import { AvalancheWalletCoreClient } from "../../../clients/createAvalancheWalletCoreClient.js";
import { PrepareImportTxnParameters, PrepareImportTxnReturnType } from "./types/prepareImportTxn.js";
/**
* Prepares an import transaction for the X-chain.
*
* @see https://build.avax.network/docs/api-reference/x-chain/txn-format#unsigned-importtx
*
* @param client - The client to use for the transaction. {@link AvalancheWalletCoreClient}
* @param params - The parameters for the transaction. {@link PrepareImportTxnParameters}
* @returns The unsigned transaction. {@link PrepareImportTxnReturnType}
*
* @example
* ```ts
* 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: {
* addresses: ["P-fuji19fc97zn3mzmwr827j4d3n45refkksgms4y2yzz"],
* },
* });
*/
export declare function prepareImportTxn(client: AvalancheWalletCoreClient, params: PrepareImportTxnParameters): Promise<PrepareImportTxnReturnType>;
//# sourceMappingURL=prepareImportTxn.d.ts.map