@reservoir0x/relay-kit-ui
Version:
Relay is the Fastest and Cheapest Way to Bridge and Transact Across Chains.
43 lines • 1.51 kB
TypeScript
import type { Execute, RelayChain } from '@reservoir0x/relay-sdk';
import type { Token } from '../types/index.js';
export type FormattedStep = {
id: string;
action: string;
isActive: boolean;
isCompleted: boolean;
progressState?: NonNullable<Execute['steps']['0']['items']>[0]['progressState'];
txHashes?: {
txHash: string;
chainId: number;
}[];
isWalletAction: boolean;
chainId?: number;
isApproveStep?: boolean;
};
type FormatTransactionStepsProps = {
steps: Execute['steps'] | null;
fromToken?: Token;
fromChain?: RelayChain;
toChain?: RelayChain;
operation: string;
};
/**
* formattedSteps transforms backend transaction steps into user-friendly UI steps by:
* - Tracking active/delayed/completed states
* - Adding readable action descriptions
* - Extracting transaction hashes for explorer links
* - Adding a final Relay processing step
*/
export declare const formatTransactionSteps: ({ steps, fromToken, fromChain, toChain, operation }: FormatTransactionStepsProps) => {
formattedSteps: FormattedStep[];
status: string | undefined;
};
/**
* Returns the appropriate action text for a transaction step based on its ID
* @param stepId The ID of the step
* @param operation The operation being performed (swap, bridge, etc.)
* @returns The formatted action text to display
*/
export declare function getStepActionText(stepId: string, operation: string): string;
export {};
//# sourceMappingURL=steps.d.ts.map