@reservoir0x/relay-kit-ui
Version:
Relay is the Fastest and Cheapest Way to Bridge and Transact Across Chains.
34 lines • 2 kB
TypeScript
import type { PublicClient } from 'viem';
import type { ChainVM } from '@reservoir0x/relay-sdk';
/**
* Calculates the gas buffer needed for a native EVM token transfer.
* This buffer is estimated based on gas price and a standard limit,
* then multiplied by a safety factor.
*
* @param publicClient - A VIEM PublicClient connected to the EVM chain.
* @param balance - The total native balance of the user (used for early exit).
* @param gasLimit - Optional: The gas limit to use for estimation (defaults to 400000n).
* @returns The calculated gas buffer amount as a bigint, or 0n if estimation fails or balance is zero.
*/
export declare const calculateEvmNativeGasBuffer: (publicClient: PublicClient, balance: bigint, gasLimit?: bigint) => Promise<bigint>;
/**
* Calculates the fee buffer needed for a native SVM (e.g., Solana) or Eclipse transaction.
* Uses specific multipliers and default fees for each type.
* Falls back to a default fee if API data is unavailable or invalid.
*
* @param chainId - The chain ID of the SVM or Eclipse network.
* @returns The calculated fee buffer amount (in lamports for Solana, Wei for Eclipse) as a bigint, or a fallback buffer if estimation fails.
*/
export declare const calculateSvmNativeFeeBuffer: (chainId: number) => Promise<bigint>;
/**
* Gets the fee buffer amount for a given chain and VM type.
* Handles caching, ongoing fetch promises, and initiates calculation if needed.
*
* @param vmType - The virtual machine type ('evm' or 'svm').
* @param chainId - The chain ID.
* @param balance - The current balance (required for EVM calculation).
* @param publicClient - VIEM PublicClient (required for EVM calculation).
* @returns A promise that resolves to the fee buffer amount as a bigint.
*/
export declare const getFeeBufferAmount: (vmType: ChainVM | undefined | null, chainId: number | undefined | null, balance: bigint, publicClient: PublicClient | null) => Promise<bigint>;
//# sourceMappingURL=nativeMaxAmount.d.ts.map