@0xfacet/sdk
Version:
A toolkit for Facet blockchain integration.
29 lines (28 loc) • 1.27 kB
TypeScript
import { Address, Hex } from "viem";
import { FacetTransactionParams } from "../types";
interface L1Transaction {
account: Address;
to: Address;
value: bigint;
data: Hex;
gas: bigint;
chainId: number;
}
/**
* Sends a raw Facet transaction by preparing the transaction data and submitting it to L1.
*
* @param l1ChainId - The chain ID of the L1 network (1 for mainnet, 11155111 for Sepolia)
* @param account - The address of the account initiating the transaction
* @param params - Transaction parameters including to, value, and data
* @param sendL1Transaction - Function to send the L1 transaction and return the transaction hash
* @param l1RpcUrl - Optional L1 RPC URL
* @returns Object containing the L1 transaction hash, Facet transaction hash, FCT mint amount, and FCT mint rate
* @throws Error if L1 chain is invalid, account is missing, or L2 chain is not configured
*/
export declare const sendRawFacetTransaction: (l1ChainId: number, account: Address, params: FacetTransactionParams, sendL1Transaction: (l1Transaction: L1Transaction) => Promise<Hex>, l1RpcUrl?: string) => Promise<{
l1TransactionHash: `0x${string}`;
facetTransactionHash: `0x${string}`;
fctMintAmount: bigint;
fctMintRate: bigint;
}>;
export {};