@0xfacet/sdk
Version:
A toolkit for Facet blockchain integration.
35 lines (34 loc) • 1.81 kB
TypeScript
import { Account, Chain, Client, Hex, SendTransactionParameters, SendTransactionRequest, SendTransactionReturnType, Transport } from "viem";
/**
* Sends a transaction through the Facet protocol.
*
* This function builds a Facet transaction using the provided parameters and sends it using
* the viem client. It handles the complexities of creating L2 transactions on the Facet network.
*
* @template chain - The chain type parameter
* @template account - The account type parameter
* @template request - The request type parameter
* @template chainOverride - Optional chain override type parameter
*
* @param client - The viem client instance used to interact with the blockchain
* @param parameters - The transaction parameters, following viem's SendTransactionParameters format
* @param parameters.data - The transaction calldata
* @param parameters.to - The recipient address
* @param parameters.value - The amount of ether to send
* @param parameters.mineBoost - Optional hex to increase FCT mining amount
*
* @returns A promise that resolves to the transaction hash
*
* @throws Will throw and properly format any errors that occur during transaction sending
*
* @example
* const hash = await sendFacetTransaction(client, {
* to: '0x...',
* value: parseEther('0.1'),
* data: '0x...',
* mineBoost: '0x1' // Optional: increase FCT mining amount
* });
*/
export declare function sendFacetTransaction<chain extends Chain | undefined, account extends Account | undefined, const request extends SendTransactionRequest<chain, chainOverride>, chainOverride extends Chain | undefined = undefined>(client: Client<Transport, chain, account>, parameters: SendTransactionParameters<chain, account, chainOverride, request> & {
mineBoost?: Hex;
}): Promise<SendTransactionReturnType>;