UNPKG

@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

37 lines 1.74 kB
import { AvalancheWalletCoreClient } from "../../../clients/createAvalancheWalletCoreClient.js"; import { PrepareCreateChainTxnParameters, PrepareCreateChainTxnReturnType } from "./types/prepareCreateChainTxn.js"; /** * Prepares a create chain transaction for the P-chain. * * @param client - The client to use for the transaction. {@link AvalancheWalletCoreClient} * @param params - The parameters for the transaction. {@link PrepareCreateChainTxnParameters} * @returns The unsigned transaction. {@link PrepareCreateChainTxnReturnType} * * @see https://build.avax.network/docs/api-reference/p-chain/txn-format#unsigned-create-chain-tx * * @example * ```ts * import { prepareCreateChainTxn } from "@avalanche-sdk/client/methods/wallet/pChain/prepareCreateChainTxn"; * 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 pChainCreateChainTxnRequest = await prepareCreateChainTxn(walletClient, { * subnetId: "..", * vmId: "..", * chainName: "My Chain", * genesisData: "0x1234567890123456789012345678901234567890", * subnetAuth: [1], * }); * * console.log(pChainCreateChainTxnRequest); * ``` */ export declare function prepareCreateChainTxn(client: AvalancheWalletCoreClient, params: PrepareCreateChainTxnParameters): Promise<PrepareCreateChainTxnReturnType>; //# sourceMappingURL=prepareCreateChainTxn.d.ts.map