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

56 lines 2.57 kB
import { AvalancheWalletCoreClient } from "../../../clients/createAvalancheWalletCoreClient.js"; import { PrepareConvertSubnetToL1TxnParameters, PrepareConvertSubnetToL1TxnReturnType } from "./types/prepareConvertSubnetToL1Txn.js"; /** * Prepares a convert subnet to L1 transaction for the P-chain. * * @param client - The client to use for the transaction. {@link AvalancheWalletCoreClient} * @param params - The parameters for the transaction. {@link PrepareConvertSubnetToL1TxnParameters} * @returns The unsigned transaction. {@link PrepareConvertSubnetToL1TxnReturnType} * * @see https://build.avax.network/docs/api-reference/p-chain/txn-format#unsigned-convert-subnet-to-l1-tx * * @example * ```ts * import { prepareConvertSubnetToL1Txn } from "@avalanche-sdk/client/methods/wallet/pChain/prepareConvertSubnetToL1Txn"; * 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 pChainConvertSubnetToL1TxnRequest = await prepareConvertSubnetToL1Txn(walletClient, { * subnetId: "11111111111111111111111111111111LpoYY", * blockchainId: 1, * managerContractAddress: "0x1234567890123456789012345678901234567890", * subnetAuth: [1], * validators: [ * { * nodeId: "NodeID-7Xhw2mDxuDS44j42TCB6U5579esbSt3Lg", * weight: 1n, * initialBalanceInAvax: avaxToNanoAvax(1), * nodePoP: { * publicKey: "0x1234567890123456789012345678901234567890", * proofOfPossession: "0x1234567890123456789012345678901234567890", * }, * remainingBalanceOwner: { * addresses: ["P-fuji19fc97zn3mzmwr827j4d3n45refkksgms4y2yzz"], * threshold: 1, * }, * deactivationOwner: { * addresses: ["P-fuji19fc97zn3mzmwr827j4d3n45refkksgms4y2yzz"], * threshold: 1, * }, * }, * ], * }); * * console.log(pChainConvertSubnetToL1TxnRequest); * ``` */ export declare function prepareConvertSubnetToL1Txn(client: AvalancheWalletCoreClient, params: PrepareConvertSubnetToL1TxnParameters): Promise<PrepareConvertSubnetToL1TxnReturnType>; //# sourceMappingURL=prepareConvertSubnetToL1Txn.d.ts.map